@Test public void copyBaseTo() { final ProgressListener listener = new SyncProgressListener() { @Override public void progressChanged(ProgressEvent progressEvent) { } }; final AWSCredentials credentials = new BasicAWSCredentials("accesskey", "accessid"); final RequestMetricCollector collector = new RequestMetricCollector() { @Override public void collectMetrics(Request<?> request, Response<?> response) { } }; final AmazonWebServiceRequest from = new AmazonWebServiceRequest() { }; from.setGeneralProgressListener(listener); from.setRequestCredentials(credentials); from.setRequestMetricCollector(collector); from.putCustomRequestHeader("k1", "v1"); from.putCustomRequestHeader("k2", "v2"); from.putCustomQueryParameter("k1", "v1"); from.putCustomQueryParameter("k2", "v2a"); from.putCustomQueryParameter("k2", "v2b"); from.getRequestClientOptions().setReadLimit(1234); final AmazonWebServiceRequest to = new AmazonWebServiceRequest() { }; RequestClientOptions toOptions; verifyBaseBeforeCopy(to); from.copyBaseTo(to); verifyBaseAfterCopy(listener, credentials, collector, from, to); }
protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) { if (customRequestHeaders != null) { for (Map.Entry<String, String> e : customRequestHeaders.entrySet()) target.putCustomRequestHeader(e.getKey(), e.getValue()); } if (customQueryParameters != null) { for (Map.Entry<String, List<String>> e : customQueryParameters.entrySet()) { if (e.getValue() != null) { for (String value : e.getValue()) { target.putCustomQueryParameter(e.getKey(), value); } } } } target.setRequestCredentialsProvider(credentialsProvider); target.setGeneralProgressListener(progressListener); target.setRequestMetricCollector(requestMetricCollector); requestClientOptions.copyTo(target.getRequestClientOptions()); return target; }
AmazonWebServiceRequest implements Cloneable, ReadLimitInfo, HandlerContextAware { protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) { if (customRequestHeaders != null) { for (Map.Entry<String, String> e : customRequestHeaders.entrySet()) target.putCustomRequestHeader(e.getKey(), e.getValue()); } if (customQueryParameters != null) { for (Map.Entry<String, List<String>> e : customQueryParameters.entrySet()) { if (e.getValue() != null) { for (String value : e.getValue()) { target.putCustomQueryParameter(e.getKey(), value); } } } } target.setRequestCredentialsProvider(credentialsProvider); target.setGeneralProgressListener(progressListener); target.setRequestMetricCollector(requestMetricCollector); requestClientOptions.copyTo(target.getRequestClientOptions()); return target; } }
AmazonWebServiceRequest implements Cloneable, ReadLimitInfo, HandlerContextAware { protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) { if (customRequestHeaders != null) { for (Map.Entry<String, String> e : customRequestHeaders.entrySet()) target.putCustomRequestHeader(e.getKey(), e.getValue()); } if (customQueryParameters != null) { for (Map.Entry<String, List<String>> e : customQueryParameters.entrySet()) { if (e.getValue() != null) { for (String value : e.getValue()) { target.putCustomQueryParameter(e.getKey(), value); } } } } target.setRequestCredentialsProvider(credentialsProvider); target.setGeneralProgressListener(progressListener); target.setRequestMetricCollector(requestMetricCollector); requestClientOptions.copyTo(target.getRequestClientOptions()); return target; }  }
AmazonWebServiceRequest implements Cloneable, ReadLimitInfo, HandlerContextAware { protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) { if (customRequestHeaders != null) { for (Map.Entry<String, String> e : customRequestHeaders.entrySet()) target.putCustomRequestHeader(e.getKey(), e.getValue()); } if (customQueryParameters != null) { for (Map.Entry<String, List<String>> e : customQueryParameters.entrySet()) { if (e.getValue() != null) { for (String value : e.getValue()) { target.putCustomQueryParameter(e.getKey(), value); } } } } target.setRequestCredentialsProvider(credentialsProvider); target.setGeneralProgressListener(progressListener); target.setRequestMetricCollector(requestMetricCollector); requestClientOptions.copyTo(target.getRequestClientOptions()); return target; }  @Deprecated void setRequestCredentials(AWSCredentials credentials); @Deprecated AWSCredentials getRequestCredentials(); void setRequestCredentialsProvider(AWSCredentialsProvider credentialsProvider); AWSCredentialsProvider getRequestCredentialsProvider(); RequestClientOptions getRequestClientOptions(); RequestMetricCollector getRequestMetricCollector(); void setRequestMetricCollector(RequestMetricCollector requestMetricCollector); T withRequestMetricCollector(RequestMetricCollector metricCollector); void setGeneralProgressListener(ProgressListener progressListener); ProgressListener getGeneralProgressListener(); T withGeneralProgressListener(ProgressListener progressListener); Map<String, String> getCustomRequestHeaders(); String putCustomRequestHeader(String name, String value); Map<String, List<String>> getCustomQueryParameters(); void putCustomQueryParameter(String name, String value); @Override final int getReadLimit(); AmazonWebServiceRequest getCloneSource(); AmazonWebServiceRequest getCloneRoot(); Integer getSdkRequestTimeout(); void setSdkRequestTimeout(int sdkRequestTimeout); T withSdkRequestTimeout(int sdkRequestTimeout); Integer getSdkClientExecutionTimeout(); void setSdkClientExecutionTimeout(int sdkClientExecutionTimeout); T withSdkClientExecutionTimeout(int sdkClientExecutionTimeout); @Override void addHandlerContext(HandlerContextKey<X> key, X value); @Override @SuppressWarnings("unchecked") X getHandlerContext(HandlerContextKey<X> key); @Override AmazonWebServiceRequest clone(); }
AmazonWebServiceRequest implements Cloneable, ReadLimitInfo, HandlerContextAware { protected final <T extends AmazonWebServiceRequest> T copyBaseTo(T target) { if (customRequestHeaders != null) { for (Map.Entry<String, String> e : customRequestHeaders.entrySet()) target.putCustomRequestHeader(e.getKey(), e.getValue()); } if (customQueryParameters != null) { for (Map.Entry<String, List<String>> e : customQueryParameters.entrySet()) { if (e.getValue() != null) { for (String value : e.getValue()) { target.putCustomQueryParameter(e.getKey(), value); } } } } target.setRequestCredentialsProvider(credentialsProvider); target.setGeneralProgressListener(progressListener); target.setRequestMetricCollector(requestMetricCollector); requestClientOptions.copyTo(target.getRequestClientOptions()); return target; }  @Deprecated void setRequestCredentials(AWSCredentials credentials); @Deprecated AWSCredentials getRequestCredentials(); void setRequestCredentialsProvider(AWSCredentialsProvider credentialsProvider); AWSCredentialsProvider getRequestCredentialsProvider(); RequestClientOptions getRequestClientOptions(); RequestMetricCollector getRequestMetricCollector(); void setRequestMetricCollector(RequestMetricCollector requestMetricCollector); T withRequestMetricCollector(RequestMetricCollector metricCollector); void setGeneralProgressListener(ProgressListener progressListener); ProgressListener getGeneralProgressListener(); T withGeneralProgressListener(ProgressListener progressListener); Map<String, String> getCustomRequestHeaders(); String putCustomRequestHeader(String name, String value); Map<String, List<String>> getCustomQueryParameters(); void putCustomQueryParameter(String name, String value); @Override final int getReadLimit(); AmazonWebServiceRequest getCloneSource(); AmazonWebServiceRequest getCloneRoot(); Integer getSdkRequestTimeout(); void setSdkRequestTimeout(int sdkRequestTimeout); T withSdkRequestTimeout(int sdkRequestTimeout); Integer getSdkClientExecutionTimeout(); void setSdkClientExecutionTimeout(int sdkClientExecutionTimeout); T withSdkClientExecutionTimeout(int sdkClientExecutionTimeout); @Override void addHandlerContext(HandlerContextKey<X> key, X value); @Override @SuppressWarnings("unchecked") X getHandlerContext(HandlerContextKey<X> key); @Override AmazonWebServiceRequest clone(); static final AmazonWebServiceRequest NOOP; }