[jboss-osgi-commits] JBoss-OSGI SVN: r89009 - in projects/jboss-osgi/projects/husky/trunk: harness and 11 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Mon May 18 13:05:43 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-18 13:05:41 -0400 (Mon, 18 May 2009)
New Revision: 89009
Added:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/internal/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd
Removed:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java
Modified:
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
projects/jboss-osgi/projects/husky/trunk/pom.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
Log:
Embedded bundle testing ok
Modified: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -18,7 +18,7 @@
<name>JBossOSGi - Husky Harness</name>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky-harness</artifactId>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -32,15 +32,58 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <!-- Budle Dependencies -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.husky.internal.Activator</Bundle-Activator>
+ <Private-Package>
+ org.jboss.osgi.husky.internal,
+ org.jboss.osgi.husky.junit
+ </Private-Package>
+ <Export-Package>
+ org.jboss.osgi.husky;version=${version},
+ org.jboss.osgi.husky.annotation;version=${version}
+ </Export-Package>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ junit;inline=false,
+ </Embed-Dependency>
+ <_exportcontents>org.junit;version=${version.junit}</_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<quiet>true</quiet>
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -26,7 +26,7 @@
import java.util.Properties;
import org.jboss.osgi.husky.internal.AbstractBridge;
-import org.jboss.osgi.husky.internal.Utils;
+import org.jboss.osgi.husky.internal.Util;
/**
* A basic {@link Bridge} implementation that can be associated
@@ -73,7 +73,7 @@
if (className == null)
throw new IllegalStateException("Cannot load invoker: " + className);
- invoker = (Invoker)Utils.loadInstance(className, props);
+ invoker = (Invoker)Util.loadInstance(className, props);
}
return invoker;
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -25,7 +25,7 @@
import java.util.Properties;
-import org.jboss.osgi.husky.internal.Utils;
+import org.jboss.osgi.husky.internal.Util;
/**
* Loads the configured test {@link Bridge} instance.
@@ -60,6 +60,6 @@
if (className == null)
throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
- return (Bridge)Utils.loadInstance(className, props);
+ return (Bridge)Util.loadInstance(className, props);
}
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -43,9 +43,15 @@
*
* @throws RuntimeException if no {@link PackageListener} can
*/
- Response process(Request req);
+ Response process(Request req) throws ClassNotFoundException;
- void addPackagerListener(PackageListener listener);
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
- void removePackagerListener(PackageListener listener);
+ /**
+ * Remove a {@link PackageListener} from this connector
+ */
+ void removePackageListener(PackageListener listener);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -45,6 +45,6 @@
* Called by {@link Connector} when this listener indicated that it can
* handle the test request.
*/
- Response runTests(Request request);
+ Response runTests(Request request) throws ClassNotFoundException;
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -39,4 +39,14 @@
* @return an empty list if the test was successful
*/
List<Failure> getFailures();
+
+ /**
+ * Add a list of failures to the response
+ */
+ void addAllFailures(List<Failure> failures);
+
+ /**
+ * Add a failure to the response
+ */
+ void addFailure(Failure failure);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -62,8 +62,8 @@
{
if (response == null)
{
- BasicRequest req = new BasicRequest(testClass.getName(), testMethod);
- response = getInvoker().invoke(req);
+ BasicRequest request = new BasicRequest(testClass.getName(), testMethod);
+ response = getInvoker().invoke(request);
}
List<Failure> failures = response.getFailures();
@@ -89,7 +89,7 @@
private Class<?> getCallerClass(String callerFrame)
{
String className = callerFrame.substring(0, callerFrame.lastIndexOf('.'));
- return Utils.loadClass(className);
+ return Util.loadClass(className);
}
private String getCallerMethod(String callerFrame)
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -41,23 +41,25 @@
{
private List<PackageListener> listeners = new ArrayList<PackageListener>();
- public void addPackagerListener(PackageListener listener)
+ public void addPackageListener(PackageListener listener)
{
listeners.add(listener);
}
- public void removePackagerListener(PackageListener listener)
+ public void removePackageListener(PackageListener listener)
{
listeners.remove(listener);
}
- public Response process(Request req)
+ public Response process(Request req) throws ClassNotFoundException
{
String testClass = req.getTestClass();
for (PackageListener listener : listeners)
{
if (listener.match(req))
+ {
return listener.runTests(req);
+ }
}
throw new IllegalStateException("Cannot find listener to handle: " + testClass + ", we have " + listeners);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -61,7 +61,7 @@
return false;
}
- public Response runTests(Request request)
+ public Response runTests(Request request) throws ClassNotFoundException
{
String testClass = request.getTestClass();
return getRunner().runTests(getContext(), loadTestClass(testClass));
@@ -71,7 +71,7 @@
public abstract Context getContext();
- public abstract Class<?> loadTestClass(String className);
+ public abstract Class<?> loadTestClass(String className) throws ClassNotFoundException;
public String toString()
{
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,55 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 17-May-2009
+ */
+public class Activator implements BundleActivator
+{
+ private JMXConnector connector;
+
+ public void start(BundleContext context) throws Exception
+ {
+ connector = new JMXConnector(context);
+ connector.start();
+
+ context.addBundleListener(new Extender(context));
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ connector = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,62 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.osgi.husky.Failure;
+import org.jboss.osgi.husky.Response;
+
+/**
+ * [TODO]
+ *
+ * @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);
+ }
+
+ public void addAllFailures(List<Failure> fails)
+ {
+ for (Failure failure : fails)
+ {
+ failures.add(failure);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,95 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.PackageListener;
+import org.jboss.osgi.husky.junit.JUnitPackageListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 17-May-2009
+ */
+public class Extender implements BundleListener
+{
+ private BundleContext context;
+ private LogService log;
+
+ public Extender(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ if (event.getType() == BundleEvent.STARTED)
+ {
+ Bundle bundle = event.getBundle();
+ String testPackage = (String)bundle.getHeaders().get("Test-Package");
+ if (testPackage != null)
+ {
+ log.log(LogService.LOG_INFO, "Test-Package: " + testPackage + " in bundle: " + bundle);
+ registerPackageListener(bundle, testPackage.split("[, ]"));
+ }
+ }
+ }
+
+ private void registerPackageListener(Bundle bundle, String[] testPackages)
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain MBeanServer service");
+ return;
+ }
+
+ JUnitPackageListener listener = new JUnitPackageListener(bundle, testPackages);
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(JMXConnector.OBJECT_NAME) == false)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain connector: " + JMXConnector.OBJECT_NAME);
+ return;
+ }
+
+ try
+ {
+ server.invoke(JMXConnector.OBJECT_NAME, "addPackageListener", new Object[] { listener }, new String[] { PackageListener.class.getName() });
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register package listener", ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,125 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 17-May-2009
+ */
+public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
+{
+ public static ObjectName OBJECT_NAME;
+ static
+ {
+ try
+ {
+ OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
+ }
+ catch (MalformedObjectNameException e)
+ {
+ // should never get here
+ }
+ }
+
+ private LogService log;
+ private BundleContext context;
+
+ public JMXConnector(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void start() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain MBeanServer service");
+
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ server.registerMBean(this, OBJECT_NAME);
+ log.log(LogService.LOG_INFO, "JMXConnector registered: " + OBJECT_NAME);
+ }
+
+ public void stop() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref != null)
+ {
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(OBJECT_NAME));
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
+
+ public InputStream process(InputStream reqStream)
+ {
+ try
+ {
+ // Unmarshall the Request
+ ObjectInputStream ois = new ObjectInputStream(reqStream);
+ Request request = (Request)ois.readObject();
+
+ // Field the request through the abstract connector
+ Response response = process(request);
+ if (response == null)
+ throw new IllegalStateException("response cannot be null");
+
+ // Marshall the Response
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(response);
+ oos.close();
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot process request", ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,53 @@
+/*
+ * 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.osgi.husky.internal;
+
+//$Id$
+
+import java.io.InputStream;
+
+import org.jboss.osgi.husky.PackageListener;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
+/**
+ * [TODO]
+ *
+ * @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);
+
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -23,12 +23,6 @@
// $Id$
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.osgi.husky.Failure;
-import org.jboss.osgi.husky.Response;
import org.junit.runner.Result;
/**
@@ -37,27 +31,16 @@
* @author Thomas.Diesler at jboss.com
* @since 16-May-2009
*/
-public class JUnitResponse implements Response
+public class JUnitResponse extends BasicResponse
{
private static final long serialVersionUID = 1L;
- private List<Failure> failures = new ArrayList<Failure>();
-
public JUnitResponse(Result result)
{
for (org.junit.runner.notification.Failure failure: result.getFailures())
{
- failures.add(new JUnitFailure(failure));
+ addFailure(new JUnitFailure(failure));
}
}
- public List<Failure> getFailures()
- {
- return Collections.unmodifiableList(failures);
- }
-
- public void addFailure(Failure failure)
- {
- failures.add(failure);
- }
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -23,6 +23,18 @@
// $Id$
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+import javax.management.RuntimeMBeanException;
+
import org.jboss.osgi.husky.Connector;
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Invoker;
@@ -39,19 +51,66 @@
*/
public class LocalInvoker implements Invoker
{
- private Connector connector;
-
- public LocalInvoker()
+ public Response invoke(Request req)
{
- connector = new LocalConnector();
- connector.addPackagerListener(new MatchAllJUnitPackageListener());
+ MBeanServerConnection server = getMBeanServer();
+ try
+ {
+ if (server.isRegistered(JMXConnector.OBJECT_NAME))
+ {
+ // Marshall the Request
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(req);
+ oos.close();
+
+ InputStream reqBytes = new ByteArrayInputStream(baos.toByteArray());
+
+ InputStream resBytes = (InputStream)server.invoke(JMXConnector.OBJECT_NAME, "process", new Object[] { reqBytes }, new String[] { InputStream.class.getName() });
+
+ // Unmarshall the Response
+ ObjectInputStream ois = new ObjectInputStream(resBytes);
+ Response response = (Response)ois.readObject();
+ return response;
+ }
+ else
+ {
+ Connector connector = new LocalConnector();
+ connector.addPackageListener(new MatchAllJUnitPackageListener());
+ return connector.process(req);
+ }
+ }
+ catch (RuntimeMBeanException rte)
+ {
+ throw rte.getTargetException();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot invoke connector", ex);
+ }
}
- public Response invoke(Request req)
+ @SuppressWarnings("unchecked")
+ private MBeanServerConnection getMBeanServer()
{
- return connector.process(req);
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
}
-
+
class LocalConnector extends AbstractConnector
{
}
@@ -60,7 +119,7 @@
{
public MatchAllJUnitPackageListener()
{
- super(new String[] {"org.jboss.test"});
+ super(new String[] { "org.jboss.test" });
}
public Context getContext()
@@ -77,7 +136,7 @@
@Override
public Class<?> loadTestClass(String className)
{
- return Utils.loadClass(className);
+ return Util.loadClass(className);
}
}
}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java (from rev 88983, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,92 @@
+/*
+ * 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.osgi.husky.internal;
+
+// $Id$
+
+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;
+ }
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -1,92 +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.osgi.husky.internal;
-
-// $Id$
-
-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 Utils
-{
- // 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;
- }
-}
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,70 @@
+/*
+ * 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.osgi.husky.junit;
+
+// $Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Runner;
+import org.jboss.osgi.husky.internal.AbstractPackageListener;
+import org.jboss.osgi.husky.internal.BasicContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of a {@link Runner} that uses the
+ * JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitPackageListener extends AbstractPackageListener
+{
+ private Bundle bundle;
+
+ public JUnitPackageListener(Bundle bundle, String[] testPackages)
+ {
+ super(testPackages);
+ this.bundle = bundle;
+ }
+
+ @Override
+ public Context getContext()
+ {
+ BasicContext context = new BasicContext();
+ context.addAttachment(Bundle.class, bundle);
+ context.addAttachment(BundleContext.class, bundle.getBundleContext());
+ return context;
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new JUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ return bundle.loadClass(className);
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -16,53 +16,87 @@
<modelVersion>4.0.0</modelVersion>
<name>JBossOSGi - Husky</name>
-
+
<description>JBoss OSGi Bundle Testsuite</description>
-
+
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
- <modules>
- <module>harness</module>
- <module>testsuite</module>
- </modules>
-
<!-- Properties -->
<properties>
- <junit.version>4.6</junit.version>
- <log4j.version>1.2.14</log4j.version>
- <slf4j.version>1.5.3</slf4j.version>
+ <version.aqute.bnd>0.0.323</version.aqute.bnd>
+ <version.felix.log>1.0.0</version.felix.log>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
+ <version.jboss.osgi>1.0.0.Beta2</version.jboss.osgi>
+ <version.junit>4.6</version.junit>
+ <version.osgi>r4v41</version.osgi>
</properties>
<!-- DependencyManagement -->
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ <version>${version.aqute.bnd}</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.felix.log}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>${version.jboss.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
+ <version>${version.junit}</version>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
+ <!-- Modules -->
+ <modules>
+ <module>harness</module>
+ <module>testsuite</module>
+ </modules>
+
<!-- Build -->
<build>
<plugins>
@@ -74,6 +108,24 @@
</configuration>
</plugin>
</plugins>
+
+ <!-- PluginManagement -->
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ <version>${version.aqute.bnd}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<!-- SCM -->
@@ -95,15 +147,8 @@
<!-- DistributionManagement -->
<distributionManagement>
<!--
- Add this to your ~/.m2/settings.xml
- <servers>
- <server>
- <id>jbpm.dyndns.org</id>
- <username>yourname</username>
- <privateKey>/home/yourname/.ssh/id_rsa</privateKey>
- <passphrase>yourpass</passphrase>
- </server>
- </servers>
+ Add this to your ~/.m2/settings.xml <servers> <server> <id>jbpm.dyndns.org</id> <username>yourname</username> <privateKey>/home/yourname/.ssh/id_rsa</privateKey>
+ <passphrase>yourpass</passphrase> </server> </servers>
-->
<site>
<id>jbpm.dyndns.org</id>
Modified: projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-18 17:05:41 UTC (rev 89009)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -29,29 +29,57 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+
+ <!-- Bundle Dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky-harness</artifactId>
<version>${version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -61,12 +89,59 @@
<!-- Plugins -->
<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>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<failIfNoTests>false</failIfNoTests>
<systemProperties>
<property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ <property>
<name>org.jboss.osgi.husky.Invoker</name>
<value>org.jboss.osgi.husky.internal.LocalInvoker</value>
</property>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,89 @@
+/*
+ * 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.test.husky.osgi.simple;
+
+// $Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeNotNull;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 17-May-2009
+ */
+public class SimpleAllInOneTest
+{
+ @ProvideContext
+ public Context context;
+
+ private OSGiTestHelper helper;
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp() throws BundleException
+ {
+ if (context == null)
+ {
+ helper = new OSGiTestHelper();
+ runtime = helper.getEmbeddedRuntime();
+
+ AbstractBundle bundle = runtime.installBundle("simple-all-in-one.jar");
+ bundle.start();
+ }
+ }
+
+ @After
+ public void tearDown()
+ {
+ if (context == null)
+ {
+ if (runtime != null)
+ runtime.shutdown();
+ }
+ }
+
+ @Test
+ public void testContextInjection()
+ {
+ if(context == null)
+ BridgeFactory.getBridge().run();
+
+ assumeNotNull(context);
+
+ Bundle bundle = context.getAttachment(Bundle.class);
+ assertEquals("simple-all-in-one", bundle.getSymbolicName());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,34 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${test.archive.directory}/../osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi.testing, \
+ org.osgi.framework;version\=1.4, \
+ org.apache.log4j
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-husky-harness.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,50 @@
+<?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="${log4j.output.dir}/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 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>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,7 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-all-in-one.jar src/test/resources/osgi/simple-all-in-one.bnd
+
+Bundle-SymbolicName: simple-all-in-one
+Export-Package: org.jboss.test.husky.osgi.simple
+
+# Register a PackageListener for this
+Test-Package: org.jboss.test.husky.osgi.simple
More information about the jboss-osgi-commits
mailing list