summaryrefslogtreecommitdiffstats
path: root/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/MemoryCacheConfigClientTest.java
blob: b59d8710f366b6ec886038fd5f6ec9488f5fe419 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// 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 org.junit.Test;

import java.util.Collections;

import static junit.framework.TestCase.assertNull;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;

/**
 * @author <a href="mailto:musum@yahoo-inc.com">Harald Musum</a>
 * @since 5.1.9
 */
public class MemoryCacheConfigClientTest {

    @Test
    public void basic() {
        MemoryCache cache = new MemoryCache();
        cache.put(Helper.fooConfig);
        MemoryCacheConfigClient client = new MemoryCacheConfigClient(cache);
        assertThat(client.getConfig(Helper.fooConfig, null), is(Helper.fooConfig));
        assertNull(client.getConfig(Helper.barConfig, null));

        assertThat(client.getActiveSourceConnection(), is("N/A"));
        assertThat(client.getSourceConnections(), is(Collections.singletonList("N/A")));
    }
}