test_class.declarator: awsClientFactory
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private AwsClientFactory awsClientFactory;
test_class.type: AwsClientFactory
test_class.var_name: awsClientFactory
test_class.declarator: cacheManager
test_class.modifier: @Autowired
      private
test_class.original_string: @Autowired
      private CacheManager cacheManager;
test_class.type: CacheManager
test_class.var_name: cacheManager
test_class.file: herd-code/herd-dao/src/test/java/org/finra/herd/dao/AwsClientFactoryTest.java
test_class.identifier: AwsClientFactoryTest
test_class.superclass: extends AbstractDaoTest
test_case.body: @Test
      public void testGetEc2ClientCacheHitMiss()
      {
          // Create an AWS parameters DTO that contains both AWS credentials and proxy information.
          AwsParamsDto awsParamsDto =
              new AwsParamsDto(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, HTTP_PROXY_HOST, HTTP_PROXY_PORT,
                  AWS_REGION_NAME_US_EAST_1);
  
          // Get an Amazon EC2 client.
          AmazonEC2 amazonEC2Client = awsClientFactory.getEc2Client(awsParamsDto);
  
          // Confirm a cache hit.
          assertEquals(amazonEC2Client, awsClientFactory.getEc2Client(
              new AwsParamsDto(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, HTTP_PROXY_HOST, HTTP_PROXY_PORT,
                  AWS_REGION_NAME_US_EAST_1)));
  
          // Confirm a cache miss due to AWS credentials.
          assertNotEquals(amazonEC2Client, awsClientFactory.getEc2Client(
              new AwsParamsDto(AWS_ASSUMED_ROLE_ACCESS_KEY_2, AWS_ASSUMED_ROLE_SECRET_KEY_2, AWS_ASSUMED_ROLE_SESSION_TOKEN_2, HTTP_PROXY_HOST, HTTP_PROXY_PORT,
                  AWS_REGION_NAME_US_EAST_1)));
  
          // Confirm a cache miss due to http proxy information.
          assertNotEquals(amazonEC2Client, awsClientFactory.getEc2Client(
              new AwsParamsDto(AWS_ASSUMED_ROLE_ACCESS_KEY, AWS_ASSUMED_ROLE_SECRET_KEY, AWS_ASSUMED_ROLE_SESSION_TOKEN, HTTP_PROXY_HOST_2, HTTP_PROXY_PORT_2,
                  AWS_REGION_NAME_US_EAST_1)));
  
          // Clear the cache.
          cacheManager.getCache(DaoSpringModuleConfig.HERD_CACHE_NAME).clear();
  
          // Confirm a cache miss due to cleared cache.
          assertNotEquals(amazonEC2Client, awsClientFactory.getEc2Client(awsParamsDto));
      }
test_case.class_method_signature: AwsClientFactoryTest.testGetEc2ClientCacheHitMiss()
test_case.full_signature: @Test public void testGetEc2ClientCacheHitMiss()
test_case.identifier: testGetEc2ClientCacheHitMiss
test_case.invocations: getEc2Client assertEquals getEc2Client assertNotEquals getEc2Client assertNotEquals getEc2Client clear getCache assertNotEquals getEc2Client
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGetEc2ClientCacheHitMiss()
focal_class.declarator: awsHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private AwsHelper awsHelper;
focal_class.type: AwsHelper
focal_class.var_name: awsHelper
focal_class.file: herd-code/herd-dao/src/main/java/org/finra/herd/dao/AwsClientFactory.java
focal_class.identifier: AwsClientFactory
focal_class.class_method_signature: AwsClientFactory.getAmazonSNSClient(AwsParamsDto awsParamsDto)
focal_class.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonSNS getAmazonSNSClient(AwsParamsDto awsParamsDto)
focal_class.identifier: getAmazonSNSClient
focal_class.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_class.parameters: (AwsParamsDto awsParamsDto)
focal_class.return: AmazonSNS
focal_class.signature: AmazonSNS getAmazonSNSClient(AwsParamsDto awsParamsDto)
focal_class.class_method_signature: AwsClientFactory.getAmazonSQSClient(AwsParamsDto awsParamsDto)
focal_class.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonSQS getAmazonSQSClient(AwsParamsDto awsParamsDto)
focal_class.identifier: getAmazonSQSClient
focal_class.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_class.parameters: (AwsParamsDto awsParamsDto)
focal_class.return: AmazonSQS
focal_class.signature: AmazonSQS getAmazonSQSClient(AwsParamsDto awsParamsDto)
focal_class.class_method_signature: AwsClientFactory.getEc2Client(AwsParamsDto awsParamsDto)
focal_class.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonEC2 getEc2Client(AwsParamsDto awsParamsDto)
focal_class.identifier: getEc2Client
focal_class.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_class.parameters: (AwsParamsDto awsParamsDto)
focal_class.return: AmazonEC2
focal_class.signature: AmazonEC2 getEc2Client(AwsParamsDto awsParamsDto)
focal_class.class_method_signature: AwsClientFactory.getEmrClient(AwsParamsDto awsParamsDto)
focal_class.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonElasticMapReduce getEmrClient(AwsParamsDto awsParamsDto)
focal_class.identifier: getEmrClient
focal_class.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_class.parameters: (AwsParamsDto awsParamsDto)
focal_class.return: AmazonElasticMapReduce
focal_class.signature: AmazonElasticMapReduce getEmrClient(AwsParamsDto awsParamsDto)
focal_class.class_method_signature: AwsClientFactory.getSesClient(AwsParamsDto awsParamsDto)
focal_class.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonSimpleEmailService getSesClient(AwsParamsDto awsParamsDto)
focal_class.identifier: getSesClient
focal_class.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_class.parameters: (AwsParamsDto awsParamsDto)
focal_class.return: AmazonSimpleEmailService
focal_class.signature: AmazonSimpleEmailService getSesClient(AwsParamsDto awsParamsDto)
focal_method.body: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME)
      public AmazonEC2 getEc2Client(AwsParamsDto awsParamsDto)
      {
          // Get client configuration.
          ClientConfiguration clientConfiguration = awsHelper.getClientConfiguration(awsParamsDto);
  
          // If specified, use the AWS credentials passed in.
          if (StringUtils.isNotBlank(awsParamsDto.getAwsAccessKeyId()))
          {
              return AmazonEC2ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(
                  new BasicSessionCredentials(awsParamsDto.getAwsAccessKeyId(), awsParamsDto.getAwsSecretKey(), awsParamsDto.getSessionToken())))
                  .withClientConfiguration(clientConfiguration).withRegion(awsParamsDto.getAwsRegionName()).build();
          }
          // Otherwise, use the default AWS credentials provider chain.
          else
          {
              return AmazonEC2ClientBuilder.standard().withClientConfiguration(clientConfiguration).withRegion(awsParamsDto.getAwsRegionName()).build();
          }
      }
focal_method.class_method_signature: AwsClientFactory.getEc2Client(AwsParamsDto awsParamsDto)
focal_method.full_signature: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public AmazonEC2 getEc2Client(AwsParamsDto awsParamsDto)
focal_method.identifier: getEc2Client
focal_method.invocations: getClientConfiguration isNotBlank getAwsAccessKeyId build withRegion withClientConfiguration withCredentials standard getAwsAccessKeyId getAwsSecretKey getSessionToken getAwsRegionName build withRegion withClientConfiguration standard getAwsRegionName
focal_method.modifiers: @Cacheable(DaoSpringModuleConfig.HERD_CACHE_NAME) public
focal_method.parameters: (AwsParamsDto awsParamsDto)
focal_method.return: AmazonEC2
focal_method.signature: AmazonEC2 getEc2Client(AwsParamsDto awsParamsDto)