Search in sources :

Example 1 with ExternalTJob

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

the class TestLinkService method syncProjectTestPlan.

public void syncProjectTestPlan(TestPlan testPlan, ExternalProject externalProject) {
    ExternalTJob externalTJob = new ExternalTJob(new Long(0));
    externalTJob.setExProject(externalProject);
    externalTJob.setName(testPlan.getName());
    externalTJob.setExternalId(testPlan.getId().toString());
    externalTJob.setExternalSystemId(this.getSystemId());
    try {
        externalTJob = externalTJobRepository.save(externalTJob);
    } catch (DataIntegrityViolationException existException) {
        ExternalTJob savedTJob = externalTJobRepository.findByExternalIdAndExternalSystemId(externalTJob.getExternalId(), externalTJob.getExternalSystemId());
        externalTJob.setId(savedTJob.getId());
        externalTJob.setSut(savedTJob.getSut());
        externalTJob.setExecDashboardConfig(savedTJob.getExecDashboardConfig());
        externalTJob = externalTJobRepository.save(externalTJob);
    }
    this.syncTestPlanCases(testPlan.getId(), externalTJob);
}
Also used : ExternalTJob(io.elastest.etm.model.external.ExternalTJob) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException)

Example 2 with ExternalTJob

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

the class ExternalService method createExternalTJobExecutionByExternalTJobId.

public ExternalTJobExecution createExternalTJobExecutionByExternalTJobId(Long exTJobId) {
    ExternalTJob exTJob = this.externalTJobRepository.findById(exTJobId);
    ExternalTJobExecution exec = new ExternalTJobExecution();
    exec.setExTJob(exTJob);
    exec.setStartDate(new Date());
    this.externalTJobExecutionRepository.save(exec);
    exec.generateMonitoringIndex();
    exec = this.externalTJobExecutionRepository.save(exec);
    SupportService eus = this.startEus();
    if (eus != null) {
        String instanceId = utilTools.generateUniqueId();
        esmService.provisionExternalTJobExecServiceInstanceAsync(eus.getId(), exec, instanceId);
        exec.getEnvVars().put("EUS_ID", eus.getId());
        exec.getEnvVars().put("EUS_INSTANCE_ID", instanceId);
        exec = this.externalTJobExecutionRepository.save(exec);
    }
    elasticsearchService.createMonitoringIndex(exec.getMonitoringIndicesList());
    return exec;
}
Also used : SupportService(io.elastest.etm.model.SupportService) ExternalTJob(io.elastest.etm.model.external.ExternalTJob) ExternalTJobExecution(io.elastest.etm.model.external.ExternalTJobExecution) Date(java.util.Date)

Aggregations

ExternalTJob (io.elastest.etm.model.external.ExternalTJob)2 SupportService (io.elastest.etm.model.SupportService)1 ExternalTJobExecution (io.elastest.etm.model.external.ExternalTJobExecution)1 Date (java.util.Date)1 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1