test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/StorageHelperTest.java
test_class.identifier: StorageHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testGetStorageAttributeValueByNameFromStorageEntity()
      {
          // Create an S3 storage entity.
          List<Attribute> attributes = new ArrayList<>();
          attributes.add(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE, ATTRIBUTE_VALUE_1));
          attributes.add(new Attribute(ATTRIBUTE_NAME_2_MIXED_CASE, BLANK_TEXT));
          attributes.add(new Attribute(ATTRIBUTE_NAME_3_MIXED_CASE, null));
          StorageEntity storageEntity = storageDaoTestHelper.createStorageEntity(STORAGE_NAME, StoragePlatformEntity.S3, attributes);
  
          // Retrieve optional attribute values.
          Assert.assertEquals(ATTRIBUTE_VALUE_1, storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_1_MIXED_CASE, storageEntity, false));
          Assert.assertEquals(BLANK_TEXT, storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_2_MIXED_CASE, storageEntity, false));
          Assert.assertNull(storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_3_MIXED_CASE, storageEntity, false));
  
          // Validate case insensitivity.
          Assert.assertEquals(ATTRIBUTE_VALUE_1, storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_1_MIXED_CASE.toUpperCase(), storageEntity, false));
          Assert.assertEquals(ATTRIBUTE_VALUE_1, storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_1_MIXED_CASE.toLowerCase(), storageEntity, false));
  
          // Retrieve a required attribute value.
          Assert.assertEquals(ATTRIBUTE_VALUE_1, storageHelper.getStorageAttributeValueByName(ATTRIBUTE_NAME_1_MIXED_CASE, storageEntity, true));
  
          // Try to retrieve a missing required attribute values when
          // - attribute does not exist
          // - attribute exists with a blank text value
          // - attribute exists with a null value
          String attributeNoExist = "I_DO_NOT_EXIST";
          for (String attributeName : Arrays.asList(attributeNoExist, ATTRIBUTE_NAME_2_MIXED_CASE, ATTRIBUTE_NAME_3_MIXED_CASE))
          {
              try
              {
                  storageHelper.getStorageAttributeValueByName(attributeName, storageEntity, true);
              }
              catch (IllegalStateException e)
              {
                  if (attributeName.equals(attributeNoExist))
                  {
                      Assert.assertEquals(String.format("Attribute \"%s\" for \"%s\" storage must be configured.", attributeName, STORAGE_NAME), e.getMessage());
                  }
                  else
                  {
                      Assert.assertEquals(String.format("Attribute \"%s\" for \"%s\" storage must have a value that is not blank.", attributeName, STORAGE_NAME),
                          e.getMessage());
                  }
              }
          }
      }
test_case.class_method_signature: StorageHelperTest.testGetStorageAttributeValueByNameFromStorageEntity()
test_case.full_signature: @Test public void testGetStorageAttributeValueByNameFromStorageEntity()
test_case.identifier: testGetStorageAttributeValueByNameFromStorageEntity
test_case.invocations: add add add createStorageEntity assertEquals getStorageAttributeValueByName assertEquals getStorageAttributeValueByName assertNull getStorageAttributeValueByName assertEquals getStorageAttributeValueByName toUpperCase assertEquals getStorageAttributeValueByName toLowerCase assertEquals getStorageAttributeValueByName asList getStorageAttributeValueByName equals assertEquals format getMessage assertEquals format getMessage
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetStorageAttributeValueByNameFromStorageEntity()
focal_class.declarator: stsDao
focal_class.modifier: @Autowired
      protected
focal_class.original_string: @Autowired
      protected StsDao stsDao;
focal_class.type: StsDao
focal_class.var_name: stsDao
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/StorageHelper.java
focal_class.identifier: StorageHelper
focal_class.class_method_signature: StorageHelper.getBooleanStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.full_signature: public boolean getBooleanStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.identifier: getBooleanStorageAttributeValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.return: boolean
focal_class.signature: boolean getBooleanStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.class_method_signature: StorageHelper.getS3BucketAccessParams(StorageEntity storageEntity)
focal_class.full_signature: public S3FileTransferRequestParamsDto getS3BucketAccessParams(StorageEntity storageEntity)
focal_class.identifier: getS3BucketAccessParams
focal_class.modifiers: public
focal_class.parameters: (StorageEntity storageEntity)
focal_class.return: S3FileTransferRequestParamsDto
focal_class.signature: S3FileTransferRequestParamsDto getS3BucketAccessParams(StorageEntity storageEntity)
focal_class.class_method_signature: StorageHelper.getS3FileCopyRequestParamsDto()
focal_class.full_signature: public S3FileCopyRequestParamsDto getS3FileCopyRequestParamsDto()
focal_class.identifier: getS3FileCopyRequestParamsDto
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: S3FileCopyRequestParamsDto
focal_class.signature: S3FileCopyRequestParamsDto getS3FileCopyRequestParamsDto()
focal_class.class_method_signature: StorageHelper.getS3FileTransferRequestParamsDto()
focal_class.full_signature: public S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDto()
focal_class.identifier: getS3FileTransferRequestParamsDto
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: S3FileTransferRequestParamsDto
focal_class.signature: S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDto()
focal_class.class_method_signature: StorageHelper.getS3FileTransferRequestParamsDtoByRole(String roleArn, String sessionName)
focal_class.full_signature: public S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDtoByRole(String roleArn, String sessionName)
focal_class.identifier: getS3FileTransferRequestParamsDtoByRole
focal_class.modifiers: public
focal_class.parameters: (String roleArn, String sessionName)
focal_class.return: S3FileTransferRequestParamsDto
focal_class.signature: S3FileTransferRequestParamsDto getS3FileTransferRequestParamsDtoByRole(String roleArn, String sessionName)
focal_class.class_method_signature: StorageHelper.getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, Integer defaultValue)
focal_class.full_signature: public Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, Integer defaultValue)
focal_class.identifier: getStorageAttributeIntegerValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, StorageEntity storageEntity, Integer defaultValue)
focal_class.return: Integer
focal_class.signature: Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, Integer defaultValue)
focal_class.class_method_signature: StorageHelper.getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.full_signature: public Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.identifier: getStorageAttributeIntegerValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.return: Integer
focal_class.signature: Integer getStorageAttributeIntegerValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.class_method_signature: StorageHelper.getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
focal_class.full_signature: public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
focal_class.identifier: getStorageAttributeValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, Storage storage, Boolean required)
focal_class.return: String
focal_class.signature: String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
focal_class.class_method_signature: StorageHelper.getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeValueRequired)
focal_class.full_signature: public String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeValueRequired)
focal_class.identifier: getStorageAttributeValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, StorageEntity storageEntity, boolean attributeValueRequired)
focal_class.return: String
focal_class.signature: String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeValueRequired)
focal_class.class_method_signature: StorageHelper.getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.full_signature: public String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.identifier: getStorageAttributeValueByName
focal_class.modifiers: public
focal_class.parameters: (String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.return: String
focal_class.signature: String getStorageAttributeValueByName(String attributeName, StorageEntity storageEntity, boolean attributeRequired,
          boolean attributeValueRequiredIfExists)
focal_class.class_method_signature: StorageHelper.getStorageBucketName(StorageEntity storageEntity)
focal_class.full_signature: public String getStorageBucketName(StorageEntity storageEntity)
focal_class.identifier: getStorageBucketName
focal_class.modifiers: public
focal_class.parameters: (StorageEntity storageEntity)
focal_class.return: String
focal_class.signature: String getStorageBucketName(StorageEntity storageEntity)
focal_class.class_method_signature: StorageHelper.getStorageKmsKeyId(StorageEntity storageEntity)
focal_class.full_signature: public String getStorageKmsKeyId(StorageEntity storageEntity)
focal_class.identifier: getStorageKmsKeyId
focal_class.modifiers: public
focal_class.parameters: (StorageEntity storageEntity)
focal_class.return: String
focal_class.signature: String getStorageKmsKeyId(StorageEntity storageEntity)
focal_class.class_method_signature: StorageHelper.setProxyHostAndPort(S3FileTransferRequestParamsDto params)
focal_class.full_signature: private void setProxyHostAndPort(S3FileTransferRequestParamsDto params)
focal_class.identifier: setProxyHostAndPort
focal_class.modifiers: private
focal_class.parameters: (S3FileTransferRequestParamsDto params)
focal_class.return: void
focal_class.signature: void setProxyHostAndPort(S3FileTransferRequestParamsDto params)
focal_method.body: public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
      {
          String attributeValue = null;
  
          for (Attribute attribute : storage.getAttributes())
          {
              if (attribute.getName().equalsIgnoreCase(attributeName))
              {
                  attributeValue = attribute.getValue();
                  break;
              }
          }
  
          if (required && StringUtils.isBlank(attributeValue))
          {
              throw new IllegalStateException(String.format("Attribute \"%s\" for \"%s\" storage must be configured.", attributeName, storage.getName()));
          }
  
          return attributeValue;
      }
focal_method.class_method_signature: StorageHelper.getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
focal_method.full_signature: public String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)
focal_method.identifier: getStorageAttributeValueByName
focal_method.invocations: getAttributes equalsIgnoreCase getName getValue isBlank format getName
focal_method.modifiers: public
focal_method.parameters: (String attributeName, Storage storage, Boolean required)
focal_method.return: String
focal_method.signature: String getStorageAttributeValueByName(String attributeName, Storage storage, Boolean required)