Package com.ripariandata.timberwolf.writer

Examples of com.ripariandata.timberwolf.writer.UserFolderSyncStateStorage


        final int idPageSize = 13;
        final int getItemSize = 3;
        Configuration config = new Configuration(idPageSize, getItemSize);
        Assert.assertTrue(config.getSyncStateStorage() instanceof InMemoryUserFolderSyncStateStorage);
        InMemoryUserFolderSyncStateStorage newSyncStorage = new InMemoryUserFolderSyncStateStorage();
        final UserFolderSyncStateStorage oldSyncStateStorage = config.getSyncStateStorage();
        assertNotSame(oldSyncStateStorage, newSyncStorage);
        Configuration newConfig = config.withSyncStateStorage(newSyncStorage);
        assertEquals(idPageSize, newConfig.getIdPageSize());
        assertEquals(getItemSize, newConfig.getItemPageSize());
        assertSame(newSyncStorage, newConfig.getSyncStateStorage());
View Full Code Here


        when(aliceFolder.getFolderId()).thenReturn(aliceId);
        when(aliceId.getId()).thenReturn(aliceFolderId);

        mockFindFolders(new FolderType[]{aliceFolder}, aliceUsername);

        UserFolderSyncStateStorage mockSyncStates = mock(UserFolderSyncStateStorage.class);


        // First call to get mail
        when(mockSyncStates.getLastSyncState(aliceUsername, aliceFolderId)).thenReturn(null);

        MessageType[] firstMessages = mockSyncFolderItems(createMockMessages(aliceFolderId, 0, totalMessageCount),
                                                          folderContext(aliceUsername, aliceFolderId),
                                                          idPageSize, "syncState2", true);
        mockGetItem(firstMessages, generateIds(0, totalMessageCount, aliceFolderId), aliceUsername);


        ArrayList<String> users = new ArrayList<String>();
        users.add(aliceUsername);

        ExchangeMailStore store = new ExchangeMailStore(getService(), idPageSize, getItemPageSize);
        Iterator<MailboxItem> mail = store.getMail(users, mockSyncStates).iterator();
        for (int i = 0; i < totalMessageCount; i++)
        {
            assertTrue(mail.hasNext());
            MailboxItem item = mail.next();
            assertEquals("ALICE-FOLDER:the #" + i + " id", item.getHeader("Item ID"));
        }
        assertFalse(mail.hasNext());
        verify(mockSyncStates).setSyncState(aliceUsername, aliceFolderId, "syncState2");

        when(mockSyncStates.getLastSyncState(aliceUsername, aliceFolderId)).thenReturn("newSyncState");
        MessageType[] newMessages =
                mockSyncFolderItems(createMockMessages(aliceFolderId, 10, 2),
                                    folderContext(aliceUsername, aliceFolderId, "newSyncState"),
                                    idPageSize, "lastSyncState", true);
        mockGetItem(newMessages,
View Full Code Here

    }

    public Integer run()
    {
        MailWriter mailWriter;
        UserFolderSyncStateStorage syncStateStorage;
        HBaseManager hbaseManager = null;
        if (useHBase)
        {
            hbaseManager = new HBaseManager(hbaseQuorum, hbaseclientPort);
            mailWriter = HBaseMailWriter.create(hbaseManager, hbaseTableName, hbaseKeyHeader,
View Full Code Here

TOP

Related Classes of com.ripariandata.timberwolf.writer.UserFolderSyncStateStorage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.