Search in sources :

Example 1 with NetworkResponse

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

the class StackToStackResponseConverterTest method testConvertWithoutCredential.

@Test
public void testConvertWithoutCredential() {
    // GIVEN
    given(conversionService.convert(any(Object.class), any(Class.class))).willReturn(new ImageJson()).willReturn(new StackAuthenticationResponse()).willReturn(new CredentialResponse()).willReturn(new ClusterResponse()).willReturn(new FailurePolicyResponse()).willReturn(new NetworkResponse()).willReturn(new OrchestratorResponse()).willReturn(new CloudbreakDetailsJson());
    given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<InstanceGroupRequest>());
    // WHEN
    StackResponse result = underTest.convert(getSource());
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("credentialId", "cloudPlatform", "platformVariant", "ambariVersion", "hdpVersion", "stackTemplate", "cloudbreakDetails", "flexSubscription"));
}
Also used : InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) CloudbreakDetailsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson) ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) CredentialResponse(com.sequenceiq.cloudbreak.api.model.CredentialResponse) OrchestratorResponse(com.sequenceiq.cloudbreak.api.model.OrchestratorResponse) FailurePolicyResponse(com.sequenceiq.cloudbreak.api.model.FailurePolicyResponse) TypeDescriptor(org.springframework.core.convert.TypeDescriptor) ImageJson(com.sequenceiq.cloudbreak.api.model.ImageJson) NetworkResponse(com.sequenceiq.cloudbreak.api.model.NetworkResponse) StackAuthenticationResponse(com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse) Test(org.junit.Test)

Example 2 with NetworkResponse

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

the class NetworkToNetworkResponseConverter method convert.

@Override
public NetworkResponse convert(Network source) {
    NetworkResponse json = new NetworkResponse();
    json.setId(source.getId());
    json.setCloudPlatform(source.cloudPlatform());
    json.setName(source.getName());
    json.setDescription(source.getDescription());
    json.setSubnetCIDR(source.getSubnetCIDR());
    json.setPublicInAccount(source.isPublicInAccount());
    Json attributes = source.getAttributes();
    if (attributes != null) {
        json.setParameters(Maps.newHashMap(attributes.getMap()));
    }
    if (source.getTopology() != null) {
        json.setTopologyId(source.getTopology().getId());
    }
    return json;
}
Also used : NetworkResponse(com.sequenceiq.cloudbreak.api.model.NetworkResponse) Json(com.sequenceiq.cloudbreak.domain.json.Json)

Example 3 with NetworkResponse

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

the class StackToStackResponseConverterTest method testConvertWithoutFailurePolicy.

@Test
public void testConvertWithoutFailurePolicy() {
    // GIVEN
    getSource().setFailurePolicy(null);
    given(conversionService.convert(any(Object.class), any(Class.class))).willReturn(new ImageJson()).willReturn(new StackAuthenticationResponse()).willReturn(new CredentialResponse()).willReturn(new ClusterResponse()).willReturn(new NetworkResponse()).willReturn(new OrchestratorResponse()).willReturn(new CloudbreakDetailsJson()).willReturn(new CredentialResponse()).willReturn(new NetworkResponse());
    given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<InstanceGroupRequest>());
    // WHEN
    StackResponse result = underTest.convert(getSource());
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("failurePolicy", "platformVariant", "ambariVersion", "hdpVersion", "stackTemplate", "cloudbreakDetails", "flexSubscription"));
}
Also used : InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) CloudbreakDetailsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson) ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) CredentialResponse(com.sequenceiq.cloudbreak.api.model.CredentialResponse) OrchestratorResponse(com.sequenceiq.cloudbreak.api.model.OrchestratorResponse) TypeDescriptor(org.springframework.core.convert.TypeDescriptor) ImageJson(com.sequenceiq.cloudbreak.api.model.ImageJson) NetworkResponse(com.sequenceiq.cloudbreak.api.model.NetworkResponse) StackAuthenticationResponse(com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse) Test(org.junit.Test)

Example 4 with NetworkResponse

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

the class StackToStackResponseConverterTest method testConvertWithoutCluster.

@Test
public void testConvertWithoutCluster() {
    // GIVEN
    getSource().setCluster(null);
    given(conversionService.convert(any(Object.class), any(Class.class))).willReturn(new ImageJson()).willReturn(new StackAuthenticationResponse()).willReturn(new CredentialResponse()).willReturn(new FailurePolicyResponse()).willReturn(new NetworkResponse()).willReturn(new OrchestratorResponse()).willReturn(new CloudbreakDetailsJson());
    given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<InstanceGroupRequest>());
    getSource().setCluster(null);
    // WHEN
    StackResponse result = underTest.convert(getSource());
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("cluster", "platformVariant", "ambariVersion", "hdpVersion", "flexSubscription"));
}
Also used : InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) CloudbreakDetailsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson) CredentialResponse(com.sequenceiq.cloudbreak.api.model.CredentialResponse) OrchestratorResponse(com.sequenceiq.cloudbreak.api.model.OrchestratorResponse) FailurePolicyResponse(com.sequenceiq.cloudbreak.api.model.FailurePolicyResponse) TypeDescriptor(org.springframework.core.convert.TypeDescriptor) ImageJson(com.sequenceiq.cloudbreak.api.model.ImageJson) NetworkResponse(com.sequenceiq.cloudbreak.api.model.NetworkResponse) StackAuthenticationResponse(com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse) Test(org.junit.Test)

Example 5 with NetworkResponse

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

the class StackToStackResponseConverterTest method testConvert.

@Test
public void testConvert() {
    // GIVEN
    given(conversionService.convert(any(Object.class), any(Class.class))).willReturn(new ImageJson()).willReturn(new StackAuthenticationResponse()).willReturn(new CredentialResponse()).willReturn(new ClusterResponse()).willReturn(new FailurePolicyResponse()).willReturn(new NetworkResponse()).willReturn(new OrchestratorResponse()).willReturn(new CloudbreakDetailsJson());
    given(conversionService.convert(any(Object.class), any(TypeDescriptor.class), any(TypeDescriptor.class))).willReturn(new HashSet<InstanceGroupRequest>());
    // WHEN
    StackResponse result = underTest.convert(getSource());
    // THEN
    assertAllFieldsNotNull(result, Arrays.asList("platformVariant", "ambariVersion", "hdpVersion", "flexSubscription"));
}
Also used : InstanceGroupRequest(com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest) CloudbreakDetailsJson(com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson) ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) CredentialResponse(com.sequenceiq.cloudbreak.api.model.CredentialResponse) OrchestratorResponse(com.sequenceiq.cloudbreak.api.model.OrchestratorResponse) FailurePolicyResponse(com.sequenceiq.cloudbreak.api.model.FailurePolicyResponse) TypeDescriptor(org.springframework.core.convert.TypeDescriptor) ImageJson(com.sequenceiq.cloudbreak.api.model.ImageJson) NetworkResponse(com.sequenceiq.cloudbreak.api.model.NetworkResponse) StackAuthenticationResponse(com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse) Test(org.junit.Test)

Aggregations

NetworkResponse (com.sequenceiq.cloudbreak.api.model.NetworkResponse)5 CloudbreakDetailsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson)4 CredentialResponse (com.sequenceiq.cloudbreak.api.model.CredentialResponse)4 ImageJson (com.sequenceiq.cloudbreak.api.model.ImageJson)4 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)4 OrchestratorResponse (com.sequenceiq.cloudbreak.api.model.OrchestratorResponse)4 StackAuthenticationResponse (com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse)4 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)4 Test (org.junit.Test)4 TypeDescriptor (org.springframework.core.convert.TypeDescriptor)4 ClusterResponse (com.sequenceiq.cloudbreak.api.model.ClusterResponse)3 FailurePolicyResponse (com.sequenceiq.cloudbreak.api.model.FailurePolicyResponse)3 Json (com.sequenceiq.cloudbreak.domain.json.Json)1