use of io.elastest.etm.model.SutSpecification in project elastest-torm by elastest.
the class SutService method deleteSut.
public void deleteSut(Long sutId) {
SutSpecification sut = sutRepository.findOne(sutId);
if (sut.isInstrumentalize()) {
this.eimService.deInstrumentalizeAndUnDeployBeats(sut.getEimConfig(), sut.getEimMonitoringConfig());
}
sutRepository.delete(sut);
}
use of io.elastest.etm.model.SutSpecification in project elastest-torm by elastest.
the class SutService method undeploySut.
public void undeploySut(Long sutId, Long sutExecId) {
SutSpecification sut = sutRepository.findOne(sutId);
SutExecution sutExec = sutExecutionRepository.findByIdAndSutSpecification(sutExecId, sut);
sutExec.setDeployStatus(SutExecution.DeployStatusEnum.UNDEPLOYED);
sutExecutionRepository.save(sutExec);
}
use of io.elastest.etm.model.SutSpecification in project elastest-torm by elastest.
the class SutApiItTest method testCreateSut.
@Test
public void testCreateSut() {
log.info("Start the test testCreateSutSpecification");
String requestJson = "{" + "\"description\": \"This is a SuT description example\"," + "\"id\": 0," + "\"name\": \"sut_definition_1\"," + "\"project\": { \"id\":" + projectId + "}," + "\"specification\": \"https://github.com/EduJGURJC/springbootdemo\"," + "\"sutType\": \"REPOSITORY\"," + "\"instrumentalize\": \"" + false + "\"," + "\"currentSutExec\": \"" + null + "\"," + "\"instrumentedBy\": \"" + InstrumentedByEnum.WITHOUT + "\"," + "\"port\": \"" + null + "\"," + "\"managedDockerType\": \"" + ManagedDockerType.IMAGE + "\"," + "\"commandsOption\": \"" + CommandsOptionEnum.DEFAULT + "\"" + "}";
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(requestJson, headers);
log.info("POST /api/sut");
ResponseEntity<SutSpecification> response = httpClient.postForEntity("/api/sut", entity, SutSpecification.class);
log.info("Sut creation response: " + response);
assertEquals(HttpStatus.OK, response.getStatusCode());
deleteSut(response.getBody().getId());
assertAll("Validating sutSpecification Properties", () -> assertTrue(response.getBody().getName().equals("sut_definition_1")), () -> assertNotNull(response.getBody().getId()), () -> assertTrue(response.getBody().getId() > 0));
}
use of io.elastest.etm.model.SutSpecification in project elastest-torm by elastest.
the class SutApiItTest method testModifySut.
@Test
public void testModifySut() {
log.info("Start the test testModifySut");
SutSpecification sutSpec = createSut(projectId);
sutSpec.setName("sut_definition_2");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
log.info("Sut to modify:" + sutSpec.toString());
String requestJson = "{" + "\"description\": \"" + sutSpec.getDescription() + "\"," + "\"id\": " + sutSpec.getId() + "," + "\"name\": \"" + sutSpec.getName() + "\"," + "\"project\": { \"id\":" + sutSpec.getProject().getId() + "}," + "\"specification\": \"" + sutSpec.getSpecification() + "\"," + "\"sutType\": \"" + sutSpec.getSutType() + "\"," + "\"instrumentalize\": \"" + false + "\"," + "\"currentSutExec\": \"" + null + "\"," + "\"instrumentedBy\": \"" + InstrumentedByEnum.WITHOUT + "\"," + "\"port\": \"" + null + "\"," + "\"managedDockerType\": \"" + ManagedDockerType.IMAGE + "\"," + "\"commandsOption\": \"" + CommandsOptionEnum.DEFAULT + "\"" + "}";
HttpEntity<String> entity = new HttpEntity<String>(requestJson, headers);
log.info("PUT /api/sut");
httpClient.put("/api/sut", entity, SutSpecification.class);
SutSpecification sutSpecModified = getSutById(sutSpec.getId());
deleteSut(sutSpec.getId());
assertAll("Validating sutSpecification Properties", () -> assertTrue(sutSpecModified.getName().equals("sut_definition_2")), () -> assertNotNull(sutSpecModified.getId()), () -> assertTrue(sutSpecModified.getId() > 0));
}
use of io.elastest.etm.model.SutSpecification in project elastest-torm by elastest.
the class ModelsTest method testCreateSutExecution.
@Test
public void testCreateSutExecution() {
SutExecution sutExec = new SutExecution(1L, new SutSpecification(), "http://localhost:8090", DeployStatusEnum.DEPLOYING);
assertTrue(sutExec.getId() == 1L);
}
Aggregations