@Test void testDescribe() { for (String region : newArrayList(Region.US_EAST_1)) { SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupServices().describePlacementGroupsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { PlacementGroup group = allResults.last(); SortedSet<PlacementGroup> result = newTreeSet( client .getPlacementGroupServices() .describePlacementGroupsInRegion(region, group.getName())); assertNotNull(result); PlacementGroup compare = result.last(); assertEquals(compare, group); } } for (String region : client.getAvailabilityZoneAndRegionServices().describeRegions().keySet()) { if (!region.equals(Region.US_EAST_1)) try { client.getPlacementGroupServices().describePlacementGroupsInRegion(region); assert false : "should be unsupported"; } catch (UnsupportedOperationException e) { } } }
@Test public void testDescribe() { for (String region : supportedRegions) { SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { PlacementGroup group = allResults.last(); SortedSet<PlacementGroup> result = newTreeSet( client .getPlacementGroupApi() .get() .describePlacementGroupsInRegion(region, group.getName())); assertNotNull(result); PlacementGroup compare = result.last(); assertEquals(compare, group); } } for (String region : client.getAvailabilityZoneAndRegionApi().get().describeRegions().keySet()) { if (!supportedRegions.contains(region)) try { client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region); fail("should be unsupported for region: " + region); } catch (UnsupportedOperationException e) { } } }
@AfterTest public void shutdown() { if (group != null) { client .getPlacementGroupServices() .deletePlacementGroupInRegion(group.getRegion(), group.getName()); assert deletedTester.apply(group) : group; } }
@Override @AfterClass(groups = {"integration", "live"}) protected void tearDownContext() { if (group != null) { client .getPlacementGroupApi() .get() .deletePlacementGroupInRegion(group.getRegion(), group.getName()); assert deletedTester.apply(group) : group; } super.tearDownContext(); }
private void verifyPlacementGroup(String region, String groupName) { assert availableTester.apply(new PlacementGroup(region, groupName, "cluster", State.PENDING)) : group; Set<PlacementGroup> oneResult = client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region, groupName); assertNotNull(oneResult); assertEquals(oneResult.size(), 1); group = oneResult.iterator().next(); assertEquals(group.getName(), groupName); assertEquals(group.getStrategy(), "cluster"); assert availableTester.apply(group) : group; }
@Test(expectedExceptions = AWSResponseException.class) public void testFilterInvalid() { for (String region : supportedRegions) { SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { PlacementGroup group = allResults.last(); SortedSet<PlacementGroup> result = newTreeSet( client .getPlacementGroupApi() .get() .describePlacementGroupsInRegionWithFilter( region, ImmutableMultimap.<String, String>builder() .put("invalid-filter", group.getName()) .build())); } } }
@Test public void testFilter() { for (String region : supportedRegions) { SortedSet<PlacementGroup> allResults = newTreeSet(client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region)); assertNotNull(allResults); if (allResults.size() >= 1) { PlacementGroup group = allResults.last(); SortedSet<PlacementGroup> result = newTreeSet( client .getPlacementGroupApi() .get() .describePlacementGroupsInRegionWithFilter( region, ImmutableMultimap.<String, String>builder() .put("group-name", group.getName()) .build())); assertNotNull(result); PlacementGroup compare = result.last(); assertEquals(compare, group); } } }