Search in sources :

Example 1 with GoogleDriveInputReader

use of org.talend.components.google.drive.runtime.data.GoogleDriveInputReader in project components by Talend.

the class GoogleDriveDatasetTestIT method testDatasetRuntime.

@Test
public void testDatasetRuntime() throws Exception {
    GoogleDriveDatasetRuntime rt = new GoogleDriveDatasetRuntime();
    rt.initialize(null, dataset);
    Schema schema = rt.getSchema();
    LOG.debug("schema = {}.", schema);
    assertNotNull(schema);
    counted = 0;
    rt.getSample(LIMIT, new org.talend.daikon.java8.Consumer<IndexedRecord>() {

        @Override
        public void accept(IndexedRecord indexedRecord) {
            counted++;
        }
    });
    assertTrue(LIMIT >= counted);
    GoogleDriveDataSource source = rt.createDataSource(properties);
    GoogleDriveInputReader reader = (GoogleDriveInputReader) source.createReader(null);
    assertTrue(reader.start());
    IndexedRecord record = reader.getCurrent();
    LOG.debug("record = {}.", record);
    while (reader.advance()) {
        assertNotNull(reader.getCurrent());
    }
}
Also used : IndexedRecord(org.apache.avro.generic.IndexedRecord) Schema(org.apache.avro.Schema) GoogleDriveDataSource(org.talend.components.google.drive.runtime.data.GoogleDriveDataSource) GoogleDriveInputReader(org.talend.components.google.drive.runtime.data.GoogleDriveInputReader) GoogleDriveDatasetRuntime(org.talend.components.google.drive.runtime.data.GoogleDriveDatasetRuntime) Test(org.junit.Test)

Aggregations

Schema (org.apache.avro.Schema)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 Test (org.junit.Test)1 GoogleDriveDataSource (org.talend.components.google.drive.runtime.data.GoogleDriveDataSource)1 GoogleDriveDatasetRuntime (org.talend.components.google.drive.runtime.data.GoogleDriveDatasetRuntime)1 GoogleDriveInputReader (org.talend.components.google.drive.runtime.data.GoogleDriveInputReader)1