DataStore implements DataCacheProvider, RolesProvider { public void init() { List<String> localDomainList = changeLogStore.getLocalDomainList(); int badDomains = processLocalDomains(localDomainList); if (badDomains == -1) { changeLogStore.setLastModificationTimestamp(null); for (String domainName : localDomainList) { deleteDomain(domainName); } } if (!processDomainUpdates()) { throw new ResourceException(ResourceException.INTERNAL_SERVER_ERROR, "Unable to initialize storage subsystem"); } if (badDomains > 0) { processDomainChecks(); } ScheduledExecutorService scheduledThreadPool = Executors.newScheduledThreadPool(1); scheduledThreadPool.scheduleAtFixedRate(new DataUpdater(), updDomainRefreshTime, updDomainRefreshTime, TimeUnit.SECONDS); } 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 testStoreInitNoLastModTimeDomainUpdateFailure() { MockZMSFileChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); clogStore.getClogStoreCommon().setTagHeader(null); DataStore store = new DataStore(clogStore, null); addDomainToDataStore(store, "coretech"); ((MockZMSFileChangeLogStore) store.changeLogStore).setDomainList(null); try { store.init(); fail(); } catch (ResourceException ex) { assertEquals(500, ex.getCode()); } }