use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class JavaProcessorUtilitiesTest method testComputeLibrariesPath.
@Test
public void testComputeLibrariesPath() {
boolean headless = CommonsPlugin.isHeadless();
try {
CommonsPlugin.setHeadless(true);
IComponent tFixedFlowComponent = ComponentsFactoryProvider.getInstance().get("tFixedFlowInput", ComponentCategory.CATEGORY_4_DI.getName());
IComponent tLogRowComponent = ComponentsFactoryProvider.getInstance().get("tLogRow", 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 tFixedFlowInput_1 = new Node(tFixedFlowComponent, process);
createMetadataColumns(tFixedFlowInput_1.getMetadataList().get(0), 1);
Node tLogRow_1 = new Node(tLogRowComponent, process);
createMetadataColumns(tLogRow_1.getMetadataList().get(0), 1);
process.addNodeContainer(new NodeContainer(tFixedFlowInput_1));
process.addNodeContainer(new NodeContainer(tLogRow_1));
new Connection(tFixedFlowInput_1, tLogRow_1, EConnectionType.FLOW_MAIN, EConnectionType.FLOW_MAIN.getName(), "tFixedFlowInput_1", "row1", "row1", false);
Set<ModuleNeeded> neededLibraries = CorePlugin.getDefault().getDesignerCoreService().getNeededLibrariesForProcess(process, false);
try {
JavaProcessorUtilities.computeLibrariesPath(neededLibraries, process, new HashSet<ModuleNeeded>());
} catch (ProcessorException e) {
fail("computeLibrariesPath failed for process test{tFixedFlowInput->tLogRow}");
}
} finally {
CommonsPlugin.setHeadless(headless);
}
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class RunProcessContextTest method testLoadLog4jContextFromProcess.
@Test
public void testLoadLog4jContextFromProcess() {
Property property1 = PropertiesFactory.eINSTANCE.createProperty();
//$NON-NLS-1$
property1.setId("property1");
//$NON-NLS-1$
property1.setVersion("0.1");
//$NON-NLS-1$
property1.setLabel("job1");
Process process = new Process(property1);
IComponent tMysqlInputComponent = //$NON-NLS-1$
ComponentsFactoryProvider.getInstance().get(//$NON-NLS-1$
"tMysqlInput", ComponentCategory.CATEGORY_4_DI.getName());
Node tMysqlInput_1 = new Node(tMysqlInputComponent, process);
process.addNodeContainer(new NodeContainer(tMysqlInput_1));
RunProcessContext context = new RunProcessContext(process);
Assert.assertFalse(context.isUseCustomLevel());
//$NON-NLS-1$
Assert.assertEquals("", context.getLog4jLevel());
//
process.getElementParameter(EParameterName.LOG4J_RUN_ACTIVATE.getName()).setValue(true);
//$NON-NLS-1$
process.getElementParameter(EParameterName.LOG4J_RUN_LEVEL.getName()).setValue("Info");
context.loadLog4jContextFromProcess();
Assert.assertTrue(context.isUseCustomLevel());
//$NON-NLS-1$
Assert.assertEquals("Info", context.getLog4jLevel());
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class RepositoryUpdateTest method createBasicConnection.
/**
* DOC nrousseau Comment method "createBasicConnection".
*
* @param id
* @return
* @throws PersistenceException
*/
private GenericConnectionItem createBasicConnection(String id) throws PersistenceException {
GenericConnection connection = GenericMetadataFactory.eINSTANCE.createGenericConnection();
Property connectionProperty = PropertiesFactory.eINSTANCE.createProperty();
// ses the id to be used for persistence lookup
connectionProperty.setId(id);
connectionProperty.setAuthor(((RepositoryContext) CoreRuntimePlugin.getInstance().getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
connectionProperty.setVersion(VersionUtils.DEFAULT_VERSION);
//$NON-NLS-1$
connectionProperty.setStatusCode("");
connectionProperty.setLabel("test");
GenericConnectionItem connectionItem = GenericMetadataFactory.eINSTANCE.createGenericConnectionItem();
connectionItem.setProperty(connectionProperty);
connectionItem.setConnection(connection);
connectionItem.setTypeName("salesforce");
ProxyRepositoryFactory.getInstance().create(connectionItem, new Path(""));
return connectionItem;
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class JobJavaScriptsManager method getProcessItemPath.
protected IPath getProcessItemPath(ProcessItem processItem, String path, boolean flag, String... selectedJobVersion) throws Exception {
String processPath = processItem.getState().getPath();
if (path != null) {
processPath = path;
}
//$NON-NLS-1$ //$NON-NLS-2$
processPath = processPath == null || processPath.equals("") ? "" : processPath;
IPath emfFileRootPath = getEmfFileRootPath(processItem);
String jobName = processItem.getProperty().getLabel();
String jobVersion = processItem.getProperty().getVersion();
if (!isMultiNodes() && selectedJobVersion != null && selectedJobVersion.length == 1) {
jobVersion = selectedJobVersion[0];
}
IPath itemPath = emfFileRootPath.append(processPath).append(jobName + '_' + jobVersion + '.' + FileConstants.ITEM_EXTENSION);
File itemFile = itemPath.toFile();
if (!flag && !itemFile.exists()) {
IRepositoryViewObject specificVersion = CoreRuntimePlugin.getInstance().getProxyRepositoryFactory().getSpecificVersion(processItem.getProperty().getId(), jobVersion, true);
if (specificVersion != null) {
Property property = specificVersion.getProperty();
URI uri = property.eResource().getURI();
IPath fullPath = URIHelper.convert(uri);
IPath relativePath = fullPath.makeRelativeTo(emfFileRootPath);
String realProcessPath = relativePath.removeLastSegments(1).removeFirstSegments(2).toString();
return getProcessItemPath(processItem, realProcessPath, true, selectedJobVersion);
}
}
return itemPath;
}
use of org.talend.core.model.properties.Property in project tdi-studio-se by Talend.
the class TestUtils method createDefaultProperty.
public static Property createDefaultProperty() {
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setAuthor(((RepositoryContext) CorePlugin.getContext().getProperty(Context.REPOSITORY_CONTEXT_KEY)).getUser());
property.setVersion(VersionUtils.DEFAULT_VERSION);
return property;
}
Aggregations