use of org.jboss.pnc.dto.DTOEntity in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method testRemoveDependency.
@Test
@InSequence(40)
public void testRemoveDependency() throws ClientException {
BuildConfigurationClient client = new BuildConfigurationClient(RestClientConfiguration.asUser());
// given
BuildConfiguration parent = client.getSpecific(configuration3Id);
Map<String, BuildConfigurationRef> oldDependencies = parent.getDependencies();
assertThat(oldDependencies).isNotEmpty();
BuildConfigurationRef toDelete = oldDependencies.values().iterator().next();
// when
client.removeDependency(parent.getId(), toDelete.getId());
// then
RemoteCollection<BuildConfiguration> all = client.getDependencies(parent.getId());
oldDependencies.remove(toDelete.getId());
assertThat(all).extracting(DTOEntity::getId).doesNotContain(toDelete.getId()).containsAll(oldDependencies.keySet().stream().collect(Collectors.toList()));
}
use of org.jboss.pnc.dto.DTOEntity in project pnc by project-ncl.
the class BuildConfigurationEndpointTest method testAddDependency.
@Test
@InSequence(20)
public void testAddDependency() throws ClientException {
BuildConfigurationClient client = new BuildConfigurationClient(RestClientConfiguration.asUser());
// given
BuildConfiguration newDependency = createBuildConfigurationAndValidateResults(projectId, environmentId, repositoryConfigurationId, "dep-" + UUID.randomUUID(), PARAMETER_KEY);
BuildConfiguration parent = client.getSpecific(configuration3Id);
Map<String, BuildConfigurationRef> oldDependencies = parent.getDependencies();
assertThat(oldDependencies).doesNotContainKey(newDependency.getId());
// when
client.addDependency(parent.getId(), newDependency);
// then
RemoteCollection<BuildConfiguration> all = client.getDependencies(parent.getId());
assertThat(all).extracting(DTOEntity::getId).containsAll(oldDependencies.keySet().stream().collect(Collectors.toList())).contains(newDependency.getId());
}
Aggregations