Search in sources :

Example 1 with CheckingBundlesProgress

use of org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress in project tesb-studio-se by Talend.

the class RunContainerProcessor method run.

@Override
public Process run(int statisticsPort, int tracePort, String watchParam, String log4jLevel, IProgressMonitor monitor, IProcessMessageManager processMessageManager) throws ProcessorException {
    if (!RuntimeServerController.getInstance().isRunning()) {
        try {
            new StartRuntimeProgress(true).run(monitor);
            new CheckingBundlesProgress().run(monitor);
        } catch (Exception e) {
            throw new ProcessorException(RunContainerMessages.getString("StartRuntimeAction.ErrorStart"), e);
        }
    }
    if (RuntimeServerController.getInstance().isRunning()) {
        RunESBRuntimeProcess esbRunContainerProcess = new RunESBRuntimeProcess(process, statisticsPort, tracePort, monitor);
        esbRunContainerProcess.setMessageManager(processMessageManager);
        try {
            esbRunContainerProcess.start();
        } catch (Exception e) {
            throw new ProcessorException(e);
        }
        return esbRunContainerProcess;
    } else {
        throw new ProcessorException(RunContainerMessages.getString("StartRuntimeAction.ErrorStart"));
    }
}
Also used : StartRuntimeProgress(org.talend.designer.esb.runcontainer.ui.progress.StartRuntimeProgress) ProcessorException(org.talend.designer.runprocess.ProcessorException) CheckingBundlesProgress(org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress) ProcessorException(org.talend.designer.runprocess.ProcessorException)

Example 2 with CheckingBundlesProgress

use of org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress in project tesb-studio-se by Talend.

the class CheckingBundlesProgressTest method testRun.

/**
 * Test method for
 * {@link org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress#run(org.eclipse.core.runtime.IProgressMonitor)}
 * .
 *
 * @throws Exception
 */
@Test
public void testRun() throws Exception {
    long[] bundles = new long[] { 1, 2, 3 };
    IProgressMonitor monitor = new NullProgressMonitor();
    monitor.beginTask("test", 1);
    try {
        CheckingBundlesProgress mock = Mockito.mock(CheckingBundlesProgress.class);
        Mockito.when(mock.checkRunning()).thenReturn(true);
        mock.run(monitor);
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    Assert.assertFalse(monitor.isCanceled());
}
Also used : NullProgressMonitor(org.eclipse.core.runtime.NullProgressMonitor) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CheckingBundlesProgress(org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress) InvocationTargetException(java.lang.reflect.InvocationTargetException) Test(org.junit.Test)

Aggregations

CheckingBundlesProgress (org.talend.designer.esb.runcontainer.ui.progress.CheckingBundlesProgress)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 Test (org.junit.Test)1 StartRuntimeProgress (org.talend.designer.esb.runcontainer.ui.progress.StartRuntimeProgress)1 ProcessorException (org.talend.designer.runprocess.ProcessorException)1