@Test
public void testProcessTrustedDomainRoleValidWildCard() {

    
    ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root",
            pkey, "0");
    DataStore store = new DataStore(clogStore, null);
    DataCache dataCache = createDataCacheWildCard("coretech");
    
    // first we're going tor process user1
    // which should match all three roles including
    // both wildcard roles
    
    Set<String> accessibleRoles = new HashSet<>();
    String prefix = "coretech" + ROLE_POSTFIX;
    String identity = "user_domain.user1";
    
    Set<String> trustedResources = new HashSet<>();
    trustedResources.add("coretech:role.admin");
    trustedResources.add("coretech:role.readers");
    trustedResources.add("coretech:role.editors");
    
    store.processTrustedDomain(dataCache, identity, prefix, null,
            trustedResources, accessibleRoles, false);
    assertEquals(accessibleRoles.size(), 3);
    assertTrue(accessibleRoles.contains("admin"));
    assertTrue(accessibleRoles.contains("editors"));
    assertTrue(accessibleRoles.contains("readers"));
    
    // user_domain.joe should match readers and editors
    
    accessibleRoles.clear();
    identity = "user_domain.joe";
    
    store.processTrustedDomain(dataCache, identity, prefix, null,
            trustedResources, accessibleRoles, false);
    assertEquals(accessibleRoles.size(), 2);
    assertTrue(accessibleRoles.contains("readers"));
    assertTrue(accessibleRoles.contains("editors"));
    
    // random service should only match editors
    
    accessibleRoles.clear();
    identity = "athenz.service";
    
    store.processTrustedDomain(dataCache, identity, prefix, null,
            trustedResources, accessibleRoles, false);
    assertEquals(accessibleRoles.size(), 1);
    assertTrue(accessibleRoles.contains("editors"));
}