use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class TextMessagesQueueTest method populateThreadsListFromServerOrCache.
// requests for list of threads
public void populateThreadsListFromServerOrCache() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
System.out.println("Received List: " + content);
threads.addAll(thread.getResult().getThreads());
chat.removeListener(chatListeners);
}
};
chat.addListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).build();
presenter.getThreads(requestThread, null);
long t1 = System.currentTimeMillis();
Mockito.verify(view, Mockito.after(10000).atLeastOnce()).onGetThreadList(Mockito.any(), Mockito.any());
long t2 = System.currentTimeMillis();
System.out.println("Received List: " + threads.size() + " after: " + (t2 - t1) + " ms");
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class TextMessagesQueueTest method populateThreadsListFromCacheOnly.
// requests for list of threads from cache
public void populateThreadsListFromCacheOnly() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
if (thread.isCache()) {
System.out.println("Received List: " + content);
threads.addAll(thread.getResult().getThreads());
chat.removeListener(chatListeners);
resumeProcess();
}
}
};
chat.addListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).build();
presenter.getThreads(requestThread, null);
pauseProcess();
System.out.println("Received List: " + threads.size());
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class ThreadCacheTest method populateThreadsFromCache.
public void populateThreadsFromCache() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
if (thread.isCache()) {
threadsInCache.addAll(thread.getResult().getThreads());
chat.removeListener(chatListeners);
} else
Assert.assertEquals(0, 1);
resumeProcess();
}
};
chat.addListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).build();
presenter.getThreads(requestThread, null);
long t1 = System.currentTimeMillis();
pauseProcess();
long t2 = System.currentTimeMillis();
System.out.println("Received List: " + threadsInCache.size() + " after: " + (t2 - t1) + " ms");
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class AssistantCacheTest method populateThreadsListFromServerOrCache.
// ///////////////////////////////////////////////////////////////////////////////
// requests for list of threads
public void populateThreadsListFromServerOrCache() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
print("Received List: " + content);
threads.addAll(thread.getResult().getThreads());
chat.removeListener(chatListeners);
}
};
chat.addListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).build();
presenter.getThreads(requestThread, null);
long t1 = System.currentTimeMillis();
Mockito.verify(view, Mockito.after(10000).atLeastOnce()).onGetThreadList(Mockito.any(), Mockito.any());
long t2 = System.currentTimeMillis();
System.out.println("Received List: " + threads.size() + " after: " + (t2 - t1) + " ms");
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class ChatTestSandbox method populateThreadsListFromServerOrCache.
@Test
public void populateThreadsListFromServerOrCache() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
System.out.println("Received List: " + content);
threads.addAll(thread.getResult().getThreads());
resumeProcess();
}
};
chat.addListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).build();
presenter.getThreads(requestThread, null);
pauseProcess();
System.out.println("Received List: " + threads.size());
}
Aggregations