Search in sources :

Example 16 with GroupConfigurationClient

use of org.jboss.pnc.client.GroupConfigurationClient in project pnc by project-ncl.

the class GroupConfigurationEndpointTest method testCreatingExistingConflicts.

@Test
public void testCreatingExistingConflicts() throws ClientException {
    GroupConfigurationClient client = new GroupConfigurationClient(RestClientConfiguration.asUser());
    String gcId = "100";
    GroupConfiguration existing = client.getSpecific(gcId).toBuilder().id(null).build();
    assertThatThrownBy(() -> client.createNew(existing)).hasCauseInstanceOf(ClientErrorException.class).has(new Condition<Throwable>((e -> ((ClientErrorException) e.getCause()).getResponse().getStatus() == 409), "Has Cause with conflicted status code 409"));
}
Also used : GroupConfigurationClient(org.jboss.pnc.client.GroupConfigurationClient) ClientErrorException(javax.ws.rs.ClientErrorException) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) ContainerTest(org.jboss.pnc.test.category.ContainerTest) Test(org.junit.Test)

Aggregations

GroupConfigurationClient (org.jboss.pnc.client.GroupConfigurationClient)16 ContainerTest (org.jboss.pnc.test.category.ContainerTest)16 Test (org.junit.Test)16 GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)12 HashMap (java.util.HashMap)5 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)5 ProductVersion (org.jboss.pnc.dto.ProductVersion)4 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)3 ProductVersionClient (org.jboss.pnc.client.ProductVersionClient)3 GroupConfigurationRef (org.jboss.pnc.dto.GroupConfigurationRef)3 GroupConfigurationPatchBuilder (org.jboss.pnc.client.patch.GroupConfigurationPatchBuilder)2 ProductVersionPatchBuilder (org.jboss.pnc.client.patch.ProductVersionPatchBuilder)2 ExecutorService (java.util.concurrent.ExecutorService)1 ClientErrorException (javax.ws.rs.ClientErrorException)1 RemoteCollection (org.jboss.pnc.client.RemoteCollection)1 RemoteResourceException (org.jboss.pnc.client.RemoteResourceException)1 BuildConfigurationRef (org.jboss.pnc.dto.BuildConfigurationRef)1