Search in sources :

Example 16 with TJob

use of io.elastest.etm.model.TJob in project elastest-torm by elastest.

the class TJobApiItTest method testGetTJobs.

@Test
public void testGetTJobs() {
    log.info("Start the test testGetTJobs");
    List<TJob> tJobsToGet = new ArrayList<>();
    for (int i = 0; i < 3; i++) {
        tJobsToGet.add(createTJob(projectId));
    }
    log.debug("GET /tjob");
    ResponseEntity<TJob[]> response = httpClient.getForEntity("/api/tjob", TJob[].class);
    TJob[] tJobs = response.getBody();
    for (TJob tjob : tJobs) {
        deleteTJob(tjob.getId());
    }
    log.info("TJobs Array size:" + tJobs.length);
    assertTrue(tJobs.length > 0);
}
Also used : ArrayList(java.util.ArrayList) TJob(io.elastest.etm.model.TJob) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 17 with TJob

use of io.elastest.etm.model.TJob in project elastest-torm by elastest.

the class TJobServiceTest method createTJobTest.

// @Mock TJobRepository tJobRepository;
// 
// @InjectMocks
// private TJobService tJobService;
// @BeforeEach
// void setUp(@Autowired TJobService tJobService ){
// this.tJobService = tJobService;
// }
@Test
public void createTJobTest(@Autowired TJob tJob, @Mock TJobRepository tJobRepo, @Mock TJobExecOrchestratorService epmIntegrationService, @Mock TJobExecRepository tJobExecRepo, @Mock EsmService esmService) {
    // TJob createdTJob =
    when(tJobRepo.save(tJob)).thenReturn(tJob);
    TJobService tJobService = new TJobService(tJobRepo, tJobExecRepo, epmIntegrationService, esmService);
    TJob tJob1 = tJobService.createTJob(tJob);
    System.out.println("ImageName:" + tJob1.getImageName());
    assertNotNull(tJob1.getId());
    assertAll("Validating Project Properties", () -> assertTrue(tJob1.getName().equals("SimpleTest")), () -> assertTrue(tJob1.getProject().getName().equals("TestProject1")));
}
Also used : TJobService(io.elastest.etm.service.TJobService) TJob(io.elastest.etm.model.TJob) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

TJob (io.elastest.etm.model.TJob)17 TJobExecution (io.elastest.etm.model.TJobExecution)6 Test (org.junit.jupiter.api.Test)6 Project (io.elastest.etm.model.Project)5 SutSpecification (io.elastest.etm.model.SutSpecification)4 ArrayList (java.util.ArrayList)4 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)4 HttpEntity (org.springframework.http.HttpEntity)4 HttpHeaders (org.springframework.http.HttpHeaders)4 Bind (com.github.dockerjava.api.model.Bind)2 Volume (com.github.dockerjava.api.model.Volume)2 Parameter (io.elastest.etm.model.Parameter)2 ExternalTJob (io.elastest.etm.model.external.ExternalTJob)2 HashMap (java.util.HashMap)2 HTTPException (javax.xml.ws.http.HTTPException)2 JsonView (com.fasterxml.jackson.annotation.JsonView)1 CreateContainerCmd (com.github.dockerjava.api.command.CreateContainerCmd)1 CreateContainerResponse (com.github.dockerjava.api.command.CreateContainerResponse)1 DockerClientException (com.github.dockerjava.api.exception.DockerClientException)1 InternalServerErrorException (com.github.dockerjava.api.exception.InternalServerErrorException)1