Search in sources :

Example 1 with CustomConfigurationsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails in project cloudbreak by hortonworks.

the class CustomConfigurationsToCustomConfigurationsDetailsConverter method convert.

public CustomConfigurationsDetails convert(CustomConfigurations customConfigurations) {
    CustomConfigurationsDetails customConfigurationsDetails = new CustomConfigurationsDetails();
    customConfigurationsDetails.setId(customConfigurations.getId());
    customConfigurationsDetails.setCustomConfigurationsName(customConfigurations.getName());
    if (customConfigurations.getConfigurations() != null) {
        customConfigurationsDetails.setServices(getServicesList(customConfigurations.getConfigurations()));
        customConfigurationsDetails.setRoles(getRolesList(customConfigurations.getConfigurations()));
    }
    customConfigurationsDetails.setRuntimeVersion(customConfigurations.getRuntimeVersion());
    return customConfigurationsDetails;
}
Also used : CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails)

Example 2 with CustomConfigurationsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails in project cloudbreak by hortonworks.

the class CustomConfigurationsToCustomConfigurationsDetailsConverterTest method testConvertEmptyNoNPE.

@Test
void testConvertEmptyNoNPE() {
    CustomConfigurations customConfigurations = new CustomConfigurations();
    CustomConfigurationsDetails customConfigurationsDetails = underTest.convert(customConfigurations);
    assertThat(customConfigurationsDetails).isNotNull();
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails) Test(org.junit.jupiter.api.Test)

Example 3 with CustomConfigurationsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails in project cloudbreak by hortonworks.

the class CustomConfigurationsToCustomConfigurationsDetailsConverterTest method testConvert.

@Test
void testConvert() {
    CustomConfigurations customConfigurations = new CustomConfigurations();
    customConfigurations.setId(1L);
    customConfigurations.setName("test-name");
    customConfigurations.setConfigurations(Sets.newHashSet(new CustomConfigurationProperty("property1", "value1", null, "service1"), new CustomConfigurationProperty("property2", "value2", "role2", "service2"), new CustomConfigurationProperty("property3", "value3", null, "service3"), new CustomConfigurationProperty("property4", "value4", "role4", "service4")));
    customConfigurations.setRuntimeVersion("test-runtime-version");
    CustomConfigurationsDetails customConfigurationsDetails = underTest.convert(customConfigurations);
    assertThat(customConfigurationsDetails).isNotNull();
    assertThat(customConfigurationsDetails.getCustomConfigurationsName()).isEqualTo("test-name");
    assertThat(customConfigurationsDetails.getId()).isEqualTo(1L);
    assertThat(customConfigurationsDetails.getRuntimeVersion()).isEqualTo("test-runtime-version");
    assertThat(customConfigurationsDetails.getRoles()).hasSameElementsAs(Lists.newArrayList("role2", "role4"));
    assertThat(customConfigurationsDetails.getServices()).hasSameElementsAs(Lists.newArrayList("service1", "service2", "service3", "service4"));
}
Also used : CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails) Test(org.junit.jupiter.api.Test)

Example 4 with CustomConfigurationsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails in project cloudbreak by hortonworks.

the class StackToStackDetailsConverterTest method testConversionWithCustomConfigsAndClusterInstalled.

@Test
public void testConversionWithCustomConfigsAndClusterInstalled() {
    // GIVEN
    Stack stack = createStack();
    Cluster cluster = new Cluster();
    CustomConfigurations customConfigurations = new CustomConfigurations();
    cluster.setCustomConfigurations(customConfigurations);
    stack.setCluster(cluster);
    CustomConfigurationsDetails customConfigurationsDetails = new CustomConfigurationsDetails();
    Mockito.when(customConfigurationsToCustomConfigurationsDetailsConverter.convert(any(CustomConfigurations.class))).thenReturn(customConfigurationsDetails);
    // WHEN
    StackDetails actual = underTest.convert(stack);
    // THEN
    Assertions.assertNotNull(actual.getCustomConfigurations());
    Assertions.assertEquals(customConfigurationsDetails, actual.getCustomConfigurations());
}
Also used : CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) Cluster(com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster) StackDetails(com.sequenceiq.cloudbreak.structuredevent.event.StackDetails) CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails) Stack(com.sequenceiq.cloudbreak.domain.stack.Stack) Test(org.junit.jupiter.api.Test)

Example 5 with CustomConfigurationsDetails

use of com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails in project cloudbreak by hortonworks.

the class StructuredEventToCDPClusterShapeConverterTest method createCustomConfigurationsDetails.

private CustomConfigurationsDetails createCustomConfigurationsDetails() {
    CustomConfigurationsDetails customConfigurationsDetails = new CustomConfigurationsDetails();
    customConfigurationsDetails.setServices(List.of("service1", "service2", "service3"));
    customConfigurationsDetails.setRoles(List.of("role1", "role2"));
    customConfigurationsDetails.setRuntimeVersion("7.2.15");
    return customConfigurationsDetails;
}
Also used : CustomConfigurationsDetails(com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails)

Aggregations

CustomConfigurationsDetails (com.sequenceiq.cloudbreak.structuredevent.event.CustomConfigurationsDetails)5 CustomConfigurations (com.sequenceiq.cloudbreak.domain.CustomConfigurations)3 Test (org.junit.jupiter.api.Test)3 CustomConfigurationProperty (com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty)1 Stack (com.sequenceiq.cloudbreak.domain.stack.Stack)1 Cluster (com.sequenceiq.cloudbreak.domain.stack.cluster.Cluster)1 StackDetails (com.sequenceiq.cloudbreak.structuredevent.event.StackDetails)1