Search in sources :

Example 6 with EzyNonBlockingRequestQueue

use of com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue in project ezyfox-server by youngmonkeys.

the class EzyNonBlockingPacketQueueTest method clearTest.

@Test
public void clearTest() {
    // given
    EzyNonBlockingRequestQueue sut = new EzyNonBlockingRequestQueue();
    EzySocketRequest socketRequest = mock(EzySocketRequest.class);
    sut.add(socketRequest);
    // when
    sut.clear();
    // then
    Asserts.assertTrue(sut.isEmpty());
}
Also used : EzyNonBlockingRequestQueue(com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue) EzySocketRequest(com.tvd12.ezyfoxserver.socket.EzySocketRequest) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 7 with EzyNonBlockingRequestQueue

use of com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue in project ezyfox-server by youngmonkeys.

the class EzyNonBlockingPacketQueueTest method isFullTest.

@Test
public void isFullTest() {
    // given
    EzyNonBlockingRequestQueue sut = new EzyNonBlockingRequestQueue(0);
    EzySocketRequest socketRequest = mock(EzySocketRequest.class);
    // when
    boolean result = sut.add(socketRequest);
    // then
    Asserts.assertTrue(sut.isFull());
    Asserts.assertFalse(result);
}
Also used : EzyNonBlockingRequestQueue(com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue) EzySocketRequest(com.tvd12.ezyfoxserver.socket.EzySocketRequest) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Aggregations

Test (org.testng.annotations.Test)6 EzyArray (com.tvd12.ezyfox.entity.EzyArray)4 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)4 EzyNonBlockingRequestQueue (com.tvd12.ezyfoxserver.socket.EzyNonBlockingRequestQueue)3 EzySocketRequest (com.tvd12.ezyfoxserver.socket.EzySocketRequest)2 BaseTest (com.tvd12.test.base.BaseTest)2 EzyNonBlockingPacketQueue (com.tvd12.ezyfoxserver.socket.EzyNonBlockingPacketQueue)1 EzyRequestFrameSecond (com.tvd12.ezyfoxserver.statistics.EzyRequestFrameSecond)1