Search in sources :

Example 21 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project components by Talend.

the class FileDelimitedTestIT method testComponentDefinition.

@Test
public void testComponentDefinition() {
    ComponentDefinition cdInput = getComponentService().getComponentDefinition(TFileInputDelimitedDefinition.COMPONENT_NAME);
    assertEquals(1, cdInput.getFamilies().length);
    assertEquals("File/Input", cdInput.getFamilies()[0]);
    assertFalse(cdInput.isDataAutoPropagate());
    assertFalse(cdInput.isSchemaAutoPropagate());
    assertTrue(cdInput.isConditionalInputs());
    assertTrue(cdInput.isStartable());
    assertNull(cdInput.getPartitioning());
    assertEquals(EnumSet.of(ConnectorTopology.OUTGOING), cdInput.getSupportedConnectorTopologies());
    ComponentDefinition cdOutput = getComponentService().getComponentDefinition(TFileOutputDelimitedDefinition.COMPONENT_NAME);
    assertEquals(1, cdOutput.getFamilies().length);
    assertEquals("File/Output", cdOutput.getFamilies()[0]);
    assertTrue(cdOutput.isSchemaAutoPropagate());
    assertFalse(cdOutput.isConditionalInputs());
    assertFalse(cdInput.isDataAutoPropagate());
    assertFalse(cdOutput.isStartable());
    assertEquals(AbstractComponentDefinition.NONE, cdOutput.getPartitioning());
    assertEquals(EnumSet.of(ConnectorTopology.INCOMING, ConnectorTopology.INCOMING_AND_OUTGOING), cdOutput.getSupportedConnectorTopologies());
}
Also used : ComponentDefinition(org.talend.components.api.component.ComponentDefinition) AbstractComponentDefinition(org.talend.components.api.component.AbstractComponentDefinition) Test(org.junit.Test)

Example 22 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project components by Talend.

the class AbstractComponentTest method assertComponentIsRegistered.

protected void assertComponentIsRegistered(String componentName) {
    try {
        ComponentDefinition componentDefinition = getComponentService().getComponentDefinition(componentName);
        assertNotNull(componentDefinition);
    } catch (ComponentException ce) {
        if (ce.getCode() == ComponentsApiErrorCode.WRONG_COMPONENT_NAME) {
            fail("Could not find component [], please check the registered component familly is in package org.talend.components");
        } else {
            throw ce;
        }
    }
}
Also used : ComponentException(org.talend.components.api.exception.ComponentException) ComponentDefinition(org.talend.components.api.component.ComponentDefinition)

Example 23 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition 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 24 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project components by Talend.

the class ComponentTestUtils method assertAllComponentImagesAreSet.

/**
 * check that all Components and Wizards have theirs images properly set.
 *
 * @param componentService service to get the components to be checked.
 */
public static void assertAllComponentImagesAreSet(DefinitionRegistryService definitionRegistry) {
    // check components
    Collection<ComponentDefinition> allComponents = definitionRegistry.getDefinitionsMapByType(ComponentDefinition.class).values();
    for (ComponentDefinition compDef : allComponents) {
        assertComponentImagesAreSet(compDef);
    }
    // check wizards
    Collection<ComponentWizardDefinition> allWizards = definitionRegistry.getDefinitionsMapByType(ComponentWizardDefinition.class).values();
    for (ComponentWizardDefinition wizDef : allWizards) {
        assertWizardImagesAreSet(wizDef);
    }
}
Also used : ComponentWizardDefinition(org.talend.components.api.wizard.ComponentWizardDefinition) ComponentDefinition(org.talend.components.api.component.ComponentDefinition)

Example 25 with ComponentDefinition

use of org.talend.components.api.component.ComponentDefinition in project tdi-studio-se by Talend.

the class GenericService method getAllGenericComponentsInfo.

@Override
public List<Map<String, String>> getAllGenericComponentsInfo() {
    List<Map<String, String>> genericComponents = new ArrayList<>();
    Set<ComponentDefinition> definitions = ComponentsUtils.getComponentService().getAllComponents();
    if (definitions != null) {
        for (ComponentDefinition definition : definitions) {
            Map<String, String> componentInfo = new LinkedHashMap<>();
            //$NON-NLS-1$
            componentInfo.put("Name", definition.getName());
            //$NON-NLS-1$
            componentInfo.put("Title", definition.getTitle());
            genericComponents.add(componentInfo);
        }
    }
    return genericComponents;
}
Also used : ArrayList(java.util.ArrayList) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ComponentDefinition (org.talend.components.api.component.ComponentDefinition)47 Test (org.junit.Test)28 IndexedRecord (org.apache.avro.generic.IndexedRecord)16 TSalesforceOutputProperties (org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputProperties)14 TSalesforceOutputDefinition (org.talend.components.salesforce.tsalesforceoutput.TSalesforceOutputDefinition)12 ArrayList (java.util.ArrayList)11 Result (org.talend.components.api.component.runtime.Result)11 TSalesforceInputProperties (org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties)10 List (java.util.List)9 DefaultComponentRuntimeContainerImpl (org.talend.components.api.container.DefaultComponentRuntimeContainerImpl)8 ComponentProperties (org.talend.components.api.properties.ComponentProperties)7 Schema (org.apache.avro.Schema)6 DefinitionDTO (org.talend.components.service.rest.dto.DefinitionDTO)6 MockComponentDefinition (org.talend.components.service.rest.mock.MockComponentDefinition)6 Response (com.jayway.restassured.response.Response)5 Arrays.asList (java.util.Arrays.asList)5 GenericData (org.apache.avro.generic.GenericData)3 ExecutionEngine (org.talend.components.api.component.runtime.ExecutionEngine)3 IComponent (org.talend.core.model.components.IComponent)3 File (java.io.File)2