Search in sources :

Example 1 with EzyAppSettingBuilder

use of com.tvd12.ezyfoxserver.setting.EzyAppSettingBuilder in project ezyfox-server-example by tvd12.

the class PushMessageServerStartup method main.

public static void main(String[] args) throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name(PLUGIN_NAME).addListenEvent(EzyEventType.USER_LOGIN).entryLoader(PluginEntryLoader.class);
    EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder().name(APP_NAME).entryLoader(AppEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name(ZONE_NAME).application(appSettingBuilder.build()).plugin(pluginSettingBuilder.build());
    EzySimpleSettings settings = new EzySettingsBuilder().zone(zoneSettingBuilder.build()).build();
    EzyEmbeddedServer server = EzyEmbeddedServer.builder().settings(settings).build();
    server.start();
}
Also used : EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer)

Example 2 with EzyAppSettingBuilder

use of com.tvd12.ezyfoxserver.setting.EzyAppSettingBuilder in project ezyfox-server-example by tvd12.

the class SimpleChatStartup method main.

public static void main(String[] args) throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name("simple-chat").addListenEvent(EzyEventType.USER_LOGIN).entryLoader(DecoratedPluginEntryLoader.class);
    EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder().name("simple-chat").entryLoader(DecoratedAppEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name("example").application(appSettingBuilder.build()).plugin(pluginSettingBuilder.build());
    EzySimpleSettings settings = new EzySettingsBuilder().zone(zoneSettingBuilder.build()).build();
    EzyEmbeddedServer server = EzyEmbeddedServer.builder().settings(settings).build();
    server.start();
}
Also used : EzyPluginSettingBuilder(com.tvd12.ezyfoxserver.setting.EzyPluginSettingBuilder) EzyZoneSettingBuilder(com.tvd12.ezyfoxserver.setting.EzyZoneSettingBuilder) EzyAppSettingBuilder(com.tvd12.ezyfoxserver.setting.EzyAppSettingBuilder) EzySettingsBuilder(com.tvd12.ezyfoxserver.setting.EzySettingsBuilder) EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings)

Example 3 with EzyAppSettingBuilder

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

the class EzyEmbeddedServerTest method test.

@Test
public void test() throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name("test").entryLoader(TestPluginEntryLoader.class);
    EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder().name("test").entryLoader(TestAppEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name("test").application(appSettingBuilder.build()).plugin(pluginSettingBuilder.build());
    EzySimpleUdpSetting udpSetting = new EzyUdpSettingBuilder().active(true).build();
    EzySimpleSettings settings = new EzySettingsBuilder().zone(zoneSettingBuilder.build()).udp(udpSetting).build();
    EzyEmbeddedServer server = EzyEmbeddedServer.builder().settings(settings).config(EzySimpleConfig.defaultConfig()).configFile("test-config/config.properties").build();
    EzyServerContext serverContext = server.start();
    Asserts.assertEquals(serverContext.getServer().getSettings(), settings);
    Thread.sleep(2000);
    server.stop();
}
Also used : EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) Test(org.testng.annotations.Test)

Example 4 with EzyAppSettingBuilder

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

the class EzyEmbeddedServerTest method startWithConfigFile.

@Test
public void startWithConfigFile() throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name("test").entryLoader(TestPluginEntryLoader.class);
    EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder().name("test").entryLoader(TestAppEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name("test").application(appSettingBuilder.build()).plugin(pluginSettingBuilder.build());
    EzySimpleSocketSetting socketSetting = new EzySocketSettingBuilder().active(// active or not,  default true
    false).build();
    EzySimpleWebSocketSetting webSocketSetting = new EzyWebSocketSettingBuilder().active(// active or not,  default true
    false).build();
    EzySimpleSettings settings = new EzySettingsBuilder().socket(socketSetting).websocket(webSocketSetting).zone(zoneSettingBuilder.build()).build();
    EzyEmbeddedServer server = EzyEmbeddedServer.builder().settings(settings).configFile("test-config/config.properties").build();
    server.start();
    Thread.sleep(1000);
    server.stop();
}
Also used : EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer) Test(org.testng.annotations.Test)

Example 5 with EzyAppSettingBuilder

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

the class HelloEmbeddedServer method main.

public static void main(String[] args) throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name("hello").addListenEvent(EzyEventType.USER_LOGIN).entryLoader(HelloPluginEntryLoader.class);
    EzyAppSettingBuilder appSettingBuilder = new EzyAppSettingBuilder().name("hello").entryLoader(HelloAppEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name("hello").application(appSettingBuilder.build()).plugin(pluginSettingBuilder.build());
    EzyWebSocketSettingBuilder webSocketSettingBuilder = new EzyWebSocketSettingBuilder().active(true).managementEnable(true);
    EzySimpleSettings settings = new EzySettingsBuilder().zone(zoneSettingBuilder.build()).websocket(webSocketSettingBuilder.build()).build();
    EzyEmbeddedServer server = EzyEmbeddedServer.builder().settings(settings).build();
    server.start();
}
Also used : EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer)

Aggregations

EzyEmbeddedServer (com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer)7 Test (org.testng.annotations.Test)3 MsgPackCodecCreator (com.tvd12.ezyfox.codec.MsgPackCodecCreator)1 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)1 EzyAppSettingBuilder (com.tvd12.ezyfoxserver.setting.EzyAppSettingBuilder)1 EzyPluginSettingBuilder (com.tvd12.ezyfoxserver.setting.EzyPluginSettingBuilder)1 EzyMaxRequestPerSecondBuilder (com.tvd12.ezyfoxserver.setting.EzySessionManagementSettingBuilder.EzyMaxRequestPerSecondBuilder)1 EzySettingsBuilder (com.tvd12.ezyfoxserver.setting.EzySettingsBuilder)1 EzySimpleListenEvents (com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting.EzySimpleListenEvents)1 EzySimpleMaxRequestPerSecond (com.tvd12.ezyfoxserver.setting.EzySimpleSessionManagementSetting.EzySimpleMaxRequestPerSecond)1 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)1 EzyZoneSettingBuilder (com.tvd12.ezyfoxserver.setting.EzyZoneSettingBuilder)1