@Test
  public void testFullUpgrade() throws Exception {
    UpgradeHelper upgradeHelper = createNiceMock(UpgradeHelper.class);
    ConfigHelper configHelper = createNiceMock(ConfigHelper.class);
    UpgradePack upgradePack = createNiceMock(UpgradePack.class);
    AmbariMetaInfo ami = createNiceMock(AmbariMetaInfo.class);

    expect(m_targetRepositoryVersion.getType()).andReturn(RepositoryType.STANDARD).atLeastOnce();

    expect(upgradeHelper.suggestUpgradePack(EasyMock.anyString(), EasyMock.anyObject(StackId.class),
        EasyMock.anyObject(StackId.class), EasyMock.anyObject(Direction.class),
        EasyMock.anyObject(UpgradeType.class), EasyMock.anyString())).andReturn(upgradePack).once();

    replayAll();

    Map<String, Object> requestMap = new HashMap<>();
    requestMap.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.ROLLING.name());
    requestMap.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.UPGRADE.name());
    requestMap.put(UpgradeResourceProvider.UPGRADE_REPO_VERSION_ID,
        m_targetRepositoryVersion.getId().toString());
    requestMap.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, "true");

    UpgradeContext context = new UpgradeContext(m_cluster, requestMap, null, upgradeHelper,
        m_upgradeDAO, m_repositoryVersionDAO, configHelper, ami);

    assertEquals(Direction.UPGRADE, context.getDirection());
    assertEquals(RepositoryType.STANDARD, context.getOrchestrationType());
    assertEquals(1, context.getSupportedServices().size());
    assertFalse(context.isPatchRevert());
    assertFalse(context.getUpgradeSummary().isSwitchBits);

    verifyAll();
  }
Tests that the {@link UpgradeContext} for a normal upgrade.

@throws Exception
ambari-server/src/test/java/org/apache/ambari/server/stack/upgrade/orchestrate/UpgradeContextTest.java