.indexOf("{\"name\":\"my-cluster5\",\"groups\":[{\"name\":\"main_group\",\"roles\":[\"hadoop_namenode\"],\"instance_num\":1,\"storage\":{\"type\":\"local\",\"size\":50},\"cpu\":3,\"memory\":15000,\"ha\":\"off\",\"vm_folder_path\":\"SERENGETI-null/my-cluster5/main_group\"},{\"name\":\"expanded_master\",\"roles\":[\"hadoop_jobtracker\"],\"instance_num\":1,\"storage\":{\"type\":\"shared\",\"size\":50},\"cpu\":2,\"memory\":7500,\"ha\":\"on\",\"vm_folder_path\":\"SERENGETI-null/my-cluster5/expanded_master\"},{\"name\":\"expanded_worker\",\"roles\":[\"hadoop_datanode\",\"hadoop_tasktracker\"],\"instance_num\":3,\"storage\":{\"type\":\"local\",\"size\":50},\"cpu\":1,\"memory\":3748,\"ha\":\"off\",\"vm_folder_path\":\"SERENGETI-null/my-cluster5/expanded_worker\"}],\"distro\":\"apache\",\"vc_clusters\":[{\"name\":\"cluster1\",\"vc_rps\":[\"rp2\"]},{\"name\":\"cluster2\",\"vc_rps\":[\"rp1\",\"rp2\"]},{\"name\":\"cluster4\",\"vc_rps\":[\"rp1\"]}],\"template_id\":\"vm-001\",\"networking\":[{\"port_group\":\"CFNetwork\",\"type\":\"dhcp\"}]") != -1,
"manifest is inconsistent");
}
public void testClusterConfigWithGroupStoragePattern() {
ClusterCreate spec = new ClusterCreate();
spec.setNetworkConfig(createNetConfigs());
spec.setName("my-cluster6");
List<String> rps = new ArrayList<String>();
rps.add("myRp2");
rps.add("myRp3");
rps.add("myRp4");
rps.add("myRp5");
spec.setRpNames(rps);
NodeGroupCreate[] nodegroups = new NodeGroupCreate[1];
NodeGroupCreate group = new NodeGroupCreate();
nodegroups[0] = group;
group.setCpuNum(3);
group.setInstanceNum(1);
group.setInstanceType(InstanceType.LARGE);
group.setHaFlag("off");
group.setName("main_group");
List<String> roles = new ArrayList<String>();
roles.add("hadoop_namenode");
group.setRoles(roles);
StorageRead storage = new StorageRead();
storage.setType(DatastoreType.LOCAL.toString());
List<String> dsNames = new ArrayList<String>();
dsNames.add("testSharedStore");
dsNames.add("testLocalStore");
storage.setDsNames(dsNames);
group.setStorage(storage);
spec.setNodeGroups(nodegroups);
clusterConfigMgr.createClusterConfig(spec);
ClusterEntity cluster = clusterEntityMgr.findByName("my-cluster6");
Assert.assertTrue(cluster != null);
ClusterCreate attrs = clusterConfigMgr.getClusterConfig("my-cluster6");
String manifest = gson.toJson(attrs);
System.out.println(manifest);
Assert.assertTrue(
manifest.indexOf("main_group") != -1
&& manifest.indexOf("expanded_master") != -1