Search in sources :

Example 6 with SutExecution

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

the class ModelsTest method testEqualsSutExecution.

@Test
public void testEqualsSutExecution() {
    SutExecution sutExec1 = new SutExecution(1L, new SutSpecification(), "http://localhost:8090", DeployStatusEnum.DEPLOYING);
    SutExecution sutExec2 = new SutExecution(1L, new SutSpecification(), "http://localhost:8090", DeployStatusEnum.DEPLOYING);
    assertTrue(sutExec1.equals(sutExec2));
    assertEquals(sutExec1.hashCode(), sutExec2.hashCode());
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) SutSpecification(io.elastest.etm.model.SutSpecification) Test(org.junit.jupiter.api.Test)

Example 7 with SutExecution

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

the class SutService method createSutExecutionBySut.

public SutExecution createSutExecutionBySut(SutSpecification sut) {
    SutExecution sutExecution = new SutExecution();
    sutExecution.setSutSpecification(sut);
    sutExecution.setUrl("");
    sutExecution.setDeployStatus(SutExecution.DeployStatusEnum.DEPLOYING);
    return sutExecutionRepository.save(sutExecution);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution)

Example 8 with SutExecution

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

the class SutService method instrumentalizeSut.

public SutSpecification instrumentalizeSut(SutSpecification sut) {
    SutExecution sutExec = createSutExecutionBySut(sut);
    sut.setCurrentSutExec(sutExec.getId());
    sutExec.setUrl(sut.getSpecification());
    // Deploy beats
    EimMonitoringConfig eimMonitoringConfig = sut.getEimMonitoringConfig();
    eimMonitoringConfig.setExec(sut.getSutMonitoringIndex());
    sut.setEimMonitoringConfig(eimMonitoringConfig);
    logger.debug("Instrumentalizing SuT \"" + sut.getName() + "\"");
    this.eimService.instrumentalizeAndDeployBeats(sut.getEimConfig(), sut.getEimMonitoringConfig());
    return sut;
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) EimMonitoringConfig(io.elastest.etm.model.EimMonitoringConfig)

Example 9 with SutExecution

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

the class SutService method prepareSutToSave.

public SutSpecification prepareSutToSave(SutSpecification sut) {
    if (sut.getId() == 0) {
        // If is a new Sut, set
        if (!sut.isInstrumentedByElastest()) {
            sut.setEimMonitoringConfig(null);
        } else {
            EimMonitoringConfig savedEimMonitoringConfig = this.eimService.createEimMonitoringConfigAndChilds(sut.getEimMonitoringConfig());
            sut.setEimMonitoringConfig(savedEimMonitoringConfig);
        }
        // Save first
        sut = sutRepository.save(sut);
        SutExecution sutExec = createSutExecutionBySut(sut);
        sut.setCurrentSutExec(sutExec.getId());
        if (sut.isInstrumentalize()) {
            String[] index = { sut.getSutMonitoringIndex() };
            elasticsearchService.createMonitoringIndex(index);
            sut = this.instrumentalizeSut(sut);
        }
    } else {
        SutSpecification savedSut = sutRepository.getOne(sut.getId());
        if (sut.isInstrumentedByElastest()) {
            if (!savedSut.isInstrumentalize() && sut.isInstrumentalize()) {
                // Instrumentalize
                sut = this.instrumentalizeSut(sut);
            } else if (savedSut.isInstrumentalize() && !sut.isInstrumentalize()) {
                // Deinstrumentalize
                logger.debug("Deinstrumentalizing SuT \"" + sut.getName() + "\"");
                this.eimService.deInstrumentalizeAndUnDeployBeats(sut.getEimConfig(), sut.getEimMonitoringConfig());
            } else {
                logger.debug("SuT is already instrumentalized. No changes");
            }
        } else {
            if (savedSut.isInstrumentalize()) {
                this.eimService.deInstrumentalizeAndUnDeployBeats(sut.getEimConfig(), sut.getEimMonitoringConfig());
            }
        }
    }
    return sut;
}
Also used : SutExecution(io.elastest.etm.model.SutExecution) SutSpecification(io.elastest.etm.model.SutSpecification) EimMonitoringConfig(io.elastest.etm.model.EimMonitoringConfig)

Example 10 with SutExecution

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

the class SutService method deleteSutExec.

public void deleteSutExec(Long sutExecId) {
    SutExecution sutExec = sutExecutionRepository.findOne(sutExecId);
    sutExecutionRepository.delete(sutExec);
}
Also used : SutExecution(io.elastest.etm.model.SutExecution)

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