Search in sources :

Example 6 with MyTestSession

use of com.tvd12.ezyfoxserver.testing.MyTestSession in project ezyfox-server by youngmonkeys.

the class BaseCoreTest method newSession.

protected EzySession newSession(int id) {
    MyTestSession session = new MyTestSession();
    session.setId(id);
    session.setDelegate(new SessionDelegate());
    return session;
}
Also used : EzySessionDelegate(com.tvd12.ezyfoxserver.delegate.EzySessionDelegate)

Example 7 with MyTestSession

use of com.tvd12.ezyfoxserver.testing.MyTestSession in project ezyfox-server by youngmonkeys.

the class BaseCoreTest method newSession.

protected EzySession newSession() {
    MyTestSession session = new MyTestSession();
    session.setDelegate(new SessionDelegate());
    return session;
}
Also used : EzySessionDelegate(com.tvd12.ezyfoxserver.delegate.EzySessionDelegate)

Example 8 with MyTestSession

use of com.tvd12.ezyfoxserver.testing.MyTestSession in project ezyfox-server by youngmonkeys.

the class EzyUserManagerImplTest method test.

@Test
public void test() {
    MyTestUserManager manager = MyTestUserManager.builder().build();
    MyTestSession session = new MyTestSession();
    session.setId(10);
    MyTestUser user = new MyTestUser();
    user.setId(1);
    user.setName("dungtv");
    session.setToken("123456");
    user.addSession(session);
    manager.addUser(session, user);
    assert manager.getUser(1) == user;
    assert manager.getUser("dungtv") == user;
    assert manager.containsUser(1);
    assert !manager.containsUser(-1);
    assert manager.containsUser(session);
    assert manager.containsUser(user);
    manager.removeUser(user.getId());
    assert manager.getUser(1) == null;
    manager.addUser(session, user);
    manager.removeUser(user.getName());
    assert manager.getUser("dungtv") == null;
    manager.addUser(session, user);
    manager.removeUser((EzyUser) null);
}
Also used : MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) MyTestSession(com.tvd12.ezyfoxserver.testing.MyTestSession) MyTestUserManager(com.tvd12.ezyfoxserver.testing.MyTestUserManager) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Aggregations

BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)6 MyTestSession (com.tvd12.ezyfoxserver.testing.MyTestSession)6 Test (org.testng.annotations.Test)6 EzySessionDelegate (com.tvd12.ezyfoxserver.delegate.EzySessionDelegate)2 MyTestSessionManager (com.tvd12.ezyfoxserver.testing.MyTestSessionManager)2 EzyAbstractSessionDelegate (com.tvd12.ezyfoxserver.delegate.EzyAbstractSessionDelegate)1 EzyDroppedPackets (com.tvd12.ezyfoxserver.entity.EzyDroppedPackets)1 EzyImmediateDeliver (com.tvd12.ezyfoxserver.entity.EzyImmediateDeliver)1 EzyMaxSessionException (com.tvd12.ezyfoxserver.exception.EzyMaxSessionException)1 EzyChannel (com.tvd12.ezyfoxserver.socket.EzyChannel)1 EzyRequestFrameSecond (com.tvd12.ezyfoxserver.statistics.EzyRequestFrameSecond)1 MyTestUser (com.tvd12.ezyfoxserver.testing.MyTestUser)1 MyTestUserManager (com.tvd12.ezyfoxserver.testing.MyTestUserManager)1 InetSocketAddress (java.net.InetSocketAddress)1