Repository: jclouds Updated Branches: refs/heads/2.0.x acb84bc5e -> 81f8818e3
http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/RouteTableApiMockTest.java ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/RouteTableApiMockTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/RouteTableApiMockTest.java new file mode 100644 index 0000000..2541a93 --- /dev/null +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/features/RouteTableApiMockTest.java @@ -0,0 +1,301 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jclouds.aws.ec2.features; + +import static javax.ws.rs.core.Response.Status.PRECONDITION_FAILED; +import static org.jclouds.aws.ec2.options.RouteOptions.Builder.destinationCidrBlock; +import static org.jclouds.aws.ec2.options.RouteOptions.Builder.gatewayId; +import static org.jclouds.aws.ec2.options.RouteTableOptions.Builder.dryRun; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertNull; +import static org.testng.Assert.assertTrue; + +import org.jclouds.aws.AWSResponseException; +import org.jclouds.aws.ec2.domain.Route; +import org.jclouds.aws.ec2.domain.RouteTable; +import org.jclouds.aws.ec2.internal.BaseAWSEC2ApiMockTest; +import org.testng.Assert; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.squareup.okhttp.mockwebserver.MockResponse; + +@Test(groups = "unit", testName = "RouteTableApiMockTest", singleThreaded = true) +public class RouteTableApiMockTest extends BaseAWSEC2ApiMockTest { + + public void describeRouteTables() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final ImmutableList<RouteTable> routeTables = routeTableApi().describeRouteTables(DEFAULT_REGION).toList(); + + assertTrue(routeTables.isEmpty(), "Returned " + routeTables.size() + " results for 404 response: " + routeTables); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DescribeRouteTables"); + } + + public void describeRouteTablesNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/describe_route_tables.xml"); + final ImmutableList<RouteTable> routeTables = routeTableApi().describeRouteTables(DEFAULT_REGION).toList(); + + assertNotNull(routeTables, "Failed to create route table description object"); + assertEquals(routeTables.size(), 3, "Failed to return all entries from test data, returned: " + routeTables); + + for (RouteTable table : routeTables) { + if (ImmutableList.of("rtb-80a3fae4", "rtb-d4605bb0").contains(table.id())) { + assertRoutesForNormalVpc(table, table.id()); + } else if (table.id().equals("rtb-e6c98381")) { + assertRoutesForTestVpc(table, table.id()); + } + } + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DescribeRouteTables"); + } + + public void describeRouteTablesWithInvalidStateValue() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/describe_route_tables_invalid.xml"); + final ImmutableList<RouteTable> routeTables = routeTableApi().describeRouteTables(DEFAULT_REGION).toList(); + + assertNotNull(routeTables, "Failed to create route table description object"); + assertEquals(routeTables.size(), 1, "Failed to return expected entry from test data, returned: " + routeTables); + + assertEquals(routeTables.get(0).routeSet().get(0).state(), Route.RouteState.UNRECOGNIZED); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DescribeRouteTables"); + } + + private void assertRoutesForNormalVpc(RouteTable table, String id) { + assertEquals(table.routeSet().size(), 2, "Failed to match test data route set size for " + id); + final String actual = table.associationSet().get(0).routeTableId(); + assertEquals(actual, id, "Test data mismatch in " + id + " association set routeTableId(): " + actual); + assertTrue(table.associationSet().get(0).main(), "Test data mismatch in " + id + " association 'main'"); + } + + private void assertRoutesForTestVpc(RouteTable table, String id) { + assertEquals(table.routeSet().size(), 1, "Failed to match test data route set size for " + id); + + assertEquals(table.routeSet().get(0).destinationCidrBlock(), "10.20.30.0/24", + "Mismatch in test data for " + id + " route set destinationCidrBlock"); + assertEquals(table.routeSet().get(0).gatewayId(), "local", + "Mismatch in test data for " + id + " route set gatewayId"); + assertEquals(table.routeSet().get(0).state(), Route.RouteState.ACTIVE, + "Mismatch in test data for " + id + " route set state"); + + final String actual = table.associationSet().get(0).routeTableId(); + assertEquals(actual, id, "Test data mismatch in " + id + " association set routeTableId(): " + actual); + assertTrue(table.associationSet().get(0).main(), "Test data mismatch in " + id + " association 'main'"); + } + + public void createRouteTable() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/create_route_table.xml"); + RouteTable result = routeTableApi().createRouteTable(DEFAULT_REGION, "vpc-1a2b3c4d"); + + assertNotNull(result, "Failed to create RouteTable object"); + assertEquals(result.id(), "rtb-8bda6cef", "Gateway id does not match mock data: " + result.id()); + assertEquals(result.routeSet().size(), 2, "Should have 2 routes"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=CreateRouteTable&VpcId=vpc-1a2b3c4d"); + } + + public void createRouteTableWithOptions() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); + try { + routeTableApi().createRouteTable(DEFAULT_REGION, "vpc-1a2b3c4d", dryRun()); + Assert.fail("Expected 'DryRunOperation' exception was not thrown"); + } catch (AWSResponseException e) { + assertDryRun(e); + } + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=CreateRouteTable&VpcId=vpc-1a2b3c4d&DryRun=true"); + } + + public void deleteRouteTable() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/delete_route_table.xml"); + final boolean deleted = routeTableApi().deleteRouteTable(DEFAULT_REGION, "rtb-8bda6cef"); + assertTrue(deleted, "Failed to match 'true' data in test response"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DeleteRouteTable&RouteTableId=rtb-8bda6cef"); + } + + public void deleteRouteTableWithOptions() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); + try { + routeTableApi().deleteRouteTable(DEFAULT_REGION, "rtb-8bda6cef", dryRun()); + Assert.fail("Expected 'DryRunOperation' exception was not thrown"); + } catch (AWSResponseException e) { + assertDryRun(e); + } + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DeleteRouteTable&RouteTableId=rtb-8bda6cef&DryRun=true"); + } + + public void deleteRouteTableNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final boolean deleted = routeTableApi().deleteRouteTable(DEFAULT_REGION, "rtb-8bda6cef"); + assertFalse(deleted, "Non-existent table reported as successfully deleted"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DeleteRouteTable&RouteTableId=rtb-8bda6cef"); + } + + public void associateRouteTable() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/associate_route_table.xml"); + final String associationId = routeTableApi().associateRouteTable(DEFAULT_REGION, "rtb-8c95c0eb", "subnet-6986410e"); + assertEquals(associationId, "rtbassoc-fb7fed9d", "Failed to associate route"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=AssociateRouteTable&RouteTableId=rtb-8c95c0eb&SubnetId=subnet-6986410e"); + } + + public void associateRouteTableNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final String associationId = routeTableApi().associateRouteTable(DEFAULT_REGION, "rtb-8c95c0eb", "subnet-6986410e"); + assertNull(associationId, "Returned id for non-existent route table: " + associationId); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=AssociateRouteTable&RouteTableId=rtb-8c95c0eb&SubnetId=subnet-6986410e"); + } + + public void associateRouteTableWithOptions() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); + try { + routeTableApi().associateRouteTable(DEFAULT_REGION, "rtb-8c95c0eb", "subnet-6986410e", dryRun()); + } catch (AWSResponseException e) { + assertDryRun(e); + } + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, + "Action=AssociateRouteTable&RouteTableId=rtb-8c95c0eb&SubnetId=subnet-6986410e&DryRun=true"); + } + + public void disassociateRouteTable() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/disassociate_route_table.xml"); + final boolean result = routeTableApi().disassociateRouteTable(DEFAULT_REGION, "rtbassoc-fb7fed9d"); + assertTrue(result, "Failed to disassociate route"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DisassociateRouteTable&AssociationId=rtbassoc-fb7fed9d"); + } + + public void disassociateRouteTableNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final boolean result = routeTableApi().disassociateRouteTable(DEFAULT_REGION, "rtbassoc-fb7fed9d"); + assertFalse(result, "Non-existent table reported as successfully disassociated"); + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DisassociateRouteTable&AssociationId=rtbassoc-fb7fed9d"); + } + + public void disassociateRouteTablewithOptions() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(PRECONDITION_FAILED, DEFAULT_REGION, "/dry_run.xml"); + try { + routeTableApi().disassociateRouteTable(DEFAULT_REGION, "rtbassoc-fb7fed9d", dryRun()); + } catch (AWSResponseException e) { + assertDryRun(e); + } + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DisassociateRouteTable&AssociationId=rtbassoc-fb7fed9d&DryRun=true"); + } + + public void createRoute() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/create_route.xml"); + final boolean created = routeTableApi().createRoute(DEFAULT_REGION, "rtb-a77f2ac0", + gatewayId("igw-97e68af3").destinationCidrBlock("172.18.19.0/24")); + assertTrue(created, "Failed to match 'true' in test data response"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, + "Action=CreateRoute&RouteTableId=rtb-a77f2ac0&GatewayId=igw-97e68af3&DestinationCidrBlock=172.18.19.0/24"); + } + + public void createRouteNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/create_route.xml"); + final boolean created = routeTableApi().createRoute(DEFAULT_REGION, "rtb-a77f2ac0", + gatewayId("igw-97e68af3").destinationCidrBlock("172.18.19.0/24")); + assertTrue(created, "Failed to match 'true' in test data response"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, + "Action=CreateRoute&RouteTableId=rtb-a77f2ac0&GatewayId=igw-97e68af3&DestinationCidrBlock=172.18.19.0/24"); + } + + public void replaceRoute() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final boolean created = routeTableApi().replaceRoute(DEFAULT_REGION, "rtb-a77f2ac0", + gatewayId("vgw-1d00376e").destinationCidrBlock("172.18.19.0/24")); + assertFalse(created, "Reported successful replace of route in non-existent route table"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, + "Action=ReplaceRoute&RouteTableId=rtb-a77f2ac0&GatewayId=vgw-1d00376e&DestinationCidrBlock=172.18.19.0/24"); + } + + public void replaceRouteNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/replace_route.xml"); + final boolean created = routeTableApi().replaceRoute(DEFAULT_REGION, "rtb-a77f2ac0", + gatewayId("vgw-1d00376e").destinationCidrBlock("172.18.19.0/24")); + assertTrue(created, "Failed to match 'true' in test data response"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, + "Action=ReplaceRoute&RouteTableId=rtb-a77f2ac0&GatewayId=vgw-1d00376e&DestinationCidrBlock=172.18.19.0/24"); + } + + public void deleteRoute() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueueXml(DEFAULT_REGION, "/delete_route.xml"); + final boolean deleted = routeTableApi().deleteRoute(DEFAULT_REGION, "rtb-a77f2ac0", + destinationCidrBlock("172.18.19.0/24")); + assertTrue(deleted, "Failed to match 'true' in test data response"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DeleteRoute&RouteTableId=rtb-a77f2ac0&DestinationCidrBlock=172.18.19.0/24"); + } + + public void deleteRouteNotFound() throws Exception { + enqueueRegions(DEFAULT_REGION); + enqueue(DEFAULT_REGION, new MockResponse().setResponseCode(404)); + final boolean deleted = routeTableApi().deleteRoute(DEFAULT_REGION, "rtb-a77f2ac0", + destinationCidrBlock("172.18.19.0/24")); + assertFalse(deleted, "Reported successful delete of route in non-existent route table"); + + assertPosted(DEFAULT_REGION, "Action=DescribeRegions"); + assertPosted(DEFAULT_REGION, "Action=DeleteRoute&RouteTableId=rtb-a77f2ac0&DestinationCidrBlock=172.18.19.0/24"); + } + + private void assertDryRun(AWSResponseException e) { + assertEquals(e.getError().getCode(), "DryRunOperation", "Expected DryRunOperation but got " + e.getError()); + } + + private RouteTableApi routeTableApi() { + return api().getRouteTableApi().get(); + } +} http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/internal/BaseAWSEC2ApiMockTest.java ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/internal/BaseAWSEC2ApiMockTest.java b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/internal/BaseAWSEC2ApiMockTest.java index 060e577..d528fe5 100644 --- a/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/internal/BaseAWSEC2ApiMockTest.java +++ b/providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/internal/BaseAWSEC2ApiMockTest.java @@ -26,10 +26,13 @@ import static org.jclouds.util.Strings2.toStringAndClose; import static org.testng.Assert.assertEquals; import java.io.IOException; +import java.io.InputStream; import java.util.Map; import java.util.Properties; import java.util.Set; +import javax.ws.rs.core.Response; + import org.jclouds.Constants; import org.jclouds.ContextBuilder; import org.jclouds.aws.ec2.AWSEC2Api; @@ -155,6 +158,13 @@ public class BaseAWSEC2ApiMockTest { new MockResponse().addHeader(CONTENT_TYPE, APPLICATION_XML).setBody(describeRegionsResponse.toString())); } + protected void enqueueXml(Response.Status status, String region, String resource) { + enqueue(region, new MockResponse() + .setStatus("HTTP/1.1 " + status.getStatusCode() + " " + status.getReasonPhrase()) + .addHeader(CONTENT_TYPE, APPLICATION_XML) + .setBody(stringFromResource(resource))); + } + protected void enqueueXml(String region, String resource) { enqueue(region, new MockResponse().addHeader(CONTENT_TYPE, APPLICATION_XML).setBody(stringFromResource(resource))); @@ -162,7 +172,12 @@ public class BaseAWSEC2ApiMockTest { protected String stringFromResource(String resourceName) { try { - return toStringAndClose(getClass().getResourceAsStream(resourceName)); + final InputStream resourceAsStream = getClass().getResourceAsStream(resourceName); + if (resourceAsStream == null) { + throw new IllegalArgumentException( + "Could not find resource '" + resourceName + "' in class " + getClass().getSimpleName()); + } + return toStringAndClose(resourceAsStream); } catch (IOException e) { throw propagate(e); } http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/associate_route_table.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/associate_route_table.xml b/providers/aws-ec2/src/test/resources/associate_route_table.xml new file mode 100644 index 0000000..88e2db5 --- /dev/null +++ b/providers/aws-ec2/src/test/resources/associate_route_table.xml @@ -0,0 +1,4 @@ +<AssociateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>f87d1645-3919-4e26-b98f-852c47def4ee</requestId> + <associationId>rtbassoc-fb7fed9d</associationId> +</AssociateRouteTableResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/create_internet_gateway_dry_run.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/create_internet_gateway_dry_run.xml b/providers/aws-ec2/src/test/resources/create_internet_gateway_dry_run.xml deleted file mode 100644 index 037d770..0000000 --- a/providers/aws-ec2/src/test/resources/create_internet_gateway_dry_run.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Response> - <Errors> - <Error> - <Code>DryRunOperation</Code> - <Message>Request would have succeeded, but DryRun flag is set.</Message> - </Error> - </Errors> - <RequestID>344ef005-e34b-42fb-a334-1180fe317e7c</RequestID> -</Response> - http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/create_route.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/create_route.xml b/providers/aws-ec2/src/test/resources/create_route.xml new file mode 100644 index 0000000..e2e31ca --- /dev/null +++ b/providers/aws-ec2/src/test/resources/create_route.xml @@ -0,0 +1,4 @@ +<CreateRouteResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>3b1d5abc-0d50-4367-87c1-a4dcc2f8b928</requestId> + <return>true</return> +</CreateRouteResponse> http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/create_route_table.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/create_route_table.xml b/providers/aws-ec2/src/test/resources/create_route_table.xml new file mode 100644 index 0000000..8234a4f --- /dev/null +++ b/providers/aws-ec2/src/test/resources/create_route_table.xml @@ -0,0 +1,24 @@ +<CreateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> + <routeTable> + <routeTableId>rtb-8bda6cef</routeTableId> + <vpcId>vpc-1a2b3c4d</vpcId> + <routeSet> + <item> + <destinationCidrBlock>10.0.0.0/16</destinationCidrBlock> + <gatewayId>local</gatewayId> + <state>active</state> + <origin>CreateRouteTable</origin> + </item> + <item> + <destinationIpv6CidrBlock>2001:db8:1234:1a00::/56</destinationIpv6CidrBlock> + <gatewayId>local</gatewayId> + <state>active</state> + <origin>CreateRouteTable</origin> + </item> + </routeSet> + <associationSet/> + <propagatingVgwSet/> + <tagSet/> + </routeTable> +</CreateRouteTableResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/delete_route.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/delete_route.xml b/providers/aws-ec2/src/test/resources/delete_route.xml new file mode 100644 index 0000000..4dce471 --- /dev/null +++ b/providers/aws-ec2/src/test/resources/delete_route.xml @@ -0,0 +1,4 @@ +<DeleteRouteResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>6d6d0513-5af2-46ae-8f8a-24c8c3ab0f70</requestId> + <return>true</return> +</DeleteRouteResponse> http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/delete_route_table.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/delete_route_table.xml b/providers/aws-ec2/src/test/resources/delete_route_table.xml new file mode 100644 index 0000000..8ea49fb --- /dev/null +++ b/providers/aws-ec2/src/test/resources/delete_route_table.xml @@ -0,0 +1,4 @@ +<DeleteRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> + <return>true</return> +</DeleteRouteTableResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/describe_route_tables.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/describe_route_tables.xml b/providers/aws-ec2/src/test/resources/describe_route_tables.xml new file mode 100644 index 0000000..a23a3ca --- /dev/null +++ b/providers/aws-ec2/src/test/resources/describe_route_tables.xml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<DescribeRouteTablesResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>0fe3e6ca-5b09-4722-9d81-1f341376c830</requestId> + <routeTableSet> + <item> + <routeTableId>rtb-80a3fae4</routeTableId> + <vpcId>vpc-6dcb5609</vpcId> + <routeSet> + <item> + <destinationCidrBlock>172.31.0.0/16</destinationCidrBlock> + <gatewayId>local</gatewayId> + <state>active</state> + </item> + <item> + <destinationCidrBlock>0.0.0.0/0</destinationCidrBlock> + <gatewayId>igw-dcdcc7b9</gatewayId> + <state>active</state> + </item> + </routeSet> + <associationSet> + <item> + <routeTableAssociationId>rtbassoc-f173c296</routeTableAssociationId> + <routeTableId>rtb-80a3fae4</routeTableId> + <main>true</main> + </item> + </associationSet> + <tagSet/> + </item> + <item> + <routeTableId>rtb-d4605bb0</routeTableId> + <vpcId>vpc-924731f6</vpcId> + <routeSet> + <item> + <destinationCidrBlock>10.0.0.0/16</destinationCidrBlock> + <gatewayId>local</gatewayId> + <state>active</state> + </item> + <item> + <destinationCidrBlock>0.0.0.0/0</destinationCidrBlock> + <gatewayId>igw-5af2023e</gatewayId> + <state>active</state> + </item> + </routeSet> + <associationSet> + <item> + <routeTableAssociationId>rtbassoc-a08aefc7</routeTableAssociationId> + <routeTableId>rtb-d4605bb0</routeTableId> + <main>true</main> + </item> + </associationSet> + <tagSet/> + </item> + <item> + <routeTableId>rtb-e6c98381</routeTableId> + <vpcId>vpc-6fa76308</vpcId> + <routeSet> + <item> + <destinationCidrBlock>10.20.30.0/24</destinationCidrBlock> + <gatewayId>local</gatewayId> + <state>active</state> + </item> + </routeSet> + <associationSet> + <item> + <routeTableAssociationId>rtbassoc-2d2dbe4b</routeTableAssociationId> + <routeTableId>rtb-e6c98381</routeTableId> + <main>true</main> + </item> + </associationSet> + <tagSet/> + </item> + </routeTableSet> +</DescribeRouteTablesResponse> + http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/describe_route_tables_invalid.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/describe_route_tables_invalid.xml b/providers/aws-ec2/src/test/resources/describe_route_tables_invalid.xml new file mode 100644 index 0000000..a7109fa --- /dev/null +++ b/providers/aws-ec2/src/test/resources/describe_route_tables_invalid.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<DescribeRouteTablesResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>0fe3e6ca-5b09-4722-9d81-1f341376c830</requestId> + <routeTableSet> + <item> + <routeTableId>rtb-80a3fae4</routeTableId> + <vpcId>vpc-6dcb5609</vpcId> + <routeSet> + <item> + <destinationCidrBlock>172.31.0.0/16</destinationCidrBlock> + <gatewayId>local</gatewayId> + <state>bogus</state> + </item> + </routeSet> + <associationSet/> + <tagSet/> + </item> + </routeTableSet> +</DescribeRouteTablesResponse> + http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/disassociate_route_table.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/disassociate_route_table.xml b/providers/aws-ec2/src/test/resources/disassociate_route_table.xml new file mode 100644 index 0000000..1a05743 --- /dev/null +++ b/providers/aws-ec2/src/test/resources/disassociate_route_table.xml @@ -0,0 +1,4 @@ +<DisassociateRouteTableResponse xmlns="http://ec2.amazonaws.com/doc/2012-06-01/"> + <requestId>36e6a0e6-cd7a-45fc-8539-ba05cc070a3f</requestId> + <return>true</return> +</DisassociateRouteTableResponse> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/dry_run.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/dry_run.xml b/providers/aws-ec2/src/test/resources/dry_run.xml new file mode 100644 index 0000000..037d770 --- /dev/null +++ b/providers/aws-ec2/src/test/resources/dry_run.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<Response> + <Errors> + <Error> + <Code>DryRunOperation</Code> + <Message>Request would have succeeded, but DryRun flag is set.</Message> + </Error> + </Errors> + <RequestID>344ef005-e34b-42fb-a334-1180fe317e7c</RequestID> +</Response> + http://git-wip-us.apache.org/repos/asf/jclouds/blob/f7390443/providers/aws-ec2/src/test/resources/replace_route.xml ---------------------------------------------------------------------- diff --git a/providers/aws-ec2/src/test/resources/replace_route.xml b/providers/aws-ec2/src/test/resources/replace_route.xml new file mode 100644 index 0000000..dbbca61 --- /dev/null +++ b/providers/aws-ec2/src/test/resources/replace_route.xml @@ -0,0 +1,4 @@ +<ReplaceRouteResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/"> + <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId> + <return>true</return> +</ReplaceRouteResponse> \ No newline at end of file
