use of org.talend.components.snowflake.tsnowflakerow.TSnowflakeRowProperties in project components by Talend.
the class SnowflakeRowStandaloneTest method setup.
@Before
public void setup() throws Exception {
properties = new TSnowflakeRowProperties("rowProperties");
properties.setupProperties();
properties.query.setValue(QUERY);
standalone = new SnowflakeRowStandalone();
standalone.initialize(null, properties);
connection = Mockito.mock(Connection.class);
PowerMockito.mockStatic(DriverManagerUtils.class);
PowerMockito.when(DriverManagerUtils.getConnection(properties.getConnectionProperties())).thenReturn(connection);
}
use of org.talend.components.snowflake.tsnowflakerow.TSnowflakeRowProperties in project components by Talend.
the class SnowflakeRowSinkTest method testInitialize.
@Test
public void testInitialize() {
RuntimeContainer container = Mockito.mock(RuntimeContainer.class);
TSnowflakeRowProperties properties = new TSnowflakeRowProperties("rowProperties");
Assert.assertNull(sink.getRowProperties());
ValidationResult result = sink.initialize(container, properties);
Assert.assertEquals(ValidationResult.OK, result);
Assert.assertEquals(properties, sink.getRowProperties());
}
use of org.talend.components.snowflake.tsnowflakerow.TSnowflakeRowProperties in project components by Talend.
the class SnowflakeRowReaderTest method setup.
@Before
public void setup() throws IOException, SQLException {
source = Mockito.mock(SnowflakeRowSource.class);
connection = Mockito.mock(Connection.class);
Mockito.when(source.createConnection(Mockito.any(RuntimeContainer.class))).thenReturn(connection);
Mockito.doNothing().when(source).closeConnection(Mockito.any(RuntimeContainer.class), Mockito.any(Connection.class));
properties = new TSnowflakeRowProperties("rowProperties");
Schema schema = SchemaBuilder.builder().record("test").fields().requiredString("name").endRecord();
query = "SELECT id, name from " + TABLE_NAME;
properties.query.setValue(query);
properties.schemaFlow.schema.setValue(schema);
properties.setupProperties();
properties.table.tableName.setValue(TABLE_NAME);
Mockito.when(source.getRowProperties()).thenReturn(properties);
Mockito.when(source.getRuntimeSchema(null)).thenReturn(schema);
reader = new SnowflakeRowReader(null, source);
Mockito.doCallRealMethod().when(source).getQuery();
}
use of org.talend.components.snowflake.tsnowflakerow.TSnowflakeRowProperties in project components by Talend.
the class SnowflakeRowSourceTest method setup.
@Before
public void setup() {
source = new SnowflakeRowSource();
source.initialize(null, new TSnowflakeRowProperties("rowProperties"));
}
use of org.talend.components.snowflake.tsnowflakerow.TSnowflakeRowProperties in project components by Talend.
the class SnowflakeRowWriteOperationTest method testCreateWriter.
@Test
public void testCreateWriter() {
TSnowflakeRowProperties properties = new TSnowflakeRowProperties("rowProperties");
sink.initialize(null, properties);
Writer<Result> writer = operation.createWriter(null);
Assert.assertTrue(writer instanceof SnowflakeRowWriter);
}
Aggregations