Search in sources :

Example 21 with ArtifactStores

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"));
}
Also used : PluggableArtifactConfig(com.thoughtworks.go.config.PluggableArtifactConfig) ArtifactStores(com.thoughtworks.go.config.ArtifactStores) ArtifactStore(com.thoughtworks.go.config.ArtifactStore) PublishArtifactResponse(com.thoughtworks.go.plugin.access.artifact.model.PublishArtifactResponse) Test(org.junit.jupiter.api.Test)

Example 22 with ArtifactStores

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"));
}
Also used : ArtifactStores(com.thoughtworks.go.config.ArtifactStores) ArtifactStore(com.thoughtworks.go.config.ArtifactStore) Test(org.junit.jupiter.api.Test)

Example 23 with ArtifactStores

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"));
}
Also used : ArtifactStores(com.thoughtworks.go.config.ArtifactStores) ArtifactStore(com.thoughtworks.go.config.ArtifactStore) Test(org.junit.jupiter.api.Test)

Aggregations

ArtifactStores (com.thoughtworks.go.config.ArtifactStores)23 Test (org.junit.jupiter.api.Test)15 ArtifactStore (com.thoughtworks.go.config.ArtifactStore)10 PluggableArtifactConfig (com.thoughtworks.go.config.PluggableArtifactConfig)7 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)7 PublishArtifactResponse (com.thoughtworks.go.plugin.access.artifact.model.PublishArtifactResponse)6 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)6 Builder (com.thoughtworks.go.domain.builder.Builder)4 NullBuilder (com.thoughtworks.go.domain.builder.NullBuilder)4 File (java.io.File)4 ArrayList (java.util.ArrayList)4 CommandBuilder (com.thoughtworks.go.domain.builder.CommandBuilder)3 Modification (com.thoughtworks.go.domain.materials.Modification)3 IOException (java.io.IOException)3 Materials (com.thoughtworks.go.config.materials.Materials)2 BuildAssignment (com.thoughtworks.go.remote.work.BuildAssignment)2 BuildWork (com.thoughtworks.go.remote.work.BuildWork)2 GoPublisher (com.thoughtworks.go.work.GoPublisher)2 InOrder (org.mockito.InOrder)2 Gson (com.google.gson.Gson)1