Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fc019dc0ee6701abc067264c7e07487fbbf7499d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*******************************************************************************
 * Copyright (c) 2010 BSI Business Systems Integration AG.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     BSI Business Systems Integration AG - initial API and implementation
 ******************************************************************************/
package org.eclipse.scout.rt.testing.server;

import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.scout.rt.testing.shared.ScoutJUnitPluginTestExecutor;

/**
 * Runs all @Test annotated methods in all classes and then exit
 * <p>
 * Normally this is called from within a server application in the start method <code><pre>
 *   public Object start(IApplicationContext context) throws Exception {
 *     logger.info("server initialized");
 *     //
 *     new JUnitServerJob().schedule();
 *     return EXIT_OK;
 *   }
 * </pre></code>
 */
public class JUnitServerJob extends Job {
  public JUnitServerJob() {
    super("JUnit Server Job");
  }

  @Override
  protected IStatus run(IProgressMonitor monitor) {
    ScoutJUnitPluginTestExecutor scoutJUnitPluginTestExecutor = new ScoutJUnitPluginTestExecutor();
    final int code = scoutJUnitPluginTestExecutor.runAllTests();
    System.exit(code);
    return Status.OK_STATUS;
  }
}

Back to the top