use of com.roof.chain.api.ValueStack in project roof-im by madfroglx.
the class MessageTest method testSuccess.
@Test
public void testSuccess() throws Exception {
online("bcd");
online("abc");
MessageRequest messageRequest = new MessageRequest();
messageRequest.setRequestType("message");
messageRequest.setToken("abc");
messageRequest.setReceiver("abc");
messageRequest.setType(ContentType.TXT);
messageRequest.setClientType(ClientType.h5.name());
messageRequest.setCreateTime(System.currentTimeMillis());
messageRequest.setPayload("test");
System.out.println(JSON.toJSONString(messageRequest));
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(messageRequest));
valueStack.set(ImConstant.CONNECT_ID, "1");
JSONObject jsonObjectMessage = JSON.parseObject(JSON.toJSONString(messageRequest));
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
enterChain.doChain(valueStack);
}
use of com.roof.chain.api.ValueStack in project roof-im by madfroglx.
the class OfflineTest method testUserNotOnline.
@Test
public void testUserNotOnline() throws Exception {
OfflineRequest offlineRequest = createRequest();
ValueStack valueStack = createValueStack(offlineRequest);
enterChain.doChain(valueStack);
}
use of com.roof.chain.api.ValueStack in project roof-im by madfroglx.
the class OfflineTest method createValueStack.
private ValueStack createValueStack(OfflineRequest offlineRequest) {
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(offlineRequest));
valueStack.set(ImConstant.CONNECT_ID, "1");
JSONObject jsonObjectMessage = JSON.parseObject(JSON.toJSONString(offlineRequest));
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
return valueStack;
}
use of com.roof.chain.api.ValueStack in project roof-im by madfroglx.
the class CloseSessionTest method testSuccess.
@Test
public void testSuccess() throws Exception {
Session session = sessionManager.open("abc", "efg", 0, 99);
CloseSessionRequest request = new CloseSessionRequest();
request.setSessionId(session.getId());
request.setRequestType(RequestType.closeSession.name());
request.setToken("abc");
ValueStack valueStack = getValueStack(request);
enterChain.doChain(valueStack);
}
use of com.roof.chain.api.ValueStack in project roof-im by madfroglx.
the class CloseSessionTest method getValueStack.
private ValueStack getValueStack(CloseSessionRequest request) {
ValueStack valueStack = new GenericValueStack();
valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(request));
JSONObject jsonObjectMessage = JSON.parseObject(JSON.toJSONString(request));
valueStack.set(ImConstant.JSON_OBJECT_MESSAGE, jsonObjectMessage);
return valueStack;
}
Aggregations