@Test
public void testPutServiceIdentitySystemMeta() {

    final String domainName = "service-system-meta";
    final String serviceName = "service1";
    TopLevelDomain dom1 = createTopLevelDomainObject(domainName,
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    ServiceIdentity service = createServiceObject(domainName,
            serviceName, "http://localhost", "/usr/bin/java", "root",
            "users", "host1");
    zms.putServiceIdentity(mockDomRsrcCtx, domainName, serviceName, auditRef, service);
    ServiceIdentity serviceRes = zms.getServiceIdentity(mockDomRsrcCtx, domainName, serviceName);
    assertNotNull(serviceRes);
    assertEquals(serviceRes.getName(), domainName + "." + serviceName);
    assertEquals(serviceRes.getExecutable(), "/usr/bin/java");
    assertEquals(serviceRes.getGroup(), "users");
    assertEquals(serviceRes.getUser(), "root");
    // provider endpoint is a system meta attribute so we shouldn't saved it
    assertNull(serviceRes.getProviderEndpoint());
    // now let's set the meta attribute
    ServiceIdentitySystemMeta meta = new ServiceIdentitySystemMeta();
    zms.putServiceIdentitySystemMeta(mockDomRsrcCtx, domainName, serviceName, "providerendpoint", auditRef, meta);
    // we expect no changes
    serviceRes = zms.getServiceIdentity(mockDomRsrcCtx, domainName, serviceName);
    assertEquals(serviceRes.getName(), domainName + "." + serviceName);
    assertEquals(serviceRes.getExecutable(), "/usr/bin/java");
    assertEquals(serviceRes.getGroup(), "users");
    assertEquals(serviceRes.getUser(), "root");
    assertNull(serviceRes.getProviderEndpoint());
    // now let's change the endpoint
    meta.setProviderEndpoint("https://localhost");
    zms.putServiceIdentitySystemMeta(mockDomRsrcCtx, domainName, serviceName, "providerendpoint", auditRef, meta);
    serviceRes = zms.getServiceIdentity(mockDomRsrcCtx, domainName, serviceName);
    assertEquals(serviceRes.getName(), domainName + "." + serviceName);
    assertEquals(serviceRes.getExecutable(), "/usr/bin/java");
    assertEquals(serviceRes.getGroup(), "users");
    assertEquals(serviceRes.getUser(), "root");
    assertEquals(serviceRes.getProviderEndpoint(), "https://localhost");
    zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}