Package jetbrains.buildServer.serverSide

Examples of jetbrains.buildServer.serverSide.BuildStatistics


        }
    }

    protected void handleBuildFinished(SRunningBuild build, SBuildFeatureDescriptor feature) {
        final Map<String, String> parameters = feature.getParameters();
        final BuildStatistics fullBuildStatistics = build.getFullStatistics();

        // prepare the endpoint authentication
        final GoogleClientSecrets secrets = new GoogleClientSecrets().setInstalled(
                new GoogleClientSecrets.Details().
                        setClientId(parameters.get(constants.getApplicationClientId())).
                        setClientSecret(parameters.get(constants.getApplicationClientSecret()))
        );

        final Credential credential = new GoogleCredential.Builder().
                setJsonFactory(jsonFactory).
                setClientSecrets(secrets).
                setTransport(httpTransport).
                build();

        credential.setAccessToken(parameters.get(constants.getApplicationAccessToken()));
        credential.setRefreshToken(parameters.get(constants.getApplicationRefreshToken()));

        // build the test report
        final Reports reports = new Reports.Builder(httpTransport, jsonFactory, credential).
                setApplicationName(constants.getApplicationName()).
                build();

        final String buildTypeExternalId = build.getBuildTypeExternalId();
        final Integer buildNumber = Integer.valueOf(build.getBuildNumber());

        final TestReport testReport = new TestReport().
                setBuildTypeId(buildTypeExternalId).
                setBuildId(buildNumber).
                setBuildDate(new DateTime(build.getStartDate())).
                setBuildDuration(build.getDuration()).
                setNumberOfFailedTests(fullBuildStatistics.getFailedTestCount()).
                setNumberOfIgnoredTests(fullBuildStatistics.getIgnoredTestCount()).
                setNumberOfPassedTests(fullBuildStatistics.getPassedTestCount());

        final List<Test> failedTests = new ArrayList<>();
        for (STestRun oneTestRun : fullBuildStatistics.getFailedTests()) {
            final STest failedTest = oneTestRun.getTest();
            final TestName failedTestName = failedTest.getName();

            failedTests.add(
                    new Test().
                            setPackageName(failedTestName.getPackageName()).
                            setClassName(failedTestName.getClassName()).
                            setMethodName(failedTestName.getTestMethodName()).
                            setError(oneTestRun.getFailureInfo().getShortStacktrace())
            );
        }
        testReport.setFailedTests(failedTests);

        final List<Test> ignoredTests = new ArrayList<>();
        for (STestRun oneTestRun : fullBuildStatistics.getIgnoredTests()) {
            final STest ignoredTest = oneTestRun.getTest();
            final TestName ignoredTestName = ignoredTest.getName();

            ignoredTests.add(
                    new Test().
View Full Code Here

TOP

Related Classes of jetbrains.buildServer.serverSide.BuildStatistics

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.