Merge remote-tracking branch 'origin/master' into livyInterperter

This commit is contained in:
Prabhjyot Singh 2016-03-09 10:42:14 +05:30
commit ee1c9f4cfb
4 changed files with 100 additions and 36 deletions

View file

@ -481,18 +481,18 @@ public class SparkInterpreter extends Interpreter {
System.setProperty("scala.repl.name.line", "line" + this.hashCode() + "$");
/* create scala repl */
this.interpreter = new SparkILoop(null, new PrintWriter(out));
interpreter.settings_$eq(settings);
interpreter.createInterpreter();
intp = interpreter.intp();
intp.setContextClassLoader();
intp.initializeSynchronous();
synchronized (sharedInterpreterLock) {
/* create scala repl */
this.interpreter = new SparkILoop(null, new PrintWriter(out));
interpreter.settings_$eq(settings);
interpreter.createInterpreter();
intp = interpreter.intp();
intp.setContextClassLoader();
intp.initializeSynchronous();
if (classOutputDir == null) {
classOutputDir = settings.outputDirs().getSingleOutput().get();
} else {
@ -523,35 +523,35 @@ public class SparkInterpreter extends Interpreter {
sparkVersion = SparkVersion.fromVersionString(sc.version());
sqlc = getSQLContext();
}
dep = getDependencyResolver();
dep = getDependencyResolver();
z = new ZeppelinContext(sc, sqlc, null, dep,
Integer.parseInt(getProperty("zeppelin.spark.maxResult")));
z = new ZeppelinContext(sc, sqlc, null, dep,
Integer.parseInt(getProperty("zeppelin.spark.maxResult")));
intp.interpret("@transient var _binder = new java.util.HashMap[String, Object]()");
binder = (Map<String, Object>) getValue("_binder");
binder.put("sc", sc);
binder.put("sqlc", sqlc);
binder.put("z", z);
intp.interpret("@transient var _binder = new java.util.HashMap[String, Object]()");
binder = (Map<String, Object>) getValue("_binder");
binder.put("sc", sc);
binder.put("sqlc", sqlc);
binder.put("z", z);
intp.interpret("@transient val z = "
+ "_binder.get(\"z\").asInstanceOf[org.apache.zeppelin.spark.ZeppelinContext]");
intp.interpret("@transient val sc = "
+ "_binder.get(\"sc\").asInstanceOf[org.apache.spark.SparkContext]");
intp.interpret("@transient val sqlc = "
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
intp.interpret("@transient val sqlContext = "
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
intp.interpret("import org.apache.spark.SparkContext._");
intp.interpret("@transient val z = "
+ "_binder.get(\"z\").asInstanceOf[org.apache.zeppelin.spark.ZeppelinContext]");
intp.interpret("@transient val sc = "
+ "_binder.get(\"sc\").asInstanceOf[org.apache.spark.SparkContext]");
intp.interpret("@transient val sqlc = "
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
intp.interpret("@transient val sqlContext = "
+ "_binder.get(\"sqlc\").asInstanceOf[org.apache.spark.sql.SQLContext]");
intp.interpret("import org.apache.spark.SparkContext._");
if (sparkVersion.oldSqlContextImplicits()) {
intp.interpret("import sqlContext._");
} else {
intp.interpret("import sqlContext.implicits._");
intp.interpret("import sqlContext.sql");
intp.interpret("import org.apache.spark.sql.functions._");
if (sparkVersion.oldSqlContextImplicits()) {
intp.interpret("import sqlContext._");
} else {
intp.interpret("import sqlContext.implicits._");
intp.interpret("import sqlContext.sql");
intp.interpret("import org.apache.spark.sql.functions._");
}
}
/* Temporary disabling DisplayUtils. see https://issues.apache.org/jira/browse/ZEPPELIN-127

View file

@ -322,7 +322,66 @@ public class ParagraphActionsIT extends AbstractZeppelinIT {
CoreMatchers.equalTo(true));
}
} catch (Exception e) {
handleException("Exception in ParagraphActionsIT while testWidth ", e);
handleException("Exception in ParagraphActionsIT while testWidth ", e);
}
}
@Test
public void testTitleButton() throws Exception {
if (!endToEndTestEnabled()) {
return;
}
try {
createNewNote();
waitForParagraph(1, "READY");
String xpathToTitle = getParagraphXPath(1) + "//div[contains(@class, 'title')]/div";
String xpathToSettingIcon = getParagraphXPath(1) + "//span[@class='icon-settings']";
String xpathToShowTitle=getParagraphXPath(1) + "//ul/li/a[@ng-click='showTitle()']";
String xpathToHideTitle=getParagraphXPath(1) + "//ul/li/a[@ng-click='hideTitle()']";
collector.checkThat("Before Show Title : The title field contains",
driver.findElement(By.xpath(xpathToTitle)).getText(),
CoreMatchers.equalTo(""));
driver.findElement(By.xpath(xpathToSettingIcon)).click();
collector.checkThat("Before Show Title : The title option in option panel of paragraph is labeled as ",
driver.findElement(By.xpath(xpathToShowTitle)).getText(),
CoreMatchers.equalTo("Show title"));
driver.findElement(By.xpath(xpathToShowTitle)).click();
collector.checkThat("After Show Title : The title field contains",
driver.findElement(By.xpath(xpathToTitle)).getText(),
CoreMatchers.equalTo("Untitled"));
driver.findElement(By.xpath(xpathToSettingIcon)).click();
collector.checkThat("After Show Title : The title option in option panel of paragraph is labeled as",
driver.findElement(By.xpath(xpathToHideTitle)).getText(),
CoreMatchers.equalTo("Hide title"));
driver.findElement(By.xpath(xpathToHideTitle)).click();
collector.checkThat("After Hide Title : The title field contains",
driver.findElement(By.xpath(xpathToTitle)).getText(),
CoreMatchers.equalTo(""));
driver.findElement(By.xpath(xpathToSettingIcon)).click();
driver.findElement(By.xpath(xpathToShowTitle)).click();
driver.findElement(By.xpath(getParagraphXPath(1) + "//div[contains(@class, 'title')]")).click();
driver.findElement(By.xpath(getParagraphXPath(1) + "//input")).sendKeys("NEW TITLE" + Keys.ENTER);
collector.checkThat("After Editing the Title : The title field contains ",
driver.findElement(By.xpath(xpathToTitle)).getText(),
CoreMatchers.equalTo("NEW TITLE"));
driver.navigate().refresh();
ZeppelinITUtils.sleep(1000, false);
collector.checkThat("After Page Refresh : The title field contains ",
driver.findElement(By.xpath(xpathToTitle)).getText(),
CoreMatchers.equalTo("NEW TITLE"));
ZeppelinITUtils.sleep(1000, false);
deleteTestNotebook(driver);
} catch (Exception e) {
handleException("Exception in ParagraphActionsIT while testTitleButton ", e);
}
}

View file

@ -664,6 +664,7 @@ public class InterpreterFactory {
intpsetting.getInterpreterGroup().destroy();
intpsetting.setOption(option);
intpsetting.setProperties(properties);
intpsetting.setDependencies(dependencies);
InterpreterGroup interpreterGroup = createInterpreterGroup(intpsetting.id(), option);

View file

@ -129,6 +129,10 @@ public class InterpreterSetting {
return properties;
}
public void setProperties(Properties properties) {
this.properties = properties;
}
public List<Dependency> getDependencies() {
if (dependencies == null) {
return new LinkedList<Dependency>();