use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class SearchMetadataTest method populateThreadsListFromServerOnly.
// requests for list of threads from server
@Test
public void populateThreadsListFromServerOnly() {
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());
resumeProcess();
}
}
};
chat.setListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).withNoCache().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 TextMessagesQueueTest method populateThreadsListFromServerOnly.
// requests for list of threads from server
public void populateThreadsListFromServerOnly() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> response) {
if (!response.isCache()) {
System.out.println("Received List: " + content);
threads.addAll(response.getResult().getThreads().stream().filter(thread -> thread.getTitle() != null && thread.getId() > 0 && !thread.isClosed() && thread.getLastMessageVO() != null).collect(Collectors.toList()));
chat.removeListener(chatListeners);
resumeProcess();
}
}
};
chat.setListener(chatListeners);
RequestThread requestThread = new RequestThread.Builder().count(25).withNoCache().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 ChatTestIntegration 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());
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class ThreadCacheTest method populateThreadsFromServer.
public void populateThreadsFromServer() {
chatListeners = new ChatListener() {
@Override
public void onGetThread(String content, ChatResponse<ResultThreads> thread) {
assert thread.getResult().getThreads().size() > 0;
if (!thread.isCache()) {
threadsInServer.addAll(new ArrayList<>(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();
sleep(2500);
long t2 = System.currentTimeMillis();
System.out.println("Received List: " + threadsInServer.size() + " after: " + (t2 - t1) + " ms");
}
use of com.fanap.podchat.model.ResultThreads in project pod-chat-android-sdk by FanapSoft.
the class IntegrationTest method populateThreadsListFromServerOrCache.
// requests for list of threads
@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());
}
};
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");
}
Aggregations