Search in sources :

Example 1 with DTOEntity

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()));
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) BuildConfigurationRef(org.jboss.pnc.dto.BuildConfigurationRef) BuildConfigurationClient(org.jboss.pnc.client.BuildConfigurationClient) DTOEntity(org.jboss.pnc.dto.DTOEntity) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 2 with DTOEntity

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());
}
Also used : BuildConfiguration(org.jboss.pnc.dto.BuildConfiguration) BuildConfigurationRef(org.jboss.pnc.dto.BuildConfigurationRef) BuildConfigurationClient(org.jboss.pnc.client.BuildConfigurationClient) DTOEntity(org.jboss.pnc.dto.DTOEntity) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

InSequence (org.jboss.arquillian.junit.InSequence)2 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)2 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)2 BuildConfigurationRef (org.jboss.pnc.dto.BuildConfigurationRef)2 DTOEntity (org.jboss.pnc.dto.DTOEntity)2 ContainerTest (org.jboss.pnc.test.category.ContainerTest)2 Test (org.junit.Test)2