@Test
  public void testDuplicateServicePropertyValidationAfterSet() {
    // Given
    ServicePropertyInfo p1 = new ServicePropertyInfo();
    p1.setName("PROP1");
    p1.setValue("V1");

    ServicePropertyInfo p2 = new ServicePropertyInfo();
    p2.setName("PROP1");
    p2.setValue("V2");

    List<ServicePropertyInfo> servicePropertyList = Lists.newArrayList(p1, p2);

    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setName("TEST_NAME");
    serviceInfo.setVersion("TEST_VERSION");
    serviceInfo.setServicePropertyList(servicePropertyList);

    // 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