Search in sources :

Example 1 with BuildDependency

use of org.jfrog.build.api.dependency.BuildDependency in project build-info by JFrogDev.

the class BuildDependencyBuilder method build.

/**
 * Assembles the build dependency class
 *
 * @return Assembled module
 */
public BuildDependency build() {
    if (name == null) {
        throw new IllegalArgumentException("BuildDependency must have a name.");
    }
    if (number == null) {
        throw new IllegalArgumentException("BuildDependency must have a number.");
    }
    if (started == null) {
        throw new IllegalArgumentException("BuildDependency must have a started time.");
    }
    BuildDependency buildDependency = new BuildDependency();
    buildDependency.setName(name);
    buildDependency.setNumber(number);
    buildDependency.setStarted(started);
    buildDependency.setUrl(url);
    return buildDependency;
}
Also used : BuildDependency(org.jfrog.build.api.dependency.BuildDependency)

Example 2 with BuildDependency

use of org.jfrog.build.api.dependency.BuildDependency in project build-info by JFrogDev.

the class BuildDependencyTest method testSetters.

/**
 * Validates the build dependency values after using the setters
 */
public void testSetters() {
    String name = "foo";
    String number = "123";
    Date date = new Date();
    String started = new SimpleDateFormat(Build.STARTED_FORMAT).format(date);
    String url = "http://myhostA.com/artifactory/builds/foo/123/";
    BuildDependency buildDependency = new BuildDependency();
    buildDependency.setName(name);
    buildDependency.setNumber(number);
    buildDependency.setStarted(started);
    buildDependency.setUrl(url);
    assertEquals(buildDependency.getName(), name, "Unexpected name.");
    assertEquals(buildDependency.getNumber(), number, "Unexpected number.");
    assertEquals(buildDependency.getStarted(), started, "Unexpected started.");
    assertEquals(buildDependency.getUrl(), url, "Unexpected url.");
}
Also used : SimpleDateFormat(java.text.SimpleDateFormat) BuildDependency(org.jfrog.build.api.dependency.BuildDependency) Date(java.util.Date)

Example 3 with BuildDependency

use of org.jfrog.build.api.dependency.BuildDependency in project build-info by JFrogDev.

the class BuildDependencyTest method testEmptyConstructor.

/**
 * Validates the build dependency values after initializing the default constructor
 */
public void testEmptyConstructor() {
    BuildDependency buildDependency = new BuildDependency();
    assertNull(buildDependency.getName(), "Name should have not been initialized.");
    assertNull(buildDependency.getNumber(), "Number should have not been initialized.");
    assertNull(buildDependency.getStarted(), "Timestamp should have not been initialized.");
    assertNull(buildDependency.getUrl(), "URI should have not been initialized.");
}
Also used : BuildDependency(org.jfrog.build.api.dependency.BuildDependency)

Example 4 with BuildDependency

use of org.jfrog.build.api.dependency.BuildDependency in project build-info by JFrogDev.

the class BuildTest method testSetters.

/**
 * Validates the build values after using the build setters
 */
public void testSetters() {
    String version = "1.2.0";
    String name = "moo";
    String number = "15";
    BuildType buildType = GRADLE;
    Agent agent = new Agent("pop", "1.6");
    long durationMillis = 6L;
    String principal = "bob";
    String artifactoryPrincipal = "too";
    String artifactoryPluginVersion = "2.3.1";
    String url = "mitz";
    String parentName = "pooh";
    String parentNumber = "5";
    String vcsRevision = "2421";
    List<Module> modules = Lists.newArrayList();
    List<PromotionStatus> statuses = Lists.newArrayList();
    List<BuildDependency> buildDependencies = Arrays.asList(new BuildDependencyBuilder().name("foo").number("123").startedDate(new Date()).build(), new BuildDependencyBuilder().name("bar").number("456").startedDate(new Date()).build());
    Properties properties = new Properties();
    Build build = new Build();
    build.setVersion(version);
    build.setName(name);
    build.setNumber(number);
    build.setType(buildType);
    build.setAgent(agent);
    build.setDurationMillis(durationMillis);
    build.setPrincipal(principal);
    build.setArtifactoryPrincipal(artifactoryPrincipal);
    build.setArtifactoryPluginVersion(artifactoryPluginVersion);
    build.setUrl(url);
    build.setParentName(parentName);
    build.setParentNumber(parentNumber);
    build.setModules(modules);
    build.setStatuses(statuses);
    build.setProperties(properties);
    build.setVcsRevision(vcsRevision);
    build.setBuildDependencies(buildDependencies);
    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.getDurationMillis(), durationMillis, "Unexpected build duration millis.");
    assertEquals(build.getPrincipal(), principal, "Unexpected build principal.");
    assertEquals(build.getArtifactoryPrincipal(), artifactoryPrincipal, "Unexpected build artifactory principal.");
    assertEquals(build.getArtifactoryPluginVersion(), artifactoryPluginVersion, "Unexpected build artifactory principal.");
    assertEquals(build.getUrl(), url, "Unexpected build URL.");
    assertEquals(build.getParentName(), parentName, "Unexpected build parent build name.");
    assertEquals(build.getParentNumber(), parentNumber, "Unexpected build parent build number.");
    assertEquals(build.getVcsRevision(), vcsRevision, "Unexpected build vcs revision.");
    assertEquals(build.getModules(), modules, "Unexpected build modules.");
    assertTrue(build.getModules().isEmpty(), "Build modules list should not have been populated.");
    assertEquals(build.getStatuses(), statuses, "Unexpected build statuses.");
    assertTrue(build.getStatuses().isEmpty(), "Build statuses 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.");
    assertEquals(build.getBuildDependencies(), buildDependencies, "Unexpected build dependencies list.");
}
Also used : BuildDependencyBuilder(org.jfrog.build.api.builder.dependency.BuildDependencyBuilder) Properties(java.util.Properties) BuildDependency(org.jfrog.build.api.dependency.BuildDependency) Date(java.util.Date) PromotionStatus(org.jfrog.build.api.release.PromotionStatus)

Example 5 with BuildDependency

use of org.jfrog.build.api.dependency.BuildDependency in project build-info by JFrogDev.

the class BuildDependencyBuilderTest method testDefaultBuild.

/**
 * Validates the module values when using the defaults
 */
public void testDefaultBuild() {
    BuildDependency buildDependency = new BuildDependencyBuilder().name("foo").number("123").started(timestamp).build();
    assertNull(buildDependency.getUrl(), "URI should have not been initialized.");
}
Also used : BuildDependencyBuilder(org.jfrog.build.api.builder.dependency.BuildDependencyBuilder) BuildDependency(org.jfrog.build.api.dependency.BuildDependency)

Aggregations

BuildDependency (org.jfrog.build.api.dependency.BuildDependency)7 BuildDependencyBuilder (org.jfrog.build.api.builder.dependency.BuildDependencyBuilder)4 Date (java.util.Date)3 SimpleDateFormat (java.text.SimpleDateFormat)1 Properties (java.util.Properties)1 PromotionStatus (org.jfrog.build.api.release.PromotionStatus)1