You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/05/14 17:44:35 UTC

svn commit: r1594616 - /felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java

Author: pderop
Date: Wed May 14 15:44:35 2014
New Revision: 1594616

URL: http://svn.apache.org/r1594616
Log:
Added startBundle method

Modified:
    felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java

Modified: felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java?rev=1594616&r1=1594615&r2=1594616&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/dm.it/src/dm/it/TestBase.java Wed May 14 15:44:35 2014
@@ -3,6 +3,7 @@ package dm.it;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.Hashtable;
+import java.util.List;
 
 import junit.framework.TestCase;
 
@@ -16,6 +17,8 @@ import org.osgi.framework.ServiceReferen
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.log.LogService;
 
+import dm.DependencyManager;
+
 /**
  * Base class for all integration tests.
  */
@@ -78,6 +81,30 @@ public abstract class TestBase extends T
     }
 
     /**
+     * Helper method used to start a given bundle.
+     * 
+     * @param symbolicName
+     *            the symbolic name of the bundle to be started.
+     */
+    protected void startBundle(String symbolicName) {
+        // Stop the test.annotation bundle
+        boolean found = false;
+        for (Bundle b : context.getBundles()) {
+            if (b.getSymbolicName().equals(symbolicName)) {
+                try {
+                    found = true;
+                    b.start();
+                } catch (BundleException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+        if (!found) {
+            throw new IllegalStateException("bundle " + symbolicName + " not found");
+        }
+    }
+
+    /**
      * Helper method used to get a given bundle.
      * 
      * @param symbolicName