@Test
  public void testSingleSignOnSupport() throws JAXBException {
    // Implicit SSO setting
    String serviceInfoXml =
        "<metainfo>" +
            "  <schemaVersion>2.0</schemaVersion>" +
            "  <services>" +
            "    <service>" +
            "      <name>SERVICE</name>" +
            "    </service>" +
            "  </services>" +
            "</metainfo>";
    Map<String, ServiceInfo> serviceInfoMap = getServiceInfo(serviceInfoXml);
    assertFalse(serviceInfoMap.get("SERVICE").isSingleSignOnSupported());
    assertTrue(serviceInfoMap.get("SERVICE").isValid());

    SingleSignOnInfo singleSignOnInfo = serviceInfoMap.get("SERVICE").getSingleSignOnInfo();
    assertNull(singleSignOnInfo);

    // Explicit SSO setting (true)
    serviceInfoXml =
        "<metainfo>" +
            "  <schemaVersion>2.0</schemaVersion>" +
            "  <services>" +
            "    <service>" +
            "      <name>SERVICE</name>" +
            "      <sso>" +
            "        <supported>true</supported>" +
            "        <enabledConfiguration>config-type/property_name</enabledConfiguration>" +
            "        <kerberosRequired>true</kerberosRequired> " +
            "      </sso>" +
            "    </service>" +
            "  </services>" +
            "</metainfo>";
    serviceInfoMap = getServiceInfo(serviceInfoXml);
    assertTrue(serviceInfoMap.get("SERVICE").isSingleSignOnSupported());
    assertTrue(serviceInfoMap.get("SERVICE").isValid());

    singleSignOnInfo = serviceInfoMap.get("SERVICE").getSingleSignOnInfo();
    assertNotNull(singleSignOnInfo);
    assertTrue(singleSignOnInfo.isSupported());
    assertEquals(Boolean.TRUE, singleSignOnInfo.getSupported());
    assertEquals("config-type/property_name", singleSignOnInfo.getEnabledConfiguration());
    assertTrue(singleSignOnInfo.isKerberosRequired());

    // Explicit SSO setting (false)
    serviceInfoXml =
        "<metainfo>" +
            "  <schemaVersion>2.0</schemaVersion>" +
            "  <services>" +
            "    <service>" +
            "      <name>SERVICE</name>" +
            "      <sso>" +
            "        <supported>false</supported>" +
            "      </sso>" +
            "    </service>" +
            "  </services>" +
            "</metainfo>";
    serviceInfoMap = getServiceInfo(serviceInfoXml);
    assertFalse(serviceInfoMap.get("SERVICE").isSingleSignOnSupported());
    assertTrue(serviceInfoMap.get("SERVICE").isValid());

    singleSignOnInfo = serviceInfoMap.get("SERVICE").getSingleSignOnInfo();
    assertNotNull(singleSignOnInfo);
    assertFalse(singleSignOnInfo.isSupported());
    assertEquals(Boolean.FALSE, singleSignOnInfo.getSupported());
    assertNull(singleSignOnInfo.getEnabledConfiguration());

    // Explicit SSO setting (invalid)
    serviceInfoXml =
        "<metainfo>" +
            "  <schemaVersion>2.0</schemaVersion>" +
            "  <services>" +
            "    <service>" +
            "      <name>SERVICE</name>" +
            "      <sso>" +
            "        <supported>true</supported>" +
            "      </sso>" +
            "    </service>" +
            "  </services>" +
            "</metainfo>";
    serviceInfoMap = getServiceInfo(serviceInfoXml);
    assertTrue(serviceInfoMap.get("SERVICE").isSingleSignOnSupported());
    assertFalse(serviceInfoMap.get("SERVICE").isValid());
    assertEquals(1, serviceInfoMap.get("SERVICE").getErrors().size());

    singleSignOnInfo = serviceInfoMap.get("SERVICE").getSingleSignOnInfo();
    assertNotNull(singleSignOnInfo);
    assertTrue(singleSignOnInfo.isSupported());
    assertEquals(Boolean.TRUE, singleSignOnInfo.getSupported());
    assertNull(singleSignOnInfo.getEnabledConfiguration());
    assertNull(singleSignOnInfo.getSsoEnabledTest());
  }
Tests the presence and absence of the credential-store block.

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