use of org.jboss.modules.maven.ArtifactCoordinates in project wildfly-swarm by wildfly-swarm.
the class GradleResolverTest method testResolveArtifact_notExists.
@Test
public void testResolveArtifact_notExists() throws IOException {
// GIVEN
File dirFile = TempFileManager.INSTANCE.newTempDirectory("gradle", null);
Path gradleCachePath = dirFile.toPath();
String group = "org.wildfly.swarm";
String packaging = "jar";
String artifact = "test";
String version = "1.0";
String classifier = "sources";
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version, classifier);
Path artifactDir = Files.createDirectories(gradleCachePath.resolve(group).resolve(artifact).resolve(version).resolve("hash"));
// Other packaging type
File artifactFile = Files.createFile(artifactDir.resolve(artifact + "-" + version + "-" + classifier + ".pom")).toFile();
// WHEN
GradleResolver resolver = new GradleResolver(gradleCachePath.toString());
File resolvedArtifactFile = resolver.resolveArtifact(artifactCoordinates, packaging);
// THEN
assertNull(resolvedArtifactFile);
}
use of org.jboss.modules.maven.ArtifactCoordinates in project wildfly-swarm by wildfly-swarm.
the class GradleResolverTest method testToGradleArtifactPath_withClassifier.
@Test
public void testToGradleArtifactPath_withClassifier() {
// GIVEN
String group = "org.jboss.ws.cxf";
String artifact = "jbossws-cxf-resources";
String version = "5.1.5.Final";
String classifier = "wildfly1000";
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version, classifier);
// WHEN
GradleResolver resolver = new GradleResolver(null);
String artifactPath = resolver.toGradleArtifactPath(artifactCoordinates);
// THEN
assertEquals("org/jboss/ws/cxf/jbossws-cxf-resources/5.1.5.Final/jbossws-cxf-resources-5.1.5.Final-wildfly1000", artifactPath);
}
use of org.jboss.modules.maven.ArtifactCoordinates in project wildfly-swarm by wildfly-swarm.
the class GradleResolverTest method testResolveArtifact_latest.
@Test
public void testResolveArtifact_latest() throws IOException, InterruptedException {
// GIVEN
File dirFile = TempFileManager.INSTANCE.newTempDirectory("gradle", null);
Path gradleCachePath = dirFile.toPath();
String group = "org.wildfly.swarm";
String packaging = "jar";
String artifact = "test";
String version = "1.0";
String classifier = "sources";
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version, classifier);
Path artifactDir = Files.createDirectories(gradleCachePath.resolve(group).resolve(artifact).resolve(version).resolve("hash1"));
File artifactFile = Files.createFile(artifactDir.resolve(artifact + "-" + version + "-" + classifier + "." + packaging)).toFile();
// Timestemp resolution of some filesystems are 2 seconds
Thread.sleep(2000);
Path artifactDirLatest = Files.createDirectories(gradleCachePath.resolve(group).resolve(artifact).resolve(version).resolve("hash2"));
File artifactFileLatest = Files.createFile(artifactDirLatest.resolve(artifact + "-" + version + "-" + classifier + "." + packaging)).toFile();
// WHEN
GradleResolver resolver = new GradleResolver(gradleCachePath.toString());
File resolvedArtifactFile = resolver.resolveArtifact(artifactCoordinates, packaging);
// THEN
assertEquals(artifactFileLatest, resolvedArtifactFile);
}
use of org.jboss.modules.maven.ArtifactCoordinates in project wildfly-swarm by wildfly-swarm.
the class GradleResolverTest method downloadFromRemoteRepository.
@Test
public void downloadFromRemoteRepository() throws IOException {
// GIVEN
File dirFile = TempFileManager.INSTANCE.newTempDirectory(".gradle", null);
Path gradleCachePath = dirFile.toPath();
String group = "org.wildfly.swarm";
String packaging = "jar";
String artifact = "bootstrap";
String version = "2017.1.1";
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version);
Path artifactDirectory = gradleCachePath.resolve(group);
GradleResolver resolver = spy(new GradleResolver(gradleCachePath.toString()));
File targetFile = mock(File.class);
doReturn(targetFile).when(resolver).doDownload(anyString(), anyString(), anyString(), eq(artifactCoordinates), eq(packaging), any(File.class), any(File.class));
// WHEN
File result = resolver.downloadFromRemoteRepository(artifactCoordinates, packaging, artifactDirectory);
// THEN
assertEquals(targetFile, result);
}
use of org.jboss.modules.maven.ArtifactCoordinates in project wildfly-swarm by wildfly-swarm.
the class GradleResolverTest method testToGradleArtifactFileName.
@Test
public void testToGradleArtifactFileName() {
// GIVEN
String group = "org.wildfly.swarm";
String packaging = "jar";
String artifact = "test";
String version = "1.0";
ArtifactCoordinates artifactCoordinates = new ArtifactCoordinates(group, artifact, version);
// WHEN
GradleResolver resolver = new GradleResolver(null);
String artifactFileName = resolver.toGradleArtifactFileName(artifactCoordinates, packaging);
// THEN
assertEquals(artifact + "-" + version + "." + packaging, artifactFileName);
}
Aggregations