@Test
  public void testupdateKerberosDescriptorArtifact() throws Exception {
    String kerberosDescriptorJson = IOUtils.toString(getClass().getClassLoader().getResourceAsStream("org/apache/ambari/server/upgrade/kerberos_descriptor.json"), "UTF-8");

    //there is HIVE -> WEBHCAT_SERVER -> configurations -> core-site -> hadoop.proxyuser.HTTP.hosts
    assertTrue(kerberosDescriptorJson.contains("${clusterHostInfo/webhcat_server_host|append(core-site/hadoop.proxyuser.HTTP.hosts, \\\\\\\\,, true)}"));
    assertTrue(kerberosDescriptorJson.contains("${clusterHostInfo/rm_host}"));

    ArtifactEntity artifactEntity = new ArtifactEntity();
    artifactEntity.setArtifactName("kerberos_descriptor");
    artifactEntity.setArtifactData(GSON.<Map<String, Object>>fromJson(kerberosDescriptorJson, Map.class));

    UpgradeCatalog270 upgradeCatalog270 = createMockBuilder(UpgradeCatalog270.class).createMock();

    expect(artifactDAO.merge(artifactEntity)).andReturn(artifactEntity);

    replay(upgradeCatalog270);

    upgradeCatalog270.updateKerberosDescriptorArtifact(artifactDAO, artifactEntity);

    final String newKerberosDescriptorJson = GSON.toJson(artifactEntity.getArtifactData());

    int oldCount = substringCount(kerberosDescriptorJson, AMBARI_INFRA_OLD_NAME);
    int newCount = substringCount(newKerberosDescriptorJson, AMBARI_INFRA_NEW_NAME);
    assertThat(newCount, is(oldCount));

    assertTrue(newKerberosDescriptorJson.contains("${clusterHostInfo/webhcat_server_hosts|append(core-site/hadoop.proxyuser.HTTP.hosts, \\\\,, true)}"));
    assertTrue(newKerberosDescriptorJson.contains("${clusterHostInfo/resourcemanager_hosts}"));

    verify(upgradeCatalog270);
  }
@return sample JSON data from repo_version data (no repositories defined) where 'OperatingSystems/ambari_managed_repositories' is missing
ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog270Test.java