Package com.vmware.bdd.apitypes

Examples of com.vmware.bdd.apitypes.ClusterCreate


    @Test
    public void testExportClusterSpec() throws Exception {
       CookieCache.put("Cookie","JSESSIONID=2AAF431F59ACEE1CC68B43C87772C54F");
       ObjectMapper mapper = new ObjectMapper();
       ClusterCreate clusterSpec =
          CommandsUtils.getObjectByJsonString(ClusterCreate.class, CommandsUtils.dataFromFile(this.getClass().getResource("/hadoop_cluster.json").getPath()));
       buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/hadoop/spec", HttpMethod.GET, HttpStatus.OK,
             mapper.writeValueAsString(clusterSpec));
       clusterCommands.exportClusterData("hadoop", null, null, null, null, null);

       setup();
       buildReqRespWithoutReqBody("https://127.0.0.1:8443/serengeti/api/cluster/hadoop/spec", HttpMethod.GET, HttpStatus.OK,
             mapper.writeValueAsString(clusterSpec));
       clusterCommands.exportClusterData("hadoop", "exportedSpec.json", null, null, null, null);
       clusterSpec = CommandsUtils.getObjectByJsonString(ClusterCreate.class, CommandsUtils.dataFromFile("exportedSpec.json"));
       Assert.assertEquals(clusterSpec.getNodeGroups().length, 3);
       File exportedFile = new File("exportedSpec.json");
       if (exportedFile.exists()) {
          Assert.assertEquals(exportedFile.delete(), true);
       }
       //TODOqqjin): need add more cases
View Full Code Here


   @Test
   public void testParseClusterSpec() {
     try {
        String[] specFiles = { "hadoop_cluster.json", "hbase_cluster.json" };
        for (String specFile : specFiles) {
           ClusterCreate clusterSpec = CommandsUtils.getObjectByJsonString(
                 ClusterCreate.class, CommandsUtils.dataFromFile(this.getClass().getResource("/" + specFile).getPath()));
           List<String> errors = new ArrayList<String>();
           List<String> warnings = new ArrayList<String>();
           boolean valid = clusterSpec.validateNodeGroupPlacementPolicies(errors, warnings);
           Assert.assertTrue(valid, errors.toString());
        }
     } catch (Exception e) {
        Assert.fail("failed to parse cluster spec", e);
     }
View Full Code Here

      MockTmScheduler.cleanFlag();
      Mockit.tearDownMocks();
   }

   private ClusterCreate getClusterSpec() {
      ClusterCreate spec = new ClusterCreate();
      spec.setName("test");
      NodeGroupCreate[] nodeGroups = new NodeGroupCreate[1];
      NodeGroupCreate group = new NodeGroupCreate();
      group.setVmFolderPath("root/test/master");
      group.setName("master");
      group.setCpuNum(2);
      nodeGroups[0] = group;
      spec.setNodeGroups(nodeGroups);
      List<NetworkAdd> networkAdds = new ArrayList<NetworkAdd>();
      NetworkAdd network = new NetworkAdd();
      network.setDhcp(true);
      network.setPortGroup("test-portgroup");
      networkAdds.add(network);
      spec.setNetworkings(networkAdds);
      return spec;
   }
View Full Code Here

      return spec;
   }

   @Test
   public void testGetVmSchema() {
      ClusterCreate spec = getClusterSpec();
      List<DiskSpec> diskSet = getDiskSpec();
      VmSchema schema =
            VcVmUtil.getVmSchema(spec, "master", diskSet, "vm-101", "snap-102");
      Assert.assertTrue(schema.resourceSchema.numCPUs == 2,
            "Excepted cpu number is 2, but got "
View Full Code Here

      new MockUp<ClusterManager>() {
         @Mock
         public Map<String, Object> getClusterConfigManifest(
               String clusterName, List<String> targets, boolean needAllocIp) {
            Map<String, Object> attrs = new HashMap<String, Object>();
            ClusterCreate cluster = new ClusterCreate();
            NodeGroupCreate master = new NodeGroupCreate();
            master.setName("마스터 노드");
            NodeGroupCreate worker = new NodeGroupCreate();
            worker.setName("协作节点");
            NodeGroupCreate client = new NodeGroupCreate();
            client.setName("クライアント");
            cluster.setNodeGroups(new NodeGroupCreate[] { master, worker,
                  client });
            attrs.put("cluster_definition", cluster);
            return attrs;
         }
      }.getMockInstance();
View Full Code Here

TOP

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

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.