@Override public AWSCredentials getCredentials() { AwsCredential herdAwsCredential = herdAWSCredentialsProvider.getAwsCredential(); return new BasicSessionCredentials(herdAwsCredential.getAwsAccessKey(), herdAwsCredential.getAwsSecretKey(), herdAwsCredential.getAwsSessionToken()); }
@Override public AWSCredentials getCredentials() { AwsCredential herdAwsCredential = herdAWSCredentialsProvider.getAwsCredential(); return new BasicSessionCredentials(herdAwsCredential.getAwsAccessKey(), herdAwsCredential.getAwsSecretKey(), herdAwsCredential.getAwsSessionToken()); }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); strategy.appendField(locator, this, "awsAccessKey", buffer, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); strategy.appendField(locator, this, "awsSecretKey", buffer, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); strategy.appendField(locator, this, "awsSessionToken", buffer, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); strategy.appendField(locator, this, "awsSessionExpirationTime", buffer, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); strategy.appendField(locator, this, "awsAccessKey", buffer, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); strategy.appendField(locator, this, "awsSecretKey", buffer, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); strategy.appendField(locator, this, "awsSessionToken", buffer, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); strategy.appendField(locator, this, "awsSessionExpirationTime", buffer, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return buffer; }
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy2 strategy) { { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); strategy.appendField(locator, this, "awsAccessKey", buffer, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); strategy.appendField(locator, this, "awsSecretKey", buffer, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); strategy.appendField(locator, this, "awsSessionToken", buffer, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); strategy.appendField(locator, this, "awsSessionExpirationTime", buffer, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return buffer; }
lhsAwsSessionToken = this.getAwsSessionToken(); String rhsAwsSessionToken; rhsAwsSessionToken = that.getAwsSessionToken(); if (!strategy.equals(LocatorUtils.property(thisLocator, "awsSessionToken", lhsAwsSessionToken), LocatorUtils.property(thatLocator, "awsSessionToken", rhsAwsSessionToken), lhsAwsSessionToken, rhsAwsSessionToken, (this.awsSessionToken!= null), (that.awsSessionToken!= null))) { return false;
lhsAwsSessionToken = this.getAwsSessionToken(); String rhsAwsSessionToken; rhsAwsSessionToken = that.getAwsSessionToken(); if (!strategy.equals(LocatorUtils.property(thisLocator, "awsSessionToken", lhsAwsSessionToken), LocatorUtils.property(thatLocator, "awsSessionToken", rhsAwsSessionToken), lhsAwsSessionToken, rhsAwsSessionToken, (this.awsSessionToken!= null), (that.awsSessionToken!= null))) { return false;
lhsAwsSessionToken = this.getAwsSessionToken(); String rhsAwsSessionToken; rhsAwsSessionToken = that.getAwsSessionToken(); if (!strategy.equals(LocatorUtils.property(thisLocator, "awsSessionToken", lhsAwsSessionToken), LocatorUtils.property(thatLocator, "awsSessionToken", rhsAwsSessionToken), lhsAwsSessionToken, rhsAwsSessionToken, (this.awsSessionToken!= null), (that.awsSessionToken!= null))) { return false;
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsAccessKey", theAwsAccessKey), currentHashCode, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSecretKey", theAwsSecretKey), currentHashCode, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionToken", theAwsSessionToken), currentHashCode, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionExpirationTime", theAwsSessionExpirationTime), currentHashCode, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsAccessKey", theAwsAccessKey), currentHashCode, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSecretKey", theAwsSecretKey), currentHashCode, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionToken", theAwsSessionToken), currentHashCode, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionExpirationTime", theAwsSessionExpirationTime), currentHashCode, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return currentHashCode; }
public int hashCode(ObjectLocator locator, HashCodeStrategy2 strategy) { int currentHashCode = 1; { String theAwsAccessKey; theAwsAccessKey = this.getAwsAccessKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsAccessKey", theAwsAccessKey), currentHashCode, theAwsAccessKey, (this.awsAccessKey!= null)); } { String theAwsSecretKey; theAwsSecretKey = this.getAwsSecretKey(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSecretKey", theAwsSecretKey), currentHashCode, theAwsSecretKey, (this.awsSecretKey!= null)); } { String theAwsSessionToken; theAwsSessionToken = this.getAwsSessionToken(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionToken", theAwsSessionToken), currentHashCode, theAwsSessionToken, (this.awsSessionToken!= null)); } { XMLGregorianCalendar theAwsSessionExpirationTime; theAwsSessionExpirationTime = this.getAwsSessionExpirationTime(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "awsSessionExpirationTime", theAwsSessionExpirationTime), currentHashCode, theAwsSessionExpirationTime, (this.awsSessionExpirationTime!= null)); } return currentHashCode; }
assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionExpirationTime());
assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionExpirationTime()); assertEquals("test", storageUnitUploadCredential.getAwsKmsKeyId());
@Test public void getStorageUnitUploadCredentialWithCreateNewVersion() { 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); Boolean createNewVersion = true; 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_UPLOAD_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); StorageUnitUploadCredential storageUnitUploadCredential = storageUnitService.getStorageUnitUploadCredential(businessObjectDataKey, createNewVersion, storageName); assertNotNull(storageUnitUploadCredential); assertNotNull(storageUnitUploadCredential.getAwsCredential()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionExpirationTime()); }
@Test public void getStorageUnitUploadCredentialAssertStorageNameTrim() { 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); Boolean createNewVersion = true; 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_UPLOAD_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); StorageUnitUploadCredential storageUnitUploadCredential = storageUnitService.getStorageUnitUploadCredential(businessObjectDataKey, createNewVersion, BLANK_TEXT + storageName + BLANK_TEXT); assertNotNull(storageUnitUploadCredential); assertNotNull(storageUnitUploadCredential.getAwsCredential()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionExpirationTime()); }
@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()); }
@Test public void getStorageUnitUploadCredentialWithBdataVersion() { 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); Boolean createNewVersion = false; 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_UPLOAD_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); StorageUnitUploadCredential storageUnitUploadCredential = storageUnitService.getStorageUnitUploadCredential(businessObjectDataKey, createNewVersion, storageName); assertNotNull(storageUnitUploadCredential); assertNotNull(storageUnitUploadCredential.getAwsCredential()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsAccessKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSecretKey()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionToken()); assertNotNull(storageUnitUploadCredential.getAwsCredential().getAwsSessionExpirationTime()); }
if (awsSessionTokenShouldBeCopiedAndSet == Boolean.TRUE) { String sourceAwsSessionToken; sourceAwsSessionToken = this.getAwsSessionToken(); String copyAwsSessionToken = ((String) strategy.copy(LocatorUtils.property(locator, "awsSessionToken", sourceAwsSessionToken), sourceAwsSessionToken, (this.awsSessionToken!= null))); copy.setAwsSessionToken(copyAwsSessionToken);
if (awsSessionTokenShouldBeCopiedAndSet == Boolean.TRUE) { String sourceAwsSessionToken; sourceAwsSessionToken = this.getAwsSessionToken(); String copyAwsSessionToken = ((String) strategy.copy(LocatorUtils.property(locator, "awsSessionToken", sourceAwsSessionToken), sourceAwsSessionToken, (this.awsSessionToken!= null))); copy.setAwsSessionToken(copyAwsSessionToken);
if (awsSessionTokenShouldBeCopiedAndSet == Boolean.TRUE) { String sourceAwsSessionToken; sourceAwsSessionToken = this.getAwsSessionToken(); String copyAwsSessionToken = ((String) strategy.copy(LocatorUtils.property(locator, "awsSessionToken", sourceAwsSessionToken), sourceAwsSessionToken, (this.awsSessionToken!= null))); copy.setAwsSessionToken(copyAwsSessionToken);