Package com.vmware.bdd.entity

Examples of com.vmware.bdd.entity.NodeGroupEntity


      cluster.setAutomationEnable(false);
      clusterEntityMgr.update(cluster);
   }

   private void testUpdateNodeGroupEntity() {
      NodeGroupEntity hdfs =
            clusterEntityMgr.findByName(CLUSTER_NAME, HDFS_GROUP);
      Assert.assertNotNull(hdfs);
      hdfs.setDefineInstanceNum(2);
      clusterEntityMgr.update(hdfs);

      Assert.assertTrue(clusterEntityMgr.findByName(CLUSTER_NAME, HDFS_GROUP)
            .getDefineInstanceNum() == 2,
            "defined instance number should be update to 2");
View Full Code Here


      Set<NodeEntity> nodes = new HashSet<NodeEntity>();
      NodeEntity node1 = new NodeEntity();
      node1.setVmName("node1");
      NodeEntity node2 = new NodeEntity();
      node2.setVmName("node2");
      NodeGroupEntity ng = new NodeGroupEntity();
      ng.setRoles(new Gson().toJson(new String[] { "hadoop_datanode" }));
      node1.setNodeGroup(ng);
      node2.setNodeGroup(ng);
      nodes.add(node1);
      nodes.add(node2);
View Full Code Here

   public void setup() {
      ctx = new ClassPathXmlApplicationContext("/META-INF/spring/*-context.xml");
      nodeDAO = ctx.getBean(INodeDAO.class);
      ngDAO = ctx.getBean(INodeGroupDAO.class);

      ng = new NodeGroupEntity();
      ng.setName(NODEGROUP_NAME);
      ng.setDefineInstanceNum(5);

      node1 = new NodeEntity();
      node1.setVmName(NODE1_NAME);
View Full Code Here

      cluster.setDistro("apache");
      cluster.setTopologyPolicy(TopologyType.NONE);
      cluster.setStatus(ClusterStatus.PROVISIONING);

      List<NodeGroupEntity> nodeGroups = new LinkedList<NodeGroupEntity>();
      NodeGroupEntity hdfsGroup = new NodeGroupEntity(HDFS_GROUP);

      hdfsGroup.setCluster(cluster);
      hdfsGroup.setCpuNum(1);
      hdfsGroup.setMemorySize(2048);
      hdfsGroup.setStorageSize(20);
      hdfsGroup.setStorageType(DatastoreType.LOCAL);
      hdfsGroup.setDefineInstanceNum(2);
      hdfsGroup.setHaFlag("on");

      List<NodeEntity> hdfsNodes = new LinkedList<NodeEntity>();
      NodeEntity hdfsNode1 = new NodeEntity();
      NodeEntity hdfsNode2 = new NodeEntity();
      hdfsNode1.setVmName("hdfsNode1");
      hdfsNode2.setVmName("hdfsNode2");

      VcResourcePoolEntity vcRp1 = new VcResourcePoolEntity();
      vcRp1.setName("RP1");
      vcRp1.setVcCluster("Cluster1");
      vcRp1.setVcResourcePool("VcRp1");
      resourcePoolDao.insert(vcRp1);
      hdfsNode1.setVcRp(vcRp1);

      hdfsNodes.add(hdfsNode1);
      hdfsNodes.add(hdfsNode2);
      hdfsGroup.setNodes(hdfsNodes);

      ArrayList<String> roleStr = new ArrayList<String>();
      roleStr.add(HADOOP_ROLE);
      roleStr.add(DATA_NODE_ROLE);
      hdfsGroup.setRoles((new Gson()).toJson(roleStr));

      nodeGroups.add(hdfsGroup);

      NodeGroupEntity computeGroup = new NodeGroupEntity(COMPUTE_GROUP);

      computeGroup.setCluster(cluster);
      computeGroup.setCpuNum(1);
      computeGroup.setMemorySize(2048);
      computeGroup.setStorageSize(20);
      computeGroup.setStorageType(DatastoreType.SHARED);
      computeGroup.setDefineInstanceNum(1);
      computeGroup.setHaFlag("on");

      List<NodeEntity> computeNodes = new LinkedList<NodeEntity>();
      NodeEntity computeNode1 = new NodeEntity();
      computeNode1.setVmName("computeNode1");
      computeNodes.add(computeNode1);
      computeGroup.setNodes(computeNodes);

      roleStr.clear();
      roleStr.add(HADOOP_ROLE);
      roleStr.add(COMPUTE_NODE_ROLE);
      computeGroup.setRoles((new Gson()).toJson(roleStr));

      Set<NodeGroupAssociation> associations =
            new HashSet<NodeGroupAssociation>();
      NodeGroupAssociation association = new NodeGroupAssociation();

      association.setReferencedGroup(HDFS_GROUP);
      association.setAssociationType(GroupAssociationType.STRICT);
      association.setNodeGroup(computeGroup);

      associations.add(association);

      computeGroup.setGroupAssociations(associations);

      nodeGroups.add(computeGroup);

      cluster.setNodeGroups(nodeGroups);

      // test insert()
      clusterDao.insert(cluster);

      ClusterEntity clusterRead = clusterDao.findByName(CLUSTER_NAME);

      Assert.assertNotNull(clusterRead);
      Assert.assertTrue(clusterRead.getNodeGroups().size() == 2);

      NodeGroupEntity groupRead =
            nodeGroupDao.findByName(clusterRead, COMPUTE_GROUP);

      Assert.assertNotNull(groupRead);
      Assert.assertTrue(groupRead.getCpuNum() == 1);
      Assert.assertTrue(groupRead.getGroupAssociations().size() == 1);

      // test updateStatus()
      clusterDao.updateStatus(CLUSTER_NAME, ClusterStatus.VHM_RUNNING);
      clusterRead = clusterDao.findByName(CLUSTER_NAME);
      Assert.assertTrue(clusterRead.getStatus() == ClusterStatus.VHM_RUNNING);
View Full Code Here

      nicEntitySet.add(nic1);
      nicEntitySet.add(nic2);
      nicEntitySet.add(nic3);

      node.setNics(nicEntitySet);
      node.setNodeGroup(new NodeGroupEntity());

      System.out.println((new Gson()).toJson(node.toNodeRead(false)));
   }
View Full Code Here

TOP

Related Classes of com.vmware.bdd.entity.NodeGroupEntity

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.