use of com.thoughtworks.go.config.materials.perforce.P4Material in project gocd by gocd.
the class MaterialsTest method shouldReturnExistingP4MaterialFromMaterialsIfItContainsOne.
@Test
void shouldReturnExistingP4MaterialFromMaterialsIfItContainsOne() {
Materials materials = new Materials();
P4Material existingMaterial = new P4Material("foo", "bar");
materials.add(existingMaterial);
assertThat(materials.getP4Material()).isSameAs(existingMaterial);
}
use of com.thoughtworks.go.config.materials.perforce.P4Material in project gocd by gocd.
the class SvnPostCommitHookImplementerTest method shouldPruneListToGiveOutOnlySvnMaterials.
@Test
void shouldPruneListToGiveOutOnlySvnMaterials() {
final Material svnMaterial1 = mock(SvnMaterial.class);
final Material svnMaterial2 = mock(SvnMaterial.class);
final Material svnMaterial3 = mock(SvnMaterial.class);
final Material hgMaterial = mock(HgMaterial.class);
final Material gitMaterial = mock(GitMaterial.class);
final Material p4Material = mock(P4Material.class);
final Material tfsMaterial = mock(TfsMaterial.class);
final Material dependencyMaterial = mock(DependencyMaterial.class);
final HashSet<Material> allMaterials = new HashSet<>(Arrays.asList(svnMaterial1, svnMaterial2, svnMaterial3, gitMaterial, hgMaterial, p4Material, tfsMaterial, dependencyMaterial));
final SvnPostCommitHookImplementer spy = spy(implementer);
doAnswer(invocation -> Boolean.TRUE).when(spy).isQualified(anyString(), any(SvnMaterial.class), any(HashMap.class));
doAnswer(invocation -> new HashMap()).when(spy).createUrlToRemoteUUIDMap(allMaterials);
final HashMap params = new HashMap();
params.put(SvnPostCommitHookImplementer.UUID, "some uuid");
final Set<Material> prunedList = spy.prune(allMaterials, params);
assertThat(prunedList.size()).isEqualTo(3);
assertThat(prunedList).contains(svnMaterial1, svnMaterial2, svnMaterial3);
}
use of com.thoughtworks.go.config.materials.perforce.P4Material in project gocd by gocd.
the class P4CommandTestBase method shouldReturnEmptyModificationListWhenP4OutputIsEmpty.
@Test
void shouldReturnEmptyModificationListWhenP4OutputIsEmpty() {
P4Material anotherMaterial = p4Fixture.material(EMPTY_VIEW);
List<Modification> materialRevisions = anotherMaterial.latestModification(clientFolder, new TestSubprocessExecutionContext());
assertThat(materialRevisions.size()).isEqualTo(0);
List<Modification> mods = anotherMaterial.modificationsSince(clientFolder, new StringRevision("1"), new TestSubprocessExecutionContext());
assertThat(mods.size()).isEqualTo(0);
}
use of com.thoughtworks.go.config.materials.perforce.P4Material in project gocd by gocd.
the class P4TestRepo method material.
public P4Material material(String p4view) {
P4Material p4Material = new P4Material(serverAndPort(), p4view);
p4Material.setUsername(user);
p4Material.setPassword(password);
p4Material.setUseTickets(useTickets);
return p4Material;
}
use of com.thoughtworks.go.config.materials.perforce.P4Material in project gocd by gocd.
the class P4TestRepo method createMaterial.
private P4Material createMaterial() {
P4Material p4Material1 = new P4Material(serverAndPort(), "//depot/... //something/...");
p4Material1.setFolder("anything");
return p4Material1;
}
Aggregations