Search in sources :

Example 1 with EzyUdpSetting

use of com.tvd12.ezyfoxserver.setting.EzyUdpSetting in project ezyfox-server by youngmonkeys.

the class EzyServerBootstrapTest method commonTest.

@Test
public void commonTest() {
    // given
    EzySimpleConfig config = new EzySimpleConfig();
    config.setPrintBanner(false);
    EzySimpleSettings settings = new EzySimpleSettings();
    EzySimpleServer server = new EzySimpleServer();
    server.setSettings(settings);
    server.setConfig(config);
    EzyServerContext serverContext = mock(EzyServerContext.class);
    when(serverContext.getServer()).thenReturn(server);
    EzyServerBootstrap sut = new EzyServerBootstrap() {

        @Override
        protected void startOtherBootstraps(Runnable callback) {
            callback.run();
        }
    };
    sut.setContext(serverContext);
    // when
    ReflectMethodUtil.invokeMethod("printBanner", sut);
    EzyUdpSetting udpSetting = (EzyUdpSetting) ReflectMethodUtil.invokeMethod("getUdpSetting", sut);
    EzyThreadPoolSizeSetting threadPoolSizeSetting = (EzyThreadPoolSizeSetting) ReflectMethodUtil.invokeMethod("getThreadPoolSizeSetting", sut);
    // then
    Asserts.assertEquals(server.getSettings().getUdp(), udpSetting);
    Asserts.assertEquals(server.getSettings().getThreadPoolSize(), threadPoolSizeSetting);
}
Also used : EzySimpleConfig(com.tvd12.ezyfoxserver.config.EzySimpleConfig) EzySimpleServer(com.tvd12.ezyfoxserver.EzySimpleServer) EzyThreadPoolSizeSetting(com.tvd12.ezyfoxserver.setting.EzyThreadPoolSizeSetting) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyUdpSetting(com.tvd12.ezyfoxserver.setting.EzyUdpSetting) EzyServerBootstrap(com.tvd12.ezyfoxserver.EzyServerBootstrap) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) Test(org.testng.annotations.Test)

Aggregations

EzyServerBootstrap (com.tvd12.ezyfoxserver.EzyServerBootstrap)1 EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)1 EzySimpleConfig (com.tvd12.ezyfoxserver.config.EzySimpleConfig)1 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)1 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)1 EzyThreadPoolSizeSetting (com.tvd12.ezyfoxserver.setting.EzyThreadPoolSizeSetting)1 EzyUdpSetting (com.tvd12.ezyfoxserver.setting.EzyUdpSetting)1 Test (org.testng.annotations.Test)1