Search in sources :

Example 1 with ExternalTestCase

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

the class TestLinkService method syncProjectTestCase.

public void syncProjectTestCase(TestCase testCase, ExternalTJob externalTJob) {
    ExternalTestCase externalTestCase = new ExternalTestCase(new Long(0));
    externalTestCase.setExTJob(externalTJob);
    externalTestCase.setName(testCase.getName());
    externalTestCase.setFields(this.getTestCaseFields(testCase));
    externalTestCase.setExternalId(testCase.getId().toString());
    externalTestCase.setExternalSystemId(this.getSystemId());
    try {
        externalTestCase = externalTestCaseRepository.save(externalTestCase);
    } catch (DataIntegrityViolationException existException) {
        ExternalTestCase savedTestCase = externalTestCaseRepository.findByExternalIdAndExternalSystemId(externalTestCase.getExternalId(), externalTestCase.getExternalSystemId());
        externalTestCase.setId(savedTestCase.getId());
        externalTestCase = externalTestCaseRepository.save(externalTestCase);
    }
    this.syncTestCaseExecs(testCase.getId(), externalTestCase);
}
Also used : ExternalTestCase(io.elastest.etm.model.external.ExternalTestCase) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException)

Example 2 with ExternalTestCase

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

the class TestLinkService method cleanExternalTJobFromExternalTestCases.

public void cleanExternalTJobFromExternalTestCases(ExternalTJob externalTJob) {
    List<ExternalTestCase> externalTestCases = externalTestCaseRepository.findByExTJob(externalTJob);
    if (externalTestCases != null) {
        for (ExternalTestCase currentCase : externalTestCases) {
            currentCase.setExTJob(null);
            externalTestCaseRepository.save(currentCase);
        }
    }
}
Also used : ExternalTestCase(io.elastest.etm.model.external.ExternalTestCase)

Aggregations

ExternalTestCase (io.elastest.etm.model.external.ExternalTestCase)2 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1