Examples of ClusterRead


Examples of com.vmware.bdd.apitypes.ClusterRead

   @Test(groups = { "TestClusteringJobs" }, dependsOnMethods = { "testDupStartCluster" })
   @Transactional(propagation = Propagation.NEVER)
   public void testConfigIOShares() throws Exception {
      clusterMgr.prioritizeCluster(TEST_STATIC_IP_CLUSTER_NAME, Priority.HIGH);
      ClusterRead cluster =
            clusterMgr.getClusterByName(TEST_STATIC_IP_CLUSTER_NAME, false);
      Assert.assertTrue(cluster.getIoShares().equals(Priority.HIGH),
            "Cluster " + cluster.getName() + " should have HIGH io share level");
   }
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

   @Transactional(propagation = Propagation.NEVER)
   public void testDeleteCluster() throws Exception {
      long jobExecutionId =
            clusterMgr.deleteClusterByName(TEST_STATIC_IP_CLUSTER_NAME);

      ClusterRead cluster =
            clusterMgr.getClusterByName(TEST_STATIC_IP_CLUSTER_NAME, false);
      Assert.assertTrue(cluster.getStatus() == ClusterStatus.DELETING,
            "Cluster status should be DELETING, but got " + cluster.getStatus());
      waitTaskFinished(jobExecutionId);
      try {
         cluster =
               clusterMgr.getClusterByName(TEST_STATIC_IP_CLUSTER_NAME, false);
         Assert.assertTrue(false, "Cluster should not be found.");
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

   @Transactional(propagation = Propagation.NEVER)
   public void testDeleteDhcpCluster() throws Exception {
      long jobExecutionId =
            clusterMgr.deleteClusterByName(TEST_DHCP_CLUSTER_NAME);

      ClusterRead cluster =
            clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
      Assert.assertTrue(cluster.getStatus() == ClusterStatus.DELETING,
            "Cluster status should be DELETING, but got " + cluster.getStatus());
      waitTaskFinished(jobExecutionId);
      try {
         cluster = clusterMgr.getClusterByName(TEST_DHCP_CLUSTER_NAME, false);
         Assert.assertTrue(false, "Cluster should not be found.");
      } catch (BddException e) {
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

        ngr2.setMemCapacityMB(2048);
        ngr2.setStorage(sr2);
        ngr2.setInstanceNum(20);
        ngr2.setInstances(instances2);
        ngr2.setRoles(roles2);
        ClusterRead cr1 = new ClusterRead();
        cr1.setName("cluster1");
        cr1.setDistro("distro1");
        cr1.setInstanceNum(10);
        cr1.setStatus(ClusterStatus.RUNNING);
        List<NodeGroupRead> nodeGroupRead1 = new LinkedList<NodeGroupRead>();
        nodeGroupRead1.add(ngr1);
        nodeGroupRead1.add(ngr2);
        cr1.setNodeGroups(nodeGroupRead1);
        this.buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
              mapper.writeValueAsString(cr1));
        this.buildReqRespWithoutRespBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/nodegroup/NodeGroup1/instancenum",
                HttpMethod.PUT, HttpStatus.NO_CONTENT, "5");
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

        ngr2.setMemCapacityMB(2048);
        ngr2.setStorage(sr2);
        ngr2.setInstanceNum(20);
        ngr2.setInstances(instances2);
        ngr2.setRoles(roles2);
        ClusterRead cr1 = new ClusterRead();
        cr1.setName("cluster1");
        cr1.setDistro("distro1");
        cr1.setInstanceNum(10);
        cr1.setStatus(ClusterStatus.RUNNING);
        List<NodeGroupRead> nodeGroupRead1 = new LinkedList<NodeGroupRead>();
        nodeGroupRead1.add(ngr1);
        nodeGroupRead1.add(ngr2);
        cr1.setNodeGroups(nodeGroupRead1);
        buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
              mapper.writeValueAsString(cr1));
        this.buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/nodegroup/ng1/instancenum",
                HttpMethod.PUT, HttpStatus.NOT_FOUND, mapper.writeValueAsString(errorMsg));
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

        task.setProgressMessage("some more details here:");
        task.setStatus(Status.STARTED);
        buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/task/12", HttpMethod.GET, HttpStatus.OK,
                mapper.writeValueAsString(task));

        ClusterRead cluster = new ClusterRead();
        List<NodeGroupRead> nodeGroups = new ArrayList<NodeGroupRead>();
        NodeGroupRead workerGroup = new NodeGroupRead();
        workerGroup.setName("worker");
        workerGroup.setInstanceNum(1);
        List<NodeRead> instances = new ArrayList<NodeRead>();
        NodeRead instance1 = new NodeRead();
        instance1.setName("worker1");
        instance1.setStatus("PoweredOn");
        instance1.setAction("Getting IP...");
        instances.add(instance1);
        workerGroup.setInstances(instances);
        nodeGroups.add(workerGroup);
        cluster.setNodeGroups(nodeGroups);
        buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET,
                HttpStatus.OK, mapper.writeValueAsString(cluster));

        task.setProgress(1.0);
        task.setStatus(Status.COMPLETED);
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

        ngr2.setMemCapacityMB(2048);
        ngr2.setStorage(sr2);
        ngr2.setInstanceNum(20);
        ngr2.setInstances(instances2);
        ngr2.setRoles(roles2);
        ClusterRead cr1 = new ClusterRead();
        cr1.setName("cluster1");
        cr1.setDistro("distro1");
        cr1.setInstanceNum(10);
        cr1.setStatus(ClusterStatus.RUNNING);
        ClusterRead cr2 = new ClusterRead();
        cr2.setName("cluster2");
        cr2.setDistro("distro2");
        cr2.setInstanceNum(20);
        cr2.setStatus(ClusterStatus.STOPPED);
        List<NodeGroupRead> nodeGroupRead1 = new LinkedList<NodeGroupRead>();
        nodeGroupRead1.add(ngr1);
        nodeGroupRead1.add(ngr2);
        cr1.setNodeGroups(nodeGroupRead1);
        cr2.setNodeGroups(nodeGroupRead1);
        buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/clusters?details=true", HttpMethod.GET, HttpStatus.OK,
                mapper.writeValueAsString(new ClusterRead[] { cr1, cr2 }));
        clusterCommands.getCluster(null, true);

        //test topology turn-on
        cr1.setTopologyPolicy(TopologyType.HVE);
        cr2.setTopologyPolicy(TopologyType.RACK_AS_RACK);
        setup();
        buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/clusters?details=true", HttpMethod.GET, HttpStatus.OK,
              mapper.writeValueAsString(new ClusterRead[] { cr1, cr2 }));
        clusterCommands.getCluster(null, true);
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

      ngr1.setMemCapacityMB(2048);
      ngr1.setStorage(sr1);
      ngr1.setInstanceNum(1);
      ngr1.setInstances(instances1);
      ngr1.setRoles(roles1);
      ClusterRead cr1 = new ClusterRead();
      cr1.setName("cluster1");
      cr1.setDistro("distro1");
      cr1.setInstanceNum(10);
      cr1.setStatus(ClusterStatus.RUNNING);
      List<NodeGroupRead> nodeGroupRead1 = new LinkedList<NodeGroupRead>();
      nodeGroupRead1.add(ngr1);
      cr1.setNodeGroups(nodeGroupRead1);
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));

      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/config", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

      ngr1.setMemCapacityMB(2048);
      ngr1.setStorage(sr1);
      ngr1.setInstanceNum(2);
      ngr1.setInstances(instances1);
      ngr1.setRoles(roles1);
      ClusterRead cr1 = new ClusterRead();
      cr1.setName("cluster1");
      cr1.setDistroVendor("BIGTOP");
      cr1.setDistro("distro1");
      cr1.setInstanceNum(10);
      cr1.setVhmMinNum(-1);
      cr1.setVhmMaxNum(-1);
      cr1.setStatus(ClusterStatus.RUNNING);
      List<NodeGroupRead> nodeGroupRead = new LinkedList<NodeGroupRead>();
      nodeGroupRead.add(ngr1);
      List<String> roles2 = new LinkedList<String>();
      roles2.add(Constants.ROLE_HADOOP_CLIENT);
      NodeGroupRead ngr2 = new NodeGroupRead();
      ngr2.setName("NodeGroup2");
      ngr2.setCpuNum(6);
      ngr2.setMemCapacityMB(2048);
      ngr2.setStorage(sr1);
      ngr2.setInstanceNum(1);
      ngr2.setInstances(instances1);
      ngr2.setRoles(roles2);
      nodeGroupRead.add(ngr2);
      cr1.setNodeGroups(nodeGroupRead);
      cr1.setAutomationEnable(false);


      //setParam tests
      //set elasticityMode to MANUAL
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", "MANUAL", null, null, null, "HIGH");

      //set elasticityMode to AUTO with targetComputeNodeNum=2
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", "AUTO", null, null, 2, "HIGH");

      //set elasticityMode to MANUAL with targetComputeNodeNum=2
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param_wait_for_result", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", "MANUAL", null, null, 2, "HIGH");

      //set minComputeNodeNum=2 and targetComputeNodeNum=2
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param_wait_for_result", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", null, 2, null, 2, "HIGH");

      //set elasticityMode to AUTO with minComputeNodeNum=maxComputeNodeNum=2
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", "AUTO", 2, 2, null, "HIGH");

      //only set ioShares to HIGH
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.setParam("cluster1", null, null, null, null, "HIGH");

      //reset Param tests
      //reset all
      setup();
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param_wait_for_result", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.resetParam("cluster1", true, false, false, false, false, false);

      //set vhmTargetNum to -1
      //then reset elasticityMode
      setup();
      cr1.setVhmTargetNum(-1);
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param_wait_for_result", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.resetParam("cluster1", false, true, false, false, false, false);

      //set automationEnable to true
      //then reset minComputeNodeNum, maxComputeNodeNum, targetComputeNodeNum and ioShares
      setup();
      cr1.setAutomationEnable(true);
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.resetParam("cluster1", false, false, true, true, true, true);

      //set automationEnable to true
      //then only reset ioShares
      setup();
      cr1.setAutomationEnable(true);
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1", HttpMethod.GET, HttpStatus.OK,
            mapper.writeValueAsString(cr1));
      buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/cluster1/param", HttpMethod.PUT,
            HttpStatus.NO_CONTENT, "");
      clusterCommands.resetParam("cluster1", false, false, false, false, false, true);
View Full Code Here

Examples of com.vmware.bdd.apitypes.ClusterRead

   public void testGetRackTopology() {
      IClusterEntityManager iclusterEntityManager =
            new MockUp<IClusterEntityManager>() {
               @Mock
               public ClusterRead toClusterRead(String name) {
                  ClusterRead cluster = new ClusterRead();
                  cluster.setTopologyPolicy(TopologyType.NONE);
                  List<NodeGroupRead> nodeGroups =
                        new ArrayList<NodeGroupRead>();
                  NodeGroupRead nodeGroup = new NodeGroupRead();
                  List<NodeRead> nodes = new ArrayList<NodeRead>();
                  NodeRead node = new NodeRead();
                  node.setRack("rack1");
                  node.setHostName("host1.com");
                  Map<NetTrafficType, List<IpConfigInfo>> ipConfigs =
                        new HashMap<NetTrafficType, List<IpConfigInfo>>();
                  IpConfigInfo ipConfigInfo1 =
                        new IpConfigInfo(NetTrafficType.MGT_NETWORK, "nw1",
                              "portgroup1", "192.168.1.100");
                  List<IpConfigInfo> ipConfigInfos1 =
                        new ArrayList<IpConfigInfo>();
                  ipConfigInfos1.add(ipConfigInfo1);
                  IpConfigInfo ipConfigInfo2 =
                        new IpConfigInfo(NetTrafficType.HDFS_NETWORK, "nw2",
                              "portgroup2", "192.168.2.100");
                  IpConfigInfo ipConfigInfo3 =
                        new IpConfigInfo(NetTrafficType.HDFS_NETWORK, "nw3",
                              "portgroup3", "192.168.3.100");
                  List<IpConfigInfo> ipConfigInfos2 =
                        new ArrayList<IpConfigInfo>();
                  ipConfigInfos2.add(ipConfigInfo2);
                  ipConfigInfos2.add(ipConfigInfo3);
                  ipConfigs.put(NetTrafficType.MGT_NETWORK, ipConfigInfos1);
                  ipConfigs.put(NetTrafficType.HDFS_NETWORK, ipConfigInfos2);
                  node.setIpConfigs(ipConfigs);
                  nodes.add(node);
                  nodeGroup.setInstances(nodes);
                  nodeGroups.add(nodeGroup);
                  cluster.setNodeGroups(nodeGroups);
                  return cluster;
               }
            }.getMockInstance();

      new MockUp<ClusterConfigManager>() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.