Package com.vmware.bdd.entity

Examples of com.vmware.bdd.entity.NodeEntity


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

      node1 = new NodeEntity();
      node1.setVmName(NODE1_NAME);
      node1.setMoId(NODE1_MOID);
      node1.setNodeGroup(ng);

      node2 = new NodeEntity();
      node2.setVmName(NODE2_NAME);
      node2.setMoId(NODE2_MOID);
      node2.setNodeGroup(ng);

      ngDAO.insert(ng);
View Full Code Here


      Assert.assertTrue(nodes.size() == 2 && nodes.contains(node1) && nodes.contains(node2));
   }

   @Test
   public void testFindByName() {
      NodeEntity node = nodeDAO.findByName(ng, NODE1_NAME);
      Assert.assertTrue(node != null && node.getVmName().equals(NODE1_NAME));

      node = nodeDAO.findByName(NODE2_NAME);
      Assert.assertTrue(node != null && node.getVmName().equals(NODE2_NAME));
   }
View Full Code Here

      Assert.assertTrue(node != null && node.getVmName().equals(NODE2_NAME));
   }

   @Test
   public void testFindByMoid() {
      NodeEntity node = nodeDAO.findByMobId(NODE1_MOID);
      Assert.assertTrue(node != null && node.getVmName().equals(NODE1_NAME));
   }
View Full Code Here

      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);
View Full Code Here

   public void tearDown() {
   }

   @Test
   public void testSetStatus() {
      NodeEntity node = new NodeEntity();
      node.setVmName(NODE_NAME);
      node.setPowerStatusChanged(false);

      NodeStatus formerStatus = NodeStatus.VM_READY;
      NodeStatus newStatus = NodeStatus.BOOTSTRAP_FAILED;
      node.setStatus(formerStatus, false);
      node.setStatus(newStatus);
      Assert.assertTrue(node.getStatus() == NodeStatus.BOOTSTRAP_FAILED);
      Assert.assertTrue(!node.isPowerStatusChanged());

      formerStatus = NodeStatus.NOT_EXIST;
      newStatus = NodeStatus.POWERED_OFF;
      node.setStatus(formerStatus, false);
      node.setStatus(newStatus);
      Assert.assertTrue(node.getStatus() == NodeStatus.POWERED_OFF);
      Assert.assertTrue(!node.isPowerStatusChanged());

      formerStatus = NodeStatus.POWERED_OFF;
      newStatus = NodeStatus.BOOTSTRAP_FAILED;
      node.setStatus(formerStatus, false);
      node.setStatus(newStatus);
      Assert.assertTrue(node.getStatus() == NodeStatus.BOOTSTRAP_FAILED);
      Assert.assertTrue(node.isPowerStatusChanged());
   }
View Full Code Here

      Assert.assertTrue(node.getStatus() == NodeStatus.BOOTSTRAP_FAILED);
      Assert.assertTrue(node.isPowerStatusChanged());
   }

   @Test void testToRead() {
      NodeEntity node = new NodeEntity();
      Set<NicEntity> nicEntitySet = new HashSet<NicEntity>();
      NicSpec.NetTrafficDefinition netDef1 = new NicSpec.NetTrafficDefinition(NetConfigInfo.NetTrafficType.MGT_NETWORK, 0);
      NicSpec.NetTrafficDefinition netDef2 = new NicSpec.NetTrafficDefinition(NetConfigInfo.NetTrafficType.MGT_NETWORK, 1);
      NicSpec.NetTrafficDefinition netDef3 = new NicSpec.NetTrafficDefinition(NetConfigInfo.NetTrafficType.MGT_NETWORK, 2);
      NicSpec.NetTrafficDefinition netDef4 = new NicSpec.NetTrafficDefinition(NetConfigInfo.NetTrafficType.HDFS_NETWORK, 0);
      NicSpec.NetTrafficDefinition netDef5 = new NicSpec.NetTrafficDefinition(NetConfigInfo.NetTrafficType.HDFS_NETWORK, 1);

      Set<NicSpec.NetTrafficDefinition> netDefs1 = new HashSet<NicSpec.NetTrafficDefinition>();
      netDefs1.add(netDef1);
      netDefs1.add(netDef4);

      Set<NicSpec.NetTrafficDefinition> netDefs2 = new HashSet<NicSpec.NetTrafficDefinition>();
      netDefs2.add(netDef2);
      netDefs2.add(netDef5);

      Set<NicSpec.NetTrafficDefinition> netDefs3 = new HashSet<NicSpec.NetTrafficDefinition>();
      netDefs3.add(netDef3);

      NicEntity nic1 = new NicEntity();
      NetworkEntity net1 = new NetworkEntity();
      net1.setPortGroup("pg1");
      net1.setName("net1");
      nic1.setIpv4Address("192.168.0.1");
      nic1.setNetTrafficDefs(netDefs1);
      nic1.setNetworkEntity(net1);

      NicEntity nic2 = new NicEntity();
      nic2.setIpv4Address("192.168.1.1");
      nic2.setNetTrafficDefs(netDefs2);
      NetworkEntity net2 = new NetworkEntity();
      net2.setPortGroup("pg2");
      net2.setName("net2");
      nic2.setNetworkEntity(net2);

      NicEntity nic3 = new NicEntity();
      nic3.setIpv4Address("192.168.2.1");
      nic3.setNetTrafficDefs(netDefs3);
      NetworkEntity net3 = new NetworkEntity();
      net3.setPortGroup("pg3");
      net3.setName("net3");
      nic3.setNetworkEntity(net3);

      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

   }

   @Override
   @Transactional
   public void updateAction(String moId, String action) {
      NodeEntity node = findByMobId(moId);
      AuAssert.check(node != null);
      node.setAction(action);
   }
View Full Code Here

            "Excepted name is OS, but got " + schema.diskSchema.getName());
   }

   @Test
   public void testGetTargetRp() {
      NodeEntity node = new NodeEntity();
      VcResourcePoolEntity rpEntity = new VcResourcePoolEntity();
      rpEntity.setVcCluster("test-cluster");
      rpEntity.setVcResourcePool("test-rp");
      node.setVcRp(rpEntity);
      VcVmUtil.getTargetRp("test-cluster", "test-group", node);
   }
View Full Code Here

      VcVmUtil.getTargetRp("test-cluster", "test-group", node);
   }

   @Test
   public void testGetTargetRpException() {
      NodeEntity node = new NodeEntity();
      VcResourcePoolEntity rpEntity = new VcResourcePoolEntity();
      rpEntity.setVcCluster("test-cluster");
      rpEntity.setVcResourcePool("test-rp");
      node.setVcRp(rpEntity);
      MockVcResourceUtils.setFlag(false);
      try {
         VcVmUtil.getTargetRp("test-cluster", "test-group", node);
         Assert.assertTrue(false,
               "Should get exception for cannot get resource pool.");
View Full Code Here

      }
   }

   @Test
   public void testGetTargetRpDisabledDRS() {
      NodeEntity node = new NodeEntity();
      VcResourcePoolEntity rpEntity = new VcResourcePoolEntity();
      rpEntity.setVcCluster("test-cluster");
      rpEntity.setVcResourcePool("test-rp");
      node.setVcRp(rpEntity);
      MockVcResourceUtils.setDisableDRS(true);
      VcResourcePool rp =
            VcVmUtil.getTargetRp("test-cluster", "test-group", node);
      Assert.assertTrue(rp.getName() != null, "Should get root rp, but got "
            + rp.getName());
View Full Code Here

TOP

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

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.