@RequestParam(value = "subPartitionValues", required = false) String subPartitionValues) return storageUnitService.getStorageUnitDownloadCredential( new BusinessObjectDataKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, herdStringHelper.splitStringWithDefaultDelimiterEscaped(subPartitionValues),
@RequestParam(value = "subPartitionValues", required = false) String subPartitionValues) return storageUnitService.getStorageUnitDownloadCredential( new BusinessObjectDataKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, herdStringHelper.splitStringWithDefaultDelimiterEscaped(subPartitionValues),
@RequestParam(value = "subPartitionValues", required = false) String subPartitionValues) StorageUnitDownloadCredential storageUnitDownloadCredential = storageUnitService.getStorageUnitDownloadCredential( new BusinessObjectDataKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, herdStringHelper.splitStringWithDefaultDelimiterEscaped(subPartitionValues),
@RequestParam(value = "subPartitionValues", required = false) String subPartitionValues) StorageUnitDownloadCredential storageUnitDownloadCredential = storageUnitService.getStorageUnitDownloadCredential( new BusinessObjectDataKey(namespace, businessObjectDefinitionName, businessObjectFormatUsage, businessObjectFormatFileType, businessObjectFormatVersion, partitionValue, herdStringHelper.splitStringWithDefaultDelimiterEscaped(subPartitionValues),
@Test public void testGetBusinessObjectDataDownloadCredential() { // Create a business object data key. BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION); // Create a delimited list of sub-partition values. String delimitedSubPartitionValues = String.join("|", SUBPARTITION_VALUES); // Create an AWS credential. AwsCredential awsCredential = new AwsCredential(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, AWS_ASSUMED_ROLE_SESSION_EXPIRATION_TIME); // Create a storage unit download credential. StorageUnitDownloadCredential storageUnitDownloadCredential = new StorageUnitDownloadCredential(awsCredential); // Mock the external calls. when(herdStringHelper.splitStringWithDefaultDelimiterEscaped(delimitedSubPartitionValues)).thenReturn(SUBPARTITION_VALUES); when(storageUnitService.getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME)).thenReturn(storageUnitDownloadCredential); // Call the method under test. BusinessObjectDataDownloadCredential result = businessObjectDataRestController .getBusinessObjectDataDownloadCredential(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, STORAGE_NAME, delimitedSubPartitionValues); // Verify the external calls. verify(herdStringHelper).splitStringWithDefaultDelimiterEscaped(delimitedSubPartitionValues); verify(storageUnitService).getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME); verifyNoMoreInteractionsHelper(); // Validate the results. assertEquals(new BusinessObjectDataDownloadCredential(awsCredential), result); }
@Test public void getStorageUnitDownloadCredential() { // Create a business object data key. BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, DATA_VERSION); // Create a delimited list of sub-partition values. String delimitedSubPartitionValues = String.join("|", SUBPARTITION_VALUES); // Create a storage unit download credential. StorageUnitDownloadCredential storageUnitDownloadCredential = new StorageUnitDownloadCredential( new AwsCredential(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, AWS_ASSUMED_ROLE_SESSION_EXPIRATION_TIME)); // Mock the external calls. when(herdStringHelper.splitStringWithDefaultDelimiterEscaped(delimitedSubPartitionValues)).thenReturn(SUBPARTITION_VALUES); when(storageUnitService.getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME)).thenReturn(storageUnitDownloadCredential); // Call the method under test. StorageUnitDownloadCredential result = storageUnitRestController .getStorageUnitDownloadCredential(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, DATA_VERSION, STORAGE_NAME, delimitedSubPartitionValues); // Verify the external calls. verify(herdStringHelper).splitStringWithDefaultDelimiterEscaped(delimitedSubPartitionValues); verify(storageUnitService).getStorageUnitDownloadCredential(businessObjectDataKey, STORAGE_NAME); verifyNoMoreInteractionsHelper(); // Validate the results. assertEquals(storageUnitDownloadCredential, result); }
@Test public void getStorageUnitDownloadCredential() { BusinessObjectDataKey businessObjectDataKey = new BusinessObjectDataKey(); businessObjectDataKey.setNamespace(NAMESPACE); businessObjectDataKey.setBusinessObjectDefinitionName(BDEF_NAME); businessObjectDataKey.setBusinessObjectFormatUsage(FORMAT_USAGE_CODE); businessObjectDataKey.setBusinessObjectFormatFileType(FORMAT_FILE_TYPE_CODE); businessObjectDataKey.setBusinessObjectFormatVersion(FORMAT_VERSION); businessObjectDataKey.setPartitionValue(PARTITION_VALUE); businessObjectDataKey.setBusinessObjectDataVersion(DATA_VERSION); String storageName = STORAGE_NAME; createBusinessObjectFormatEntity(businessObjectDataKey); // Create an S3 storage entity. List<Attribute> attributes = new ArrayList<>(); attributes.add(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_DOWNLOAD_ROLE_ARN), "testRole")); attributes.add(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), "testBucket")); attributes.add( new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_KEY_PREFIX_VELOCITY_TEMPLATE), S3_KEY_PREFIX_VELOCITY_TEMPLATE)); storageDaoTestHelper.createStorageEntity(storageName, StoragePlatformEntity.S3, attributes); StorageUnitDownloadCredential storageUnitDownloadCredential = storageUnitService.getStorageUnitDownloadCredential(businessObjectDataKey, storageName); assertNotNull(storageUnitDownloadCredential); assertNotNull(storageUnitDownloadCredential.getAwsCredential()); assertNotNull(storageUnitDownloadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitDownloadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitDownloadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitDownloadCredential.getAwsCredential().getAwsSessionExpirationTime()); }