Search in sources :

Example 1 with EzySimpleSettings

use of com.tvd12.ezyfoxserver.setting.EzySimpleSettings 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 EzySimpleSettings

use of com.tvd12.ezyfoxserver.setting.EzySimpleSettings 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 EzySimpleSettings

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

the class ServerStartup method main.

public static void main(String[] args) throws Exception {
    EzyPluginSettingBuilder pluginSettingBuilder = new EzyPluginSettingBuilder().name(PLUGIN_NAME).addListenEvent(EzyEventType.USER_LOGIN).entryLoader(PluginEntryLoader.class);
    EzyZoneSettingBuilder zoneSettingBuilder = new EzyZoneSettingBuilder().name(ZONE_NAME).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) EzySettingsBuilder(com.tvd12.ezyfoxserver.setting.EzySettingsBuilder) EzyEmbeddedServer(com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings)

Example 4 with EzySimpleSettings

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

the class EzyServerBootstrapTest method test.

@SuppressWarnings("rawtypes")
@Test
public void test() throws Exception {
    EzyServerBootstrap bt = new MyTestServerBootstrapBuilder().server(newServer()).build();
    bt.destroy();
    assert MethodInvoker.create().object(bt).method("getServer").invoke() != null;
    assert MethodInvoker.create().object(bt).method("getServerSettings").invoke() != null;
    assert MethodInvoker.create().object(bt).method("getHttpSetting").invoke() != null;
    assert MethodInvoker.create().object(bt).method("getSocketSetting").invoke() != null;
    assert MethodInvoker.create().object(bt).method("getWebSocketSetting").invoke() != null;
    EzyServerBootstrap bootstrap = new EzyServerBootstrap() {

        @Override
        protected void startOtherBootstraps(Runnable callback) {
            callback.run();
        }
    };
    EzyServerContext serverContext = mock(EzyServerContext.class);
    EzySimpleServer server = new EzySimpleServer();
    EzySimpleConfig config = new EzySimpleConfig();
    server.setConfig(config);
    when(serverContext.getServer()).thenReturn(server);
    EzySimpleSettings settings = new EzySimpleSettings();
    server.setSettings(settings);
    EzySessionManager sessionManager = new ExEzySimpleSessionManager.Builder().objectFactory(() -> spy(EzyAbstractSession.class)).build();
    server.setSessionManager(sessionManager);
    EzyBootstrap localBootstrap = EzyBootstrap.builder().context(serverContext).build();
    bootstrap.setContext(serverContext);
    bootstrap.setLocalBootstrap(localBootstrap);
    bootstrap.start();
}
Also used : EzySimpleConfig(com.tvd12.ezyfoxserver.config.EzySimpleConfig) EzySimpleServer(com.tvd12.ezyfoxserver.EzySimpleServer) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyBootstrap(com.tvd12.ezyfoxserver.EzyBootstrap) EzySessionManager(com.tvd12.ezyfoxserver.wrapper.EzySessionManager) EzyServerBootstrap(com.tvd12.ezyfoxserver.EzyServerBootstrap) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) Test(org.testng.annotations.Test)

Example 5 with EzySimpleSettings

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

the class EzySettingsReaderTest method test.

@Test
public void test() throws Exception {
    JAXBContext jaxbContext = JAXBContext.newInstance("com.tvd12.ezyfoxserver", getClass().getClassLoader());
    Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
    EzySimpleSettings settings = jaxbUnmarshaller.unmarshal(new StreamSource(inputStream()), EzySimpleSettings.class).getValue();
    System.out.println(settings);
}
Also used : StreamSource(javax.xml.transform.stream.StreamSource) JAXBContext(javax.xml.bind.JAXBContext) EzySimpleSettings(com.tvd12.ezyfoxserver.setting.EzySimpleSettings) Unmarshaller(javax.xml.bind.Unmarshaller) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)49 EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)46 EzySimpleSettings (com.tvd12.ezyfoxserver.setting.EzySimpleSettings)43 EzySimpleServerContext (com.tvd12.ezyfoxserver.context.EzySimpleServerContext)26 BaseTest (com.tvd12.test.base.BaseTest)21 EzySimpleStreamingSetting (com.tvd12.ezyfoxserver.setting.EzySimpleStreamingSetting)14 EzySimpleSessionTokenGenerator (com.tvd12.ezyfoxserver.service.impl.EzySimpleSessionTokenGenerator)13 EzySimpleStatistics (com.tvd12.ezyfoxserver.statistics.EzySimpleStatistics)13 EzyStatistics (com.tvd12.ezyfoxserver.statistics.EzyStatistics)13 ExecutorService (java.util.concurrent.ExecutorService)13 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)11 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)11 EzyHandlerGroupBuilderFactory (com.tvd12.ezyfoxserver.nio.factory.EzyHandlerGroupBuilderFactory)11 EzyEventControllers (com.tvd12.ezyfoxserver.wrapper.EzyEventControllers)11 EzySessionManager (com.tvd12.ezyfoxserver.wrapper.EzySessionManager)11 EzyErrorScheduledExecutorService (com.tvd12.ezyfox.concurrent.EzyErrorScheduledExecutorService)10 EzySimpleZone (com.tvd12.ezyfoxserver.EzySimpleZone)10 EzyResponseApi (com.tvd12.ezyfoxserver.api.EzyResponseApi)10 EzySimpleZoneContext (com.tvd12.ezyfoxserver.context.EzySimpleZoneContext)10 EzyEmbeddedServer (com.tvd12.ezyfoxserver.embedded.EzyEmbeddedServer)10