Search in sources :

Example 1 with MaterialAgentFactory

use of com.thoughtworks.go.domain.materials.MaterialAgentFactory in project gocd by gocd.

the class BuildWork method prepareJob.

private void prepareJob(AgentIdentifier agentIdentifier, PackageRepositoryExtension packageRepositoryExtension, SCMExtension scmExtension) {
    goPublisher.reportAction("Start to prepare");
    goPublisher.reportCurrentStatus(Preparing);
    createWorkingDirectoryIfNotExist(workingDirectory);
    if (!plan.shouldFetchMaterials()) {
        goPublisher.consumeLineWithPrefix("Skipping material update since stage is configured not to fetch materials");
        return;
    }
    ProcessOutputStreamConsumer<GoPublisher, GoPublisher> consumer = processOutputStreamConsumer();
    MaterialAgentFactory materialAgentFactory = new MaterialAgentFactory(consumer, workingDirectory, agentIdentifier, packageRepositoryExtension, scmExtension);
    materialRevisions.getMaterials().cleanUp(workingDirectory, consumer);
    goPublisher.consumeLineWithPrefix("Start to update materials.\n");
    for (MaterialRevision revision : materialRevisions.getRevisions()) {
        materialAgentFactory.createAgent(revision).prepare();
    }
}
Also used : MaterialAgentFactory(com.thoughtworks.go.domain.materials.MaterialAgentFactory) GoPublisher(com.thoughtworks.go.work.GoPublisher) DefaultGoPublisher(com.thoughtworks.go.work.DefaultGoPublisher)

Example 2 with MaterialAgentFactory

use of com.thoughtworks.go.domain.materials.MaterialAgentFactory in project gocd by gocd.

the class DependencyMaterialAgentTest method shouldBeCreatedByAgentFactory.

@Test
public void shouldBeCreatedByAgentFactory() {
    MaterialAgentFactory factory = new MaterialAgentFactory(ProcessOutputStreamConsumer.inMemoryConsumer(), new File("blah"), new AgentIdentifier("", "", ""), null, null);
    MaterialAgent createdAgent = factory.createAgent(materialRevision("pipeline-name", 1, "pipeline-label", "stage-name", 1));
    assertThat(createdAgent, instanceOf(DependencyMaterialAgent.class));
}
Also used : MaterialAgentFactory(com.thoughtworks.go.domain.materials.MaterialAgentFactory) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) MaterialAgent(com.thoughtworks.go.domain.materials.MaterialAgent) File(java.io.File) Test(org.junit.Test)

Aggregations

MaterialAgentFactory (com.thoughtworks.go.domain.materials.MaterialAgentFactory)2 MaterialAgent (com.thoughtworks.go.domain.materials.MaterialAgent)1 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)1 DefaultGoPublisher (com.thoughtworks.go.work.DefaultGoPublisher)1 GoPublisher (com.thoughtworks.go.work.GoPublisher)1 File (java.io.File)1 Test (org.junit.Test)1