@Test(dependsOnMethods = "testDescribe") public void testCreateWithOptions() { try { routeTableApi.createRouteTable(TEST_REGION, vpc.id(), dryRun()); Assert.fail("Expected 'DryRunOperation' exception was not thrown"); } catch (AWSResponseException e) { assertDryRun(e); } }
@Test(dependsOnMethods = "testDescribe") public void testCreate() { // When you create a new route table for the VPC it automatically gets a route to match the VPC CIDR routeTable = routeTableApi.createRouteTable(TEST_REGION, vpc.id()); assertNotNull(routeTable, "Gateway was not successfully created"); assertEquals(routeTable.vpcId(), vpc.id(), "RouteTable VPC ID " + routeTable.vpcId() + " does not match VPC's ID " + vpc.id()); final List<Route> routes = routeTable.routeSet(); assertEquals(routes.size(), 1, "Unexpected number of routes in new table: " + routes.size()); assertEquals(routes.get(0).destinationCidrBlock(), vpc.cidrBlock(), "CIDR for route table " + routes.get(0).destinationCidrBlock() + " does not match VPC CIDR" + vpc.cidrBlock()); assertEquals(routes.get(0).state(), Route.RouteState.ACTIVE, "Route should be active"); assertEquals(routeTable.tags().size(), 0, "Freshly created routeTable has tags"); tagger.applyToResources(ImmutableMap.of("Name", simpleName), ImmutableList.of(routeTable.id())); getAnonymousLogger().info("Created routeTable " + simpleName + " with id " + routeTable.id()); }
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"); }