aboutsummaryrefslogtreecommitdiffstats
path: root/container-messagebus/src/test/java/com/yahoo/container/jdisc/messagebus/MbusClientProviderTest.java
blob: 6335cf01d8c669270c7a709e538b9e08ff05c8bc (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
30
31
32
33
34
35
36
37
38
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.jdisc.messagebus;

import com.yahoo.container.jdisc.config.SessionConfig;
import com.yahoo.container.jdisc.messagebus.MbusClientProvider;
import com.yahoo.container.jdisc.messagebus.SessionCache;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;

/**
 * @author Ulf Lilleengen
 */
public class MbusClientProviderTest {

    @Test
    public void testIntermediateClient() {
        SessionConfig.Builder builder = new SessionConfig.Builder();
        builder.name("foo");
        builder.type(SessionConfig.Type.Enum.INTERMEDIATE);
        testClient(new SessionConfig(builder));
    }

    @Test
    public void testSourceClient() {
        SessionConfig.Builder builder = new SessionConfig.Builder();
        builder.name("foo");
        builder.type(SessionConfig.Type.Enum.SOURCE);
        testClient(new SessionConfig(builder));
    }

    private void testClient(SessionConfig config) {
        MbusClientProvider p = new MbusClientProvider(new SessionCache("dir:src/test/resources/config/clientprovider"), config);
        assertNotNull(p.get());
        p.deconstruct();
    }

}