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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations