failedMsgList.get(0));
}
@Test
public void testValidateInfraSettingsBasedOnRole() {
ClusterBlueprint blueprint = new ClusterBlueprint();
blueprint.setHadoopStack(new HadoopStack());
blueprint.getHadoopStack().setDistro(Constants.DEFAULT_VENDOR);
Map<NetTrafficType, List<String>> networkConfig = new HashMap<NetTrafficType, List<String>>();
List<String> mgtnets = new ArrayList<String>();
mgtnets.add("nw1");
networkConfig.put(NetTrafficType.MGT_NETWORK, mgtnets);
List<String> hadpnets = new ArrayList<String>();
hadpnets.add("nw2");
networkConfig.put(NetTrafficType.HDFS_NETWORK, hadpnets);
NodeGroupInfo master = new NodeGroupInfo();
master.setName("master");
master.setInstanceNum(1);
master.setRoles(Arrays.asList(HadoopRole.HADOOP_NAMENODE_ROLE.toString(),
HadoopRole.HADOOP_RESOURCEMANAGER_ROLE.toString()));
NodeGroupInfo worker = new NodeGroupInfo();
worker.setName("worker");
worker.setRoles(Arrays.asList(HadoopRole.HADOOP_DATANODE.toString(),
HadoopRole.HADOOP_NODEMANAGER_ROLE.toString()));
worker.setInstanceNum(0);
NodeGroupInfo client = new NodeGroupInfo();
client.setName("client");
client.setInstanceNum(0);
client.setRoles(Arrays.asList(HadoopRole.HADOOP_CLIENT_ROLE.toString(),
HadoopRole.HIVE_SERVER_ROLE.toString(),
HadoopRole.HIVE_ROLE.toString()));
List<String> failedMsgList = new ArrayList<String>();
List<String> warningMsgList = new ArrayList<String>();
List<NodeGroupInfo> groups = new ArrayList<NodeGroupInfo>();
groups.add(master);
groups.add(worker);
groups.add(client);
blueprint.setNodeGroups(groups);
validator.validateGroupConfig(blueprint, failedMsgList, warningMsgList);
assertEquals(1, failedMsgList.size());
assertEquals("worker.instanceNum=0.", failedMsgList.get(0));
assertEquals(0, warningMsgList.size());
}