use of com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response in project cloudbreak by hortonworks.
the class CustomConfigurationsToCustomConfigurationsV4ResponseConverterTest method testConvertResponseContainsCorrectCustomConfigsProperties.
@Test
void testConvertResponseContainsCorrectCustomConfigsProperties() {
Set<CustomConfigurationPropertyParameters> properties = customConfigurations.getConfigurations().stream().map(c -> customConfigurationPropertyConverter.convertToResponseJson(c)).collect(Collectors.toSet());
CustomConfigurationsV4Response response = underTest.convert(customConfigurations);
Set<CustomConfigurationPropertyParameters> result = response.getConfigurations();
assertEquals(properties, result);
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response in project cloudbreak by hortonworks.
the class CustomConfigurationsToCustomConfigurationsV4ResponseConverterTest method testConvert.
@Test
void testConvert() {
customConfigurations.setAccount("testAccount");
when(customConfigurationPropertyConverter.convertToResponseJson(any(CustomConfigurationProperty.class))).thenCallRealMethod();
CustomConfigurationsV4Response response = underTest.convert(customConfigurations);
assertEquals(customConfigurations.getName(), response.getName());
assertTrue(CollectionUtils.isEqualCollection(Sets.newHashSet("property1", "property2"), collectNames(response.getConfigurations())));
assertTrue(CollectionUtils.isEqualCollection(Sets.newHashSet("value1", "value2"), collectValues(response.getConfigurations())));
assertTrue(CollectionUtils.isEqualCollection(Sets.newHashSet("role1", null), collectRoles(response.getConfigurations())));
assertTrue(CollectionUtils.isEqualCollection(Sets.newHashSet("service2", "service1"), collectServices(response.getConfigurations())));
assertEquals(customConfigurations.getRuntimeVersion(), response.getRuntimeVersion());
assertEquals(customConfigurations.getCrn(), response.getCrn());
assertEquals(customConfigurations.getAccount(), response.getAccount());
assertEquals(customConfigurations.getCreated(), response.getCreated());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response in project cloudbreak by hortonworks.
the class CustomConfigurationsToCustomConfigurationsV4ResponseConverter method convert.
public CustomConfigurationsV4Response convert(CustomConfigurations source) {
CustomConfigurationsV4Response response = new CustomConfigurationsV4Response();
response.setName(source.getName());
response.setCreated(source.getCreated());
response.setCrn(source.getCrn());
response.setConfigurations(source.getConfigurations().stream().map(c -> customConfigurationPropertyConverter.convertToResponseJson(c)).collect(Collectors.toSet()));
response.setAccount(source.getAccount());
response.setRuntimeVersion(source.getRuntimeVersion());
return response;
}
Aggregations