[jboss-osgi-commits] JBoss-OSGI SVN: r88983 - in projects/jboss-osgi/projects: husky and 24 other directories.
jboss-osgi-commits at lists.jboss.org
jboss-osgi-commits at lists.jboss.org
Sat May 16 19:14:43 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-16 19:14:43 -0400 (Sat, 16 May 2009)
New Revision: 88983
Added:
projects/jboss-osgi/projects/husky/
projects/jboss-osgi/projects/husky/trunk/
projects/jboss-osgi/projects/husky/trunk/.classpath
projects/jboss-osgi/projects/husky/trunk/.project
projects/jboss-osgi/projects/husky/trunk/.settings/
projects/jboss-osgi/projects/husky/trunk/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/husky/trunk/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/husky/trunk/harness/
projects/jboss-osgi/projects/husky/trunk/harness/.classpath
projects/jboss-osgi/projects/husky/trunk/harness/.project
projects/jboss-osgi/projects/husky/trunk/harness/.settings/
projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/husky/trunk/harness/src/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/
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/Bridge.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/Context.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.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/Request.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/Runner.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/package.html
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/
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/BasicContext.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicRequest.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitFailure.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/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/junit/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitRunner.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/package.html
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/package.html
projects/jboss-osgi/projects/husky/trunk/pom.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/
projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
projects/jboss-osgi/projects/husky/trunk/testsuite/.project
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/src/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceBase.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceTest.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/SimpleTest.java
Log:
Add husky test harness - first cut
Added: projects/jboss-osgi/projects/husky/trunk/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.classpath (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/.classpath 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <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"/>
+</classpath>
Added: projects/jboss-osgi/projects/husky/trunk/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.project (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/.project 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/husky/trunk/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/.settings/org.eclipse.jdt.core.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,5 @@
+#Fri May 15 00:24:23 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/husky/trunk/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/.settings/org.maven.ide.eclipse.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,9 @@
+#Fri May 15 00:24:21 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/projects/husky/trunk/harness/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.classpath (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.classpath 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <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"/>
+</classpath>
Added: projects/jboss-osgi/projects/husky/trunk/harness/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.project (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.project 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky-harness</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.eclipse.jdt.core.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,5 @@
+#Fri May 15 01:05:35 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/.settings/org.maven.ide.eclipse.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,9 @@
+#Fri May 15 01:05:34 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<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">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi - Husky Harness</name>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <quiet>true</quiet>
+ <excludePackageNames>*.internal</excludePackageNames>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
___________________________________________________________________
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/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,88 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.util.Properties;
+
+import org.jboss.osgi.husky.internal.AbstractBridge;
+import org.jboss.osgi.husky.internal.Utils;
+
+/**
+ * A basic {@link Bridge} implementation that can be associated
+ * with an arbitrary {@link Invoker}.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class BasicBridge extends AbstractBridge
+{
+ private Properties props;
+ private Invoker invoker;
+
+ /**
+ * Construct a basic {@link Bridge} with the given properties.
+ *
+ * The properties would typically contain the name of the
+ * associated invoker under the key of {@link Invoker}.
+ */
+ public BasicBridge(Properties props)
+ {
+ this.props = props;
+ }
+
+ /**
+ * Get the invoker associated with this {@link Bridge}.
+ *
+ * If the invoker was not explicitly set, this method will load the
+ * invoker from the class name given by the {@link Invoker} property.
+ *
+ * If still not found it will load the invoker from the class name
+ * given by the {@link Invoker} system property.
+ *
+ * @throws RuntimeException if the {@link Invoker} cannot be loaded.
+ */
+ public Invoker getInvoker()
+ {
+ if (invoker == null)
+ {
+ String className = props.getProperty(Invoker.class.getName());
+ if (className == null)
+ className = System.getProperty(Invoker.class.getName());
+
+ if (className == null)
+ throw new IllegalStateException("Cannot load invoker: " + className);
+
+ invoker = (Invoker)Utils.loadInstance(className, props);
+ }
+ return invoker;
+ }
+
+ /**
+ * Set the associated invoker
+ */
+ public void setInvoker(Invoker invoker)
+ {
+ this.invoker = invoker;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.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/Bridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,105 @@
+/*
+ * 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;
+
+// $Id$
+
+/**
+ * A Bridge intercepts a test and delegates the execution
+ * to the same (or another) test in and isolated test environment.
+ *
+ * An isolated test environment is one that does not have the same
+ * class loading space as the test itself. Isolated test environments
+ * are for example
+ *
+ * <ul>
+ * <li>Remote container environment</li>
+ * <li>Embedded OSGi Framework</li>
+ * </ul>
+ *
+ * Details on test method mapping is given with the individual
+ * run methods.
+ *
+ * The test {@link Request} is fieled through an {@link Invoker}
+ * that that returns a {@link Response} for the given test run.
+ *
+ * Invokers may be arbitarily complex. Local 'in proccess' invokers are
+ * possible just as well as remote invokers.
+ *
+ * <pre>
+ * void testMethod
+ * {
+ * if(isNotInContainer())
+ * {
+ * BridgeFactory.getBridge().run();
+ * return;
+ * }
+ * else
+ * {
+ * // in container test logic
+ * ...
+ * }
+ * }
+ * </pre>
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public interface Bridge
+{
+ /**
+ * Intercepts a test and delegates the execution to the
+ * same test in the same test class.
+ *
+ * The main use case is that of the same test class beeing deployed
+ * in the isolated test environment as well as run from the client test runner.
+ */
+ void run();
+
+ /**
+ * Intercepts a test and delegates the execution to the
+ * same test in a different test class.
+ *
+ * The main use case is that of one client side test class with the same
+ * set of test methods as another test class that runs in the isolated test environment.
+ */
+ void run(Class<?> testClass);
+
+ /**
+ * Intercepts a test and delegates the execution to another test
+ * in a different test class.
+ *
+ * The main use case is that of free mapping between client side tests and tests
+ * that run in the isolated test environment.
+ */
+ void run(Class<?> testClass, String testMethod);
+
+ /**
+ * Get the invoker that is associated with this bridge.
+ */
+ Invoker getInvoker();
+
+ /**
+ * Set the invoker that is associated with this bridge.
+ */
+ void setInvoker(Invoker invoker);
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.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/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,65 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.util.Properties;
+
+import org.jboss.osgi.husky.internal.Utils;
+
+/**
+ * Loads the configured test {@link Bridge} instance.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public abstract class BridgeFactory
+{
+ /**
+ * Loads the bridge class that is configed through the system property {@link Bridge}.
+ * If there is no such property, it returns an instance of {@link BasicBridge}.
+ */
+ public static Bridge getBridge()
+ {
+ Properties props = System.getProperties();
+ String className = props.getProperty(Bridge.class.getName());
+ return (className != null ? getBridge(props) : new BasicBridge(props));
+ }
+
+ /**
+ * Loads the bridge class that is configed through the property {@link Bridge}.
+ *
+ * If the loaded bridge has a constructor that takes a {@link Properties} parameter,
+ * that constructor is used. Otherwise the bridge will be instanciated with the default constructor
+ *
+ * @param props bridge properties
+ */
+ public static Bridge getBridge(Properties props)
+ {
+ String className = props.getProperty(Bridge.class.getName());
+ if (className == null)
+ throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
+
+ return (Bridge)Utils.loadInstance(className, props);
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.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/Connector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,51 @@
+/*
+ * 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;
+
+// $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.
+ *
+ * @throws RuntimeException if no {@link PackageListener} can
+ */
+ Response process(Request req);
+
+ void addPackagerListener(PackageListener listener);
+
+ void removePackagerListener(PackageListener listener);
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.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/Context.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,160 @@
+/*
+ * 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;
+
+// $Id$
+
+import java.util.Collection;
+
+/**
+ * The Context is a bucket of typed/named attachemnts.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public interface Context
+{
+ /** Get attachment keys */
+ Collection<Key> getAttachmentKeys();
+
+ /** Add arbitrary attachment */
+ <T> T addAttachment(Class<T> clazz, Object value);
+
+ /** Add arbitrary attachment with name */
+ <T> T addAttachment(Class<T> clazz, String name, Object value);
+
+ /** Add arbitrary attachment with name */
+ Object addAttachment(String name, Object value);
+
+ /** Get an arbitrary attachment */
+ <T> T getAttachment(Class<T> clazz);
+
+ /** Get an arbitrary attachment */
+ <T> T getAttachment(Class<T> clazz, String name);
+
+ /** Get an arbitrary attachment */
+ Object getAttachment(String name);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> clazz);
+
+ /** Remove arbitrary attachments */
+ <T> T removeAttachment(Class<T> clazz, String name);
+
+ /** Remove arbitrary attachments */
+ Object removeAttachment(String name);
+
+ /**
+ * A key for attachements
+ */
+ static class Key
+ {
+ private Class<?> clazz;
+ private String name;
+
+ /**
+ * Construct the key with optional class and name
+ */
+ public Key(Class<?> clazz, String name)
+ {
+ this.clazz = clazz;
+ this.name = name;
+ }
+
+ public static Key valueOf(String key)
+ {
+ int index = key.indexOf(",");
+ if (key.startsWith("[") && key.endsWith("]") && index > 0)
+ {
+ Class<?> classPart = null;
+ String className = key.substring(1, index);
+ String namePart = key.substring(index + 1, key.length() - 1);
+ if (className.length() > 0 && !className.equals("null"))
+ {
+ try
+ {
+ classPart = Class.forName(className);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalArgumentException("Cannot find class '" + className + "' in: " + key);
+ }
+ }
+ return new Key(classPart, namePart);
+ }
+ return null;
+ }
+
+ /**
+ * Get the class part for this key
+ *
+ * @return maybe null
+ */
+ public Class<?> getClassPart()
+ {
+ return clazz;
+ }
+
+ /**
+ * Get the name part for this key
+ *
+ * @return maybe null
+ */
+ public String getNamePart()
+ {
+ return name;
+ }
+
+ /**
+ * Two keys are equal if their {@link #toString()} is equal
+ */
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof Key))
+ return false;
+ if (obj == this)
+ return true;
+ return obj.toString().equals(toString());
+ }
+
+ /**
+ * Two keys have the same hashCode if their {@link #toString()} is equal
+ */
+ public int hashCode()
+ {
+ return toString().hashCode();
+ }
+
+ /**
+ * Returns the String repesentation of this Key.
+ * <p/>
+ *
+ * <pre>
+ * "[" + clazz + "," + name + "]"
+ * </pre>
+ */
+ public String toString()
+ {
+ return "[" + clazz + "," + name + "]";
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.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/Failure.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,57 @@
+/*
+ * 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;
+
+// $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
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.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/Invoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,39 @@
+/*
+ * 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;
+
+// $Id$
+
+/**
+ * An Invoker is the sending side of a test request.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public interface Invoker
+{
+ /**
+ * Invokes the associated {@link Connector} with a given test
+ * {@link Request}
+ */
+ Response invoke(Request req);
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.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/PackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,50 @@
+/*
+ * 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;
+
+// $Id$
+
+/**
+ * A PackageListener that is associated with a {@link Connector}.
+ *
+ * The PackageListener matches test {@link Request}s with the package names
+ * that it can handle. On a successful match the {@link Connector} will invoke
+ * the {@link #runTests(Request)} method.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public interface PackageListener
+{
+ /**
+ * Return true if the given {@link Request} is from a package
+ * that this listener can handle.
+ */
+ boolean match(Request request);
+
+ /**
+ * Called by {@link Connector} when this listener indicated that it can
+ * handle the test request.
+ */
+ Response runTests(Request request);
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.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/Request.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Request.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Request.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+//$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 getTestClass();
+
+ /**
+ * Get the test method name
+ */
+ String getTestMethod();
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Request.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/Response.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,42 @@
+/*
+ * 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;
+
+// $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();
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.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/Runner.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Runner.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Runner.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,54 @@
+/*
+ * 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;
+
+//$Id$
+
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.husky.junit.JUnitRunner;
+
+/**
+ * An abstraction of a test runner that executes the given
+ * test case in the isolated test environment.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public interface Runner
+{
+ /**
+ * Run the tests in the given test class.
+ *
+ * Simmilar to the {@link JUnitRunner} a valid implementation
+ * would do something simmilar to
+ *
+ * <ol>
+ * <li>Instanciate the test case</li>
+ * <li>Inject the context in the field marked by {@link ProvideContext}</li>
+ * <li>Run the individual test methods</li>
+ * <li>Collect the test results and wrap them in the {@link Response}</li>
+ * </ol>
+ *
+ * Note, some test frameworks may choose to use an instance per test method.
+ */
+ Response runTests(Context context, Class<?> testClass);
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Runner.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/annotation/ProvideContext.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,47 @@
+/*
+ * 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.annotation;
+
+// $Id$
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Runner;
+
+/**
+ * An annotation that instructs the {@link Runner} to inject
+ * the {@link Context} into the marked field or method on the
+ * test case instance prior to the execution of any test method.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+ at Retention(RetentionPolicy.RUNTIME)
+ at Target({ElementType.METHOD, ElementType.FIELD})
+public @interface ProvideContext
+{
+
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.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/annotation/package.html
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/package.html (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/package.html 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,4 @@
+<body>
+Annotaions used by the test harness.
+</body>
+
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,133 @@
+/*
+ * 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.BufferedReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.List;
+
+import junit.framework.AssertionFailedError;
+
+import org.jboss.osgi.husky.Bridge;
+import org.jboss.osgi.husky.Failure;
+import org.jboss.osgi.husky.Response;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public abstract class AbstractBridge implements Bridge
+{
+ private Response response;
+
+ public void run()
+ {
+ String callerFrame = getCallerFrame();
+ run(getCallerClass(callerFrame), getCallerMethod(callerFrame));
+ }
+
+ public void run(Class<?> testClass)
+ {
+ String callerFrame = getCallerFrame();
+ run(testClass, getCallerMethod(callerFrame));
+ }
+
+ public void run(Class<?> testClass, String testMethod)
+ {
+ if (response == null)
+ {
+ BasicRequest req = new BasicRequest(testClass.getName(), testMethod);
+ response = getInvoker().invoke(req);
+ }
+
+ List<Failure> failures = response.getFailures();
+ for (Failure failure : failures)
+ {
+ String failedClass = failure.getClassName();
+ String failedMethod = failure.getMethodName();
+ if (failedClass.equals(testClass.getName()) && failedMethod.equals(testMethod))
+ {
+ Throwable failureCause = failure.getException();
+ if (failureCause instanceof RuntimeException)
+ throw (RuntimeException)failureCause;
+ if (failureCause instanceof Error)
+ throw (Error)failureCause;
+
+ AssertionFailedError error = new AssertionFailedError(failure.getMessage());
+ error.initCause(failureCause);
+ throw error;
+ }
+ }
+ }
+
+ private Class<?> getCallerClass(String callerFrame)
+ {
+ String className = callerFrame.substring(0, callerFrame.lastIndexOf('.'));
+ return Utils.loadClass(className);
+ }
+
+ private String getCallerMethod(String callerFrame)
+ {
+ return callerFrame.substring(callerFrame.lastIndexOf('.') + 1);
+ }
+
+ private String getCallerFrame()
+ {
+ String callerFrame = null;
+ try
+ {
+ throw new Exception();
+ }
+ catch (Exception ex)
+ {
+ StringWriter sw = new StringWriter();
+ ex.printStackTrace(new PrintWriter(sw));
+
+ try
+ {
+ BufferedReader br = new BufferedReader(new StringReader(sw.toString()));
+
+ // line 1 is java.lang.Exception
+ // line 2 is this run method
+ String line = br.readLine();
+ line = br.readLine().trim();
+ while (line.startsWith("at org.jboss.osgi.husky"))
+ {
+ line = br.readLine().trim();
+ }
+ callerFrame = line.substring(3, line.indexOf('('));
+ }
+ catch (IOException ioex)
+ {
+ // ignore
+ }
+ }
+ return callerFrame;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.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/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,64 @@
+/*
+ * 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.List;
+
+import org.jboss.osgi.husky.Connector;
+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 16-May-2009
+ */
+public abstract class AbstractConnector implements Connector
+{
+ private List<PackageListener> listeners = new ArrayList<PackageListener>();
+
+ public void addPackagerListener(PackageListener listener)
+ {
+ listeners.add(listener);
+ }
+
+ public void removePackagerListener(PackageListener listener)
+ {
+ listeners.remove(listener);
+ }
+
+ public Response process(Request req)
+ {
+ 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);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.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/AbstractPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,80 @@
+/*
+ * 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.Arrays;
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.PackageListener;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.Runner;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public abstract class AbstractPackageListener implements PackageListener
+{
+ private String[] testPackages;
+
+ public AbstractPackageListener(String[] testPackages)
+ {
+ if (testPackages == null)
+ throw new IllegalArgumentException("Invalid test package: " + testPackages);
+
+ this.testPackages = testPackages;
+
+ }
+
+ public boolean match(Request req)
+ {
+ String testClass = req.getTestClass();
+ for (String testPackage : testPackages)
+ {
+ if (testClass.startsWith(testPackage))
+ return true;
+ }
+ return false;
+ }
+
+ public Response runTests(Request request)
+ {
+ String testClass = request.getTestClass();
+ return getRunner().runTests(getContext(), loadTestClass(testClass));
+ }
+
+ public abstract Runner getRunner();
+
+ public abstract Context getContext();
+
+ public abstract Class<?> loadTestClass(String className);
+
+ public String toString()
+ {
+ return Arrays.asList(testPackages).toString();
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.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/BasicContext.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,121 @@
+/*
+ * 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.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.osgi.husky.Context;
+
+/**
+ * The Context is a bucket of typed/named attachemnts.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Apr-2007
+ */
+public class BasicContext implements Context
+{
+ private Map<Key, Object> attachments = new HashMap<Key, Object>();
+
+ /** Construct the execution context with no attachments */
+ public BasicContext()
+ {
+
+ }
+
+ /** Construct the execution context with given attachments */
+ public BasicContext(Context att)
+ {
+ if (att != null)
+ {
+ for (Key key : att.getAttachmentKeys())
+ {
+ Object value = att.getAttachment(key.getClassPart(), key.getNamePart());
+ this.attachments.put(key, value);
+ }
+ }
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.keySet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.get(new Key(clazz, name));
+ }
+
+ public Object getAttachment(String name)
+ {
+ return attachments.get(new Key(null, name));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, null), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, String name, Object obj)
+ {
+ return (T)attachments.put(new Key(clazz, name), obj);
+ }
+
+ public Object addAttachment(String name, Object obj)
+ {
+ return attachments.put(new Key(null, name), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return (T)attachments.remove(new Key(clazz, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.remove(new Key(clazz, name));
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return attachments.remove(new Key(null, name));
+ }
+
+ public String toString()
+ {
+ return attachments.toString();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.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/BasicRequest.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicRequest.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicRequest.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,57 @@
+/*
+ * 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.jboss.osgi.husky.Request;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class BasicRequest implements Request
+{
+ private static final long serialVersionUID = 1L;
+
+ private String testClass;
+ private String testMethod;
+
+ public BasicRequest(String testClass, String testMethod)
+ {
+ this.testClass = testClass;
+ this.testMethod = testMethod;
+ }
+
+ public String getTestClass()
+ {
+ return testClass;
+ }
+
+ public String getTestMethod()
+ {
+ return testMethod;
+ }
+
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicRequest.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/JUnitFailure.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitFailure.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitFailure.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,72 @@
+/*
+ * 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.jboss.osgi.husky.Failure;
+import org.junit.runner.Description;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitFailure implements Failure
+{
+ private static final long serialVersionUID = 1L;
+
+ private String className;
+ private String methodName;
+ private Throwable exception;
+ private String message;
+
+ public JUnitFailure(org.junit.runner.notification.Failure failure)
+ {
+ Description descr = failure.getDescription();
+ className = descr.getClassName();
+ methodName = descr.getMethodName();
+ message = failure.getMessage();
+ exception = failure.getException();
+ }
+
+ public String getClassName()
+ {
+ return className;
+ }
+
+ public String getMethodName()
+ {
+ return methodName;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public Throwable getException()
+ {
+ return exception;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitFailure.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/JUnitResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,63 @@
+/*
+ * 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;
+import org.junit.runner.Result;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitResponse implements Response
+{
+ 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));
+ }
+ }
+
+ public List<Failure> getFailures()
+ {
+ return Collections.unmodifiableList(failures);
+ }
+
+ public void addFailure(Failure failure)
+ {
+ failures.add(failure);
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.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/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,83 @@
+/*
+ * 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.jboss.osgi.husky.Connector;
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Invoker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.Runner;
+import org.jboss.osgi.husky.junit.JUnitRunner;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class LocalInvoker implements Invoker
+{
+ private Connector connector;
+
+ public LocalInvoker()
+ {
+ connector = new LocalConnector();
+ connector.addPackagerListener(new MatchAllJUnitPackageListener());
+ }
+
+ public Response invoke(Request req)
+ {
+ return connector.process(req);
+ }
+
+ class LocalConnector extends AbstractConnector
+ {
+ }
+
+ class MatchAllJUnitPackageListener extends AbstractPackageListener
+ {
+ public MatchAllJUnitPackageListener()
+ {
+ super(new String[] {"org.jboss.test"});
+ }
+
+ public Context getContext()
+ {
+ return new BasicContext();
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new JUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className)
+ {
+ return Utils.loadClass(className);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.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/Utils.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -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 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;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.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/junit/JUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitRunner.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitRunner.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,106 @@
+/*
+ * 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 java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.Runner;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.husky.internal.JUnitResponse;
+import org.junit.runner.Result;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.BlockJUnit4ClassRunner;
+import org.junit.runners.model.InitializationError;
+
+/**
+ * An implementation of a {@link Runner} that uses the
+ * JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitRunner implements Runner
+{
+ /**
+ * Run the tests in the given test class.
+ */
+ public Response runTests(final Context context, final Class<?> testClass)
+ {
+ BlockJUnit4ClassRunner runner;
+ try
+ {
+ runner = new BlockJUnit4ClassRunner(testClass)
+ {
+ @Override
+ protected Object createTest() throws Exception
+ {
+ Object test = super.createTest();
+ for (Field field : testClass.getFields())
+ {
+ ProvideContext anProvide = field.getAnnotation(ProvideContext.class);
+ if (anProvide != null)
+ {
+ field.set(test, context);
+ }
+ }
+ for (Method method : testClass.getDeclaredMethods())
+ {
+ ProvideContext anProvide = method.getAnnotation(ProvideContext.class);
+ if (anProvide != null)
+ {
+ method.invoke(test, context);
+ }
+ }
+ return test;
+ }
+ };
+ }
+ catch (InitializationError ex)
+ {
+ throw new IllegalStateException("Cannot initialize test case: " + testClass.getName());
+ }
+
+ Result result = new Result();
+ RunListener listener = result.createListener();
+ RunNotifier fNotifier = new RunNotifier();
+ fNotifier.addFirstListener(listener);
+ try
+ {
+ fNotifier.fireTestRunStarted(runner.getDescription());
+ runner.run(fNotifier);
+ fNotifier.fireTestRunFinished(result);
+ }
+ finally
+ {
+ fNotifier.removeListener(listener);
+ }
+
+ Response response = new JUnitResponse(result);
+ return response;
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitRunner.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/junit/package.html
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/package.html (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/package.html 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,4 @@
+<body>
+JUnit specific implementations
+</body>
+
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/package.html
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/package.html (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/package.html 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,4 @@
+<body>
+The Husky Test Harness main package see <a href="Bridge.html">Bridge</a> for details.
+</body>
+
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<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">
+
+ <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>
+ </properties>
+
+ <!-- DependencyManagement -->
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <!-- Build -->
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!-- SCM -->
+ <scm>
+ <connection>scm:svn:http://jbpm.dyndns.org/repos/playground/bunit
+ </connection>
+ <developerConnection>scm:svn:http://jbpm.dyndns.org/repos/playground/bunit</developerConnection>
+ </scm>
+
+ <!-- Licenses -->
+ <licenses>
+ <license>
+ <name>lgpl</name>
+ <url>http://repository.jboss.com/licenses/lgpl.txt
+ </url>
+ </license>
+ </licenses>
+
+ <!-- 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>
+ -->
+ <site>
+ <id>jbpm.dyndns.org</id>
+ <url>scp://jbpm.dyndns.org/var/www/html/husky
+ </url>
+ </site>
+ </distributionManagement>
+
+ <!-- Reporting -->
+ <reporting>
+ <plugins>
+ <plugin>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <show>public</show>
+ <excludePackageNames>*.internal:*.incubator:*.test</excludePackageNames>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <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"/>
+</classpath>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.project
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.project (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.project 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>jboss-osgi-husky-testsuite</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.maven.ide.eclipse.maven2Builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.maven.ide.eclipse.maven2Nature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.eclipse.jdt.core.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,5 @@
+#Fri May 15 01:05:35 CEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.source=1.5
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.settings/org.maven.ide.eclipse.prefs 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,9 @@
+#Fri May 15 01:05:34 CEST 2009
+activeProfiles=
+eclipse.preferences.version=1
+fullBuildGoals=process-test-resources
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+skipCompilerPlugin=true
+version=1
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!-- ====================================================================== -->
+ <!-- -->
+ <!-- JBoss, JUnit testing for OSGi bundles -->
+ <!-- -->
+ <!-- Distributable under LGPL license. -->
+ <!-- See terms of license at http://www.gnu.org. -->
+ <!-- -->
+ <!-- ====================================================================== -->
+
+ <!-- $Id$ -->
+
+<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">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <name>JBossOSGi - Husky Testsuite</name>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-testsuite</artifactId>
+ <packaging>jar</packaging>
+
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+
+ <!-- Plugins -->
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <redirectTestOutputToFile>false</redirectTestOutputToFile>
+ <failIfNoTests>false</failIfNoTests>
+ <systemProperties>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.LocalInvoker</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceBase.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceBase.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceBase.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,23 @@
+package org.jboss.test.husky.simple;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public abstract class InheritanceBase
+{
+ protected String value;
+
+ @Before
+ public void setUp()
+ {
+ value = "foo";
+ }
+
+ @Test
+ public void testSuperClass()
+ {
+ assertEquals("foo", value);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceBase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceTest.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceTest.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceTest.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,14 @@
+package org.jboss.test.husky.simple;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+public class InheritanceTest extends InheritanceBase
+{
+ @Test
+ public void testSubClass()
+ {
+ assertEquals("foo", value);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/InheritanceTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/SimpleTest.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/SimpleTest.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/SimpleTest.java 2009-05-16 23:14:43 UTC (rev 88983)
@@ -0,0 +1,26 @@
+package org.jboss.test.husky.simple;
+
+import static org.junit.Assert.assertNotNull;
+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.junit.Test;
+
+public class SimpleTest
+{
+ @ProvideContext
+ public Context context;
+
+ @Test
+ public void testContextInjection()
+ {
+ if(context == null)
+ BridgeFactory.getBridge().run();
+
+ assumeNotNull(context);
+
+ assertNotNull("TestContext available", context);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/simple/SimpleTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
More information about the jboss-osgi-commits
mailing list