Search in sources :

Example 1 with TSnowflakeOutputProperties

use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.

the class SnowflakeRuntimeIT method handleRows.

protected Result handleRows(List<IndexedRecord> rows, SnowflakeConnectionTableProperties props, TSnowflakeOutputProperties.OutputAction action) throws Exception {
    TSnowflakeOutputProperties handleProperties = getRightProperties(props);
    handleProperties.outputAction.setValue(action);
    LOGGER.debug(action + ": " + rows.size() + " rows");
    return writeRows(makeWriter(handleProperties), rows);
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties)

Example 2 with TSnowflakeOutputProperties

use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.

the class SnowflakeRuntimeIT method writeRows.

// Returns the rows written (having been re-read so they have their Ids)
protected List<IndexedRecord> writeRows(SnowflakeConnectionTableProperties props, List<IndexedRecord> outputRows) throws Exception {
    TSnowflakeOutputProperties outputProps = getRightProperties(props);
    outputProps.outputAction.setValue(TSnowflakeOutputProperties.OutputAction.INSERT);
    writeRows(makeWriter(outputProps), outputRows);
    return readAndCheckRows(props, outputRows.size());
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties)

Example 3 with TSnowflakeOutputProperties

use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.

the class SnowflakeWritersTestIT method testOutputActionType.

@Test
public void testOutputActionType() throws Throwable {
    ComponentDefinition definition = getComponentService().getComponentDefinition(TSnowflakeOutputDefinition.COMPONENT_NAME);
    TSnowflakeOutputProperties outputProps = (TSnowflakeOutputProperties) getComponentService().getComponentProperties(TSnowflakeOutputDefinition.COMPONENT_NAME);
    setupProps(outputProps.connection);
    outputProps.outputAction.setValue(TSnowflakeOutputProperties.OutputAction.DELETE);
    setupTableWithStaticValues(outputProps);
    ComponentTestUtils.checkSerialize(outputProps, errorCollector);
    List<IndexedRecord> rows = new ArrayList<>();
    try {
        writeRows(outputProps, rows);
    } catch (Exception ex) {
        if (ex instanceof ClassCastException) {
            LOGGER.debug("Exception: " + ex.getMessage());
            fail("Get error before delete!");
        }
    }
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) ArrayList(java.util.ArrayList) SQLException(java.sql.SQLException) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) Test(org.junit.Test)

Example 4 with TSnowflakeOutputProperties

use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.

the class SnowflakeWritersTestIT method testOutputBadConnection.

@Test
public void testOutputBadConnection() throws Throwable {
    TSnowflakeOutputProperties outputProps = (TSnowflakeOutputProperties) getComponentService().getComponentProperties(TSnowflakeOutputDefinition.COMPONENT_NAME);
    // No connection information
    SnowflakeTableProperties tableProps = outputProps.table;
    Form f = tableProps.getForm(Form.REFERENCE);
    tableProps.tableName.setValue("BADONE");
    tableProps = (SnowflakeTableProperties) PropertiesTestUtils.checkAndAfter(getComponentService(), f, tableProps.tableName.getName(), tableProps);
    LOGGER.info(String.valueOf(tableProps.getValidationResult()));
    assertEquals(ValidationResult.Result.ERROR, tableProps.getValidationResult().getStatus());
    assertThat(tableProps.getValidationResult().getMessage(), containsString("Missing account"));
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties) Form(org.talend.daikon.properties.presentation.Form) SnowflakeTableProperties(org.talend.components.snowflake.SnowflakeTableProperties) Test(org.junit.Test)

Example 5 with TSnowflakeOutputProperties

use of org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties in project components by Talend.

the class SnowflakeResultListenerTest method setup.

@Before
public void setup() {
    properties = new TSnowflakeOutputProperties("ouput");
    properties.init();
    listener = new SnowflakeResultListener(properties);
}
Also used : TSnowflakeOutputProperties(org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties) Before(org.junit.Before)

Aggregations

TSnowflakeOutputProperties (org.talend.components.snowflake.tsnowflakeoutput.TSnowflakeOutputProperties)17 Test (org.junit.Test)10 Schema (org.apache.avro.Schema)3 IndexedRecord (org.apache.avro.generic.IndexedRecord)3 Matchers.containsString (org.hamcrest.Matchers.containsString)3 Before (org.junit.Before)3 Form (org.talend.daikon.properties.presentation.Form)3 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)2 Result (org.talend.components.api.component.runtime.Result)2 DefaultComponentRuntimeContainerImpl (org.talend.components.api.container.DefaultComponentRuntimeContainerImpl)2 SnowflakeTableProperties (org.talend.components.snowflake.SnowflakeTableProperties)2 ValidationResult (org.talend.daikon.properties.ValidationResult)2 Connection (java.sql.Connection)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 LoaderProperty (net.snowflake.client.loader.LoaderProperty)1 StreamLoader (net.snowflake.client.loader.StreamLoader)1 Connector (org.talend.components.api.component.Connector)1 RuntimeContainer (org.talend.components.api.container.RuntimeContainer)1 SnowflakeConnectionProperties (org.talend.components.snowflake.SnowflakeConnectionProperties)1