Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.NodeMetadata


   @SuppressWarnings("unchecked")
   private void assertRegionAndZoneForLocation(Location location, String region, String zone) {
      String imageId = "ami1";
      String instanceCreatedId = "instance1";
      NodeMetadata nodeMetadata = new NodeMetadataBuilder().id(region + "/" + instanceCreatedId)
            .providerId(instanceCreatedId).status(Status.RUNNING).build();

      // setup mocks
      EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
      InputParams input = new InputParams(location);
View Full Code Here


      String group = "winadm";
      // Spin up a new node. Make sure to open the RDP port 3389
      Template template = view.getComputeService().templateBuilder().from(windowsTemplate).options(inboundPorts(3389))
               .build();
      try {
         NodeMetadata node = Iterables.getOnlyElement(view.getComputeService().createNodesInGroup(group, 1, template));
         assertEquals(node.getCredentials().getUser(), "Administrator");
         assertFalse(Strings.isNullOrEmpty(node.getCredentials().getPassword()));
      } finally {
         view.getComputeService().destroyNodesMatching(NodePredicates.inGroup(group));
      }
   }
View Full Code Here

   public void testVirtualMachineToNodeMetadata() {
      VirtualAppliance vapp = EasyMock.createMock(VirtualAppliance.class);
      VirtualMachine mockVm = mockVirtualMachine(vapp);

      NodeMetadata node = function.apply(mockVm);

      verify(mockVm);

      assertEquals(node.getId(), vm.getId().toString());
      assertEquals(node.getUri(), URI.create("http://foo/bar"));
      assertEquals(node.getName(), vm.getNodeName());
      assertEquals(node.getGroup(), "VAPP");
      assertEquals(node.getLocation().getId(), "1");
      assertEquals(node.getLocation().getDescription(), "Mock Location");
      assertEquals(node.getImageId(), "1");
      assertEquals(node.getHardware().getId(), "1");
      assertEquals(node.getHardware().getRam(), vm.getRam().intValue());
      assertEquals(node.getHardware().getProcessors().get(0).getCores(), (double) vm.getCpu());
      assertEquals(node.getLoginPort(), vm.getVdrpPort());
      assertEquals(node.getPrivateAddresses().size(), 1);
      assertEquals(node.getPublicAddresses().size(), 2);
      assertEquals(Iterables.get(node.getPrivateAddresses(), 0), privNic.getIp());
      assertEquals(Iterables.get(node.getPublicAddresses(), 0), pubNic.getIp());
      assertEquals(Iterables.get(node.getPublicAddresses(), 1), extNic.getIp());
   }
View Full Code Here

    public Properties getProperties(String id) throws Exception {
        Properties result = new Properties();

        JcloudsNodeLauncherConfig config = getActiveConfig();
        NodeMetadata nodeMetadata = getNodeMetadataForRunningNodeWithTag(config.getTagPrefix() + id, config);
        if (nodeMetadata == null) {
            return null;
        }
        result.put("id", id);
        result.put("node-id", nodeMetadata.getId());
        result.put("ip", nodeMetadata.getPublicAddresses().iterator().next());

        return result;
    }
View Full Code Here

    }

    private NodeMetadata getNodeMetadataForRunningNodeWithTag(String tag, JcloudsNodeLauncherConfig config) {

        for (ComputeMetadata node : config.getComputeService().listNodes()) {
            NodeMetadata candidate = config.getComputeService().getNodeMetadata(node.getId());
            if (tag.equals(candidate.getGroup()) && candidate.getState().equals(NodeState.RUNNING)) {
                return candidate;
            }
        }
        return null;
    }
View Full Code Here

      ComputeService computeService = orderedRequestsSendResponses(orderedRequests, orderedResponses);

      GoogleComputeEngineTemplateOptions options = computeService.templateOptions().as(GoogleComputeEngineTemplateOptions.class);
      options.tags(ImmutableSet.of("aTag"));
      NodeMetadata node = getOnlyElement(computeService.createNodesInGroup("test", 1, options));
      assertEquals(node.getImageId(), "gcel-12-04-v20121106");
   }
View Full Code Here

    ClusterControllerFactory factory = mock(ClusterControllerFactory.class);
    ClusterController controller = mock(ClusterController.class);
    when(factory.create((String) any())).thenReturn(controller);

    NodeMetadata node1 = new NodeMetadataBuilder().name("name1").ids("id1")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id1").description("location-desc1").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.1"))
        .privateAddresses(Lists.newArrayList("127.0.0.1")).build();

    NodeMetadata node2 = new NodeMetadataBuilder().name("name2").ids("id2")
        .location(new LocationBuilder().scope(LocationScope.PROVIDER)
          .id("location-id2").description("location-desc2").build())
        .imageId("image-id").state(NodeState.RUNNING)
        .publicAddresses(Lists.newArrayList("127.0.0.2"))
        .privateAddresses(Lists.newArrayList("127.0.0.2")).build();
View Full Code Here

  public void testAllOptions() throws Exception {
   
    ServiceFactory factory = mock(ServiceFactory.class);
    Service service = mock(Service.class);
    when(factory.create((String) any())).thenReturn(service);
    NodeMetadata node1 = new NodeMetadataImpl(null, "name1", "id1",
        new LocationImpl(LocationScope.PROVIDER, "location-id1",
            "location-desc1", null),
        null, Collections.<String,String>emptyMap(), null, null, "image-id",
        null, NodeState.RUNNING,
        Lists.newArrayList("100.0.0.1"),
        Lists.newArrayList("10.0.0.1"), null);
    NodeMetadata node2 = new NodeMetadataImpl(null, "name2", "id2",
        new LocationImpl(LocationScope.PROVIDER, "location-id2",
            "location-desc2", null),
        null, Collections.<String,String>emptyMap(), null, null, "image-id",
        null, NodeState.RUNNING,
        Lists.newArrayList("100.0.0.2"),
View Full Code Here

      Set<NodeMetadata> nodes = Sets.newHashSet();
      Map<?, Exception> executionExceptions = Maps.newHashMap();
      Map<NodeMetadata, Throwable> failedNodes = Maps.newHashMap();
      for (int i = 0; i < num; i++) {
        NodeMetadata nodeMeta = new NodeMetadataBuilder()
            .providerId("ec2").name("" + roles + id).id("nodeId" + id + i)
            .location(location).uri(URI.create("http://node" + i))
            .status(NodeMetadata.Status.RUNNING).privateAddresses(addresses)
            .publicAddresses(addresses)
            .credentials(loginCredentials).hostname("hostname").build();
        if (i < only) {
          nodes.add(nodeMeta);
          LOG.info("{} - Node successfully started: {}", roles, nodeMeta.getId());
        } else {
          failedNodes.put(nodeMeta, new Exception("Simulated failing node"));
          LOG.info("{} - Node failing to start: {}", roles, nodeMeta.getId());
        }
      }
      if (failedNodes.size() > 0) {
        Image image = new ImageBuilder().providerId("ec2").name("test").id("testId").location(location)
              .uri(URI.create("http://node")).operatingSystem(OperatingSystem.builder().description("op").build())
View Full Code Here

      String region = "ap-southeast-1";
      String zone = "ap-southeast-1a";

      String imageId = "ami1";
      String instanceCreatedId = "instance1";
      NodeMetadata nodeMetadata = new NodeMetadataBuilder().id(region + "/" + instanceCreatedId)
            .providerId(instanceCreatedId).status(Status.RUNNING).build();
      // setup mocks
      EC2CreateNodesInGroupThenAddToSet strategy = setupStrategy(nodeMetadata);
      InputParams input = new InputParams(location);
      InstanceApi instanceClient = createMock(InstanceApi.class);
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.