use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4MultipleMaterialsTest method shouldIgnoreDestinationFolderWhenUpdateToOnServerSide.
@Test
public void shouldIgnoreDestinationFolderWhenUpdateToOnServerSide() {
P4Material p4Material = p4Fixture.material(VIEW_SRC, "dest1");
MaterialRevision revision = new MaterialRevision(p4Material, p4Material.latestModification(clientFolder, new TestSubprocessExecutionContext()));
revision.updateTo(clientFolder, inMemoryConsumer(), new TestSubprocessExecutionContext(true));
assertThat(new File(clientFolder, "dest1/net").exists(), is(false));
assertThat(new File(clientFolder, "net").exists(), is(true));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class P4TestRepo method checkInOneFile.
private List<Modification> checkInOneFile(P4Material p4Material1, String fileName, String comment) throws Exception {
File workingDir = temporaryFolder.newFolder();
P4Client client = createClient();
client.client(clientConfig(clientName, workingDir), inMemoryConsumer(), true);
File dir = new File(workingDir, p4Material1.getFolder());
dir.mkdirs();
checkout(dir);
File newFile = new File(new File(workingDir, p4Material1.getFolder()), fileName);
newFile.createNewFile();
add(workingDir, newFile.getAbsolutePath());
commit(comment, workingDir);
client.removeClient();
List<Modification> modifications = p4Material1.latestModification(workingDir, new TestSubprocessExecutionContext());
return modifications;
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class TfsMaterialTest method shouldShowLatestModification.
@Test
public void shouldShowLatestModification() throws IOException {
File dir = temporaryFolder.newFolder("tfs-dir");
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsMaterial spy = spy(tfsMaterialFirstCollectionSecondProject);
TfsCommand tfsCommand = mock(TfsCommand.class);
when(tfsCommand.latestModification(dir)).thenReturn(new ArrayList<>());
doReturn(tfsCommand).when(spy).tfs(execCtx);
List<Modification> actual = spy.latestModification(dir, execCtx);
assertThat(actual, is(new ArrayList<Modification>()));
verify(tfsCommand).latestModification(dir);
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class TfsMaterialTest method shouldLoadAllModificationsSinceAGivenRevision.
@Test
public void shouldLoadAllModificationsSinceAGivenRevision() throws IOException {
File dir = temporaryFolder.newFolder("tfs-dir");
TestSubprocessExecutionContext execCtx = new TestSubprocessExecutionContext();
TfsMaterial spy = spy(tfsMaterialFirstCollectionFirstProject);
TfsCommand tfsCommand = mock(TfsCommand.class);
when(tfsCommand.modificationsSince(dir, new StringRevision("5"))).thenReturn(new ArrayList<>());
doReturn(tfsCommand).when(spy).tfs(execCtx);
List<Modification> actual = spy.modificationsSince(dir, new StringRevision("5"), execCtx);
assertThat(actual, is(new ArrayList<Modification>()));
verify(tfsCommand).modificationsSince(dir, new StringRevision("5"));
}
use of com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext in project gocd by gocd.
the class HgMaterialDockerTest method shouldRefreshWorkingDirectoryIfUsernameInUrlChanges.
@Test
public void shouldRefreshWorkingDirectoryIfUsernameInUrlChanges() throws Exception {
HgMaterial material = new HgMaterial("http://user1:password@localhost:9999", null);
final List<Modification> modifications = material.latestModification(workingFolder, new TestSubprocessExecutionContext());
final File unversionedFile = new File(workingFolder, "unversioned.txt");
FileUtils.writeStringToFile(unversionedFile, "something", UTF_8);
assertTrue(unversionedFile.exists());
material = new HgMaterial("http://user2:password@localhost:9999", null);
material.modificationsSince(workingFolder, new StringRevision(modifications.get(0).getRevision()), new TestSubprocessExecutionContext());
assertFalse(unversionedFile.exists());
}
Aggregations