use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class SCMMaterialSourceTest method shouldReloadSchedulableMaterialsOnConfigRepoChange.
@Test
public void shouldReloadSchedulableMaterialsOnConfigRepoChange() {
Set<MaterialConfig> schedulableMaterialConfigs = new HashSet<>(Arrays.asList(svnMaterial.config(), gitMaterial.config()));
when(goConfigService.getSchedulableSCMMaterials()).thenReturn(schedulableMaterialConfigs);
when(materialConfigConverter.toMaterials(schedulableMaterialConfigs)).thenReturn(new HashSet<>(Arrays.asList(svnMaterial, gitMaterial)));
when(serverHealthService.logs()).thenReturn(new ServerHealthStates());
source.onEntityConfigChange(mock(ConfigRepoConfig.class));
Set<Material> materials = source.materialsForUpdate();
assertThat(materials.size(), is(2));
assertTrue(materials.contains(svnMaterial));
assertTrue(materials.contains(gitMaterial));
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class GitPostCommitHookImplementerTest method shouldReturnEmptyListIfParamHasNoValueForRepoURL.
@Test
public void shouldReturnEmptyListIfParamHasNoValueForRepoURL() throws Exception {
GitMaterial material1 = mock(GitMaterial.class);
when(material1.getUrlArgument()).thenReturn(new UrlArgument("https://machine.local.git"));
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
HashMap params = new HashMap();
params.put(GitPostCommitHookImplementer.REPO_URL_PARAM_KEY, "");
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 GitPostCommitHookImplementerTest method shouldQueryOnlyGitMaterialsWhilePruning.
@Test
public void shouldQueryOnlyGitMaterialsWhilePruning() throws Exception {
SvnMaterial material1 = mock(SvnMaterial.class);
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
HashMap params = new HashMap();
params.put(GitPostCommitHookImplementer.REPO_URL_PARAM_KEY, "https://machine.local.git");
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 MercurialPostCommitHookImplementerTest method shouldReturnEmptyListWhenURLIsSpecified.
@Test
public void shouldReturnEmptyListWhenURLIsSpecified() throws Exception {
HgMaterial material = mock(HgMaterial.class);
HashSet<Material> materials = new HashSet<>(Arrays.asList(material));
Set<Material> actual = implementer.prune(materials, new HashMap());
assertThat(actual.size(), is(0));
verify(material, times(0)).getUrlArgument();
}
use of com.thoughtworks.go.domain.materials.Material in project gocd by gocd.
the class PluggableSCMPostCommitHookImplementerTest method shouldReturnEmptyListIfParamHasNoValueForSCMName.
@Test
public void shouldReturnEmptyListIfParamHasNoValueForSCMName() throws Exception {
PluggableSCMMaterial material1 = mock(PluggableSCMMaterial.class);
Set<Material> materials = new HashSet<>(Arrays.asList(material1));
Map params = new HashMap();
params.put(PluggableSCMPostCommitHookImplementer.SCM_NAME, "");
Set<Material> actual = implementer.prune(materials, params);
assertThat(actual.size(), is(0));
verifyNoMoreInteractions(material1);
}
Aggregations