Search in sources :

Example 1 with History

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

the class LocalChatTest method getHistoryFromTime.

/*old method*/
@Test
@MediumTest
public void getHistoryFromTime() {
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    long threadId = 1288;
    History history = new History.Builder().fromTime(235566).fromTimeNanos(2).build();
    presenter.getHistory(history, threadId, null);
    try {
        Thread.sleep(3000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    Mockito.verify(view, Mockito.times(1)).onGetThreadHistory(Mockito.any());
}
Also used : History(com.fanap.podchat.mainmodel.History) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) MediumTest(android.support.test.filters.MediumTest)

Example 2 with History

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

the class ChatTestIntegration method getThreadHistory.

// Get History
@Test
@MediumTest
public void getThreadHistory() {
    sleep(3000);
    History history = new History.Builder().count(5).build();
    presenter.getHistory(history, 381, null);
    sleep(3000);
    Mockito.verify(view, Mockito.times(1)).onGetThreadHistory(Mockito.any());
}
Also used : ResultHistory(com.fanap.podchat.model.ResultHistory) History(com.fanap.podchat.mainmodel.History) RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Example 3 with History

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

the class ChatTest method getThreadHistory.

// Get History
@Test
@MediumTest
public void getThreadHistory() {
    sleep(3000);
    History history = new History.Builder().count(5).build();
    presenter.getHistory(history, 381, null);
    sleep(3000);
    Mockito.verify(view, Mockito.times(1)).onGetThreadHistory(Mockito.any());
}
Also used : ResultHistory(com.fanap.podchat.model.ResultHistory) History(com.fanap.podchat.mainmodel.History) RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Example 4 with History

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

the class MessageDatabaseHelper method updateGetHistoryResponse.

public void updateGetHistoryResponse(@NonNull Callback callback, @NonNull List<MessageVO> messageVOS, long threadId, @NonNull List<CacheMessageVO> cMessageVOS) {
    worker(() -> {
        long count = callback.getCount();
        long offset = callback.getOffset();
        long firstMessageId = callback.getFirstMessageId();
        long lastMessageId = callback.getLastMessageId();
        long messageId = callback.getMessageId();
        long fromTime = callback.getFromTime();
        long fromTimeNanos = callback.getFromTimeNanos();
        long toTimeNanos = callback.getToTimeNanos();
        long toTime = callback.getToTime();
        String order = callback.getOrder();
        String query = callback.getQuery();
        History history = new History.Builder().id(messageId).count(count).fromTime(fromTime).fromTimeNanos(fromTimeNanos).toTime(toTime).toTimeNanos(toTimeNanos).order(order).offset(offset).query(query).build();
        if (!callback.isMetadataCriteria()) {
            if (order.equals("asc")) {
                whereClauseAsc(history, messageVOS, threadId, cMessageVOS);
            } else {
                whereClauseDesc(history, messageVOS, threadId, cMessageVOS);
            }
        }
    });
}
Also used : ResultHistory(com.fanap.podchat.model.ResultHistory) RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) History(com.fanap.podchat.mainmodel.History)

Example 5 with History

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

the class ChatTestSandbox method getThreadHistory.

// Get History
@Test
@MediumTest
public void getThreadHistory() {
    sleep(3000);
    History history = new History.Builder().count(5).build();
    presenter.getHistory(history, 381, null);
    sleep(3000);
    Mockito.verify(view, Mockito.times(1)).onGetThreadHistory(Mockito.any());
}
Also used : ResultHistory(com.fanap.podchat.model.ResultHistory) History(com.fanap.podchat.mainmodel.History) RequestGetHistory(com.fanap.podchat.requestobject.RequestGetHistory) FlakyTest(android.support.test.filters.FlakyTest) MediumTest(android.support.test.filters.MediumTest) Test(org.junit.Test) LargeTest(android.support.test.filters.LargeTest) MediumTest(android.support.test.filters.MediumTest)

Aggregations

History (com.fanap.podchat.mainmodel.History)5 MediumTest (android.support.test.filters.MediumTest)4 ResultHistory (com.fanap.podchat.model.ResultHistory)4 RequestGetHistory (com.fanap.podchat.requestobject.RequestGetHistory)4 Test (org.junit.Test)4 FlakyTest (android.support.test.filters.FlakyTest)3 LargeTest (android.support.test.filters.LargeTest)3