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