Search in sources :

Example 36 with Thread

use of com.fanap.podchat.mainmodel.Thread in project pod-chat-android-sdk by FanapSoft.

the class AssistantCacheTest method populateMessagesFromCache.

public void populateMessagesFromCache() {
    populateThreadsListFromServerOnly();
    assert threads.size() > 0;
    Thread thread = threads.get(0);
    chatListeners = new ChatListener() {

        @Override
        public void onGetHistory(String content, ChatResponse<ResultHistory> history) {
            if (history.isCache()) {
                print("Received Message List Cache: " + content);
                threadMessagesList.addAll(history.getResult().getHistory());
                chat.removeListener(chatListeners);
                resumeProcess();
            }
        }
    };
    chat.addListener(chatListeners);
    RequestGetHistory requestGetHistory = new RequestGetHistory.Builder(thread.getId()).build();
    chat.getHistory(requestGetHistory, null);
    pauseProcess();
}
Also used : RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) ChatListener(com.fanap.podchat.chat.ChatListener) ResultHistory(com.fanap.podchat.model.ResultHistory) Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread)

Example 37 with Thread

use of com.fanap.podchat.mainmodel.Thread in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method getAllThreadsHistories.

@Test
@LargeTest
public // performance should be acceptable
void getAllThreadsHistories() {
    populateThreadsListFromServerOrCache();
    long startTime = System.currentTimeMillis();
    for (Thread thread : new ArrayList<>(threads)) {
        System.out.println("NEXT: " + thread.getTitle());
        System.out.println(thread.getId());
        getThreadFullHistory(thread);
    }
    // getThreadFullHistory(threads.get(0));
    long endTime = System.currentTimeMillis();
    Assert.assertTrue(true);
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println("TEST IS DONE FOR ");
    System.out.println(threads.size());
    System.out.println("THREADS IN");
    System.out.println(endTime - startTime + " MILLISECONDS");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
}
Also used : ArrayList(java.util.ArrayList) Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Example 38 with Thread

use of com.fanap.podchat.mainmodel.Thread in project pod-chat-android-sdk by FanapSoft.

the class ChatTestIntegration method getUserRolesInThread.

@Test
@LargeTest
public void getUserRolesInThread() {
    populateThreadsListFromServerOrCache();
    for (Thread t : threads) {
        if (t.getAdmin()) {
            System.out.println("Get roles in " + t.getId());
            getCurrentUserRoles(t.getId());
            break;
        }
    }
    System.out.println("** Get roles in " + threads.get(0).getId());
    getCurrentUserRoles(threads.get(0).getId());
}
Also used : Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Example 39 with Thread

use of com.fanap.podchat.mainmodel.Thread in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method getThreadHistoryIns.

@Test
@LargeTest
public void getThreadHistoryIns() {
    populateThreadsListFromServerOrCache();
    System.out.println("** Get history of " + threads.get(0).getId());
    for (Thread thread : new ArrayList<>(threads)) {
        getThreadHistory(thread.getId());
    }
// getThreadHistory(threads.get(0).getId());
}
Also used : ArrayList(java.util.ArrayList) Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Example 40 with Thread

use of com.fanap.podchat.mainmodel.Thread in project pod-chat-android-sdk by FanapSoft.

the class ChatTestSandbox method getAllThreadsHistories.

@Test
@LargeTest
public // performance should be acceptable
void getAllThreadsHistories() {
    populateThreadsListFromServerOrCache();
    long startTime = System.currentTimeMillis();
    for (Thread thread : new ArrayList<>(threads)) {
        System.out.println("NEXT: " + thread.getTitle());
        System.out.println(thread.getId());
        getThreadFullHistory(thread);
    }
    // getThreadFullHistory(threads.get(0));
    long endTime = System.currentTimeMillis();
    Assert.assertTrue(true);
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println("TEST IS DONE FOR ");
    System.out.println(threads.size());
    System.out.println("THREADS IN");
    System.out.println(endTime - startTime + " MILLISECONDS");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
    System.out.println(">>> >>> >>>");
}
Also used : ArrayList(java.util.ArrayList) Thread(com.fanap.podchat.mainmodel.Thread) RequestThread(com.fanap.podchat.requestobject.RequestThread) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) LargeTest(android.support.test.filters.LargeTest)

Aggregations

Thread (com.fanap.podchat.mainmodel.Thread)95 RequestThread (com.fanap.podchat.requestobject.RequestThread)79 Test (org.junit.Test)55 ChatListener (com.fanap.podchat.chat.ChatListener)53 ArrayList (java.util.ArrayList)42 ResultHistory (com.fanap.podchat.model.ResultHistory)36 LargeTest (android.support.test.filters.LargeTest)35 RequestMessage (com.fanap.podchat.requestobject.RequestMessage)33 Date (java.util.Date)30 ChatResponse (com.fanap.podchat.model.ChatResponse)22 RequestGetHistory (com.fanap.podchat.requestobject.RequestGetHistory)22 MessageVO (com.fanap.podchat.mainmodel.MessageVO)20 SearchSystemMetadataRequest (com.fanap.podchat.chat.messge.SearchSystemMetadataRequest)16 NosqlSearchMetadataCriteria (com.fanap.podchat.mainmodel.NosqlSearchMetadataCriteria)16 ResultNewMessage (com.fanap.podchat.model.ResultNewMessage)16 ResultThreads (com.fanap.podchat.model.ResultThreads)16 FlakyTest (android.support.test.filters.FlakyTest)14 MediumTest (android.support.test.filters.MediumTest)14 Activity (android.app.Activity)10 Context (android.content.Context)10