use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class StackToStackV4ResponseConverterTest method testConvertWithLoadBalancers.
@Test
public void testConvertWithLoadBalancers() throws CloudbreakImageNotFoundException {
Set<LoadBalancer> loadBalancers = Set.of(new LoadBalancer());
Stack source = getSource();
// GIVEN
given(imageService.getImage(source.getId())).willReturn(mock(Image.class));
given(imageToStackImageV4ResponseConverter.convert(any())).willReturn(new StackImageV4Response());
given(stackToCustomDomainsSettingsV4Response.convert(any())).willReturn(new CustomDomainSettingsV4Response());
given(stackAuthenticationToStackAuthenticationV4ResponseConverter.convert(any())).willReturn(new StackAuthenticationV4Response());
given(networkToNetworkV4ResponseConverter.convert(any())).willReturn(new NetworkV4Response());
given(workspaceToWorkspaceResourceV4ResponseConverter.convert(any())).willReturn(new WorkspaceResourceV4Response());
given(cloudbreakDetailsToCloudbreakDetailsV4ResponseConverter.convert(any())).willReturn(new CloudbreakDetailsV4Response());
given(stackToPlacementSettingsV4ResponseConverter.convert(any())).willReturn(new PlacementSettingsV4Response());
given(telemetryConverter.convert(any())).willReturn(new TelemetryResponse());
given(instanceGroupToInstanceGroupV4ResponseConverter.convert(any())).willReturn(new InstanceGroupV4Response());
given(databaseAvailabilityTypeToDatabaseResponseConverter.convert(any(), any())).willReturn(new DatabaseResponse());
given(loadBalancerService.findByStackId(any())).willReturn(loadBalancers);
// WHEN
source.setLoadBalancers(loadBalancers);
StackV4Response result = underTest.convert(source);
// THEN
assertNotNull(result.getLoadBalancers());
assertTrue(result.isEnableLoadBalancer());
verify(restRequestThreadLocalService).setWorkspace(source.getWorkspace());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponseWithEnabledClusterLogsCollectionFeatures.
@Test
public void testConvertToResponseWithEnabledClusterLogsCollectionFeatures() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
Features features = new Features();
features.setWorkloadAnalytics(null);
features.addClusterLogsCollection(true);
telemetry.setFeatures(features);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
assertTrue(result.getFeatures().getClusterLogsCollection().isEnabled());
assertNull(result.getFeatures().getWorkloadAnalytics());
assertNull(result.getFeatures().getMetering());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertFromEnvAndSdxResponseWithWADisabled.
@Test
public void testConvertFromEnvAndSdxResponseWithWADisabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
SdxClusterResponse sdxClusterResponse = new SdxClusterResponse();
sdxClusterResponse.setCrn("crn:cdp:cloudbreak:us-west-1:someone:sdxcluster:sdxId");
sdxClusterResponse.setName("sdxName");
FeaturesResponse featuresResponse = new FeaturesResponse();
featuresResponse.addWorkloadAnalytics(false);
response.setFeatures(featuresResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, sdxClusterResponse);
// THEN
assertNull(result.getWorkloadAnalytics());
assertFalse(result.getFeatures().getWorkloadAnalytics().isEnabled());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertToResponse.
@Test
public void testConvertToResponse() {
// GIVEN
Logging logging = new Logging();
S3CloudStorageV1Parameters s3Params = new S3CloudStorageV1Parameters();
s3Params.setInstanceProfile(INSTANCE_PROFILE_VALUE);
logging.setS3(s3Params);
Telemetry telemetry = new Telemetry();
telemetry.setLogging(logging);
// WHEN
TelemetryResponse result = underTest.convert(telemetry);
// THEN
assertEquals(INSTANCE_PROFILE_VALUE, result.getLogging().getS3().getInstanceProfile());
}
use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.
the class TelemetryConverterTest method testConvertWithCloudStorageLoggingNotEnabled.
@Test
public void testConvertWithCloudStorageLoggingNotEnabled() {
// GIVEN
TelemetryResponse response = new TelemetryResponse();
FeaturesResponse featuresResponse = new FeaturesResponse();
FeatureSetting fs = new FeatureSetting();
fs.setEnabled(false);
featuresResponse.setCloudStorageLogging(fs);
response.setFeatures(featuresResponse);
// WHEN
TelemetryRequest result = underTest.convert(response, null);
// THEN
assertFalse(result.getFeatures().getCloudStorageLogging().isEnabled());
}
Aggregations