Search in sources :

Example 21 with GroupConfiguration

use of org.jboss.pnc.dto.GroupConfiguration in project pnc by project-ncl.

the class GroupConfigurationProviderTest method testStore.

@Test
public void testStore() {
    final String name = "NewNAME";
    final String id = "12";
    org.jboss.pnc.dto.GroupConfiguration groupConfiguration = GroupConfiguration.builder().name(name).productVersion(ProductVersionRef.refBuilder().id(id).build()).build();
    org.jboss.pnc.dto.GroupConfiguration stored = provider.store(groupConfiguration);
    assertThat(stored).isNotNull();
    assertThat(stored.getId()).isNotNull();
    assertThat(stored.getName()).isEqualTo(name);
    assertThat(stored.getProductVersion().getId()).isEqualTo(id);
}
Also used : GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) Test(org.junit.Test)

Example 22 with GroupConfiguration

use of org.jboss.pnc.dto.GroupConfiguration in project pnc by project-ncl.

the class GroupConfigurationProviderTest method testGetSpecific.

@Test
public void testGetSpecific() {
    GroupConfiguration groupConfiguration = provider.getSpecific(bcs.getId().toString());
    assertThat(groupConfiguration).isNotNull();
    assertThat(groupConfiguration.getId()).isEqualTo(bcs.getId().toString());
    assertThat(groupConfiguration.getName()).isEqualTo(bcs.getName());
}
Also used : GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) Test(org.junit.Test)

Example 23 with GroupConfiguration

use of org.jboss.pnc.dto.GroupConfiguration in project pnc by project-ncl.

the class GroupConfigurationProviderTest method testRemoveConfiguration.

@Test
public void testRemoveConfiguration() {
    // With
    // 
    org.jboss.pnc.dto.GroupConfiguration groupConfiguration = provider.getSpecific("1");
    BuildConfiguration toRemove = bcs.getBuildConfigurations().stream().findFirst().get();
    when(buildConfigurationRepository.queryById(toRemove.getId())).thenReturn(toRemove);
    assertThat(groupConfiguration.getBuildConfigs()).containsKey(toRemove.getId().toString());
    // When
    provider.removeConfiguration(groupConfiguration.getId(), toRemove.getId().toString());
    // Then
    org.jboss.pnc.dto.GroupConfiguration refreshed = provider.getSpecific(groupConfiguration.getId());
    assertThat(refreshed.getBuildConfigs().values()).doNotHave(new Condition<>(toRemove::equals, "BC is equal to 'toRemove' bc"));
}
Also used : BuildConfiguration(org.jboss.pnc.model.BuildConfiguration) GroupConfiguration(org.jboss.pnc.dto.GroupConfiguration) Test(org.junit.Test)

Aggregations

GroupConfiguration (org.jboss.pnc.dto.GroupConfiguration)23 Test (org.junit.Test)21 ContainerTest (org.jboss.pnc.test.category.ContainerTest)18 GroupConfigurationClient (org.jboss.pnc.client.GroupConfigurationClient)12 BuildConfiguration (org.jboss.pnc.dto.BuildConfiguration)6 HashMap (java.util.HashMap)5 GroupBuild (org.jboss.pnc.dto.GroupBuild)5 ProductVersion (org.jboss.pnc.dto.ProductVersion)5 BuildConfigurationClient (org.jboss.pnc.client.BuildConfigurationClient)4 ProductVersionClient (org.jboss.pnc.client.ProductVersionClient)4 GroupBuildParameters (org.jboss.pnc.rest.api.parameters.GroupBuildParameters)4 GroupConfigurationRef (org.jboss.pnc.dto.GroupConfigurationRef)3 BuildStatus (org.jboss.pnc.enums.BuildStatus)3 GroupConfigurationPatchBuilder (org.jboss.pnc.client.patch.GroupConfigurationPatchBuilder)2 ProductVersionPatchBuilder (org.jboss.pnc.client.patch.ProductVersionPatchBuilder)2 BuildConfigurationRef (org.jboss.pnc.dto.BuildConfigurationRef)2 Test (org.junit.jupiter.api.Test)2 Undertow (io.undertow.Undertow)1 Method (java.lang.reflect.Method)1 Path (java.nio.file.Path)1