Search in sources :

Example 11 with TFileInputDelimitedProperties

use of org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedProperties in project components by Talend.

the class FileDelimitedReaderTestIT method testInputDieOnErrorCsvMode.

// Test FileInputDelimited component read with CSV mode and die on error
@Test(expected = RuntimeException.class)
public void testInputDieOnErrorCsvMode() throws Throwable {
    String resources = getClass().getResource("/runtime/input").toURI().getPath();
    String inputFile = resources + "/test_input_csv_reject.csv";
    LOGGER.debug("Test file path: " + inputFile);
    TFileInputDelimitedProperties properties = createInputProperties(inputFile, true);
    properties.dieOnError.setValue(true);
    try {
        testInputReject(properties);
    } catch (Exception e) {
        LOGGER.debug("Expect exception: " + e.getMessage());
        throw e;
    }
}
Also used : TFileInputDelimitedProperties(org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedProperties) DataRejectException(org.talend.components.api.exception.DataRejectException) Test(org.junit.Test)

Example 12 with TFileInputDelimitedProperties

use of org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedProperties in project components by Talend.

the class FileDelimitedWizardTestIT method testWizardSupportComponents.

@Test
public void testWizardSupportComponents() {
    // This control the "Property Type" showed in component
    TFileInputDelimitedProperties input = (TFileInputDelimitedProperties) new TFileInputDelimitedDefinition().createProperties();
    TFileOutputDelimitedProperties output = (TFileOutputDelimitedProperties) new TFileOutputDelimitedDefinition().createProperties();
    List<ComponentWizard> wizards = getComponentService().getComponentWizardsForProperties(input, null);
    assertTrue(wizards.get(0) instanceof FileDelimitedWizard);
    wizards = getComponentService().getComponentWizardsForProperties(output, null);
    assertTrue(wizards.get(0) instanceof FileDelimitedWizard);
}
Also used : ComponentWizard(org.talend.components.api.wizard.ComponentWizard) TFileInputDelimitedDefinition(org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedDefinition) TFileOutputDelimitedDefinition(org.talend.components.filedelimited.tfileoutputdelimited.TFileOutputDelimitedDefinition) TFileInputDelimitedProperties(org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedProperties) TFileOutputDelimitedProperties(org.talend.components.filedelimited.tfileoutputdelimited.TFileOutputDelimitedProperties) Test(org.junit.Test)

Aggregations

TFileInputDelimitedProperties (org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedProperties)12 Test (org.junit.Test)7 DataRejectException (org.talend.components.api.exception.DataRejectException)6 IndexedRecord (org.apache.avro.generic.IndexedRecord)4 TFileInputDelimitedDefinition (org.talend.components.filedelimited.tfileinputdelimited.TFileInputDelimitedDefinition)3 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)1 TFileOutputDelimitedDefinition (org.talend.components.filedelimited.tfileoutputdelimited.TFileOutputDelimitedDefinition)1 TFileOutputDelimitedProperties (org.talend.components.filedelimited.tfileoutputdelimited.TFileOutputDelimitedProperties)1 Form (org.talend.daikon.properties.presentation.Form)1