Search in sources :

Example 1 with CamelCodeGenerator

use of org.talend.camel.designer.codegen.CamelCodeGenerator in project tesb-studio-se by Talend.

the class ECamelTemplateTest method testGetTemplateURL.

/**
 * Test method for {@link org.talend.camel.designer.codegen.config.ECamelTemplate#getTemplateURL()}.
 */
@Test
public void testGetTemplateURL() {
    ECamelTemplate.CONTEXT.getTemplateURL();
    ECamelTemplate.CAMEL_SPECIALLINKS.getTemplateURL();
    ProcessItem processItem = PropertiesFactory.eINSTANCE.createProcessItem();
    Property myProperty = PropertiesFactory.eINSTANCE.createProperty();
    String id = ProxyRepositoryFactory.getInstance().getNextId();
    myProperty.setId(id);
    ItemState itemState = PropertiesFactory.eINSTANCE.createItemState();
    itemState.setDeleted(false);
    itemState.setPath("");
    processItem.setState(itemState);
    processItem.setProperty(myProperty);
    myProperty.setLabel("myRoute");
    myProperty.setVersion("0.1");
    processItem.setProcess(TalendFileFactory.eINSTANCE.createProcessType());
    // $NON-NLS-1$ //$NON-NLS-2$
    IComponent component = ComponentsFactoryProvider.getInstance().get("cTimer", "CAMEL");
    RouteProcess process = new RouteProcess(myProperty);
    process.setId("routeprocess");
    INode nodeTimer = new Node(component, process);
    nodeTimer.setLabel("cTimer_1");
    CamelCodeGenerator codeGenerator = new CamelCodeGenerator(process, false, false);
    try {
        String code = codeGenerator.generateProcessCode();
    } catch (CodeGeneratorException e) {
        e.printStackTrace();
        fail("Test testGetTemplateURL() method failure.");
    }
}
Also used : INode(org.talend.core.model.process.INode) ProcessItem(org.talend.core.model.properties.ProcessItem) IComponent(org.talend.core.model.components.IComponent) CamelCodeGenerator(org.talend.camel.designer.codegen.CamelCodeGenerator) ItemState(org.talend.core.model.properties.ItemState) INode(org.talend.core.model.process.INode) Node(org.talend.designer.core.ui.editor.nodes.Node) RouteProcess(org.talend.camel.designer.ui.editor.RouteProcess) CodeGeneratorException(org.talend.designer.codegen.exception.CodeGeneratorException) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 CamelCodeGenerator (org.talend.camel.designer.codegen.CamelCodeGenerator)1 RouteProcess (org.talend.camel.designer.ui.editor.RouteProcess)1 IComponent (org.talend.core.model.components.IComponent)1 INode (org.talend.core.model.process.INode)1 ItemState (org.talend.core.model.properties.ItemState)1 ProcessItem (org.talend.core.model.properties.ProcessItem)1 Property (org.talend.core.model.properties.Property)1 CodeGeneratorException (org.talend.designer.codegen.exception.CodeGeneratorException)1 Node (org.talend.designer.core.ui.editor.nodes.Node)1