Search in sources :

Example 1 with CustomConfigurationPropertyParameters

use of com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters 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());
}
Also used : CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurationPropertyParameters(com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters) Test(org.junit.jupiter.api.Test)

Example 2 with CustomConfigurationPropertyParameters

use of com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters 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);
}
Also used : Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) InjectMocks(org.mockito.InjectMocks) BeforeEach(org.junit.jupiter.api.BeforeEach) Mock(org.mockito.Mock) Collection(java.util.Collection) CustomConfigurations(com.sequenceiq.cloudbreak.domain.CustomConfigurations) Set(java.util.Set) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) CollectionUtils(org.apache.commons.collections4.CollectionUtils) Sets(com.google.common.collect.Sets) Test(org.junit.jupiter.api.Test) MockitoAnnotations(org.mockito.MockitoAnnotations) CustomConfigurationsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response) Assertions.assertTrue(org.junit.jupiter.api.Assertions.assertTrue) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurationPropertyParameters(com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters) CustomConfigurationPropertyParameters(com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters) CustomConfigurationsV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response) Test(org.junit.jupiter.api.Test)

Example 3 with CustomConfigurationPropertyParameters

use of com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters 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());
}
Also used : CustomConfigurationProperty(com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty) CustomConfigurationPropertyParameters(com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters) Test(org.junit.jupiter.api.Test)

Example 4 with CustomConfigurationPropertyParameters

use of com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters in project cloudbreak by hortonworks.

the class CustomConfigurationPropertyConverter method convertToResponseJson.

public CustomConfigurationPropertyParameters convertToResponseJson(CustomConfigurationProperty source) {
    CustomConfigurationPropertyParameters response = new CustomConfigurationPropertyParameters();
    response.setName(source.getName());
    response.setValue(source.getValue());
    response.setRoleType(source.getRoleType());
    response.setServiceType(source.getServiceType());
    return response;
}
Also used : CustomConfigurationPropertyParameters(com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters)

Aggregations

CustomConfigurationPropertyParameters (com.sequenceiq.cloudbreak.api.model.CustomConfigurationPropertyParameters)4 CustomConfigurationProperty (com.sequenceiq.cloudbreak.domain.CustomConfigurationProperty)3 Test (org.junit.jupiter.api.Test)3 Sets (com.google.common.collect.Sets)1 CustomConfigurationsV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.responses.CustomConfigurationsV4Response)1 CustomConfigurations (com.sequenceiq.cloudbreak.domain.CustomConfigurations)1 Collection (java.util.Collection)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 CollectionUtils (org.apache.commons.collections4.CollectionUtils)1 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)1 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)1 Assertions.assertTrue (org.junit.jupiter.api.Assertions.assertTrue)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 InjectMocks (org.mockito.InjectMocks)1 Mock (org.mockito.Mock)1 Mockito.when (org.mockito.Mockito.when)1 MockitoAnnotations (org.mockito.MockitoAnnotations)1