Search in sources :

Example 1 with SutExecution

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

the class TJobExecOrchestratorService method initSut.

/**
 *******************
 */
/**
 ** SuT Methods ***
 */
/**
 * @throws Exception
 *******************
 */
public void initSut(DockerExecution dockerExec) throws Exception {
    SutSpecification sut = dockerExec.gettJobexec().getTjob().getSut();
    SutExecution sutExec;
    String sutIP = "";
    // If it's MANAGED SuT
    if (sut.getSutType() != SutTypeEnum.DEPLOYED) {
        try {
            sutExec = startManagedSut(dockerExec);
        } catch (TJobStoppedException e) {
            throw e;
        }
    } else // If it's DEPLOYED SuT
    {
        Long currentSutExecId = sut.getCurrentSutExec();
        sutExec = sutService.getSutExecutionById(currentSutExecId);
        sutIP = sut.getSpecification();
        String sutUrl = "http://" + sutIP + ":" + (sut.getPort() != null ? sut.getPort() : "");
        sutExec.setUrl(sutUrl);
        sutExec.setIp(sutIP);
    }
    dockerExec.setSutExec(sutExec);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) SutSpecification(io.elastest.etm.model.SutSpecification)

Example 2 with SutExecution

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

the class TJobExecOrchestratorService method updateSutExecDeployStatus.

public void updateSutExecDeployStatus(DockerExecution dockerExec, DeployStatusEnum status) {
    SutExecution sutExec = dockerExec.getSutExec();
    if (sutExec != null) {
        sutExec.setDeployStatus(status);
    }
    dockerExec.setSutExec(sutExec);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution)

Example 3 with SutExecution

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

the class SutServiceTest method testGetSutExecutionById.

@Test
public void testGetSutExecutionById() {
    when(sutExecutionRepository.findOne(Mockito.anyLong())).thenReturn(sutExec);
    SutExecution sutExecLocal = sutService.getSutExecutionById(Mockito.anyLong());
    assertTrue(sutExecLocal.getId() == 1L);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) Test(org.junit.jupiter.api.Test)

Example 4 with SutExecution

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

the class SutServiceTest method testCreateSutExecutionById.

@Test
public void testCreateSutExecutionById() {
    when(sutRepository.findOne(Mockito.anyLong())).thenReturn(sut);
    when(sutExecutionRepository.save(Mockito.any(SutExecution.class))).thenReturn(sutExec);
    SutExecution sutExec = sutService.createSutExecutionById(1L);
    assertTrue(sutExec.getSutSpecification().getId() == this.sut.getId());
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) Test(org.junit.jupiter.api.Test)

Example 5 with SutExecution

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

the class ModelsTest method executionTest.

@Test
public void executionTest() {
    Project project = new Project(3l, "name", new ArrayList<TJob>(), new ArrayList<SutSpecification>());
    SutSpecification sut = new SutSpecification(34l, "name", "specification", "description", project, new ArrayList<>(), SutTypeEnum.REPOSITORY, false, null, InstrumentedByEnum.WITHOUT, null, ManagedDockerType.IMAGE, CommandsOptionEnum.DEFAULT);
    TJob tjob = new TJob(34l, "name", "imageName", sut, project, false, "execDashboardConfig", null);
    List<Parameter> params = new ArrayList<>();
    params.add(new Parameter(45l, "param1", "value1", tjob, null));
    tjob.setParameters(params);
    TJobExecution exec = new TJobExecution(45l, 34543534l, ResultEnum.SUCCESS);
    List<Parameter> paramsExec = new ArrayList<>();
    paramsExec.add(new Parameter(45l, "param1", "value1", tjob, exec));
    exec.setParameters(paramsExec);
    TJobExecution exec2 = new TJobExecution(45l, 34543534l, ResultEnum.SUCCESS);
    List<Parameter> paramsExec2 = new ArrayList<>();
    paramsExec2.add(new Parameter(45l, "param1", "value1", tjob, exec2));
    exec2.setParameters(paramsExec2);
    exec.setTjob(tjob);
    exec2.setTjob(tjob);
    SutExecution sutExec = new SutExecution(45l, sut, "ssss", DeployStatusEnum.DEPLOYED);
    SutExecution sutExec2 = new SutExecution(45l, sut, "ssss", DeployStatusEnum.DEPLOYED);
    exec.setSutExecution(sutExec);
    exec2.setSutExecution(sutExec2);
    assertEquals(exec, exec2);
    assertEquals(exec.hashCode(), exec2.hashCode());
}
Also used : Project(io.elastest.etm.model.Project) TJobExecution(io.elastest.etm.model.TJobExecution) SutExecution(io.elastest.etm.model.SutExecution) ArrayList(java.util.ArrayList) Parameter(io.elastest.etm.model.Parameter) SutSpecification(io.elastest.etm.model.SutSpecification) TJob(io.elastest.etm.model.TJob) Test(org.junit.jupiter.api.Test)

Aggregations

SutExecution (io.elastest.etm.model.SutExecution)18 SutSpecification (io.elastest.etm.model.SutSpecification)9 Test (org.junit.jupiter.api.Test)8 EimMonitoringConfig (io.elastest.etm.model.EimMonitoringConfig)2 TJobExecution (io.elastest.etm.model.TJobExecution)2 ArrayList (java.util.ArrayList)2 Parameter (io.elastest.etm.model.Parameter)1 Project (io.elastest.etm.model.Project)1 TJob (io.elastest.etm.model.TJob)1 IOException (java.io.IOException)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1