Search in sources :

Example 1 with MessageRequest

use of org.roof.im.request.MessageRequest in project roof-im by madfroglx.

the class MessageRequestTest method testSuccess.

@Test
public void testSuccess() throws Exception {
    online("bcd");
    MessageRequest messageRequest = new MessageRequest();
    messageRequest.setRequestType("message");
    messageRequest.setToken("abc");
    messageRequest.setReceiver("bcd");
    messageRequest.setType(ContentType.TXT);
    messageRequest.setClientType(ClientType.h5.name());
    messageRequest.setCreateTime(System.currentTimeMillis());
    messageRequest.setPayload("test");
    ValueStack valueStack = new GenericValueStack();
    valueStack.set(ImConstant.TEXT_MESSAGE, JSON.toJSONString(messageRequest));
    valueStack.set(ImConstant.CONNECT_ID, "1");
    valueStack.set("messageRequest", messageRequest);
    messageRequestChain.doChain(valueStack);
}
Also used : MessageRequest(org.roof.im.request.MessageRequest) ValueStack(com.roof.chain.api.ValueStack) GenericValueStack(com.roof.chain.support.GenericValueStack) GenericValueStack(com.roof.chain.support.GenericValueStack) Test(org.junit.Test)

Example 2 with MessageRequest

use of org.roof.im.request.MessageRequest 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);
}
Also used : MessageRequest(org.roof.im.request.MessageRequest) ValueStack(com.roof.chain.api.ValueStack) GenericValueStack(com.roof.chain.support.GenericValueStack) JSONObject(com.alibaba.fastjson.JSONObject) GenericValueStack(com.roof.chain.support.GenericValueStack) Test(org.junit.Test)

Aggregations

ValueStack (com.roof.chain.api.ValueStack)2 GenericValueStack (com.roof.chain.support.GenericValueStack)2 Test (org.junit.Test)2 MessageRequest (org.roof.im.request.MessageRequest)2 JSONObject (com.alibaba.fastjson.JSONObject)1