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);
}
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;
}
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();
}
Aggregations