Search in sources :

Example 1 with ImgurPhotosExporter

use of org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosExporter in project data-transfer-project by google.

the class ImgurTransferExtension method initialize.

@Override
public void initialize(ExtensionContext context) {
    Monitor monitor = context.getMonitor();
    if (initialized) {
        monitor.severe(() -> "ImgurTransferExtension is already initialized");
        return;
    }
    ObjectMapper mapper = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    OkHttpClient client = context.getService(OkHttpClient.class);
    TemporaryPerJobDataStore jobStore = context.getService(TemporaryPerJobDataStore.class);
    exporter = new ImgurPhotosExporter(monitor, client, mapper, jobStore, BASE_URL);
    importer = new ImgurPhotosImporter(monitor, client, mapper, jobStore, BASE_URL);
    initialized = true;
}
Also used : TemporaryPerJobDataStore(org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore) Monitor(org.datatransferproject.api.launcher.Monitor) OkHttpClient(okhttp3.OkHttpClient) ImgurPhotosImporter(org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosImporter) ImgurPhotosExporter(org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosExporter) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 2 with ImgurPhotosExporter

use of org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosExporter in project data-transfer-project by google.

the class ImgurPhotoExporterTest method setUp.

@Before
public void setUp() throws IOException {
    server = new MockWebServer();
    server.start();
    exporter = new ImgurPhotosExporter(monitor, client, mapper, jobStore, server.url("").toString());
}
Also used : MockWebServer(com.squareup.okhttp.mockwebserver.MockWebServer) ImgurPhotosExporter(org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosExporter) Before(org.junit.Before)

Aggregations

ImgurPhotosExporter (org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosExporter)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 MockWebServer (com.squareup.okhttp.mockwebserver.MockWebServer)1 OkHttpClient (okhttp3.OkHttpClient)1 Monitor (org.datatransferproject.api.launcher.Monitor)1 ImgurPhotosImporter (org.datatransferproject.datatransfer.imgur.photos.ImgurPhotosImporter)1 TemporaryPerJobDataStore (org.datatransferproject.spi.cloud.storage.TemporaryPerJobDataStore)1 Before (org.junit.Before)1