Author: rfeng
Date: Tue Jan 13 14:40:13 2009
New Revision: 734264

URL: http://svn.apache.org/viewvc?rev=734264&view=rev
Log:
Expose the EquinoxHost for the osgi junit plugin

Modified:
    
tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
    tuscany/java/sca/tools/maven/maven-osgi-junit/pom.xml
    
tuscany/java/sca/tools/maven/maven-osgi-junit/src/main/java/org/apache/tuscany/tools/sca/osgi/junit/plugin/OSGiJUnitMojo.java

Modified: 
tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java?rev=734264&r1=734263&r2=734264&view=diff
==============================================================================
--- 
tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
 (original)
+++ 
tuscany/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
 Tue Jan 13 14:40:13 2009
@@ -49,7 +49,7 @@
 /**
  * Wraps the Equinox runtime.
  */
-class EquinoxHost {
+public class EquinoxHost {
     private static Logger logger = 
Logger.getLogger(EquinoxHost.class.getName());
 
     private BundleContext bundleContext;
@@ -119,7 +119,7 @@
      * 
      * @return
      */
-    BundleContext start() {
+    public BundleContext start() {
         try {
             if (!EclipseStarter.isRunning()) {
 
@@ -328,7 +328,7 @@
     /**
      * Stop the Equinox host.
      */
-    void stop() {
+    public void stop() {
         try {
             
             // Uninstall all the bundles we've installed

Modified: tuscany/java/sca/tools/maven/maven-osgi-junit/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/tools/maven/maven-osgi-junit/pom.xml?rev=734264&r1=734263&r2=734264&view=diff
==============================================================================
--- tuscany/java/sca/tools/maven/maven-osgi-junit/pom.xml (original)
+++ tuscany/java/sca/tools/maven/maven-osgi-junit/pom.xml Tue Jan 13 14:40:13 
2009
@@ -34,18 +34,18 @@
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-plugin-api</artifactId>
-            <version>2.0.7</version>
+            <version>2.0.8</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.maven</groupId>
             <artifactId>maven-project</artifactId>
-            <version>2.0.7</version>
+            <version>2.0.8</version>
         </dependency>
         
         <dependency>
             <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-node-launcher-osgi</artifactId>
+            <artifactId>tuscany-node-launcher-equinox</artifactId>
             <version>2.0-SNAPSHOT</version>
         </dependency>
         

Modified: 
tuscany/java/sca/tools/maven/maven-osgi-junit/src/main/java/org/apache/tuscany/tools/sca/osgi/junit/plugin/OSGiJUnitMojo.java
URL: 
http://svn.apache.org/viewvc/tuscany/java/sca/tools/maven/maven-osgi-junit/src/main/java/org/apache/tuscany/tools/sca/osgi/junit/plugin/OSGiJUnitMojo.java?rev=734264&r1=734263&r2=734264&view=diff
==============================================================================
--- 
tuscany/java/sca/tools/maven/maven-osgi-junit/src/main/java/org/apache/tuscany/tools/sca/osgi/junit/plugin/OSGiJUnitMojo.java
 (original)
+++ 
tuscany/java/sca/tools/maven/maven-osgi-junit/src/main/java/org/apache/tuscany/tools/sca/osgi/junit/plugin/OSGiJUnitMojo.java
 Tue Jan 13 14:40:13 2009
@@ -38,8 +38,7 @@
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.project.MavenProject;
-import org.apache.tuscany.sca.node.osgi.launcher.FelixOSGiHost;
-import org.apache.tuscany.sca.node.osgi.launcher.LauncherBundleActivator;
+import org.apache.tuscany.sca.node.equinox.launcher.EquinoxHost;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 
@@ -129,6 +128,44 @@
 
         return artifact;
     }
+    
+    /**
+     * Returns a string representation of the given bundle.
+     * 
+     * @param b
+     * @param verbose
+     * @return
+     */
+    static String string(Bundle bundle, boolean verbose) {
+        StringBuffer sb = new StringBuffer();
+        sb.append(bundle.getBundleId()).append(" 
").append(bundle.getSymbolicName());
+        int s = bundle.getState();
+        if ((s & Bundle.UNINSTALLED) != 0) {
+            sb.append(" UNINSTALLED");
+        }
+        if ((s & Bundle.INSTALLED) != 0) {
+            sb.append(" INSTALLED");
+        }
+        if ((s & Bundle.RESOLVED) != 0) {
+            sb.append(" RESOLVED");
+        }
+        if ((s & Bundle.STARTING) != 0) {
+            sb.append(" STARTING");
+        }
+        if ((s & Bundle.STOPPING) != 0) {
+            sb.append(" STOPPING");
+        }
+        if ((s & Bundle.ACTIVE) != 0) {
+            sb.append(" ACTIVE");
+        }
+
+        if (verbose) {
+            sb.append(" ").append(bundle.getLocation());
+            sb.append(" ").append(bundle.getHeaders());
+        }
+        return sb.toString();
+    }
+
 
     public void execute() throws MojoExecutionException {
         if (project.getPackaging().equals("pom")) {
@@ -170,13 +207,12 @@
         //        System.setProperty("TUSCANY_HOME", home);
         //        getLog().info(home);
         try {
-            FelixOSGiHost host = new FelixOSGiHost();
-            host.setActivator(new LauncherBundleActivator(jarFiles));
+            EquinoxHost host = new EquinoxHost();
             BundleContext context = host.start();
 
             for (Bundle b : context.getBundles()) {
                 if (getLog().isDebugEnabled()) {
-                    getLog().debug(LauncherBundleActivator.toString(b, false));
+                    getLog().debug(string(b, false));
                 }
             }
 


Reply via email to