use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PluggableSCMPostCommitHookImplementerTest method shouldReturnEmptyListIfParamIsMissingForSCMName.
@Test
public void shouldReturnEmptyListIfParamIsMissingForSCMName() throws Exception {
PluggableSCMMaterial material1 = mock(PluggableSCMMaterial.class);
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
Set<Material> actual = implementer.prune(materials, new HashMap());
assertThat(actual.size(), is(0));
verifyNoMoreInteractions(material1);
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PluggableSCMPostCommitHookImplementerTest method shouldQueryOnlyPluggableSCMMaterialsWhilePruning.
@Test
public void shouldQueryOnlyPluggableSCMMaterialsWhilePruning() throws Exception {
SvnMaterial material1 = mock(SvnMaterial.class);
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
Map params = new HashMap();
params.put(PluggableSCMPostCommitHookImplementer.SCM_NAME, "scm-material-1");
Set<Material> actual = implementer.prune(materials, params);
assertThat(actual.size(), is(0));
verifyNoMoreInteractions(material1);
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PluggableSCMPostCommitHookImplementerTest method shouldReturnEmptyListIfNoMatchingMaterialFound.
@Test
public void shouldReturnEmptyListIfNoMatchingMaterialFound() throws Exception {
PluggableSCMMaterial material1 = new PluggableSCMMaterial(MaterialConfigsMother.pluggableSCMMaterialConfig("material-1", null, null));
PluggableSCMMaterial material2 = new PluggableSCMMaterial(MaterialConfigsMother.pluggableSCMMaterialConfig("material-2", null, null));
Set<Material> materials = new HashSet<>(Arrays.asList(material1, material2));
Map params = new HashMap();
params.put(PluggableSCMPostCommitHookImplementer.SCM_NAME, "unknown-scm-name");
Set<Material> actual = implementer.prune(materials, params);
assertThat(actual.size(), is(0));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class SvnPostCommitHookImplementerTest method shouldReturnEmptyListWhenUUIDIsNotPresent.
@Test
public void shouldReturnEmptyListWhenUUIDIsNotPresent() {
final SvnMaterial svnMaterial1 = mock(SvnMaterial.class);
final HashSet<Material> allMaterials = new HashSet<>();
allMaterials.add(svnMaterial1);
final SvnPostCommitHookImplementer spy = spy(implementer);
final Set<Material> prunedList = spy.prune(allMaterials, new HashMap());
assertThat(prunedList.size(), is(0));
verify(spy, never()).isQualified(anyString(), any(SvnMaterial.class), any(HashMap.class));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class SvnPostCommitHookImplementerTest method shouldCreateRemoteUrlToRemoteUUIDMap.
@Test
public void shouldCreateRemoteUrlToRemoteUUIDMap() {
final SvnPostCommitHookImplementer spy = spy(implementer);
final SvnCommand svnCommand = mock(SvnCommand.class);
final Material svnMaterial1 = mock(SvnMaterial.class);
final Material hgMaterial1 = mock(HgMaterial.class);
final HashSet<Material> allMaterials = new HashSet<>(Arrays.asList(svnMaterial1, hgMaterial1));
doAnswer(new Answer() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
return svnCommand;
}
}).when(spy).getEmptySvnCommand();
spy.createUrlToRemoteUUIDMap(allMaterials);
verify(svnCommand).createUrlToRemoteUUIDMap(new HashSet<>(Arrays.asList((SvnMaterial) svnMaterial1)));
}
Aggregations