Search in sources :

Example 41 with User

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

the class EzyRequestAppEventImplTest method test.

@Test
public void test() {
    EzyUser user = newUser();
    EzyArray data = newArrayBuilder().append(100).build();
    EzyUserRequestAppEvent event = new EzySimpleUserRequestAppEvent(user, null, data);
    assert event.getData() == data;
    assert event.getUser() == user;
}
Also used : EzyUser(com.tvd12.ezyfoxserver.entity.EzyUser) EzySimpleUserRequestAppEvent(com.tvd12.ezyfoxserver.event.EzySimpleUserRequestAppEvent) EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzyUserRequestAppEvent(com.tvd12.ezyfoxserver.event.EzyUserRequestAppEvent) BaseCoreTest(com.tvd12.ezyfoxserver.testing.BaseCoreTest) Test(org.testng.annotations.Test)

Example 42 with User

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

the class UserViewController method getUser.

@DoGet("/{username}")
public View getUser(@PathVariable("username") String username) {
    User user = userService.getUser(username);
    String msg = user != null ? "User " + username + " with info: " + user : "User " + username + " not found";
    return View.builder().addVariable("message", msg).template("user-info").build();
}
Also used : User(org.youngmonkeys.example.ezyhttp.website.user_management.entity.User) DoGet(com.tvd12.ezyhttp.server.core.annotation.DoGet)

Example 43 with User

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

the class ApiAddUserTest method main.

public static void main(String[] args) throws Exception {
    HttpClient httpClient = HttpClient.builder().build();
    User body = new User();
    body.setUsername("tvd12");
    body.setPassword("123456");
    RequestEntity requestEntity = RequestEntity.body(body);
    Request request = new PostRequest().setURL(API_URL + "add").setEntity(requestEntity).setResponseType(Boolean.class).setResponseType(StatusCodes.CONFLICT, String.class);
    Boolean response = httpClient.call(request);
    System.out.println("add user reponse: " + response);
}
Also used : PostRequest(com.tvd12.ezyhttp.client.request.PostRequest) User(org.youngmonkeys.example.ezyhttp.website.user_management.entity.User) HttpClient(com.tvd12.ezyhttp.client.HttpClient) PostRequest(com.tvd12.ezyhttp.client.request.PostRequest) Request(com.tvd12.ezyhttp.client.request.Request) RequestEntity(com.tvd12.ezyhttp.client.request.RequestEntity)

Example 44 with User

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

the class ApiGetUserTest method main.

public static void main(String[] args) throws Exception {
    HttpClientProxy httpClient = HttpClientProxy.builder().build();
    httpClient.start();
    RequestEntity entity = RequestEntity.builder().build();
    Request helloRequest = new GetRequest().setURL(API_URL + "tvd12").setEntity(entity).setResponseType(String.class).setResponseType(StatusCodes.NOT_FOUND, String.class);
    String response = httpClient.call(helloRequest, 10000);
    System.out.println("get user response: " + response);
}
Also used : GetRequest(com.tvd12.ezyhttp.client.request.GetRequest) GetRequest(com.tvd12.ezyhttp.client.request.GetRequest) Request(com.tvd12.ezyhttp.client.request.Request) HttpClientProxy(com.tvd12.ezyhttp.client.HttpClientProxy) RequestEntity(com.tvd12.ezyhttp.client.request.RequestEntity)

Example 45 with User

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

the class EzyLoginSuccessHandler method handle.

@Override
public void handle(EzyArray data) {
    EzyData responseData = data.get(4, EzyData.class);
    EzyUser user = newUser(data);
    EzyZone zone = newZone(data);
    ((EzyMeAware) client).setMe(user);
    ((EzyZoneAware) client).setZone(zone);
    handleLoginSuccess(responseData);
    EzyLogger.debug("user: " + user + " logged in successfully");
}
Also used : EzyZone(com.tvd12.ezyfoxserver.client.entity.EzyZone) EzyUser(com.tvd12.ezyfoxserver.client.entity.EzyUser) EzyZoneAware(com.tvd12.ezyfoxserver.client.entity.EzyZoneAware) EzyData(com.tvd12.ezyfoxserver.client.entity.EzyData) EzyMeAware(com.tvd12.ezyfoxserver.client.entity.EzyMeAware)

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