Search in sources :

Example 1 with MyTestUser

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

the class EzyDisconnectUserImplTest method test3.

@Test
public void test3() {
    MyTestUser user = new MyTestUser();
    user.setName("dungtv");
    EzySession session = newSession();
    session.setToken("abc");
    user.addSession(session);
}
Also used : MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Example 2 with MyTestUser

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

the class EzyDisconnectUserImplTest method test2.

@Test
public void test2() {
    MyTestUser user = new MyTestUser();
    user.setName("dungtv");
    EzySession session = newSession();
    session.setToken("abc");
    user.addSession(session);
}
Also used : MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Example 3 with MyTestUser

use of com.tvd12.ezyfoxserver.testing.MyTestUser 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);
}
Also used : EzyRequestAppController(com.tvd12.ezyfoxserver.controller.EzyRequestAppController) MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzySimpleRequestAppRequest(com.tvd12.ezyfoxserver.request.EzySimpleRequestAppRequest) Test(org.testng.annotations.Test) BaseCoreContextTest(com.tvd12.ezyfoxserver.testing.BaseCoreContextTest)

Example 4 with MyTestUser

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

the class EzyRequestAppControllerTest method newServerContext.

@Override
protected EzyServerContext newServerContext() {
    session = newSession();
    session.setToken("abc");
    user = new MyTestUser();
    user.setName("dungtv");
    user.addSession(session);
    EzyAppContext appContext = mock(EzyAppContext.class);
    EzySimpleApplication app = new EzySimpleApplication();
    app.setSetting(new EzySimpleAppSetting());
    app.setUserManager(EzyAppUserManagerImpl.builder().build());
    app.getUserManager().addUser(user);
    when(appContext.getApp()).thenReturn(app);
    EzyServerContext serverContext = mock(EzyServerContext.class);
    when(serverContext.getAppContext(1)).thenReturn(appContext);
    return serverContext;
}
Also used : EzySimpleAppSetting(com.tvd12.ezyfoxserver.setting.EzySimpleAppSetting) EzySimpleApplication(com.tvd12.ezyfoxserver.EzySimpleApplication) MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyAppContext(com.tvd12.ezyfoxserver.context.EzyAppContext)

Example 5 with MyTestUser

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

the class EzyServerUserInterceptorTest method test1.

@Test
public void test1() throws Exception {
    EzyServerContext context = newServerContext();
    EzyServerUserInterceptor interceptor = new EzyServerUserInterceptor();
    EzySimpleRequestAppRequest request = new EzySimpleRequestAppRequest();
    request.setUser(new MyTestUser());
    interceptor.intercept(context, request);
}
Also used : EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) MyTestUser(com.tvd12.ezyfoxserver.testing.MyTestUser) EzySimpleRequestAppRequest(com.tvd12.ezyfoxserver.request.EzySimpleRequestAppRequest) EzyServerUserInterceptor(com.tvd12.ezyfoxserver.interceptor.EzyServerUserInterceptor) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Aggregations

MyTestUser (com.tvd12.ezyfoxserver.testing.MyTestUser)6 Test (org.testng.annotations.Test)5 BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)4 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)3 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)2 EzySimpleRequestAppRequest (com.tvd12.ezyfoxserver.request.EzySimpleRequestAppRequest)2 EzyArray (com.tvd12.ezyfox.entity.EzyArray)1 EzySimpleApplication (com.tvd12.ezyfoxserver.EzySimpleApplication)1 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)1 EzyRequestAppController (com.tvd12.ezyfoxserver.controller.EzyRequestAppController)1 EzyServerUserInterceptor (com.tvd12.ezyfoxserver.interceptor.EzyServerUserInterceptor)1 EzySimpleAppSetting (com.tvd12.ezyfoxserver.setting.EzySimpleAppSetting)1 BaseCoreContextTest (com.tvd12.ezyfoxserver.testing.BaseCoreContextTest)1 MyTestSession (com.tvd12.ezyfoxserver.testing.MyTestSession)1 MyTestUserManager (com.tvd12.ezyfoxserver.testing.MyTestUserManager)1