Search in sources :

Example 26 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class TSplunkEventCollectorTestIT method testGetProps.

@Test
public void testGetProps() {
    ComponentProperties props = new TSplunkEventCollectorDefinition().createProperties();
    Form f = props.getForm(Form.MAIN);
    ComponentTestUtils.checkSerialize(props, errorCollector);
    Form advancedF = props.getForm(Form.ADVANCED);
    System.out.println(f);
    System.out.println(advancedF);
    System.out.println(props);
    assertEquals(Form.MAIN, f.getName());
    assertEquals(Form.ADVANCED, advancedF.getName());
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) Form(org.talend.daikon.properties.presentation.Form) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 27 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class FileDelimitedTestIT method testGetProps.

@Test
public void testGetProps() throws Throwable {
    // Input properties
    testInputProperties();
    // Output delimited
    ComponentProperties output = new TFileOutputDelimitedDefinition().createProperties();
    Form outputForm = output.getForm(Form.MAIN);
    ComponentTestUtils.checkSerialize(output, errorCollector);
    LOGGER.debug(outputForm.toString());
    LOGGER.debug(output.toString());
    assertEquals(Form.MAIN, outputForm.getName());
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) Form(org.talend.daikon.properties.presentation.Form) TFileOutputDelimitedDefinition(org.talend.components.filedelimited.tfileoutputdelimited.TFileOutputDelimitedDefinition) Test(org.junit.Test)

Example 28 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class AbstractComponentDefinition method createRuntimeProperties.

@Override
public ComponentProperties createRuntimeProperties() {
    ComponentProperties compProp = PropertiesImpl.createNewInstance(getPropertiesClass(), "root");
    compProp.initForRuntime();
    return compProp;
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties)

Example 29 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class ComponentTestUtils method testAlli18n.

/**
 * check all properties of a component for i18n, check form i18n, check ComponentProperties title is i18n
 *
 * @param componentService where to get all the components
 * @param errorCollector used to collect all errors at once. @see
 *            <a href="http://junit.org/apidocs/org/junit/rules/ErrorCollector.html">ErrorCollector</a>
 * @deprecated use {@link PropertiesTestUtils#assertAlli18nAreSetup(DefinitionRegistryService, ErrorCollector)} and
 *             {@link #assertReturnProperties18nAreSet(DefinitionRegistryService, ErrorCollector)}
 */
@Deprecated
public static void testAlli18n(ComponentService componentService, ErrorCollector errorCollector) {
    Set<ComponentDefinition> allComponents = componentService.getAllComponents();
    for (ComponentDefinition cd : allComponents) {
        ComponentProperties props = (ComponentProperties) PropertiesImpl.createNewInstance(cd.getPropertiesClass(), "root").init();
        // check all properties
        if (props != null) {
            checkAllI18N(props, errorCollector);
        } else {
            System.out.println("No properties to check fo I18n for :" + cd.getName());
        }
        // check component definition title
        errorCollector.checkThat("missing I18n property [" + cd.getTitle() + "] for definition [" + cd.getClass().getName() + "]", cd.getTitle().contains("component."), is(false));
        // check return properties i18n
        checkAllPropertyI18n(cd.getReturnProperties(), cd, errorCollector);
    }
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) ComponentDefinition(org.talend.components.api.component.ComponentDefinition)

Example 30 with ComponentProperties

use of org.talend.components.api.properties.ComponentProperties in project components by Talend.

the class TestFixedConnectorComponentProperties method testSetSchema.

@Test
public void testSetSchema() {
    // $NON-NLS-1$
    ComponentProperties properties = getComponentService().getComponentProperties("foo");
    // $NON-NLS-1$
    Schema aSchema = SchemaBuilder.builder().record("foo").fields().endRecord();
    Schema schema = properties.getSchema(TestProperties.MAIN_CONNECTOR, true);
    assertNotEquals(aSchema, schema);
    properties.setConnectedSchema(TestProperties.MAIN_CONNECTOR, aSchema, true);
    schema = properties.getSchema(TestProperties.MAIN_CONNECTOR, true);
    assertEquals(aSchema, schema);
}
Also used : ComponentProperties(org.talend.components.api.properties.ComponentProperties) Schema(org.apache.avro.Schema) Test(org.junit.Test)

Aggregations

ComponentProperties (org.talend.components.api.properties.ComponentProperties)76 Test (org.junit.Test)22 Form (org.talend.daikon.properties.presentation.Form)17 Property (org.talend.daikon.properties.property.Property)17 ArrayList (java.util.ArrayList)16 NamedThing (org.talend.daikon.NamedThing)13 GenericConnection (org.talend.repository.generic.model.genericMetadata.GenericConnection)13 Properties (org.talend.daikon.properties.Properties)10 List (java.util.List)9 IElementParameter (org.talend.core.model.process.IElementParameter)9 INode (org.talend.core.model.process.INode)9 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)8 Schema (org.apache.avro.Schema)7 ComponentDefinition (org.talend.components.api.component.ComponentDefinition)7 ComponentService (org.talend.components.api.service.ComponentService)7 ComponentWizard (org.talend.components.api.wizard.ComponentWizard)7 MetadataTable (org.talend.core.model.metadata.builder.connection.MetadataTable)7 ConnectionItem (org.talend.core.model.properties.ConnectionItem)7 GenericElementParameter (org.talend.designer.core.generic.model.GenericElementParameter)7 ElementParameter (org.talend.designer.core.model.components.ElementParameter)7