Search in sources :

Example 71 with IComponent

use of org.talend.core.model.components.IComponent 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);
            }
        }
    }
}
Also used : IComponent(org.talend.core.model.components.IComponent) ArrayList(java.util.ArrayList) ComponentService(org.talend.components.api.service.ComponentService) ComponentDefinition(org.talend.components.api.component.ComponentDefinition) Test(org.junit.Test)

Example 72 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class ComponentContextPropertyValueEvaluatorTest method before.

@Before
public void before() {
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
    node = new Node(component, new Process(new FakePropertyImpl()));
    props = node.getComponentProperties();
    evaluator = new ComponentContextPropertyValueEvaluator(node);
}
Also used : FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) IComponent(org.talend.core.model.components.IComponent) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) Before(org.junit.Before)

Example 73 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class ComponentTest method testGetElementParameterValueFromComponentProperties.

@Test
public void testGetElementParameterValueFromComponentProperties() {
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent sfComponent = ComponentsFactoryProvider.getInstance().get("tSalesforceInput", "DI");
    INode node = new Node(sfComponent, new Process(new FakePropertyImpl()));
    ComponentProperties props = node.getComponentProperties();
    Form form = props.getForm(Form.MAIN);
    IElementParameter param = new GenericElementParameter(node, node.getComponentProperties(), form, form.getWidget("condition"), //$NON-NLS-1$
    null);
    Object obj = component.getElementParameterValueFromComponentProperties(node, param);
    Assert.assertNotNull(obj);
}
Also used : INode(org.talend.core.model.process.INode) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) ComponentProperties(org.talend.components.api.properties.ComponentProperties) Form(org.talend.daikon.properties.presentation.Form) IComponent(org.talend.core.model.components.IComponent) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) Test(org.junit.Test)

Example 74 with IComponent

use of org.talend.core.model.components.IComponent in project tdi-studio-se by Talend.

the class GenericElementParameterTest method before.

@Before
public void before() {
    ComponentService componentService = ComponentsUtils.getComponentService();
    //$NON-NLS-1$
    TestProperties props = (TestProperties) new TestProperties("test").init();
    Form form = props.getForm(Form.MAIN);
    //$NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("tSalesforceConnection", "DI");
    INode node = new Node(component, new Process(new FakePropertyImpl()));
    parameter = new GenericElementParameter(node, props, form, form.getWidget(props.userId), componentService);
}
Also used : TestProperties(org.talend.designer.core.generic.utils.TestProperties) INode(org.talend.core.model.process.INode) FakePropertyImpl(org.talend.core.model.repository.FakePropertyImpl) Form(org.talend.daikon.properties.presentation.Form) IComponent(org.talend.core.model.components.IComponent) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) ComponentService(org.talend.components.api.service.ComponentService) Before(org.junit.Before)

Example 75 with IComponent

use of org.talend.core.model.components.IComponent in project tesb-studio-se by Talend.

the class LocalESBRunContainerServiceTest method testCreateJavaProcessor.

/**
     * Test method for
     * {@link org.talend.designer.esb.runcontainer.core.LocalESBRunContainerService#createJavaProcessor(org.talend.core.model.process.IProcess, Property, boolean)}
     */
@Test
public void testCreateJavaProcessor() {
    IESBRunContainerService service = (IESBRunContainerService) GlobalServiceRegister.getDefault().getService(IESBRunContainerService.class);
    String[] esbComponents = { "tESBProviderRequest", "tRESTClient", "tRESTRequest", "tRESTResponse", "tESBConsumer", "tESBProviderFault", "tESBProviderRequest", "tESBProviderResponse" };
    for (String esbComponent : esbComponents) {
        Property property = PropertiesFactory.eINSTANCE.createProperty();
        property.setVersion("0.1");
        property.setId("property1");
        property.setLabel("ESBArtifact");
        ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
        processItem.setProperty(property);
        property.setItem(processItem);
        ProcessType process = TalendFileFactory.eINSTANCE.createProcessType();
        processItem.setProcess(process);
        NodeType node = TalendFileFactory.eINSTANCE.createNodeType();
        process.getNode().add(node);
        node.setComponentName(esbComponent);
        IComponent tESBComponent = ComponentsFactoryProvider.getInstance().get(esbComponent, ComponentCategory.CATEGORY_4_DI.getName());
        Process esbJob = new Process(property);
        Node tESBComponent_1 = new Node(tESBComponent, esbJob);
        esbJob.addNodeContainer(new NodeContainer(tESBComponent_1));
        Assert.assertNotNull(service.createJavaProcessor(esbJob, property, false));
    }
}
Also used : ProcessType(org.talend.designer.core.model.utils.emf.talendfile.ProcessType) IESBRunContainerService(org.talend.designer.runprocess.IESBRunContainerService) ProcessItem(org.talend.core.model.properties.ProcessItem) IComponent(org.talend.core.model.components.IComponent) NodeType(org.talend.designer.core.model.utils.emf.talendfile.NodeType) Node(org.talend.designer.core.ui.editor.nodes.Node) Process(org.talend.designer.core.ui.editor.process.Process) NodeContainer(org.talend.designer.core.ui.editor.nodecontainer.NodeContainer) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Aggregations

IComponent (org.talend.core.model.components.IComponent)146 Node (org.talend.designer.core.ui.editor.nodes.Node)54 ArrayList (java.util.ArrayList)47 IElementParameter (org.talend.core.model.process.IElementParameter)36 Process (org.talend.designer.core.ui.editor.process.Process)36 Test (org.junit.Test)35 INode (org.talend.core.model.process.INode)33 IMetadataTable (org.talend.core.model.metadata.IMetadataTable)22 List (java.util.List)15 Property (org.talend.core.model.properties.Property)15 FakePropertyImpl (org.talend.core.model.repository.FakePropertyImpl)15 NodeContainer (org.talend.designer.core.ui.editor.nodecontainer.NodeContainer)13 IComponentsFactory (org.talend.core.model.components.IComponentsFactory)12 Connection (org.talend.designer.core.ui.editor.connections.Connection)12 HashMap (java.util.HashMap)11 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)10 DataNode (org.talend.designer.core.model.process.DataNode)10 HashSet (java.util.HashSet)9 IConnection (org.talend.core.model.process.IConnection)9 Rectangle (org.eclipse.swt.graphics.Rectangle)8