@Test
public void testExecutePutRoleMeta() {

    final String domainName = "metadom1";
    final String roleName = "metarole1";
    List<String> admins = new ArrayList<>();
    admins.add(adminUser);
    zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject(domainName, "test desc",
            "testOrg", false, "", 1234, "", 0), admins, null, auditRef);
    Role role = createRoleObject(domainName, roleName, null, "user.john", "user.jane");
    zms.dbService.executePutRole(mockDomRsrcCtx, domainName, roleName, role, "test", "putrole");
    RoleMeta rm = new RoleMeta();
    rm.setSelfServe(true);
    Role originalRole = zms.dbService.getRole(domainName, roleName, false, false, false);
    zms.dbService.executePutRoleMeta(mockDomRsrcCtx, domainName, roleName, originalRole,
            rm, auditRef, "putrolemeta");
    Role resRole1 = zms.dbService.getRole(domainName, roleName, false, true, false);
    assertTrue(resRole1.getSelfServe());
    rm = new RoleMeta();
    rm.setSelfServe(true);
    rm.setMemberExpiryDays(10);
    rm.setServiceExpiryDays(15);
    rm.setGroupExpiryDays(25);
    rm.setTokenExpiryMins(20);
    rm.setReviewEnabled(true);
    rm.setNotifyRoles("role1,role2");
    rm.setMemberReviewDays(30);
    rm.setServiceReviewDays(35);
    rm.setUserAuthorityFilter("employee");
    rm.setUserAuthorityExpiration("elevated-clearance");
    originalRole = zms.dbService.getRole(domainName, roleName, false, false, false);
    zms.dbService.executePutRoleMeta(mockDomRsrcCtx, domainName, roleName, originalRole,
            rm, auditRef, "putrolemeta");
    resRole1 = zms.dbService.getRole(domainName, roleName, false, true, false);
    assertTrue(resRole1.getSelfServe());
    assertNull(resRole1.getCertExpiryMins());
    assertEquals(resRole1.getMemberExpiryDays(), Integer.valueOf(10));
    assertEquals(resRole1.getServiceExpiryDays(), Integer.valueOf(15));
    assertEquals(resRole1.getGroupExpiryDays(), Integer.valueOf(25));
    assertEquals(resRole1.getTokenExpiryMins(), Integer.valueOf(20));
    assertTrue(resRole1.getReviewEnabled());
    assertEquals(resRole1.getNotifyRoles(), "role1,role2");
    assertEquals(resRole1.getMemberReviewDays(), Integer.valueOf(30));
    assertEquals(resRole1.getServiceReviewDays(), Integer.valueOf(35));
    assertEquals(resRole1.getUserAuthorityFilter(), "employee");
    assertEquals(resRole1.getUserAuthorityExpiration(), "elevated-clearance");
    rm = new RoleMeta();
    rm.setSelfServe(false);
    rm.setCertExpiryMins(10);
    rm.setTokenExpiryMins(25);
    rm.setServiceExpiryDays(15);
    rm.setGroupExpiryDays(20);
    rm.setSignAlgorithm("rsa");
    rm.setReviewEnabled(false);
    rm.setServiceReviewDays(35);
    rm.setUserAuthorityFilter("contractor");
    originalRole = zms.dbService.getRole(domainName, roleName, false, false, false);
    zms.dbService.executePutRoleMeta(mockDomRsrcCtx, domainName, roleName, originalRole,
            rm, auditRef, "putrolemeta");
    resRole1 = zms.dbService.getRole(domainName, roleName, false, true, false);
    assertNull(resRole1.getSelfServe());
    assertEquals(resRole1.getCertExpiryMins(), Integer.valueOf(10));
    assertEquals(resRole1.getMemberExpiryDays(), Integer.valueOf(10));
    assertEquals(resRole1.getServiceExpiryDays(), Integer.valueOf(15));
    assertEquals(resRole1.getGroupExpiryDays(), Integer.valueOf(20));
    assertEquals(resRole1.getTokenExpiryMins(), Integer.valueOf(25));
    assertEquals(resRole1.getMemberReviewDays(), Integer.valueOf(30));
    assertEquals(resRole1.getServiceReviewDays(), Integer.valueOf(35));
    assertEquals(resRole1.getSignAlgorithm(), "rsa");
    assertNull(resRole1.getReviewEnabled());
    assertEquals(resRole1.getNotifyRoles(), "role1,role2");
    assertEquals(resRole1.getUserAuthorityFilter(), "contractor");
    assertEquals(resRole1.getUserAuthorityExpiration(), "elevated-clearance");
    zms.dbService.executeDeleteDomain(mockDomRsrcCtx, domainName, auditRef, "deletedomain");
}