Search in sources :

Example 1 with ExportServiceAction

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.");
    }
}
Also used : ExportServiceAction(org.talend.repository.services.ui.action.ExportServiceAction) ServiceConnection(org.talend.repository.services.model.services.ServiceConnection) ItemState(org.talend.core.model.properties.ItemState) ExportChoice(org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice) ServiceItem(org.talend.repository.services.model.services.ServiceItem) EnumMap(java.util.EnumMap) Property(org.talend.core.model.properties.Property) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 EnumMap (java.util.EnumMap)1 Test (org.junit.Test)1 ItemState (org.talend.core.model.properties.ItemState)1 Property (org.talend.core.model.properties.Property)1 ServiceConnection (org.talend.repository.services.model.services.ServiceConnection)1 ServiceItem (org.talend.repository.services.model.services.ServiceItem)1 ExportServiceAction (org.talend.repository.services.ui.action.ExportServiceAction)1 ExportChoice (org.talend.repository.ui.wizards.exportjob.scriptsmanager.JobScriptsManager.ExportChoice)1