Search in sources :

Example 21 with Context

use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.

the class TestRDSMySQL method test.

@Test
public void test() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String clientStackName = "client-" + this.random8String();
    final String stackName = "rds-mysql-" + this.random8String();
    final String password = this.random8String();
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml");
        try {
            this.createStack(context, clientStackName, "state/client-sg.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
            try {
                this.createStack(context, stackName, "state/rds-mysql.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName), new Parameter().withParameterKey("ParentClientStack").withParameterValue(clientStackName), new Parameter().withParameterKey("DBName").withParameterValue("db1"), new Parameter().withParameterKey("DBMasterUserPassword").withParameterValue(password));
            // TODO how can we check if this stack works? start a bastion host and try to connect?
            } finally {
                this.deleteStack(context, stackName);
            }
        } finally {
            this.deleteStack(context, clientStackName);
        }
    } finally {
        this.deleteStack(context, vpcStackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Example 22 with Context

use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.

the class TestS3 method test.

@Test
public void test() {
    final Context context = new Context();
    final String stackName = "s3-" + this.random8String();
    try {
        this.createStack(context, stackName, "state/s3.yaml");
    // TODO how can we check if this stack works?
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Example 23 with Context

use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.

the class TestVPC3AZs method test.

@Test
public void test() {
    final Context context = new Context();
    final String stackName = "vpc-3azs-" + this.random8String();
    try {
        this.createStack(context, stackName, "vpc/vpc-3azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue("10"));
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetAPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetBPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetCPublic");
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) Test(org.junit.Test)

Example 24 with Context

use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.

the class TestVPC4AZs method test.

@Test
public void test() {
    final Context context = new Context();
    final String stackName = "vpc-4azs-" + this.random8String();
    try {
        this.createStack(context, stackName, "vpc/vpc-4azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue("10"));
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetAPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetBPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetCPublic");
        this.testVPCSubnetInternetAccess(context, stackName, "SubnetDPublic");
    } finally {
        this.deleteStack(context, stackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) Test(org.junit.Test)

Example 25 with Context

use of de.widdix.awscftemplates.Context in project aws-cf-templates by widdix.

the class TestVPCEndpointDynamoDB method test.

@Test
public void test() {
    final Context context = new Context();
    final String vpcStackName = "vpc-2azs-" + this.random8String();
    final String endpointStackName = "vpc-endpoint-dynamodb-" + this.random8String();
    final String classB = "10";
    try {
        this.createStack(context, vpcStackName, "vpc/vpc-2azs.yaml", new Parameter().withParameterKey("ClassB").withParameterValue(classB));
        try {
            this.createStack(context, endpointStackName, "vpc/vpc-endpoint-dynamodb.yaml", new Parameter().withParameterKey("ParentVPCStack").withParameterValue(vpcStackName));
        // TODO how can we check if this stack works?
        } finally {
            this.deleteStack(context, endpointStackName);
        }
    } finally {
        this.deleteStack(context, vpcStackName);
    }
}
Also used : Context(de.widdix.awscftemplates.Context) Parameter(com.amazonaws.services.cloudformation.model.Parameter) ACloudFormationTest(de.widdix.awscftemplates.ACloudFormationTest) Test(org.junit.Test)

Aggregations

Context (de.widdix.awscftemplates.Context)70 Test (org.junit.Test)70 Parameter (com.amazonaws.services.cloudformation.model.Parameter)66 ACloudFormationTest (de.widdix.awscftemplates.ACloudFormationTest)62 HttpResponse (org.apache.http.HttpResponse)19 KeyPair (com.amazonaws.services.ec2.model.KeyPair)4 DescribeContainerInstancesRequest (com.amazonaws.services.ecs.model.DescribeContainerInstancesRequest)2 DescribeContainerInstancesResult (com.amazonaws.services.ecs.model.DescribeContainerInstancesResult)2 ListContainerInstancesRequest (com.amazonaws.services.ecs.model.ListContainerInstancesRequest)2 ListContainerInstancesResult (com.amazonaws.services.ecs.model.ListContainerInstancesResult)2 Session (com.jcraft.jsch.Session)1 Ignore (org.junit.Ignore)1