use of io.fabric8.patch.management.Artifact in project fabric8 by jboss-fuse.
the class MavenProxyResolutionTest method releaseIsAvailableInRemoteRepositoryUpdatingRelease.
@Test
public void releaseIsAvailableInRemoteRepositoryUpdatingRelease() throws IOException, InvalidMavenArtifactRequest {
File remoteRepository = initFileRepository("rr");
MavenResolver resolver = new ResolverBuilder().withRemoteRepositories(Collections.singletonList(remoteRepository)).withReleaseUpdates().withUpdatePolicy(RepositoryPolicy.UPDATE_POLICY_ALWAYS).build();
MavenDownloadProxyServlet servlet = new MavenDownloadProxyServlet(resolver, runtime, null, 1, 0);
mvnInstall(remoteRepository, "io.fabric8.test", "universalis-api", "0.1.0", at("10:00"), "a");
File file = servlet.download("io/fabric8/test/universalis-api/0.1.0/universalis-api-0.1.0.jar");
// first resolution
assertThat(FileUtils.readFileToString(file), equalTo("a"));
// don't do that, it's not proper use of maven. But sometimes we just have another deployment to public repository...
mvnInstall(remoteRepository, "io.fabric8.test", "universalis-api", "0.1.0", at("11:00"), "b");
// second resolution
file = servlet.download("io/fabric8/test/universalis-api/0.1.0/universalis-api-0.1.0.jar");
assertThat("Artifact will be updated though it's not proper usage of Maven", FileUtils.readFileToString(file), equalTo("b"));
}
use of io.fabric8.patch.management.Artifact in project fabric8 by jboss-fuse.
the class MavenProxySnapshotResolutionTest method snapshotIsAvailableInTwoDefaultRepositories.
@Test
public void snapshotIsAvailableInTwoDefaultRepositories() throws IOException, InvalidMavenArtifactRequest {
File defaultRepository1 = initFileRepository("dr1");
File defaultRepository2 = initFileRepository("dr2");
MavenResolver resolver = new ResolverBuilder().withDefaultRepositories(Arrays.asList(defaultRepository1, defaultRepository2)).build();
MavenDownloadProxyServlet servlet = new MavenDownloadProxyServlet(resolver, runtime, null, 1, 0);
servlet.start();
mvnInstall(defaultRepository1, "io.fabric8.test", "universalis-api", "0.1.0-SNAPSHOT", at("10:00"), "a");
mvnInstall(defaultRepository2, "io.fabric8.test", "universalis-api", "0.1.0-SNAPSHOT", at("11:00"), "b");
File file = servlet.download("io/fabric8/test/universalis-api/0.1.0-SNAPSHOT/maven-metadata.xml");
Metadata metadata = readMetadata(file);
assertThat("Resolution done in first default repository, even if second one has newer artifact", metadata.getVersioning().getSnapshotVersions().get(0).getUpdated(), is("20170101100000"));
}
use of io.fabric8.patch.management.Artifact in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getContainerWithGroupArtifactTest.
@Test
public void getContainerWithGroupArtifactTest() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
// container name with group id and aritact id without alias and user
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/").cleanup("try").tags(tags).compression("gzip").dockerFile("testFile").dockerFileDir("/demo").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("test-group-test-artifact", containers.get(0).getName());
assertEquals("docker.io/test", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of io.fabric8.patch.management.Artifact in project fabric8-maven-plugin by fabric8io.
the class ContainerHandlerTest method getContainersWithAliasTest.
@Test
public void getContainersWithAliasTest() {
project.setArtifactId("test-artifact");
project.setGroupId("test-group");
ports.add("8080");
ports.add("9090");
tags.add("latest");
tags.add("test");
ContainerHandler handler = new ContainerHandler(project, envVarHandler, probeHandler);
// container name with alias
BuildImageConfiguration buildImageConfiguration = new BuildImageConfiguration.Builder().ports(ports).from("fabric8/maven:latest").cleanup("try").tags(tags).compression("gzip").build();
ImageConfiguration imageConfiguration = new ImageConfiguration.Builder().name("test").alias("test-app").buildConfig(buildImageConfiguration).registry("docker.io").build();
images.clear();
images.add(imageConfiguration);
containers = handler.getContainers(config, images);
assertNotNull(containers);
assertEquals("test-app", containers.get(0).getName());
assertEquals("docker.io/test", containers.get(0).getImage());
assertEquals("IfNotPresent", containers.get(0).getImagePullPolicy());
}
use of io.fabric8.patch.management.Artifact in project fabric8-maven-plugin by fabric8io.
the class AbstractSpringBootHealthCheckEnricherSupport method init.
@Before
public void init() {
String version = getSpringBootVersion();
this.propertyHelper = new SpringBootConfigurationHelper(version);
final MavenProject project = new MavenProject();
Set<Artifact> artifacts = new HashSet<>();
Artifact a = new DefaultArtifact("org.springframework.boot", "spring-boot", version, "compile", "jar", "", null);
a.setResolved(true);
artifacts.add(a);
project.setArtifacts(artifacts);
new Expectations() {
{
context.getProject();
result = project;
}
};
}
Aggregations