Search in sources :

Example 1 with EzyBroadcastPluginsEventImpl

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

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

the class EzyBroadcastPluginsEventImplTest method firePluginEventExceptionCase.

@Test
public void firePluginEventExceptionCase() {
    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);
    EzyPlugin plugin = mock(EzyPlugin.class);
    when(pluginContext.getPlugin()).thenReturn(plugin);
    EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
    when(plugin.getSetting()).thenReturn(pluginSetting);
    EzySimpleListenEvents listenEvents = pluginSetting.getListenEvents();
    listenEvents.setEvent("SERVER_READY");
    doThrow(new IllegalStateException("server maintain")).when(pluginContext).handleEvent(any(), any());
    when(zoneContext.getPluginContexts()).thenReturn(Lists.newArrayList(pluginContext));
    EzyBroadcastPluginsEventImpl cmd = new EzyBroadcastPluginsEventImpl(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) EzySimpleListenEvents(com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting.EzySimpleListenEvents) EzyPluginContext(com.tvd12.ezyfoxserver.context.EzyPluginContext) EzyBroadcastPluginsEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyBroadcastPluginsEventImpl) EzySimpleServerReadyEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerReadyEvent) EzyPlugin(com.tvd12.ezyfoxserver.EzyPlugin) EzySimpleZoneSetting(com.tvd12.ezyfoxserver.setting.EzySimpleZoneSetting) EzyServerReadyEvent(com.tvd12.ezyfoxserver.event.EzyServerReadyEvent) EzySimplePluginSetting(com.tvd12.ezyfoxserver.setting.EzySimplePluginSetting) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Example 3 with EzyBroadcastPluginsEventImpl

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

the class EzyBroadcastPluginsEventImplTest method pluginContextsNullCaseTest.

@Test
public void pluginContextsNullCaseTest() {
    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);
    EzyBroadcastPluginsEventImpl cmd = new EzyBroadcastPluginsEventImpl(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) EzyBroadcastPluginsEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyBroadcastPluginsEventImpl) 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

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