Search in sources :

Example 21 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class StackToTemplatePreparationObjectConverter method updateFileSystemViewWithBackupLocation.

private void updateFileSystemViewWithBackupLocation(DetailedEnvironmentResponse detailedEnvironmentResponse, BaseFileSystemConfigurationsView fileSystemConfigurationView) {
    if (fileSystemConfigurationView != null) {
        BackupResponse backupResponse = detailedEnvironmentResponse.getBackup();
        TelemetryResponse telemetryResponse = detailedEnvironmentResponse.getTelemetry();
        Optional<String> backupLocation = Optional.empty();
        if (backupResponse != null && backupResponse.getStorageLocation() != null) {
            backupLocation = Optional.of(backupResponse.getStorageLocation());
        } else if (telemetryResponse != null && telemetryResponse.getLogging() != null) {
            backupLocation = Optional.of(telemetryResponse.getLogging().getStorageLocation());
        }
        if (backupLocation.isPresent()) {
            StorageLocation storageLocation = new StorageLocation();
            storageLocation.setValue(backupLocation.get());
            storageLocation.setProperty(RangerCloudStorageServiceConfigProvider.DEFAULT_BACKUP_DIR);
            StorageLocationView backupLocationView = new StorageLocationView(storageLocation);
            fileSystemConfigurationView.getLocations().add(backupLocationView);
        }
    }
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) StorageLocationView(com.sequenceiq.cloudbreak.template.filesystem.StorageLocationView) BackupResponse(com.sequenceiq.common.api.backup.response.BackupResponse) StorageLocation(com.sequenceiq.cloudbreak.domain.StorageLocation)

Example 22 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testWithSupportDestination.

@Test
void testWithSupportDestination() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.SUPPORT);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("Destination SUPPORT is not supported yet."));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 23 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class DiagnosticsCollectionValidatorTest method testWithCloudStorageWithEmptyLogging.

@Test
void testWithCloudStorageWithEmptyLogging() {
    BaseDiagnosticsCollectionRequest request = new BaseDiagnosticsCollectionRequest();
    request.setDestination(DiagnosticsDestination.CLOUD_STORAGE);
    StackV4Response stackV4Response = new StackV4Response();
    stackV4Response.setCrn(DATALAKE_CRN);
    TelemetryResponse telemetry = new TelemetryResponse();
    LoggingResponse logging = new LoggingResponse();
    telemetry.setLogging(logging);
    stackV4Response.setTelemetry(telemetry);
    BadRequestException thrown = assertThrows(BadRequestException.class, () -> underTest.validate(request, stackV4Response));
    assertTrue(thrown.getMessage().contains("S3, ABFS or GCS cloud storage logging setting should be enabled for Data Lake"));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) BaseDiagnosticsCollectionRequest(com.sequenceiq.common.api.diagnostics.BaseDiagnosticsCollectionRequest) StackV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) BadRequestException(com.sequenceiq.cloudbreak.common.exception.BadRequestException) Test(org.junit.jupiter.api.Test)

Example 24 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class EnvironmentClientServiceTest method testSdxBackupLocationOnUpgradeRequestEnabled.

@Test
public void testSdxBackupLocationOnUpgradeRequestEnabled() {
    BackupResponse backupResponse = new BackupResponse();
    backupResponse.setStorageLocation(BACKUP_LOCATION);
    LoggingResponse loggingResponse = new LoggingResponse();
    loggingResponse.setStorageLocation(LOG_LOCATION);
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    telemetryResponse.setLogging(loggingResponse);
    DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
    environmentResponse.setCloudPlatform(CLOUD_PLATFORM);
    environmentResponse.setBackup(backupResponse);
    environmentResponse.setTelemetry(telemetryResponse);
    environmentResponse.setAzure(AzureEnvironmentParameters.builder().withAzureResourceGroup(AzureResourceGroup.builder().withResourceGroupUsage(ResourceGroupUsage.MULTIPLE).build()).build());
    when(environmentEndpoint.getByCrn(anyString())).thenReturn(environmentResponse);
    Assert.assertEquals(BACKUP_LOCATION, underTest.getBackupLocation(ENV_CRN));
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) BackupResponse(com.sequenceiq.common.api.backup.response.BackupResponse) Test(org.junit.Test)

Example 25 with TelemetryResponse

use of com.sequenceiq.common.api.telemetry.response.TelemetryResponse in project cloudbreak by hortonworks.

the class CloudStorageManifesterTest method whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentity.

@Test
public void whenEnvironmentHasOnlyLoggingEnabledThenShouldApplyAsLogIdentity() {
    DetailedEnvironmentResponse environment = new DetailedEnvironmentResponse();
    environment.setCloudPlatform("AWS");
    TelemetryResponse telemetryResponse = new TelemetryResponse();
    LoggingResponse loggingResponse = new LoggingResponse();
    S3CloudStorageV1Parameters s3CloudStorageV1Parameters = new S3CloudStorageV1Parameters();
    s3CloudStorageV1Parameters.setInstanceProfile("logprofile");
    loggingResponse.setS3(s3CloudStorageV1Parameters);
    telemetryResponse.setLogging(loggingResponse);
    environment.setTelemetry(telemetryResponse);
    ClusterV4Request clusterV4Request = new ClusterV4Request();
    clusterV4Request.setBlueprintName(exampleBlueprintName);
    CloudStorageRequest cloudStorageConfigReq = underTest.initCloudStorageRequest(environment, clusterV4Request, null, new SdxClusterRequest());
    assertEquals(1, cloudStorageConfigReq.getIdentities().size());
    assertEquals(1, cloudStorageConfigReq.getIdentities().stream().filter(r -> r.getType().equals(CloudIdentityType.LOG)).collect(Collectors.toSet()).size());
    assertEquals("logprofile", cloudStorageConfigReq.getIdentities().get(0).getS3().getInstanceProfile());
}
Also used : TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) SdxCluster(com.sequenceiq.datalake.entity.SdxCluster) GcpEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.gcp.GcpEnvironmentParameters) ArgumentMatchers.anyLong(org.mockito.ArgumentMatchers.anyLong) Mock(org.mockito.Mock) FileSystemParameterV4Responses(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Responses) Assertions.assertNull(org.junit.jupiter.api.Assertions.assertNull) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) GcsCloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.GcsCloudStorageV1Parameters) ArgumentMatchers.anyBoolean(org.mockito.ArgumentMatchers.anyBoolean) AwsEnvironmentParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.AwsEnvironmentParameters) ArrayList(java.util.ArrayList) ThreadBasedUserCrnProvider(com.sequenceiq.cloudbreak.auth.ThreadBasedUserCrnProvider) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) FileSystemParameterV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.responses.FileSystemParameterV4Response) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) TelemetryResponse(com.sequenceiq.common.api.telemetry.response.TelemetryResponse) InjectMocks(org.mockito.InjectMocks) RegionAwareInternalCrnGenerator(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGenerator) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) CloudStorageCdpService(com.sequenceiq.common.model.CloudStorageCdpService) StorageLocationBase(com.sequenceiq.common.api.cloudstorage.StorageLocationBase) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) Mockito.when(org.mockito.Mockito.when) Collectors(java.util.stream.Collectors) Mockito.verify(org.mockito.Mockito.verify) FileSystemV4Endpoint(com.sequenceiq.cloudbreak.api.endpoint.v4.filesystems.FileSystemV4Endpoint) RegionAwareInternalCrnGeneratorFactory(com.sequenceiq.cloudbreak.auth.crn.RegionAwareInternalCrnGeneratorFactory) Test(org.junit.jupiter.api.Test) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) List(java.util.List) S3GuardRequestParameters(com.sequenceiq.environment.api.v1.environment.model.request.aws.S3GuardRequestParameters) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) FileSystemType(com.sequenceiq.common.model.FileSystemType) CloudIdentityType(com.sequenceiq.common.model.CloudIdentityType) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ClusterV4Request(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.request.cluster.ClusterV4Request) S3CloudStorageV1Parameters(com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters) SdxCloudStorageRequest(com.sequenceiq.sdx.api.model.SdxCloudStorageRequest) CloudStorageRequest(com.sequenceiq.common.api.cloudstorage.CloudStorageRequest) LoggingResponse(com.sequenceiq.common.api.telemetry.response.LoggingResponse) SdxClusterRequest(com.sequenceiq.sdx.api.model.SdxClusterRequest) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) Test(org.junit.jupiter.api.Test)

Aggregations

TelemetryResponse (com.sequenceiq.common.api.telemetry.response.TelemetryResponse)45 LoggingResponse (com.sequenceiq.common.api.telemetry.response.LoggingResponse)17 Test (org.junit.jupiter.api.Test)17 Test (org.junit.Test)16 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)14 CloudStorageRequest (com.sequenceiq.common.api.cloudstorage.CloudStorageRequest)10 S3CloudStorageV1Parameters (com.sequenceiq.common.api.cloudstorage.old.S3CloudStorageV1Parameters)10 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)9 StackV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.response.StackV4Response)8 StorageLocationBase (com.sequenceiq.common.api.cloudstorage.StorageLocationBase)8 SdxClusterResponse (com.sequenceiq.sdx.api.model.SdxClusterResponse)8 ArrayList (java.util.ArrayList)8 FeaturesResponse (com.sequenceiq.common.api.telemetry.response.FeaturesResponse)7 CloudIdentityType (com.sequenceiq.common.model.CloudIdentityType)7 CloudStorageCdpService (com.sequenceiq.common.model.CloudStorageCdpService)7 FileSystemType (com.sequenceiq.common.model.FileSystemType)7 List (java.util.List)7 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)7 Assertions.assertNull (org.junit.jupiter.api.Assertions.assertNull)7 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)7