Package com.datasift.client.mock

Source Code of com.datasift.client.mock.MockServer

package com.datasift.client.mock;

import com.datasift.client.mock.datasift.MockCoreApi;
import io.higgs.core.HiggsServer;
import io.higgs.http.server.config.HttpConfig;
import io.higgs.http.server.protocol.HttpProtocolConfiguration;

import java.net.URL;

import static org.junit.Assert.assertNotNull;

public class MockServer {
    private MockServer() {
    }

    public static HiggsServer startNewServer() {
        HttpProtocolConfiguration http = new HttpProtocolConfiguration();
        URL cfg = MockServer.class.getClassLoader().getResource("config.yml");
        assertNotNull(cfg);
        HiggsServer server = new HiggsServer().setConfig(cfg.getPath(), HttpConfig.class);
        server.registerProtocol(http);
        //
        server.registerPackage(MockCoreApi.class.getPackage());
        server.start();
        return server;
    }
}
TOP

Related Classes of com.datasift.client.mock.MockServer

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.