use of net.geoprism.registry.etl.ETLService in project geoprism-registry by terraframe.
the class SchedulerTestUtils method waitUntilStatus.
@Request
public static void waitUntilStatus(String histId, AllJobStatus status) throws InterruptedException {
int waitTime = 0;
while (true) {
JobHistory hist = JobHistory.get(histId);
if (hist.getStatus().get(0) == status) {
break;
} else if (hist.getStatus().get(0) == AllJobStatus.SUCCESS || hist.getStatus().get(0) == AllJobStatus.FAILURE || hist.getStatus().get(0) == AllJobStatus.FEEDBACK || hist.getStatus().get(0) == AllJobStatus.CANCELED || hist.getStatus().get(0) == AllJobStatus.STOPPED || hist.getStatus().get(0) == AllJobStatus.WARNING) {
String extra = "";
if (hist.getStatus().get(0).equals(AllJobStatus.FEEDBACK)) {
extra = new ETLService().getImportErrors(Session.getCurrentSession().getOid(), hist.getOid(), false, 10, 1).toString();
String validationProblems = new ETLService().getValidationProblems(Session.getCurrentSession().getOid(), hist.getOid(), false, 10, 1).toString();
extra = extra + " " + validationProblems;
}
Assert.fail("Job has a finished status [" + hist.getStatus().get(0) + "] which is not what we expected. " + extra);
}
Thread.sleep(10);
waitTime += 10;
if (waitTime > 200000) {
String extra = "";
if (hist.getStatus().get(0).equals(AllJobStatus.FEEDBACK)) {
extra = new ETLService().getImportErrors(Session.getCurrentSession().getOid(), hist.getOid(), false, 10, 1).toString();
String validationProblems = new ETLService().getValidationProblems(Session.getCurrentSession().getOid(), hist.getOid(), false, 10, 1).toString();
extra = extra + " " + validationProblems;
}
Assert.fail("Job was never scheduled (status is " + hist.getStatus().get(0).getEnumName() + "). " + extra);
return;
}
}
Thread.sleep(100);
waitTime += 100;
}
Aggregations