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;
}
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()));
}
}
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)");
}
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);
}
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;
}
Aggregations