Package org.jclouds.compute.strategy

Examples of org.jclouds.compute.strategy.GetNodeMetadataStrategy


      CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions createKeyPairAndSecurityGroupsAsNeededAndReturncustomize = createMock(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.class);
      PresentInstances presentInstances = createMock(PresentInstances.class);
      RunningInstanceToNodeMetadata runningInstanceToNodeMetadata = createMock(RunningInstanceToNodeMetadata.class);
      LoadingCache<RunningInstance, Optional<LoginCredentials>> instanceToCredentials = createMock(LoadingCache.class);
      LoadingCache<RegionAndName, String> elasticIpCache = createMock(LoadingCache.class);
      GetNodeMetadataStrategy nodeRunning = new GetNodeMetadataStrategy() {

         @Override
         public NodeMetadata getNode(String input) {
            Assert.assertEquals(input, node.getId());
            return node;
View Full Code Here


      PollPeriod period = new PollPeriod();

      final NodeMetadata pendingNode = new NodeMetadataBuilder().ids(nodeId).status(Status.PENDING).build();
      final NodeMetadata runningNode = new NodeMetadataBuilder().ids(nodeId).status(Status.RUNNING).build();
      GetNodeMetadataStrategy nodeClient = createMock(GetNodeMetadataStrategy.class);
      AtomicNodeRunning nodeRunning = new AtomicNodeRunning(nodeClient);
      Predicate<AtomicReference<NodeMetadata>> retryableNodeRunning = new ComputeServiceTimeoutsModule() {
         public Predicate<AtomicReference<NodeMetadata>> nodeRunning(AtomicNodeRunning statusRunning,
               Timeouts timeouts, PollPeriod period) {
            return super.nodeRunning(statusRunning, timeouts, period);
         }
      }.nodeRunning(nodeRunning, timeouts, period);
      AtomicReference<NodeMetadata> atomicNode = Atomics.newReference(pendingNode);

      // Simulate transient error: first call returns null; subsequent calls
      // return the running node
      EasyMock.expect(nodeClient.getNode(nodeId)).andAnswer(new IAnswer<NodeMetadata>() {
         private int count = 0;

         @Override
         public NodeMetadata answer() throws Throwable {
            count++;
View Full Code Here

   private GetNodeMetadataStrategy computeService;

   @Test
   public void testNoUpdatesAtomicReferenceOnPass() {
      NodeMetadata running = new NodeMetadataBuilder().id("myid").status(Status.RUNNING).build();
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);

      replay(computeService);

      AtomicNodeRunning nodeRunning = new AtomicNodeRunning(computeService);
      AtomicReference<NodeMetadata> reference = Atomics.newReference(running);
View Full Code Here

   }

   @Test
   public void testRefreshUpdatesAtomicReferenceOnRecheckPending() {
      NodeMetadata pending = new NodeMetadataBuilder().id("myid").status(Status.PENDING).build();
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);

      expect(computeService.getNode("myid")).andReturn(pending);

      replay(computeService);

      AtomicNodeRunning nodeRunning = new AtomicNodeRunning(computeService);
      AtomicReference<NodeMetadata> reference = Atomics.newReference(pending);
View Full Code Here

      LoginCredentials creds2 = LoginCredentials.builder().user("user").password("password2").build();

      NodeMetadata pending = new NodeMetadataBuilder().id("myid").status(Status.PENDING).credentials(creds2).build();
     
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);

      expect(computeService.getNode("myid")).andReturn(pending);

      replay(computeService);

      AtomicNodeRunning nodeRunning = new AtomicNodeRunning(computeService);
      AtomicReference<NodeMetadata> reference = Atomics.newReference(newNode);
View Full Code Here

  
   @Test
   public void testRefreshUpdatesAtomicReferenceOnRecheckRunning() {
      NodeMetadata running = new NodeMetadataBuilder().id("myid").status(Status.RUNNING).build();
      NodeMetadata pending = new NodeMetadataBuilder().id("myid").status(Status.PENDING).build();
      GetNodeMetadataStrategy computeService = createMock(GetNodeMetadataStrategy.class);

      expect(computeService.getNode("myid")).andReturn(running);

      replay(computeService);

      AtomicNodeRunning nodeRunning = new AtomicNodeRunning(computeService);
      AtomicReference<NodeMetadata> reference = Atomics.newReference(pending);
View Full Code Here

TOP

Related Classes of org.jclouds.compute.strategy.GetNodeMetadataStrategy

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.