@Test
  public void testGroupOrdersForRolling() {
    Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
    assertTrue(upgrades.size() > 0);
    assertTrue(upgrades.containsKey("upgrade_test_checks"));
    UpgradePack upgrade = upgrades.get("upgrade_test_checks");

    PrerequisiteCheckConfig prerequisiteCheckConfig = upgrade.getPrerequisiteCheckConfig();
    assertNotNull(prerequisiteCheckConfig);
    assertNotNull(prerequisiteCheckConfig.globalProperties);
    assertTrue(prerequisiteCheckConfig.getGlobalProperties().containsKey("global-property-1"));
    assertEquals("global-value-1", prerequisiteCheckConfig.getGlobalProperties().get("global-property-1"));
    assertNotNull(prerequisiteCheckConfig.prerequisiteCheckProperties);
    assertEquals(2, prerequisiteCheckConfig.prerequisiteCheckProperties.size());
    assertNotNull(prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck"));
    assertTrue(prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck").containsKey("dfs-protocols-regex"));
    assertEquals("^([^:]*dfs|wasb|ecs):.*", prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesMapReduceDistributedCacheCheck").get("dfs-protocols-regex"));
    assertNotNull(prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck"));
    assertTrue(prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck").containsKey("dfs-protocols-regex"));
    assertEquals("^([^:]*dfs|wasb|ecs):.*", prerequisiteCheckConfig.getCheckProperties(
        "org.apache.ambari.server.checks.ServicesTezDistributedCacheCheck").get("dfs-protocols-regex"));


    List<String> expected_up = Arrays.asList(
        "PRE_CLUSTER",
        "ZOOKEEPER",
        "CORE_MASTER",
        "SERVICE_CHECK_1",
        "CORE_SLAVES",
        "SERVICE_CHECK_2",
        "OOZIE",
        "POST_CLUSTER");

    List<String> expected_down = Arrays.asList(
        "PRE_CLUSTER",
        "OOZIE",
        "CORE_SLAVES",
        "SERVICE_CHECK_2",
        "CORE_MASTER",
        "SERVICE_CHECK_1",
        "ZOOKEEPER",
        "POST_CLUSTER");

    Grouping serviceCheckGroup = null;

    int i = 0;
    List<Grouping> groups = upgrade.getGroups(Direction.UPGRADE);
    for (Grouping g : groups) {
      assertEquals(expected_up.get(i), g.name);
      i++;

      if (g.name.equals("SERVICE_CHECK_1")) {
        serviceCheckGroup = g;
      }
    }

    List<String> expected_priority = Arrays.asList("HDFS", "HBASE", "YARN");

    assertNotNull(serviceCheckGroup);
    assertEquals(ServiceCheckGrouping.class, serviceCheckGroup.getClass());
    ServiceCheckGrouping scg = (ServiceCheckGrouping) serviceCheckGroup;

    Set<String> priorities = scg.getPriorities();
    assertEquals(3, priorities.size());

    i = 0;
    for (String s : priorities) {
      assertEquals(expected_priority.get(i++), s);
    }


    i = 0;
    groups = upgrade.getGroups(Direction.DOWNGRADE);
    for (Grouping g : groups) {
      assertEquals(expected_down.get(i), g.name);
      i++;
    }

  }
Tests that boolean values are property serialized in the upgrade pack.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/state/stack/UpgradePackTest.java