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);
}
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);
}
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);
}
Aggregations