use of com.tvd12.ezyhttp.client.request.Request in project ezyfox-server by youngmonkeys.
the class EzyRequestAppControllerTest method testHasNotAccessed.
@Test
public void testHasNotAccessed() {
EzyArray data = EzyEntityArrays.newArray(1, EzyEntityArrays.newArray());
EzyRequestAppController controller = new EzyRequestAppController();
MyTestUser user = new MyTestUser();
user.setName("dungtv1");
user.addSession(session);
EzySimpleRequestAppRequest request = new EzySimpleRequestAppRequest();
request.deserializeParams(data);
request.setUser(user);
request.setSession(session);
EzyServerContext ctx = newServerContext();
controller.handle(ctx, request);
}
use of com.tvd12.ezyhttp.client.request.Request in project ezyfox-server by youngmonkeys.
the class EzyRequestAppControllerTest method test.
@Test
public void test() {
EzyArray data = EzyEntityArrays.newArray(1, EzyEntityArrays.newArray());
EzyRequestAppController controller = new EzyRequestAppController();
EzySimpleRequestAppRequest request = new EzySimpleRequestAppRequest();
request.deserializeParams(data);
request.setUser(user);
request.setSession(session);
EzyServerContext ctx = newServerContext();
controller.handle(ctx, request);
}
use of com.tvd12.ezyhttp.client.request.Request in project ezyfox-server by youngmonkeys.
the class EzySocketRequestHandlerTest method test.
@Test
public void test() {
ExEzySocketRequestHandler handler = new ExEzySocketRequestHandler();
EzySocketDataHandlerGroupFetcher dataHandlerGroupFetcher = mock(EzySocketDataHandlerGroupFetcher.class);
EzySocketDataHandlerGroup handlerGroup = mock(EzySocketDataHandlerGroup.class);
when(dataHandlerGroupFetcher.getDataHandlerGroup(any(EzySession.class))).thenReturn(handlerGroup);
EzySession session = spy(EzyAbstractSession.class);
session.setActivated(true);
EzyRequestQueue requestQueue = new EzyNonBlockingRequestQueue();
when(session.getExtensionRequestQueue()).thenReturn(requestQueue);
EzyArray array = EzyEntityFactory.newArrayBuilder().append(10).build();
EzySocketRequest request = new EzySimpleSocketRequest(session, array);
EzySessionTicketsRequestQueues sessionTicketsRequestQueues = new EzySessionTicketsRequestQueues();
handler.setSessionTicketsQueue(sessionTicketsRequestQueues.getExtensionQueue());
sessionTicketsRequestQueues.addRequest(request);
handler.setDataHandlerGroupFetcher(dataHandlerGroupFetcher);
handler.handleEvent();
handler.destroy();
}
use of com.tvd12.ezyhttp.client.request.Request in project ezyfox-server by youngmonkeys.
the class EzySocketRequestHandlerTest method processRequestQueue0RemainTest.
@Test
public void processRequestQueue0RemainTest() {
// given
ExEzySocketRequestHandler handler = new ExEzySocketRequestHandler();
EzySocketDataHandlerGroup handlerGroup = mock(EzySocketDataHandlerGroup.class);
EzySocketDataHandlerGroupFetcher dataHandlerGroupFetcher = mock(EzySocketDataHandlerGroupFetcher.class);
when(dataHandlerGroupFetcher.getDataHandlerGroup(any(EzySession.class))).thenReturn(handlerGroup);
EzySession session = spy(EzyAbstractSession.class);
when(session.isActivated()).thenReturn(Boolean.TRUE);
EzyRequestQueue requestQueue = new EzyNonBlockingRequestQueue();
when(session.getExtensionRequestQueue()).thenReturn(requestQueue);
EzyArray array = EzyEntityFactory.newArrayBuilder().append(10).build();
EzySocketRequest request = new EzySimpleSocketRequest(session, array);
EzySessionTicketsRequestQueues sessionTicketsRequestQueues = new EzySessionTicketsRequestQueues();
handler.setSessionTicketsQueue(sessionTicketsRequestQueues.getExtensionQueue());
sessionTicketsRequestQueues.addRequest(request);
sessionTicketsRequestQueues.addRequest(request);
handler.setDataHandlerGroupFetcher(dataHandlerGroupFetcher);
// when
handler.handleEvent();
// then
Asserts.assertEquals(sessionTicketsRequestQueues.getExtensionQueue().size(), 1);
}
use of com.tvd12.ezyhttp.client.request.Request in project ezyfox-server by youngmonkeys.
the class EzySocketRequestHandlerTest method handleGroupNullCaseTest.
@Test
public void handleGroupNullCaseTest() {
ExEzySocketRequestHandler handler = new ExEzySocketRequestHandler();
EzySocketDataHandlerGroupFetcher dataHandlerGroupFetcher = mock(EzySocketDataHandlerGroupFetcher.class);
when(dataHandlerGroupFetcher.getDataHandlerGroup(any(EzySession.class))).thenReturn(null);
EzySession session = spy(EzyAbstractSession.class);
when(session.isActivated()).thenReturn(Boolean.TRUE);
EzyRequestQueue requestQueue = new EzyNonBlockingRequestQueue();
when(session.getExtensionRequestQueue()).thenReturn(requestQueue);
EzyArray array = EzyEntityFactory.newArrayBuilder().append(10).build();
EzySocketRequest request = new EzySimpleSocketRequest(session, array);
EzySessionTicketsRequestQueues sessionTicketsRequestQueues = new EzySessionTicketsRequestQueues();
handler.setSessionTicketsQueue(sessionTicketsRequestQueues.getExtensionQueue());
sessionTicketsRequestQueues.addRequest(request);
handler.setDataHandlerGroupFetcher(dataHandlerGroupFetcher);
handler.handleEvent();
}
Aggregations