@Test
public void testExecutePutPublicKeyEntry() {

    
    String domainName = "servicepubpubkeydom1";
    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);
    PublicKeyEntry keyEntry = new PublicKeyEntry();
    keyEntry.setId("zone1");
    keyEntry.setKey(pubKeyK2);
    
    zms.dbService.executePutPublicKeyEntry(mockDomRsrcCtx, domainName, serviceName,
            keyEntry, auditRef, "putPublicKeyEntry");
    
    ServiceIdentity serviceRes = zms.getServiceIdentity(mockDomRsrcCtx, domainName, serviceName);
    List<PublicKeyEntry> keyList = serviceRes.getPublicKeys();
    boolean foundKey1 = false;
    boolean foundKey2 = false;
    boolean foundKeyZONE1 = false;
    for (PublicKeyEntry entry : keyList) {
        switch (entry.getId()) {
            case "1":
                foundKey1 = true;
                break;
            case "2":
                foundKey2 = true;
                break;
            case "zone1":
                foundKeyZONE1 = true;
                break;
        }
    }
    assertTrue(foundKey1);
    assertTrue(foundKey2);
    assertTrue(foundKeyZONE1);
    
    PublicKeyEntry entry = zms.getPublicKeyEntry(mockDomRsrcCtx, domainName, serviceName, "zone1");
    assertNotNull(entry);
    assertEquals(entry.getId(), "zone1");
    assertEquals(entry.getKey(), pubKeyK2);
    
    zms.deleteTopLevelDomain(mockDomRsrcCtx, domainName, auditRef);
}