diff options
author | Harald Musum <musum@yahoo-inc.com> | 2017-02-14 22:17:35 +0100 |
---|---|---|
committer | Harald Musum <musum@yahoo-inc.com> | 2017-02-14 22:17:35 +0100 |
commit | 58474e77ccd2a0f495a69c77cabe41e40d94bcfa (patch) | |
tree | 58e3aca49204f9e1559506bd40b25f4dfbab93aa /config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java | |
parent | 7c6ae7d45e6c53c70b9033973061ddebf95e8a98 (diff) |
Refactoring
* Remove traces of diskcache mode and simplify startup now that
only default mode is supported when starting config proxy
* Remove CacheManager now that we have only one type of cache
* Rename some classes
Diffstat (limited to 'config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java')
-rw-r--r-- | config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java index 9ab96cc3535..2da0f629b6f 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheTest.java @@ -1,9 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.config.proxy; +import com.yahoo.slime.Slime; +import com.yahoo.vespa.config.ConfigCacheKey; +import com.yahoo.vespa.config.ConfigKey; +import com.yahoo.vespa.config.ConfigPayload; import com.yahoo.vespa.config.RawConfig; +import com.yahoo.vespa.config.protocol.Payload; +import org.junit.Before; import org.junit.Test; +import java.util.ArrayList; +import java.util.Optional; + import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.*; @@ -11,7 +20,57 @@ import static org.junit.Assert.*; * @author hmusum * @since 5.1.9 */ -public class MemoryCacheTest extends CacheTest { +public class MemoryCacheTest { + private String defName = "foo"; + private String configId = "id"; + private String namespace = "bar"; + private static final String defMd5 = "a"; + + private long generation = 1L; + private String defName2 = "baz-quux"; + private String namespace2 = "search.config"; + // Test with a config id with / in it + private String configId2 = "clients/gateways/gateway/component/com.yahoo.feedhandler.VespaFeedHandlerRemoveLocation"; + private static final String defMd52 = "a2"; + private static final String differentDefMd5 = "09ef"; + private static final String configMd5 = "b"; + private ConfigKey<?> configKey = new ConfigKey<>(defName, configId, namespace); + private ConfigKey<?> configKey2 = new ConfigKey<>(defName2, configId2, namespace2); + private ConfigCacheKey cacheKey; + private ConfigCacheKey cacheKeyDifferentMd5; + private ConfigCacheKey cacheKey2; + private RawConfig config; + private RawConfig config2; + private RawConfig configDifferentMd5; + private Payload payload; + private Payload payload2; + private Payload payloadDifferentMd5; + + @Before + public void setup() { + ArrayList<String> defContent = new ArrayList<>(); + defContent.add("bar string"); + + Slime slime = new Slime(); + slime.setString("bar \"value\""); + payload = Payload.from(new ConfigPayload(slime)); + + slime = new Slime(); + slime.setString("bar \"baz\""); + payload2 = Payload.from(new ConfigPayload(slime)); + + slime = new Slime(); + slime.setString("bar \"value2\""); + payloadDifferentMd5 = Payload.from(new ConfigPayload(slime)); + + config = new RawConfig(configKey, defMd5, payload, configMd5, generation, defContent, Optional.empty()); + config2 = new RawConfig(configKey2, defMd52, payload2, configMd5, generation, defContent, Optional.empty()); + configDifferentMd5 = new RawConfig(configKey, differentDefMd5, payloadDifferentMd5, configMd5, generation, defContent, Optional.empty()); + + cacheKey = new ConfigCacheKey(configKey, config.getDefMd5()); + cacheKey2 = new ConfigCacheKey(configKey2, config2.getDefMd5()); + cacheKeyDifferentMd5 = new ConfigCacheKey(configKey, differentDefMd5); + } @Test public void basic() { |