use of com.sequenceiq.cloudbreak.api.model.ImageJson 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"));
}
use of com.sequenceiq.cloudbreak.api.model.ImageJson 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"));
}
use of com.sequenceiq.cloudbreak.api.model.ImageJson in project cloudbreak by hortonworks.
the class ImageToImageJsonConverter method convert.
@Override
public ImageJson convert(Image source) {
ImageJson imageJson = new ImageJson();
imageJson.setImageName(source.getImageName());
imageJson.setImageCatalogUrl(Strings.isNullOrEmpty(source.getImageCatalogUrl()) ? imageCatalogService.getImageDefaultCatalogUrl() : source.getImageCatalogUrl());
imageJson.setImageCatalogName(Strings.isNullOrEmpty(source.getImageCatalogName()) ? "cloudbreak-default" : source.getImageCatalogName());
imageJson.setImageId(Strings.isNullOrEmpty(source.getImageId()) ? null : source.getImageId());
return imageJson;
}
use of com.sequenceiq.cloudbreak.api.model.ImageJson 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"));
}
use of com.sequenceiq.cloudbreak.api.model.ImageJson 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"));
}
Aggregations