use of org.talend.components.snowflake.tsnowflakeclose.TSnowflakeCloseProperties in project components by Talend.
the class SnowflakeCloseSourceOrSinkTest method reset.
@Before
public void reset() {
closeSourceOrSink = new SnowflakeCloseSourceOrSink();
closeSourceOrSink.initialize(null, new TSnowflakeCloseProperties("connection"));
}
use of org.talend.components.snowflake.tsnowflakeclose.TSnowflakeCloseProperties in project components by Talend.
the class SnowflakeReadersTestIT method testCloseExistingConnection.
@Test
public void testCloseExistingConnection() 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());
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());
}
use of org.talend.components.snowflake.tsnowflakeclose.TSnowflakeCloseProperties 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);
}
Aggregations