Search in sources :

Example 41 with RevisionContext

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

the class TFSMaterialUpdaterTest method mockRevisionContext.

public void mockRevisionContext() {
    String mockRevision = "11111";
    Revision revision = mock(Revision.class);
    when(revision.getRevision()).thenReturn(mockRevision);
    revisionContext = mock(RevisionContext.class);
    when(revisionContext.getLatestRevision()).thenReturn(revision);
}
Also used : Revision(com.thoughtworks.go.domain.materials.Revision) RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext)

Example 42 with RevisionContext

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

the class TfsExecutor method execute.

@Override
public boolean execute(BuildCommand command, BuildSession buildSession) {
    String url = command.getStringArg("url");
    String username = command.getStringArg("username");
    String password = command.getStringArg("password");
    String domain = command.getStringArg("domain");
    String projectPath = command.getStringArg("projectPath");
    String revision = command.getStringArg("revision");
    File workingDir = buildSession.resolveRelativeDir(command.getWorkingDirectory());
    ConsoleOutputStreamConsumer consoleOutputStreamConsumer = new LabeledOutputStreamConsumer(TaggedStreamConsumer.PREP, TaggedStreamConsumer.PREP_ERR, buildSession.processOutputStreamConsumer());
    RevisionContext revisionContext = new RevisionContext(new StringRevision(revision));
    AgentSubprocessExecutionContext execCtx = new AgentSubprocessExecutionContext(buildSession.getAgentIdentifier(), workingDir.getAbsolutePath());
    createMaterial(url, username, password, domain, projectPath).updateTo(consoleOutputStreamConsumer, workingDir, revisionContext, execCtx);
    return true;
}
Also used : LabeledOutputStreamConsumer(com.thoughtworks.go.util.command.LabeledOutputStreamConsumer) RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) ConsoleOutputStreamConsumer(com.thoughtworks.go.util.command.ConsoleOutputStreamConsumer) File(java.io.File) AgentSubprocessExecutionContext(com.thoughtworks.go.domain.materials.AgentSubprocessExecutionContext)

Example 43 with RevisionContext

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

the class GitMaterialShallowCloneTest method shouldBeAbleToUpdateToRevisionNotFetched.

@Test
void shouldBeAbleToUpdateToRevisionNotFetched() {
    GitMaterial material = new GitMaterial(repo.projectRepositoryUrl(), true);
    material.updateTo(inMemoryConsumer(), workingDir, new RevisionContext(REVISION_3, REVISION_2, 2), context());
    assertThat(localRepoFor(material).currentRevision()).isEqualTo(REVISION_3.getRevision());
    assertThat(localRepoFor(material).containsRevisionInBranch(REVISION_2)).isTrue();
    assertThat(localRepoFor(material).containsRevisionInBranch(REVISION_3)).isTrue();
}
Also used : RevisionContext(com.thoughtworks.go.domain.materials.RevisionContext) Test(org.junit.jupiter.api.Test)

Aggregations

RevisionContext (com.thoughtworks.go.domain.materials.RevisionContext)43 Test (org.junit.Test)37 File (java.io.File)23 StringRevision (com.thoughtworks.go.domain.materials.mercurial.StringRevision)17 GitTestRepo (com.thoughtworks.go.domain.materials.git.GitTestRepo)9 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)9 GitSubmoduleRepos (com.thoughtworks.go.helper.GitSubmoduleRepos)6 Modification (com.thoughtworks.go.domain.materials.Modification)5 Test (org.junit.jupiter.api.Test)4 InMemoryStreamConsumer (com.thoughtworks.go.util.command.InMemoryStreamConsumer)3 StringContains.containsString (org.hamcrest.core.StringContains.containsString)3 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)2 TestSubprocessExecutionContext (com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext)2 HgTestRepo (com.thoughtworks.go.helper.HgTestRepo)2 RegexMatcher (com.thoughtworks.go.matchers.RegexMatcher)2 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)1 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)1 AgentSubprocessExecutionContext (com.thoughtworks.go.domain.materials.AgentSubprocessExecutionContext)1 Revision (com.thoughtworks.go.domain.materials.Revision)1 SvnTestRepo (com.thoughtworks.go.helper.SvnTestRepo)1