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.");
}
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.");
}
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.");
}
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.");
}
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);
}
Aggregations