@Test
public void testGetServiceIdentities() {

    
    final String domainName = "get-services";
    TopLevelDomain dom1 = createTopLevelDomainObject(domainName,
            "Test Domain1", "testOrg", adminUser);
    zms.postTopLevelDomain(mockDomRsrcCtx, auditRef, dom1);
    ServiceIdentity service1 = createServiceObject(domainName,
            "service1", "http://localhost", "/usr/bin/java", "root",
            "users", "host1");
    zms.putServiceIdentity(mockDomRsrcCtx, domainName, "service1", auditRef, service1);
    ServiceIdentity service2 = createServiceObject(domainName,
            "service2", "http://localhost", "/usr/bin/java", "yahoo",
            "users", "host2");
    zms.putServiceIdentity(mockDomRsrcCtx, domainName, "service2", auditRef, service2);
    
    ServiceIdentities serviceList = zms.getServiceIdentities(mockDomRsrcCtx, domainName,
            Boolean.TRUE, Boolean.TRUE);
    List<ServiceIdentity> services = serviceList.getList();
    assertEquals(2, services.size());
    
    boolean service1Check = false;
    boolean service2Check = false;
    
    for (ServiceIdentity service : services) {
        switch (service.getName()) {
            case "get-services.service1":
                assertEquals(service.getExecutable(), "/usr/bin/java");
                assertEquals(service.getUser(), "root");
                assertEquals(service.getPublicKeys().size(), 2);
                assertEquals(service.getHosts().size(), 1);
                assertEquals(service.getHosts().get(0), "host1");
                service1Check = true;
                break;
            case "get-services.service2":
                assertEquals(service.getExecutable(), "/usr/bin/java");
                assertEquals(service.getUser(), "yahoo");
                assertEquals(service.getPublicKeys().size(), 2);
                assertEquals(service.getHosts().size(), 1);
                assertEquals(service.getHosts().get(0), "host2");
                service2Check = true;
                break;
        }
    }
    
    assertTrue(service1Check);
    assertTrue(service2Check);
    
    zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}