Search in sources :

Example 16 with SutSpecification

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);
}
Also used : SutSpecification(io.elastest.etm.model.SutSpecification)

Example 17 with SutSpecification

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);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) SutSpecification(io.elastest.etm.model.SutSpecification)

Example 18 with SutSpecification

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

Example 19 with SutSpecification

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

Example 20 with SutSpecification

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

Aggregations

SutSpecification (io.elastest.etm.model.SutSpecification)23 SutExecution (io.elastest.etm.model.SutExecution)9 Test (org.junit.jupiter.api.Test)7 TJob (io.elastest.etm.model.TJob)4 TJobExecution (io.elastest.etm.model.TJobExecution)4 ArrayList (java.util.ArrayList)4 DockerContainer (io.elastest.epm.client.json.DockerContainerInfo.DockerContainer)3 Parameter (io.elastest.etm.model.Parameter)3 IOException (java.io.IOException)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 HttpEntity (org.springframework.http.HttpEntity)3 HttpHeaders (org.springframework.http.HttpHeaders)3 Container (com.github.dockerjava.api.model.Container)2 Project (io.elastest.etm.model.Project)2 CreateContainerCmd (com.github.dockerjava.api.command.CreateContainerCmd)1 DockerClientException (com.github.dockerjava.api.exception.DockerClientException)1 InternalServerErrorException (com.github.dockerjava.api.exception.InternalServerErrorException)1 NotFoundException (com.github.dockerjava.api.exception.NotFoundException)1 NotModifiedException (com.github.dockerjava.api.exception.NotModifiedException)1 Bind (com.github.dockerjava.api.model.Bind)1