Search in sources :

Example 51 with Property

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

the class ConnectionManagerTest 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);
    //$NON-NLS-1$
    property.setStatusCode("");
    return property;
}
Also used : Property(org.talend.core.model.properties.Property)

Example 52 with Property

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

the class JobSettingsManagerTest method testCreateExtraContextLoadNodes.

/**
     * Test method for
     * {@link org.talend.designer.core.model.process.jobsettings.JobSettingsManager#createExtraContextLoadNodes(org.talend.core.model.process.IProcess)}
     * .
     */
@Test
public void testCreateExtraContextLoadNodes() {
    // junit for TUP-3972
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    IProcess2 process = new Process(property);
    process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD.getName()).setValue(true);
    process.getElementParameter(EParameterName.IMPLICIT_TCONTEXTLOAD_FILE.getName()).setValue("the test file");
    process.getElementParameter("FROM_FILE_FLAG_IMPLICIT_CONTEXT").setValue(true);
    final List<DataNode> createContextLoadNodes = JobSettingsManager.createExtraContextLoadNodes(process);
    assertNotEquals(createContextLoadNodes.size(), 0);
    final DataNode dataNode = createContextLoadNodes.get(0);
    final IMetadataTable metadataTable = dataNode.getMetadataList().get(0);
    for (IMetadataColumn column : metadataTable.getListColumns()) {
        assertNotNull(column.getDefault());
        assertNotNull(JavaTypesManager.getDefaultValueFromJavaType(column.getTalendType(), column.getDefault()));
    }
}
Also used : IMetadataTable(org.talend.core.model.metadata.IMetadataTable) DataNode(org.talend.designer.core.model.process.DataNode) IProcess2(org.talend.core.model.process.IProcess2) Process(org.talend.designer.core.ui.editor.process.Process) IMetadataColumn(org.talend.core.model.metadata.IMetadataColumn) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 53 with Property

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

the class ChangeOutputConnectionOrderCommandTest method test.

@Test
public void test() {
    tSAPBapiComponent = ComponentsFactoryProvider.getInstance().get("tSAPBapi", ComponentCategory.CATEGORY_4_DI.getName());
    tLogRowComponent = ComponentsFactoryProvider.getInstance().get("tLogRow", ComponentCategory.CATEGORY_4_DI.getName());
    Property property1 = PropertiesFactory.eINSTANCE.createProperty();
    //$NON-NLS-1$
    property1.setId("property1");
    //$NON-NLS-1$
    property1.setVersion("0.1");
    //$NON-NLS-1$
    property1.setLabel("test1");
    Process process = new Process(property1);
    Node tSAPBapi_1 = new Node(tSAPBapiComponent, process);
    tSAPBapi_1.getMetadataList().add(createMetadataTable("row_IV_KOKRS_1"));
    tSAPBapi_1.getMetadataList().add(createMetadataTable("row_ES_RETURN_1"));
    tSAPBapi_1.getMetadataList().add(createMetadataTable("row_ET_COSTELEMGRP_HIER_1"));
    tSAPBapi_1.getMetadataList().add(createMetadataTable("row_SINGLE_PARAM_1"));
    Node tLogRow_1 = new Node(tLogRowComponent, process);
    Connection conn1 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_ES_RETURN_1", "row_ES_RETURN_1", false);
    Connection conn2 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_ET_COSTELEMGRP_HIER_1", "row_ET_COSTELEMGRP_HIER_1", false);
    Connection conn3 = new Connection(tSAPBapi_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tSAPBapi_1", "row_SINGLE_PARAM_1", "row_SINGLE_PARAM_1", false);
    List<IConnection> reoderConnection = new ArrayList<IConnection>();
    reoderConnection.add(conn2);
    reoderConnection.add(conn3);
    reoderConnection.add(conn1);
    ChangeOutputConnectionOrderCommand command = new ChangeOutputConnectionOrderCommand(tSAPBapi_1, reoderConnection);
    command.execute();
    Assert.assertEquals(conn1.getConnectionLabel().getLabelText(), "row_ES_RETURN_1 (Main order:3)");
    Assert.assertEquals(conn2.getConnectionLabel().getLabelText(), "row_ET_COSTELEMGRP_HIER_1 (Main order:1)");
    Assert.assertEquals(conn3.getConnectionLabel().getLabelText(), "row_SINGLE_PARAM_1 (Main order:2)");
    command.undo();
    Assert.assertEquals(conn1.getConnectionLabel().getLabelText(), "row_ES_RETURN_1 (Main order:1)");
    Assert.assertEquals(conn2.getConnectionLabel().getLabelText(), "row_ET_COSTELEMGRP_HIER_1 (Main order:2)");
    Assert.assertEquals(conn3.getConnectionLabel().getLabelText(), "row_SINGLE_PARAM_1 (Main order:3)");
}
Also used : Node(org.talend.designer.core.ui.editor.nodes.Node) IConnection(org.talend.core.model.process.IConnection) Connection(org.talend.designer.core.ui.editor.connections.Connection) ArrayList(java.util.ArrayList) Process(org.talend.designer.core.ui.editor.process.Process) IConnection(org.talend.core.model.process.IConnection) Property(org.talend.core.model.properties.Property) Test(org.junit.Test)

Example 54 with Property

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

the class ConnectionCreateCommandTest method getFakeProcess.

private IProcess2 getFakeProcess() {
    Property property = PropertiesFactory.eINSTANCE.createProperty();
    //$NON-NLS-1$
    property.setId("junitId");
    //$NON-NLS-1$
    property.setVersion("0.1");
    //$NON-NLS-1$
    property.setLabel("test");
    return new Process(property);
}
Also used : Process(org.talend.designer.core.ui.editor.process.Process) Property(org.talend.core.model.properties.Property)

Example 55 with Property

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

the class JobJavaScriptOSGIForESBManager method getExportResources.

@Override
public List<ExportFileResource> getExportResources(ExportFileResource[] processes, String... codeOptions) throws ProcessorException {
    List<ExportFileResource> list = new ArrayList<ExportFileResource>();
    //$NON-NLS-1$;
    ExportFileResource osgiResource = new ExportFileResource(null, "");
    //$NON-NLS-1$
    ExportFileResource jobScriptResource = new ExportFileResource(null, "");
    list.add(osgiResource);
    list.add(jobScriptResource);
    // set export config mode now only to be sure that the libraries will be
    // setup for an export mode, and not
    // editor mode.
    //$NON-NLS-1$
    ProcessorUtilities.setExportConfig(JAVA, "", "");
    // set export type as osgi
    ProcessorUtilities.setExportAsOSGI(true);
    try {
        ProcessItem processItem = null;
        for (ExportFileResource process : processes) {
            processItem = (ProcessItem) process.getItem();
            if (processItem.eIsProxy() || processItem.getProcess().eIsProxy()) {
                try {
                    Property property = ProxyRepositoryFactory.getInstance().getUptodateProperty(processItem.getProperty());
                    processItem = (ProcessItem) property.getItem();
                } catch (PersistenceException e) {
                    throw new ProcessorException(e);
                }
            }
            String jobVersion = processItem.getProperty().getVersion();
            if (!isMultiNodes() && getSelectedJobVersion() != null) {
                jobVersion = getSelectedJobVersion();
            }
            ProcessorUtilities.setExportConfig(process.getDirectoryName(), true);
            String processId = processItem.getProperty().getId();
            if (null == contextName) {
                contextName = processItem.getProcess().getDefaultContext();
            }
            IProcess iProcess = generateJobFiles(processItem, contextName, jobVersion, statisticPort != IProcessor.NO_STATISTICS, tracePort != IProcessor.NO_TRACES, isOptionChoosed(ExportChoice.applyToChildren), progressMonitor);
            analysisModules(processId, jobVersion);
            analysisMavenModule(processItem);
            // generate jar file for job
            getJobScriptsUncompressed(jobScriptResource, processItem);
            // dynamic DB XML mapping
            addXmlMapping(process, isOptionChoosed(ExportChoice.needSourceCode));
            generateConfig(osgiResource, processItem, iProcess);
            addResources(osgiResource, processItem);
            /*
                 * export current item's dependencies. this used for TDM components specially and need more discussion
                 * about then
                 */
            BuildExportManager.getInstance().exportOSGIDependencies(osgiResource, processItem);
        }
        ExportFileResource libResource = getCompiledLibExportFileResource(processes);
        list.add(libResource);
        // generate the META-INFO folder
        ExportFileResource metaInfoFolder = genMetaInfoFolder(libResource, processItem);
        list.add(0, metaInfoFolder);
        ExportFileResource providedLibResources = getProvidedLibExportFileResource(processes);
        if (providedLibResources != null) {
            list.add(providedLibResources);
        }
    } catch (ProcessorException e) {
        throw e;
    } catch (Exception e) {
        throw new ProcessorException(e);
    }
    return list;
}
Also used : ProcessorException(org.talend.designer.runprocess.ProcessorException) ProcessItem(org.talend.core.model.properties.ProcessItem) ExportFileResource(org.talend.repository.documentation.ExportFileResource) ArrayList(java.util.ArrayList) PersistenceException(org.talend.commons.exception.PersistenceException) Property(org.talend.core.model.properties.Property) IProcess(org.talend.core.model.process.IProcess) ProcessorException(org.talend.designer.runprocess.ProcessorException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) PersistenceException(org.talend.commons.exception.PersistenceException)

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