Search in sources :

Example 1 with Artifact

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

the class ModuleBuilderTest method testBuilderSetters.

/**
 * Validates the module values after using the builder setters
 */
public void testBuilderSetters() {
    String id = "moo";
    List<Artifact> artifacts = Lists.newArrayList();
    List<Dependency> dependencies = Lists.newArrayList();
    Properties properties = new Properties();
    Module module = new ModuleBuilder().id(id).artifacts(artifacts).dependencies(dependencies).properties(properties).build();
    assertEquals(module.getId(), id, "Unexpected module ID.");
    assertEquals(module.getArtifacts(), artifacts, "Unexpected module artifacts.");
    assertTrue(module.getArtifacts().isEmpty(), "Module artifacts list should not have been populated.");
    assertEquals(module.getDependencies(), dependencies, "Unexpected module dependencies.");
    assertTrue(module.getDependencies().isEmpty(), "Module dependencies list should not have been populated.");
    assertEquals(module.getProperties(), properties, "Unexpected module properties.");
    assertTrue(module.getProperties().isEmpty(), "Module properties list should not have been populated.");
}
Also used : Dependency(org.jfrog.build.api.Dependency) Properties(java.util.Properties) Module(org.jfrog.build.api.Module) Artifact(org.jfrog.build.api.Artifact)

Example 2 with Artifact

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

the class ArtifactBuilderTest method testDefaultBuild.

/**
 * Validates the artifact values when using the defaults
 */
public void testDefaultBuild() {
    Artifact artifact = new ArtifactBuilder("name").build();
    assertEquals(artifact.getName(), "name", "Unexpected artifact name.");
    assertNull(artifact.getType(), "Default artifact type.");
    assertNull(artifact.getSha1(), "Default artifact SHA1 checksum should be null.");
    assertNull(artifact.getSha256(), "Default artifact SHA256 checksum should be null.");
    assertNull(artifact.getMd5(), "Default artifact MD5 checksum should be null.");
    assertNull(artifact.getProperties(), "Default artifact properties should be null.");
}
Also used : Artifact(org.jfrog.build.api.Artifact)

Example 3 with Artifact

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

the class ArtifactBuilderTest method testBuilderSetters.

/**
 * Validates the artifact values after using the builder setters
 */
public void testBuilderSetters() {
    String name = "moo";
    String type = "bob";
    String sha1 = "pop";
    String sha256 = "lol";
    String md5 = "shmop";
    Properties properties = new Properties();
    Artifact artifact = new ArtifactBuilder(name).type(type).sha1(sha1).sha256(sha256).md5(md5).properties(properties).build();
    assertEquals(artifact.getName(), name, "Unexpected artifact ID.");
    assertEquals(artifact.getType(), type, "Unexpected artifact type.");
    assertEquals(artifact.getSha1(), sha1, "Unexpected artifact SHA1 checksum.");
    assertEquals(artifact.getSha256(), sha256, "Unexpected artifact SHA256 checksum.");
    assertEquals(artifact.getMd5(), md5, "Unexpected artifact SHA1 checksum.");
    assertEquals(artifact.getProperties(), properties, "Unexpected artifact properties.");
    assertTrue(artifact.getProperties().isEmpty(), "Artifact properties list should not have been populated.");
}
Also used : Properties(java.util.Properties) Artifact(org.jfrog.build.api.Artifact)

Example 4 with Artifact

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

the class ArtifactBuilderTest method testBuilderAddMethods.

/**
 * Validates the artifact values after using the builder add methods
 */
public void testBuilderAddMethods() {
    String propertyKey = "key";
    String propertyValue = "value";
    Artifact artifact = new ArtifactBuilder("name").addProperty(propertyKey, propertyValue).build();
    assertTrue(artifact.getProperties().containsKey(propertyKey), "An artifact property should have been added.");
    assertEquals(artifact.getProperties().get(propertyKey), propertyValue, "Unexpected artifact property value.");
}
Also used : Artifact(org.jfrog.build.api.Artifact)

Example 5 with Artifact

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

the class SpecsHelperIntegrationTest method integrationTests.

@Test(dataProvider = "testCases")
public void integrationTests(String testName, String uploadSpec, String downloadSpec, Expected expected) throws IOException, NoSuchAlgorithmException, URISyntaxException {
    Reporter.log("Running test: " + testName, true);
    // Upload artifacts.
    File uploadFromPath = new File(this.getClass().getResource("/workspace").toURI()).getCanonicalFile();
    List<Artifact> uploaded = specsHelper.uploadArtifactsBySpec(uploadSpec, uploadFromPath, new HashMap<String, String>(), buildInfoClient);
    Reporter.log("Uploaded " + uploaded.size() + " artifacts", true);
    // Download artifacts to compare against the expected result.
    List<Dependency> downloaded = specsHelper.downloadArtifactsBySpec(downloadSpec, dependenciesClient, tempWorkspace.getPath());
    Reporter.log("Downloaded " + downloaded.size() + " artifacts", true);
    // Verify expected results
    verifyExpected(expected);
}
Also used : Dependency(org.jfrog.build.api.Dependency) File(java.io.File) Artifact(org.jfrog.build.api.Artifact) Test(org.testng.annotations.Test)

Aggregations

Artifact (org.jfrog.build.api.Artifact)10 Module (org.jfrog.build.api.Module)4 File (java.io.File)3 Dependency (org.jfrog.build.api.Dependency)3 DeployDetails (org.jfrog.build.client.DeployDetails)3 Properties (java.util.Properties)2 ArtifactBuilder (org.jfrog.build.api.builder.ArtifactBuilder)2 EndArtifactPublishEvent (org.apache.ivy.core.event.publish.EndArtifactPublishEvent)1 PublishEvent (org.apache.ivy.core.event.publish.PublishEvent)1 ModuleRevisionId (org.apache.ivy.core.module.id.ModuleRevisionId)1 Project (org.apache.tools.ant.Project)1 BuildInfoExtractorUtils.getModuleIdString (org.jfrog.build.extractor.BuildInfoExtractorUtils.getModuleIdString)1 BuildInfoExtractorUtils.getTypeString (org.jfrog.build.extractor.BuildInfoExtractorUtils.getTypeString)1 ArtifactoryClientConfiguration (org.jfrog.build.extractor.clientConfiguration.ArtifactoryClientConfiguration)1 IncludeExcludePatterns (org.jfrog.build.extractor.clientConfiguration.IncludeExcludePatterns)1 Test (org.testng.annotations.Test)1