TransformationCacheKey implements ContentCacheKey { @Override public String getKey() { return PREFIX + '_' + preparationId + "_" + datasetId + "_" + DigestUtils.sha1Hex(stepId + format + Objects.hash(parameters) + sourceType + userId + filter); } TransformationCacheKey(final String preparationId, final String datasetId, final String format, final String stepId,
            final String parameters, final ExportParameters.SourceType sourceType, final String userId,
            final String filter); @Override String toString(); @Override String getKey(); @Override String getPrefix(); @Override Predicate<String> getMatcher();  }
@Test public void shouldGenerateKey() throws Exception { final TransformationCacheKey key = createTestDefaultKey(); assertNotNull(key.getKey()); }
@Test public void shouldGenerateSameKey() throws Exception { final TransformationCacheKey key1 = createTestDefaultKey(); final TransformationCacheKey key2 = createTestDefaultKey(); assertEquals(key1.getKey(), key2.getKey()); }
@Test public void getKey_should_generate_serialized_key() throws Exception { final ContentCacheKey key = new TransformationCacheKey("prep1", "dataset1", "JSON", "step1", "param1", HEAD, "user1", ""); final String keyStr = key.getKey(); assertThat(keyStr, is("transformation_prep1_dataset1_b6aa01425c31e1eed71d0c3cbc7763aad865d1b1")); }