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());
}
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;
}
}
}
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);
}
}
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);
}
}
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;
}
Aggregations