Package org.jclouds.aws.ec2.domain

Examples of org.jclouds.aws.ec2.domain.PlacementGroup


      // part!

      // create mocks
      CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions strategy = setupStrategy();
      AWSEC2TemplateOptions options = createMock(AWSEC2TemplateOptions.class);
      PlacementGroup placementGroup = createMock(PlacementGroup.class);

      // setup expectations
      expect(options.getPlacementGroup()).andReturn(userSuppliedPlacementGroup);
      expect(options.shouldAutomaticallyCreatePlacementGroup()).andReturn(shouldAutomaticallyCreatePlacementGroup);
View Full Code Here


@Test(groups = "unit", testName = "DescribePlacementGroupsResponseHandlerTest")
public class DescribePlacementGroupsResponseHandlerTest extends BaseEC2HandlerTest {
   public void testApplyInputStream() {
      InputStream is = getClass().getResourceAsStream("/describe_placement_groups.xml");

      PlacementGroup expected = new PlacementGroup(defaultRegion, "XYZ-cluster", "cluster",
               PlacementGroup.State.AVAILABLE);
      DescribePlacementGroupsResponseHandler handler = injector
               .getInstance(DescribePlacementGroupsResponseHandler.class);
      addDefaultRegionToHandler(handler);
      PlacementGroup result = getOnlyElement(factory.create(handler).parse(is));

      assertEquals(result, expected);
   }
View Full Code Here

      try {
         if (!client.getPlacementGroupApi().get().describePlacementGroupsInRegion(region, placementGroup).isEmpty()) {
            logger.debug(">> deleting placementGroup(%s)", placementGroup);
            try {
               client.getPlacementGroupApi().get().deletePlacementGroupInRegion(region, placementGroup);
               checkState(placementGroupDeleted.apply(new PlacementGroup(region, placementGroup, "cluster",
                        State.PENDING)), String.format("placementGroup region(%s) name(%s) failed to delete", region,
                        placementGroup));
               placementGroupMap.invalidate(new RegionAndName(region, placementGroup));
               logger.debug("<< deleted placementGroup(%s)", placementGroup);
            } catch (IllegalStateException e) {
View Full Code Here

      checkNotNull(name, "name");
      logger.debug(">> creating placementGroup region(%s) name(%s)", region, name);
      try {
         ec2Api.getPlacementGroupApi().get().createPlacementGroupInRegion(region, name);
         logger.debug("<< created placementGroup(%s)", name);
         checkState(placementGroupAvailable.apply(new PlacementGroup(region, name, "cluster", State.PENDING)), String
                  .format("placementGroup region(%s) name(%s) failed to become available", region, name));
      } catch (AWSResponseException e) {
         if (e.getError().getCode().equals("InvalidPlacementGroup.Duplicate")) {
            logger.debug("<< reused placementGroup(%s)", name);
         } else {
View Full Code Here

      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()) {
View Full Code Here

      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);
         }
      }
   }
View Full Code Here

      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()));
         }
      }
   }
View Full Code Here

         verifyPlacementGroup(region, groupName);
      }
   }

   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();
View Full Code Here

   public PlacementGroup getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();
      PlacementGroup returnVal = new PlacementGroup(region, name, strategy, state);
      this.name = null;
      this.strategy = "cluster";
      this.state = null;
      return returnVal;
   }
View Full Code Here

              .payload(payloadFromResourceWithContentType("/describe_placement_groups.xml", "text/xml")).build();

      AWSEC2Api apiWhenExist = requestsSendResponses(describeRegionsRequest, describeRegionsResponse, filter, filterResponse)
              .getContext().unwrapApi(AWSEC2Api.class);

      PlacementGroup group = getOnlyElement(apiWhenExist.getPlacementGroupApi().get().describePlacementGroupsInRegionWithFilter("us-east-1",
              ImmutableMultimap.<String, String>builder()
                      .put("strategy", "cluster")
                      .build()));

      assertEquals(group.getName(), "XYZ-cluster");
   }
View Full Code Here

TOP

Related Classes of org.jclouds.aws.ec2.domain.PlacementGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.