ZMSFileChangeLogStoreCommon { public String retrieveTagHeader(Map<String, List<String>> responseHeaders) { List<String> tagData = responseHeaders.get(ATTR_TAG); if (tagData == null || tagData.isEmpty()) { LOGGER.error("Response headers from ZMS does not include 'ETag/tag' value"); return null; } return tagData.get(0); } ZMSFileChangeLogStoreCommon(final String rootDirectory); boolean supportsFullRefresh(); SignedDomain getLocalSignedDomain(final String domainName); SignedDomain getServerSignedDomain(ZMSClient zmsClient, final String domainName); void removeLocalDomain(String domainName); void saveLocalDomain(String domainName, SignedDomain signedDomain); synchronized T get(String name, Class<T> classType); synchronized void put(String name, byte[] data); synchronized void delete(String name); List<String> getLocalDomainList(); Set<String> getServerDomainList(ZMSClient zmsClient); SignedDomains getServerDomainModifiedList(ZMSClient zmsClient); String retrieveLastModificationTime(); void setLastModificationTimestamp(String newLastModTime); String retrieveTagHeader(Map<String, List<String>> responseHeaders); SignedDomains getUpdatedSignedDomains(ZMSClient zmsClient, StringBuilder lastModTimeBuffer); public String lastModTime; }
@Test public void testRetrieveTagHeader() { ZMSFileChangeLogStoreCommon fstore = new ZMSFileChangeLogStoreCommon(FSTORE_PATH); Map<String, List<String>> responseHeaders = new HashMap<>(); assertNull(fstore.retrieveTagHeader(responseHeaders)); responseHeaders.put("Content-Type", Collections.singletonList("application/json")); responseHeaders.put("Content-Length", Collections.singletonList("10000")); assertNull(fstore.retrieveTagHeader(responseHeaders)); responseHeaders.put("tag", Arrays.asList("tag1", "tag2")); assertEquals(fstore.retrieveTagHeader(responseHeaders), "tag1"); }