use of com.thoughtworks.go.config.ArtifactStores in project gocd by gocd.
the class ArtifactsPublisherTest method shouldPublishPluggableArtifactsAndUploadMetadataFileToServer.
@Test
public void shouldPublishPluggableArtifactsAndUploadMetadataFileToServer() throws IOException {
final ArtifactStore s3ArtifactStore = new ArtifactStore("s3", "cd.go.s3", create("access_key", false, "some-key"));
final ArtifactStore dockerArtifactStore = new ArtifactStore("docker", "cd.go.docker", create("registry-url", false, "docker.io"));
final ArtifactStores artifactStores = new ArtifactStores(s3ArtifactStore, dockerArtifactStore);
final ArtifactPlan s3ArtifactPlan = new ArtifactPlan(new PluggableArtifactConfig("installers", "s3", create("Baz", true, "Car")));
final ArtifactPlan dockerArtifactPlan = new ArtifactPlan(new PluggableArtifactConfig("test-reports", "docker", create("junit", false, "junit.xml")));
when(artifactExtension.publishArtifact(eq("cd.go.s3"), eq(s3ArtifactPlan), eq(s3ArtifactStore), anyString(), eq(env))).thenReturn(new PublishArtifactResponse(Collections.singletonMap("src", "s3://dist")));
when(artifactExtension.publishArtifact(eq("cd.go.docker"), eq(dockerArtifactPlan), eq(dockerArtifactStore), anyString(), eq(env))).thenReturn(new PublishArtifactResponse(Collections.singletonMap("image", "alpine")));
new ArtifactsPublisher(publisher, artifactExtension, artifactStores, registry, workingFolder).publishArtifacts(Arrays.asList(s3ArtifactPlan, dockerArtifactPlan), env);
assertThat(uploadedPluggableMetadataFiles(publisher.publishedFiles()), containsInAnyOrder("cd.go.s3.json", "cd.go.docker.json"));
}
use of com.thoughtworks.go.config.ArtifactStores in project gocd by gocd.
the class ArtifactStoreServiceTest method findArtifactStore_shouldFindArtifactStoreByStoreId.
@Test
public void findArtifactStore_shouldFindArtifactStoreByStoreId() {
when(configService.artifactStores()).thenReturn(new ArtifactStores(new ArtifactStore("docker", "cd.go.docker"), new ArtifactStore("s3", "cd.go.s3")));
final ArtifactStore dockerArtifactStore = artifactStoreService.findArtifactStore("docker");
assertThat(dockerArtifactStore).isEqualTo(new ArtifactStore("docker", "cd.go.docker"));
final ArtifactStore s3ArtifactStore = artifactStoreService.findArtifactStore("s3");
assertThat(s3ArtifactStore).isEqualTo(new ArtifactStore("s3", "cd.go.s3"));
}
use of com.thoughtworks.go.config.ArtifactStores in project gocd by gocd.
the class ArtifactStoreServiceTest method getPluginProfiles_shouldGetAllArtifactStores.
@Test
public void getPluginProfiles_shouldGetAllArtifactStores() {
when(configService.artifactStores()).thenReturn(new ArtifactStores(new ArtifactStore("docker", "cd.go.docker"), new ArtifactStore("s3", "cd.go.s3")));
final ArtifactStores artifactStores = artifactStoreService.getPluginProfiles();
assertThat(artifactStores).hasSize(2).contains(new ArtifactStore("docker", "cd.go.docker"), new ArtifactStore("s3", "cd.go.s3"));
}
Aggregations