use of com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty in project cloudbreak by hortonworks.
the class CustomConfigurationsService method cloneCustomConfigs.
private CustomConfigurations cloneCustomConfigs(CustomConfigurations existingCustomConfigurations, String newName, String newRuntimeVersion) {
CustomConfigurations clone = new CustomConfigurations(existingCustomConfigurations);
Set<CustomConfigurationProperty> newConfigSet = existingCustomConfigurations.getConfigurations().stream().map(config -> new CustomConfigurationProperty(config.getName(), config.getValue(), config.getRoleType(), config.getServiceType())).collect(Collectors.toSet());
clone.setConfigurations(newConfigSet);
clone.setName(newName);
clone.setRuntimeVersion(newRuntimeVersion);
return clone;
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty 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"));
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty in project cloudbreak by hortonworks.
the class CustomConfigurationPropertyConverterTest method testConvertFromCustomConfigurationPropertyParameters.
@Test
void testConvertFromCustomConfigurationPropertyParameters() {
CustomConfigurationPropertyParameters property = new CustomConfigurationPropertyParameters();
property.setName(TEST_PROPERTY_NAME);
property.setValue(TEST_PROPERTY_VALUE);
property.setRoleType(TEST_ROLE);
property.setServiceType(TEST_SERVICE);
CustomConfigurationProperty result = underTest.convertFromRequestJson(property);
assertEquals(TEST_PROPERTY_NAME, result.getName());
assertEquals(TEST_PROPERTY_VALUE, result.getValue());
assertEquals(TEST_ROLE, result.getRoleType());
assertEquals(TEST_SERVICE, result.getServiceType());
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty in project cloudbreak by hortonworks.
the class CustomConfigurationsV4RequestToCustomConfigurationsConverterTest method testConvert.
@Test
void testConvert() {
property.setName("property1");
property.setValue("value1");
property.setRoleType("role1");
property.setServiceType("service1");
request.setName("test");
request.setConfigurations(Set.of(property));
request.setRuntimeVersion("7.2.8");
when(customConfigurationPropertyConverter.convertFromRequestJson(any(CustomConfigurationPropertyParameters.class))).thenReturn(new CustomConfigurationProperty("property1", "value1", "role1", "service1"));
when(customConfigurationPropertyConverter.convertToResponseJson(any(CustomConfigurationProperty.class))).thenReturn(property);
CustomConfigurations result = underTest.convert(request);
assertEquals(request.getName(), result.getName());
assertEquals(request.getConfigurations(), result.getConfigurations().stream().map(c -> customConfigurationPropertyConverter.convertToResponseJson(c)).collect(Collectors.toSet()));
assertEquals(request.getRuntimeVersion(), result.getRuntimeVersion());
}
use of com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty in project cloudbreak by hortonworks.
the class CustomConfigurationPropertyConverterTest method testConvertToCustomConfigurationPropertyParameters.
@Test
void testConvertToCustomConfigurationPropertyParameters() {
CustomConfigurationProperty property = new CustomConfigurationProperty();
property.setName(TEST_PROPERTY_NAME);
property.setSecretValue(TEST_PROPERTY_VALUE);
property.setRoleType(TEST_ROLE);
property.setServiceType(TEST_SERVICE);
CustomConfigurationPropertyParameters result = underTest.convertToResponseJson(property);
assertEquals(TEST_PROPERTY_NAME, result.getName());
assertEquals(TEST_PROPERTY_VALUE, result.getValue());
assertEquals(TEST_ROLE, result.getRoleType());
assertEquals(TEST_SERVICE, result.getServiceType());
}
Aggregations