use of com.tvd12.ezyfoxserver.support.entry.EzySimplePluginEntry in project ezyfox-server by youngmonkeys.
the class EzySimplePluginEntryTest method test2.
@Test
public void test2() throws Exception {
EzySimpleSettings settings = new EzySimpleSettings();
EzySimpleServer server = new EzySimpleServer();
server.setSettings(settings);
EzySimpleServerContext serverContext = new EzySimpleServerContext();
serverContext.setServer(server);
serverContext.init();
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
EzySimpleZoneContext zoneContext = new EzySimpleZoneContext();
zoneContext.setZone(zone);
zoneContext.init();
zoneContext.setParent(serverContext);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
EzyEventControllersSetting eventControllersSetting = new EzySimpleEventControllersSetting();
EzyEventControllers eventControllers = EzyEventControllersImpl.create(eventControllersSetting);
EzySimplePlugin plugin = new EzySimplePlugin();
plugin.setSetting(pluginSetting);
plugin.setEventControllers(eventControllers);
ScheduledExecutorService pluginScheduledExecutorService = new EzyErrorScheduledExecutorService("not implement");
EzySimplePluginContext pluginContext = new EzySimplePluginContext();
pluginContext.setPlugin(plugin);
pluginContext.setParent(zoneContext);
pluginContext.setExecutorService(pluginScheduledExecutorService);
pluginContext.init();
EzySimplePluginEntry entry = new EzyPluginEntryEx2();
entry.config(pluginContext);
entry.start();
entry.destroy();
}
use of com.tvd12.ezyfoxserver.support.entry.EzySimplePluginEntry in project ezyfox-server by youngmonkeys.
the class EzyUserRequestPluginSingletonControllerTest method test.
@Test
public void test() throws Exception {
EzySimpleSettings settings = new EzySimpleSettings();
EzySimpleServer server = new EzySimpleServer();
server.setSettings(settings);
EzySimpleServerContext serverContext = new EzySimpleServerContext();
serverContext.setServer(server);
serverContext.init();
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
EzyZoneUserManager zoneUserManager = EzyZoneUserManagerImpl.builder().zoneName("test").build();
zone.setUserManager(zoneUserManager);
EzySimpleZoneContext zoneContext = new EzySimpleZoneContext();
zoneContext.setZone(zone);
zoneContext.init();
zoneContext.setParent(serverContext);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
EzyEventControllersSetting eventControllersSetting = new EzySimpleEventControllersSetting();
EzyEventControllers eventControllers = EzyEventControllersImpl.create(eventControllersSetting);
EzySimplePlugin plugin = new EzySimplePlugin();
plugin.setSetting(pluginSetting);
plugin.setEventControllers(eventControllers);
ScheduledExecutorService pluginScheduledExecutorService = new EzyErrorScheduledExecutorService("not implement");
EzySimplePluginContext pluginContext = new EzySimplePluginContext();
pluginContext.setPlugin(plugin);
pluginContext.setParent(zoneContext);
pluginContext.setExecutorService(pluginScheduledExecutorService);
pluginContext.init();
EzySimplePluginEntry entry = new EzyPluginEntryEx();
entry.config(pluginContext);
entry.start();
handleClientRequest(pluginContext);
EzyBeanContext beanContext = pluginContext.get(EzyBeanContext.class);
EzyRequestCommandManager requestCommandManager = beanContext.getSingleton(EzyRequestCommandManager.class);
EzyFeatureCommandManager featureCommandManager = beanContext.getSingleton(EzyFeatureCommandManager.class);
Asserts.assertTrue(requestCommandManager.containsCommand("v1.2.2/hello"));
Asserts.assertTrue(requestCommandManager.isManagementCommand("v1.2.2/hello"));
Asserts.assertTrue(requestCommandManager.isPaymentCommand("v1.2.2/hello"));
Asserts.assertEquals(featureCommandManager.getFeatureByCommand("v1.2.2/hello"), "hello.world");
entry.destroy();
}
use of com.tvd12.ezyfoxserver.support.entry.EzySimplePluginEntry in project ezyfox-server by youngmonkeys.
the class EzyDefaultPluginEntryTest method test.
@Test
public void test() throws Exception {
EzySimpleSettings settings = new EzySimpleSettings();
EzySimpleServer server = new EzySimpleServer();
server.setSettings(settings);
EzySimpleServerContext serverContext = new EzySimpleServerContext();
serverContext.setServer(server);
serverContext.init();
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
EzySimpleZoneContext zoneContext = new EzySimpleZoneContext();
zoneContext.setZone(zone);
zoneContext.init();
zoneContext.setParent(serverContext);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
pluginSetting.setActiveProfiles("hello,world");
pluginSetting.setPackageName("x.z.y");
EzyEventControllersSetting eventControllersSetting = new EzySimpleEventControllersSetting();
EzyEventControllers eventControllers = EzyEventControllersImpl.create(eventControllersSetting);
EzySimplePlugin plugin = new EzySimplePlugin();
plugin.setSetting(pluginSetting);
plugin.setEventControllers(eventControllers);
ScheduledExecutorService pluginScheduledExecutorService = new EzyErrorScheduledExecutorService("not implement");
EzySimplePluginContext pluginContext = new EzySimplePluginContext();
pluginContext.setPlugin(plugin);
pluginContext.setParent(zoneContext);
pluginContext.setExecutorService(pluginScheduledExecutorService);
pluginContext.init();
EzySimplePluginEntry entry = new EzyPluginEntryEx();
entry.config(pluginContext);
entry.start();
handleClientRequest(pluginContext);
entry.destroy();
}
use of com.tvd12.ezyfoxserver.support.entry.EzySimplePluginEntry in project ezyfox-server by youngmonkeys.
the class EzyDefaultPluginEntryTest method test2.
@Test
public void test2() throws Exception {
EzySimpleSettings settings = new EzySimpleSettings();
EzySimpleServer server = new EzySimpleServer();
server.setSettings(settings);
EzySimpleServerContext serverContext = new EzySimpleServerContext();
serverContext.setServer(server);
serverContext.init();
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
EzySimpleZoneContext zoneContext = new EzySimpleZoneContext();
zoneContext.setZone(zone);
zoneContext.init();
zoneContext.setParent(serverContext);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
EzyEventControllersSetting eventControllersSetting = new EzySimpleEventControllersSetting();
EzyEventControllers eventControllers = EzyEventControllersImpl.create(eventControllersSetting);
EzySimplePlugin plugin = new EzySimplePlugin();
plugin.setSetting(pluginSetting);
plugin.setEventControllers(eventControllers);
ScheduledExecutorService pluginScheduledExecutorService = new EzyErrorScheduledExecutorService("not implement");
EzySimplePluginContext pluginContext = new EzySimplePluginContext();
pluginContext.setPlugin(plugin);
pluginContext.setParent(zoneContext);
pluginContext.setExecutorService(pluginScheduledExecutorService);
pluginContext.init();
EzySimplePluginEntry entry = new EzyPluginEntryEx2();
entry.config(pluginContext);
entry.start();
entry.destroy();
}
use of com.tvd12.ezyfoxserver.support.entry.EzySimplePluginEntry in project ezyfox-server by youngmonkeys.
the class EzySimplePluginEntryTest method test.
@SuppressWarnings("rawtypes")
@Test
public void test() throws Exception {
EzySimpleSettings settings = new EzySimpleSettings();
EzySimpleServer server = new EzySimpleServer();
server.setSettings(settings);
EzySimpleServerContext serverContext = new EzySimpleServerContext();
serverContext.setServer(server);
serverContext.init();
EzySimpleZoneSetting zoneSetting = new EzySimpleZoneSetting();
EzySimpleZone zone = new EzySimpleZone();
zone.setSetting(zoneSetting);
EzySimpleZoneContext zoneContext = new EzySimpleZoneContext();
zoneContext.setZone(zone);
zoneContext.init();
zoneContext.setParent(serverContext);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
EzyEventControllersSetting eventControllersSetting = new EzySimpleEventControllersSetting();
EzyEventControllers eventControllers = EzyEventControllersImpl.create(eventControllersSetting);
EzySimplePlugin plugin = new EzySimplePlugin();
plugin.setSetting(pluginSetting);
plugin.setEventControllers(eventControllers);
ScheduledExecutorService pluginScheduledExecutorService = new EzyErrorScheduledExecutorService("not implement");
EzySimplePluginContext pluginContext = new EzySimplePluginContext();
pluginContext.setPlugin(plugin);
pluginContext.setParent(zoneContext);
pluginContext.setExecutorService(pluginScheduledExecutorService);
pluginContext.init();
EzySimplePluginEntry entry = new EzyPluginEntryEx();
entry.config(pluginContext);
entry.start();
handleClientRequest(pluginContext);
List<EzyEventController> loginEventHandlers = pluginContext.getPlugin().getEventControllers().getControllers(EzyEventType.USER_LOGIN);
Assert.assertEquals(loginEventHandlers.size(), 1);
Assert.assertEquals(loginEventHandlers.get(0).getClass(), PluginUserLoginRequestController.class);
entry.destroy();
}
Aggregations