DataStore implements DataCacheProvider, RolesProvider { boolean processLocalDomain(String domainName) { boolean result = false; try { result = processDomain(changeLogStore.getLocalSignedDomain(domainName), false); } catch (Exception ex) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Unable to process local domain {}:{}", domainName, ex.getMessage()); } } if (!result) { LOGGER.error("Invalid local domain: {}. Refresh from ZMS required.", domainName); } return result; } DataStore(ChangeLogStore clogStore, CloudStore cloudStore); JWKList getZtsJWKList(Boolean rfc); void init(); boolean processDomain(SignedDomain signedDomain, boolean saveInStore); boolean processDomainDeletes(); void processDomainChecks(); boolean processDomainUpdates(); DomainData getDomainData(String name); void addDomainToCache(String name, DataCache dataCache); @Override DataCache getDataCache(String domainName); List<GroupMember> getGroupMembers(final String groupName); void getAccessibleRoles(DataCache data, String domainName, String identity,
            String[] requestedRoleList, Set<String> accessibleRoles, boolean keepFullName); String getPublicKey(String domain, String service, String keyId); HostServices getHostServices(String host); CloudStore getCloudStore(); void setCloudStore(CloudStore cloudStore); Cache<String, DataCache> getCacheStore(); Map<String, String> getPublicKeyCache(); @Override List<Role> getRolesByDomain(String domain);  }
@Test public void testProcessLocalDomain() { ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); DataStore store = new DataStore(clogStore, null); store.loadAthenzPublicKeys(); SignedDomain signedDomain = createSignedDomain("coretech", "weather"); store.processDomain(signedDomain, true); store = new DataStore(clogStore, null); boolean result = store.processLocalDomain("coretech"); assertTrue(result); assertNotNull(store.getDomainData("coretech")); }
@Test public void testProcessLocalDomainInvalidFile() { ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); DataStore store = new DataStore(clogStore, null); boolean result = store.processLocalDomain("coretech"); assertFalse(result); }