Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.NodeMetadata


      requestResponseMap.put(describeImageRequest, describeImagesResponse);
      requestResponseMap.put(createTagsRequest, createTagsResponse);

      ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());

      NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
              blockUntilRunning(false).overrideLoginUser("ec2-user")));
      assertEquals(node.getCredentials().getUser(), "ec2-user");
      System.out.println(node.getImageId());
      assertNotNull(node.getCredentials().getPrivateKey());
   }
View Full Code Here


      requestResponseMap.put(createSecondTagRequest, createTagsResponse);
      requestResponseMap.put(createThirdTagRequest, createTagsResponse);

      ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());

      NodeMetadata node = Iterables.getFirst(apiThatCreatesNode.createNodesInGroup("test", 3,
              maxCount(3).blockUntilRunning(false).overrideLoginUser("ec2-user")), null);
      assertNotNull(node, "Node should exist");
      assertEquals(node.getCredentials().getUser(), "ec2-user", "User should be ec2-user");
   }
View Full Code Here

      requestResponseMap.put(createSecondTagRequest, createTagsResponse);
      requestResponseMap.put(createThirdTagRequest, createTagsResponse);

      ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());

      NodeMetadata node = Iterables.getFirst(apiThatCreatesNode.createNodesInGroup("test", 3,
              maxCount(4).blockUntilRunning(false).overrideLoginUser("ec2-user")), null);
      assertNotNull(node, "Node should exist");
      assertEquals(node.getCredentials().getUser(), "ec2-user", "User should be ec2-user");
   }
View Full Code Here

      requestResponseMap.put(describeImageRequest, describeImagesResponse);
      requestResponseMap.put(createNamedTagsRequest, createTagsResponse);

      ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());

      NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1,
              blockUntilRunning(false).overrideLoginUser("ec2-user").nodeNames(ImmutableSet.of("test-node"))));
      assertEquals(node.getCredentials().getUser(), "ec2-user");
      assertNotNull(node.getCredentials().getPrivateKey());
      assertEquals(node.getName(), "test-node");
   }
View Full Code Here

      requestResponseMap.put(describeImageRequest, describeImagesResponse);
      requestResponseMap.put(createTagsRequest, createTagsResponse);

      ComputeService apiThatCreatesNode = requestsSendResponses(requestResponseMap.build());

      NodeMetadata node = Iterables.getOnlyElement(
            apiThatCreatesNode.createNodesInGroup("test", 1,
            apiThatCreatesNode.templateBuilder().from("osDescriptionMatches=.*fedora.*,loginUser=ec2-user").build()));
      assertEquals(node.getCredentials().getUser(), "ec2-user");
      assertNotNull(node.getCredentials().getPrivateKey());
   }
View Full Code Here

      }

      TemplateOptions options = client.templateOptions().blockOnPort(22, 120);
      try {
         Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, options);
         NodeMetadata node = get(nodes, 0);
         LoginCredentials good = node.getCredentials();
         assert good.identity != null : nodes;

         for (Entry<? extends NodeMetadata, ExecResponse> response : client.runScriptOnNodesMatching(
               runningInGroup(group), "hostname",
               wrapInInitScript(false).runAsRoot(false).overrideLoginCredentials(good)).entrySet()) {
            checkResponseEqualsHostname(response.getValue(), response.getKey());
         }

         // test single-node execution
         ExecResponse response = client.runScriptOnNode(node.getId(), "hostname",
               wrapInInitScript(false).runAsRoot(false));
         checkResponseEqualsHostname(response, node);
         OperatingSystem os = node.getOperatingSystem();

         // test bad password
         tryBadPassword(group, good);

         runScriptWithCreds(group, os, good);

         checkNodes(nodes, group, "runScriptWithCreds");

         // test adding AdminAccess later changes the default boot user, in this
         // case to foo, with home dir /over/ridden/foo
         ListenableFuture<ExecResponse> future = client.submitScriptOnNode(node.getId(), AdminAccess.builder()
               .adminUsername("foo").adminHome("/over/ridden/foo").build(), nameTask("adminUpdate"));

         response = future.get(3, TimeUnit.MINUTES);

         assert response.getExitStatus() == 0 : node.getId() + ": " + response;

         node = client.getNodeMetadata(node.getId());
         // test that the node updated to the correct admin user!
         assertEquals(node.getCredentials().identity, "foo");
         assert node.getCredentials().credential != null : nodes;

         weCanCancelTasks(node);

         assert response.getExitStatus() == 0 : node.getId() + ": " + response;

         response = client.runScriptOnNode(node.getId(), "echo $USER", wrapInInitScript(false).runAsRoot(false));

         assert response.getOutput().trim().equals("foo") : node.getId() + ": " + response;

      } finally {
         client.destroyNodesMatching(inGroup(group));
      }
   }
View Full Code Here

         throw e;
      }

      assertEquals(nodes.size(), 2, "expected two nodes but was " + nodes);
      checkNodes(nodes, group, "bootstrap");
      NodeMetadata node1 = nodes.first();
      NodeMetadata node2 = nodes.last();
      // credentials aren't always the same
      // assertEquals(node1.getCredentials(), node2.getCredentials());

      assertLocationSameOrChild(checkNotNull(node1.getLocation(), "location of %s", node1), template.getLocation());
      assertLocationSameOrChild(checkNotNull(node2.getLocation(), "location of %s", node2), template.getLocation());
      checkImageIdMatchesTemplate(node1);
      checkImageIdMatchesTemplate(node2);
      checkOsMatchesTemplate(node1);
      checkOsMatchesTemplate(node2);
   }
View Full Code Here

         nodes = newTreeSet(concat(e.getSuccessfulNodes(), e.getNodeErrors().keySet()));
         throw e;
      }

      assertEquals(nodes.size(), 2, "expected two nodes but was " + nodes);
      NodeMetadata node1 = Iterables.getFirst(nodes, null);
      NodeMetadata node2 = Iterables.getLast(nodes, null);
      // credentials aren't always the same
      // assertEquals(node1.getCredentials(), node2.getCredentials());

      assertTrue(node1.getName().equals("first-node") || node2.getName().equals("first-node"),
              "one node should be named 'first-node'");
      assertFalse(node1.getName().equals("first-node") && node2.getName().equals("first-node"),
              "one node should be named something other than 'first-node");

      this.nodes.addAll(nodes);
   }
View Full Code Here

      }

      Set<? extends NodeMetadata> nodes = client.createNodesInGroup(group, 1, template);
      assertEquals(nodes.size(), 1);
      checkNodes(nodes, group, "bootstrap");
      NodeMetadata node = Iterables.getOnlyElement(nodes);
      if (existingLocationIsAssignable)
         assertEquals(node.getLocation(), existingLocation);
      else
         this.assertLocationSameOrChild(checkNotNull(node.getLocation(), "location of %s", node), template.getLocation());
      checkOsMatchesTemplate(node);
      this.nodes.add(node);
   }
View Full Code Here

            final String group = "twin" + groupNum;
            groups.add(group);

            ListenableFuture<NodeMetadata> future = userExecutor.submit(new Callable<NodeMetadata>() {
               public NodeMetadata call() throws Exception {
                  NodeMetadata node = getOnlyElement(client.createNodesInGroup(group, 1, inboundPorts(22, 8080)
                           .blockOnPort(22, 300 + groupNum)));
                  getAnonymousLogger().info("Started node " + node.getId());
                  return node;
               }
            });
            futures.add(future);
         }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.NodeMetadata

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.