@Test public void validateNoProtocol() { ObjectStorageMetadataRequest request = ObjectStorageMetadataRequest.builder() .withCloudPlatform(CLOUD_PLATFORM) .withCredential(CLOUD_CREDENTIAL) .withObjectStoragePath(BUCKET_NAME) .build(); ObjectStorageMetadataResponse response = ObjectStorageMetadataResponse.builder().withRegion(ENV_REGION).withStatus(ResponseStatus.OK).build(); when(cloudProviderServicesEndpoint.getObjectStorageMetaData(eq(request))).thenReturn(response); ValidationResultBuilder validationResultBuilder = new ValidationResultBuilder(); underTest.validate(OBJECT_PATH, FileSystemType.S3, environment, validationResultBuilder); assertFalse(validationResultBuilder.build().hasError()); }
public void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder) { String bucketName = getBucketName(fileSystemType, storageLocation); Credential credential = getCredential(environment); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential); ObjectStorageMetadataRequest request = createObjectStorageMetadataRequest(environment.getCloudPlatform(), cloudCredential, bucketName); ObjectStorageMetadataResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> cloudProviderServicesV4Endopint.getObjectStorageMetaData(request)); resultBuilder.ifError(() -> response.getStatus() == ResponseStatus.OK && !environment.getLocation().getName().equals(response.getRegion()), String.format("Object storage location [%s] of bucket '%s' must match environment location [%s]", response.getRegion(), bucketName, environment.getLocation().getName())); }
CloudStorageLocationValidator { public void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder) { String bucketName = getBucketName(fileSystemType, storageLocation); Credential credential = getCredential(environment); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential); ObjectStorageMetadataRequest request = createObjectStorageMetadataRequest(environment.getCloudPlatform(), cloudCredential, bucketName); ObjectStorageMetadataResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> cloudProviderServicesV4Endopint.getObjectStorageMetaData(request)); resultBuilder.ifError(() -> response.getStatus() == ResponseStatus.OK && !environment.getLocation().getName().equals(response.getRegion()), String.format("Object storage location [%s] of bucket '%s' must match environment location [%s]", response.getRegion(), bucketName, environment.getLocation().getName())); } }
CloudStorageLocationValidator { public void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder) { String bucketName = getBucketName(fileSystemType, storageLocation); Credential credential = getCredential(environment); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential); ObjectStorageMetadataRequest request = createObjectStorageMetadataRequest(environment.getCloudPlatform(), cloudCredential, bucketName); ObjectStorageMetadataResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> cloudProviderServicesV4Endopint.getObjectStorageMetaData(request)); resultBuilder.ifError(() -> response.getStatus() == ResponseStatus.OK && !environment.getLocation().getName().equals(response.getRegion()), String.format("Object storage location [%s] of bucket '%s' must match environment location [%s]", response.getRegion(), bucketName, environment.getLocation().getName())); } CloudStorageLocationValidator(CredentialToCloudCredentialConverter credentialToCloudCredentialConverter,
            SecretService secretService, CloudProviderServicesV4Endopint cloudProviderServicesV4Endopint); }
CloudStorageLocationValidator { public void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder) { String bucketName = getBucketName(fileSystemType, storageLocation); Credential credential = getCredential(environment); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential); ObjectStorageMetadataRequest request = createObjectStorageMetadataRequest(environment.getCloudPlatform(), cloudCredential, bucketName); ObjectStorageMetadataResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> cloudProviderServicesV4Endopint.getObjectStorageMetaData(request)); resultBuilder.ifError(() -> response.getStatus() == ResponseStatus.OK && !environment.getLocation().getName().equals(response.getRegion()), String.format("Object storage location [%s] of bucket '%s' must match environment location [%s]", response.getRegion(), bucketName, environment.getLocation().getName())); } CloudStorageLocationValidator(CredentialToCloudCredentialConverter credentialToCloudCredentialConverter,
            SecretService secretService, CloudProviderServicesV4Endopint cloudProviderServicesV4Endopint); void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder); }
CloudStorageLocationValidator { public void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder) { String bucketName = getBucketName(fileSystemType, storageLocation); Credential credential = getCredential(environment); CloudCredential cloudCredential = credentialToCloudCredentialConverter.convert(credential); ObjectStorageMetadataRequest request = createObjectStorageMetadataRequest(environment.getCloudPlatform(), cloudCredential, bucketName); ObjectStorageMetadataResponse response = ThreadBasedUserCrnProvider.doAsInternalActor(() -> cloudProviderServicesV4Endopint.getObjectStorageMetaData(request)); resultBuilder.ifError(() -> response.getStatus() == ResponseStatus.OK && !environment.getLocation().getName().equals(response.getRegion()), String.format("Object storage location [%s] of bucket '%s' must match environment location [%s]", response.getRegion(), bucketName, environment.getLocation().getName())); } CloudStorageLocationValidator(CredentialToCloudCredentialConverter credentialToCloudCredentialConverter,
            SecretService secretService, CloudProviderServicesV4Endopint cloudProviderServicesV4Endopint); void validate(String storageLocation, FileSystemType fileSystemType, DetailedEnvironmentResponse environment, ValidationResultBuilder resultBuilder);  }