use of org.datatransferproject.cloud.local.LocalJobStore in project data-transfer-project by google.
the class JobPollingServiceTest method setUp.
@Before
public void setUp() {
store = new LocalJobStore();
PublicKeySerializer serializer = new PublicKeySerializer() {
@Override
public boolean canHandle(String scheme) {
return true;
}
@Override
public String serialize(byte[] encodedPublicKey) throws SecurityException {
return "key";
}
};
Scheduler scheduler = Scheduler.newFixedDelaySchedule(0, 20, TimeUnit.SECONDS);
Monitor monitor = new Monitor() {
};
ExtensionContext extensionContext = mock(ExtensionContext.class);
when(extensionContext.getSetting("credTimeoutSeconds", 300)).thenReturn(300);
jobPollingService = new JobPollingService(store, asymmetricKeyGenerator, serializer, scheduler, monitor, extensionContext);
}
use of org.datatransferproject.cloud.local.LocalJobStore in project data-transfer-project by google.
the class GooglePhotosImporterTest method setUp.
@Before
public void setUp() throws IOException, InvalidTokenException, PermissionDeniedException {
googlePhotosInterface = Mockito.mock(GooglePhotosInterface.class);
monitor = Mockito.mock(Monitor.class);
executor = new InMemoryIdempotentImportExecutor(monitor);
Mockito.when(googlePhotosInterface.makePostRequest(anyString(), any(), any(), eq(NewMediaItemResult.class))).thenReturn(Mockito.mock(NewMediaItemResult.class));
JobStore jobStore = new LocalJobStore();
InputStream inputStream = Mockito.mock(InputStream.class);
imageStreamProvider = Mockito.mock(ImageStreamProvider.class);
HttpURLConnection conn = Mockito.mock(HttpURLConnection.class);
Mockito.when(imageStreamProvider.getConnection(anyString())).thenReturn(conn);
Mockito.when(conn.getInputStream()).thenReturn(inputStream);
Mockito.when(conn.getContentLengthLong()).thenReturn(32L);
googlePhotosImporter = new GooglePhotosImporter(null, jobStore, null, null, googlePhotosInterface, imageStreamProvider, monitor, 1.0);
}
Aggregations