use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class SvnExternalTest method shouldGetLatestRevision.
@Test
public void shouldGetLatestRevision() {
SvnMaterial svn = svnMaterial(svnRepo.projectRepositoryUrl(), null);
SvnMaterial svnExt = svnMaterial(svnRepo.externalRepositoryUrl(), "end2end");
final Materials materials = new Materials(svn, svnExt);
final MaterialRevisions materialRevisions = materials.latestModification(svnRepo.workingFolder(), new TestSubprocessExecutionContext());
assertThat(materialRevisions.numberOfRevisions(), is(2));
MaterialRevision main = materialRevisions.getRevisions().get(0);
assertThat(main.getMaterial(), is(svn));
assertThat(main.getModifications().size(), is(1));
assertThat(main.getRevision().getRevision(), is("5"));
MaterialRevision external = materialRevisions.getRevisions().get(1);
assertThat(external.getMaterial(), is(svnExt));
assertThat(external.getRevision().getRevision(), is("4"));
assertThat(external.getModifications().size(), is(1));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class SvnMaterialMockitoTest method shouldNotDeleteWorkingDirIfSvnRepositoryUsesFileProtocol.
@Test
public void shouldNotDeleteWorkingDirIfSvnRepositoryUsesFileProtocol() throws IOException {
Subversion subversion = mock(Subversion.class);
when(subversion.getUserName()).thenReturn("");
when(subversion.getPassword()).thenReturn("");
when(subversion.isCheckExternals()).thenReturn(false);
File workingCopy = createSvnWorkingCopy(true);
when(subversion.workingRepositoryUrl(workingCopy)).thenReturn(workingCopy.getPath());
String url = "file://" + workingCopy.getPath();
when(subversion.getUrl()).thenReturn(new UrlArgument(url));
SvnMaterial svnMaterial = SvnMaterial.createSvnMaterialWithMock(subversion);
svnMaterial.setUrl(url);
svnMaterial.updateTo(outputStreamConsumer, workingCopy, new RevisionContext(revision), new TestSubprocessExecutionContext());
assertThat(workingCopy.exists(), is(true));
verify(subversion).updateTo(outputStreamConsumer, workingCopy, revision);
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class TfsMaterialTest method shouldCheckConnection.
@Test
public void shouldCheckConnection() {
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsCommand tfsCommand = mock(TfsCommand.class);
doNothing().when(tfsCommand).checkConnection();
TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
doReturn(tfsCommand).when(spy).tfs(execCtx);
assertThat(spy.checkConnection(execCtx), Is.is(ValidationBean.valid()));
verify(tfsCommand, times(1)).checkConnection();
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class HgMultipleMaterialsTest method shouldCloneMaterialToItsDestFolder.
@Test
public void shouldCloneMaterialToItsDestFolder() throws Exception {
HgMaterial material1 = repo.createMaterial("dest1");
MaterialRevision materialRevision = new MaterialRevision(material1, material1.latestModification(pipelineDir, new TestSubprocessExecutionContext()));
materialRevision.updateTo(pipelineDir, ProcessOutputStreamConsumer.inMemoryConsumer(), new TestSubprocessExecutionContext());
assertThat(new File(pipelineDir, "dest1").exists(), is(true));
assertThat(new File(pipelineDir, "dest1/.hg").exists(), is(true));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4MaterialTestBase method shouldCheckConnection.
@Test
public void shouldCheckConnection() throws Exception {
P4Material p4Material = new P4Material("localhost:9876", "p4view");
p4Material.setPassword("secret");
p4Material.setUseTickets(false);
ValidationBean validation = p4Material.checkConnection(new TestSubprocessExecutionContext());
assertThat(validation.isValid(), is(false));
assertThat(validation.getError(), containsString("Unable to connect to server localhost:9876"));
assertThat(validation.getError(), not(containsString("secret")));
}
Aggregations