Search in sources :

Example 6 with P4Material

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);
}
Also used : P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) Test(org.junit.jupiter.api.Test)

Example 7 with P4Material

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);
}
Also used : HashMap(java.util.HashMap) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) Material(com.thoughtworks.go.domain.materials.Material) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) TfsMaterial(com.thoughtworks.go.config.materials.tfs.TfsMaterial) DependencyMaterial(com.thoughtworks.go.config.materials.dependency.DependencyMaterial) GitMaterial(com.thoughtworks.go.config.materials.git.GitMaterial) SvnMaterial(com.thoughtworks.go.config.materials.svn.SvnMaterial) HgMaterial(com.thoughtworks.go.config.materials.mercurial.HgMaterial) HashSet(java.util.HashSet) Test(org.junit.jupiter.api.Test)

Example 8 with P4Material

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);
}
Also used : Modification(com.thoughtworks.go.domain.materials.Modification) TestSubprocessExecutionContext(com.thoughtworks.go.domain.materials.TestSubprocessExecutionContext) StringRevision(com.thoughtworks.go.domain.materials.mercurial.StringRevision) P4Material(com.thoughtworks.go.config.materials.perforce.P4Material) Test(org.junit.jupiter.api.Test)

Example 9 with P4Material

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;
}
Also used : P4Material(com.thoughtworks.go.config.materials.perforce.P4Material)

Example 10 with 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;
}
Also used : P4Material(com.thoughtworks.go.config.materials.perforce.P4Material)

Aggregations

P4Material (com.thoughtworks.go.config.materials.perforce.P4Material)18 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)9 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)8 GitMaterial (com.thoughtworks.go.config.materials.git.GitMaterial)8 Test (org.junit.jupiter.api.Test)8 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)7 TfsMaterial (com.thoughtworks.go.config.materials.tfs.TfsMaterial)5 Materials (com.thoughtworks.go.config.materials.Materials)3 PackageMaterial (com.thoughtworks.go.config.materials.PackageMaterial)3 ScmMaterial (com.thoughtworks.go.config.materials.ScmMaterial)3 Modification (com.thoughtworks.go.domain.materials.Modification)3 ArrayList (java.util.ArrayList)3 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 PluggableSCMMaterial (com.thoughtworks.go.config.materials.PluggableSCMMaterial)2 Material (com.thoughtworks.go.domain.materials.Material)2 HgMaterialInstance (com.thoughtworks.go.domain.materials.mercurial.HgMaterialInstance)2 PackageMaterialInstance (com.thoughtworks.go.domain.materials.packagematerial.PackageMaterialInstance)2 P4MaterialInstance (com.thoughtworks.go.domain.materials.perforce.P4MaterialInstance)2 PluggableSCMMaterialInstance (com.thoughtworks.go.domain.materials.scm.PluggableSCMMaterialInstance)2 SvnMaterialInstance (com.thoughtworks.go.domain.materials.svn.SvnMaterialInstance)2