Search in sources :

Example 1 with AuthTestDriver

use of org.datatransferproject.auth.microsoft.harness.AuthTestDriver in project data-transfer-project by google.

the class LocalImportTestRunner method main.

@SuppressWarnings("unchecked")
public static void main(String... args) throws Exception {
    AuthTestDriver authTestDriver = new AuthTestDriver();
    MicrosoftTransferExtension serviceProvider = new MicrosoftTransferExtension();
    TokenAuthData token = authTestDriver.getOAuthTokenCode();
    Importer<TokenAuthData, ContactsModelWrapper> contacts = (Importer<TokenAuthData, ContactsModelWrapper>) serviceProvider.getImporter("CONTACTS");
    ContactsModelWrapper wrapper = new ContactsModelWrapper(createCards());
    FakeIdempotentImportExecutor executor = new FakeIdempotentImportExecutor();
    ImportResult result = contacts.importItem(UUID.randomUUID(), executor, token, wrapper);
}
Also used : ImportResult(org.datatransferproject.spi.transfer.provider.ImportResult) TokenAuthData(org.datatransferproject.types.transfer.auth.TokenAuthData) FakeIdempotentImportExecutor(org.datatransferproject.test.types.FakeIdempotentImportExecutor) MicrosoftTransferExtension(org.datatransferproject.transfer.microsoft.MicrosoftTransferExtension) ContactsModelWrapper(org.datatransferproject.types.common.models.contacts.ContactsModelWrapper) AuthTestDriver(org.datatransferproject.auth.microsoft.harness.AuthTestDriver) Importer(org.datatransferproject.spi.transfer.provider.Importer)

Example 2 with AuthTestDriver

use of org.datatransferproject.auth.microsoft.harness.AuthTestDriver in project data-transfer-project by google.

the class LocalExportTestRunner method main.

@SuppressWarnings("unchecked")
public static void main(String... args) throws Exception {
    AuthTestDriver authTestDriver = new AuthTestDriver();
    MicrosoftTransferExtension serviceProvider = new MicrosoftTransferExtension();
    TokenAuthData token = authTestDriver.getOAuthTokenCode();
    Exporter<TokenAuthData, ContactsModelWrapper> contacts = (Exporter<TokenAuthData, ContactsModelWrapper>) serviceProvider.getExporter("CONTACTS");
    ExportResult<ContactsModelWrapper> wrapper = contacts.export(UUID.randomUUID(), token, Optional.empty());
}
Also used : TokenAuthData(org.datatransferproject.types.transfer.auth.TokenAuthData) MicrosoftTransferExtension(org.datatransferproject.transfer.microsoft.MicrosoftTransferExtension) ContactsModelWrapper(org.datatransferproject.types.common.models.contacts.ContactsModelWrapper) AuthTestDriver(org.datatransferproject.auth.microsoft.harness.AuthTestDriver) Exporter(org.datatransferproject.spi.transfer.provider.Exporter)

Aggregations

AuthTestDriver (org.datatransferproject.auth.microsoft.harness.AuthTestDriver)2 MicrosoftTransferExtension (org.datatransferproject.transfer.microsoft.MicrosoftTransferExtension)2 ContactsModelWrapper (org.datatransferproject.types.common.models.contacts.ContactsModelWrapper)2 TokenAuthData (org.datatransferproject.types.transfer.auth.TokenAuthData)2 Exporter (org.datatransferproject.spi.transfer.provider.Exporter)1 ImportResult (org.datatransferproject.spi.transfer.provider.ImportResult)1 Importer (org.datatransferproject.spi.transfer.provider.Importer)1 FakeIdempotentImportExecutor (org.datatransferproject.test.types.FakeIdempotentImportExecutor)1