use of com.thoughtworks.go.plugin.access.artifact.ArtifactExtension in project gocd by gocd.
the class FetchPluggableArtifactBuilderTest method setUp.
@Before
public void setUp() throws Exception {
publisher = mock(DefaultGoPublisher.class);
artifactExtension = mock(ArtifactExtension.class);
checksumFileHandler = mock(ChecksumFileHandler.class);
registry = mock(PluginRequestProcessorRegistry.class);
metadataDest = new File(temporaryFolder.newFolder("dest"), "cd.go.s3.json");
FileUtils.writeStringToFile(metadataDest, "{\"artifactId\":{}}", StandardCharsets.UTF_8);
jobIdentifier = new JobIdentifier("cruise", -10, "1", "dev", "1", "windows", 1L);
artifactStore = new ArtifactStore("s3", "cd.go.s3", ConfigurationPropertyMother.create("ACCESS_KEY", true, "hksjdfhsksdfh"));
fetchPluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("dev"), new CaseInsensitiveString("windows"), "artifactId", ConfigurationPropertyMother.create("Destination", false, "build/"));
sourceOnServer = format("%s/%s", PLUGGABLE_ARTIFACT_METADATA_FOLDER, "cd.go.s3.json");
when(checksumFileHandler.handleResult(SC_OK, publisher)).thenReturn(true);
}
use of com.thoughtworks.go.plugin.access.artifact.ArtifactExtension in project gocd by gocd.
the class ArtifactsPublisherTest method setUp.
@BeforeEach
public void setUp() throws IOException {
artifactExtension = mock(ArtifactExtension.class);
registry = mock(PluginRequestProcessorRegistry.class);
publisher = new StubGoPublisher();
artifactsPublisher = new ArtifactsPublisher(publisher, artifactExtension, new ArtifactStores(), registry, workingFolder);
File file = new File(workingFolder, "cruise-output/log.xml");
file.getParentFile().mkdirs();
file.createNewFile();
}
use of com.thoughtworks.go.plugin.access.artifact.ArtifactExtension in project gocd by gocd.
the class BuildWorkTest method shouldCallArtifactExtensionToPublishPluggableArtifact.
@Test
void shouldCallArtifactExtensionToPublishPluggableArtifact() throws Exception {
final ArtifactExtension artifactExtension = mock(ArtifactExtension.class);
buildWork = (BuildWork) getWork(pluggableArtifact(), PIPELINE_NAME);
artifactManipulator = new GoArtifactsManipulatorStub(new HttpServiceStub(SC_NOT_ACCEPTABLE));
buildWork.doWork(environmentVariableContext, new AgentWorkContext(agentIdentifier, buildRepository, artifactManipulator, new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie"), packageRepositoryExtension, scmExtension, taskExtension, artifactExtension, pluginRequestProcessorRegistry));
verify(artifactExtension).publishArtifact(anyString(), any(ArtifactPlan.class), any(ArtifactStore.class), anyString(), any(EnvironmentVariableContext.class));
}
use of com.thoughtworks.go.plugin.access.artifact.ArtifactExtension in project gocd by gocd.
the class ExternalArtifactsServiceTest method setUp.
@BeforeEach
public void setUp() {
artifactExtension = mock(ArtifactExtension.class);
externalArtifactsService = new ExternalArtifactsService(artifactExtension);
ArtifactPluginInfo pluginInfo = mock(ArtifactPluginInfo.class);
PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class);
when(pluginInfo.getDescriptor()).thenReturn(pluginDescriptor);
when(pluginDescriptor.id()).thenReturn(pluginId);
ArtifactMetadataStore.instance().setPluginInfo(pluginInfo);
pluggableArtifactConfig = new PluggableArtifactConfig("foo", "bar");
pipelineConfig = PipelineConfigMother.createPipelineConfig("p1", "s1", "j1");
pipelineConfig.getStage("s1").jobConfigByConfigName("j1").artifactTypeConfigs().add(pluggableArtifactConfig);
fetchPluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("p1"), new CaseInsensitiveString("s1"), new CaseInsensitiveString("j1"), "foo");
cruiseConfig = GoConfigMother.defaultCruiseConfig();
cruiseConfig.addPipelineWithoutValidation("group", pipelineConfig);
cruiseConfig.getArtifactStores().add(new ArtifactStore("bar", pluginId));
}
use of com.thoughtworks.go.plugin.access.artifact.ArtifactExtension in project gocd by gocd.
the class FetchPluggableArtifactBuilderTest method setUp.
@BeforeEach
public void setUp(@TempDir Path tempDir) throws Exception {
publisher = mock(DefaultGoPublisher.class);
artifactExtension = mock(ArtifactExtension.class);
checksumFileHandler = mock(ChecksumFileHandler.class);
registry = mock(PluginRequestProcessorRegistry.class);
metadataDest = TempDirUtils.createTempDirectoryIn(tempDir, "dest").resolve("cd.go.s3.json").toFile();
FileUtils.writeStringToFile(metadataDest, "{\"artifactId\":{}}", StandardCharsets.UTF_8);
jobIdentifier = new JobIdentifier("cruise", -10, "1", "dev", "1", "windows", 1L);
artifactStore = new ArtifactStore("s3", PLUGIN_ID, ConfigurationPropertyMother.create("ACCESS_KEY", true, "hksjdfhsksdfh"));
fetchPluggableArtifactTask = new FetchPluggableArtifactTask(new CaseInsensitiveString("dev"), new CaseInsensitiveString("windows"), "artifactId", ConfigurationPropertyMother.create("Destination", false, "build/"));
sourceOnServer = format("%s/%s", PLUGGABLE_ARTIFACT_METADATA_FOLDER, "cd.go.s3.json");
when(checksumFileHandler.handleResult(SC_OK, publisher)).thenReturn(true);
}
Aggregations