use of com.thoughtworks.go.remote.work.artifact.ArtifactRequestProcessor in project gocd by gocd.
the class FetchPluggableArtifactBuilder method build.
@Override
public void build(DefaultGoPublisher publisher, EnvironmentVariableContext environmentVariableContext, TaskExtension taskExtension, ArtifactExtension artifactExtension, PluginRequestProcessorRegistry pluginRequestProcessorRegistry, String consoleLogCharset) {
downloadMetadataFile(publisher);
try {
pluginRequestProcessorRegistry.registerProcessorFor(CONSOLE_LOG.requestName(), new ArtifactRequestProcessor(publisher));
final String message = format("[%s] Fetching pluggable artifact using plugin %s.", GoConstants.PRODUCT_NAME, artifactStore.getPluginId());
LOGGER.info(message);
publisher.taggedConsumeLine(TaggedStreamConsumer.OUT, message);
artifactExtension.fetchArtifact(artifactStore.getPluginId(), artifactStore, configuration, getMetadataFromFile(artifactId), agentWorkingDirectory());
} catch (Exception e) {
publisher.taggedConsumeLine(TaggedStreamConsumer.ERR, e.getMessage());
LOGGER.error(e.getMessage(), e);
throw new RuntimeException(e);
} finally {
pluginRequestProcessorRegistry.removeProcessorFor(CONSOLE_LOG.requestName());
}
}
use of com.thoughtworks.go.remote.work.artifact.ArtifactRequestProcessor in project gocd by gocd.
the class ArtifactRequestProcessorTest method setUp.
@Before
public void setUp() throws Exception {
request = mock(GoApiRequest.class);
descriptor = mock(GoPluginDescriptor.class);
goPublisher = mock(DefaultGoPublisher.class);
artifactRequestProcessor = new ArtifactRequestProcessor(goPublisher);
when(request.apiVersion()).thenReturn("1.0");
when(descriptor.id()).thenReturn("cd.go.artifact.docker");
when(request.api()).thenReturn(CONSOLE_LOG.requestName());
}
Aggregations