use of org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties in project components by Talend.
the class SalesforceGetDeletedUpdatedReaderTestIT method writeRows.
protected List<IndexedRecord> writeRows(String random, SalesforceConnectionModuleProperties props, List<IndexedRecord> outputRows, TSalesforceOutputProperties.OutputAction action) throws Exception {
// $NON-NLS-1$
TSalesforceOutputProperties outputProps = new TSalesforceOutputProperties("output");
outputProps.copyValuesFrom(props);
outputProps.outputAction.setValue(action);
outputProps.ignoreNull.setValue(true);
doWriteRows(outputProps, outputRows);
List<IndexedRecord> inputRows = readRows(props);
return checkRows(random, inputRows, outputRows.size());
}
use of org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties in project components by Talend.
the class SalesforceComponentTestIT method testOutputActionType.
@Test
public void testOutputActionType() throws Throwable {
ComponentDefinition definition = getComponentService().getComponentDefinition(TSalesforceOutputDefinition.COMPONENT_NAME);
TSalesforceOutputProperties outputProps = (TSalesforceOutputProperties) getComponentService().getComponentProperties(TSalesforceOutputDefinition.COMPONENT_NAME);
setupProps(outputProps.connection, !ADD_QUOTES);
outputProps.outputAction.setValue(OutputAction.DELETE);
setupModule(outputProps.module, "Account");
ComponentTestUtils.checkSerialize(outputProps, errorCollector);
List<IndexedRecord> rows = new ArrayList<>();
try {
writeRows(null, outputProps, rows);
} catch (Exception ex) {
if (ex instanceof ClassCastException) {
LOGGER.debug("Exception: " + ex.getMessage());
fail("Get error before delete!");
}
}
}
use of org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties in project components by Talend.
the class SalesforceTestBase method writeRows.
protected static void writeRows(List<IndexedRecord> outputRows) throws Exception {
// $NON-NLS-1$
TSalesforceOutputProperties outputProps = createSalesforceoutputProperties(EXISTING_MODULE_NAME);
outputProps.outputAction.setValue(TSalesforceOutputProperties.OutputAction.INSERT);
doWriteRows(outputProps, outputRows);
}
use of org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties in project components by Talend.
the class SalesforceWriteOperationTest method setUp.
@Before
public void setUp() {
properties = new TSalesforceOutputProperties("root");
sink = new SalesforceSink();
writeOperation = new SalesforceWriteOperation(sink);
}
use of org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties in project components by Talend.
the class SalesforceSchemaTest method testOutputSchemaForTSalesforceOutput1.
@Test
public void testOutputSchemaForTSalesforceOutput1() throws Throwable {
TSalesforceOutputDefinition defin = (TSalesforceOutputDefinition) getComponentService().getComponentDefinition(TSalesforceOutputDefinition.COMPONENT_NAME);
TSalesforceOutputProperties modelProps = (TSalesforceOutputProperties) defin.createProperties();
modelProps.module.main.schema.setValue(schema);
modelProps.extendInsert.setValue(false);
modelProps.retrieveInsertId.setValue(true);
modelProps.outputAction.setValue(OutputAction.INSERT);
getComponentService().afterProperty("schema", modelProps.module.main);
Schema output = modelProps.schemaFlow.schema.getValue();
assertThat(output.getType(), is(Schema.Type.RECORD));
assertThat(output.getFields(), hasSize(4));
assertThat(output.getFields().get(0).name(), is("col_1"));
assertThat(output.getFields().get(0).schema().getType(), is(Schema.Type.STRING));
assertThat(output.getFields().get(1).name(), is("col_2"));
assertThat(output.getFields().get(1).schema().getType(), is(Schema.Type.INT));
assertThat(output.getFields().get(2).name(), is("col_3"));
assertThat(output.getFields().get(2).schema().getType(), is(Schema.Type.LONG));
assertThat(output.getFields().get(2).getProp(SchemaConstants.TALEND_COLUMN_PATTERN), is("yyyy-MM-dd'T'HH:mm:ss'.000Z'"));
assertThat(output.getFields().get(3).name(), is("salesforce_id"));
assertThat(output.getFields().get(3).schema().getType(), is(Schema.Type.STRING));
Schema reject = modelProps.schemaReject.schema.getValue();
assertThat(reject.getType(), is(Schema.Type.RECORD));
assertThat(reject.getFields(), hasSize(6));
assertThat(reject.getFields().get(0).name(), is("col_1"));
assertThat(reject.getFields().get(0).schema().getType(), is(Schema.Type.STRING));
assertThat(reject.getFields().get(1).name(), is("col_2"));
assertThat(reject.getFields().get(1).schema().getType(), is(Schema.Type.INT));
assertThat(reject.getFields().get(2).name(), is("col_3"));
assertThat(reject.getFields().get(2).schema().getType(), is(Schema.Type.LONG));
assertThat(reject.getFields().get(2).getProp(SchemaConstants.TALEND_COLUMN_PATTERN), is("yyyy-MM-dd'T'HH:mm:ss'.000Z'"));
assertThat(reject.getFields().get(3).name(), is("errorCode"));
assertThat(reject.getFields().get(3).schema().getType(), is(Schema.Type.STRING));
assertThat(reject.getFields().get(4).name(), is("errorFields"));
assertThat(reject.getFields().get(4).schema().getType(), is(Schema.Type.STRING));
assertThat(reject.getFields().get(5).name(), is("errorMessage"));
assertThat(reject.getFields().get(5).schema().getType(), is(Schema.Type.STRING));
}
Aggregations