use of org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties in project components by Talend.
the class SnowflakeReadersTestIT method testInputManualError.
@Test(expected = IOException.class)
public void testInputManualError() throws Throwable {
TSnowflakeInputProperties props = (TSnowflakeInputProperties) new TSnowflakeInputDefinition().createProperties();
setupProps(props.getConnectionProperties());
Form f = props.getForm(MAIN);
props.manualQuery.setValue(true);
props = (TSnowflakeInputProperties) PropertiesTestUtils.checkAndAfter(getComponentService(), f, props.manualQuery.getName(), props);
props.query.setValue("bad query");
readRows(props);
}
use of org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties in project components by Talend.
the class SnowflakeReadersTestIT method testInputCondition.
@Test
public void testInputCondition() throws Throwable {
TSnowflakeInputProperties props = (TSnowflakeInputProperties) new TSnowflakeInputDefinition().createProperties();
setupProps(props.getConnectionProperties());
Form f = props.getForm(MAIN);
props.manualQuery.setValue(false);
props = (TSnowflakeInputProperties) PropertiesTestUtils.checkAndAfter(getComponentService(), f, props.manualQuery.getName(), props);
props.condition.setValue("ID > 80");
setupTableWithStaticValues(props);
List<IndexedRecord> rows = readRows(props);
assertEquals(19, rows.size());
assertEquals(BigDecimal.valueOf(81), rows.get(0).get(0));
assertEquals("foo_81", rows.get(0).get(1));
}
use of org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties in project components by Talend.
the class SnowflakeReadersTestIT method testTableNamesInput.
@Test
public void testTableNamesInput() throws Throwable {
TSnowflakeInputProperties props = (TSnowflakeInputProperties) getComponentService().getComponentProperties(TSnowflakeInputDefinition.COMPONENT_NAME);
setupProps(props.getConnectionProperties());
ComponentTestUtils.checkSerialize(props, errorCollector);
checkAndSetupTable(props);
}
use of org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties in project components by Talend.
the class SnowflakeRuntimeIT method readRows.
protected List<IndexedRecord> readRows(SnowflakeConnectionTableProperties props, RuntimeContainer container) throws IOException {
TSnowflakeInputProperties inputProps = null;
if (props instanceof TSnowflakeInputProperties) {
inputProps = (TSnowflakeInputProperties) props;
} else {
inputProps = (TSnowflakeInputProperties) new TSnowflakeInputProperties("bar").init();
}
inputProps.connection = props.connection;
inputProps.table = props.table;
BoundedReader<IndexedRecord> reader = (SnowflakeReader) createBoundedReader(inputProps, container);
boolean hasRecord = reader.start();
List<IndexedRecord> rows = new ArrayList<>();
while (hasRecord) {
org.apache.avro.generic.IndexedRecord unenforced = reader.getCurrent();
rows.add(unenforced);
hasRecord = reader.advance();
}
reader.close();
return rows;
}
use of org.talend.components.snowflake.tsnowflakeinput.TSnowflakeInputProperties in project components by Talend.
the class SnowflakeReaderTest method setUp.
@Before
public void setUp() throws Exception {
schema = SchemaBuilder.builder().record("Schema").fields().requiredString("field").requiredString("column").endRecord();
schema.getField("field").addProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "field");
schema.getField("column").addProp(SchemaConstants.TALEND_COLUMN_DB_COLUMN_NAME, "column");
TSnowflakeInputProperties tSnowflakeInputProperties = new TSnowflakeInputProperties("test");
tSnowflakeInputProperties.setupProperties();
tSnowflakeInputProperties.table.main.schema.setValue(schema);
tSnowflakeInputProperties.table.tableName.setValue("Table");
snowflakeReader = new SnowflakeReader(runtimeContainerMock, snowflakeSourceMock, tSnowflakeInputProperties);
}
Aggregations