change restapi testcase to find build problem.

This commit is contained in:
astroshim 2015-11-30 17:12:37 +09:00
parent 5bb2c5e6e9
commit 8002cd5766
2 changed files with 24 additions and 3 deletions

View file

@ -311,12 +311,20 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
paragraph.setText("%md This is test paragraph.");
note.persist();
String noteID = note.getId();
// Call Run Notebook Jobs REST API
PostMethod postNoteJobs = httpPost("/notebook/job/" + noteID, "");
// wait until job is finished or timeout.
int timeout = 1;
while (paragraph.getStatus() == Status.PENDING || !paragraph.isTerminated()) {
Thread.sleep(1000);
if (timeout++ > 10) {
LOG.info("testNoteJobs timeout job.");
break;
}
}
assertThat("test notebook jobs run:", postNoteJobs, isAccepted());
postNoteJobs.releaseConnection();
Thread.sleep(1000);
// Call Stop Notebook Jobs REST API
DeleteMethod deleteNoteJobs = httpDelete("/notebook/job/" + noteID);
@ -352,9 +360,19 @@ public class ZeppelinRestApiTest extends AbstractTestRestApi {
String jsonRequest = "{\"cron\":\"* * * * * ?\" }";
// right cron expression but not exist note.
PostMethod postCron = httpPost("/notebook/cron/notexistnote", jsonRequest);
// wait until job is finished or timeout.
int timeout = 1;
while (paragraph.getStatus() == Status.PENDING || !paragraph.isTerminated()) {
Thread.sleep(1000);
if (timeout++ > 10) {
LOG.info("testNoteJobs timeout job.");
break;
}
}
assertThat("", postCron, isNotFound());
postCron.releaseConnection();
Thread.sleep(1000);
// right cron expression.
postCron = httpPost("/notebook/cron/" + note.getId(), jsonRequest);

View file

@ -334,10 +334,13 @@ public class Note implements Serializable, JobListener {
Paragraph p = getParagraph(paragraphId);
p.setNoteReplLoader(replLoader);
p.setListener(jobListenerFactory.getParagraphJobListener(this));
logger.info("Note Run Paragraph=" + p);
Interpreter intp = replLoader.get(p.getRequiredReplName());
logger.info("Note Run intp=" + intp);
if (intp == null) {
throw new InterpreterException("Interpreter " + p.getRequiredReplName() + " not found");
}
logger.info("Note Run intp=" + intp);
intp.getScheduler().submit(p);
}