X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=osgi%2Fruntime%2Forg.argeo.osgi.boot%2Fsrc%2Ftest%2Fjava%2Forg%2Fargeo%2Fosgi%2Fboot%2FOsgiBootRuntimeTest.java;h=fd32f1ae08a3bebfb95954b230a4b7513840be74;hb=c1742bece3a0d15600aa9212f3a07df9be1d70d2;hp=0f2eb7d3247e72878f8af12caba89e8daee551df;hpb=5b77596e389e631a16bc849bddf0603d56582b1f;p=lgpl%2Fargeo-commons.git diff --git a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootRuntimeTest.java b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootRuntimeTest.java index 0f2eb7d32..fd32f1ae0 100644 --- a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootRuntimeTest.java +++ b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootRuntimeTest.java @@ -21,7 +21,6 @@ import java.util.TreeMap; import junit.framework.TestCase; -import org.argeo.osgi.boot.OsgiBoot; import org.eclipse.core.runtime.adaptor.EclipseStarter; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -29,8 +28,14 @@ import org.osgi.framework.BundleContext; /** Starts an Equinox runtime and provision it with OSGi boot. */ public class OsgiBootRuntimeTest extends TestCase { protected OsgiBoot osgiBoot = null; + private boolean osgiRuntimeAlreadyRunning = false; public void testInstallAndStart() throws Exception { + if (osgiRuntimeAlreadyRunning) { + System.out + .println("OSGi runtime already running, skipping test..."); + return; + } osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL, OsgiBootNoRuntimeTest.BUNDLES)); Map map = new TreeMap(osgiBoot.getBundlesBySymbolicName()); @@ -71,11 +76,16 @@ public class OsgiBootRuntimeTest extends TestCase { } public void setUp() throws Exception { + osgiRuntimeAlreadyRunning = EclipseStarter.isRunning(); + if (osgiRuntimeAlreadyRunning) + return; BundleContext bundleContext = startRuntime(); osgiBoot = new OsgiBoot(bundleContext); } public void tearDown() throws Exception { + if (osgiRuntimeAlreadyRunning) + return; osgiBoot = null; stopRuntime(); }