Search in sources :

Example 41 with Property

use of org.talend.daikon.properties.property.Property in project components by Talend.

the class SalesforceComponentTestIT method testInputProps.

@Test
public void testInputProps() throws Throwable {
    TSalesforceInputProperties props = (TSalesforceInputProperties) new TSalesforceInputDefinition().createProperties();
    assertEquals(2, props.queryMode.getPossibleValues().size());
    Property[] returns = new TSalesforceInputDefinition().getReturnProperties();
    assertEquals(ComponentDefinition.RETURN_TOTAL_RECORD_COUNT, returns[1].getName());
    // Default query mode
    Form queryAdvancedForm = props.getForm(Form.ADVANCED);
    assertTrue(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.bulkConnection.getName()).isHidden());
    assertFalse(queryAdvancedForm.getWidget(props.normalizeDelimiter.getName()).isHidden());
    assertFalse(queryAdvancedForm.getWidget(props.columnNameDelimiter.getName()).isHidden());
    assertFalse(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpChunked.getName()).isHidden());
    assertTrue(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpTraceMessage.getName()).isHidden());
    // Change to bulk query mode
    props.queryMode.setValue(TSalesforceInputProperties.QueryMode.Bulk);
    props.afterQueryMode();
    Form bulkQueryAdvancedForm = props.getForm(Form.ADVANCED);
    assertTrue(bulkQueryAdvancedForm.getWidget(props.normalizeDelimiter.getName()).isHidden());
    assertTrue(bulkQueryAdvancedForm.getWidget(props.columnNameDelimiter.getName()).isHidden());
    assertTrue(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpChunked.getName()).isHidden());
    assertFalse(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpTraceMessage.getName()).isHidden());
    assertTrue(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.bulkConnection.getName()).isHidden());
}
Also used : Form(org.talend.daikon.properties.presentation.Form) TSalesforceInputDefinition(org.talend.components.salesforce.tsalesforceinput.TSalesforceInputDefinition) TSalesforceInputProperties(org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties) Property(org.talend.daikon.properties.property.Property) Test(org.junit.Test)

Example 42 with Property

use of org.talend.daikon.properties.property.Property in project components by Talend.

the class SnowflakeRuntimeIT method checkAndSetupTable.

protected void checkAndSetupTable(SnowflakeConnectionTableProperties props) throws Throwable {
    assertEquals(2, props.getForms().size());
    Form f = props.table.getForm(Form.REFERENCE);
    SnowflakeTableProperties tableProps = (SnowflakeTableProperties) f.getProperties();
    assertTrue(f.getWidget(tableProps.tableName.getName()).isCallBeforeActivate());
    tableProps = (SnowflakeTableProperties) PropertiesTestUtils.checkAndBeforeActivate(getComponentService(), f, tableProps.tableName.getName(), tableProps);
    Property prop = (Property) f.getWidget(tableProps.tableName.getName()).getContent();
    LOGGER.debug(prop.getPossibleValues().toString());
    LOGGER.debug(tableProps.getValidationResult().toString());
    assertEquals(ValidationResult.Result.OK, tableProps.getValidationResult().getStatus());
    assertEquals(1, prop.getPossibleValues().size());
    tableProps.tableName.setValue(testTable);
    tableProps = (SnowflakeTableProperties) PropertiesTestUtils.checkAndAfter(getComponentService(), f, tableProps.tableName.getName(), tableProps);
    Form schemaForm = tableProps.main.getForm(Form.REFERENCE);
    PropertiesTestUtils.checkAndAfter(getComponentService(), schemaForm, tableProps.main.schema.getName(), tableProps.main);
    Schema schema = tableProps.main.schema.getValue();
    LOGGER.debug(schema.toString());
    for (Schema.Field child : schema.getFields()) {
        LOGGER.debug(child.name());
    }
    assertEquals(NUM_COLUMNS, schema.getFields().size());
}
Also used : Form(org.talend.daikon.properties.presentation.Form) Schema(org.apache.avro.Schema) SnowflakeTableProperties(org.talend.components.snowflake.SnowflakeTableProperties) Property(org.talend.daikon.properties.property.Property)

Aggregations

Property (org.talend.daikon.properties.property.Property)42 ComponentProperties (org.talend.components.api.properties.ComponentProperties)20 NamedThing (org.talend.daikon.NamedThing)17 Form (org.talend.daikon.properties.presentation.Form)13 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)10 List (java.util.List)7 Schema (org.apache.avro.Schema)7 Properties (org.talend.daikon.properties.Properties)6 SchemaProperty (org.talend.daikon.properties.property.SchemaProperty)6 PresentationItem (org.talend.daikon.properties.PresentationItem)5 StringProperty (org.talend.daikon.properties.property.StringProperty)5 HashMap (java.util.HashMap)4 SalesforceConnectionProperties (org.talend.components.salesforce.SalesforceConnectionProperties)4 TSalesforceInputProperties (org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties)4 SimpleNamedThing (org.talend.daikon.SimpleNamedThing)4 Map (java.util.Map)3 PropertyPathConnector (org.talend.components.api.component.PropertyPathConnector)3 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)3 SalesforceModuleProperties (org.talend.components.salesforce.SalesforceModuleProperties)3