use of org.talend.repository.services.ui.action.ExportServiceAction in project tesb-studio-se by Talend.
the class ExportServiceActionTest method testRun.
/**
* Test method for
* {@link org.talend.repository.services.ui.action.ExportServiceAction#run(org.eclipse.core.runtime.IProgressMonitor)}
* .
*/
@Test
public void testRun() {
Map<ExportChoice, Object> exportChoiceMap = new EnumMap<ExportChoice, Object>(ExportChoice.class);
exportChoiceMap.put(ExportChoice.needLauncher, true);
exportChoiceMap.put(ExportChoice.needSystemRoutine, true);
exportChoiceMap.put(ExportChoice.needUserRoutine, true);
exportChoiceMap.put(ExportChoice.needTalendLibraries, true);
exportChoiceMap.put(ExportChoice.needJobItem, true);
exportChoiceMap.put(ExportChoice.needJobScript, true);
exportChoiceMap.put(ExportChoice.needContext, true);
exportChoiceMap.put(ExportChoice.needSourceCode, true);
exportChoiceMap.put(ExportChoice.applyToChildren, false);
exportChoiceMap.put(ExportChoice.doNotCompileCode, false);
exportChoiceMap.put(ExportChoice.needMavenScript, false);
ServiceItem serviceItem = ServicesFactory.eINSTANCE.createServiceItem();
Property property = PropertiesFactory.eINSTANCE.createProperty();
property.setLabel("testSvr");
serviceItem.setProperty(property);
ItemState state = PropertiesFactory.eINSTANCE.createItemState();
serviceItem.setState(state);
ServiceConnection connection = ServicesFactoryImpl.eINSTANCE.createServiceConnection();
serviceItem.setConnection(connection);
try {
File fileName = File.createTempFile("serviceExportTest", ".jar");
ExportServiceAction action = new ExportServiceAction(serviceItem, fileName.getAbsolutePath(), exportChoiceMap);
Assert.assertNotNull(action.getTmpFolderPath());
} catch (Exception e) {
e.printStackTrace();
fail("Test testRun() method failure.");
}
}
Aggregations