Search in sources :

Example 6 with ExportInformation

use of org.dataportabilityproject.spi.transfer.types.ExportInformation in project data-transfer-project by google.

the class GoogleContactsExporterTest method exportSubsequentPage.

@Test
public void exportSubsequentPage() throws IOException {
    setUpSinglePersonResponse();
    // Looking at a subsequent page, with no pages after it
    PaginationData paginationData = new StringPaginationToken(NEXT_PAGE_TOKEN);
    ExportInformation exportInformation = new ExportInformation(paginationData, null);
    listConnectionsResponse.setNextPageToken(null);
    when(listConnectionsRequest.setPageToken(NEXT_PAGE_TOKEN)).thenReturn(listConnectionsRequest);
    // Run test
    ExportResult<ContactsModelWrapper> result = contactsService.export(UUID.randomUUID(), null, exportInformation);
    // Verify correct calls were made - i.e., token was added before execution
    InOrder inOrder = Mockito.inOrder(listConnectionsRequest);
    inOrder.verify(listConnectionsRequest).setPageToken(NEXT_PAGE_TOKEN);
    inOrder.verify(listConnectionsRequest).execute();
    // Check continuation data
    ContinuationData continuationData = (ContinuationData) result.getContinuationData();
    assertThat(continuationData.getContainerResources()).isEmpty();
    assertThat(continuationData.getPaginationData()).isNull();
}
Also used : ExportInformation(org.dataportabilityproject.spi.transfer.types.ExportInformation) PaginationData(org.dataportabilityproject.spi.transfer.types.PaginationData) InOrder(org.mockito.InOrder) ContinuationData(org.dataportabilityproject.spi.transfer.types.ContinuationData) ContactsModelWrapper(org.dataportabilityproject.types.transfer.models.contacts.ContactsModelWrapper) StringPaginationToken(org.dataportabilityproject.spi.transfer.types.StringPaginationToken) Test(org.junit.Test)

Example 7 with ExportInformation

use of org.dataportabilityproject.spi.transfer.types.ExportInformation in project data-transfer-project by google.

the class PortabilityInMemoryDataCopier method copy.

/**
 * Kicks off transfer job {@code jobId} from {@code exporter} to {@code importer}.
 */
@Override
public void copy(AuthData exportAuthData, AuthData importAuthData, UUID jobId) throws IOException {
    // Initial copy, starts off the process with no previous paginationData or containerResource
    // information
    ExportInformation emptyExportInfo = new ExportInformation(null, null);
    copyHelper(jobId, exportAuthData, importAuthData, emptyExportInfo);
}
Also used : ExportInformation(org.dataportabilityproject.spi.transfer.types.ExportInformation)

Aggregations

ExportInformation (org.dataportabilityproject.spi.transfer.types.ExportInformation)7 ContinuationData (org.dataportabilityproject.spi.transfer.types.ContinuationData)6 Test (org.junit.Test)5 StringPaginationToken (org.dataportabilityproject.spi.transfer.types.StringPaginationToken)4 IdOnlyContainerResource (org.dataportabilityproject.spi.transfer.types.IdOnlyContainerResource)3 PaginationData (org.dataportabilityproject.spi.transfer.types.PaginationData)3 ContainerResource (org.dataportabilityproject.types.transfer.models.ContainerResource)3 CalendarContainerResource (org.dataportabilityproject.types.transfer.models.calendar.CalendarContainerResource)3 InOrder (org.mockito.InOrder)3 Photo (com.flickr4java.flickr.photos.Photo)1 PhotoList (com.flickr4java.flickr.photos.PhotoList)1 IntPaginationToken (org.dataportabilityproject.spi.transfer.types.IntPaginationToken)1 TokenSecretAuthData (org.dataportabilityproject.types.transfer.auth.TokenSecretAuthData)1 CalendarEventModel (org.dataportabilityproject.types.transfer.models.calendar.CalendarEventModel)1 ContactsModelWrapper (org.dataportabilityproject.types.transfer.models.contacts.ContactsModelWrapper)1 PhotosContainerResource (org.dataportabilityproject.types.transfer.models.photos.PhotosContainerResource)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Token (org.scribe.model.Token)1