use of com.fanap.podchat.mainmodel.MessageVO in project pod-chat-android-sdk by FanapSoft.
the class MentionCacheTest method checkMentionsAreSameInCacheAndServer.
public void checkMentionsAreSameInCacheAndServer() {
Assert.assertEquals(threadMentionMessagesListInCache.size(), threadMentionMessagesListInServer.size());
Assert.assertEquals(threadMentionMessagesListInCache.size() > 0, threadMentionMessagesListInServer.size() > 0);
for (MessageVO msg : threadMentionMessagesListInServer) {
if (msg.getMessage() == null)
continue;
MessageVO msgInCache = threadMentionMessagesListInCache.stream().filter(messageVO -> messageVO.getId() == msg.getId()).findFirst().get();
System.out.println(">>>>>>>>>>> Server Mention Message " + msg.getMessage());
System.out.println(">>>>>>>>>>> Cache Mention Message " + msgInCache.getMessage());
Assert.assertEquals(msg.getMessage(), msgInCache.getMessage());
Assert.assertEquals(msg.getId(), msgInCache.getId());
}
}
use of com.fanap.podchat.mainmodel.MessageVO in project pod-chat-android-sdk by FanapSoft.
the class DbTest method updateCacheFirstMsgIdAndLastMsgIdConditional2.
// first messsage and last message
// Conditional 2
// cache siz more than one but server size is 1
@Test
public void updateCacheFirstMsgIdAndLastMsgIdConditional2() {
long threadId = 2;
Callback callback = new Callback();
List<MessageVO> messageVOS = new ArrayList<>();
// MessageVO messageVO = new MessageVO(
// 5653,
// false,
// false,
// false,
// false,
// false,
// "91efe7da-547f-4c5f-c34b-0442951ffbbc",
// 0,
// 5652,
// "",
// null,
// 13354321,
// 321000000,
// "",
// null,
// null,
// null,
// null
//
// );
List<CacheMessageVO> cacheMessageVOS = new ArrayList<>();
CacheMessageVO cacheMessageVO = new CacheMessageVO();
cacheMessageVO.setId(5878);
cacheMessageVO.setThreadVoId(2L);
cacheMessageVOS.add(cacheMessageVO);
// messageVOS.add(messageVO);
callback.setOffset(0);
callback.setOffset(0);
callback.setCount(50);
callback.setOrder("asc");
callback.setFirstMessageId(5652);
callback.setLastMessageId(5878);
messageDatabaseHelper.updateGetHistoryResponse(callback, messageVOS, threadId, cacheMessageVOS);
}
use of com.fanap.podchat.mainmodel.MessageVO in project pod-chat-android-sdk by FanapSoft.
the class HashTagCacheTest method populateHashTagListFromServer.
public void populateHashTagListFromServer(long threadId) {
threadHashTagMessagesListInServer.clear();
chatListeners = new ChatListener() {
@Override
public void onGetHashTagList(ChatResponse<ResultHistory> response) {
if (!response.isCache()) {
System.out.println("Received HashTag Message List Server: " + response.getJson());
threadHashTagMessagesListInServer.addAll(response.getResult().getHistory().stream().filter(messageVO -> messageVO.getMessage() != null).collect(Collectors.toList()));
chat.removeListener(chatListeners);
resumeProcess();
}
}
};
chat.setListener(chatListeners);
RequestGetHashTagList request = new RequestGetHashTagList.Builder(threadId).offset(0).count(25).setHashtag("test").build();
presenter.getHashTagList(request, null);
pauseProcess();
System.out.println("Received HashTag Message List Server: " + threadHashTagMessagesListInServer.size());
}
use of com.fanap.podchat.mainmodel.MessageVO in project pod-chat-android-sdk by FanapSoft.
the class HashTagCacheTest method checkHashTagsAreSameInCacheAndServer.
public void checkHashTagsAreSameInCacheAndServer() {
Assert.assertEquals(threadHashTagMessagesListInCache.size(), threadHashTagMessagesListInServer.size());
Assert.assertEquals(threadHashTagMessagesListInCache.size() > 0, threadHashTagMessagesListInServer.size() > 0);
for (MessageVO msg : threadHashTagMessagesListInServer) {
if (msg.getMessage() == null)
continue;
MessageVO msgInCache = threadHashTagMessagesListInCache.stream().filter(messageVO -> messageVO.getId() == msg.getId()).findFirst().get();
System.out.println(">>>>>>>>>>> Server HashTag Message " + msg.getMessage());
System.out.println(">>>>>>>>>>> Cache HashTag Message " + msgInCache.getMessage());
Assert.assertEquals(msg.getMessage(), msgInCache.getMessage());
Assert.assertEquals(msg.getId(), msgInCache.getId());
}
}
use of com.fanap.podchat.mainmodel.MessageVO in project pod-chat-android-sdk by FanapSoft.
the class HashTagCacheTest method populateHashTagListFromCache.
public void populateHashTagListFromCache(long threadId) {
threadHashTagMessagesListInCache.clear();
chatListeners = new ChatListener() {
@Override
public void onGetHashTagList(ChatResponse<ResultHistory> response) {
if (response.isCache()) {
System.out.println("Received HashTag Message List Server: " + response.getJson());
threadHashTagMessagesListInCache.addAll(response.getResult().getHistory().stream().filter(messageVO -> messageVO.getMessage() != null).collect(Collectors.toList()));
chat.removeListener(chatListeners);
resumeProcess();
} else {
Assert.assertEquals(5, 10);
resumeProcess();
}
}
};
chat.setListener(chatListeners);
RequestGetHashTagList request = new RequestGetHashTagList.Builder(threadId).offset(0).count(25).setHashtag("test").build();
presenter.getHashTagList(request, null);
pauseProcess();
System.out.println("Received HashTag Message List Server: " + threadHashTagMessagesListInCache.size());
}
Aggregations