/** * Loads the test-specific Log4J configuration and resets the environment. */ public void setUp(String propertiesName) throws Exception { URL config = ClassLoader.getSystemResource(propertiesName); assertNotNull("missing configuration: " + propertiesName, config); LogManager.resetConfiguration(); PropertyConfigurator.configure(config); localLogger = Logger.getLogger(getClass()); runId = String.valueOf(System.currentTimeMillis()); resourceName = "SNSAppenderIntegrationTest-" + runId; System.setProperty("SNSAppenderIntegrationTest.resourceName", resourceName); localSNSclient = AmazonSNSClientBuilder.defaultClient(); localSQSclient = AmazonSQSClientBuilder.defaultClient(); }
/** * Returns an SNS client. * * <p>This method is provided so unit tests can mock out SNS. */ protected AmazonSNS getSNSClient() { // Use a getter here so unit tests can substitute a mock client AmazonSNS client = AmazonSNSClientBuilder.standard().withRegion(region.getName()).build(); return client; }
@Override public AmazonSNS get(SnsModule.EndpointConfig config) { AmazonSNSClientBuilder builder = AmazonSNSClientBuilder.standard(); builder.withCredentials(credentialsProvider); if (config.endpoint().isPresent()) { builder.withEndpointConfiguration( new AwsClientBuilder.EndpointConfiguration(config.getEndpoint(), config.getRegionName()) ); } else { builder.withRegion(config.getRegionName()); } return builder.build(); }
public AmazonSNS createSnsClient(String accessKey, String secretKey, String region) { String decryptedAccessKey = encryptionService.decrypt(accessKey, true); String decryptedSecretKey = encryptionService.decrypt(secretKey, true); BasicAWSCredentials credentials = new BasicAWSCredentials(decryptedAccessKey, decryptedSecretKey); AmazonSNS snsClient = AmazonSNSClientBuilder.standard().withRegion(Regions.fromName(region)).withCredentials(new AWSStaticCredentialsProvider(credentials)).build(); return snsClient; }
private void createAmazonAPIClients() { cfnClient = AmazonCloudFormationClientBuilder.defaultClient(); ec2Client = AmazonEC2ClientBuilder.defaultClient(); snsClient = AmazonSNSClientBuilder.defaultClient(); sqsClient = AmazonSQSClientBuilder.defaultClient(); elbClient = AmazonElasticLoadBalancingClientBuilder.defaultClient(); s3Client = AmazonS3ClientBuilder.defaultClient(); rdsClient = AmazonRDSClientBuilder.defaultClient(); iamClient = AmazonIdentityManagementClientBuilder.defaultClient(); }
public static AmazonSNSClient createNotificationClient() { BasicCredentialsProvider credentials = BasicCredentialsProvider.standard(); AmazonSNSClient client = !credentials.isValid() ? null : (AmazonSNSClient) AmazonSNSClientBuilder.standard() .withCredentials(credentials) .withRegion("eu-west-1") .build(); return client; }
public Texter() { AmazonSNSClientBuilder builder = AmazonSNSClientBuilder.standard().withCredentials(new DefaultAWSCredentialsProviderChain()); builder.setRegion(System.getenv("Region")); amazonSNS = builder.build(); }
/** * The static client factory used by smoketestByArn() */ public static AmazonSNS createClient() { return AmazonSNSClientBuilder.defaultClient(); }
public static AmazonSNS createSNSClient() { return AmazonSNSClientBuilder.defaultClient(); }