use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server by youngmonkeys.
the class EzyPluginSendResponseImplTest method test.
@Test
public void test() {
EzyPluginContext pluginContext = mock(EzyPluginContext.class);
EzyPlugin plugin = mock(EzyPlugin.class);
when(pluginContext.getPlugin()).thenReturn(plugin);
EzySimplePluginSetting pluginSetting = new EzySimplePluginSetting();
pluginSetting.setName("test");
when(plugin.getSetting()).thenReturn(pluginSetting);
EzyZoneContext zoneContext = mock(EzyZoneContext.class);
when(pluginContext.getParent()).thenReturn(zoneContext);
EzyServerContext serverContext = mock(EzyServerContext.class);
when(zoneContext.getParent()).thenReturn(serverContext);
EzyPluginSendResponseImpl cmd = new EzyPluginSendResponseImpl(pluginContext);
EzyObject data = EzyEntityFactory.newObjectBuilder().build();
EzyAbstractSession session = spy(EzyAbstractSession.class);
cmd.execute(data, session, false);
cmd.execute(data, Lists.newArrayList(session), false);
}
use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server by youngmonkeys.
the class EzyAbstractObjectResponse method getResponseData.
@Override
protected EzyData getResponseData() {
EzyObject object = data != null ? marshaller.marshal(data) : newObjectBuilder().build();
if (additionalParams != null) {
for (Map.Entry<Object, Object> e : additionalParams.entrySet()) {
Object skey = marshaller.marshal(e.getKey());
Object svalue = marshaller.marshal(e.getValue());
object.put(skey, svalue);
}
}
if (excludeParamKeys != null) {
object.removeAll(excludeParamKeys);
}
return object;
}
use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server by youngmonkeys.
the class EzyUserLoginEventImplTest method test.
@SuppressWarnings("unchecked")
@Test
public void test() {
EzyArray data = newArrayBuilder().build();
data.add("123.abc");
EzyObject output2 = newObjectBuilder().append("2", "b").build();
EzyUserLoginEvent event = new EzySimpleUserLoginEvent(null, "zone", "dungtv", "123", data);
assert event.getData() == data;
assert event.getUsername().equals("dungtv");
assert event.getPassword().equals("123");
assert event.getOutput() == null;
event.setUsername("new login name");
event.setPassword("new password");
event.setOutput(output2);
assert event.getUsername().equals("new login name");
assert event.getPassword().equals("new password");
assert event.getOutput() == output2;
event.setUserProperty("id", 1);
event.setUserProperties(EzyMapBuilder.mapBuilder().build());
assert event.getUserProperties().size() == 1;
event.setStreamingEnable(true);
assert event.isStreamingEnable();
assert event.getZoneName().equals("zone");
event = new EzySimpleUserLoginEvent(null, null, null, null, null);
assert event.getUsername().equals("");
assert event.getPassword().equals("");
}
use of com.tvd12.ezyfox.entity.EzyObject in project ezyfox-server-android-client by youngmonkeys.
the class EzyObjectToMap method toMap.
@SuppressWarnings({ "rawtypes", "unchecked" })
public Map toMap(EzyObject object) {
Map answer = new HashMap<>();
for (Object key : object.keySet()) {
Object value = object.get(key);
Object skey = key;
EzyArrayToList arrayToList = EzyArrayToList.getInstance();
if (key instanceof EzyArray)
skey = arrayToList.toList((EzyArray) key);
else if (key instanceof EzyObject)
skey = toMap((EzyObject) key);
Object svalue = value;
if (value != null) {
if (value instanceof EzyArray)
svalue = arrayToList.toList((EzyArray) value);
if (value instanceof EzyObject)
svalue = toMap((EzyObject) value);
}
answer.put(skey, svalue);
}
return answer;
}
use of com.tvd12.ezyfox.entity.EzyObject in project dahlia by youngmonkeys.
the class LocalCollection method findOne.
@Override
public EzyObject findOne(EzyObject query) {
CommandFindOne command = new CommandFindOne(store.getId(), query);
EzyObject result = commandExecutor.execute(command);
return result;
}
Aggregations