Search in sources :

Example 6 with EzyServerReadyEvent

use of com.tvd12.ezyfoxserver.event.EzyServerReadyEvent in project ezyfox-server by youngmonkeys.

the class EzyZoneBroadcastEventImplTest method fireAppEventNoCatchExceptionCaseTest.

@Test
public void fireAppEventNoCatchExceptionCaseTest() {
    EzyZoneContext zoneContext = mock(EzyZoneContext.class);
    EzyZone zone = mock(EzyZone.class);
    when(zoneContext.getZone()).thenReturn(zone);
    EzySimpleZoneSetting setting = new EzySimpleZoneSetting();
    setting.setName("test");
    when(zone.getSetting()).thenReturn(setting);
    EzyAppContext appContext = mock(EzyAppContext.class);
    when(zoneContext.getAppContexts()).thenReturn(Lists.newArrayList(appContext));
    EzyZoneBroadcastEventImpl cmd = new EzyZoneBroadcastEventImpl(zoneContext);
    EzyServerReadyEvent event = new EzySimpleServerReadyEvent();
    cmd.fire(EzyEventType.SERVER_READY, event, false);
}
Also used : EzyZone(com.tvd12.ezyfoxserver.EzyZone) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyZoneBroadcastEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl) EzySimpleServerReadyEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent) EzyAppContext(com.tvd12.ezyfoxserver.context.EzyAppContext) EzySimpleZoneSetting(com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting) EzyServerReadyEvent(com.tvd12.ezyfoxserver.event.EzyServerReadyEvent) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Example 7 with EzyServerReadyEvent

use of com.tvd12.ezyfoxserver.event.EzyServerReadyEvent in project ezyfox-server by youngmonkeys.

the class EzyZoneBroadcastEventImplTest method firePluginEventCatchExceptionCaseTest.

@Test
public void firePluginEventCatchExceptionCaseTest() {
    EzyZoneContext zoneContext = mock(EzyZoneContext.class);
    EzyZone zone = mock(EzyZone.class);
    when(zoneContext.getZone()).thenReturn(zone);
    EzySimpleZoneSetting setting = new EzySimpleZoneSetting();
    setting.setName("test");
    when(zone.getSetting()).thenReturn(setting);
    EzyPluginContext pluginContext = mock(EzyPluginContext.class);
    when(zoneContext.getPluginContexts()).thenReturn(Lists.newArrayList(pluginContext));
    doThrow(new IllegalStateException("server maintain")).when(pluginContext).handleEvent(any(), any());
    EzyZoneBroadcastEventImpl cmd = new EzyZoneBroadcastEventImpl(zoneContext);
    EzyServerReadyEvent event = new EzySimpleServerReadyEvent();
    cmd.fire(EzyEventType.SERVER_READY, event, true);
}
Also used : EzyZone(com.tvd12.ezyfoxserver.EzyZone) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext) EzyZoneBroadcastEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl) EzySimpleServerReadyEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent) EzySimpleZoneSetting(com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting) EzyServerReadyEvent(com.tvd12.ezyfoxserver.event.EzyServerReadyEvent) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)7 EzyServerReadyEvent (com.tvd12.ezyfoxserver.event.EzyServerReadyEvent)7 EzySimpleServerReadyEvent (com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent)7 Test (org.testng.annotations.Test)7 EzyZone (com.tvd12.ezyfoxserver.EzyZone)6 EzySimpleZoneSetting (com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting)6 BaseTest (com.tvd12.test.base.BaseTest)6 EzyZoneBroadcastEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl)4 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)3 EzyBroadcastPluginsEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyBroadcastPluginsEventImpl)2 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)2 EzySimplePluginSetting (com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting)2 EzyPlugin (com.tvd12.ezyfoxserver.EzyPlugin)1 EzySimpleApplication (com.tvd12.ezyfoxserver.EzySimpleApplication)1 EzySimplePlugin (com.tvd12.ezyfoxserver.EzySimplePlugin)1 EzySimpleServer (com.tvd12.ezyfoxserver.EzySimpleServer)1 EzyResponseApi (com.tvd12.ezyfoxserver.api.EzyResponseApi)1 EzyStreamingApi (com.tvd12.ezyfoxserver.api.EzyStreamingApi)1 EzyBroadcastEvent (com.tvd12.ezyfoxserver.command.EzyBroadcastEvent)1 EzySimpleAppContext (com.tvd12.ezyfoxserver.context.EzySimpleAppContext)1