use of io.elastest.etm.api.model.ExternalJob in project elastest-torm by elastest.
the class ExternalApiItTest method testCreateExternalJob.
@Test
public void testCreateExternalJob() {
log.info("Start the test testCreateTJob");
String requestJson = "{ \"jobName\" : \"ExternalJobName\" }";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<String>(requestJson, headers);
log.info("POST /api/external/tjob");
ResponseEntity<ExternalJob> response = httpClient.postForEntity("/api/external/tjob", entity, ExternalJob.class);
if (response.getStatusCode() != HttpStatus.OK) {
log.warn("Error creating external Job: " + response);
}
log.info("TJob created:" + response.getBody());
assertAll("Validating tJob Properties", () -> assertTrue(response.getBody().getJobName().equals("ExternalJobName")), () -> assertNotNull(response.getBody().gettJobExecId()));
}
use of io.elastest.etm.api.model.ExternalJob in project elastest-torm by elastest.
the class ExternalService method isReadyTJobForExternalExecution.
public ExternalJob isReadyTJobForExternalExecution(Long tJobExecId) {
ExternalJob externalJob = runningExternalJobs.get(tJobExecId);
if (externalJob.getTSServices() != null && externalJob.getTSServices().size() > 0) {
TJobExecution tJobExecution = tJobService.getTJobExecById(externalJob.gettJobExecId());
if (tJobExecution.getEnvVars() != null && !tJobExecution.getEnvVars().isEmpty()) {
externalJob.setEnvVars(tJobExecution.getEnvVars());
externalJob.setReady(true);
return externalJob;
} else {
externalJob.setReady(false);
return externalJob;
}
} else {
externalJob.setReady(true);
return externalJob;
}
}
use of io.elastest.etm.api.model.ExternalJob in project elastest-torm by elastest.
the class ModelsTest method testEqualsExternalJobs.
@Test
public void testEqualsExternalJobs() {
ExternalJob extJob1 = new ExternalJob("Job1", "htt://localhost:8090", "http://localhost:8090", 1L, "9200", "192.168.1.1", null, null, 0, false);
ExternalJob extJob2 = new ExternalJob("Job1", "htt://localhost:8090", "http://localhost:8090", 1L, "9200", "192.168.1.1", null, null, 0, false);
assertTrue(extJob1.equals(extJob2));
assertEquals(extJob1.hashCode(), extJob2.hashCode());
}
use of io.elastest.etm.api.model.ExternalJob in project elastest-torm by elastest.
the class ModelsTest method testCreateExternalJob.
@Test
public void testCreateExternalJob() {
ExternalJob extJob = new ExternalJob("Job1", "htt://localhost:8090", "http://localhost:8090", 1L, "9200", "192.168.1.1", null, null, 0, false);
assertTrue(extJob.getJobName().equals("Job1"));
}
Aggregations