aboutsummaryrefslogtreecommitdiffstats
path: root/container-messagebus/src/test/java/com/yahoo/container/jdisc/messagebus/MbusClientProviderTest.java
blob: 86ad759e2db314e5025288519a7f9213dd737660 (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
// Copyright 2016 Yahoo Inc. 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 lulf
 * @since 5.1
 */
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();
    }
}