use of org.jboss.pnc.client.patch.GroupConfigurationPatchBuilder in project pnc by project-ncl.
the class GroupConfigurationEndpointTest method shouldDeleteBuildConfigWithPatch.
@Test
public void shouldDeleteBuildConfigWithPatch() throws Exception {
// given
GroupConfigurationClient groupConfigurationClient = new GroupConfigurationClient(RestClientConfiguration.asUser());
BuildConfigurationClient bcClient = new BuildConfigurationClient(RestClientConfiguration.asUser());
GroupConfiguration gc = groupConfigurationClient.getAll().iterator().next();
assertThat(gc.getBuildConfigs()).isNotEmpty();
BuildConfiguration toRemove = bcClient.getSpecific(gc.getBuildConfigs().keySet().iterator().next());
GroupConfigurationPatchBuilder builder = new GroupConfigurationPatchBuilder();
builder.removeBuildConfigs(Collections.singletonList(toRemove.getId()));
// when
groupConfigurationClient.patch(gc.getId(), builder);
// then
GroupConfiguration refresh = groupConfigurationClient.getSpecific(gc.getId());
assertThat(refresh.getBuildConfigs().keySet()).doesNotContain(toRemove.getId());
}
use of org.jboss.pnc.client.patch.GroupConfigurationPatchBuilder in project pnc by project-ncl.
the class GroupConfigurationEndpointTest method shouldPatchGroupConfiguration.
@Test
public void shouldPatchGroupConfiguration() throws ClientException, PatchBuilderException {
GroupConfigurationClient client = new GroupConfigurationClient(RestClientConfiguration.asUser());
GroupConfiguration groupConfiguration = client.getAll().iterator().next();
String id = groupConfiguration.getId();
ProductVersion newProductVersion = createProductVersion();
ProductVersion pv = ProductVersion.builder().id(newProductVersion.getId()).build();
GroupConfigurationPatchBuilder builder = new GroupConfigurationPatchBuilder().replaceProductVersion(pv);
GroupConfiguration updated = client.patch(id, builder);
assertThat(updated.getProductVersion().getVersion()).isEqualTo(newProductVersion.getVersion());
}
Aggregations