use of com.tvd12.ezyfoxserver.context.EzyAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppResponseImplTest method newResponse.
private EzyAppResponse newResponse() {
EzyAppContext context = mock(EzyAppContext.class);
EzyApplication application = mock(EzyApplication.class);
EzyAppUserManager userManager = EzyAppUserManagerImpl.builder().build();
when(context.getApp()).thenReturn(application);
when(application.getUserManager()).thenReturn(userManager);
return new EzyAppResponseImpl(context);
}
use of com.tvd12.ezyfoxserver.context.EzyAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppSendResponseImplTest method test.
@Test
public void test() {
EzyAppContext appContext = mock(EzyAppContext.class);
EzyApplication app = mock(EzyApplication.class);
when(appContext.getApp()).thenReturn(app);
EzySimpleAppSetting appSetting = new EzySimpleAppSetting();
appSetting.setName("test");
when(app.getSetting()).thenReturn(appSetting);
EzyZoneContext zoneContext = mock(EzyZoneContext.class);
when(appContext.getParent()).thenReturn(zoneContext);
EzyServerContext serverContext = mock(EzyServerContext.class);
when(zoneContext.getParent()).thenReturn(serverContext);
EzyAppSendResponseImpl cmd = new EzyAppSendResponseImpl(appContext);
EzyData data = EzyEntityFactory.newArrayBuilder().build();
EzyAbstractSession session = spy(EzyAbstractSession.class);
cmd.execute(data, session, false);
cmd.execute(data, Lists.newArrayList(session), false);
}
use of com.tvd12.ezyfoxserver.context.EzyAppContext 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);
}
use of com.tvd12.ezyfoxserver.context.EzyAppContext 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);
}
use of com.tvd12.ezyfoxserver.context.EzyAppContext in project ezyfox-server by youngmonkeys.
the class EzyAppFireEventImplTest method test.
@Test
public void test() {
EzySimpleAppSetting app = mock(EzySimpleAppSetting.class);
EzyAppContext context = mock(EzyAppContext.class);
EzySimpleApplication application = new EzySimpleApplication();
application.setEventControllers(new EzyEventControllersImpl());
application.setSetting(app);
when(context.getApp()).thenReturn(application);
}
Aggregations