Search in sources :

Example 1 with EzyServerInitializingEvent

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

the class EzyZonesStarter method notifyServerInitializing.

protected void notifyServerInitializing(EzyZoneContext zoneContext) {
    EzyServerInitializingEvent event = new EzySimpleServerInitializingEvent();
    zoneContext.handleEvent(EzyEventType.SERVER_INITIALIZING, event);
}
Also used : EzySimpleServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerInitializingEvent) EzyServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzyServerInitializingEvent)

Example 2 with EzyServerInitializingEvent

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

the class EzyBootstrap method notifyServerInitializing.

protected void notifyServerInitializing() {
    EzyServerInitializingEvent event = new EzySimpleServerInitializingEvent();
    context.handleEvent(EzyEventType.SERVER_INITIALIZING, event);
}
Also used : EzySimpleServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerInitializingEvent) EzyServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzyServerInitializingEvent)

Example 3 with EzyServerInitializingEvent

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

the class EzyBroadcastEventImplTest method test.

@Test
public void test() {
    EzyServerContext serverContext = mock(EzyServerContext.class);
    EzyZoneContext zoneContext1 = mock(EzyZoneContext.class);
    EzyZoneContext zoneContext2 = mock(EzyZoneContext.class);
    doThrow(new IllegalStateException()).when(zoneContext2).handleEvent(any(), any());
    when(serverContext.getZoneContexts()).thenReturn(Lists.newArrayList(zoneContext1, zoneContext2));
    EzyBroadcastEventImpl cmd = new EzyBroadcastEventImpl(serverContext);
    EzyServerInitializingEvent event = new EzySimpleServerInitializingEvent();
    cmd.fire(EzyEventType.SERVER_INITIALIZING, event, true);
    try {
        cmd.fire(EzyEventType.SERVER_INITIALIZING, event, false);
    } catch (Exception e) {
        assert e instanceof IllegalStateException;
    }
}
Also used : EzySimpleServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzySimpleServerInitializingEvent) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyServerInitializingEvent(com.tvd12.ezyfoxserver.event.EzyServerInitializingEvent) EzyBroadcastEventImpl(com.tvd12.ezyfoxserver.command.impl.EzyBroadcastEventImpl) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

EzyServerInitializingEvent (com.tvd12.ezyfoxserver.event.EzyServerInitializingEvent)3 EzySimpleServerInitializingEvent (com.tvd12.ezyfoxserver.event.EzySimpleServerInitializingEvent)3 EzyBroadcastEventImpl (com.tvd12.ezyfoxserver.command.impl.EzyBroadcastEventImpl)1 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)1 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)1 BaseTest (com.tvd12.test.base.BaseTest)1 Test (org.testng.annotations.Test)1