mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
ZEPPELIN-804 Refactoring registration mechanism on Interpreters
- Fixed test environments
This commit is contained in:
parent
d54f98e0ee
commit
8a90fe439a
5 changed files with 26 additions and 6 deletions
|
|
@ -39,6 +39,13 @@ public class DepInterpreterTest {
|
|||
private File tmpDir;
|
||||
private SparkInterpreter repl;
|
||||
|
||||
private Properties getTestProperties() {
|
||||
Properties p = new Properties();
|
||||
p.setProperty("zeppelin.dep.localrepo", "local-repo");
|
||||
p.setProperty("zeppelin.dep.additionalRemoteRepository", "spark-packages,http://dl.bintray.com/spark-packages/maven,false;");
|
||||
return p;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
|
||||
|
|
@ -46,7 +53,7 @@ public class DepInterpreterTest {
|
|||
|
||||
tmpDir.mkdirs();
|
||||
|
||||
Properties p = new Properties();
|
||||
Properties p = getTestProperties();
|
||||
|
||||
dep = new DepInterpreter(p);
|
||||
dep.open();
|
||||
|
|
|
|||
|
|
@ -63,6 +63,15 @@ public class SparkInterpreterTest {
|
|||
return version;
|
||||
}
|
||||
|
||||
public static Properties getSparkTestProperties() {
|
||||
Properties p = new Properties();
|
||||
p.setProperty("master", "local[*]");
|
||||
p.setProperty("spark.app.name", "Zeppelin Test");
|
||||
p.setProperty("zeppelin.spark.maxResult", "1000");
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
tmpDir = new File(System.getProperty("java.io.tmpdir") + "/ZeppelinLTest_" + System.currentTimeMillis());
|
||||
|
|
@ -71,10 +80,9 @@ public class SparkInterpreterTest {
|
|||
tmpDir.mkdirs();
|
||||
|
||||
if (repl == null) {
|
||||
Properties p = new Properties();
|
||||
intpGroup = new InterpreterGroup();
|
||||
intpGroup.put("note", new LinkedList<Interpreter>());
|
||||
repl = new SparkInterpreter(p);
|
||||
repl = new SparkInterpreter(getSparkTestProperties());
|
||||
repl.setInterpreterGroup(intpGroup);
|
||||
intpGroup.get("note").add(repl);
|
||||
repl.open();
|
||||
|
|
@ -207,8 +215,7 @@ public class SparkInterpreterTest {
|
|||
@Test
|
||||
public void shareSingleSparkContext() throws InterruptedException {
|
||||
// create another SparkInterpreter
|
||||
Properties p = new Properties();
|
||||
SparkInterpreter repl2 = new SparkInterpreter(p);
|
||||
SparkInterpreter repl2 = new SparkInterpreter(getSparkTestProperties());
|
||||
repl2.setInterpreterGroup(intpGroup);
|
||||
intpGroup.get("note").add(repl2);
|
||||
repl2.open();
|
||||
|
|
|
|||
|
|
@ -46,6 +46,10 @@ public class SparkSqlInterpreterTest {
|
|||
@Before
|
||||
public void setUp() throws Exception {
|
||||
Properties p = new Properties();
|
||||
p.putAll(SparkInterpreterTest.getSparkTestProperties());
|
||||
p.setProperty("zeppelin.spark.maxResult", "1000");
|
||||
p.setProperty("zeppelin.spark.concurrentSQL", "false");
|
||||
p.setProperty("zeppelin.spark.sql.stacktrace", "false");
|
||||
|
||||
if (repl == null) {
|
||||
|
||||
|
|
|
|||
|
|
@ -160,6 +160,8 @@ public abstract class Interpreter {
|
|||
}
|
||||
|
||||
public String getProperty(String key) {
|
||||
logger.debug("key: {}, value: {}", key, getProperty().getProperty(key));
|
||||
|
||||
return getProperty().getProperty(key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@ public class InterpreterFactory implements InterpreterGroupFactory {
|
|||
if (null != registeredInterpreter) {
|
||||
Map<String, InterpreterProperty> defaultProperties = registeredInterpreter.getProperties();
|
||||
for (String key : defaultProperties.keySet()) {
|
||||
if (!properties.containsKey(key)) {
|
||||
if (!properties.containsKey(key) && null != defaultProperties.get(key).getValue()) {
|
||||
properties.setProperty(key, defaultProperties.get(key).getValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue