use of com.tvd12.ezyfox.entity.EzyData in project ezyfox-server by youngmonkeys.
the class EzyRequestAppResponseTest method test.
@Test
public void test() {
EzyRequestAppResponseParams params = new EzyRequestAppResponseParams();
EzyData data = EzyEntityFactory.EMPTY_ARRAY;
params.setData(data);
params.setAppId(1);
assert params.getAppId() == 1;
assert params.getData() == data;
EzyRequestAppResponse response = new EzyRequestAppResponse(params);
assert response.getParams() == params;
assert response.getCommand() == EzyCommand.APP_REQUEST;
assert response.serialize().size() > 0;
response.release();
}
use of com.tvd12.ezyfox.entity.EzyData in project ezyfox-server-android-client by youngmonkeys.
the class EzyTcpClient method send.
@Override
public void send(EzyRequest request, boolean encrypted) {
Object cmd = request.getCommand();
EzyData data = request.serialize();
send((EzyCommand) cmd, (EzyArray) data, encrypted);
}
use of com.tvd12.ezyfox.entity.EzyData in project ezyfox-server-android-client by youngmonkeys.
the class EzyAppResponseHandler method handle.
@Override
public void handle(EzyArray data) {
int appId = data.get(0, int.class);
EzyArray commandData = data.get(1, EzyArray.class);
String cmd = commandData.get(0, String.class);
EzyData responseData = commandData.get(1, EzyData.class, null);
EzyApp app = client.getAppById(appId);
if (app == null) {
EzyLogger.info("receive message when has not joined app yet");
return;
}
EzyAppDataHandler dataHandler = app.getDataHandler(cmd);
if (dataHandler != null)
dataHandler.handle(app, responseData);
else
EzyLogger.warn("app: " + app.getName() + " has no handler for command: " + cmd);
}
use of com.tvd12.ezyfox.entity.EzyData 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");
}
use of com.tvd12.ezyfox.entity.EzyData in project ezyfox-server by youngmonkeys.
the class EzyAccessAppResponseTest method test.
@Test
public void test() {
EzySimpleAppSetting setting = new EzySimpleAppSetting();
EzyAccessAppParams params = new EzyAccessAppParams();
EzyData data = EzyEntityFactory.EMPTY_ARRAY;
params.setData(data);
params.setApp(setting);
assert params.getApp() == setting;
assert params.getData() == data;
EzyAccessAppResponse response = new EzyAccessAppResponse(params);
assert response.getParams() == params;
assert response.getCommand() == EzyCommand.APP_ACCESS;
assert response.serialize().size() > 0;
response.release();
}
Aggregations