DataStore implements DataCacheProvider, RolesProvider { public boolean processDomainUpdates() { StringBuilder lastModTimestamp = new StringBuilder(128); SignedDomains signedDomains = changeLogStore.getUpdatedSignedDomains(lastModTimestamp); if (signedDomains == null && lastModTimestamp.length() == 0) { return false; } boolean result = processSignedDomains(signedDomains); if (result) { changeLogStore.setLastModificationTimestamp(lastModTimestamp.toString()); } 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 testProcessDomainUpdatesFromZMSNoTagHeader() { MockZMSFileChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); clogStore.getClogStoreCommon().setTagHeader(null); DataStore store = new DataStore(clogStore, null); SignedDomain signedDomain = createSignedDomain("coretech", "weather"); List<SignedDomain> domains = new ArrayList<>(); domains.add(signedDomain); SignedDomains signedDomains = new SignedDomains(); signedDomains.setDomains(domains); ((MockZMSFileChangeLogStore) store.changeLogStore).setSignedDomains(signedDomains); boolean result = store.processDomainUpdates(); assertFalse(result); }
@Test public void testProcessDomainUpdatesFromZMSInvalidSignedDomain() { ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); DataStore store = new DataStore(clogStore, null); SignedDomain signedDomain = createSignedDomain("coretech", "weather"); signedDomain.setSignature("ABCD"); List<SignedDomain> domains = new ArrayList<>(); domains.add(signedDomain); SignedDomains signedDomains = new SignedDomains(); signedDomains.setDomains(domains); ((MockZMSFileChangeLogStore) store.changeLogStore).setSignedDomains(signedDomains); boolean result = store.processDomainUpdates(); assertFalse(result); }