use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class MySqlIntegTest method setUp.
/**
* Creates a MySql RDS Instance used for the integration tests.
*/
@BeforeClass
@Override
protected void setUp() {
cloudFormationClient = new CloudFormationClient(theApp, getMySqlStack());
try {
// Create the CloudFormation stack for the MySql DB instance.
cloudFormationClient.createStack();
// Get DB instance's host and port information and set the environment variables needed for the Lambda.
setEnvironmentVars(getInstanceData());
// Create the DB schema in the newly created DB instance used for the integration tests.
createDbSchema();
// Invoke the framework's setUp().
super.setUp();
} catch (Exception e) {
// Delete the partially formed CloudFormation stack.
cloudFormationClient.deleteStack();
throw e;
}
}
use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class RedisIntegTest method setUp.
/**
* Creates a Redis cluster used for the integration tests.
*/
@BeforeClass
@Override
protected void setUp() {
cloudFormationClient = new CloudFormationClient(theApp, getRedisStack());
try {
// Create the CloudFormation stack for the Redis instances.
cloudFormationClient.createStack();
// Get host and port information
Endpoint standaloneEndpoint = getRedisInstanceData(redisStandaloneName, false);
logger.info("Got Endpoint: " + standaloneEndpoint.toString());
redisEndpoints.put(STANDALONE_KEY, String.format("%s:%s", standaloneEndpoint.getAddress(), standaloneEndpoint.getPort()));
Endpoint clusterEndpoint = getRedisInstanceData(redisClusterName, true);
logger.info("Got Endpoint: " + clusterEndpoint.toString());
redisEndpoints.put(CLUSTER_KEY, String.format("%s:%s:%s", clusterEndpoint.getAddress(), clusterEndpoint.getPort(), redisPassword));
// Get endpoint information and set the connection string environment var for Lambda.
environmentVars.put("standalone_connection", redisEndpoints.get(STANDALONE_KEY));
environmentVars.put("cluster_connection", redisEndpoints.get(CLUSTER_KEY));
// Invoke the framework's setUp().
super.setUp();
} catch (Exception e) {
// Delete the partially formed CloudFormation stack.
cloudFormationClient.deleteStack();
throw e;
}
}
use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class RedisIntegTest method setUpTableData.
/**
* Create and invoke a special Lambda function that sets up the Redis instances used by the integration tests.
*/
@Override
protected void setUpTableData() {
logger.info("----------------------------------------------------");
logger.info("Setting up data for Redis Instances");
logger.info("----------------------------------------------------");
String redisLambdaName = "integ-redis-helper-" + UUID.randomUUID();
AWSLambda lambdaClient = AWSLambdaClientBuilder.defaultClient();
CloudFormationClient cloudFormationRedisClient = new CloudFormationClient(getRedisLambdaStack(redisLambdaName));
try {
// Create the Lambda function.
cloudFormationRedisClient.createStack();
// Invoke the Lambda function.
lambdaClient.invoke(new InvokeRequest().withFunctionName(redisLambdaName).withInvocationType(InvocationType.RequestResponse));
} finally {
// Delete the Lambda function.
cloudFormationRedisClient.deleteStack();
lambdaClient.shutdown();
}
}
use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class ElasticsearchIntegTest method setUp.
/**
* Creates an Elasticsearch Cluster used for the integration tests.
*/
@BeforeClass
@Override
protected void setUp() {
cloudFormationClient = new CloudFormationClient(theApp, getElasticsearchStack());
try {
// Create the CloudFormation stack for the Elasticsearch Cluster.
cloudFormationClient.createStack();
// Invoke the framework's setUp().
super.setUp();
} catch (Exception e) {
// Delete the partially formed CloudFormation stack.
cloudFormationClient.deleteStack();
throw e;
}
}
use of com.amazonaws.athena.connector.integ.clients.CloudFormationClient in project aws-athena-query-federation by awslabs.
the class IntegrationTestBase method setUp.
/**
* Creates a CloudFormation stack to build the infrastructure needed to run the integration tests (e.g., Database
* instance, Lambda function, etc...). Once the stack is created successfully, the lambda function is registered
* with Athena.
*/
@BeforeClass
protected void setUp() {
cloudFormationClient = new CloudFormationClient(connectorStackProvider.getStack());
try {
cloudFormationClient.createStack();
setUpTableData();
} catch (Exception e) {
// Delete the partially formed CloudFormation stack.
cloudFormationClient.deleteStack();
throw e;
}
}
Aggregations