Package com.ripariandata.timberwolf.mail.exchange.SyncFolderItemsHelper

Examples of com.ripariandata.timberwolf.mail.exchange.SyncFolderItemsHelper.SyncFolderItemsResult


        Configuration config = new Configuration(DEFAULT_MAX_ENTRIES, 0);
        SyncFolderItemsType syncItems = SyncFolderItemsHelper.getSyncFolderItemsRequest(config, folderContext);
        when(getService().syncFolderItems(likeThis(syncItems), eq(getDefaultUser()))).thenReturn(null);
        try
        {
            SyncFolderItemsResult result =
                    SyncFolderItemsHelper.syncFolderItems(getService(), config, folderContext);
            fail("No exception was thrown.");
        }
        catch (ServiceCallException e)
        {
View Full Code Here


    public void testSyncFolderItemsRespond0() throws ServiceCallException, HttpErrorException
    {
        String[] ids = new String[0];
        final String myNewSyncState = "MyNewSyncState";
        mockSyncFolderItems(ids, myNewSyncState);
        SyncFolderItemsResult result = SyncFolderItemsHelper
                .syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        assertEquals(0, result.getIds().size());
        assertTrue(result.includesLastItem());
        assertEquals("", getDefaultFolder().getSyncStateToken());
        assertEquals(myNewSyncState, result.getSyncState());
    }
View Full Code Here

        String[] ids = new String[]{"onlyId"};
        final String oldSyncState = "oldSyncState";
        final String newSyncState = "MySweetNewSyncState";
        getDefaultFolder().setSyncStateToken(oldSyncState);
        mockSyncFolderItems(ids, newSyncState);
        SyncFolderItemsResult result =
                SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        Vector<String> expected = new Vector<String>(1);
        expected.add("onlyId");
        assertEquals(expected, result.getIds());
        assertTrue(result.includesLastItem());
        assertEquals(oldSyncState, getDefaultFolder().getSyncStateToken());
        assertEquals(newSyncState, result.getSyncState());
    }
View Full Code Here

        List<String> ids = generateIds(0, count, getDefaultFolderId());
        final String oldSyncState = "oldSyncState";
        final String newSyncState = "MySweetNewSyncState";
        getDefaultFolder().setSyncStateToken(oldSyncState);
        mockSyncFolderItems(ids.toArray(new String[ids.size()]), newSyncState);
        SyncFolderItemsResult result =
                SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        assertEquals(ids, result.getIds());
        assertTrue(result.includesLastItem());
        assertEquals(oldSyncState, getDefaultFolder().getSyncStateToken());
        assertEquals(newSyncState, result.getSyncState());
    }
View Full Code Here

    {
        MessageType[] messages = new MessageType[0];
        final String myNewSyncState = "MyNewSyncState";
        mockSyncFolderItems(messages, getDefaultFolder(),
                            getDefaultConfig().getIdPageSize(), myNewSyncState, false);
        SyncFolderItemsResult result = SyncFolderItemsHelper
                .syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        assertEquals(0, result.getIds().size());
        assertFalse(result.includesLastItem());
        assertEquals("", getDefaultFolder().getSyncStateToken());
        assertEquals(myNewSyncState, result.getSyncState());
    }
View Full Code Here

        final String oldSyncState = "oldSyncState";
        final String newSyncState = "MySweetNewSyncState";
        getDefaultFolder().setSyncStateToken(oldSyncState);
        mockSyncFolderItems(messages, getDefaultFolder(), getDefaultConfig().getIdPageSize(),
                            newSyncState, false);
        SyncFolderItemsResult result =
                SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        assertEquals(ids, result.getIds());
        assertFalse(result.includesLastItem());
        assertEquals(oldSyncState, getDefaultFolder().getSyncStateToken());
        assertEquals(newSyncState, result.getSyncState());
    }
View Full Code Here

        when(getService().syncFolderItems(likeThis(syncItems), eq(getDefaultFolder().getUser()))).
                thenReturn(syncItemsResponse);
        when(syncItemsResponse.getResponseMessages()).thenReturn(arrayOfResponseMessages);
        when(arrayOfResponseMessages.getSyncFolderItemsResponseMessageArray())
                .thenReturn(new SyncFolderItemsResponseMessageType[]{});
        SyncFolderItemsResult result = SyncFolderItemsHelper
                .syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        assertEquals(0, result.getIds().size());
        assertTrue(result.includesLastItem());
        assertEquals(oldState, getDefaultFolder().getSyncStateToken());
    }
View Full Code Here

        when(arrayOfResponseMessages.getSyncFolderItemsResponseMessageArray())
                .thenReturn(new SyncFolderItemsResponseMessageType[]{syncFolderItemsResponseMessage});
        when(syncFolderItemsResponseMessage.getResponseCode()).thenReturn(ResponseCodeType.ERROR_ACCESS_DENIED);
        try
        {
            SyncFolderItemsResult result = SyncFolderItemsHelper
                    .syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
            fail("No exception was thrown");
        }
        catch (ServiceCallException e)
        {
View Full Code Here

        when(syncFolderItemsResponseMessage.getSyncState()).thenReturn(newSyncState);
        when(syncFolderItemsResponseMessage.isSetChanges()).thenReturn(true);
        when(syncFolderItemsResponseMessage.getChanges()).thenReturn(syncFolderItemsChanges);
        SyncFolderItemsCreateOrUpdateType[] creates = createSyncFolderItemsCreateArray(ids);
        when(syncFolderItemsChanges.getCreateArray()).thenReturn(creates);
        SyncFolderItemsResult result =
                SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        Vector<String> expected = new Vector<String>(1);
        expected.add("onlyId");
        assertEquals(expected, result.getIds());
        assertFalse(result.includesLastItem());
        assertEquals(oldSyncState, getDefaultFolder().getSyncStateToken());
        assertEquals(newSyncState, result.getSyncState());
    }
View Full Code Here

        when(syncFolderItemsResponseMessage.isSetSyncState()).thenReturn(false);
        when(syncFolderItemsResponseMessage.isSetChanges()).thenReturn(true);
        when(syncFolderItemsResponseMessage.getChanges()).thenReturn(syncFolderItemsChanges);
        SyncFolderItemsCreateOrUpdateType[] creates = createSyncFolderItemsCreateArray(ids);
        when(syncFolderItemsChanges.getCreateArray()).thenReturn(creates);
        SyncFolderItemsResult result =
                SyncFolderItemsHelper.syncFolderItems(getService(), getDefaultConfig(), getDefaultFolder());
        Vector<String> expected = new Vector<String>(1);
        expected.add("onlyId");
        assertEquals(expected, result.getIds());
        assertFalse(result.includesLastItem());
        assertEquals(oldSyncState, getDefaultFolder().getSyncStateToken());
        assertEquals(oldSyncState, result.getSyncState());
    }
View Full Code Here

TOP

Related Classes of com.ripariandata.timberwolf.mail.exchange.SyncFolderItemsHelper.SyncFolderItemsResult

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.