DataStore implements DataCacheProvider, RolesProvider { void processDomainServiceIdentities(DomainData domainData, DataCache domainCache) { List<com.yahoo.athenz.zms.ServiceIdentity> services = domainData.getServices(); if (services == null) { return; } for (com.yahoo.athenz.zms.ServiceIdentity service : services) { domainCache.processServiceIdentity(service); } } 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 testProcessDomainServiceIdentities() { ChangeLogStore clogStore = new MockZMSFileChangeLogStore("/tmp/zts_server_unit_tests/zts_root", pkey, "0"); DataStore store = new DataStore(clogStore, null); ServiceIdentity service = new ServiceIdentity(); service.setName("coretech.storage"); List<String> hosts = new ArrayList<>(); hosts.add("host1"); service.setHosts(hosts); List<ServiceIdentity> services = new ArrayList<>(); services.add(service); DomainData domainData = new DomainData(); domainData.setName("coretech"); domainData.setServices(services); DataCache dataCache = new DataCache(); dataCache.setDomainData(domainData); store.processDomainServiceIdentities(domainData, dataCache); store.addDomainToCache(domainData.getName(), dataCache); HostServices hostServices = store.getHostServices("host1"); hosts = hostServices.getNames(); assertEquals(hosts.size(), 1); assertTrue(hosts.contains("coretech.storage")); }