@Test()
public void testCreateHostOrderedUpgradeThrowsExceptions() throws Exception {

  Map<String, Object> requestProps = new HashMap<>();
  requestProps.put(UpgradeResourceProvider.UPGRADE_CLUSTER_NAME, "c1");
  requestProps.put(UpgradeResourceProvider.UPGRADE_VERSION, "2.2.0.0");
  requestProps.put(UpgradeResourceProvider.UPGRADE_PACK, "upgrade_test_host_ordered");
  requestProps.put(UpgradeResourceProvider.UPGRADE_TYPE, UpgradeType.HOST_ORDERED.toString());
  requestProps.put(UpgradeResourceProvider.UPGRADE_SKIP_PREREQUISITE_CHECKS, Boolean.TRUE.toString());
  requestProps.put(UpgradeResourceProvider.UPGRADE_DIRECTION, Direction.UPGRADE.name());
  ResourceProvider upgradeResourceProvider = createProvider(amc);
  Request request = PropertyHelper.getCreateRequest(Collections.singleton(requestProps), null);
  try {
    upgradeResourceProvider.createResources(request);
    Assert.fail("The request should have failed due to the missing Upgrade/host_order property");
  } catch( SystemException systemException ){
    // expected
  }
  // stick a bad host_ordered_hosts in there which has the wrong hosts
  Set<Map<String, List<String>>> hostsOrder = new LinkedHashSet<>();
  Map<String, List<String>> hostGrouping = new HashMap<>();
  hostGrouping.put("hosts", Lists.newArrayList("invalid-host"));
  hostsOrder.add(hostGrouping);
  requestProps.put(UpgradeResourceProvider.UPGRADE_HOST_ORDERED_HOSTS, hostsOrder);
  try {
    upgradeResourceProvider.createResources(request);
    Assert.fail("The request should have failed due to invalid hosts");
  } catch (SystemException systemException) {
    // expected
  }
  // use correct hosts now
  hostsOrder = new LinkedHashSet<>();
  hostGrouping = new HashMap<>();
  hostGrouping.put("hosts", Lists.newArrayList("h1"));
  hostsOrder.add(hostGrouping);
  requestProps.put(UpgradeResourceProvider.UPGRADE_HOST_ORDERED_HOSTS, hostsOrder);
  upgradeResourceProvider.createResources(request);
}