@Test
public void testExecutePutRoleSystemMeta() {

    List<String> admins = new ArrayList<>();
    admins.add(adminUser);
    zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject("MetaDom1", "test desc", "testOrg", false,
            "", 1234, "", 0), admins, null, auditRef);
    Role role = createRoleObject("MetaDom1", "MetaRole1", null, "user.john", "user.jane");
    zms.dbService.executePutRole(mockDomRsrcCtx, "MetaDom1", "MetaRole1", role, "test", "putrole");
    RoleSystemMeta rsm = new RoleSystemMeta();
    rsm.setAuditEnabled(true);
    try {
        zms.dbService.executePutRoleSystemMeta(mockDomRsrcCtx, "MetaDom1", "MetaRole1",
                rsm,"auditenabled", auditRef, "putrolesystemmeta");
        fail();
    } catch (ResourceException ex) {
        assertEquals(ex.getCode(), 400);
    }
    zms.dbService.executeDeleteDomain(mockDomRsrcCtx, "MetaDom1", auditRef, "deletedomain");
    Domain dom2 = new Domain()
            .setName("MetaDom2")
            .setAuditEnabled(true)
            .setYpmId(1234)
            .setCertDnsDomain("athenz.cloud");
    zms.dbService.makeDomain(mockDomRsrcCtx, ZMSTestUtils.makeDomainObject("MetaDom2", "test desc", "testOrg", true,
            "", 1234, "", 0), admins, null, auditRef);
    DomainMeta meta2 = new DomainMeta()
            .setAccount("acct")
            .setYpmId(1234)
            .setCertDnsDomain("athenz.cloud");
    zms.dbService.updateSystemMetaFields(dom2, "auditenabled", false, meta2);
    Role role2 = createRoleObject("MetaDom2", "MetaRole2", null, "user.john", "user.jane");
    zms.dbService.executePutRole(mockDomRsrcCtx, "MetaDom2", "MetaRole2",role2, "test", "putrole");
    RoleSystemMeta rsm2 = new RoleSystemMeta();
    rsm2.setAuditEnabled(true);
    zms.dbService.executePutRoleSystemMeta(mockDomRsrcCtx, "MetaDom2", "MetaRole2",
            rsm2,"auditenabled", auditRef, "putrolesystemmeta");
    Role resRole2 = zms.dbService.getRole("MetaDom2", "MetaRole2", false, true, false);
    assertTrue(resRole2.getAuditEnabled());
    zms.dbService.executeDeleteDomain(mockDomRsrcCtx, "MetaDom2", auditRef, "deletedomain");
}