[jboss-svn-commits] JBoss Common SVN: r4549 - in arquillian/trunk: build and 30 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Jun 24 04:54:06 EDT 2010


Author: thomas.diesler at jboss.com
Date: 2010-06-24 04:54:00 -0400 (Thu, 24 Jun 2010)
New Revision: 4549

Added:
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JUnitBundleTestRunner.java
   arquillian/trunk/bundle/src/main/resources/
   arquillian/trunk/bundle/src/main/resources/META-INF/
   arquillian/trunk/bundle/src/main/resources/META-INF/services/
   arquillian/trunk/bundle/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestRunner
   arquillian/trunk/containers/osgi-embedded/hs_err_pid11887.log
   arquillian/trunk/containers/osgi-embedded/scripts/
   arquillian/trunk/containers/osgi-embedded/scripts/assembly-bundles.xml
   arquillian/trunk/containers/osgi-embedded/src/test/resources/log4j.xml
   arquillian/trunk/testenrichers/osgi/
   arquillian/trunk/testenrichers/osgi/pom.xml
   arquillian/trunk/testenrichers/osgi/src/
   arquillian/trunk/testenrichers/osgi/src/main/
   arquillian/trunk/testenrichers/osgi/src/main/java/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/
   arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java
Removed:
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/AbstractConnector.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicFailure.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicRequest.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicResponse.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Connector.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Failure.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnector.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnectorMBean.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Request.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Response.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/SocketConnector.java
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Util.java
   arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiTestEnricher.java
Modified:
   arquillian/trunk/.gitignore
   arquillian/trunk/build/pom.xml
   arquillian/trunk/bundle/pom.xml
   arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/ArquillianActivator.java
   arquillian/trunk/containers/osgi-embedded/pom.xml
   arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkContainer.java
   arquillian/trunk/containers/osgi-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestEnricher
   arquillian/trunk/containers/osgi-embedded/src/test/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkTestCase.java
   arquillian/trunk/containers/osgi-embedded/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
   arquillian/trunk/containers/pom.xml
   arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitTestRunner.java
   arquillian/trunk/pom.xml
   arquillian/trunk/protocols/jmx/pom.xml
   arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java
   arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java
   arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunnerMBean.java
   arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java
   arquillian/trunk/spi/pom.xml
   arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/TestRunners.java
   arquillian/trunk/testenrichers/pom.xml
Log:
osgi: in framework testing - ok

Modified: arquillian/trunk/.gitignore
===================================================================
--- arquillian/trunk/.gitignore	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/.gitignore	2010-06-24 08:54:00 UTC (rev 4549)
@@ -67,6 +67,8 @@
 testenrichers/cdi/target
 testenrichers/ejb/.classpath
 testenrichers/ejb/target
+testenrichers/osgi/.classpath
+testenrichers/osgi/target
 testenrichers/resource/.classpath
 testenrichers/resource/target
 testng/target

Modified: arquillian/trunk/build/pom.xml
===================================================================
--- arquillian/trunk/build/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/build/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -28,6 +28,7 @@
     <version.javax.inject_javax.inject>1</version.javax.inject_javax.inject>
     <version.javaee_api>6.0</version.javaee_api>
     <version.jboss_embedded>1.0.0-alpha-1</version.jboss_embedded>
+    <version.jboss_logging>2.1.0.GA</version.jboss_logging>
     <version.jboss_osgi_spi>1.0.7-SNAPSHOT</version.jboss_osgi_spi>
     <version.jboss_osgi_vfs>1.0.0</version.jboss_osgi_vfs>
     <version.jetty_jetty>6.1.9</version.jetty_jetty>
@@ -192,6 +193,16 @@
         <version>${version.javax.inject_javax.inject}</version>
       </dependency>
       <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-spi</artifactId>
+        <version>${version.jboss_logging}</version>
+      </dependency>
+      <dependency>
+        <groupId>org.jboss.logging</groupId>
+        <artifactId>jboss-logging-log4j</artifactId>
+        <version>${version.jboss_logging}</version>
+      </dependency>
+      <dependency>
         <groupId>org.jboss.osgi</groupId>
         <artifactId>jboss-osgi-spi</artifactId>
         <version>${version.jboss_osgi_spi}</version>

Modified: arquillian/trunk/bundle/pom.xml
===================================================================
--- arquillian/trunk/bundle/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -14,7 +14,7 @@
 
   <!-- Artifact Configuration -->
   <artifactId>arquillian-bundle</artifactId>
-  <name>Arquillian Bundle</name>
+  <name>Arquillian OSGi Bundle</name>
   <description>Arquillian OSGi Bundle</description>
   <packaging>bundle</packaging>
 
@@ -32,33 +32,41 @@
           <instructions>
             <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
             <Bundle-Activator>org.jboss.arquillian.bundle.ArquillianActivator</Bundle-Activator>
-            <Export-Package>
-              org.jboss.arquillian.bundle;version=${version},
-            </Export-Package>
+            <Export-Package></Export-Package>
             <Import-Package>
               javax.management*,
               javax.naming,
-              javax.xml.parsers, 
+              javax.xml.parsers,
               org.w3c.dom,
-              
+
+              org.jboss.logging;version="[2.1,3.0)",
+
               org.osgi.framework;version="[1.5,2.0)",
-              org.osgi.jmx.framework;version="[1.0,2.0)",
               org.osgi.util.tracker;version="[1.4,2.0)",
             </Import-Package>
             <Private-Package>
+              org.jboss.arquillian.bundle,
             </Private-Package>
+            <DynamicImport-Package>*</DynamicImport-Package>
             <Embed-Transitive>true</Embed-Transitive>
             <Embed-Dependency>
               arquillian-api;inline=false,
               arquillian-impl-base;inline=false,
               arquillian-junit;inline=false,
+              arquillian-protocol-jmx;inline=false,
               arquillian-spi;inline=false,
+              arquillian-testenricher-osgi;inline=false,
               shrinkwrap-api;inline=false,
               shrinkwrap-impl-base;inline=false,
               shrinkwrap-spi;inline=false,
+              javax.inject;inline=false,
               junit;inline=false,
             </Embed-Dependency>
             <_exportcontents>
+              javax.inject;version=${version.javax.inject_javax.inject},
+              org.jboss.shrinkwrap.api;version=${version.shrinkwrap_shrinkwrap},
+              org.jboss.shrinkwrap.api.spec;version=${version.shrinkwrap_shrinkwrap},
+              org.junit;version=${version.junit_junit},
             </_exportcontents>
           </instructions>
         </configuration>
@@ -82,11 +90,25 @@
   <!-- Dependencies -->
   <dependencies>
     <dependency>
+      <groupId>org.jboss.arquillian.testenricher</groupId>
+      <artifactId>arquillian-testenricher-osgi</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian.protocol</groupId>
+      <artifactId>arquillian-protocol-jmx</artifactId>
+      <version>${version}</version>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.arquillian</groupId>
       <artifactId>arquillian-junit</artifactId>
       <version>${version}</version>
     </dependency>
     <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>provided</scope>

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/AbstractConnector.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/AbstractConnector.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/AbstractConnector.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,118 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.logging.Logger;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * An abstract {@link Connector} implementation 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public abstract class AbstractConnector implements Connector
-{
-   // Provide logging
-   private static final Logger log = Logger.getLogger(AbstractConnector.class.getName());
-   
-   private BundleContext context;
-
-   public AbstractConnector(BundleContext context)
-   {
-      this.context = context;
-   }
-
-   public BundleContext getBundleContext()
-   {
-      return context;
-   }
-
-   protected void start() throws Exception
-   {
-   }
-
-   protected void stop() throws Exception
-   {
-   }
-
-   public Response process(final Request req) throws Throwable
-   {
-      throw new IllegalStateException("Cannot find listener to handle: " + req.getClassName());
-   }
-
-   protected InputStream process(InputStream reqStream)
-   {
-      Request request = null;
-      Response response = null;
-      try
-      {
-         // Unmarshall the Request
-         ObjectInputStream ois = new ObjectInputStream(reqStream);
-         request = (Request)ois.readObject();
-
-         log.fine("Start invoke: " + request);
-         
-         // Field the request through the abstract connector
-         response = process(request);
-      }
-      catch (Throwable th)
-      {
-         response = new BasicResponse();
-         BasicFailure failure = new BasicFailure(th.getMessage(), th);
-         if (request != null)
-         {
-            failure.setClassName(request.getClassName());
-            failure.setMethodName(request.getMethodName());
-         }
-         response.addFailure(failure);
-      }
-      finally
-      {
-         log.fine("End invoke: " + response);
-      }
-
-      // Marshall the Response
-      try
-      {
-         ByteArrayOutputStream baos = new ByteArrayOutputStream();
-         ObjectOutputStream oos = new ObjectOutputStream(baos);
-         oos.writeObject(response);
-         oos.close();
-
-         return new ByteArrayInputStream(baos.toByteArray());
-      }
-      catch (IOException ex)
-      {
-         throw new IllegalStateException("Cannot marshall response", ex);
-      }
-   }
-}
\ No newline at end of file

Modified: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/ArquillianActivator.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/ArquillianActivator.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/ArquillianActivator.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -23,55 +23,86 @@
 
 // $Id$
 
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
+import org.jboss.arquillian.protocol.jmx.JMXTestRunner;
+import org.jboss.logging.Logger;
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
 
 /**
- * This is the Husky {@link BundleActivator}.
+ * This is the Arquillian {@link BundleActivator}.
  * 
- * It unconditionally starts the {@link JMXConnector}.
+ * It unconditionally starts the {@link JMXTestRunner}.
  * 
- * If the {@link SocketConnector#PROP_SOCKET_CONNECTOR_HOST} and 
- * {@link SocketConnector#PROP_SOCKET_CONNECTOR_PORT} properites are set it also
- * starts the {@link SocketConnector}.
- * 
- * Finally it starts the {@link HuskyExtender}, which is a {@link BundleListener}
- * that looks for manifest headers called  {@link ManifestProcessor#HEADER_TEST_PACKAGE}. 
- * 
- * 
- * @author Thomas.Diesler at jboss.com
+ * @author thomas.diesler at jboss.com
  * @since 17-May-2009
  */
 public class ArquillianActivator implements BundleActivator
 {
-   private SocketConnector socketConnector;
-   private JMXConnector jmxConnector;
+   // Provide logging
+   private static Logger log = Logger.getLogger(ArquillianActivator.class);
 
+   // An thread local association 
+   static BundleContext bundleContext;
+   
+   @Override
    public void start(BundleContext context) throws Exception
    {
-      jmxConnector = new JMXConnector(context);
-      jmxConnector.start();
-
-      if (SocketConnector.isRemoteConnection(context))
-      {
-         socketConnector = new SocketConnector(context);
-         socketConnector.start();
-      }
+      ArquillianActivator.bundleContext = context;
+      
+      // Register the JMX TestRunner
+      MBeanServer mbeanServer = getMBeanServer(context);
+      JMXTestRunner.register(mbeanServer);
    }
 
+   @Override
    public void stop(BundleContext context) throws Exception
    {
-      if (socketConnector != null)
+      // Unregister the JMX TestRunner
+      MBeanServer mbeanServer = getMBeanServer(context);
+      JMXTestRunner.unregister(mbeanServer);
+      
+      ArquillianActivator.bundleContext = null;
+   }
+
+   private MBeanServer getMBeanServer(BundleContext context)
+   {
+      MBeanServer mbeanServer = null;
+      
+      // Check if there is an MBeanServer service already
+      ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+      if (sref != null)
       {
-         socketConnector.stop();
-         socketConnector = null;
+         mbeanServer = (MBeanServer)context.getService(sref);
+         log.debug("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
+         return mbeanServer;
       }
 
-      if (jmxConnector != null)
+      ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+      if (serverArr.size() > 1)
+         log.warn("Multiple MBeanServer instances: " + serverArr);
+
+      if (serverArr.size() > 0)
       {
-         jmxConnector.stop();
-         jmxConnector = null;
+         mbeanServer = serverArr.get(0);
+         log.debug("Found MBeanServer: " + mbeanServer.getDefaultDomain());
       }
+
+      if (mbeanServer == null)
+      {
+         log.debug("No MBeanServer, create one ...");
+         mbeanServer = MBeanServerFactory.createMBeanServer();
+      }
+      
+      // Register the MBeanServer under the system context
+      BundleContext syscontext = context.getBundle(0).getBundleContext();
+      syscontext.registerService(MBeanServer.class.getName(), mbeanServer, null);
+      
+      return mbeanServer;
    }
 }
\ No newline at end of file

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicFailure.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicFailure.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicFailure.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,76 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id: BasicResponse.java 91197 2009-07-14 09:48:24Z thomas.diesler at jboss.com $
-
-/**
- * A basic {@link Failure} implementation. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public class BasicFailure implements Failure
-{
-   private static final long serialVersionUID = 1L;
-
-   private String message;
-   private Throwable exception;
-   private String className;
-   private String methodName;
-   
-   public BasicFailure(String message, Throwable exception)
-   {
-      this.message = message;
-      this.exception = exception;
-   }
-
-   public Throwable getException()
-   {
-      return exception;
-   }
-
-   public String getMessage()
-   {
-      return message;
-   }
-
-   public String getClassName()
-   {
-      return className;
-   }
-
-   public void setClassName(String className)
-   {
-      this.className = className;
-   }
-
-   public String getMethodName()
-   {
-      return methodName;
-   }
-
-   public void setMethodName(String methodName)
-   {
-      this.methodName = methodName;
-   }
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicRequest.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicRequest.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicRequest.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,70 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-/**
- * A basic {@link Request} implementation. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public class BasicRequest implements Request
-{
-   private static final long serialVersionUID = 1L;
-   
-   private String className;
-   private String methodName;
-
-   public BasicRequest(String className, String methodName)
-   {
-      if (className == null)
-         throw new IllegalArgumentException("Null className");
-      if (methodName == null)
-         throw new IllegalArgumentException("Null methodName");
-      
-      this.className = className;
-      this.methodName = methodName;
-   }
-
-   public String getClassName()
-   {
-      return className;
-   }
-
-   public String getMethodName()
-   {
-      return methodName;
-   }
-
-   @Override
-   public String toString()
-   {
-      String testName = className;
-      int dotIndex = testName.lastIndexOf(".");
-      if (dotIndex > 0)
-         testName = testName.substring(dotIndex + 1);
-      testName = testName + "." + methodName;
-      return "BasicRequest[" + testName + "]";
-   }
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicResponse.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicResponse.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/BasicResponse.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,63 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A basic {@link Response} implementation. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public class BasicResponse implements Response
-{
-   private static final long serialVersionUID = 1L;
-
-   private List<Failure> failures = new ArrayList<Failure>();
-
-   public List<Failure> getFailures()
-   {
-      return Collections.unmodifiableList(failures);
-   }
-
-   public void addFailure(Failure failure)
-   {
-      failures.add(failure);
-   }
-
-   @Override
-   public String toString()
-   {
-      StringBuffer msgs = new StringBuffer();
-      for (int i = 0; i < failures.size(); i++)
-      {
-         Failure f = failures.get(i);
-         msgs.append((i > 0 ? "," : "") + f.getMessage());
-      }
-      return "BasicResponse[" + msgs + "]";
-   }
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Connector.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Connector.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Connector.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-//$Id$
-
-/**
- * A Connector is the receiving side of a test request.
- * 
- * It processes the test request by dispatching it to one of
- * the associated {@link PackageListener}s.
- * 
- * It is an error if no {@link PackageListener} can handle the 
- * incomming test request.
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public interface Connector
-{
-   /**
-    * Handles the test request by dispatching to one of the 
-    * associated {@link PackageListener}s. 
-    */
-   Response process(Request req) throws Throwable;
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Failure.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Failure.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Failure.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.Serializable;
-
-
-
-/**
- * An abstraction of a test failure that is associated with a test {@link Response}. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public interface Failure extends Serializable
-{
-   /**
-    * Get the name of the test class that failed
-    */
-   String getClassName();
-   
-   /**
-    * Get the name of the test method that failed
-    */
-   String getMethodName();
-   
-   /**
-    * Get the test failure message
-    */
-   String getMessage();
-   
-   /**
-    * Get the exceoption that caused the failure.
-    * In case of a failure due to an assertion, this will be 
-    * RuntimeException or Error thrown by the test framework. 
-    */
-   Throwable getException();
-}
\ No newline at end of file

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnector.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnector.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnector.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,133 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
-/**
- * The JMX connector is a {@link Connector} that process Husky 
- * requests via an JMX invocation. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 17-May-2009
- */
-public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
-{
-   // Provide Logging
-   private static final Logger logger = Logger.getLogger(JMXConnector.class.getName());
-
-   /** The ObjectName for this service: jboss.osgi.husky:service=jmx-connector */
-   public static ObjectName OBJECT_NAME;
-   static
-   {
-      try
-      {
-         OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
-      }
-      catch (MalformedObjectNameException ex)
-      {
-         // ignore
-      }
-   }
-
-   public JMXConnector(BundleContext context)
-   {
-      super(context);
-   }
-
-   @Override
-   public void start() throws Exception
-   {
-      super.start();
-      
-      MBeanServer mbeanServer = getMBeanServer();
-      mbeanServer.registerMBean(this, OBJECT_NAME);
-
-      Properties props = new Properties();
-      props.setProperty("transport", "jmx");
-      getBundleContext().registerService(Connector.class.getName(), this, props);
-
-      logger.info("JMXConnector registered: " + OBJECT_NAME);
-   }
-
-   @Override
-   public void stop() throws Exception
-   {
-      super.stop();
-      
-      MBeanServer mbeanServer = getMBeanServer();
-      if (mbeanServer.isRegistered(OBJECT_NAME))
-         mbeanServer.unregisterMBean(OBJECT_NAME);
-   }
-
-   @Override
-   public InputStream process(InputStream reqStream)
-   {
-      return super.process(reqStream);
-   }
-
-   private MBeanServer getMBeanServer()
-   {
-      MBeanServer mbeanServer = null;
-      BundleContext context = getBundleContext();
-
-      // Check if there is an MBeanServer service already
-      ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
-      if (sref != null)
-      {
-         mbeanServer = (MBeanServer)context.getService(sref);
-         logger.fine("Found MBeanServer fom service: " + mbeanServer.getDefaultDomain());
-      }
-      else
-      {
-         ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
-         if (serverArr.size() > 1)
-            logger.warning("Multiple MBeanServer instances: " + serverArr);
-
-         if (serverArr.size() > 0)
-         {
-            mbeanServer = serverArr.get(0);
-            logger.fine("Found MBeanServer: " + mbeanServer.getDefaultDomain());
-         }
-
-         if (mbeanServer == null)
-         {
-            logger.fine("No MBeanServer, create one ...");
-            mbeanServer = MBeanServerFactory.createMBeanServer();
-         }
-      }
-      return mbeanServer;
-   }
-}
\ No newline at end of file

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnectorMBean.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnectorMBean.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JMXConnectorMBean.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,44 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-//$Id$
-
-import java.io.InputStream;
-
-/**
- * The management interface of the {@link JMXConnector}.
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 17-May-2009
- */
-public interface JMXConnectorMBean
-{
-   /**
-    * Consumes the serialized version of an {@link Request} and
-    * return the the {@link Response} from the test run
-    *
-    * @param reqStream the input stream to read the {@link Request} from
-    * @return the input stream to read the {@link Response} from
-    */
-   InputStream process(InputStream reqStream);
-}
\ No newline at end of file

Added: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JUnitBundleTestRunner.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JUnitBundleTestRunner.java	                        (rev 0)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/JUnitBundleTestRunner.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.jboss.arquillian.bundle;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.arquillian.impl.context.AbstractEventContext;
+import org.jboss.arquillian.junit.JUnitTestRunner;
+import org.jboss.arquillian.spi.Context;
+import org.jboss.arquillian.testenricher.osgi.OSGiTestEnricher;
+import org.junit.runner.Description;
+import org.junit.runner.notification.RunListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * JUnitTestRunner
+ * 
+ * A Implementation of the Arquillian TestRunner SPI for JUnit.
+ *
+ * @author thomas.diesler at jboss.com
+ * @version $Revision: $
+ */
+public class JUnitBundleTestRunner extends JUnitTestRunner
+{
+   @Override
+   protected List<RunListener> getRunListeners()
+   {
+      List<RunListener> listeners = new ArrayList<RunListener>(super.getRunListeners());
+      listeners.add(new BundleRunListener());
+      return Collections.unmodifiableList(listeners);
+   }
+   
+   class BundleRunListener extends RunListener
+   {
+      @Override
+      public void testRunStarted(Description descr) throws Exception
+      {
+         Class<?> testClass = descr.getTestClass();
+         
+         // [TODO] This is a hack. Get the context in some other way
+         BundleContext context = ArquillianActivator.bundleContext;
+         if (context == null)
+            throw new IllegalStateException("Cannot obtain arquillian-bundle context");
+         
+         ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+         PackageAdmin pa = (PackageAdmin)context.getService(sref);
+         Bundle testBundle = pa.getBundle(testClass);
+         
+         TestRunnerContext arquillianContext = new TestRunnerContext();
+         arquillianContext.add(BundleContext.class, context.getBundle(0).getBundleContext());
+         arquillianContext.add(Bundle.class, testBundle);
+
+         OSGiTestEnricher enricher = new OSGiTestEnricher();
+         enricher.enrich(arquillianContext, testClass);
+      }
+   }
+   
+   static class TestRunnerContext extends AbstractEventContext
+   {
+      @Override
+      public Context getParentContext()
+      {
+         return null;
+      }
+   }
+}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Request.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Request.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Request.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-//$Id$
-
-import java.io.Serializable;
-
-/**
- * An abstraction of a test request. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public interface Request extends Serializable
-{
-   /**
-    * Get the test case name 
-    */
-   String getClassName();
-   
-   /**
-    * Get the test method name 
-    */
-   String getMethodName();
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Response.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Response.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Response.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.List;
-
-
-
-/**
- * An abstraction of a test response. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public interface Response extends Serializable
-{
-   /**
-    * Get the list of test failures
-    * @return an empty list if the test was successful
-    */
-   List<Failure> getFailures();
-   
-   /**
-    * Add a failure to the response
-    */
-   void addFailure(Failure failure);
-}

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/SocketConnector.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/SocketConnector.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/SocketConnector.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,192 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * The socket connector is a {@link Connector} that process Husky 
- * requests via an socket invocations.
- * 
- * Both, the test runner process as well as the remote target process must 
- * configure the properties {@link #PROP_SOCKET_CONNECTOR_HOST} and 
- * {@link #PROP_SOCKET_CONNECTOR_PORT}. 
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 17-May-2009
- */
-public class SocketConnector extends AbstractConnector
-{
-   // Provide Logging
-   private static final Logger logger = Logger.getLogger(SocketConnector.class.getName());
-   
-   /** The Husky socket connector host poperty: 'org.jboss.osgi.husky.runtime.connector.host' */
-   public static final String PROP_SOCKET_CONNECTOR_HOST = Connector.class.getName().toLowerCase() + ".host";
-   /** The Husky socket connector port poperty: 'org.jboss.osgi.husky.runtime.connector.port' */
-   public static final String PROP_SOCKET_CONNECTOR_PORT = Connector.class.getName().toLowerCase() + ".port";
-   
-   private ServiceRegistration sreg;
-   private ListenerThread listenerThread;
-
-   public SocketConnector(BundleContext context)
-   {
-      super(context);
-   }
-
-   public static boolean isRemoteConnection(BundleContext context)
-   {
-      return getHost(context) != null && getPort(context) != null;
-   }
-
-   private static String getPort(BundleContext context)
-   {
-      String port = context.getProperty(PROP_SOCKET_CONNECTOR_PORT);
-      return port;
-   }
-
-   private static String getHost(BundleContext context)
-   {
-      String host = context.getProperty(PROP_SOCKET_CONNECTOR_HOST);
-      return host;
-   }
-
-   @Override
-   public void start() throws Exception
-   {
-      super.start();
-      
-      BundleContext context = getBundleContext();
-      String host = getHost(context);
-      String port = getPort(context);
-
-      Properties props = new Properties();
-      props.setProperty("transport", "socket");
-      props.setProperty("host", host);
-      props.setProperty("port", port);
-
-      listenerThread = new ListenerThread(host, new Integer(port));
-      listenerThread.start();
-
-      sreg = context.registerService(Connector.class.getName(), this, props);
-      logger.info("SocketConnector registered: " + props);
-   }
-
-   @Override
-   public void stop() throws Exception
-   {
-      super.stop();
-      
-      if (sreg != null)
-         sreg.unregister();
-
-      if (listenerThread != null)
-         listenerThread.stopListener();
-   }
-
-   class ListenerThread extends Thread
-   {
-      private ServerSocket serverSocket;
-
-      public ListenerThread(String host, int port)
-      {
-         super("ConnectorThread");
-         try
-         {
-            serverSocket = new ServerSocket();
-            serverSocket.bind(new InetSocketAddress(host, port));
-         }
-         catch (IOException ex)
-         {
-            throw new IllegalStateException("Cannot create server socket", ex);
-         }
-      }
-
-      public void stopListener()
-      {
-         try
-         {
-            logger.fine("Stop SocketConnector");
-            serverSocket.close();
-         }
-         catch (IOException ex)
-         {
-            // ignore
-         }
-      }
-
-      @Override
-      public void run()
-      {
-         while (serverSocket.isClosed() == false)
-         {
-            Socket socket = null;
-            try
-            {
-               logger.fine("Waiting for connection ...");
-               socket = serverSocket.accept();
-               logger.fine("Connection accepted");
-            }
-            catch (IOException ex)
-            {
-               if (serverSocket.isClosed())
-                  break;
-            }
-
-            if (socket != null)
-            {
-               try
-               {
-                  InputStream resStream = process(socket.getInputStream());
-                  Util.copyStream(resStream, socket.getOutputStream());
-               }
-               catch (Exception ex)
-               {
-                  logger.log(Level.SEVERE, "Cannot process request", ex);
-               }
-               finally
-               {
-                  try
-                  {
-                     socket.close();
-                  }
-                  catch (IOException ex)
-                  {
-                     logger.log(Level.SEVERE, "Cannot close socket", ex);
-                  }
-               }
-            }
-         }
-      }
-   }
-}
\ No newline at end of file

Deleted: arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Util.java
===================================================================
--- arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Util.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/bundle/src/main/java/org/jboss/arquillian/bundle/Util.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,106 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.arquillian.bundle;
-
-// $Id$
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.lang.reflect.Constructor;
-import java.util.Properties;
-
-/**
- * Loads the configured test {@link Bridge} instance.
- * 
- * @author Thomas.Diesler at jboss.com
- * @since 16-May-2009
- */
-public abstract class Util
-{
-   // Load an instance for a given class name.
-   // Use the SomeObject(Properties) ctor if present.
-   public static Object loadInstance(String className, Properties props)
-   {
-      // net bridge class
-      Class<?> instanceClass = loadClass(className);
-
-      // get instance with properties
-      Object instance = null;
-      try
-      {
-         Constructor<?> ctor = instanceClass.getConstructor(Properties.class);
-         instance = ctor.newInstance(props);
-      }
-      catch (NoSuchMethodException ex)
-      {
-         // ignore
-      }
-      catch (Exception ex)
-      {
-         throw new IllegalStateException("Cannot load: " + className, ex);
-      }
-
-      // get instance with default ctor
-      if (instance == null)
-      {
-         try
-         {
-            instance = instanceClass.newInstance();
-         }
-         catch (Exception ex)
-         {
-            throw new IllegalStateException("Cannot load: " + className, ex);
-         }
-      }
-
-      return instance;
-   }
-
-   // Load a given class name.
-   public static Class<?> loadClass(String className)
-   {
-      // net bridge class
-      Class<?> instanceClass;
-      try
-      {
-         instanceClass = Class.forName(className);
-      }
-      catch (ClassNotFoundException ex)
-      {
-         throw new IllegalStateException("Cannot load: " + className, ex);
-      }
-
-      return instanceClass;
-   }
-   
-   public static void copyStream(InputStream in, OutputStream out) throws IOException
-   {
-      byte[] bytes = new byte[1024];
-      int read = in.read(bytes);
-      while (read > 0)
-      {
-         out.write(bytes, 0, read);
-         read = in.read(bytes);
-      }
-   }
-}

Added: arquillian/trunk/bundle/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestRunner
===================================================================
--- arquillian/trunk/bundle/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestRunner	                        (rev 0)
+++ arquillian/trunk/bundle/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestRunner	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1 @@
+org.jboss.arquillian.bundle.JUnitBundleTestRunner
\ No newline at end of file

Added: arquillian/trunk/containers/osgi-embedded/hs_err_pid11887.log
===================================================================
--- arquillian/trunk/containers/osgi-embedded/hs_err_pid11887.log	                        (rev 0)
+++ arquillian/trunk/containers/osgi-embedded/hs_err_pid11887.log	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,365 @@
+#
+# A fatal error has been detected by the Java Runtime Environment:
+#
+#  SIGSEGV (0xb) at pc=0x00007f69da029182, pid=11887, tid=140092578993936
+#
+# JRE version: 6.0_20-b02
+# Java VM: Java HotSpot(TM) 64-Bit Server VM (16.3-b01 mixed mode linux-amd64 )
+# Problematic frame:
+# V  [libjvm.so+0x2dd182]
+#
+# If you would like to submit a bug report, please visit:
+#   http://java.sun.com/webapps/bugreport/crash.jsp
+#
+
+---------------  T H R E A D  ---------------
+
+Current thread (0x00007f69d4062800):  VMThread [stack: 0x00007f69d8581000,0x00007f69d8682000] [id=11900]
+
+siginfo:si_signo=SIGSEGV: si_errno=0, si_code=1 (SEGV_MAPERR), si_addr=0x000000000019000c
+
+Registers:
+RAX=0x0000000000000008, RBX=0x000000000019000c, RCX=0x0000000000000001, RDX=0x0000000000000000
+RSP=0x00007f69d86806f0, RBP=0x00007f69d8680730, RSI=0x0000000000000026, RDI=0x0000000000000020
+R8 =0x0000000000000001, R9 =0x0000000000000001, R10=0x00007f69da65db70, R11=0x0000000000000003
+R12=0x00007f698dce7390, R13=0x00007f698dce7360, R14=0x0000000000000020, R15=0x00007f698dce7228
+RIP=0x00007f69da029182, EFL=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
+  TRAPNO=0x000000000000000e
+
+Top of Stack: (sp=0x00007f69d86806f0)
+0x00007f69d86806f0:   00007f69d86806ff 08007f698dce74d8
+0x00007f69d8680700:   0000000000000003 00007f698dc64108
+0x00007f69d8680710:   0000000000000000 00007f69d8680760
+0x00007f69d8680720:   0000000000000000 00007f69d4015360
+0x00007f69d8680730:   00007f69d8680750 00007f69da2c8913
+0x00007f69d8680740:   0000000000000000 00007f69da7910e0
+0x00007f69d8680750:   00007f69d86807c0 00007f69da364836
+0x00007f69d8680760:   00007f69d4010100 0000000000000000
+0x00007f69d8680770:   00007f69d4061fa0 00007f69d4023600
+0x00007f69d8680780:   00007f69d86807a0 00007f69d40008c0
+0x00007f69d8680790:   00007f69d40606f0 00007f69d40607a0
+0x00007f69d86807a0:   00007f69d86807c0 0000000000143000
+0x00007f69d86807b0:   00007f69da66d268 00007f69da66f510
+0x00007f69d86807c0:   00007f69d86809f0 00007f69da3637f9
+0x00007f69d86807d0:   000000000c7d5680 00000000020307b8
+0x00007f69d86807e0:   00007f69d86809a0 00007f69d86808b0
+0x00007f69d86807f0:   00007f69d86808f0 00007f69d8680920
+0x00007f69d8680800:   00007f69d8680980 000000000e805e38
+0x00007f69d8680810:   00007f69d86809b0 00007f69d4016ae0
+0x00007f69d8680820:   0000000000654018 0000000002abc7b8
+0x00007f69d8680830:   0000000000989920 00000000031107d0
+0x00007f69d8680840:   00007f69d86808e0 00007f69d8680920
+0x00007f69d8680850:   00007f69d8680950 00007f69d86809b0
+0x00007f69d8680860:   00007f69d40170c0 00007f69d40151c0
+0x00007f69d8680870:   00007f69d4015130 00007f69d4016ae0
+0x00007f69d8680880:   00000012d4061050 00007f69d4014e10
+0x00007f69d8680890:   00007f69da677040 00007f6900000004
+0x00007f69d86808a0:   00007f69d40609c0 00007f6900000004
+0x00007f69d86808b0:   000000000000a5b9 0000000000a34c61
+0x00007f69d86808c0:   00007f69d1119b00 00007f69d40604a0
+0x00007f69d86808d0:   0000000000000000 00007f69d4060420
+0x00007f69d86808e0:   0000000000000000 0000000000a3f229 
+
+Instructions: (pc=0x00007f69da029182)
+0x00007f69da029172:   00 00 00 84 c9 74 7a 49 8b 5d 00 48 85 db 74 71
+0x00007f69da029182:   4c 8b 1b 41 83 e3 03 49 83 fb 03 74 64 4c 8b 23 
+
+Stack: [0x00007f69d8581000,0x00007f69d8682000],  sp=0x00007f69d86806f0,  free space=3fd0000000000000018k
+Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
+V  [libjvm.so+0x2dd182]
+V  [libjvm.so+0x57c913]
+V  [libjvm.so+0x618836]
+V  [libjvm.so+0x6177f9]
+V  [libjvm.so+0x6242d7]
+V  [libjvm.so+0x5ece5e]
+V  [libjvm.so+0x7109c9]
+V  [libjvm.so+0x71d60a]
+V  [libjvm.so+0x71cb92]
+V  [libjvm.so+0x71ce14]
+V  [libjvm.so+0x71c90e]
+V  [libjvm.so+0x5db02f]
+
+VM_Operation (0x00007f69d9d48880): ParallelGCFailedAllocation, mode: safepoint, requested by thread 0x00007f69d4007000
+
+
+---------------  P R O C E S S  ---------------
+
+Java Threads: ( => current thread )
+  0x00007f69d428b800 JavaThread "pool-1-thread-5" [_thread_blocked, id=11916, stack(0x00007f698d4f9000,0x00007f698d5fa000)]
+  0x00007f69d428b000 JavaThread "pool-1-thread-4" [_thread_blocked, id=11915, stack(0x00007f698d5fa000,0x00007f698d6fb000)]
+  0x00007f694c001800 JavaThread "pool-1-thread-3" [_thread_blocked, id=11914, stack(0x00007f698d6fb000,0x00007f698d7fc000)]
+  0x00007f69d41ab800 JavaThread "pool-1-thread-2" [_thread_blocked, id=11913, stack(0x00007f698d7fc000,0x00007f698d8fd000)]
+  0x00007f69d41e4800 JavaThread "pool-1-thread-1" [_thread_blocked, id=11912, stack(0x00007f698d8fd000,0x00007f698d9fe000)]
+  0x00007f69d408f000 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=11906, stack(0x00007f698daff000,0x00007f698dc00000)]
+  0x00007f69d408d000 JavaThread "CompilerThread1" daemon [_thread_blocked, id=11905, stack(0x00007f69d807c000,0x00007f69d817d000)]
+  0x00007f69d408a000 JavaThread "CompilerThread0" daemon [_thread_blocked, id=11904, stack(0x00007f69d817d000,0x00007f69d827e000)]
+  0x00007f69d4088000 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=11903, stack(0x00007f69d827e000,0x00007f69d837f000)]
+  0x00007f69d4069000 JavaThread "Finalizer" daemon [_thread_blocked, id=11902, stack(0x00007f69d837f000,0x00007f69d8480000)]
+  0x00007f69d4067000 JavaThread "Reference Handler" daemon [_thread_blocked, id=11901, stack(0x00007f69d8480000,0x00007f69d8581000)]
+  0x00007f69d4007000 JavaThread "main" [_thread_blocked, id=11895, stack(0x00007f69d9c4b000,0x00007f69d9d4c000)]
+
+Other Threads:
+=>0x00007f69d4062800 VMThread [stack: 0x00007f69d8581000,0x00007f69d8682000] [id=11900]
+  0x00007f69d4092000 WatcherThread [stack: 0x00007f698d9fe000,0x00007f698daff000] [id=11907]
+
+VM state:at safepoint (normal execution)
+
+VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
+[0x00007f69d4004a30] Threads_lock - owner thread: 0x00007f69d4062800
+[0x00007f69d4004f30] Heap_lock - owner thread: 0x00007f69d4007000
+
+Heap
+ PSYoungGen      total 213888K, used 6480K [0x00007f69bc560000, 0x00007f69d0e80000, 0x00007f69d1000000)
+  eden space 192448K, 0% used [0x00007f69bc560000,0x00007f69bc560000,0x00007f69c8150000)
+  from space 21440K, 30% used [0x00007f69c8150000,0x00007f69c87a4018,0x00007f69c9640000)
+  to   space 20672K, 0% used [0x00007f69cfa50000,0x00007f69cfa50000,0x00007f69d0e80000)
+ PSOldGen        total 43840K, used 43761K [0x00007f6993000000, 0x00007f6995ad0000, 0x00007f69bc560000)
+  object space 43840K, 99% used [0x00007f6993000000,0x00007f6995abc7b8,0x00007f6995ad0000)
+ PSPermGen       total 21248K, used 9766K [0x00007f698dc00000, 0x00007f698f0c0000, 0x00007f6993000000)
+  object space 21248K, 45% used [0x00007f698dc00000,0x00007f698e589920,0x00007f698f0c0000)
+
+Dynamic libraries:
+40000000-40009000 r-xp 00000000 fd:03 139462                             /usr/java/jdk1.6.0_20/bin/java
+40108000-4010a000 rwxp 00008000 fd:03 139462                             /usr/java/jdk1.6.0_20/bin/java
+40e88000-40ea9000 rwxp 00000000 00:00 0                                  [heap]
+3673e00000-3673e1e000 r-xp 00000000 fd:03 292                            /lib64/ld-2.12.so
+367401e000-367401f000 r-xp 0001e000 fd:03 292                            /lib64/ld-2.12.so
+367401f000-3674020000 rwxp 0001f000 fd:03 292                            /lib64/ld-2.12.so
+3674020000-3674021000 rwxp 00000000 00:00 0 
+3674200000-3674375000 r-xp 00000000 fd:03 5341                           /lib64/libc-2.12.so
+3674375000-3674575000 ---p 00175000 fd:03 5341                           /lib64/libc-2.12.so
+3674575000-3674579000 r-xp 00175000 fd:03 5341                           /lib64/libc-2.12.so
+3674579000-367457a000 rwxp 00179000 fd:03 5341                           /lib64/libc-2.12.so
+367457a000-367457f000 rwxp 00000000 00:00 0 
+3674600000-3674617000 r-xp 00000000 fd:03 7483                           /lib64/libpthread-2.12.so
+3674617000-3674816000 ---p 00017000 fd:03 7483                           /lib64/libpthread-2.12.so
+3674816000-3674817000 r-xp 00016000 fd:03 7483                           /lib64/libpthread-2.12.so
+3674817000-3674818000 rwxp 00017000 fd:03 7483                           /lib64/libpthread-2.12.so
+3674818000-367481c000 rwxp 00000000 00:00 0 
+3674a00000-3674a02000 r-xp 00000000 fd:03 11352                          /lib64/libdl-2.12.so
+3674a02000-3674c02000 ---p 00002000 fd:03 11352                          /lib64/libdl-2.12.so
+3674c02000-3674c03000 r-xp 00002000 fd:03 11352                          /lib64/libdl-2.12.so
+3674c03000-3674c04000 rwxp 00003000 fd:03 11352                          /lib64/libdl-2.12.so
+3674e00000-3674e07000 r-xp 00000000 fd:03 7484                           /lib64/librt-2.12.so
+3674e07000-3675006000 ---p 00007000 fd:03 7484                           /lib64/librt-2.12.so
+3675006000-3675007000 r-xp 00006000 fd:03 7484                           /lib64/librt-2.12.so
+3675007000-3675008000 rwxp 00007000 fd:03 7484                           /lib64/librt-2.12.so
+3675600000-3675683000 r-xp 00000000 fd:03 7792                           /lib64/libm-2.12.so
+3675683000-3675882000 ---p 00083000 fd:03 7792                           /lib64/libm-2.12.so
+3675882000-3675883000 r-xp 00082000 fd:03 7792                           /lib64/libm-2.12.so
+3675883000-3675884000 rwxp 00083000 fd:03 7792                           /lib64/libm-2.12.so
+3683a00000-3683a16000 r-xp 00000000 fd:03 62723                          /lib64/libnsl-2.12.so
+3683a16000-3683c15000 ---p 00016000 fd:03 62723                          /lib64/libnsl-2.12.so
+3683c15000-3683c16000 r-xp 00015000 fd:03 62723                          /lib64/libnsl-2.12.so
+3683c16000-3683c17000 rwxp 00016000 fd:03 62723                          /lib64/libnsl-2.12.so
+3683c17000-3683c19000 rwxp 00000000 00:00 0 
+7f693c000000-7f693c021000 rwxp 00000000 00:00 0 
+7f693c021000-7f6940000000 ---p 00000000 00:00 0 
+7f6944000000-7f6944021000 rwxp 00000000 00:00 0 
+7f6944021000-7f6948000000 ---p 00000000 00:00 0 
+7f6948000000-7f6948021000 rwxp 00000000 00:00 0 
+7f6948021000-7f694c000000 ---p 00000000 00:00 0 
+7f694c000000-7f694c021000 rwxp 00000000 00:00 0 
+7f694c021000-7f6950000000 ---p 00000000 00:00 0 
+7f6950000000-7f6950021000 rwxp 00000000 00:00 0 
+7f6950021000-7f6954000000 ---p 00000000 00:00 0 
+7f6954000000-7f6954021000 rwxp 00000000 00:00 0 
+7f6954021000-7f6958000000 ---p 00000000 00:00 0 
+7f6958000000-7f6958021000 rwxp 00000000 00:00 0 
+7f6958021000-7f695c000000 ---p 00000000 00:00 0 
+7f695c000000-7f695d87f000 rwxp 00000000 00:00 0 
+7f695d87f000-7f6960000000 ---p 00000000 00:00 0 
+7f6960000000-7f6961892000 rwxp 00000000 00:00 0 
+7f6961892000-7f6964000000 ---p 00000000 00:00 0 
+7f6964000000-7f6964021000 rwxp 00000000 00:00 0 
+7f6964021000-7f6968000000 ---p 00000000 00:00 0 
+7f696a16f000-7f6970000000 r-xp 00000000 fd:03 8194                       /usr/lib/locale/locale-archive
+7f6970000000-7f6970021000 rwxp 00000000 00:00 0 
+7f6970021000-7f6974000000 ---p 00000000 00:00 0 
+7f6974000000-7f6974021000 rwxp 00000000 00:00 0 
+7f6974021000-7f6978000000 ---p 00000000 00:00 0 
+7f6978000000-7f6978021000 rwxp 00000000 00:00 0 
+7f6978021000-7f697c000000 ---p 00000000 00:00 0 
+7f697c000000-7f697c021000 rwxp 00000000 00:00 0 
+7f697c021000-7f6980000000 ---p 00000000 00:00 0 
+7f6980000000-7f6980021000 rwxp 00000000 00:00 0 
+7f6980021000-7f6984000000 ---p 00000000 00:00 0 
+7f6984000000-7f6984021000 rwxp 00000000 00:00 0 
+7f6984021000-7f6988000000 ---p 00000000 00:00 0 
+7f6988000000-7f6988021000 rwxp 00000000 00:00 0 
+7f6988021000-7f698c000000 ---p 00000000 00:00 0 
+7f698d4f9000-7f698d4fc000 ---p 00000000 00:00 0 
+7f698d4fc000-7f698d5fa000 rwxp 00000000 00:00 0 
+7f698d5fa000-7f698d5fd000 ---p 00000000 00:00 0 
+7f698d5fd000-7f698d6fb000 rwxp 00000000 00:00 0 
+7f698d6fb000-7f698d6fe000 ---p 00000000 00:00 0 
+7f698d6fe000-7f698d7fc000 rwxp 00000000 00:00 0 
+7f698d7fc000-7f698d7ff000 ---p 00000000 00:00 0 
+7f698d7ff000-7f698d8fd000 rwxp 00000000 00:00 0 
+7f698d8fd000-7f698d900000 ---p 00000000 00:00 0 
+7f698d900000-7f698d9fe000 rwxp 00000000 00:00 0 
+7f698d9fe000-7f698d9ff000 ---p 00000000 00:00 0 
+7f698d9ff000-7f698daff000 rwxp 00000000 00:00 0 
+7f698daff000-7f698db02000 ---p 00000000 00:00 0 
+7f698db02000-7f698f0c0000 rwxp 00000000 00:00 0 
+7f698f0c0000-7f6993000000 rwxp 00000000 00:00 0 
+7f6993000000-7f6995ad0000 rwxp 00000000 00:00 0 
+7f6995ad0000-7f69bc560000 rwxp 00000000 00:00 0 
+7f69bc560000-7f69d0e80000 rwxp 00000000 00:00 0 
+7f69d0e80000-7f69d1000000 rwxp 00000000 00:00 0 
+7f69d1000000-7f69d1270000 rwxp 00000000 00:00 0 
+7f69d1270000-7f69d43d5000 rwxp 00000000 00:00 0 
+7f69d43d5000-7f69d8000000 ---p 00000000 00:00 0 
+7f69d8010000-7f69d8011000 r-xs 00004000 fd:05 115476444                  /home/tdiesler/.m2/repository/org/apache/maven/maven-archiver/2.4/maven-archiver-2.4.jar
+7f69d8011000-7f69d8013000 r-xs 00004000 fd:05 115479313                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-active-collections/1.0-beta-2/plexus-active-collections-1.0-beta-2.jar
+7f69d8013000-7f69d8015000 r-xs 00008000 fd:05 115475719                  /home/tdiesler/.m2/repository/org/apache/maven/shared/maven-shared-io/1.1/maven-shared-io-1.1.jar
+7f69d8015000-7f69d8017000 r-xs 00006000 fd:05 115478200                  /home/tdiesler/.m2/repository/org/apache/maven/shared/file-management/1.1/file-management-1.1.jar
+7f69d8017000-7f69d8019000 r-xs 0000a000 fd:05 115479289                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-io/1.0-alpha-4/plexus-io-1.0-alpha-4.jar
+7f69d8019000-7f69d801b000 r-xs 0000b000 fd:05 115479284                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.7/plexus-interpolation-1.7.jar
+7f69d801b000-7f69d801f000 r-xs 00028000 fd:05 115478138                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-12/plexus-archiver-1.0-alpha-12.jar
+7f69d801f000-7f69d8020000 r-xs 00007000 fd:05 115478098                  /home/tdiesler/.m2/repository/org/apache/maven/shared/maven-plugin-testing-harness/1.1/maven-plugin-testing-harness-1.1.jar
+7f69d8020000-7f69d8025000 r-xs 00040000 fd:05 115478084                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.12/plexus-utils-1.5.12.jar
+7f69d8025000-7f69d8027000 r-xs 00006000 fd:05 115478085                  /home/tdiesler/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.1/maven-common-artifact-filters-1.1.jar
+7f69d8027000-7f69d8028000 r-xs 00003000 fd:05 115476258                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.5.3/plexus-compiler-javac-1.5.3.jar
+7f69d8028000-7f69d802a000 r-xs 00000000 fd:05 115476245                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/1.5.3/plexus-compiler-manager-1.5.3.jar
+7f69d802a000-7f69d802b000 r-xs 00004000 fd:05 115476233                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-compiler-api/1.5.3/plexus-compiler-api-1.5.3.jar
+7f69d802b000-7f69d802d000 r-xs 00026000 fd:05 115476016                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar
+7f69d802d000-7f69d802f000 r-xs 0000d000 fd:05 115475930                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.13/plexus-interpolation-1.13.jar
+7f69d802f000-7f69d8031000 r-xs 00007000 fd:05 115475816                  /home/tdiesler/.m2/repository/org/apache/maven/shared/maven-filtering/1.0-beta-3/maven-filtering-1.0-beta-3.jar
+7f69d8031000-7f69d8035000 r-xs 00034000 fd:05 115475811                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.15/plexus-utils-1.5.15.jar
+7f69d8035000-7f69d803a000 r-xs 00040000 fd:05 115476014                  /home/tdiesler/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
+7f69d803a000-7f69d803c000 r-xs 0000c000 fd:05 115476018                  /home/tdiesler/.m2/repository/org/apache/maven/enforcer/enforcer-rules/1.0-beta-1/enforcer-rules-1.0-beta-1.jar
+7f69d803c000-7f69d803d000 r-xs 00002000 fd:05 115476012                  /home/tdiesler/.m2/repository/org/apache/maven/enforcer/enforcer-api/1.0-beta-1/enforcer-api-1.0-beta-1.jar
+7f69d803d000-7f69d8041000 r-xs 00038000 fd:05 115476013                  /home/tdiesler/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar
+7f69d8041000-7f69d807c000 r-xs 002c7000 fd:03 262163                     /usr/java/apache-maven-2.2.1/lib/maven-2.2.1-uber.jar
+7f69d807c000-7f69d807f000 ---p 00000000 00:00 0 
+7f69d807f000-7f69d817d000 rwxp 00000000 00:00 0 
+7f69d817d000-7f69d8180000 ---p 00000000 00:00 0 
+7f69d8180000-7f69d827e000 rwxp 00000000 00:00 0 
+7f69d827e000-7f69d8281000 ---p 00000000 00:00 0 
+7f69d8281000-7f69d837f000 rwxp 00000000 00:00 0 
+7f69d837f000-7f69d8382000 ---p 00000000 00:00 0 
+7f69d8382000-7f69d8480000 rwxp 00000000 00:00 0 
+7f69d8480000-7f69d8483000 ---p 00000000 00:00 0 
+7f69d8483000-7f69d8581000 rwxp 00000000 00:00 0 
+7f69d8581000-7f69d8582000 ---p 00000000 00:00 0 
+7f69d8582000-7f69d8bba000 rwxp 00000000 00:00 0 
+7f69d8bba000-7f69d8d50000 r-xs 02fd0000 fd:03 137808                     /usr/java/jdk1.6.0_20/jre/lib/rt.jar
+7f69d8d50000-7f69d8d78000 rwxp 00000000 00:00 0 
+7f69d8d78000-7f69d8d79000 ---p 00000000 00:00 0 
+7f69d8d79000-7f69d8e79000 rwxp 00000000 00:00 0 
+7f69d8e79000-7f69d8e7a000 ---p 00000000 00:00 0 
+7f69d8e7a000-7f69d8f7a000 rwxp 00000000 00:00 0 
+7f69d8f7a000-7f69d8f7b000 ---p 00000000 00:00 0 
+7f69d8f7b000-7f69d907b000 rwxp 00000000 00:00 0 
+7f69d907b000-7f69d907c000 ---p 00000000 00:00 0 
+7f69d907c000-7f69d9187000 rwxp 00000000 00:00 0 
+7f69d9187000-7f69d91a6000 rwxp 00000000 00:00 0 
+7f69d91a6000-7f69d91bc000 rwxp 00000000 00:00 0 
+7f69d91bc000-7f69d92f1000 rwxp 00000000 00:00 0 
+7f69d92f1000-7f69d92fc000 rwxp 00000000 00:00 0 
+7f69d92fc000-7f69d931b000 rwxp 00000000 00:00 0 
+7f69d931b000-7f69d9331000 rwxp 00000000 00:00 0 
+7f69d9331000-7f69d9465000 rwxp 00000000 00:00 0 
+7f69d9465000-7f69d950b000 rwxp 00000000 00:00 0 
+7f69d950b000-7f69d9516000 rwxp 00000000 00:00 0 
+7f69d9516000-7f69d95cc000 rwxp 00000000 00:00 0 
+7f69d95cc000-7f69d95da000 r-xp 00000000 fd:03 140106                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libzip.so
+7f69d95da000-7f69d96dc000 ---p 0000e000 fd:03 140106                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libzip.so
+7f69d96dc000-7f69d96df000 rwxp 00010000 fd:03 140106                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libzip.so
+7f69d96df000-7f69d96e0000 rwxp 00000000 00:00 0 
+7f69d96e0000-7f69d96ec000 r-xp 00000000 fd:03 5041                       /lib64/libnss_files-2.12.so
+7f69d96ec000-7f69d98eb000 ---p 0000c000 fd:03 5041                       /lib64/libnss_files-2.12.so
+7f69d98eb000-7f69d98ec000 r-xp 0000b000 fd:03 5041                       /lib64/libnss_files-2.12.so
+7f69d98ec000-7f69d98ed000 rwxp 0000c000 fd:03 5041                       /lib64/libnss_files-2.12.so
+7f69d98ed000-7f69d98ee000 r-xs 00001000 fd:05 115475806                  /home/tdiesler/.m2/repository/org/sonatype/plexus/plexus-build-api/0.0.4/plexus-build-api-0.0.4.jar
+7f69d98ee000-7f69d98f3000 r-xs 0003d000 fd:05 115476015                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-utils/1.5.8/plexus-utils-1.5.8.jar
+7f69d98f3000-7f69d98f7000 r-xs 0002f000 fd:05 115477671                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-assembly-plugin/2.2-beta-4/maven-assembly-plugin-2.2-beta-4.jar
+7f69d98f7000-7f69d98f8000 r-xs 00005000 fd:05 115475533                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-source-plugin/2.1.1/maven-source-plugin-2.1.1.jar
+7f69d98f8000-7f69d98fa000 r-xs 00004000 fd:05 115475463                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-enforcer-plugin/1.0-beta-1/maven-enforcer-plugin-1.0-beta-1.jar
+7f69d98fa000-7f69d98fb000 r-xs 00007000 fd:05 115475513                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-release-plugin/2.0-beta-9/maven-release-plugin-2.0-beta-9.jar
+7f69d98fb000-7f69d98fc000 r-xs 00005000 fd:05 115475739                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-install-plugin/2.3/maven-install-plugin-2.3.jar
+7f69d98fc000-7f69d98fe000 r-xs 00005000 fd:05 115475499                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-jar-plugin/2.2/maven-jar-plugin-2.2.jar
+7f69d98fe000-7f69d98ff000 r-xs 00005000 fd:05 115475547                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-surefire-plugin/2.4.3/maven-surefire-plugin-2.4.3.jar
+7f69d98ff000-7f69d9902000 r-xs 00020000 fd:05 115476338                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-archiver/1.0-alpha-7/plexus-archiver-1.0-alpha-7.jar
+7f69d9902000-7f69d9909000 r-xp 00000000 fd:03 140108                     /usr/java/jdk1.6.0_20/jre/lib/amd64/native_threads/libhpi.so
+7f69d9909000-7f69d9a0a000 ---p 00007000 fd:03 140108                     /usr/java/jdk1.6.0_20/jre/lib/amd64/native_threads/libhpi.so
+7f69d9a0a000-7f69d9a0c000 rwxp 00008000 fd:03 140108                     /usr/java/jdk1.6.0_20/jre/lib/amd64/native_threads/libhpi.so
+7f69d9a0c000-7f69d9a0d000 rwxp 00000000 00:00 0 
+7f69d9a0d000-7f69d9a36000 r-xp 00000000 fd:03 140119                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libjava.so
+7f69d9a36000-7f69d9b35000 ---p 00029000 fd:03 140119                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libjava.so
+7f69d9b35000-7f69d9b3c000 rwxp 00028000 fd:03 140119                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libjava.so
+7f69d9b3c000-7f69d9b49000 r-xp 00000000 fd:03 140101                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libverify.so
+7f69d9b49000-7f69d9c48000 ---p 0000d000 fd:03 140101                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libverify.so
+7f69d9c48000-7f69d9c4b000 rwxp 0000c000 fd:03 140101                     /usr/java/jdk1.6.0_20/jre/lib/amd64/libverify.so
+7f69d9c4b000-7f69d9c4e000 ---p 00000000 00:00 0 
+7f69d9c4e000-7f69d9d4c000 rwxp 00000000 00:00 0 
+7f69d9d4c000-7f69da501000 r-xp 00000000 fd:03 140126                     /usr/java/jdk1.6.0_20/jre/lib/amd64/server/libjvm.so
+7f69da501000-7f69da600000 ---p 007b5000 fd:03 140126                     /usr/java/jdk1.6.0_20/jre/lib/amd64/server/libjvm.so
+7f69da600000-7f69da78b000 rwxp 007b4000 fd:03 140126                     /usr/java/jdk1.6.0_20/jre/lib/amd64/server/libjvm.so
+7f69da78b000-7f69da7c7000 rwxp 00000000 00:00 0 
+7f69da7c7000-7f69da7ce000 r-xp 00000000 fd:03 140091                     /usr/java/jdk1.6.0_20/jre/lib/amd64/jli/libjli.so
+7f69da7ce000-7f69da8cf000 ---p 00007000 fd:03 140091                     /usr/java/jdk1.6.0_20/jre/lib/amd64/jli/libjli.so
+7f69da8cf000-7f69da8d1000 rwxp 00008000 fd:03 140091                     /usr/java/jdk1.6.0_20/jre/lib/amd64/jli/libjli.so
+7f69da8d1000-7f69da8d2000 rwxp 00000000 00:00 0 
+7f69da8d2000-7f69da8d3000 r-xs 00004000 fd:05 115475483                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.0.2/maven-compiler-plugin-2.0.2.jar
+7f69da8d3000-7f69da8d4000 r-xs 00005000 fd:05 115476478                  /home/tdiesler/.m2/repository/org/apache/maven/plugins/maven-resources-plugin/2.4.1/maven-resources-plugin-2.4.1.jar
+7f69da8d4000-7f69da8d5000 r-xs 00002000 fd:05 115477675                  /home/tdiesler/.m2/repository/org/apache/maven/maven-archiver/2.2/maven-archiver-2.2.jar
+7f69da8d5000-7f69da8d8000 r-xs 00027000 fd:05 115475167                  /home/tdiesler/.m2/repository/org/codehaus/plexus/plexus-utils/1.0.5/plexus-utils-1.0.5.jar
+7f69da8d8000-7f69da8da000 r-xs 00003000 fd:05 117047583                  /home/tdiesler/.m2/repository/org/codehaus/mojo/jboss-packaging-maven-plugin/2.0-beta-1/jboss-packaging-maven-plugin-2.0-beta-1.jar
+7f69da8da000-7f69da8db000 r-xp 00000000 00:00 0 
+7f69da8db000-7f69da8dd000 r-xs 00008000 fd:03 262150                     /usr/java/apache-maven-2.2.1/boot/classworlds-1.1.jar
+7f69da8dd000-7f69da8e5000 rwxs 00000000 fd:03 404012                     /tmp/hsperfdata_tdiesler/11887
+7f69da8e5000-7f69da8e6000 rwxp 00000000 00:00 0 
+7f69da8e6000-7f69da8e7000 ---p 00000000 00:00 0 
+7f69da8e7000-7f69da8e8000 rwxp 00000000 00:00 0 
+7fffa1bad000-7fffa1bc2000 rwxp 00000000 00:00 0                          [stack]
+7fffa1bff000-7fffa1c00000 r-xp 00000000 00:00 0                          [vdso]
+ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
+
+VM Arguments:
+jvm_args: -Dclassworlds.conf=/usr/java/apache-maven/bin/m2.conf -Dmaven.home=/usr/java/apache-maven 
+java_command: org.codehaus.classworlds.Launcher "install"
+Launcher Type: SUN_STANDARD
+
+Environment Variables:
+JAVA_HOME=/usr/java/jdk1.6
+PATH=/home/tdiesler/bin:/usr/java/jdk1.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
+USERNAME=tdiesler
+LD_LIBRARY_PATH=/usr/java/jdk1.6.0_20/jre/lib/amd64/server:/usr/java/jdk1.6.0_20/jre/lib/amd64:/usr/java/jdk1.6.0_20/jre/../lib/amd64:/usr/java/yjp/bin/linux-x86-64
+SHELL=/bin/bash
+DISPLAY=:0.0
+
+Signal Handlers:
+SIGSEGV: [libjvm.so+0x70ffd0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGBUS: [libjvm.so+0x70ffd0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGFPE: [libjvm.so+0x5d8cf0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGPIPE: [libjvm.so+0x5d8cf0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGXFSZ: [libjvm.so+0x5d8cf0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGILL: [libjvm.so+0x5d8cf0], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGUSR1: SIG_DFL, sa_mask[0]=0x00000000, sa_flags=0x00000000
+SIGUSR2: [libjvm.so+0x5db510], sa_mask[0]=0x00000000, sa_flags=0x10000004
+SIGHUP: [libjvm.so+0x5db260], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGINT: [libjvm.so+0x5db260], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGTERM: [libjvm.so+0x5db260], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+SIGQUIT: [libjvm.so+0x5db260], sa_mask[0]=0x7ffbfeff, sa_flags=0x10000004
+
+
+---------------  S Y S T E M  ---------------
+
+OS:Fedora release 13 (Goddard)
+
+uname:Linux 2.6.33.5-124.fc13.x86_64 #1 SMP Fri Jun 11 09:38:12 UTC 2010 x86_64
+libc:glibc 2.12 NPTL 2.12 
+rlimit: STACK 10240k, CORE 0k, NPROC 1024, NOFILE 1024, AS infinity
+load average:0.89 0.42 0.21
+
+CPU:total 4 (4 cores per cpu, 1 threads per core) family 16 model 4 stepping 2, cmov, cx8, fxsr, mmx, sse, sse2, sse3, popcnt, mmxext, 3dnow, 3dnowext, lzcnt, sse4a
+
+Memory: 4k page, physical 4058112k(691548k free), swap 6160376k(6159132k free)
+
+vm_info: Java HotSpot(TM) 64-Bit Server VM (16.3-b01) for linux-amd64 JRE (1.6.0_20-b02), built on Apr 12 2010 13:57:11 by "java_re" with gcc 3.2.2 (SuSE Linux)
+
+time: Wed Jun 23 15:07:01 2010
+elapsed time: 10 seconds
+

Modified: arquillian/trunk/containers/osgi-embedded/pom.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -21,12 +21,35 @@
 
   <!-- Properties -->
   <properties>
-
-    <!-- Versioning -->
     <version.jboss_osgi_framework>1.0.0.Alpha5-SNAPSHOT</version.jboss_osgi_framework>
-
   </properties>
 
+  <!-- Build -->
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>bundles</id>
+            <phase>test-compile</phase>
+            <goals>
+              <goal>directory-single</goal>
+            </goals>
+            <configuration>
+              <finalName>test-libs</finalName>
+              <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+              <appendAssemblyId>false</appendAssemblyId>
+              <descriptors>
+                <descriptor>scripts/assembly-bundles.xml</descriptor>
+              </descriptors>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
   <!-- Dependencies -->
   <dependencies>
 
@@ -40,14 +63,33 @@
       <groupId>org.jboss.arquillian.protocol</groupId>
       <artifactId>arquillian-protocol-jmx</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
-
     <dependency>
+      <groupId>org.jboss.arquillian.protocol</groupId>
+      <artifactId>arquillian-protocol-local</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.arquillian.packager</groupId>
       <artifactId>arquillian-packager-osgi</artifactId>
       <version>${project.version}</version>
+      <scope>provided</scope>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-bundle</artifactId>
+      <version>${project.version}</version>
+      <scope>provided</scope>
+    </dependency>
 
+    <dependency>
+      <groupId>org.jboss.shrinkwrap</groupId>
+      <artifactId>shrinkwrap-impl-base</artifactId>
+      <scope>provided</scope>
+    </dependency>
+
     <!-- org.jboss.osgi -->
     <dependency>
       <groupId>org.jboss.osgi</groupId>
@@ -58,38 +100,42 @@
       <artifactId>org.osgi.core</artifactId>
       <scope>provided</scope>
     </dependency>
-    
     <dependency>
-      <groupId>javax.inject</groupId>
-      <artifactId>javax.inject</artifactId>
-    </dependency>
-    
-    <dependency>
-      <groupId>org.jboss.shrinkwrap</groupId>
-      <artifactId>shrinkwrap-impl-base</artifactId>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.compendium</artifactId>
       <scope>provided</scope>
     </dependency>
 
     <!-- Test dependencies -->
     <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
+      <groupId>org.jboss.arquillian.testenricher</groupId>
+      <artifactId>arquillian-testenricher-osgi</artifactId>
+      <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
-    
     <dependency>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-junit</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.jboss.osgi.framework</groupId>
       <artifactId>jboss-osgi-framework-core</artifactId>
       <version>${version.jboss_osgi_framework}</version>
       <scope>test</scope>
     </dependency>
-
     <dependency>
-      <groupId>org.jboss.arquillian</groupId>
-      <artifactId>arquillian-junit</artifactId>
-      <version>${project.version}</version>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-log4j</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
 </project>

Added: arquillian/trunk/containers/osgi-embedded/scripts/assembly-bundles.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded/scripts/assembly-bundles.xml	                        (rev 0)
+++ arquillian/trunk/containers/osgi-embedded/scripts/assembly-bundles.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,27 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+  <id>deploy-artifacts</id>
+  <formats>
+    <format>dir</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+
+  <!-- Dependency Sets -->
+  <dependencySets>
+  
+    <!-- bundle -->
+    <dependencySet>
+      <outputDirectory>bundles</outputDirectory>
+      <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+      <includes>
+        <include>*:arquillian-bundle:jar</include>
+        <include>*:org.osgi.compendium:jar</include>
+      </includes>
+      <useStrictFiltering>true</useStrictFiltering>
+      <scope>provided</scope>
+      <unpack>false</unpack>
+    </dependencySet>
+    
+  </dependencySets>
+</assembly>

Modified: arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkContainer.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkContainer.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkContainer.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -61,6 +61,7 @@
       try
       {
          framework.start();
+         context.add(BundleContext.class, framework.getBundleContext());
       }
       catch (BundleException ex)
       {
@@ -107,6 +108,8 @@
       {
          throw new DeploymentException("Cannot deploy: " + archive, ex);
       }
+      
+      //return new LocalMethodExecutor(); 
       return new JMXMethodExecutor();
    }
 

Deleted: arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiTestEnricher.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiTestEnricher.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiTestEnricher.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,98 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * 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.jboss.arquillian.osgi;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-
-import javax.inject.Inject;
-
-import org.jboss.arquillian.spi.Context;
-import org.jboss.arquillian.spi.TestEnricher;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.launch.Framework;
-
-/**
- * The OSGi TestEnricher
- * 
- * The enricher supports the injection of the Framework and the Bundle under test.
- * 
- * <pre><code>
- *    @Inject
- *    Framework framework;
- * 
- *    @Inject
- *    Bundle bundle;
- * </code></pre>
- * 
- * @author thomas.diesler at jboss.com
- * @version $Revision: $
- */
-public class OSGiTestEnricher implements TestEnricher
-{
-   @Override
-   public void enrich(Context context, Object testCase)
-   {
-      Class<? extends Object> testClass = testCase.getClass();
-      for (Field field : testClass.getDeclaredFields())
-      {
-         if (field.isAnnotationPresent(Inject.class))
-         {
-            if (field.getType().isAssignableFrom(Framework.class))
-            {
-               injectFramework(context, testCase, field);
-            }
-            if (field.getType().isAssignableFrom(Bundle.class))
-            {
-               injectBundle(context, testCase, field);
-            }
-         }
-      }
-   }
-
-   private void injectFramework(Context context, Object testCase, Field field) 
-   {
-      try
-      {
-         Framework framework = context.get(Framework.class);
-         field.set(testCase, framework);
-      }
-      catch (IllegalAccessException ex)
-      {
-         throw new IllegalStateException("Cannot inject Framework", ex);
-      }
-   }
-
-   private void injectBundle(Context context, Object testCase, Field field) 
-   {
-      try
-      {
-         Bundle bundle = context.get(Bundle.class);
-         field.set(testCase, bundle);
-      }
-      catch (IllegalAccessException ex)
-      {
-         throw new IllegalStateException("Cannot inject Bundle", ex);
-      }
-   }
-
-   @Override
-   public Object[] resolve(Context context, Method method)
-   {
-      return null;
-   }
-}

Modified: arquillian/trunk/containers/osgi-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestEnricher
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestEnricher	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/src/main/resources/META-INF/services/org.jboss.arquillian.spi.TestEnricher	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1 +1 @@
-org.jboss.arquillian.osgi.OSGiTestEnricher
\ No newline at end of file
+org.jboss.arquillian.testenricher.osgi.OSGiTestEnricher
\ No newline at end of file

Modified: arquillian/trunk/containers/osgi-embedded/src/test/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkTestCase.java
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/test/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkTestCase.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/src/test/java/org/jboss/arquillian/osgi/OSGiEmbeddedFrameworkTestCase.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -34,7 +34,6 @@
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
-import org.osgi.framework.launch.Framework;
 
 /**
  * Test the embedded OSGi framework
@@ -45,9 +44,10 @@
 @RunWith(Arquillian.class)
 public class OSGiEmbeddedFrameworkTestCase
 {
+   
    public OSGiEmbeddedFrameworkTestCase()
    {
-      System.out.println("new OSGiEmbeddedFrameworkTestCase");
+      super();
    }
 
    @Deployment
@@ -62,6 +62,9 @@
             builder.addBundleSymbolicName(archive.getName());
             builder.addBundleManifestVersion(2);
             builder.addBundleActivator(SimpleActivator.class.getName());
+            // [TODO] generate a separate bundle the contains the test case
+            builder.addExportPackages(OSGiEmbeddedFrameworkTestCase.class);
+            builder.addImportPackages("org.jboss.shrinkwrap.api", "org.jboss.shrinkwrap.api.spec", "javax.inject", "org.junit");
             return builder.openStream();
          }
       });
@@ -71,24 +74,29 @@
    }
 
    @Inject
-   Framework framework;
+   public static BundleContext context;
    
    @Test
-   public void testFrameworkInjection() throws Exception
+   public void testBundleContextInjection() throws Exception
    {
-      assertNotNull("Framework injected", framework);
+      assertNotNull("BundleContext injected", context);
+      assertEquals("System Bundle ID", 0, context.getBundle().getBundleId());
    }
 
    @Inject
-   Bundle bundle;
+   public static Bundle bundle;
    
    @Test
    public void testBundleInjection() throws Exception
    {
-      // Assert that the bundle is injected and in state INSTALLED
+      // Assert that the bundle is injected
       assertNotNull("Bundle injected", bundle);
-      assertEquals("Bundle INSTALLED", Bundle.INSTALLED, bundle.getState());
       
+      // Assert that the bundle is in state RESOLVED
+      // Note when the test bundle contains the test case it 
+      // must be resolved already when this test method is called
+      assertEquals("Bundle RESOLVED", Bundle.RESOLVED, bundle.getState());
+      
       // Start the bundle
       bundle.start();
       assertEquals("Bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
@@ -102,12 +110,12 @@
       assertNotNull("ServiceReference not null", sref);
       
       // Get the service for the reference
-      //SimpleService service = (SimpleService)context.getService(sref);
-      //assertNotNull("Service not null", service);
+      SimpleService service = (SimpleService)context.getService(sref);
+      assertNotNull("Service not null", service);
       
       // Invoke the service 
-      //int sum = service.sum(1, 2, 3);
-      //assertEquals(6, sum);
+      int sum = service.sum(1, 2, 3);
+      assertEquals(6, sum);
       
       // Stop the bundle
       bundle.stop();

Modified: arquillian/trunk/containers/osgi-embedded/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/osgi-embedded/src/test/resources/META-INF/jboss-osgi-bootstrap.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -34,4 +34,18 @@
     </constructor>
   </bean>
   
+  <bean name="OSGiAutoInstallPlugin" class="org.jboss.osgi.framework.plugins.internal.AutoInstallPluginImpl">
+    <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+    <property name="autoInstall">
+     <list elementClass="java.net.URL">
+      <value>./target/test-libs/bundles/org.osgi.compendium.jar</value>
+     </list>
+    </property>
+    <property name="autoStart">
+     <list elementClass="java.net.URL">
+      <value>./target/test-libs/bundles/arquillian-bundle.jar</value>
+     </list>
+    </property>
+  </bean>
+  
 </deployment>

Added: arquillian/trunk/containers/osgi-embedded/src/test/resources/log4j.xml
===================================================================
--- arquillian/trunk/containers/osgi-embedded/src/test/resources/log4j.xml	                        (rev 0)
+++ arquillian/trunk/containers/osgi-embedded/src/test/resources/log4j.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+  <!-- ================================= -->
+  <!-- Preserve messages in a local file -->
+  <!-- ================================= -->
+
+  <appender name="FILE" class="org.apache.log4j.FileAppender">
+    <param name="File" value="target/test.log"/>
+    <param name="Append" value="false"/>
+    <layout class="org.apache.log4j.PatternLayout">
+      <!-- The default pattern: Date Priority [Category] Message\n -->
+      <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+    </layout>
+  </appender>
+  
+  <!-- ============================== -->
+  <!-- Append messages to the console -->
+  <!-- ============================== -->
+
+  <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+    <param name="Target" value="System.out" />
+    <param name="Threshold" value="INFO" />
+    <layout class="org.apache.log4j.PatternLayout">
+      <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+    </layout>
+  </appender>
+
+  <!-- ================ -->
+  <!-- Limit categories -->
+  <!-- ================ -->
+
+  <!-- Show jboss osgi traces - ->  
+  <category name="org.jboss.osgi">
+    <priority value="TRACE" />
+  </category>
+  -->
+  
+  <!-- Show jboss deployer traces  
+  <category name="org.jboss.deployers">
+    <priority value="TRACE" />
+  </category>
+  -->
+
+  <!-- ======================= -->
+  <!-- Setup the Root category -->
+  <!-- ======================= -->
+
+  <root>
+    <appender-ref ref="CONSOLE"/>
+    <appender-ref ref="FILE"/>
+  </root>
+
+</log4j:configuration>

Modified: arquillian/trunk/containers/pom.xml
===================================================================
--- arquillian/trunk/containers/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/containers/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -23,7 +23,7 @@
 
   <!-- Aggregate Modules -->
   <modules>
-    
+    <module>osgi-embedded</module>    
     <module>jbossas-remote-50</module>
     <module>jbossas-remote-51</module>
     <module>jbossas-remote-60</module>
@@ -31,7 +31,6 @@
     <module>jbossas-local-60</module>
     <module>jbossas-embedded-60</module>
     <module>glassfish-embedded-30</module>
-    <module>osgi-embedded</module>    
     <module>weld-embedded</module>    
     <module>weld-ee-embedded</module>
     <module>openejb</module>

Modified: arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitTestRunner.java
===================================================================
--- arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitTestRunner.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/junit/src/main/java/org/jboss/arquillian/junit/JUnitTestRunner.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -16,11 +16,14 @@
  */
 package org.jboss.arquillian.junit;
 
+import java.util.Collections;
+import java.util.List;
+
 import org.jboss.arquillian.impl.DeployableTestBuilder;
 import org.jboss.arquillian.spi.ContainerProfile;
 import org.jboss.arquillian.spi.TestResult;
+import org.jboss.arquillian.spi.TestResult.Status;
 import org.jboss.arquillian.spi.TestRunner;
-import org.jboss.arquillian.spi.TestResult.Status;
 import org.junit.Test;
 import org.junit.runner.Description;
 import org.junit.runner.JUnitCore;
@@ -34,31 +37,32 @@
  * A Implementation of the Arquillian TestRunner SPI for JUnit.
  *
  * @author <a href="mailto:aslak at conduct.no">Aslak Knutsen</a>
+ * @author thomas.diesler at jboss.com
  * @version $Revision: $
  */
 public class JUnitTestRunner implements TestRunner
 {
+   /** 
+    * Overwrite to provide additional run listeners. 
+    */
+   protected List<RunListener> getRunListeners()
+   {
+      return Collections.emptyList();
+   }
+
    public TestResult execute(Class<?> testClass, String methodName)
    {
-      final ExpectedExceptionHolder exceptionHolder = new ExpectedExceptionHolder();
       DeployableTestBuilder.setProfile(ContainerProfile.CONTAINER);
       JUnitCore runner = new JUnitCore();
-      runner.addListener(new RunListener() {
-         @Override
-         public void testFinished(Description description) throws Exception
-         {
-            Test test = description.getAnnotation(Test.class);
-            if(test != null && test.expected() != Test.None.class)
-            {
-               exceptionHolder.setException(Arquillian.caughtTestException.get());
-            }
-         }
-      });
-      Result result = runner.run(
-            Request.method(
-                  testClass, 
-                  methodName));
-     
+
+      ExpectedExceptionHolder exceptionHolder = new ExpectedExceptionHolder();
+      runner.addListener(exceptionHolder);
+
+      for (RunListener listener : getRunListeners())
+         runner.addListener(listener);
+
+      Result result = runner.run(Request.method(testClass, methodName));
+
       DeployableTestBuilder.clearProfile();
       return convertToTestResult(result, exceptionHolder.getException());
    }
@@ -69,33 +73,39 @@
     * @param result JUnit Test Run Result
     * @return The TestResult representation of the JUnit Result
     */
-   private TestResult convertToTestResult(Result result, Throwable expectedException) 
+   private TestResult convertToTestResult(Result result, Throwable expectedException)
    {
       Status status = Status.PASSED;
       Throwable throwable = expectedException;
-      if(result.getFailureCount() > 0) 
+      if (result.getFailureCount() > 0)
       {
          status = Status.FAILED;
          throwable = result.getFailures().get(0).getException();
       }
-      if(result.getIgnoreCount() > 0) 
+      if (result.getIgnoreCount() > 0)
       {
          status = Status.SKIPPED;
       }
       return new TestResult(status, throwable);
    }
-   
-   private class ExpectedExceptionHolder {
-      private Throwable exception = null;
-      
-      public void setException(Throwable exception)
-      {
-         this.exception = exception;
-      }
-      
+
+   private class ExpectedExceptionHolder extends RunListener
+   {
+      private Throwable exception;
+
       public Throwable getException()
       {
          return exception;
       }
+
+      @Override
+      public void testFinished(Description description) throws Exception
+      {
+         Test test = description.getAnnotation(Test.class);
+         if (test != null && test.expected() != Test.None.class)
+         {
+            exception = Arquillian.caughtTestException.get();
+         }
+      }
    }
 }

Modified: arquillian/trunk/pom.xml
===================================================================
--- arquillian/trunk/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -57,11 +57,11 @@
     <module>protocols</module>
     <module>testenrichers</module>
     <module>packagers</module>
+    <module>bundle</module>
     <module>containers</module>
 
     <module>frameworks</module>
     <module>examples</module>
-    <module>bundle</module>
 
     <module>doc/reference</module>
 </modules>

Modified: arquillian/trunk/protocols/jmx/pom.xml
===================================================================
--- arquillian/trunk/protocols/jmx/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/protocols/jmx/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -15,8 +15,8 @@
   <!-- Artifact Configuration -->
   <groupId>org.jboss.arquillian.protocol</groupId>
   <artifactId>arquillian-protocol-jmx</artifactId>
-  <name>Arquillian Protocol Local</name>
-  <description>Protocol handler for communicating whithin the same Java VM</description>
+  <name>Arquillian Protocol JMX</name>
+  <description>Protocol handler for communicating via JMX</description>
 
 
   <!-- Properties -->
@@ -35,6 +35,10 @@
       <artifactId>arquillian-spi</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.jboss.logging</groupId>
+      <artifactId>jboss-logging-spi</artifactId>
+    </dependency>
 
     <dependency>
       <groupId>org.jboss.arquillian</groupId>

Modified: arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXMethodExecutor.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -16,6 +16,15 @@
  */
 package org.jboss.arquillian.protocol.jmx;
 
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
 import org.jboss.arquillian.spi.ContainerMethodExecutor;
 import org.jboss.arquillian.spi.TestMethodExecutor;
 import org.jboss.arquillian.spi.TestResult;
@@ -29,26 +38,58 @@
  */
 public class JMXMethodExecutor implements ContainerMethodExecutor
 {
+   private MBeanServer cachedMBeanServer;
+   
    @Override
    public TestResult invoke(TestMethodExecutor testMethodExecutor)
    {
-      TestResult result = new TestResult();
+      if(testMethodExecutor == null) 
+         throw new IllegalArgumentException("TestMethodExecutor null");
+      
+      String testClass = testMethodExecutor.getInstance().getClass().getName();
+      String testMethod = testMethodExecutor.getMethod().getName();
+
+      TestResult result = null;
       try 
       {
-         testMethodExecutor.invoke();
-         result.setStatus(Status.PASSED);
+         MBeanServer mbeanServer = getMBeanServer();
+         ObjectName objectName = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
+         JMXTestRunnerMBean testRunner = getMBeanProxy(mbeanServer, objectName, JMXTestRunnerMBean.class);
+
+         // Invoke the remote test method
+         InputStream resultStream = testRunner.runTestMethodRemote(testClass, testMethod);
+         
+         // Unmarshall the TestResult
+         ObjectInputStream ois = new ObjectInputStream(resultStream);
+         result = (TestResult)ois.readObject();
       }
       catch (final Throwable e) 
       {
-         /*
-          *  TODO: the internal state TestResult is FAILED with Exception set, but it might have passed
-          *  due to the TestFrameworks ExpectedExceptions. We need to know this information to set the correct state.
-          */
-
-         result.setStatus(Status.FAILED);
+         result = new TestResult(Status.FAILED);
          result.setThrowable(e);
       }
-      result.setEnd(System.currentTimeMillis());
+      finally
+      {
+         result.setEnd(System.currentTimeMillis());
+      }
       return result;
    }
+
+   private MBeanServer getMBeanServer()
+   {
+      if (cachedMBeanServer == null)
+      {
+         ArrayList<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null);
+         if (mbeanServers.size() < 1)
+            throw new IllegalStateException("No MBeanServer available");
+         
+         cachedMBeanServer = mbeanServers.get(0);
+      }
+      return cachedMBeanServer;
+   }
+
+   private <T> T getMBeanProxy(MBeanServer mbeanServer, ObjectName name, Class<T> interf)
+   {
+      return (T)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, name, interf, false);
+   }
 }
\ No newline at end of file

Modified: arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunner.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -22,10 +22,15 @@
 import java.io.InputStream;
 import java.io.ObjectOutputStream;
 
+import javax.management.JMException;
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
 import org.jboss.arquillian.spi.TestResult;
 import org.jboss.arquillian.spi.TestResult.Status;
 import org.jboss.arquillian.spi.TestRunner;
 import org.jboss.arquillian.spi.util.TestRunners;
+import org.jboss.logging.Logger;
 
 /**
  * An MBean to run test methods in container.
@@ -35,8 +40,29 @@
  */
 public class JMXTestRunner implements JMXTestRunnerMBean
 {
+   // Provide logging
+   private static Logger log = Logger.getLogger(JMXTestRunner.class);
+
+   public static ObjectName register(MBeanServer mbeanServer) throws JMException
+   {
+      ObjectName oname = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
+      mbeanServer.registerMBean(new JMXTestRunner(), oname);
+      log.debug("JMXTestRunner registered: " + oname);
+      return oname;
+   }
+
+   public static void unregister(MBeanServer mbeanServer) throws JMException
+   {
+      ObjectName oname = new ObjectName(JMXTestRunnerMBean.OBJECT_NAME);
+      if (mbeanServer.isRegistered(oname))
+      {
+         mbeanServer.unregisterMBean(oname);
+         log.debug("JMXTestRunner unregistered: " + oname);
+      }
+   }
+
    @Override
-   public TestResult runTestMethodLocal(String className, String methodName) 
+   public TestResult runTestMethodLocal(String className, String methodName)
    {
       return runTestMethodInternal(className, methodName);
    }
@@ -45,7 +71,7 @@
    public InputStream runTestMethodRemote(String className, String methodName)
    {
       TestResult result = runTestMethodInternal(className, methodName);
-      
+
       // Marshall the TestResult
       try
       {
@@ -64,16 +90,17 @@
 
    private TestResult runTestMethodInternal(String className, String methodName)
    {
-      try 
+      try
       {
-         Class<?> testClass = Thread.currentThread().getContextClassLoader().loadClass(className);
-         
-         TestRunner runner = TestRunners.getTestRunner();
-         
+         ClassLoader classLoader = getClass().getClassLoader();
+         Class<?> testClass = classLoader.loadClass(className);
+
+         TestRunner runner = TestRunners.getTestRunner(classLoader);
+
          TestResult testResult = runner.execute(testClass, methodName);
          return testResult;
-      } 
-      catch(Throwable th) 
+      }
+      catch (Throwable th)
       {
          return new TestResult(Status.FAILED, th);
       }

Modified: arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunnerMBean.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunnerMBean.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/protocols/jmx/src/main/java/org/jboss/arquillian/protocol/jmx/JMXTestRunnerMBean.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -28,6 +28,9 @@
  */
 public interface JMXTestRunnerMBean
 {
+   /** The ObjectName for this service: jboss.arquillian:service=jmx-test-runner */
+   String OBJECT_NAME = "jboss.arquillian:service=jmx-test-runner";
+   
    /**
     * Runs a test method on the given test class
     *

Modified: arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java
===================================================================
--- arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/protocols/jmx/src/test/java/org/jboss/arquillian/jmx/JMXTestRunnerTestCase.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -18,7 +18,15 @@
 
 import static org.junit.Assert.*;
 
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.ObjectName;
+
 import org.jboss.arquillian.protocol.jmx.JMXTestRunner;
+import org.jboss.arquillian.protocol.jmx.JMXTestRunnerMBean;
 import org.jboss.arquillian.spi.TestResult;
 import org.jboss.arquillian.spi.TestResult.Status;
 import org.junit.Test;
@@ -33,13 +41,36 @@
 public class JMXTestRunnerTestCase
 {
    @Test
-   public void testFrameworkInjection() throws Throwable
+   public void testJMXTestRunner() throws Throwable
    {
-      JMXTestRunner testRunner = new JMXTestRunner();
-      TestResult result = testRunner.runTestMethodLocal(DummyTestCase.class.getName(), "testMethod");
-      assertNotNull("TestResult not null", result);
-      assertNotNull("Status not null", result.getStatus());
-      if (result.getStatus() == Status.FAILED)
-         throw result.getThrowable();
+      MBeanServer mbeanServer = getMBeanServer();
+      ObjectName oname = JMXTestRunner.register(mbeanServer);
+      
+      try
+      {
+         JMXTestRunnerMBean testRunner = getMBeanProxy(mbeanServer, oname, JMXTestRunnerMBean.class);
+         TestResult result = testRunner.runTestMethodLocal(DummyTestCase.class.getName(), "testMethod");
+         
+         assertNotNull("TestResult not null", result);
+         assertNotNull("Status not null", result.getStatus());
+         if (result.getStatus() == Status.FAILED)
+            throw result.getThrowable();
+      }
+      finally
+      {
+         mbeanServer.unregisterMBean(oname);
+      }
    }
+
+   private MBeanServer getMBeanServer()
+   {
+      ArrayList<MBeanServer> mbeanServers = MBeanServerFactory.findMBeanServer(null);
+      MBeanServer mbeanServer = (mbeanServers.size() < 1 ? MBeanServerFactory.createMBeanServer() : mbeanServers.get(0));
+      return mbeanServer;
+   }
+
+   private <T> T getMBeanProxy(MBeanServer mbeanServer, ObjectName name, Class<T> interf)
+   {
+      return (T)MBeanServerInvocationHandler.newProxyInstance(mbeanServer, name, interf, false);
+   }
 }

Modified: arquillian/trunk/spi/pom.xml
===================================================================
--- arquillian/trunk/spi/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/spi/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -1,34 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
-   <!-- Parent -->
-   <parent>
-      <groupId>org.jboss.arquillian</groupId>
-      <artifactId>arquillian-build</artifactId>
-      <version>1.0.0-SNAPSHOT</version>
-      <relativePath>../build/pom.xml</relativePath>
-   </parent>
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.arquillian</groupId>
+    <artifactId>arquillian-build</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
 
-   <!-- Model Version -->
-   <modelVersion>4.0.0</modelVersion>
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
 
-   <!-- Artifact Configuration -->
-   <artifactId>arquillian-spi</artifactId>
-   <name>Arquillian SPI</name>
-   <description>Extension View of the Arquillian Project</description>
+  <!-- Artifact Configuration -->
+  <artifactId>arquillian-spi</artifactId>
+  <name>Arquillian SPI</name>
+  <description>Extension View of the Arquillian Project</description>
 
 
-   <!-- Properties -->
-   <properties>
+  <!-- Properties -->
+  <properties>
 
-      <!-- Versioning -->
+    <!-- Versioning -->
 
-   </properties>
+  </properties>
 
   <reporting>
     <plugins>
-    
+
       <!-- JavaDoc / APIViz -->
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
@@ -49,7 +48,7 @@
           <version>true</version>
           <author>true</author>
           <keywords>true</keywords>
-          <additionalparam> 
+          <additionalparam>
             -sourceclasspath ${project.build.outputDirectory}
           </additionalparam>
           <stylesheetfile>${basedir}/src/javadoc/stylesheet.css</stylesheetfile>
@@ -57,17 +56,22 @@
           <docfilessubdirs>true</docfilessubdirs>
         </configuration>
       </plugin>
-    
+
     </plugins>
   </reporting>
 
-   <!-- Dependencies -->
-   <dependencies>
-      <dependency>
-         <groupId>org.jboss.arquillian</groupId>
-         <artifactId>arquillian-api</artifactId>
-	 <version>${project.version}</version>
-      </dependency>
-   </dependencies>
+  <!-- Dependencies -->
+  <dependencies>
+    <dependency>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
 </project>
 

Modified: arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/TestRunners.java
===================================================================
--- arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/TestRunners.java	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/spi/src/main/java/org/jboss/arquillian/spi/util/TestRunners.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -28,24 +28,35 @@
  */
 public final class TestRunners
 {
-   private TestRunners() {}
-   
+   // Hide ctor
+   private TestRunners()
+   {
+   }
+
    /**
-    * Dynamically loads / creates a new instance of a test runner. 
+    * Dynamically loads an instance of a test runner. 
     * 
     * @return A Initialized TestRunner
     * @throws IllegalStateException if multiple TestRunners found in classpath.
     */
-   public static TestRunner getTestRunner() 
+   public static TestRunner getTestRunner()
    {
-      ServiceLoader<TestRunner> serviceLoader = ServiceLoader.load(
-            TestRunner.class, 
-            SecurityActions.getThreadContextClassLoader());
+      return getTestRunner(SecurityActions.getThreadContextClassLoader());
+   }
 
-      if(serviceLoader.getProviders().size() > 1) 
-      {
+   /**
+    * Dynamically loads an instance of a test runner. 
+    * 
+    * @return A Initialized TestRunner
+    * @throws IllegalStateException if multiple TestRunners found in classpath.
+    */
+   public static TestRunner getTestRunner(ClassLoader classLoader)
+   {
+      ServiceLoader<TestRunner> serviceLoader = ServiceLoader.load(TestRunner.class, classLoader);
+
+      if (serviceLoader.getProviders().size() > 1)
          throw new IllegalStateException("Multiple TestRunners found, only one allowed. Check your classpath");
-      }
+      
       return serviceLoader.iterator().next();
    }
 }

Copied: arquillian/trunk/testenrichers/osgi/pom.xml (from rev 4548, arquillian/trunk/protocols/jmx/pom.xml)
===================================================================
--- arquillian/trunk/testenrichers/osgi/pom.xml	                        (rev 0)
+++ arquillian/trunk/testenrichers/osgi/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <!-- Parent -->
+  <parent>
+    <groupId>org.jboss.arquillian</groupId>
+    <artifactId>arquillian-build</artifactId>
+    <version>1.0.0-SNAPSHOT</version>
+    <relativePath>../../build/pom.xml</relativePath>
+  </parent>
+
+  <!-- Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- Artifact Configuration -->
+  <groupId>org.jboss.arquillian.testenricher</groupId>
+  <artifactId>arquillian-testenricher-osgi</artifactId>
+  <name>Arquillian TestEnricher OSGi</name>
+  <description>OSGi TestEnricher for the Arquillian Project</description>
+
+
+  <!-- Properties -->
+  <properties>
+  </properties>
+
+  <!-- Dependencies -->
+  <dependencies>
+
+    <!-- org.jboss.arquillian -->
+    <dependency>
+      <groupId>org.jboss.arquillian</groupId>
+      <artifactId>arquillian-spi</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>javax.inject</groupId>
+      <artifactId>javax.inject</artifactId>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.osgi</groupId>
+      <artifactId>org.osgi.core</artifactId>
+      <scope>provided</scope>
+    </dependency>
+  </dependencies>
+</project>
+

Copied: arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java (from rev 4548, arquillian/trunk/containers/osgi-embedded/src/main/java/org/jboss/arquillian/osgi/OSGiTestEnricher.java)
===================================================================
--- arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java	                        (rev 0)
+++ arquillian/trunk/testenrichers/osgi/src/main/java/org/jboss/arquillian/testenricher/osgi/OSGiTestEnricher.java	2010-06-24 08:54:00 UTC (rev 4549)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * 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.jboss.arquillian.testenricher.osgi;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import javax.inject.Inject;
+
+import org.jboss.arquillian.spi.Context;
+import org.jboss.arquillian.spi.TestEnricher;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The OSGi TestEnricher
+ * 
+ * The enricher supports the injection of the Framework and the Bundle under test.
+ * 
+ * <pre><code>
+ *    @Inject
+ *    BundleContext sysctx;
+ * 
+ *    @Inject
+ *    Bundle bundle;
+ * </code></pre>
+ * 
+ * @author thomas.diesler at jboss.com
+ * @version $Revision: $
+ */
+public class OSGiTestEnricher implements TestEnricher
+{
+   @Override
+   public void enrich(Context context, Object testCase)
+   {
+      Class<? extends Object> testClass = testCase.getClass();
+      enrichInternal(context, testClass, testCase);
+   }
+
+   /**
+    * Enrich the static fields on the test case
+    */
+   public void enrich(Context context, Class<?> testClass)
+   {
+      enrichInternal(context, testClass, null);
+   }
+
+   private void enrichInternal(Context context, Class<?> testClass, Object testCase)
+   {
+      for (Field field : testClass.getDeclaredFields())
+      {
+         if (field.isAnnotationPresent(Inject.class))
+         {
+            if (field.getType().isAssignableFrom(BundleContext.class))
+            {
+               injectBundleContext(context, testCase, field);
+            }
+            if (field.getType().isAssignableFrom(Bundle.class))
+            {
+               injectBundle(context, testCase, field);
+            }
+         }
+      }
+   }
+
+   private void injectBundleContext(Context context, Object testCase, Field field) 
+   {
+      try
+      {
+         BundleContext sysctx = context.get(BundleContext.class);
+         field.set(testCase, sysctx);
+      }
+      catch (IllegalAccessException ex)
+      {
+         throw new IllegalStateException("Cannot inject BundleContext", ex);
+      }
+   }
+
+   private void injectBundle(Context context, Object testCase, Field field) 
+   {
+      try
+      {
+         Bundle bundle = context.get(Bundle.class);
+         field.set(testCase, bundle);
+      }
+      catch (IllegalAccessException ex)
+      {
+         throw new IllegalStateException("Cannot inject Bundle", ex);
+      }
+   }
+
+   @Override
+   public Object[] resolve(Context context, Method method)
+   {
+      return null;
+   }
+}

Modified: arquillian/trunk/testenrichers/pom.xml
===================================================================
--- arquillian/trunk/testenrichers/pom.xml	2010-06-24 08:50:17 UTC (rev 4548)
+++ arquillian/trunk/testenrichers/pom.xml	2010-06-24 08:54:00 UTC (rev 4549)
@@ -28,6 +28,7 @@
     
     <module>cdi</module>
     <module>ejb</module>
+    <module>osgi</module>
     <module>resource</module>
 
   </modules>



More information about the jboss-svn-commits mailing list