Package org.jfrog.build.api

Examples of org.jfrog.build.api.Build


    /**
     * Validates the build values when using the defaults
     */
    public void testDefaultBuild() {
        Build build = new BuildInfoBuilder("test").number("4").started("test").build();
        assertEquals(build.getVersion(), "1.0.1", "Unexpected default build version.");
        assertEquals(build.getNumber(), "4", "Unexpected default build number.");
        assertNull(build.getType(), "Default build type should be null.");

        assertNull(build.getAgent(), "Default build agent should be null.");

        assertEquals(build.getDurationMillis(), 0, "Default build duration millis should be zero.");
        assertNull(build.getPrincipal(), "Default build principal should be null.");
        assertNull(build.getArtifactoryPrincipal(), "Default build artifactory principal should be null.");
        assertNull(build.getUrl(), "Default build URL should be null.");
        assertNull(build.getParentName(), "Default build parent build name should be null.");
        assertNull(build.getParentNumber(), "Default build parent build number should be null.");
        assertNull(build.getModules(), "Default build modules should be null.");
        assertNull(build.getProperties(), "Default properties should be null.");
        assertNull(build.getVcsRevision(), "Default vcs revision should be null.");
    }
View Full Code Here


        String parentName = "pooh";
        String parentNumber = "5";
        List<Module> modules = Lists.newArrayList();
        Properties properties = new Properties();

        Build build = new BuildInfoBuilder(name).started("test").version(version).number(number).type(buildType)
                .agent(agent).durationMillis(durationMillis).principal(principal)
                .artifactoryPrincipal(artifactoryPrincipal).url(url).parentName(parentName).parentNumber(parentNumber)
                .modules(modules).properties(properties).buildAgent(buildAgent).build();

        assertEquals(build.getVersion(), version, "Unexpected build version.");
        assertEquals(build.getName(), name, "Unexpected build name.");
        assertEquals(build.getNumber(), number, "Unexpected build number.");
        assertEquals(build.getType(), buildType, "Unexpected build type.");
        assertEquals(build.getAgent(), agent, "Unexpected build agent.");
        assertEquals(build.getBuildAgent(), buildAgent, "Unexpected build agent.");
        assertEquals(build.getDurationMillis(), durationMillis, "Unexpected build duration millis.");
        assertEquals(build.getPrincipal(), principal, "Unexpected build principal.");
        assertEquals(build.getArtifactoryPrincipal(), artifactoryPrincipal, "Unexpected build artifactory principal.");
        assertEquals(build.getUrl(), url, "Unexpected build URL.");
        assertEquals(build.getParentName(), parentName, "Unexpected build parent name.");
        assertEquals(build.getParentNumber(), parentNumber, "Unexpected build parent build number.");
        assertEquals(build.getModules(), modules, "Unexpected build modules.");
        assertTrue(build.getModules().isEmpty(), "Build modules list should not have been populated.");
        assertEquals(build.getProperties(), properties, "Unexpected build properties.");
        assertTrue(build.getProperties().isEmpty(), "Build properties list should not have been populated.");
    }
View Full Code Here

    /**
     * Validates the build start time values after using the builder setters
     */
    public void testStartedSetters() throws ParseException {
        String started = "192-1212-1";
        Build build = new BuildInfoBuilder("test").number("4").started(started).build();
        assertEquals(build.getStarted(), started, "Unexpected build started.");

        Date startedDate = new Date();
        build = new BuildInfoBuilder("test").number("4").startedDate(startedDate).build();

        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(Build.STARTED_FORMAT);
        assertEquals(build.getStarted(), simpleDateFormat.format(startedDate), "Unexpected build started.");
    }
View Full Code Here

        Module module = new Module();
        String propertyKey = "key";
        String propertyValue = "value";
        PromotionStatus promotionStatus = new PromotionStatusBuilder("momo").timestampDate(new Date()).build();

        Build build = new BuildInfoBuilder("test").number("4").started("test").addModule(module)
                .addProperty(propertyKey, propertyValue).addStatus(promotionStatus).build();
        List<Module> modules = build.getModules();
        assertFalse(modules.isEmpty(), "A build module should have been added.");
        assertEquals(modules.get(0), module, "Unexpected build module.");

        assertTrue(build.getProperties().containsKey(propertyKey), "A build property should have been added.");
        assertEquals(build.getProperties().get(propertyKey), propertyValue, "Unexpected build property value.");

        List<PromotionStatus> statuses = build.getStatuses();
        assertFalse(statuses.isEmpty(), "Expected a status to be added.");
        assertEquals(statuses.get(0), promotionStatus, "Unexpected added status.");
    }
View Full Code Here

                deployArtifacts(allDeployDetails, client, patterns);
            }

            //Extract build info and update the clientConf info accordingly (build name, num, etc.)
            GradleBuildInfoExtractor gbie = new GradleBuildInfoExtractor(acc, allDeployDetails);
            Build build = gbie.extract(getProject().getRootProject());
            /**
             * The build-info will be always written to a file in its JSON form.
             */
            exportBuildInfo(build, getExportFile(acc));
            if (isPublishBuildInfo(acc)) {
View Full Code Here

        assertTrue(repositoryKeys.size() > 0, "Expected to get some repositories");
    }

    @Test(enabled = false, expectedExceptions = IOException.class, expectedExceptionsMessageRegExp = ".* Unauthorized")
    public void postBuildInfoWithBadCredentials() throws IOException {
        Build build = new Build();
        ArtifactoryBuildInfoClient client = new ArtifactoryBuildInfoClient(artifactoryUrl,
                "no-such-user", "test", new NullLog());

        client.sendBuildInfo(build);
    }
View Full Code Here

        client.sendBuildInfo(build);
    }

    public void postBuildInfo() throws IOException {
        Build build = new BuildInfoBuilder("build").startedDate(new Date()).number("123").build();
        ArtifactoryBuildInfoClient client = new ArtifactoryBuildInfoClient(artifactoryUrl, "admin", "password",
                new NullLog());
        client.sendBuildInfo(build);
    }
View Full Code Here

    }

    @Override
    public void sessionEnded(ExecutionEvent event) {
        try {
            Build build = extract(event);
            if (build != null) {
                File basedir = event.getSession().getTopLevelProject().getBasedir();
                conf.persistToPropertiesFile();
                buildDeploymentHelper.deploy(build, conf, deployableArtifactBuilderMap, projectHasTestFailures, basedir);
            }
View Full Code Here

TOP

Related Classes of org.jfrog.build.api.Build

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.