aboutsummaryrefslogtreecommitdiffstats
path: root/container-messagebus/src/test/java/com/yahoo/messagebus/jdisc/test/ServerTestDriverTestCase.java
blob: f6ae2335d1271a7cc46ae7ed7e7ad7f9ab14cde5 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.messagebus.jdisc.test;

import com.yahoo.jdisc.test.NonWorkingRequestHandler;
import com.yahoo.jrt.ListenFailedException;
import com.yahoo.jrt.slobrok.server.Slobrok;
import com.yahoo.messagebus.test.SimpleProtocol;
import org.junit.Test;

import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

/**
 * @author Simon Thoresen Hult
 */
public class ServerTestDriverTestCase {

    @Test
    public void requireThatFactoryMethodsWork() throws ListenFailedException {
        ServerTestDriver driver = ServerTestDriver.newInstance(new NonWorkingRequestHandler(), false);
        assertNotNull(driver);
        assertTrue(driver.close());

        driver = ServerTestDriver.newInstanceWithProtocol(new SimpleProtocol(), new NonWorkingRequestHandler(), false);
        assertNotNull(driver);
        assertTrue(driver.close());

        Slobrok slobrok = new Slobrok();
        driver = ServerTestDriver.newInstanceWithExternSlobrok(slobrok.configId(), new NonWorkingRequestHandler(), false);
        assertNotNull(driver);
        assertTrue(driver.close());
    }

}