Search in sources :

Example 1 with DistroXClusterV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverter method convert.

public DistroXClusterV1Request convert(ClusterV4Request source) {
    DistroXClusterV1Request request = new DistroXClusterV1Request();
    request.setExposedServices(getIfNotNull(source.getGateway(), gatewayConverter::exposedService));
    request.setDatabases(source.getDatabases());
    request.setBlueprintName(source.getBlueprintName());
    request.setUserName(null);
    request.setPassword(null);
    request.setCm(getIfNotNull(source.getCm(), cmConverter::convert));
    request.setCloudStorage(source.getCloudStorage());
    request.setProxy(source.getProxyConfigCrn());
    return request;
}
Also used : DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request)

Example 2 with DistroXClusterV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverterTest method testConvertClusterV4RequestToDistroXClusterV1RequestThenCloudStorageShouldBeSet.

@Test
void testConvertClusterV4RequestToDistroXClusterV1RequestThenCloudStorageShouldBeSet() {
    DistroXClusterV1Request result = underTest.convert(clusterV4RequestInput);
    assertNotNull(result);
    assertEquals(clusterV4RequestInput.getCloudStorage(), result.getCloudStorage());
}
Also used : DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request) Test(org.junit.jupiter.api.Test)

Example 3 with DistroXClusterV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverterTest method testConvertClusterV4RequestToDistroXClusterV1RequestWhenCmIsNullThenItShouldNotBeSet.

@Test
void testConvertClusterV4RequestToDistroXClusterV1RequestWhenCmIsNullThenItShouldNotBeSet() {
    clusterV4RequestInput.setCm(null);
    DistroXClusterV1Request result = underTest.convert(clusterV4RequestInput);
    assertNotNull(result);
    assertNull(result.getCm());
    verify(cmConverter, never()).convert(any(ClouderaManagerV4Request.class));
}
Also used : DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.jupiter.api.Test)

Example 4 with DistroXClusterV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverterTest method testConvertClusterV4RequestToDistroXClusterV1RequestThenDatabasesShouldBeSet.

@Test
void testConvertClusterV4RequestToDistroXClusterV1RequestThenDatabasesShouldBeSet() {
    DistroXClusterV1Request result = underTest.convert(clusterV4RequestInput);
    assertNotNull(result);
    assertEquals(clusterV4RequestInput.getDatabases(), result.getDatabases());
}
Also used : DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request) Test(org.junit.jupiter.api.Test)

Example 5 with DistroXClusterV1Request

use of com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request in project cloudbreak by hortonworks.

the class DistroXClusterToClusterConverterTest method testConvertClusterV4RequestToDistroXClusterV1RequestWhenCmIsNotNullThenItShouldBeSet.

@Test
void testConvertClusterV4RequestToDistroXClusterV1RequestWhenCmIsNotNullThenItShouldBeSet() {
    ClouderaManagerV1Request cmConverterResult = new ClouderaManagerV1Request();
    when(cmConverter.convert(clusterV4RequestInput.getCm())).thenReturn(cmConverterResult);
    DistroXClusterV1Request result = underTest.convert(clusterV4RequestInput);
    assertNotNull(result);
    assertEquals(cmConverterResult, result.getCm());
    verify(cmConverter, times(1)).convert(any(ClouderaManagerV4Request.class));
    verify(cmConverter, times(1)).convert(clusterV4RequestInput.getCm());
}
Also used : DistroXClusterV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request) ClouderaManagerV1Request(com.sequenceiq.distrox.api.v1.distrox.model.cluster.cm.ClouderaManagerV1Request) ClouderaManagerV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request) Test(org.junit.jupiter.api.Test)

Aggregations

DistroXClusterV1Request (com.sequenceiq.distrox.api.v1.distrox.model.cluster.DistroXClusterV1Request)15 Test (org.junit.jupiter.api.Test)10 ClouderaManagerV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.cm.ClouderaManagerV4Request)2 DistroXV1Request (com.sequenceiq.distrox.api.v1.distrox.model.DistroXV1Request)2 ClouderaManagerV1Request (com.sequenceiq.distrox.api.v1.distrox.model.cluster.cm.ClouderaManagerV1Request)2 DefaultClusterTemplateV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.clustertemplate.requests.DefaultClusterTemplateV4Request)1 ClusterV4Request (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request)1 ThreadBasedUserCrnProvider (com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider)1 RegionAwareInternalCrnGeneratorFactory (com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory)1 NullUtil.getIfNotNull (com.sequenceiq.cloudbreak.util.NullUtil.getIfNotNull)1 ClouderaManagerRepositoryV1Request (com.sequenceiq.distrox.api.v1.distrox.model.cluster.cm.repository.ClouderaManagerRepositoryV1Request)1 InstanceGroupV1Request (com.sequenceiq.distrox.api.v1.distrox.model.instancegroup.InstanceGroupV1Request)1 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)1 ProxyEndpoint (com.sequenceiq.environment.api.v1.proxy.endpoint.ProxyEndpoint)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 CollectionUtils.isEmpty (org.apache.commons.collections4.CollectionUtils.isEmpty)1 Component (org.springframework.stereotype.Component)1