use of ddf.catalog.cache.impl.CacheKey in project ddf by codice.
the class CacheKeyTest method testKeyUniquenessProperty.
/**
* Tests the key will be unique if given a different property in the ResourceRequest.
*/
@Test
public void testKeyUniquenessProperty() {
Map<String, Serializable> propertyMap = new HashMap<>();
propertyMap.put(ResourceRequest.OPTION_ARGUMENT, "pdf");
CacheKey cacheKey1 = new CacheKey(getMetacardStub("sampleId1", "source1"), getResourceRequestStub(propertyMap));
CacheKey cacheKey2 = new CacheKey(getMetacardStub("sampleId1", "source1"), getResourceRequestStub());
String key1 = cacheKey1.generateKey();
String key2 = cacheKey2.generateKey();
assertThat("Keys must be different.", key1, not(equalTo(key2)));
}
use of ddf.catalog.cache.impl.CacheKey in project ddf by codice.
the class CacheKeyTest method testKeyUniquenessFromSourcesAndIds.
@Test
public void testKeyUniquenessFromSourcesAndIds() {
CacheKey cacheKey1 = new CacheKey(getMetacardStub("sampleId1", "source1"), getResourceRequestStub());
CacheKey cacheKey2 = new CacheKey(getMetacardStub("sampleId2", "source2"), getResourceRequestStub());
String key1 = cacheKey1.generateKey();
String key2 = cacheKey2.generateKey();
assertThat("Keys must be different.", key1, not(equalTo(key2)));
}
use of ddf.catalog.cache.impl.CacheKey in project ddf by codice.
the class CacheKeyTest method testKeyUniquenessFromSourcesWithoutResourceRequest.
@Test
public void testKeyUniquenessFromSourcesWithoutResourceRequest() {
CacheKey cacheKey1 = new CacheKey(getMetacardStub("sampleId", "source1"));
CacheKey cacheKey2 = new CacheKey(getMetacardStub("sampleId", "source2"));
String key1 = cacheKey1.generateKey();
String key2 = cacheKey2.generateKey();
assertThat("Keys must be different.", key1, not(equalTo(key2)));
}
use of ddf.catalog.cache.impl.CacheKey in project ddf by codice.
the class CacheKeyTest method testKeyConsistencyWithoutResourceRequest.
@Test
public void testKeyConsistencyWithoutResourceRequest() {
CacheKey cacheKey1 = new CacheKey(getMetacardStub("sampleId1", "source1"));
CacheKey cacheKey2 = new CacheKey(getMetacardStub("sampleId1", "source1"));
String key1 = cacheKey1.generateKey();
String key2 = cacheKey2.generateKey();
assertThat("The same input to cache key should generate the same output.", key1, equalTo(key2));
}
use of ddf.catalog.cache.impl.CacheKey in project ddf by codice.
the class CacheKeyTest method testKeyConsistency.
@Test
public void testKeyConsistency() {
Map<String, Serializable> propertyMap = new HashMap<>();
propertyMap.put("pdf", "sample.pdf");
CacheKey cacheKey1 = new CacheKey(getMetacardStub("sampleId1", "source1"), getResourceRequestStub(propertyMap));
CacheKey cacheKey2 = new CacheKey(getMetacardStub("sampleId1", "source1"), getResourceRequestStub(propertyMap));
String key1 = cacheKey1.generateKey();
String key2 = cacheKey2.generateKey();
assertThat("The same input to cache key should generate the same output.", key1, equalTo(key2));
}
Aggregations