Search in sources :

Example 1 with ConsoleMonitor

use of org.datatransferproject.launcher.monitor.ConsoleMonitor in project data-transfer-project by google.

the class MicrosoftPhotosImporterTest method setUp.

@Before
public void setUp() throws IOException {
    executor = new FakeIdempotentImportExecutor();
    authData = mock(TokensAndUrlAuthData.class);
    client = mock(OkHttpClient.class);
    objectMapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    // mocked on a per test basis
    jobStore = mock(TemporaryPerJobDataStore.class);
    monitor = new ConsoleMonitor(ConsoleMonitor.Level.INFO);
    credentialFactory = mock(MicrosoftCredentialFactory.class);
    credential = new Credential.Builder(BearerToken.authorizationHeaderAccessMethod()).build();
    when(credentialFactory.createCredential(any())).thenReturn(credential);
    when(credentialFactory.refreshCredential(any())).thenReturn(credential);
    credential.setAccessToken("acc");
    credential.setExpirationTimeMilliseconds(null);
    importer = new MicrosoftPhotosImporter(BASE_URL, client, objectMapper, jobStore, monitor, credentialFactory);
}
Also used : ConsoleMonitor(org.datatransferproject.launcher.monitor.ConsoleMonitor) TemporaryPerJobDataStore(org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore) OkHttpClient(okhttp3.OkHttpClient) FakeIdempotentImportExecutor(org.datatransferproject.test.types.FakeIdempotentImportExecutor) TokensAndUrlAuthData(org.datatransferproject.types.transfer.auth.TokensAndUrlAuthData) MicrosoftCredentialFactory(org.datatransferproject.transfer.microsoft.common.MicrosoftCredentialFactory) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Before(org.junit.Before)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 OkHttpClient (okhttp3.OkHttpClient)1 ConsoleMonitor (org.datatransferproject.launcher.monitor.ConsoleMonitor)1 TemporaryPerJobDataStore (org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore)1 FakeIdempotentImportExecutor (org.datatransferproject.test.types.FakeIdempotentImportExecutor)1 MicrosoftCredentialFactory (org.datatransferproject.transfer.microsoft.common.MicrosoftCredentialFactory)1 TokensAndUrlAuthData (org.datatransferproject.types.transfer.auth.TokensAndUrlAuthData)1 Before (org.junit.Before)1