use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class GoogleDriveDeleteReaderTest method delete.
private void delete() throws java.io.IOException {
source.initialize(container, properties);
BoundedReader reader = source.createReader(container);
assertTrue(reader.start());
IndexedRecord record = (IndexedRecord) reader.getCurrent();
assertNotNull(record);
assertEquals(1, record.getSchema().getFields().size());
assertEquals(FOLDER_DELETE_ID, record.get(0));
reader.close();
Map<String, Object> returnValues = reader.getReturnValues();
assertNotNull(returnValues);
assertEquals(FOLDER_DELETE_ID, returnValues.get(GoogleDriveDeleteDefinition.RETURN_FILE_ID));
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class GoogleDriveGetReaderTest method testStart.
@Test
public void testStart() throws Exception {
ValidationResult vr = source.initialize(container, properties);
assertNotNull(vr);
assertEquals(Result.OK, vr.getStatus());
BoundedReader reader = source.createReader(container);
assertTrue(reader.start());
IndexedRecord record = (IndexedRecord) reader.getCurrent();
assertNotNull(record);
assertEquals(1, record.getSchema().getFields().size());
assertFalse(reader.advance());
reader.close();
Map<String, Object> returnValues = reader.getReturnValues();
assertEquals(FILE_GET_ID, returnValues.get(GoogleDriveGetDefinition.RETURN_FILE_ID));
assertNull(returnValues.get(GoogleDriveGetDefinition.RETURN_CONTENT));
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageInputTableTestIT method testFilterReader.
@SuppressWarnings({ "rawtypes" })
@Test
public void testFilterReader() throws Throwable {
Date startTest = new Date();
String sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm").format(startTest);
Thread.sleep(2000);
String ctable = tbl_test + "InputFilter";
createSampleDataset(ctable);
properties.tableName.setValue(ctable);
properties.useFilterExpression.setValue(true);
List<String> cols = Arrays.asList("PartitionKey", "Timestamp");
List<String> ops = Arrays.asList(pk_test1, sdf);
List<String> funs = Arrays.asList(Comparison.EQUAL.toString(), Comparison.GREATER_THAN.toString());
List<String> preds = Arrays.asList(Predicate.AND.toString(), Predicate.AND.toString());
List<String> types = Arrays.asList(SupportedFieldType.STRING.toString(), SupportedFieldType.DATE.toString());
properties.filterExpression.column.setValue(cols);
properties.filterExpression.function.setValue(funs);
properties.filterExpression.operand.setValue(ops);
properties.filterExpression.predicate.setValue(preds);
properties.filterExpression.fieldType.setValue(types);
properties.schema.schema.setValue(getDynamicSchema());
BoundedReader reader = createBoundedReader(properties);
assertTrue(reader.start());
while (reader.advance()) {
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertNotNull(current);
assertEquals(5, current.getSchema().getFields().size());
assertEquals(pk_test1, current.get(0));
assertTrue(((Date) current.get(2)).after(startTest));
}
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageInputTableTestIT method testSystemReader.
@SuppressWarnings("rawtypes")
@Test
public void testSystemReader() throws Throwable {
String ctable = tbl_test + "InputSys";
createSampleDataset(ctable);
properties.tableName.setValue(ctable);
properties.schema.schema.setValue(getSystemSchema());
properties.useFilterExpression.setValue(false);
BoundedReader reader = createBoundedReader(properties);
assertTrue(reader.start());
while (reader.advance()) {
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertNotNull(current);
assertEquals(getSystemSchema(), current.getSchema());
assertEquals(3, current.getSchema().getFields().size());
}
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageGetReaderTestIT method testBlobGetAll.
@SuppressWarnings("rawtypes")
@Test
public void testBlobGetAll() throws Exception {
cleanupLists();
prefixes.add("");
includes.add(true);
creates.add(true);
BoundedReader reader = createGetReader(false);
assertTrue(reader.start());
reader.close();
for (String file : TEST_ALL_BLOBS) assertTrue(fileExistsAndHasTheGoodSize(file));
}
Aggregations