use of com.thoughtworks.go.config.ArtifactStore in project gocd by gocd.
the class ArtifactsPublisher method artifactStoresToPlugin.
private Map<ArtifactPlan, ArtifactStore> artifactStoresToPlugin(List<ArtifactPlan> artifactPlans) {
final HashMap<ArtifactPlan, ArtifactStore> artifactPlanToArtifactStoreMap = new HashMap<>();
for (ArtifactPlan artifactPlan : artifactPlans) {
final String storeId = (String) artifactPlan.getPluggableArtifactConfiguration().get("storeId");
artifactPlanToArtifactStoreMap.put(artifactPlan, artifactStores.find(storeId));
}
return artifactPlanToArtifactStoreMap;
}
use of com.thoughtworks.go.config.ArtifactStore in project gocd by gocd.
the class ArtifactMessageConverterV1Test method fetchArtifactMessage_shouldSerializeToJson.
@Test
public void fetchArtifactMessage_shouldSerializeToJson() throws JSONException {
final ArtifactMessageConverterV1 converter = new ArtifactMessageConverterV1();
final ArtifactStore artifactStore = new ArtifactStore("s3-store", "pluginId", create("Foo", false, "Bar"));
final Map<String, Object> metadata = Collections.singletonMap("Version", "10.12.0");
final FetchPluggableArtifactTask pluggableArtifactTask = new FetchPluggableArtifactTask(null, null, "artifactId", create("Filename", false, "build/libs/foo.jar"));
final String fetchArtifactMessage = converter.fetchArtifactMessage(artifactStore, pluggableArtifactTask.getConfiguration(), metadata, "/temp");
final String expectedStr = "{\n" + " \"artifact_metadata\": {\n" + " \"Version\": \"10.12.0\"\n" + " },\n" + " \"store_configuration\": {\n" + " \"Foo\": \"Bar\"\n" + " },\n" + " \"fetch_artifact_configuration\": {\n" + " \"Filename\": \"build/libs/foo.jar\"\n" + " },\n" + " \"agent_working_directory\": \"/temp\"\n" + "}";
JSONAssert.assertEquals(expectedStr, fetchArtifactMessage, true);
}
use of com.thoughtworks.go.config.ArtifactStore in project gocd by gocd.
the class ArtifactMessageConverterV1Test method publishArtifactMessage_shouldSerializeToJson.
@Test
public void publishArtifactMessage_shouldSerializeToJson() throws JSONException {
final ArtifactMessageConverterV1 converter = new ArtifactMessageConverterV1();
final ArtifactStore artifactStore = new ArtifactStore("s3-store", "pluginId", create("Foo", false, "Bar"));
final ArtifactPlan artifactPlan = new ArtifactPlan(new PluggableArtifactConfig("installers", "s3-store", create("Baz", true, "Car")));
final String publishArtifactMessage = converter.publishArtifactMessage(artifactPlan, artifactStore, "/temp");
final String expectedStr = "{\n" + " \"artifact_plan\": {\n" + " \"configuration\": {\n" + " \"Baz\": \"Car\"\n" + " },\n" + " \"id\": \"installers\",\n" + " \"storeId\": \"s3-store\"\n" + " },\n" + " \"artifact_store\": {\n" + " \"configuration\": {\n" + " \"Foo\": \"Bar\"\n" + " },\n" + " \"id\": \"s3-store\"\n" + " },\n" + " \"agent_working_directory\": \"/temp\"\n" + "}";
JSONAssert.assertEquals(expectedStr, publishArtifactMessage, true);
}
Aggregations