S3DataTransfererFactory implements DataTransferFactory { @Override public S3DataTransferer createDataTransfer() { String bucketName = System.getProperty(BUCKET_NAME_PROPERTY); String region = System.getProperty(REGION_PROPERTY); String accessKey = System.getProperty(ACCESS_KEY_PROPERTY); String secretKey = System.getProperty(SECRET_KEY_PROPERTY); boolean encrypt = Boolean.getBoolean(ENCRYPT_PROPERTY); AmazonS3Client s3 = (AmazonS3Client) AmazonS3ClientBuilder.standard() .withRegion(region) .withCredentials( new AWSStaticCredentialsProvider( new BasicAWSCredentials(accessKey, secretKey))) .build(); return new S3DataTransferer(s3, bucketName, encrypt); }  @Override S3DataTransferer createDataTransfer();  }
@Test public void testCreateDataTransferer() { System.setProperty(BUCKET_NAME_PROPERTY, "test-bucket"); System.setProperty(REGION_PROPERTY, "US_WEST_1"); System.setProperty(ACCESS_KEY_PROPERTY, "23123123123"); System.setProperty(SECRET_KEY_PROPERTY, "00101010101"); System.setProperty(ENCRYPT_PROPERTY, "true"); S3DataTransfererFactory factory = new S3DataTransfererFactory(); S3DataTransferer transferer = factory.createDataTransfer(); assertThat(transferer, is(not(nullValue()))); }