Search in sources :

Example 1 with ExternalJob

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()));
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) HttpEntity(org.springframework.http.HttpEntity) ExternalJob(io.elastest.etm.api.model.ExternalJob) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with ExternalJob

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;
    }
}
Also used : ExternalTJobExecution(io.elastest.etm.model.external.ExternalTJobExecution) TJobExecution(io.elastest.etm.model.TJobExecution) ExternalJob(io.elastest.etm.api.model.ExternalJob)

Example 3 with 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());
}
Also used : ExternalJob(io.elastest.etm.api.model.ExternalJob) Test(org.junit.jupiter.api.Test)

Example 4 with ExternalJob

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"));
}
Also used : ExternalJob(io.elastest.etm.api.model.ExternalJob) Test(org.junit.jupiter.api.Test)

Aggregations

ExternalJob (io.elastest.etm.api.model.ExternalJob)4 Test (org.junit.jupiter.api.Test)3 TJobExecution (io.elastest.etm.model.TJobExecution)1 ExternalTJobExecution (io.elastest.etm.model.external.ExternalTJobExecution)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1 HttpEntity (org.springframework.http.HttpEntity)1 HttpHeaders (org.springframework.http.HttpHeaders)1