AmazonWebServiceRequestAdapter extends RequestConfig { @Override public AWSCredentialsProvider getCredentialsProvider() { return request.getRequestCredentialsProvider(); } AmazonWebServiceRequestAdapter(AmazonWebServiceRequest request); @Override ProgressListener getProgressListener(); @Override RequestMetricCollector getRequestMetricsCollector(); @Override AWSCredentialsProvider getCredentialsProvider(); @Override Map<String, String> getCustomRequestHeaders(); @Override Map<String, List<String>> getCustomQueryParameters(); @Override Integer getRequestTimeout(); @Override Integer getClientExecutionTimeout(); @Override RequestClientOptions getRequestClientOptions(); @Override String getRequestType(); @Override Object getOriginalRequest();  }
@Test public void customCredentialsProviderSetInBaseRequest_IsSetOnAdapter() { EmptyAmazonWebServiceRequest request = new EmptyAmazonWebServiceRequest(); AWSCredentialsProvider credentialsProvider = mock(AWSCredentialsProvider.class); request.setRequestCredentialsProvider(credentialsProvider); AmazonWebServiceRequestAdapter adapter = new AmazonWebServiceRequestAdapter(request); assertEquals(credentialsProvider, adapter.getCredentialsProvider()); }
@Test public void customCredentialsSetInBaseRequest_IsSetOnAdapter() { EmptyAmazonWebServiceRequest request = new EmptyAmazonWebServiceRequest(); AWSCredentials credentials = new BasicAWSCredentials("akid", "skid"); request.setRequestCredentials(credentials); AmazonWebServiceRequestAdapter adapter = new AmazonWebServiceRequestAdapter(request); AWSCredentials adaptedCredentials = adapter.getCredentialsProvider().getCredentials(); assertEquals("akid", adaptedCredentials.getAWSAccessKeyId()); assertEquals("skid", adaptedCredentials.getAWSSecretKey()); }