Package com.vmware.bdd.apitypes

Examples of com.vmware.bdd.apitypes.ResourcePoolRead


      List<ResourcePoolRead> rps = new ArrayList<ResourcePoolRead>();
      List<VcResourcePoolEntity> entities = rpDao.findAllOrderByClusterName();

      for (VcResourcePoolEntity entity : entities) {
         ResourcePoolRead read = entity.toRest();
         rps.add(read);
      }
      return rps;
   }
View Full Code Here


      rpName = CommonUtil.decode(rpName);
      if (CommonUtil.isBlank(rpName)
            || !CommonUtil.validateResourceName(rpName)) {
         throw BddException.INVALID_PARAMETER("resource pool name", rpName);
      }
      ResourcePoolRead read = vcRpSvc.getResourcePoolForRest(rpName);
      if (read == null) {
         throw BddException.NOT_FOUND("Resource pool", rpName);
      }
      return read;
   }
View Full Code Here

      Set<VcResourcePoolEntity> rps = cluster.getUsedRps();
      List<ResourcePoolRead> rpReads =
            new ArrayList<ResourcePoolRead>(rps.size());
      for (VcResourcePoolEntity rp : rps) {
         ResourcePoolRead rpRead = rp.toRest();
         rpRead.setNodes(null);
         rpReads.add(rpRead);
      }
      clusterRead.setResourcePools(rpReads);

      if (clusterStatus.isActiveServiceStatus()
View Full Code Here

            ResourcePoolRead[] rps = restClient.getAll();
            if (rps != null) {
               prettyOutputResourcePoolsInfo(rps, detail);
            }
         } else {
            ResourcePoolRead rp = restClient.get(name);
            if (rp != null) {
               prettyOutputResourcePoolInfo(rp, detail);
            }
         }
      }catch (CliRestException e) {
View Full Code Here

   }
  
   @Test
   public void testRpList() throws Exception {
      CookieCache.put("Cookie","JSESSIONID=2AAF431F59ACEE1CC68B43C87772C54F");
      ResourcePoolRead rp = new ResourcePoolRead();
      rp.setRpName("test01");
      rp.setVcCluster("home");
      rp.setRpVsphereName("hadoop01");
      rp.setTotalRAMInMB(8192);
      rp.setTotalCPUInMHz(2048);

      NodeRead node01 = new NodeRead();
      node01.setName("node01");
      node01.setIpConfigs(createIpConfigs("192.168.1.2"));
      List<String> roles01 = new ArrayList<String>();
      roles01.add("NameNode");
      roles01.add("JobTracker");
      roles01.add("DataNode");
      roles01.add("HadoopClient");
      node01.setRoles(roles01);
      NodeRead node02 = new NodeRead();
      node02.setName("node02");
      node02.setIpConfigs(createIpConfigs("192.168.1.3"));
      List<String> roles02 = new ArrayList<String>();
      roles02.add("NameNode");
      roles02.add("JobTracker");
      node02.setRoles(roles02);

      NodeRead[] nodes = { node01, node02 };

      rp.setNodes(nodes);
     
      ObjectMapper mapper = new ObjectMapper();
      this.buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/resourcepool/test01",
            HttpMethod.GET, HttpStatus.OK, mapper.writeValueAsString(rp));
   
View Full Code Here

      roles02.add("NameNode");
      roles02.add("JobTracker");
      node02.setRoles(roles02);
      NodeRead[] nodes = { node01, node02 };

      ResourcePoolRead rp01 = new ResourcePoolRead();
      rp01.setRpName("test01");
      rp01.setVcCluster("home");
      rp01.setRpVsphereName("hadoop01");
      rp01.setTotalRAMInMB(8192);
      rp01.setTotalCPUInMHz(2048);
      rp01.setNodes(nodes);

      ResourcePoolRead rp02 = new ResourcePoolRead();
      rp02.setRpName("test02");
      rp02.setVcCluster("home");
      rp02.setRpVsphereName("hadoop02");
      rp02.setTotalRAMInMB(8192);
      rp02.setTotalCPUInMHz(2048);
      rp02.setNodes(nodes);

      ResourcePoolRead[] rps = { rp01, rp02 };
      ObjectMapper mapper = new ObjectMapper();
      this.buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/resourcepools",
            HttpMethod.GET, HttpStatus.OK, mapper.writeValueAsString(rps));
View Full Code Here

      nodes.add(node1);
      nodes.add(node2);

      vcRpEntity.setHadoopNodes(nodes);

      ResourcePoolRead rpRead = vcRpEntity.toRest();
      Assert.assertTrue(rpRead != null);

      NodeRead[] nodeReads = rpRead.getNodes();
      Assert.assertTrue(nodeReads.length == 2);
      Assert.assertTrue(nodeReads[0].getName().equals("node1"));
      Assert.assertTrue(nodeReads[1].getName().equals("node2"));
   }
View Full Code Here

   public void setHadoopNodes(Set<NodeEntity> hadoopNodes) {
      this.hadoopNodes = hadoopNodes;
   }

   public ResourcePoolRead toRest() {
      ResourcePoolRead read = new ResourcePoolRead();
      read.setRpName(this.getName());
      read.setRpVsphereName(this.getVcResourcePool());
      read.setVcCluster(this.getVcCluster());
      Set<NodeEntity> nodes = this.getHadoopNodes();
      if (nodes == null || nodes.isEmpty()) {
         return read;
      }

      List<NodeRead> nodeReads = new ArrayList<NodeRead>();
      for (NodeEntity node : nodes) {
         NodeRead nodeRead = node.toNodeRead(false);
         nodeReads.add(nodeRead);
      }
      Collections.sort(nodeReads, new Comparator<NodeRead>() {
         @Override
         public int compare(NodeRead arg0, NodeRead arg1) {
            return arg0.getName().compareTo(arg1.getName());
         }
      });
      read.setNodes(nodeReads.toArray(new NodeRead[nodeReads.size()]));
      return read;
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.apitypes.ResourcePoolRead

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.