@Test
  public void testDuplicateServicePropertyValidationAfterXmlDeserialization() throws Exception {
    // Given
    String serviceInfoXml =
        "<metainfo>" +
            "  <schemaVersion>2.0</schemaVersion>" +
            "  <services>" +
            "    <service>" +
            "      <version>1.0</version>" +
            "      <name>WITH_DUPLICATE_PROPS</name>" +
            "      <displayName>WITH_PROPS</displayName>" +
            "      <properties>" +
            "        <property>" +
            "          <name>PROP1</name>" +
            "          <value>VAL1</value>" +
            "        </property>" +
            "        <property>" +
            "          <name>PROP1</name>" +
            "          <value>VAL2</value>" +
            "        </property>" +
            "        <property>" +
            "          <name>managed</name>" +
            "          <value>false</value>" +
            "        </property>" +
            "      </properties>" +
            "    </service>" +
            "  </services>" +
            "</metainfo>";

    // When
    Map<String, ServiceInfo> serviceInfoMap = getServiceInfo(serviceInfoXml);
    ServiceInfo serviceInfo = serviceInfoMap.get("WITH_DUPLICATE_PROPS");

    // Then
    assertFalse("Service info should be in invalid state due to duplicate service property names !", serviceInfo.isValid());

    assertTrue("Service info error collection should contain the name of the duplicate service property !", serviceInfo.getErrors().contains("Duplicate service property with name 'PROP1' found in " + serviceInfo.getName() + ":" + serviceInfo.getVersion() + " service definition !"));

  }
Tests the presence and absence of the credential-store block.

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