Search in sources :

Example 56 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class ComponentListControllerTest method testrenameComponentUniqueName.

@Test
public void testrenameComponentUniqueName() {
    //---first
    String oldConnectionName = "joblet3_1";
    String newConnectionName = "joblet1_1_joblet2_1_joblet3_1";
    List<Node> nodesToUpdate = new ArrayList<Node>();
    IComponent component = ComponentsFactoryProvider.getInstance().get("tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    Process process = new Process(property);
    Node node = new Node(component, process);
    nodesToUpdate.add(node);
    IElementParameter param = node.getElementParameter("CONNECTION");
    param.setValue("joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1");
    ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
    assertTrue(param.getValue().equals("joblet1_1_joblet2_1_joblet3_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
    //---second
    oldConnectionName = "tMysqlConnection_1";
    newConnectionName = "joblet1_1_joblet2_1_tMysqlConnection_1";
    param.setValue("tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1");
    ComponentListController.renameComponentUniqueName(oldConnectionName, newConnectionName, nodesToUpdate);
    assertTrue(param.getValue().equals("joblet1_1_joblet2_1_tMysqlConnection_1_joblet4_1_joblet5_1_tMysqlConnection_1"));
}
Also used : IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) ArrayList(java.util.ArrayList) IElementParameter(org.talend.core.model.process.IElementParameter) Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 57 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class UpdateELTMapComponentCommandTest method createProperty.

private static Property createProperty() {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
    property.setVersion(VersionUtils.DEFAULT_VERSION);
    return property;
}
Also used : Property(org.talend.core.model.properties.Property)

Example 58 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class PurposeStatusSection method setInput.

@Override
public void setInput(IWorkbenchPart part, ISelection selection) {
    super.setInput(part, selection);
    try {
        Property property = getObject().getProperty();
        List<Status> status = property == null ? new ArrayList<Status>() : statusHelper.getStatusList(property);
        statusText.setItems(toArray(status));
    } catch (PersistenceException e) {
        // e.printStackTrace();
        ExceptionHandler.process(e);
    }
}
Also used : Status(org.talend.core.model.properties.Status) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property)

Example 59 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class ProcessErrorUtilTest method testGetAllErrorMess.

/**
     * Test method for
     * {@link org.talend.designer.runprocess.ui.ProcessComposite#getAllErrorMess(org.talend.designer.runprocess.IProcessMessage)}
     * .
     */
@Test
public void testGetAllErrorMess() {
    Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    //$NON-NLS-1$
    property1.setId("property1");
    //$NON-NLS-1$
    property1.setVersion("0.1");
    //$NON-NLS-1$
    property1.setLabel("ParentJob");
    Process process = new Process(property1);
    IComponent tOracleSPComponent = ComponentsFactoryProvider.getInstance().get("tOracleSP", ComponentCategory.CATEGORY_4_DI.getName());
    Node tOracleSP_1 = new Node(tOracleSPComponent, process);
    process.addNodeContainer(new NodeContainer(tOracleSP_1));
    RunProcessContext context = new RunProcessContext(process);
    String errorMessage1 = "Exception in component tOracleSP_1 (ParentJob)\njava.sql.SQLException: ORA-20000: Failed to execute one or more sql statements";
    ProcessMessage message1 = new ProcessMessage(MsgType.STD_ERR, errorMessage1);
    HashMap<String, IProcessMessage> errorMessMap = ProcessErrorUtil.getAllErrorMess(message1, context);
    Assert.assertEquals(errorMessMap.get(tOracleSP_1.getUniqueName()).getContent(), errorMessage1);
    String errorMessage2 = "Exception in component tOracleSP_1 (ChildJob)\njava.sql.SQLException: ORA-20000: Failed to execute one or more sql statements";
    ProcessMessage message2 = new ProcessMessage(MsgType.STD_ERR, errorMessage2);
    HashMap<String, IProcessMessage> errorMessMap2 = ProcessErrorUtil.getAllErrorMess(message2, context);
    Assert.assertNull(errorMessMap2.get(tOracleSP_1.getUniqueName()));
}
Also used : RunProcessContext(org.talend.designer.runprocess.RunProcessContext) IProcessMessage(org.talend.designer.runprocess.IProcessMessage) IComponent(org.talend.core.model.components.IComponent) Node(org.talend.designer.core.ui.editor.nodes.Node) IProcessMessage(org.talend.designer.runprocess.IProcessMessage) ProcessMessage(org.talend.designer.runprocess.ProcessMessage) 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)

Example 60 with Property

use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.

the class JavaProcessorUtilitiesTest method testComputeLibrariesPathWithMissingJars.

@Test
public void testComputeLibrariesPathWithMissingJars() {
    boolean headless = CommonsPlugin.isHeadless();
    try {
        // don't popup dialog to block ui
        CommonsPlugin.setHeadless(true);
        IComponent tLibraryLoadComponent = ComponentsFactoryProvider.getInstance().get("tLibraryLoad", ComponentCategory.CATEGORY_4_DI.getName());
        Property property = PropertiesFactory.eINSTANCE.createProperty();
        //$NON-NLS-1$
        property.setId("property");
        //$NON-NLS-1$
        property.setVersion("0.1");
        //$NON-NLS-1$
        property.setLabel("test");
        Process process = new Process(property);
        Node tLibraryLoad_1 = new Node(tLibraryLoadComponent, process);
        process.addNodeContainer(new NodeContainer(tLibraryLoad_1));
        tLibraryLoad_1.getElementParameter("LIBRARY").setValue("computeLibrariesPath.jar");
        Set<ModuleNeeded> neededLibraries = CorePlugin.getDefault().getDesignerCoreService().getNeededLibrariesForProcess(process, false);
        ProcessorException exception = null;
        try {
            JavaProcessorUtilities.computeLibrariesPath(neededLibraries, process, new HashSet<ModuleNeeded>());
        } catch (ProcessorException e) {
            exception = e;
        }
        if (exception != null) {
            Assert.assertTrue(exception.getMessage().contains("computeLibrariesPath.jar"));
        } else {
            fail("computeLibrariesPath failed for process test{tLibraryLoad},computeLibrariesPath.jar not found but no exception");
        }
    } finally {
        CommonsPlugin.setHeadless(headless);
    }
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) IComponent(org.talend.core.model.components.IComponent) 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) ModuleNeeded(org.talend.core.model.general.ModuleNeeded) Test(org.junit.Test)

Aggregations

Property (org.talend.core.model.properties.Property)147 PersistenceException (org.talend.commons.exception.PersistenceException)56 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)48 Item (org.talend.core.model.properties.Item)46 ProcessItem (org.talend.core.model.properties.ProcessItem)39 IProxyRepositoryFactory (org.talend.repository.model.IProxyRepositoryFactory)36 Node (org.talend.designer.core.ui.editor.nodes.Node)28 Process (org.talend.designer.core.ui.editor.process.Process)23 RepositoryNode (org.talend.repository.model.RepositoryNode)22 IElementParameter (org.talend.core.model.process.IElementParameter)21 ConnectionItem (org.talend.core.model.properties.ConnectionItem)21 IDynamicProperty (org.talend.core.ui.properties.tab.IDynamicProperty)21 ArrayList (java.util.ArrayList)20 Test (org.junit.Test)19 INode (org.talend.core.model.process.INode)19 IComponent (org.talend.core.model.components.IComponent)15 Connection (org.talend.core.model.metadata.builder.connection.Connection)14 IProcess2 (org.talend.core.model.process.IProcess2)14 List (java.util.List)12 IFile (org.eclipse.core.resources.IFile)12