Search in sources :

Example 1 with ClusterResponse

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

the class StackToStackResponseConverterTest method testConvertWithoutNetwork.

@Test
public void testConvertWithoutNetwork() {
    // GIVEN
    getSource().setNetwork(null);
    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 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("networkId", "platformVariant", "ambariVersion", "hdpVersion", "network", "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) StackAuthenticationResponse(com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse) StackResponse(com.sequenceiq.cloudbreak.api.model.StackResponse) Test(org.junit.Test)

Example 2 with ClusterResponse

use of com.sequenceiq.cloudbreak.api.model.ClusterResponse 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 3 with ClusterResponse

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

the class ClusterV1Controller method get.

@Override
public ClusterResponse get(Long stackId) {
    Stack stack = stackService.get(stackId);
    ClusterResponse cluster = clusterService.retrieveClusterForCurrentUser(stackId, ClusterResponse.class);
    String clusterJson = clusterService.getClusterJson(stack.getAmbariIp(), stackId);
    return clusterService.getClusterResponse(cluster, clusterJson);
}
Also used : ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) AutoscaleClusterResponse(com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.Stack)

Example 4 with ClusterResponse

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

the class ClusterToClusterResponseConverterTest method testConvertWhenExtendedBlueprintTextIsNotNull.

@Test
public void testConvertWhenExtendedBlueprintTextIsNotNull() throws IOException {
    // GIVEN
    mockAll();
    getSource().setExtendedBlueprintText("extendedBlueprintText");
    // WHEN
    ClusterResponse clusterResponse = underTest.convert(getSource());
    // THEN
    assertEquals("extendedBlueprintText", clusterResponse.getExtendedBlueprintText());
}
Also used : ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) Test(org.junit.Test)

Example 5 with ClusterResponse

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

the class ClusterToClusterResponseConverterTest method testConvert.

@Test
public void testConvert() throws IOException {
    // GIVEN
    mockAll();
    getSource().setConfigStrategy(ConfigStrategy.NEVER_APPLY);
    given(stackUtil.extractAmbariIp(any(Stack.class))).willReturn("10.0.0.1");
    // WHEN
    ClusterResponse result = underTest.convert(getSource());
    // THEN
    assertEquals(1L, (long) result.getId());
    assertAllFieldsNotNull(result, Lists.newArrayList("cluster", "ambariStackDetails", "rdsConfigId", "blueprintCustomProperties", "blueprint", "rdsConfigs", "ldapConfig", "exposedKnoxServices", "customContainers", "ambariRepoDetailsJson", "ambariDatabaseDetails", "creationFinished", "kerberosResponse"));
}
Also used : ClusterResponse(com.sequenceiq.cloudbreak.api.model.ClusterResponse) Stack(com.sequenceiq.cloudbreak.domain.Stack) Test(org.junit.Test)

Aggregations

ClusterResponse (com.sequenceiq.cloudbreak.api.model.ClusterResponse)13 Test (org.junit.Test)9 CredentialResponse (com.sequenceiq.cloudbreak.api.model.CredentialResponse)5 ImageJson (com.sequenceiq.cloudbreak.api.model.ImageJson)5 OrchestratorResponse (com.sequenceiq.cloudbreak.api.model.OrchestratorResponse)5 StackAuthenticationResponse (com.sequenceiq.cloudbreak.api.model.StackAuthenticationResponse)5 StackResponse (com.sequenceiq.cloudbreak.api.model.StackResponse)5 CloudbreakDetailsJson (com.sequenceiq.cloudbreak.api.model.CloudbreakDetailsJson)4 FailurePolicyResponse (com.sequenceiq.cloudbreak.api.model.FailurePolicyResponse)4 InstanceGroupRequest (com.sequenceiq.cloudbreak.api.model.InstanceGroupRequest)4 NetworkResponse (com.sequenceiq.cloudbreak.api.model.NetworkResponse)4 Stack (com.sequenceiq.cloudbreak.domain.Stack)4 TypeDescriptor (org.springframework.core.convert.TypeDescriptor)4 AutoscaleClusterResponse (com.sequenceiq.cloudbreak.api.model.AutoscaleClusterResponse)3 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)2 InstanceGroupResponse (com.sequenceiq.cloudbreak.api.model.InstanceGroupResponse)1 StackServiceComponentDescriptor (com.sequenceiq.cloudbreak.blueprint.validation.StackServiceComponentDescriptor)1 Image (com.sequenceiq.cloudbreak.cloud.model.Image)1 CloudbreakImageNotFoundException (com.sequenceiq.cloudbreak.core.CloudbreakImageNotFoundException)1 ArrayList (java.util.ArrayList)1