From: Mathieu Baudier Date: Mon, 23 May 2011 08:44:06 +0000 (+0000) Subject: Remove deprecated properties X-Git-Tag: argeo-commons-2.1.30~1249 X-Git-Url: https://git.argeo.org/?a=commitdiff_plain;h=3f6778125ace0c2cf816a8cf532ef8210f24394e;p=lgpl%2Fargeo-commons.git Remove deprecated properties git-svn-id: https://svn.argeo.org/commons/trunk@4538 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/Launcher.java b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/Launcher.java index 98d7503e3..364e2a8ef 100644 --- a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/Launcher.java +++ b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/Launcher.java @@ -25,13 +25,13 @@ import java.util.Vector; import org.eclipse.core.runtime.adaptor.EclipseStarter; import org.osgi.framework.BundleContext; +/** Command line interface. */ public class Launcher { public static void main(String[] args) { // Try to load system properties - String systemPropertiesFilePath = OsgiBootUtils.getPropertyCompat( - OsgiBoot.PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE, - OsgiBoot.PROP_SLC_OSGIBOOT_SYSTEM_PROPERTIES_FILE); + String systemPropertiesFilePath = OsgiBootUtils + .getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_SYSTEM_PROPERTIES_FILE); if (systemPropertiesFilePath != null) { FileInputStream in; try { @@ -68,23 +68,16 @@ public class Launcher { } protected static void startMainClass() { - // Properties config = System.getProperties(); - // String className = config.getProperty("slc.osgiboot.appclass"); - String className = OsgiBootUtils.getPropertyCompat( - OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS, - OsgiBoot.PROP_SLC_OSGIBOOT_APPCLASS); + String className = OsgiBootUtils + .getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPCLASS); if (className == null) return; - // should use OsgiBootUtils.getPropertyCompat(), but it does not - // work for "" as default value - // so no warning displayed if PROP_SLC_OSGIBOOT_APPARGS is used - // FIXME: change OsgiBootUtils.getPropertyCompat() - String line = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPARGS, - System.getProperty(OsgiBoot.PROP_SLC_OSGIBOOT_APPARGS, "")); - + String line = System.getProperty(OsgiBoot.PROP_ARGEO_OSGI_BOOT_APPARGS, + ""); + String[] uiArgs = readArgumentsFromLine(line); - + try { // Launch main method using reflection Class clss = Class.forName(className); @@ -103,9 +96,7 @@ public class Launcher { * arguments. (nested \" are not supported) */ private static String[] readArgumentsFromLine(String lineOrig) { - String line = lineOrig.trim();// remove trailing spaces - // System.out.println("line=" + line); List args = new Vector(); StringBuffer curr = new StringBuffer(""); boolean inQuote = false; @@ -139,7 +130,6 @@ public class Launcher { String[] res = new String[args.size()]; for (int i = 0; i < args.size(); i++) { res[i] = args.get(i).toString(); - // System.out.println("res[i]=" + res[i]); } return res; } diff --git a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBoot.java b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBoot.java index 7c3798697..63e5d059b 100644 --- a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBoot.java +++ b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBoot.java @@ -43,6 +43,7 @@ import org.osgi.framework.ServiceReference; import org.osgi.service.packageadmin.ExportedPackage; import org.osgi.service.packageadmin.PackageAdmin; +/** Core component, performing basic provisioning of an OSGi runtime. */ public class OsgiBoot { public final static String SYMBOLIC_NAME_OSGI_BOOT = "org.argeo.osgi.boot"; public final static String SYMBOLIC_NAME_EQUINOX = "org.eclipse.osgi"; @@ -62,36 +63,11 @@ public class OsgiBoot { public final static String PROP_ARGEO_OSGI_BOOT_APPCLASS = "argeo.osgi.boot.appclass"; public final static String PROP_ARGEO_OSGI_BOOT_APPARGS = "argeo.osgi.boot.appargs"; - /** @deprecated */ - public final static String PROP_SLC_OSGI_START = "slc.osgi.start"; - /** @deprecated */ - public final static String PROP_SLC_OSGI_BUNDLES = "slc.osgi.bundles"; - /** @deprecated */ - public final static String PROP_SLC_OSGI_LOCATIONS = "slc.osgi.locations"; - /** @deprecated */ - public final static String PROP_SLC_OSGI_BASE_URL = "slc.osgi.baseUrl"; - /** @deprecated */ - public final static String PROP_SLC_OSGI_MODULES_URL = "slc.osgi.modulesUrl"; - - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_DEBUG = "slc.osgiboot.debug"; - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_DEFAULT_TIMEOUT = "slc.osgiboot.defaultTimeout"; - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_MODULES_URL_SEPARATOR = "slc.osgiboot.modulesUrlSeparator"; - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_SYSTEM_PROPERTIES_FILE = "slc.osgiboot.systemPropertiesFile"; - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_APPCLASS = "slc.osgiboot.appclass"; - /** @deprecated */ - public final static String PROP_SLC_OSGIBOOT_APPARGS = "slc.osgiboot.appargs"; - public final static String DEFAULT_BASE_URL = "reference:file:"; public final static String EXCLUDES_SVN_PATTERN = "**/.svn/**"; private boolean debug = Boolean.valueOf( - System.getProperty(PROP_ARGEO_OSGI_BOOT_DEBUG, - System.getProperty(PROP_SLC_OSGIBOOT_DEBUG, "false"))) + System.getProperty(PROP_ARGEO_OSGI_BOOT_DEBUG, "false")) .booleanValue(); /** Default is 10s (set in constructor) */ private long defaultTimeout; @@ -104,12 +80,10 @@ public class OsgiBoot { public OsgiBoot(BundleContext bundleContext) { this.bundleContext = bundleContext; - defaultTimeout = Long.parseLong(OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BOOT_DEFAULT_TIMEOUT, - PROP_SLC_OSGIBOOT_DEFAULT_TIMEOUT, "10000")); - modulesUrlSeparator = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BOOT_MODULES_URL_SEPARATOR, - PROP_SLC_OSGIBOOT_MODULES_URL_SEPARATOR, ","); + defaultTimeout = Long.parseLong(OsgiBootUtils.getProperty( + PROP_ARGEO_OSGI_BOOT_DEFAULT_TIMEOUT, "10000")); + modulesUrlSeparator = OsgiBootUtils.getProperty( + PROP_ARGEO_OSGI_BOOT_MODULES_URL_SEPARATOR, ","); initSystemProperties(); } @@ -262,8 +236,8 @@ public class OsgiBoot { } public void startBundles() { - String bundlesToStart = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_START, PROP_SLC_OSGI_START); + String bundlesToStart = OsgiBootUtils + .getProperty(PROP_ARGEO_OSGI_START); startBundles(bundlesToStart); } @@ -342,6 +316,7 @@ public class OsgiBoot { } } + /** List packages exported twice. */ public Map findPackagesExportedTwice() { ServiceReference paSr = bundleContext .getServiceReference(PackageAdmin.class.getName()); @@ -445,23 +420,21 @@ public class OsgiBoot { } public List getLocationsUrls() { - String baseUrl = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BASE_URL, PROP_SLC_OSGI_BASE_URL, + String baseUrl = OsgiBootUtils.getProperty(PROP_ARGEO_OSGI_BASE_URL, DEFAULT_BASE_URL); - String bundleLocations = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_LOCATIONS, PROP_SLC_OSGI_LOCATIONS); + String bundleLocations = OsgiBootUtils + .getProperty(PROP_ARGEO_OSGI_LOCATIONS); return getLocationsUrls(baseUrl, bundleLocations); } public List getModulesUrls() { List urls = new ArrayList(); - String modulesUrlStr = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_MODULES_URL, PROP_SLC_OSGI_MODULES_URL); + String modulesUrlStr = OsgiBootUtils + .getProperty(PROP_ARGEO_OSGI_MODULES_URL); if (modulesUrlStr == null) return urls; - String baseUrl = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BASE_URL, PROP_SLC_OSGI_BASE_URL); + String baseUrl = OsgiBootUtils.getProperty(PROP_ARGEO_OSGI_BASE_URL); Map installedBundles = getBundles(); @@ -586,11 +559,10 @@ public class OsgiBoot { } public List getBundlesUrls() { - String baseUrl = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BASE_URL, PROP_SLC_OSGI_BASE_URL, + String baseUrl = OsgiBootUtils.getProperty(PROP_ARGEO_OSGI_BASE_URL, DEFAULT_BASE_URL); - String bundlePatterns = OsgiBootUtils.getPropertyCompat( - PROP_ARGEO_OSGI_BUNDLES, PROP_SLC_OSGI_BUNDLES); + String bundlePatterns = OsgiBootUtils + .getProperty(PROP_ARGEO_OSGI_BUNDLES); return getBundlesUrls(baseUrl, bundlePatterns); } diff --git a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java index a9067a213..acc0302e6 100644 --- a/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java +++ b/osgi/runtime/org.argeo.osgi.boot/src/main/java/org/argeo/osgi/boot/OsgiBootUtils.java @@ -16,6 +16,7 @@ package org.argeo.osgi.boot; +/** Utilities, mostly related to logging. */ public class OsgiBootUtils { public static void info(Object obj) { @@ -23,7 +24,7 @@ public class OsgiBootUtils { } public static void debug(Object obj) { - System.out.println("# OSGiBOOT DBG # " + obj); + System.out.println("# OSGiBOOT DBG # " + obj); } public static void warn(Object obj) { @@ -35,14 +36,18 @@ public class OsgiBootUtils { // System.err.println("# WARN " + obj); } - //FIXE: returns null when defaultValue is "" + /** + * Gets a property value + * + * @return null when defaultValue is "" + */ public static String getProperty(String name, String defaultValue) { final String value; if (defaultValue != null) value = System.getProperty(name, defaultValue); else value = System.getProperty(name); - + if (value == null || value.equals("")) return null; else @@ -53,36 +58,4 @@ public class OsgiBootUtils { return getProperty(name, null); } - public static String getPropertyCompat(String name, String oldName) { - return getPropertyCompat(name, oldName, null); - } - - public static String getPropertyCompat(String name, String oldName, - String defaultValue) { - String res = null; - - if (defaultValue != null) { - res = getProperty(name, defaultValue); - if (res.equals(defaultValue)) { - res = getProperty(oldName, defaultValue); - if (!res.equals(defaultValue)) - warnDeprecated(name, oldName); - } - } else { - res = getProperty(name, null); - if (res == null) { - res = getProperty(oldName, null); - if (res != null) - warnDeprecated(name, oldName); - } - } - return res; - } - - public static void warnDeprecated(String name, String oldName) { - warn("Property '" + oldName - + "' is deprecated and will be removed soon, use '" + name - + "' instead."); - } - } diff --git a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootNoRuntimeTest.java b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootNoRuntimeTest.java new file mode 100644 index 000000000..198547850 --- /dev/null +++ b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootNoRuntimeTest.java @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.argeo.osgi.boot; + +import java.io.File; +import java.util.List; + +import junit.framework.TestCase; + +import org.argeo.osgi.boot.OsgiBoot; + +/** Tests which do not require a runtime. */ +public class OsgiBootNoRuntimeTest extends TestCase { + public final static String BUNDLES = "src/test/bundles/some;in=*;ex=excluded," + + "src/test/bundles/others;in=**/org.argeo.*"; + + /** Tests that location lists are properly parsed. */ + public void testLocations() { + String baseUrl = "file:"; + String locations = "/mydir/myfile" + File.pathSeparator + + "/myotherdir/myotherfile"; + + OsgiBoot osgiBoot = new OsgiBoot(null); + List urls = osgiBoot.getLocationsUrls(baseUrl, locations); + assertEquals(2, urls.size()); + assertEquals("file:/mydir/myfile", urls.get(0)); + assertEquals("file:/myotherdir/myotherfile", urls.get(1)); + } + + /** Tests that bundle lists are properly parsed. */ + public void testBundles() { + String baseUrl = "file:"; + String bundles = BUNDLES; + OsgiBoot osgiBoot = new OsgiBoot(null); + List urls = osgiBoot.getBundlesUrls(baseUrl, bundles); + for (int i = 0; i < urls.size(); i++) + System.out.println(urls.get(i)); + assertEquals(3, urls.size()); + + List jarUrls = osgiBoot.getBundlesUrls(baseUrl, + "src/test/bundles/jars;in=*.jar"); + for (int i = 0; i < jarUrls.size(); i++) + System.out.println(jarUrls.get(i)); + assertEquals(1, jarUrls.size()); + } +} 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 new file mode 100644 index 000000000..93f5c921b --- /dev/null +++ b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/osgi/boot/OsgiBootRuntimeTest.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Mathieu Baudier + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.argeo.osgi.boot; + +import java.util.Iterator; +import java.util.Map; +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; + +/** Starts an Equinox runtime and provision it with OSGi boot. */ +public class OsgiBootRuntimeTest extends TestCase { + protected OsgiBoot osgiBoot = null; + + public void testInstallAndStart() throws Exception { + osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL, + OsgiBootNoRuntimeTest.BUNDLES)); + Map map = new TreeMap(osgiBoot.getBundles()); + for (Iterator keys = map.keySet().iterator(); keys.hasNext();) { + Object key = keys.next(); + Bundle bundle = (Bundle) map.get(key); + System.out.println(key + " : " + bundle.getLocation()); + } + assertEquals(4, map.size()); + Iterator keys = map.keySet().iterator(); + assertEquals("org.argeo.osgi.boot.test.bundle1", keys.next()); + assertEquals("org.argeo.osgi.boot.test.bundle2", keys.next()); + assertEquals("org.argeo.osgi.boot.test.bundle3", keys.next()); + assertEquals("org.eclipse.osgi", keys.next()); + + osgiBoot.startBundles("org.argeo.osgi.boot.test.bundle2"); + long begin = System.currentTimeMillis(); + while (System.currentTimeMillis() - begin < 10000) { + Map mapBundles = osgiBoot.getBundles(); + Bundle bundle = (Bundle) mapBundles + .get("org.argeo.osgi.boot.test.bundle2"); + if (bundle.getState() == Bundle.ACTIVE) { + System.out.println("Bundle " + bundle + " started."); + return; + } + } + fail("Bundle not started after timeout limit."); + } + + protected BundleContext startRuntime() throws Exception { + String[] args = { "-console", "-clean" }; + BundleContext bundleContext = EclipseStarter.startup(args, null); + return bundleContext; + } + + protected void stopRuntime() throws Exception { + EclipseStarter.shutdown(); + } + + public void setUp() throws Exception { + BundleContext bundleContext = startRuntime(); + osgiBoot = new OsgiBoot(bundleContext); + } + + public void tearDown() throws Exception { + osgiBoot = null; + stopRuntime(); + } + +} diff --git a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootNoRuntimeTest.java b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootNoRuntimeTest.java deleted file mode 100644 index 77f74d346..000000000 --- a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootNoRuntimeTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2010 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.argeo.slc.osgiboot; - -import java.io.File; -import java.util.List; - -import junit.framework.TestCase; - -import org.argeo.osgi.boot.OsgiBoot; - -public class OsgiBootNoRuntimeTest extends TestCase { - public final static String BUNDLES = "src/test/bundles/some;in=*;ex=excluded," - + "src/test/bundles/others;in=**/org.argeo.*"; - - public void testLocations() { - String baseUrl = "file:"; - String locations = "/mydir/myfile" + File.pathSeparator - + "/myotherdir/myotherfile"; - - OsgiBoot osgiBoot = new OsgiBoot(null); - List urls = osgiBoot.getLocationsUrls(baseUrl, locations); - assertEquals(2, urls.size()); - assertEquals("file:/mydir/myfile", urls.get(0)); - assertEquals("file:/myotherdir/myotherfile", urls.get(1)); - } - - public void testBundles() { - String baseUrl = "file:"; - String bundles = BUNDLES; - OsgiBoot osgiBoot = new OsgiBoot(null); - List urls = osgiBoot.getBundlesUrls(baseUrl, bundles); - for (int i = 0; i < urls.size(); i++) - System.out.println(urls.get(i)); - assertEquals(3, urls.size()); - - List jarUrls = osgiBoot.getBundlesUrls(baseUrl, - "src/test/bundles/jars;in=*.jar"); - for (int i = 0; i < jarUrls.size(); i++) - System.out.println(jarUrls.get(i)); - assertEquals(1, jarUrls.size()); - } -} diff --git a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootRuntimeTest.java b/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootRuntimeTest.java deleted file mode 100644 index b717c3ac4..000000000 --- a/osgi/runtime/org.argeo.osgi.boot/src/test/java/org/argeo/slc/osgiboot/OsgiBootRuntimeTest.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 Mathieu Baudier - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.argeo.slc.osgiboot; - -import java.util.Iterator; -import java.util.Map; -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; - -public class OsgiBootRuntimeTest extends TestCase { - protected OsgiBoot osgiBoot = null; - - public void testInstallAndStart() throws Exception { - osgiBoot.installUrls(osgiBoot.getBundlesUrls(OsgiBoot.DEFAULT_BASE_URL, - OsgiBootNoRuntimeTest.BUNDLES)); - Map map = new TreeMap(osgiBoot.getBundles()); - for (Iterator keys = map.keySet().iterator(); keys.hasNext();) { - Object key = keys.next(); - Bundle bundle = (Bundle) map.get(key); - System.out.println(key + " : " + bundle.getLocation()); - } - assertEquals(4, map.size()); - Iterator keys = map.keySet().iterator(); - assertEquals("org.argeo.slc.osgiboot.test.bundle1", keys.next()); - assertEquals("org.argeo.slc.osgiboot.test.bundle2", keys.next()); - assertEquals("org.argeo.slc.osgiboot.test.bundle3", keys.next()); - assertEquals("org.eclipse.osgi", keys.next()); - - osgiBoot.startBundles("org.argeo.slc.osgiboot.test.bundle2"); - long begin = System.currentTimeMillis(); - while (System.currentTimeMillis() - begin < 10000) { - Map mapBundles = osgiBoot.getBundles(); - Bundle bundle = (Bundle) mapBundles - .get("org.argeo.slc.osgiboot.test.bundle2"); - if (bundle.getState() == Bundle.ACTIVE) { - System.out.println("Bundle " + bundle + " started."); - return; - } - } - fail("Bundle not started after timeout limit."); - } - - protected BundleContext startRuntime() throws Exception { - String[] args = { "-console", "-clean" }; - BundleContext bundleContext = EclipseStarter.startup(args, null); - return bundleContext; - } - - protected void stopRuntime() throws Exception { - EclipseStarter.shutdown(); - } - - public void setUp() throws Exception { - BundleContext bundleContext = startRuntime(); - osgiBoot = new OsgiBoot(bundleContext); - } - - public void tearDown() throws Exception { - osgiBoot = null; - stopRuntime(); - } - -}