Search in sources :

Example 1 with EzyZoneBroadcastEventImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl in project ezyfox-server by youngmonkeys.

the class EzySimpleZoneContext method doInit.

@Override
protected void doInit() {
    this.broadcastEvent = new EzyZoneBroadcastEventImpl(this);
    this.broadcastAppsEvent = new EzyBroadcastAppsEventImpl(this);
    this.broadcastPluginsEvent = new EzyBroadcastPluginsEventImpl(this);
    this.properties.put(EzyBroadcastEvent.class, broadcastEvent);
    this.properties.put(EzyBroadcastAppsEvent.class, broadcastAppsEvent);
    this.properties.put(EzyBroadcastPluginsEvent.class, broadcastPluginsEvent);
}
Also used : EzyBroadcastAppsEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyBroadcastAppsEventImpl) EzyZoneBroadcastEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl) EzyBroadcastPluginsEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyBroadcastPluginsEventImpl)

Example 2 with EzyZoneBroadcastEventImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl in project ezyfox-server by youngmonkeys.

the class EzyZoneBroadcastEventImplTest method firePluginEventNoCatchExceptionCaseTest.

@Test
public void firePluginEventNoCatchExceptionCaseTest() {
    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));
    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) 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)

Example 3 with EzyZoneBroadcastEventImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl in project ezyfox-server by youngmonkeys.

the class EzyZoneBroadcastEventImplTest method fireAppEventCatchExceptionCaseTest.

@Test
public void fireAppEventCatchExceptionCaseTest() {
    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));
    doThrow(new IllegalStateException("server maintain")).when(appContext).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) 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 4 with EzyZoneBroadcastEventImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl 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 5 with EzyZoneBroadcastEventImpl

use of com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl 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

EzyZoneBroadcastEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyZoneBroadcastEventImpl)5 EzyZone (com.tvd12.ezyfoxserver.EzyZone)4 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)4 EzyServerReadyEvent (com.tvd12.ezyfoxserver.event.EzyServerReadyEvent)4 EzySimpleServerReadyEvent (com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent)4 EzySimpleZoneSetting (com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting)4 BaseTest (com.tvd12.test.base.BaseTest)4 Test (org.testng.annotations.Test)4 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)2 EzyPluginContext (com.tvd12.ezyfoxserver.context.EzyPluginContext)2 EzyBroadcastAppsEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyBroadcastAppsEventImpl)1 EzyBroadcastPluginsEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyBroadcastPluginsEventImpl)1