use of com.thoughtworks.go.work.GoPublisher in project gocd by gocd.
the class ArtifactsPublisherTest method shouldDeletePluggableArtifactMetadataDirectory.
@Test
public void shouldDeletePluggableArtifactMetadataDirectory() throws Exception {
TestFileUtil.createTestFile(workingFolder, "installer.zip");
TestFileUtil.createTestFile(workingFolder, "testreports.xml");
final ArtifactStore artifactStore = new ArtifactStore("s3", "cd.go.s3", create("Foo", false, "Bar"));
final ArtifactStores artifactStores = new ArtifactStores(artifactStore);
final ArtifactPlan artifactPlan = new ArtifactPlan(new PluggableArtifactConfig("installers", "s3", create("Baz", true, "Car")));
List<ArtifactPlan> artifactPlans = Arrays.asList(new ArtifactPlan(ArtifactPlanType.file, "installer.zip", "dist"), new ArtifactPlan(ArtifactPlanType.unit, "testreports.xml", "testreports"), artifactPlan);
when(artifactExtension.publishArtifact(eq("cd.go.s3"), eq(artifactPlan), eq(artifactStore), anyString(), eq(env))).thenReturn(new PublishArtifactResponse(Collections.singletonMap("Foo", "Bar")));
final GoPublisher publisher = mock(GoPublisher.class);
assertThat(Arrays.asList(workingFolder.list()), containsInAnyOrder("testreports.xml", "installer.zip", "cruise-output"));
new ArtifactsPublisher(publisher, artifactExtension, artifactStores, registry, workingFolder).publishArtifacts(artifactPlans, env);
assertThat(Arrays.asList(workingFolder.list()), containsInAnyOrder("testreports.xml", "installer.zip", "cruise-output"));
}
use of com.thoughtworks.go.work.GoPublisher in project gocd by gocd.
the class ArtifactsPublisherTest method shouldAddPluggableArtifactMetadataFileArtifactPlanAtTop.
@Test
public void shouldAddPluggableArtifactMetadataFileArtifactPlanAtTop() throws Exception {
TestFileUtil.createTestFile(workingFolder, "installer.zip");
TestFileUtil.createTestFile(workingFolder, "testreports.xml");
final ArtifactStore artifactStore = new ArtifactStore("s3", "cd.go.s3", create("Foo", false, "Bar"));
final ArtifactStores artifactStores = new ArtifactStores(artifactStore);
final ArtifactPlan artifactPlan = new ArtifactPlan(new PluggableArtifactConfig("installers", "s3", create("Baz", true, "Car")));
List<ArtifactPlan> artifactPlans = Arrays.asList(new ArtifactPlan(ArtifactPlanType.file, "installer.zip", "dist"), new ArtifactPlan(ArtifactPlanType.unit, "testreports.xml", "testreports"), artifactPlan);
when(artifactExtension.publishArtifact(eq("cd.go.s3"), eq(artifactPlan), eq(artifactStore), anyString(), eq(env))).thenReturn(new PublishArtifactResponse(Collections.singletonMap("Foo", "Bar")));
final GoPublisher publisher = mock(GoPublisher.class);
new ArtifactsPublisher(publisher, artifactExtension, artifactStores, registry, workingFolder).publishArtifacts(artifactPlans, env);
InOrder inOrder = inOrder(publisher);
inOrder.verify(publisher).upload(any(), eq("pluggable-artifact-metadata"));
inOrder.verify(publisher).upload(any(), eq("dist"));
inOrder.verify(publisher).upload(any(), eq("testreports"));
}
Aggregations