@Test
public void testMergeRoleCommandOrder() throws Exception {

  StackInfo stack = stackManager.getStack("HDP", "2.1.1");
  // merged role command order with parent stacks
  Map<String, Object> roleCommandOrder = stack.getRoleCommandOrder().getContent();
  assertTrue(roleCommandOrder.containsKey("optional_glusterfs"));
  assertTrue(roleCommandOrder.containsKey("general_deps"));
  assertTrue(roleCommandOrder.containsKey("optional_no_glusterfs"));
  assertTrue(roleCommandOrder.containsKey("namenode_optional_ha"));
  assertTrue(roleCommandOrder.containsKey("resourcemanager_optional_ha"));
  Map<String, Object>  generalDeps = (Map<String, Object>) roleCommandOrder.get("general_deps");
  assertTrue(generalDeps.containsKey("HBASE_MASTER-START"));
  assertTrue(generalDeps.containsKey("HBASE_REGIONSERVER-START"));
  Map<String, Object>  optionalNoGlusterfs  = (Map<String, Object>) roleCommandOrder.get("optional_no_glusterfs");
  assertTrue(optionalNoGlusterfs.containsKey("SECONDARY_NAMENODE-START"));
  ArrayList<String> hbaseMasterStartValues = (ArrayList<String>) generalDeps.get("HBASE_MASTER-START");
  assertTrue(hbaseMasterStartValues.get(0).equals("ZOOKEEPER_SERVER-START"));
  ServiceInfo service = stack.getService("PIG");
  assertNotNull("PIG's roll command order is null", service.getRoleCommandOrder());
  assertTrue(optionalNoGlusterfs.containsKey("NAMENODE-STOP"));
  ArrayList<String> nameNodeStopValues = (ArrayList<String>) optionalNoGlusterfs.get("NAMENODE-STOP");
  assertTrue(nameNodeStopValues.contains("JOBTRACKER-STOP"));
  assertTrue(nameNodeStopValues.contains("CUSTOM_MASTER-STOP"));
  assertTrue(generalDeps.containsKey("CUSTOM_MASTER-START"));
  ArrayList<String> customMasterStartValues = (ArrayList<String>) generalDeps.get("CUSTOM_MASTER-START");
  assertTrue(customMasterStartValues.contains("ZOOKEEPER_SERVER-START"));
  assertTrue(customMasterStartValues.contains("NAMENODE-START"));
}