use of org.talend.components.api.component.ComponentDefinition in project tdi-studio-se by Talend.
the class Component method createMultipleComponentManagers.
@Override
protected List<IMultipleComponentManager> createMultipleComponentManagers() {
List<IMultipleComponentManager> multipleComponentManagers = new ArrayList<>();
if (componentDefinition instanceof VirtualComponentDefinition) {
VirtualComponentDefinition definition = (VirtualComponentDefinition) componentDefinition;
String inputComponentName = null;
String outputComponentName = null;
ComponentDefinition inputComponentDefinition = definition.getInputComponentDefinition();
if (inputComponentDefinition != null) {
inputComponentName = inputComponentDefinition.getName();
}
ComponentDefinition outputComponentDefinition = definition.getOutputComponentDefinition();
if (outputComponentDefinition != null) {
outputComponentName = outputComponentDefinition.getName();
}
if (inputComponentName == null || outputComponentName == null) {
return multipleComponentManagers;
}
IMultipleComponentManager multipleComponentManager = new MultipleComponentManager(inputComponentName, outputComponentName);
IMultipleComponentItem inputItem = multipleComponentManager.addItem(inputComponentName, inputComponentName);
multipleComponentManager.setExistsLinkTo(true);
// FIXME: should get the connector type by other way.
String cType = EConnectionType.ON_ROWS_END.getName();
inputItem.getOutputConnections().add(new MultipleComponentConnection(cType, outputComponentName));
multipleComponentManager.addItem(outputComponentName, outputComponentName);
multipleComponentManager.validateItems();
multipleComponentManagers.add(multipleComponentManager);
}
return multipleComponentManagers;
}
use of org.talend.components.api.component.ComponentDefinition in project tdi-studio-se by Talend.
the class ComponentsUtilsTest method testLoadComponents.
@Test
public void testLoadComponents() {
ComponentService componentService = ComponentsUtils.getComponentService();
Set<ComponentDefinition> componentDefinitions = componentService.getAllComponents();
Set<IComponent> coms = ComponentsFactoryProvider.getInstance().getComponents();
List<IComponent> comList = new ArrayList<IComponent>();
for (ComponentDefinition componentDefinition : componentDefinitions) {
for (IComponent com : coms) {
if (com.getName().equals(componentDefinition.getName())) {
comList.add(com);
break;
}
}
}
coms.removeAll(comList);
ComponentsUtils.loadComponents(componentService);
coms = ComponentsFactoryProvider.getInstance().getComponents();
for (ComponentDefinition componentDefinition : componentDefinitions) {
if (!componentDefinition.getName().equals("tJIRAInput")) {
continue;
}
for (IComponent com : coms) {
if (com.getName().equals(componentDefinition.getName())) {
assertFalse("Component loaded: " + componentDefinition.getName(), true);
}
}
}
}
use of org.talend.components.api.component.ComponentDefinition in project components by Talend.
the class TSalesforceOutputBulkExecDefinitionTest method testComponents.
@Test
public void testComponents() {
ComponentDefinition inputDefinition = definition.getInputComponentDefinition();
assertNotNull(inputDefinition);
assertTrue(inputDefinition.getSupportedConnectorTopologies().contains(ConnectorTopology.INCOMING));
ComponentDefinition outputDefinition = definition.getOutputComponentDefinition();
assertNotNull(outputDefinition);
assertTrue(outputDefinition.getSupportedConnectorTopologies().contains(ConnectorTopology.OUTGOING));
}
use of org.talend.components.api.component.ComponentDefinition in project components by Talend.
the class SalesforceComponentTestIT method generateJavaNestedCompPropClassNames.
@Test
public void generateJavaNestedCompPropClassNames() {
Set<ComponentDefinition> allComponents = getComponentService().getAllComponents();
for (ComponentDefinition cd : allComponents) {
ComponentProperties props = cd.createProperties();
String javaCode = PropertiesTestUtils.generatedNestedComponentCompatibilitiesJavaCode(props);
LOGGER.debug("Nested Props for (" + cd.getClass().getSimpleName() + ".java:1)" + javaCode);
}
}
use of org.talend.components.api.component.ComponentDefinition in project components by Talend.
the class SalesforceComponentTestIT method testUseExistingConnection.
@Test
public void testUseExistingConnection() throws Throwable {
SalesforceConnectionProperties connProps = (SalesforceConnectionProperties) getComponentService().getComponentProperties(TSalesforceConnectionDefinition.COMPONENT_NAME);
setupProps(connProps, !ADD_QUOTES);
final String currentComponentName = TSalesforceConnectionDefinition.COMPONENT_NAME + "_1";
RuntimeContainer connContainer = new DefaultComponentRuntimeContainerImpl() {
@Override
public String getCurrentComponentId() {
return currentComponentName;
}
};
SalesforceSourceOrSink salesforceSourceOrSink = new SalesforceSourceOrSink();
salesforceSourceOrSink.initialize(connContainer, connProps);
assertEquals(ValidationResult.Result.OK, salesforceSourceOrSink.validate(connContainer).getStatus());
// Input component get connection from the tSalesforceConnection
ComponentDefinition inputDefinition = getComponentService().getComponentDefinition(TSalesforceInputDefinition.COMPONENT_NAME);
TSalesforceInputProperties inProps = (TSalesforceInputProperties) getComponentService().getComponentProperties(TSalesforceInputDefinition.COMPONENT_NAME);
inProps.connection.referencedComponent.componentInstanceId.setValue(currentComponentName);
SalesforceSourceOrSink salesforceInputSourceOrSink = new SalesforceSourceOrSink();
salesforceInputSourceOrSink.initialize(connContainer, inProps);
assertEquals(ValidationResult.Result.OK, salesforceInputSourceOrSink.validate(connContainer).getStatus());
}
Aggregations