@Test
public void testUpgradeServerActionOrchestration() throws Exception {

  Map<String, UpgradePack> upgrades = ambariMetaInfo.getUpgradePacks("HDP", "2.1.1");
  ServiceInfo si = ambariMetaInfo.getService("HDP", "2.1.1", "ZOOKEEPER");
  si.setDisplayName("Zk");
  ComponentInfo ci = si.getComponentByName("ZOOKEEPER_SERVER");
  ci.setDisplayName("ZooKeeper1 Server2");
  assertTrue(upgrades.containsKey("upgrade_server_action_test"));
  UpgradePack upgrade = upgrades.get("upgrade_server_action_test");
  assertNotNull(upgrade);
  Cluster cluster = makeCluster();
  UpgradeContext context = m_upgradeContextFactory.create(cluster, UpgradeType.ROLLING,
      Direction.UPGRADE, UPGRADE_VERSION, new HashMap<String, Object>());
  context.setResolver(m_masterHostResolver);
  List<UpgradeGroupHolder> groups = m_upgradeHelper.createSequence(upgrade, context);
  assertEquals(1, groups.size());
  UpgradeGroupHolder group = groups.get(0);
  assertEquals("CLUSTER_SERVER_ACTIONS", group.name);
  List<StageWrapper> stageWrappers = group.items;
  assertEquals(6, stageWrappers.size());
  assertEquals("Pre Upgrade", stageWrappers.get(0).getText());
  assertEquals("Pre Upgrade Zookeeper", stageWrappers.get(1).getText());
  assertEquals("Configuring", stageWrappers.get(2).getText());
  assertEquals("Configuring HDFS", stageWrappers.get(3).getText());
  assertEquals("Calculating Properties", stageWrappers.get(4).getText());
  assertEquals("Calculating HDFS Properties", stageWrappers.get(5).getText());
  // Do stacks cleanup
  stackManagerMock.invalidateCurrentPaths();
  ambariMetaInfo.init();
}