use of com.thoughtworks.go.util.command.DevNull in project gocd by gocd.
the class MaterialAgentFactoryTest method shouldCreateMaterialAgent_withAgentsUuidAsSubprocessExecutionContextNamespace.
@Test
public void shouldCreateMaterialAgent_withAgentsUuidAsSubprocessExecutionContextNamespace() throws IOException {
String agentUuid = "uuid-01783738";
File workingDirectory = temporaryFolder.newFolder();
MaterialAgentFactory factory = new MaterialAgentFactory(new ProcessOutputStreamConsumer(new DevNull(), new DevNull()), workingDirectory, new AgentIdentifier("host", "1.1.1.1", agentUuid), packageRepositoryExtension, scmExtension);
GitMaterial gitMaterial = new GitMaterial("http://foo", "master", "dest_folder");
MaterialAgent agent = factory.createAgent(new MaterialRevision(gitMaterial));
assertThat(agent, is(instanceOf(AbstractMaterialAgent.class)));
SubprocessExecutionContext execCtx = (SubprocessExecutionContext) ReflectionUtil.getField(agent, "execCtx");
assertThat(execCtx.getProcessNamespace("fingerprint"), is(CachedDigestUtils.sha256Hex(String.format("%s%s%s", "fingerprint", agentUuid, gitMaterial.workingdir(workingDirectory)))));
}
Aggregations