Search in sources :

Example 1 with TestLinkAPIException

use of br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException in project elastest-torm by elastest.

the class TestLinkService method init.

@PostConstruct
public void init() {
    if (!etEtmTestLinkHost.equals("none")) {
        if (etEtmTestLinkServiceName.equals(etEtmTestLinkHost)) {
            etEtmTestLinkHost = etEtmTestLinkContainerName;
        }
        try {
            // Default development
            this.testLinkHost = this.dockerService.getContainerIpByNetwork(etEtmTestLinkHost, etDockerNetwork);
            this.testLinkPort = etEtmTestLinkPort;
            // If not development, start socat
            if (!etPublicHost.equals("localhost")) {
                try {
                    String testLinkIp = UtilTools.doPing(etEtmTestLinkHost);
                    logger.info("Real TestLink Ip: {}", testLinkIp);
                    SocatBindedPort socatBindedPort = dockerService.bindingPort(testLinkIp, etEtmTestLinkPort, etDockerNetwork);
                    this.testLinkHost = etPublicHost;
                    this.testLinkPort = socatBindedPort.getListenPort();
                } catch (Exception e) {
                    logger.error("Cannot get Testlink socat data", e);
                    this.testLinkHost = etEtmTestLinkHost;
                    this.testLinkPort = etEtmTestLinkPort;
                }
            }
            String url = this.getTestLinkUrl() + "/lib/api/xmlrpc/v1/xmlrpc.php";
            try {
                testlinkURL = new URL(url);
            } catch (MalformedURLException mue) {
                mue.printStackTrace();
            }
            try {
                api = new TestLinkAPI(testlinkURL, devKey);
            } catch (TestLinkAPIException te) {
                logger.error(te.getMessage());
            }
        } catch (Exception e) {
            logger.error("Cannot get TestLink container ip");
        }
    }
}
Also used : MalformedURLException(java.net.MalformedURLException) TestLinkAPIException(br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException) SocatBindedPort(io.elastest.etm.model.SocatBindedPort) DataIntegrityViolationException(org.springframework.dao.DataIntegrityViolationException) MalformedURLException(java.net.MalformedURLException) TestLinkAPIException(br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException) URL(java.net.URL) TestLinkAPI(br.eti.kinoshita.testlinkjavaapi.TestLinkAPI) PostConstruct(javax.annotation.PostConstruct)

Example 2 with TestLinkAPIException

use of br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException in project elastest-torm by elastest.

the class TestLinkService method getFullDetailedTestCases.

public TestCase[] getFullDetailedTestCases(TestCase[] testCases) {
    TestCase[] fullDetailedCases = null;
    try {
        for (TestCase currentCase : testCases) {
            currentCase = this.getFullDetailedTestCase(currentCase);
            fullDetailedCases = (TestCase[]) ArrayUtils.add(fullDetailedCases, currentCase);
        }
    } catch (TestLinkAPIException e) {
    // EMPTY
    }
    if (fullDetailedCases == null) {
        fullDetailedCases = testCases;
    }
    return fullDetailedCases;
}
Also used : ExternalTestCase(io.elastest.etm.model.external.ExternalTestCase) TestCase(br.eti.kinoshita.testlinkjavaapi.model.TestCase) TestLinkAPIException(br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException)

Example 3 with TestLinkAPIException

use of br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException in project elastest-torm by elastest.

the class TestLinkService method getPlanBuildTestCases.

public TestCase[] getPlanBuildTestCases(Integer planId) {
    TestCase[] cases = null;
    Build[] builds = this.getPlanBuilds(planId);
    if (builds != null) {
        for (Build currentBuild : builds) {
            try {
                cases = (TestCase[]) ArrayUtils.addAll(cases, this.api.getTestCasesForTestPlan(planId, null, currentBuild.getId(), null, null, null, null, null, null, null, TestCaseDetails.FULL));
            } catch (TestLinkAPIException e) {
            // EMPTY
            }
        }
    }
    return cases;
}
Also used : ExternalTestCase(io.elastest.etm.model.external.ExternalTestCase) TestCase(br.eti.kinoshita.testlinkjavaapi.model.TestCase) Build(br.eti.kinoshita.testlinkjavaapi.model.Build) TestLinkAPIException(br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException)

Aggregations

TestLinkAPIException (br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException)3 TestCase (br.eti.kinoshita.testlinkjavaapi.model.TestCase)2 ExternalTestCase (io.elastest.etm.model.external.ExternalTestCase)2 TestLinkAPI (br.eti.kinoshita.testlinkjavaapi.TestLinkAPI)1 Build (br.eti.kinoshita.testlinkjavaapi.model.Build)1 SocatBindedPort (io.elastest.etm.model.SocatBindedPort)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 PostConstruct (javax.annotation.PostConstruct)1 DataIntegrityViolationException (org.springframework.dao.DataIntegrityViolationException)1