}
public void monitor(final String experimentId) throws Exception {
AiravataAPI airavataAPI = AiravataAPIFactory.getAPI(new URI(getRegistryURL()), getGatewayName(), getUserName(),
new PasswordCallbackImpl());
final Monitor experimentMonitor = airavataAPI.getExecutionManager().getExperimentMonitor(experimentId,
new EventDataListenerAdapter() {
public void notify(EventDataRepository eventDataRepo, EventData eventData) {
Assert.assertNotNull(eventDataRepo);
Assert.assertNotNull(eventData);
if (MonitorUtil.EventType.WORKFLOW_TERMINATED.equals(eventData.getType())) {
try {
BaseCaseIT.this.verifyOutput(experimentId, "echo_output=Airavata_Test");
} catch (Exception e) {
log.error("Error verifying output", e);
Assert.fail("Error occurred while verifying output.");
} finally {
getMonitor().stopMonitoring();
}
}
log.info("No of events: " + eventDataRepo.getEvents().size());
}
});
experimentMonitor.startMonitoring();
experimentMonitor.waitForCompletion();
}