use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.
the class TSnowflakeOutputMigrationTest method testSnowflakeConvertToUppercaseMigration.
@Test
public void testSnowflakeConvertToUppercaseMigration() throws IOException {
Deserialized<TSnowflakeOutputProperties> deser = Properties.Helper.fromSerializedPersistent(TestUtils.getResourceAsString(getClass(), "tSnowflakeOuputProperties.json"), TSnowflakeOutputProperties.class);
assertTrue("The property should be migrated, the migration returned false instead of true", deser.migrated);
TSnowflakeOutputProperties properties = deser.object;
boolean convertToUppercase = properties.convertColumnsAndTableToUppercase.getValue();
assertFalse(convertToUppercase);
}
use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.
the class SnowflakeSinkTest method setup.
@Before
public void setup() {
sink = new SnowflakeSink();
sink.initialize(null, new TSnowflakeOutputProperties("outputProperties"));
}
use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.
the class SnowflakeReadersTestIT method testSameConnectionForSeveralReaders.
@Test(expected = IOException.class)
public void testSameConnectionForSeveralReaders() throws Throwable {
SnowflakeConnectionProperties connProps = (SnowflakeConnectionProperties) getComponentService().getComponentProperties(TSnowflakeConnectionDefinition.COMPONENT_NAME);
setupProps(connProps);
final String currentComponentName = TSnowflakeConnectionDefinition.COMPONENT_NAME + "_1";
RuntimeContainer connContainer = new DefaultComponentRuntimeContainerImpl() {
@Override
public String getCurrentComponentId() {
return currentComponentName;
}
};
SnowflakeSourceOrSink SnowflakeSourceOrSink = new SnowflakeSourceOrSink();
SnowflakeSourceOrSink.initialize(connContainer, connProps);
assertEquals(ValidationResult.Result.OK, SnowflakeSourceOrSink.validate(connContainer).getStatus());
TSnowflakeOutputProperties props = (TSnowflakeOutputProperties) getComponentService().getComponentProperties(TSnowflakeOutputDefinition.COMPONENT_NAME);
setupProps(props.getConnectionProperties());
setupTableWithStaticValues(props);
props.connection.referencedComponent.componentInstanceId.setValue(currentComponentName);
List<IndexedRecord> rows = readRows(props, connContainer);
assertEquals(100, rows.size());
// Read second time with the same properties but with new reader.
rows = readRows(props, connContainer);
assertEquals(100, rows.size());
TSnowflakeCloseProperties closeProps = (TSnowflakeCloseProperties) getComponentService().getComponentProperties(TSnowflakeCloseDefinition.COMPONENT_NAME);
closeProps.referencedComponent.componentInstanceId.setValue(currentComponentName);
SnowflakeCloseSourceOrSink snowflakeCloseSourceOrSink = new SnowflakeCloseSourceOrSink();
snowflakeCloseSourceOrSink.initialize(connContainer, closeProps);
assertEquals(ValidationResult.Result.OK, snowflakeCloseSourceOrSink.validate(connContainer).getStatus());
// After close, exception should be thrown by the reader, if we try to read with the same connection.
rows = readRows(props, connContainer);
}
use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.
the class SnowflakeRuntimeIT method populateOutput.
protected SnowflakeConnectionTableProperties populateOutput(int count) throws Throwable {
TSnowflakeOutputProperties props = (TSnowflakeOutputProperties) getComponentService().getComponentProperties(TSnowflakeOutputDefinition.COMPONENT_NAME);
setupProps(props.getConnectionProperties());
checkAndSetupTable(props);
props.outputAction.setStoredValue(TSnowflakeOutputProperties.OutputAction.INSERT);
props.afterOutputAction();
long time = System.currentTimeMillis();
LOGGER.info("Start loading: " + count + " rows");
Result result = makeAndWriteRows(makeWriter(props), count);
assertEquals(count, result.getSuccessCount());
assertEquals(0, result.getRejectCount());
long elapsed = System.currentTimeMillis() - time;
LOGGER.info("time (ms): " + elapsed + " rows/sec: " + ((float) count / (float) (elapsed / 1000)));
return props;
}
use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.
the class SnowflakeRuntimeIT method getRightProperties.
protected TSnowflakeOutputProperties getRightProperties(SnowflakeConnectionTableProperties props) {
TSnowflakeOutputProperties handleProperties;
if (props instanceof TSnowflakeOutputProperties) {
handleProperties = (TSnowflakeOutputProperties) props;
} else {
// $NON-NLS-1$
handleProperties = new TSnowflakeOutputProperties("output");
handleProperties.copyValuesFrom(props);
}
return handleProperties;
}
Aggregations