use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class AzureStorageContainerListReaderTestIT method testContainerList.
@SuppressWarnings("rawtypes")
@Test
public void testContainerList() throws Exception {
BoundedReader reader = createContainerListReader();
List<String> containers = new ArrayList<>();
Boolean rows = reader.start();
Object row;
assertTrue(rows);
//
while (rows) {
row = ((IndexedRecord) reader.getCurrent()).get(0);
assertNotNull(row);
assertTrue(row instanceof String);
containers.add(row.toString());
rows = reader.advance();
}
reader.close();
assertTrue(isTestContainerInContainerList(containers));
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageConnectionTestIT method testInvalidConnection.
@SuppressWarnings("rawtypes")
@Test(expected = Exception.class)
public void testInvalidConnection() throws Throwable {
TAzureStorageContainerListProperties properties = new TAzureStorageContainerListProperties("test");
properties.dieOnError.setValue(true);
BoundedReader reader = createBoundedReader(properties);
reader.start();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class SalesforceBulkExecReaderTestIT method executeBulkInsert.
/**
* Test runtime of tSalesforceOutputBulk
*/
private void executeBulkInsert(TSalesforceBulkExecProperties bulkExecProperties, String random, int count) throws Throwable {
TSalesforceBulkExecDefinition definition = (TSalesforceBulkExecDefinition) getComponentService().getComponentDefinition(TSalesforceBulkExecDefinition.COMPONENT_NAME);
RuntimeInfo runtimeInfo = definition.getRuntimeInfo(ExecutionEngine.DI, bulkExecProperties, ConnectorTopology.OUTGOING);
try (SandboxedInstance sandboxedInstance = RuntimeUtil.createRuntimeClass(runtimeInfo, definition.getClass().getClassLoader())) {
SalesforceSource boundedSource = (SalesforceSource) sandboxedInstance.getInstance();
boundedSource.initialize(null, bulkExecProperties);
BoundedReader boundedReader = boundedSource.createReader(null);
try {
boolean hasRecord = boundedReader.start();
List<IndexedRecord> rows = new ArrayList<>();
while (hasRecord) {
rows.add((IndexedRecord) boundedReader.getCurrent());
hasRecord = boundedReader.advance();
}
checkRows(random, rows, count);
} finally {
boundedReader.close();
}
}
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageInputTableTestIT method testNameMappings.
@SuppressWarnings("rawtypes")
@Test
public void testNameMappings() throws Throwable {
String ctable = tbl_test + "InputNameMappings";
createSampleDataset(ctable);
properties.tableName.setValue(ctable);
properties.useFilterExpression.setValue(false);
properties.schema.schema.setValue(getMappingSchema());
properties.nameMapping.schemaColumnName.setValue(schemaMappings);
properties.nameMapping.entityPropertyName.setValue(propertyMappings);
BoundedReader reader = createBoundedReader(properties);
IndexedRecord current = null;
assertTrue(reader.start());
while (reader.advance()) {
current = (IndexedRecord) reader.getCurrent();
assertNotNull(current);
assertEquals(getMappingSchema(), current.getSchema());
assertNotNull(current.getSchema().getField("pk"));
assertNotNull(current.getSchema().getField("rk"));
assertNotNull(current.getSchema().getField("ts"));
assertNotNull(current.getSchema().getField("electronicMail"));
assertNotNull(current.getSchema().getField("telephoneNumber"));
}
reader.close();
}
use of org.talend.components.api.component.runtime.BoundedReader in project components by Talend.
the class TAzureStorageInputTableTestIT method testFirstReader.
@SuppressWarnings("rawtypes")
@Test
public void testFirstReader() throws Throwable {
String ctable = tbl_test + "InputSimple";
createSampleDataset(ctable);
properties.tableName.setValue(ctable);
properties.useFilterExpression.setValue(false);
properties.schema.schema.setValue(null);
BoundedReader reader = createBoundedReader(properties);
assertTrue(reader.start());
while (reader.advance()) {
IndexedRecord current = (IndexedRecord) reader.getCurrent();
assertNotNull(current);
}
reader.close();
}
Aggregations