ZMSFileMTLSChangeLogStore implements ChangeLogStore { @Override public SignedDomains getUpdatedSignedDomains(StringBuilder lastModTimeBuffer) { try { return changeLogStoreCommon.getUpdatedSignedDomains(zmsClient, lastModTimeBuffer); } catch (ZMSClientException ex) { LOGGER.error("Error when refreshing data from ZMS: {}", ex.getMessage()); return null; } } ZMSFileMTLSChangeLogStore(String rootDirectory, final String keyPath, final String certPath,
                                     final String trustStorePath, final String trustStorePassword); @Override boolean supportsFullRefresh(); @Override SignedDomain getLocalSignedDomain(String domainName); @Override SignedDomain getServerSignedDomain(String domainName); @Override void removeLocalDomain(String domainName); @Override void saveLocalDomain(String domainName, SignedDomain signedDomain); @Override List<String> getLocalDomainList(); @Override Set<String> getServerDomainList(); @Override SignedDomains getServerDomainModifiedList(); @Override void setLastModificationTimestamp(String newLastModTime); @Override SignedDomains getUpdatedSignedDomains(StringBuilder lastModTimeBuffer);  }
@Test public void testGetUpdatedSignedDomainsNull() throws InterruptedException, IOException, KeyRefresherException { MockZMSFileMTLSChangeLogStore store = new MockZMSFileMTLSChangeLogStore(FSTORE_PATH, keyPath, certPath, trustStorePath, trustStorePassword); store.setSignedDomainsExc(); StringBuilder str = new StringBuilder(); assertNull(store.getUpdatedSignedDomains(str)); }
@Test public void testGetUpdatedSignedDomainsNullDomains() throws InterruptedException, IOException, KeyRefresherException { MockZMSFileMTLSChangeLogStore store = new MockZMSFileMTLSChangeLogStore(FSTORE_PATH, keyPath, certPath, trustStorePath, trustStorePassword); SignedDomains domains = new SignedDomains(); store.setSignedDomains(domains); StringBuilder str = new StringBuilder(); assertNull(store.getUpdatedSignedDomains(str)); }
@Test public void testGetUpdatedSignedDomains() throws InterruptedException, IOException, KeyRefresherException { MockZMSFileMTLSChangeLogStore store = new MockZMSFileMTLSChangeLogStore(FSTORE_PATH, keyPath, certPath, trustStorePath, trustStorePassword); MockZMSFileChangeLogStoreCommon cstore = new MockZMSFileChangeLogStoreCommon(FSTORE_PATH); store.setChangeLogStoreCommon(cstore); List<SignedDomain> domains = new ArrayList<>(); DomainData domData = new DomainData().setName("athenz"); SignedDomain domain = new SignedDomain().setDomain(domData); domains.add(domain); SignedDomains signedDomains = new SignedDomains().setDomains(domains); store.setSignedDomains(signedDomains); StringBuilder str = new StringBuilder(); assertNull(store.getUpdatedSignedDomains(str)); cstore.setTagHeader(Timestamp.fromCurrentTime().toString()); SignedDomains retDoamins = store.getUpdatedSignedDomains(str); assertNotNull(retDoamins); assertEquals(retDoamins.getDomains().size(), 1); assertEquals(retDoamins.getDomains().get(0).getDomain().getName(), "athenz"); store.setSignedDomains(null); str.setLength(0); assertNull(store.getUpdatedSignedDomains(str)); }