Search in sources :

Example 61 with User

use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server by youngmonkeys.

the class HelloController method greet.

@EzyDoHandle("Hello5")
public void greet(@EzyRequestData GreetRequest request, EzyUser user, EzySession session, char nothing) {
    GreetResponse response = new GreetResponse("Hello " + request.getWho() + "!");
    System.out.println("HelloController::Big/Hello response: " + response);
}
Also used : GreetResponse(com.tvd12.ezyfoxserver.support.test.data.GreetResponse) EzyDoHandle(com.tvd12.ezyfox.core.annotation.EzyDoHandle)

Example 62 with User

use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server by youngmonkeys.

the class HelloController method greet.

@EzyDoHandle("Hello4")
public void greet(@EzyRequestData GreetRequest request, EzyUser user, EzySession session, boolean nothing) {
    GreetResponse response = new GreetResponse("Hello " + request.getWho() + "!");
    System.out.println("HelloController::Big/Hello response: " + response);
}
Also used : GreetResponse(com.tvd12.ezyfoxserver.support.test.data.GreetResponse) EzyDoHandle(com.tvd12.ezyfox.core.annotation.EzyDoHandle)

Example 63 with User

use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server by youngmonkeys.

the class HelloController method greet.

@EzyDoHandle("Hello3")
public void greet(@EzyRequestData GreetRequest request, EzyUser user, EzySession session, int nothing) {
    GreetResponse response = new GreetResponse("Hello " + request.getWho() + "!");
    System.out.println("HelloController::Big/Hello response: " + response);
}
Also used : GreetResponse(com.tvd12.ezyfoxserver.support.test.data.GreetResponse) EzyDoHandle(com.tvd12.ezyfox.core.annotation.EzyDoHandle)

Example 64 with User

use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server by youngmonkeys.

the class EzyServerContextsTest method test.

@Test
public void test() {
    EzySimpleApplication app = new EzySimpleApplication();
    app.setUserManager(EzyAppUserManagerImpl.builder().maxUsers(1).appName("test").build());
    EzyAppContext appContext = mock(EzyAppContext.class);
    when(appContext.getApp()).thenReturn(app);
    EzySimpleUser user = new EzySimpleUser();
    assert !EzyServerContexts.containsUser(appContext, user);
    assert !EzyServerContexts.containsUser(appContext, "test");
    assert EzyServerContexts.getUserManager(appContext) != null;
}
Also used : EzySimpleApplication(com.tvd12.ezyfoxserver.EzySimpleApplication) EzySimpleUser(com.tvd12.ezyfoxserver.entity.EzySimpleUser) EzyAppContext(com.tvd12.ezyfoxserver.context.EzyAppContext) BaseTest(com.tvd12.test.base.BaseTest) Test(org.testng.annotations.Test)

Example 65 with User

use of com.tvd12.example.lucky_wheel.entity.User in project ezyfox-server by youngmonkeys.

the class EzySimpleAppContextTest method test.

@Test
public void test() {
    EzyServerContext serverContext = mock(EzyServerContext.class);
    EzySimpleZone zone = new EzySimpleZone();
    EzyZoneContext zoneContext = mock(EzyZoneContext.class);
    when(zoneContext.getZone()).thenReturn(zone);
    when(zoneContext.getParent()).thenReturn(serverContext);
    EzySimpleApplication app = new EzySimpleApplication();
    EzySimpleAppSetting setting = new EzySimpleAppSetting();
    app.setSetting(setting);
    EzySimpleAppContext appContext = new EzySimpleAppContext();
    appContext.setParent(zoneContext);
    appContext.setApp(app);
    appContext.init();
    Asserts.assertNull(appContext.get(Void.class));
    // noinspection EqualsWithItself
    assert appContext.equals(appContext);
    EzySimpleAppContext appContext2 = new EzySimpleAppContext();
    assert !appContext.equals(appContext2);
    assert appContext.cmd(EzyAppResponse.class) != null;
    Asserts.assertNull(appContext.cmd(Void.class));
    EzySimpleUser user = new EzySimpleUser();
    user.setName("test");
    EzyAbstractSession session = spy(EzyAbstractSession.class);
    user.addSession(session);
    EzyData data = EzyEntityFactory.newArrayBuilder().build();
    appContext.send(data, session, false);
    ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
    appContext.setExecutorService(executorService);
    assert appContext.getExecutorService() != null;
    appContext.handleException(Thread.currentThread(), new Exception());
}
Also used : EzySimpleAppSetting(com.tvd12.ezyfoxserver.setting.EzySimpleAppSetting) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) EzyZoneContext(com.tvd12.ezyfoxserver.context.EzyZoneContext) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyData(com.tvd12.ezyfox.entity.EzyData) EzySimpleZone(com.tvd12.ezyfoxserver.EzySimpleZone) EzySimpleApplication(com.tvd12.ezyfoxserver.EzySimpleApplication) EzySimpleUser(com.tvd12.ezyfoxserver.entity.EzySimpleUser) EzyAbstractSession(com.tvd12.ezyfoxserver.entity.EzyAbstractSession) EzySimpleAppContext(com.tvd12.ezyfoxserver.context.EzySimpleAppContext) EzyAppResponse(com.tvd12.ezyfoxserver.command.EzyAppResponse) Test(org.testng.annotations.Test) BaseTest(com.tvd12.test.base.BaseTest)

Aggregations

Test (org.testng.annotations.Test)42 EzySimpleUser (com.tvd12.ezyfoxserver.entity.EzySimpleUser)33 EzyZoneContext (com.tvd12.ezyfoxserver.context.EzyZoneContext)28 EzyUser (com.tvd12.ezyfoxserver.entity.EzyUser)25 EzyAbstractSession (com.tvd12.ezyfoxserver.entity.EzyAbstractSession)20 EzyArray (com.tvd12.ezyfox.entity.EzyArray)16 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)16 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)15 BaseTest (com.tvd12.test.base.BaseTest)14 EzyAppContext (com.tvd12.ezyfoxserver.context.EzyAppContext)13 BaseCoreTest (com.tvd12.ezyfoxserver.testing.BaseCoreTest)12 EzyApplication (com.tvd12.ezyfoxserver.EzyApplication)10 EzyZoneUserManager (com.tvd12.ezyfoxserver.wrapper.EzyZoneUserManager)10 EzySimpleAppSetting (com.tvd12.ezyfoxserver.setting.EzySimpleAppSetting)8 GreetResponse (com.tvd12.ezyfoxserver.support.test.data.GreetResponse)8 EzyAppUserManager (com.tvd12.ezyfoxserver.wrapper.EzyAppUserManager)8 EzyDoHandle (com.tvd12.ezyfox.core.annotation.EzyDoHandle)7 EzySimpleApplication (com.tvd12.ezyfoxserver.EzySimpleApplication)7 EzySimpleZone (com.tvd12.ezyfoxserver.EzySimpleZone)7 EzyResponse (com.tvd12.ezyfoxserver.response.EzyResponse)7