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