JBoss-OSGI SVN: r89051 - in projects/jboss-osgi/trunk: bundle/blueprint and 19 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-19 10:29:27 -0400 (Tue, 19 May 2009)
New Revision: 89051
Added:
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/AutoExportModes.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/InitialContextFactory.java
Removed:
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TautoExportModes.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tinterfaces.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tservice.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TservicePropertyEntry.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ParserTestCase.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/NamingService.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Targument.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tcollection.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tkey.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TmapEntry.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tproperty.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceProperties.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceReference.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
projects/jboss-osgi/trunk/bundle/blueprint/src/main/resources/schema/blueprint-jbxb.xsd
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-beans.xml
projects/jboss-osgi/trunk/bundle/jmx/pom.xml
projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/ServiceActivator.java
projects/jboss-osgi/trunk/bundle/jndi/.classpath
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
projects/jboss-osgi/trunk/spi/pom.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd
projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
Log:
Initial integration with Husky
Modified: projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -25,6 +25,11 @@
<version>${version}</version>
</dependency>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+
<!-- Provided Dependencies -->
<dependency>
<groupId>org.osgi</groupId>
@@ -36,19 +41,94 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
-
+
<!-- Bundle Dependencies -->
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jbossxb-bundle</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!-- Build -->
<build>
<plugins>
<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<quiet>true</quiet>
@@ -62,6 +142,15 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- Exclude tests that require remote access -->
+ <exclude>**/junit4osgi/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
</plugins>
</build>
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/AutoExportModes.java (from rev 88856, projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TautoExportModes.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/AutoExportModes.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/AutoExportModes.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -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.blueprint.reflect;
+
+// $Id$
+
+/**
+ * Java class for TautoExportModes.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public enum AutoExportModes
+{
+
+ DISABLED("disabled"),
+ INTERFACES("interfaces"),
+ CLASS_HIERARCHY("class-hierarchy"),
+ ALL_CLASSES("all-classes");
+
+ private final String value;
+
+ AutoExportModes(String v)
+ {
+ value = v;
+ }
+
+ public String value()
+ {
+ return value;
+ }
+
+ public static AutoExportModes fromValue(String v)
+ {
+ for (AutoExportModes c : AutoExportModes.values())
+ {
+ if (c.value.equals(v))
+ {
+ return c;
+ }
+ }
+ throw new IllegalArgumentException(v);
+ }
+
+}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/BeanMetadataImpl.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -282,6 +282,10 @@
{
return otherAttributes;
}
+
+
+ // **********************************************************************
+
public List getArguments()
{
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java (from rev 88857, projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tservice.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -0,0 +1,354 @@
+/*
+ * 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.blueprint.reflect;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.xml.namespace.QName;
+
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
+import org.w3c.dom.Element;
+
+/**
+ * Tservice is the type for services exported by this blueprint bundle. Services are sourced by either a <ref> to a <bean> component or an <inline> bean component.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class ServiceMetadataImpl extends ComponentMetadataImpl implements ServiceMetadata
+{
+ protected String description;
+ protected List<String> interfaces;
+ protected List<ServicePropertyEntry> serviceProperties;
+ protected List<TregistrationListener> registrationListener;
+ protected BeanMetadataImpl bean;
+ protected Tref refFIXME;
+ protected List<Object> any;
+ protected String _interface;
+ protected String ref;
+ protected String dependsOn;
+ protected AutoExportModes autoExport;
+ protected int ranking;
+ private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+
+ /**
+ * Gets the value of the description property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getDescription()
+ {
+ return description;
+ }
+
+ /**
+ * Sets the value of the description property.
+ *
+ * @param value allowed object is {@link String }
+ *
+ */
+ public void setDescription(String value)
+ {
+ this.description = value;
+ }
+
+ /**
+ * Gets the value of the interfaces property.
+ */
+ public List<String> getInterfaceNames()
+ {
+ if (interfaces == null)
+ interfaces = new ArrayList<String>();
+
+ return interfaces;
+ }
+
+ /**
+ * Gets the value of the serviceProperties property.
+ */
+ public List<ServicePropertyEntry> getServiceProperties()
+ {
+ if (serviceProperties == null)
+ serviceProperties = new ArrayList<ServicePropertyEntry>();
+
+ return serviceProperties;
+ }
+
+ /**
+ * Gets the value of the registrationListener property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the
+ * JAXB object. This is why there is not a <CODE>set</CODE> method for the registrationListener property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getRegistrationListener().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link TregistrationListener }
+ *
+ *
+ */
+ public List<TregistrationListener> getRegistrationListener()
+ {
+ if (registrationListener == null)
+ {
+ registrationListener = new ArrayList<TregistrationListener>();
+ }
+ return this.registrationListener;
+ }
+
+ /**
+ * Gets the value of the bean property.
+ *
+ * @return possible object is {@link BeanMetadataImpl }
+ *
+ */
+ public BeanMetadataImpl getBean()
+ {
+ return bean;
+ }
+
+ /**
+ * Sets the value of the bean property.
+ *
+ * @param value allowed object is {@link BeanMetadataImpl }
+ *
+ */
+ public void setBean(BeanMetadataImpl value)
+ {
+ this.bean = value;
+ }
+
+ /**
+ * Gets the value of the refFIXME property.
+ *
+ * @return possible object is {@link Tref }
+ *
+ */
+ public Tref getRefFIXME()
+ {
+ return refFIXME;
+ }
+
+ /**
+ * Sets the value of the refFIXME property.
+ *
+ * @param value allowed object is {@link Tref }
+ *
+ */
+ public void setRefFIXME(Tref value)
+ {
+ this.refFIXME = value;
+ }
+
+ /**
+ * Gets the value of the any property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the
+ * JAXB object. This is why there is not a <CODE>set</CODE> method for the any property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ *
+ * <pre>
+ * getAny().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list {@link Object } {@link Element }
+ *
+ *
+ */
+ public List<Object> getAny()
+ {
+ if (any == null)
+ {
+ any = new ArrayList<Object>();
+ }
+ return this.any;
+ }
+
+ /**
+ * Gets the value of the interface property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getInterface()
+ {
+ return _interface;
+ }
+
+ /**
+ * Sets the value of the interface property.
+ *
+ * @param value allowed object is {@link String }
+ *
+ */
+ public void setInterface(String value)
+ {
+ this._interface = value;
+ }
+
+ /**
+ * Gets the value of the ref property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getRef()
+ {
+ return ref;
+ }
+
+ /**
+ * Sets the value of the ref property.
+ *
+ * @param value allowed object is {@link String }
+ *
+ */
+ public void setRef(String value)
+ {
+ this.ref = value;
+ }
+
+ /**
+ * Gets the value of the dependsOn property.
+ *
+ * @return possible object is {@link String }
+ *
+ */
+ public String getDependsOn()
+ {
+ return dependsOn;
+ }
+
+ /**
+ * Sets the value of the dependsOn property.
+ *
+ * @param value allowed object is {@link String }
+ *
+ */
+ public void setDependsOn(String value)
+ {
+ this.dependsOn = value;
+ }
+
+ /**
+ * Gets the value of the autoExport property.
+ *
+ * @return possible object is {@link AutoExportModes }
+ *
+ */
+ public AutoExportModes getAutoExport()
+ {
+ if (autoExport == null)
+ {
+ return AutoExportModes.DISABLED;
+ }
+ else
+ {
+ return autoExport;
+ }
+ }
+
+ /**
+ * Sets the value of the autoExport property.
+ *
+ * @param value allowed object is {@link AutoExportModes }
+ *
+ */
+ public void setAutoExport(AutoExportModes value)
+ {
+ this.autoExport = value;
+ }
+
+ /**
+ * Gets the value of the ranking property.
+ */
+ public int getRanking()
+ {
+ return ranking;
+ }
+
+ /**
+ * Sets the value of the ranking property.
+ */
+ public void setRanking(int value)
+ {
+ this.ranking = value;
+ }
+
+ /**
+ * Gets a map that contains attributes that aren't bound to any typed property on this class.
+ *
+ * <p>
+ * the map is keyed by the name of the attribute and the value is the string value of the attribute.
+ *
+ * the map returned by this method is live, and you can add new attribute by updating the map directly. Because of this design, there's no setter.
+ *
+ *
+ * @return always non-null
+ */
+ public Map<QName, String> getOtherAttributes()
+ {
+ return otherAttributes;
+ }
+
+ // **********************************************************************
+
+ public int getAutoExportMode()
+ {
+ throw new NotImplementedException();
+ }
+
+ public List getExplicitDependencies()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Collection getRegistrationListeners()
+ {
+ throw new NotImplementedException();
+ }
+
+ public Target getServiceComponent()
+ {
+ throw new NotImplementedException();
+ }
+}
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java (from rev 88857, projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TservicePropertyEntry.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/ServicePropertyEntry.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -0,0 +1,40 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-793
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2009.05.13 at 02:16:52 PM CEST
+//
+
+package org.jboss.osgi.blueprint.reflect;
+
+/**
+ * TservicePropertyEntry is an entry value used for the <service-properties> element. This does not allow a child <key> element and there are no key-ref or value-ref
+ * attributes.
+ *
+ */
+public class ServicePropertyEntry
+{
+ protected String key;
+ protected String value;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey(String key)
+ {
+ this.key = key;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue(String value)
+ {
+ this.value = value;
+ }
+
+}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Targument.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Targument.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Targument.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -59,7 +59,7 @@
public class Targument {
protected String description;
- protected Tservice service;
+ protected ServiceMetadataImpl service;
protected TrefCollection refList;
protected TrefCollection refSet;
protected BeanMetadataImpl bean;
@@ -108,10 +108,10 @@
*
* @return
* possible object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public Tservice getService() {
+ public ServiceMetadataImpl getService() {
return service;
}
@@ -120,10 +120,10 @@
*
* @param value
* allowed object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public void setService(Tservice value) {
+ public void setService(ServiceMetadataImpl value) {
this.service = value;
}
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TautoExportModes.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TautoExportModes.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TautoExportModes.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,54 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-793
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.05.13 at 02:16:52 PM CEST
-//
-
-
-package org.jboss.osgi.blueprint.reflect;
-
-
-/**
- * <p>Java class for TautoExportModes.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- * <p>
- * <pre>
- * <simpleType name="TautoExportModes">
- * <restriction base="{http://www.w3.org/2001/XMLSchema}token">
- * <enumeration value="disabled"/>
- * <enumeration value="interfaces"/>
- * <enumeration value="class-hierarchy"/>
- * <enumeration value="all-classes"/>
- * </restriction>
- * </simpleType>
- * </pre>
- *
- */
-public enum TautoExportModes {
-
- DISABLED("disabled"),
- INTERFACES("interfaces"),
- CLASS_HIERARCHY("class-hierarchy"),
- ALL_CLASSES("all-classes");
- private final String value;
-
- TautoExportModes(String v) {
- value = v;
- }
-
- public String value() {
- return value;
- }
-
- public static TautoExportModes fromValue(String v) {
- for (TautoExportModes c: TautoExportModes.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tcollection.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tcollection.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tcollection.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -60,7 +60,7 @@
* <p>
* Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link Tvalue }{@code >}
- * {@link JAXBElement }{@code <}{@link Tservice }{@code >}
+ * {@link JAXBElement }{@code <}{@link ServiceMetadataImpl }{@code >}
* {@link JAXBElement }{@code <}{@link Tref }{@code >}
* {@link JAXBElement }{@code <}{@link Treference }{@code >}
* {@link JAXBElement }{@code <}{@link Tref }{@code >}
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tinterfaces.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tinterfaces.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tinterfaces.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,74 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-793
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.05.13 at 02:16:52 PM CEST
-//
-
-
-package org.jboss.osgi.blueprint.reflect;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-/**
- *
- *
- * The type definition for the <interfaces> element used for <service>,
- * <reference>, <ref-set>, and <ref-list>;
- *
- *
- *
- * <p>Java class for Tinterfaces complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="Tinterfaces">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <choice maxOccurs="unbounded">
- * <element name="value" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TinterfaceValue"/>
- * </choice>
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-public class Tinterfaces {
-
- protected List<String> value;
-
- /**
- * Gets the value of the value property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the value property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getValue().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link String }
- *
- *
- */
- public List<String> getValue() {
- if (value == null) {
- value = new ArrayList<String>();
- }
- return this.value;
- }
-
-}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tkey.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tkey.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tkey.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -39,7 +39,7 @@
*/
public class Tkey {
- protected Tservice service;
+ protected ServiceMetadataImpl service;
protected TrefCollection refList;
protected TrefCollection refSet;
protected BeanMetadataImpl bean;
@@ -59,10 +59,10 @@
*
* @return
* possible object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public Tservice getService() {
+ public ServiceMetadataImpl getService() {
return service;
}
@@ -71,10 +71,10 @@
*
* @param value
* allowed object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public void setService(Tservice value) {
+ public void setService(ServiceMetadataImpl value) {
this.service = value;
}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TmapEntry.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TmapEntry.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TmapEntry.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -50,7 +50,7 @@
public class TmapEntry {
protected Tkey keyFIXME;
- protected Tservice service;
+ protected ServiceMetadataImpl service;
protected TrefCollection refList;
protected TrefCollection refSet;
protected BeanMetadataImpl bean;
@@ -99,10 +99,10 @@
*
* @return
* possible object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public Tservice getService() {
+ public ServiceMetadataImpl getService() {
return service;
}
@@ -111,10 +111,10 @@
*
* @param value
* allowed object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public void setService(Tservice value) {
+ public void setService(ServiceMetadataImpl value) {
this.service = value;
}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tproperty.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tproperty.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tproperty.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -51,7 +51,7 @@
public class Tproperty {
protected String description;
- protected Tservice service;
+ protected ServiceMetadataImpl service;
protected TrefCollection refList;
protected TrefCollection refSet;
protected BeanMetadataImpl bean;
@@ -99,10 +99,10 @@
*
* @return
* possible object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public Tservice getService() {
+ public ServiceMetadataImpl getService() {
return service;
}
@@ -111,10 +111,10 @@
*
* @param value
* allowed object is
- * {@link Tservice }
+ * {@link ServiceMetadataImpl }
*
*/
- public void setService(Tservice value) {
+ public void setService(ServiceMetadataImpl value) {
this.service = value;
}
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tservice.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tservice.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/Tservice.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,396 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-793
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.05.13 at 02:16:52 PM CEST
-//
-
-
-package org.jboss.osgi.blueprint.reflect;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import javax.xml.namespace.QName;
-import org.w3c.dom.Element;
-
-
-/**
- *
- *
- * Tservice is the type for services exported by this blueprint bundle.
- * Services are sourced by either a <ref> to a <bean> component or an
- * <inline> bean component.
- *
- *
- *
- * <p>Java class for Tservice complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="Tservice">
- * <complexContent>
- * <extension base="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tcomponent">
- * <sequence>
- * <group ref="{http://www.osgi.org/xmlns/blueprint/v1.0.0}serviceElements"/>
- * <any processContents='lax' namespace='##other' maxOccurs="unbounded" minOccurs="0"/>
- * </sequence>
- * <attribute name="interface" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tclass" />
- * <attribute name="ref" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}Tidref" />
- * <attribute name="depends-on" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TdependsOn" />
- * <attribute name="auto-export" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TautoExportModes" default="disabled" />
- * <attribute name="ranking" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
- * <anyAttribute processContents='lax' namespace='##other'/>
- * </extension>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-public class Tservice
- extends ComponentMetadataImpl
-{
-
- protected String description;
- protected Tinterfaces interfaces;
- protected TserviceProperties serviceProperties;
- protected List<TregistrationListener> registrationListener;
- protected BeanMetadataImpl bean;
- protected Tref refFIXME;
- protected List<Object> any;
- protected String _interface;
- protected String ref;
- protected String dependsOn;
- protected TautoExportModes autoExport;
- protected Integer ranking;
- private Map<QName, String> otherAttributes = new HashMap<QName, String>();
-
- /**
- * Gets the value of the description property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the value of the description property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDescription(String value) {
- this.description = value;
- }
-
- /**
- * Gets the value of the interfaces property.
- *
- * @return
- * possible object is
- * {@link Tinterfaces }
- *
- */
- public Tinterfaces getInterfaces() {
- return interfaces;
- }
-
- /**
- * Sets the value of the interfaces property.
- *
- * @param value
- * allowed object is
- * {@link Tinterfaces }
- *
- */
- public void setInterfaces(Tinterfaces value) {
- this.interfaces = value;
- }
-
- /**
- * Gets the value of the serviceProperties property.
- *
- * @return
- * possible object is
- * {@link TserviceProperties }
- *
- */
- public TserviceProperties getServiceProperties() {
- return serviceProperties;
- }
-
- /**
- * Sets the value of the serviceProperties property.
- *
- * @param value
- * allowed object is
- * {@link TserviceProperties }
- *
- */
- public void setServiceProperties(TserviceProperties value) {
- this.serviceProperties = value;
- }
-
- /**
- * Gets the value of the registrationListener property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the registrationListener property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getRegistrationListener().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link TregistrationListener }
- *
- *
- */
- public List<TregistrationListener> getRegistrationListener() {
- if (registrationListener == null) {
- registrationListener = new ArrayList<TregistrationListener>();
- }
- return this.registrationListener;
- }
-
- /**
- * Gets the value of the bean property.
- *
- * @return
- * possible object is
- * {@link BeanMetadataImpl }
- *
- */
- public BeanMetadataImpl getBean() {
- return bean;
- }
-
- /**
- * Sets the value of the bean property.
- *
- * @param value
- * allowed object is
- * {@link BeanMetadataImpl }
- *
- */
- public void setBean(BeanMetadataImpl value) {
- this.bean = value;
- }
-
- /**
- * Gets the value of the refFIXME property.
- *
- * @return
- * possible object is
- * {@link Tref }
- *
- */
- public Tref getRefFIXME() {
- return refFIXME;
- }
-
- /**
- * Sets the value of the refFIXME property.
- *
- * @param value
- * allowed object is
- * {@link Tref }
- *
- */
- public void setRefFIXME(Tref value) {
- this.refFIXME = value;
- }
-
- /**
- * Gets the value of the any property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the any property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getAny().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Object }
- * {@link Element }
- *
- *
- */
- public List<Object> getAny() {
- if (any == null) {
- any = new ArrayList<Object>();
- }
- return this.any;
- }
-
- /**
- * Gets the value of the interface property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getInterface() {
- return _interface;
- }
-
- /**
- * Sets the value of the interface property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setInterface(String value) {
- this._interface = value;
- }
-
- /**
- * Gets the value of the ref property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getRef() {
- return ref;
- }
-
- /**
- * Sets the value of the ref property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setRef(String value) {
- this.ref = value;
- }
-
- /**
- * Gets the value of the dependsOn property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getDependsOn() {
- return dependsOn;
- }
-
- /**
- * Sets the value of the dependsOn property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setDependsOn(String value) {
- this.dependsOn = value;
- }
-
- /**
- * Gets the value of the autoExport property.
- *
- * @return
- * possible object is
- * {@link TautoExportModes }
- *
- */
- public TautoExportModes getAutoExport() {
- if (autoExport == null) {
- return TautoExportModes.DISABLED;
- } else {
- return autoExport;
- }
- }
-
- /**
- * Sets the value of the autoExport property.
- *
- * @param value
- * allowed object is
- * {@link TautoExportModes }
- *
- */
- public void setAutoExport(TautoExportModes value) {
- this.autoExport = value;
- }
-
- /**
- * Gets the value of the ranking property.
- *
- * @return
- * possible object is
- * {@link Integer }
- *
- */
- public int getRanking() {
- if (ranking == null) {
- return 0;
- } else {
- return ranking;
- }
- }
-
- /**
- * Sets the value of the ranking property.
- *
- * @param value
- * allowed object is
- * {@link Integer }
- *
- */
- public void setRanking(Integer value) {
- this.ranking = value;
- }
-
- /**
- * Gets a map that contains attributes that aren't bound to any typed property on this class.
- *
- * <p>
- * the map is keyed by the name of the attribute and
- * the value is the string value of the attribute.
- *
- * the map returned by this method is live, and you can add new attribute
- * by updating the map directly. Because of this design, there's no setter.
- *
- *
- * @return
- * always non-null
- */
- public Map<QName, String> getOtherAttributes() {
- return otherAttributes;
- }
-
-}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceProperties.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceProperties.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceProperties.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -41,7 +41,7 @@
*/
public class TserviceProperties {
- protected List<TservicePropertyEntry> entry;
+ protected List<ServicePropertyEntry> entry;
/**
* Gets the value of the entry property.
@@ -61,13 +61,13 @@
*
* <p>
* Objects of the following type(s) are allowed in the list
- * {@link TservicePropertyEntry }
+ * {@link ServicePropertyEntry }
*
*
*/
- public List<TservicePropertyEntry> getEntry() {
+ public List<ServicePropertyEntry> getEntry() {
if (entry == null) {
- entry = new ArrayList<TservicePropertyEntry>();
+ entry = new ArrayList<ServicePropertyEntry>();
}
return this.entry;
}
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TservicePropertyEntry.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TservicePropertyEntry.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TservicePropertyEntry.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,476 +0,0 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-793
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
-// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2009.05.13 at 02:16:52 PM CEST
-//
-
-
-package org.jboss.osgi.blueprint.reflect;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- *
- *
- * TservicePropertyEntry is an entry value used for the <service-properties>
- * element. This does not allow a child <key> element and there are no
- * key-ref or value-ref attributes.
- *
- *
- *
- * <p>Java class for TservicePropertyEntry complex type.
- *
- * <p>The following schema fragment specifies the expected content contained within this class.
- *
- * <pre>
- * <complexType name="TservicePropertyEntry">
- * <complexContent>
- * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- * <sequence>
- * <group ref="{http://www.osgi.org/xmlns/blueprint/v1.0.0}value"/>
- * </sequence>
- * <attribute name="key" use="required" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TstringValue" />
- * <attribute name="valueFIXME" type="{http://www.osgi.org/xmlns/blueprint/v1.0.0}TstringValue" />
- * </restriction>
- * </complexContent>
- * </complexType>
- * </pre>
- *
- *
- */
-public class TservicePropertyEntry {
-
- protected Tservice service;
- protected TrefCollection refList;
- protected TrefCollection refSet;
- protected BeanMetadataImpl bean;
- protected Treference reference;
- protected Tref refFIXME;
- protected List<Object> any;
- protected Tref idref;
- protected Tvalue value;
- protected Tcollection list;
- protected Tcollection set;
- protected Tmap map;
- protected Tcollection array;
- protected Tprops props;
- protected Tnull _null;
- protected String key;
- protected String valueFIXME;
-
- /**
- * Gets the value of the service property.
- *
- * @return
- * possible object is
- * {@link Tservice }
- *
- */
- public Tservice getService() {
- return service;
- }
-
- /**
- * Sets the value of the service property.
- *
- * @param value
- * allowed object is
- * {@link Tservice }
- *
- */
- public void setService(Tservice value) {
- this.service = value;
- }
-
- /**
- * Gets the value of the refList property.
- *
- * @return
- * possible object is
- * {@link TrefCollection }
- *
- */
- public TrefCollection getRefList() {
- return refList;
- }
-
- /**
- * Sets the value of the refList property.
- *
- * @param value
- * allowed object is
- * {@link TrefCollection }
- *
- */
- public void setRefList(TrefCollection value) {
- this.refList = value;
- }
-
- /**
- * Gets the value of the refSet property.
- *
- * @return
- * possible object is
- * {@link TrefCollection }
- *
- */
- public TrefCollection getRefSet() {
- return refSet;
- }
-
- /**
- * Sets the value of the refSet property.
- *
- * @param value
- * allowed object is
- * {@link TrefCollection }
- *
- */
- public void setRefSet(TrefCollection value) {
- this.refSet = value;
- }
-
- /**
- * Gets the value of the bean property.
- *
- * @return
- * possible object is
- * {@link BeanMetadataImpl }
- *
- */
- public BeanMetadataImpl getBean() {
- return bean;
- }
-
- /**
- * Sets the value of the bean property.
- *
- * @param value
- * allowed object is
- * {@link BeanMetadataImpl }
- *
- */
- public void setBean(BeanMetadataImpl value) {
- this.bean = value;
- }
-
- /**
- * Gets the value of the reference property.
- *
- * @return
- * possible object is
- * {@link Treference }
- *
- */
- public Treference getReference() {
- return reference;
- }
-
- /**
- * Sets the value of the reference property.
- *
- * @param value
- * allowed object is
- * {@link Treference }
- *
- */
- public void setReference(Treference value) {
- this.reference = value;
- }
-
- /**
- * Gets the value of the refFIXME property.
- *
- * @return
- * possible object is
- * {@link Tref }
- *
- */
- public Tref getRefFIXME() {
- return refFIXME;
- }
-
- /**
- * Sets the value of the refFIXME property.
- *
- * @param value
- * allowed object is
- * {@link Tref }
- *
- */
- public void setRefFIXME(Tref value) {
- this.refFIXME = value;
- }
-
- /**
- * Gets the value of the any property.
- *
- * <p>
- * This accessor method returns a reference to the live list,
- * not a snapshot. Therefore any modification you make to the
- * returned list will be present inside the JAXB object.
- * This is why there is not a <CODE>set</CODE> method for the any property.
- *
- * <p>
- * For example, to add a new item, do as follows:
- * <pre>
- * getAny().add(newItem);
- * </pre>
- *
- *
- * <p>
- * Objects of the following type(s) are allowed in the list
- * {@link Object }
- *
- *
- */
- public List<Object> getAny() {
- if (any == null) {
- any = new ArrayList<Object>();
- }
- return this.any;
- }
-
- /**
- * Gets the value of the idref property.
- *
- * @return
- * possible object is
- * {@link Tref }
- *
- */
- public Tref getIdref() {
- return idref;
- }
-
- /**
- * Sets the value of the idref property.
- *
- * @param value
- * allowed object is
- * {@link Tref }
- *
- */
- public void setIdref(Tref value) {
- this.idref = value;
- }
-
- /**
- * Gets the value of the value property.
- *
- * @return
- * possible object is
- * {@link Tvalue }
- *
- */
- public Tvalue getValue() {
- return value;
- }
-
- /**
- * Sets the value of the value property.
- *
- * @param value
- * allowed object is
- * {@link Tvalue }
- *
- */
- public void setValue(Tvalue value) {
- this.value = value;
- }
-
- /**
- * Gets the value of the list property.
- *
- * @return
- * possible object is
- * {@link Tcollection }
- *
- */
- public Tcollection getList() {
- return list;
- }
-
- /**
- * Sets the value of the list property.
- *
- * @param value
- * allowed object is
- * {@link Tcollection }
- *
- */
- public void setList(Tcollection value) {
- this.list = value;
- }
-
- /**
- * Gets the value of the set property.
- *
- * @return
- * possible object is
- * {@link Tcollection }
- *
- */
- public Tcollection getSet() {
- return set;
- }
-
- /**
- * Sets the value of the set property.
- *
- * @param value
- * allowed object is
- * {@link Tcollection }
- *
- */
- public void setSet(Tcollection value) {
- this.set = value;
- }
-
- /**
- * Gets the value of the map property.
- *
- * @return
- * possible object is
- * {@link Tmap }
- *
- */
- public Tmap getMap() {
- return map;
- }
-
- /**
- * Sets the value of the map property.
- *
- * @param value
- * allowed object is
- * {@link Tmap }
- *
- */
- public void setMap(Tmap value) {
- this.map = value;
- }
-
- /**
- * Gets the value of the array property.
- *
- * @return
- * possible object is
- * {@link Tcollection }
- *
- */
- public Tcollection getArray() {
- return array;
- }
-
- /**
- * Sets the value of the array property.
- *
- * @param value
- * allowed object is
- * {@link Tcollection }
- *
- */
- public void setArray(Tcollection value) {
- this.array = value;
- }
-
- /**
- * Gets the value of the props property.
- *
- * @return
- * possible object is
- * {@link Tprops }
- *
- */
- public Tprops getProps() {
- return props;
- }
-
- /**
- * Sets the value of the props property.
- *
- * @param value
- * allowed object is
- * {@link Tprops }
- *
- */
- public void setProps(Tprops value) {
- this.props = value;
- }
-
- /**
- * Gets the value of the null property.
- *
- * @return
- * possible object is
- * {@link Tnull }
- *
- */
- public Tnull getNull() {
- return _null;
- }
-
- /**
- * Sets the value of the null property.
- *
- * @param value
- * allowed object is
- * {@link Tnull }
- *
- */
- public void setNull(Tnull value) {
- this._null = value;
- }
-
- /**
- * Gets the value of the key property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Sets the value of the key property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setKey(String value) {
- this.key = value;
- }
-
- /**
- * Gets the value of the valueFIXME property.
- *
- * @return
- * possible object is
- * {@link String }
- *
- */
- public String getValueFIXME() {
- return valueFIXME;
- }
-
- /**
- * Sets the value of the valueFIXME property.
- *
- * @param value
- * allowed object is
- * {@link String }
- *
- */
- public void setValueFIXME(String value) {
- this.valueFIXME = value;
- }
-
-}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceReference.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceReference.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/jboss/osgi/blueprint/reflect/TserviceReference.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -56,7 +56,7 @@
{
protected String description;
- protected Tinterfaces interfaces;
+ protected List<String> interfaces;
protected List<TReferenceListener> listener;
protected List<Object> any;
protected String _interface;
@@ -90,26 +90,16 @@
/**
* Gets the value of the interfaces property.
*
- * @return possible object is {@link Tinterfaces }
- *
*/
- public Tinterfaces getInterfaces()
+ public List<String> getInterfaceNames()
{
+ if (interfaces == null)
+ interfaces = new ArrayList<String>();
+
return interfaces;
}
/**
- * Sets the value of the interfaces property.
- *
- * @param value allowed object is {@link Tinterfaces }
- *
- */
- public void setInterfaces(Tinterfaces value)
- {
- this.interfaces = value;
- }
-
- /**
* Gets the value of the listener property.
*
* <p>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/java/org/osgi/service/blueprint/reflect/ServiceMetadata.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -66,7 +66,7 @@
*
* @return an immutable set of (String) type names, or an empty set if using auto-export
*/
- List/*<String>*/ getInterfaceNames();
+ List<String> getInterfaceNames();
/**
* Return the auto-export mode specified.
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/main/resources/schema/blueprint-jbxb.xsd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/main/resources/schema/blueprint-jbxb.xsd 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/main/resources/schema/blueprint-jbxb.xsd 2009-05-19 14:29:27 UTC (rev 89051)
@@ -226,9 +226,27 @@
</xsd:documentation>
</xsd:annotation>
<xsd:choice>
- <xsd:element name="service" type="Tservice" />
- <xsd:element name="ref-list" type="Tref-collection" />
- <xsd:element name="ref-set" type="Tref-collection" />
+ <xsd:element name="service" type="Tservice" >
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="components"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="ref-list" type="Tref-collection" >
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="components"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
+ <xsd:element name="ref-set" type="Tref-collection" >
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="components"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
<xsd:group ref="targetComponent" />
</xsd:choice>
</xsd:group>
@@ -635,6 +653,9 @@
<xsd:complexType name="Tservice">
<xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.osgi.blueprint.reflect.ServiceMetadataImpl"></jbxb:class>
+ </xsd:appinfo>
<xsd:documentation>
<![CDATA[
Tservice is the type for services exported by this blueprint bundle.
@@ -650,7 +671,13 @@
<xsd:any namespace="##other" minOccurs="0" maxOccurs="unbounded"
processContents="lax" />
</xsd:sequence>
- <xsd:attribute name="interface" type="Tclass" use="optional" />
+ <xsd:attribute name="interface" type="Tclass" use="optional" >
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="interfaceNames"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:attribute>
<xsd:attribute name="ref" type="Tidref" use="optional" />
<xsd:attribute name="depends-on" type="TdependsOn" use="optional">
<xsd:annotation>
@@ -1027,7 +1054,13 @@
</xsd:documentation>
</xsd:annotation>
<xsd:choice minOccurs="1" maxOccurs="unbounded">
- <xsd:element name="value" type="TinterfaceValue" />
+ <xsd:element name="value" type="TinterfaceValue" >
+ <xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:property name="interfaceNames"/>
+ </xsd:appinfo>
+ </xsd:annotation>
+ </xsd:element>
</xsd:choice>
</xsd:complexType>
@@ -1111,6 +1144,9 @@
<xsd:simpleType name="TautoExportModes">
<xsd:annotation>
+ <xsd:appinfo>
+ <jbxb:class impl="org.jboss.osgi.blueprint.reflect.AutoExportModes"></jbxb:class>
+ </xsd:appinfo>
<xsd:documentation>
<![CDATA[
TautoExportModes is a base type that should be used for export-mode
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java (from rev 88857, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ParserTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/BasicRootParserTestCase.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -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.test.osgi.blueprint.parser;
+
+//$Id$
+
+import java.math.BigInteger;
+import java.net.URL;
+
+import org.jboss.osgi.blueprint.parser.BlueprintParser;
+import org.jboss.osgi.blueprint.reflect.Availability;
+import org.jboss.osgi.blueprint.reflect.Blueprint;
+import org.jboss.osgi.spi.testing.OSGiTest;
+
+/**
+ * Blueprint parser tests
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class BasicRootParserTestCase extends OSGiTest
+{
+ public void testBlueprintDefaultAttributes() throws Exception
+ {
+ URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
+ Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+
+ // assert default attributes
+ assertEquals(Availability.MANDATORY, blueprint.getDefaultAvailability());
+ assertEquals(new BigInteger("300000"), blueprint.getDefaultTimeout());
+ assertEquals(Boolean.FALSE, blueprint.isDefaultLazyInit());
+ assertNull(blueprint.getDefaultInitMethod());
+ assertNull(blueprint.getDefaultDestroyMethod());
+ }
+
+ public void testBlueprintDescription() throws Exception
+ {
+ URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
+ Blueprint blueprint = new BlueprintParser().parse(xmlURL);
+
+ // assert description
+ assertEquals("some text", blueprint.getDescription());
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ParserTestCase.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/parser/ParserTestCase.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint.parser;
-
-//$Id$
-
-import java.math.BigInteger;
-import java.net.URL;
-import java.util.List;
-
-import org.jboss.osgi.blueprint.parser.BlueprintParser;
-import org.jboss.osgi.blueprint.reflect.Availability;
-import org.jboss.osgi.blueprint.reflect.Blueprint;
-import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.osgi.service.blueprint.reflect.BeanMetadata;
-
-/**
- * Blueprint parser tests
- *
- * @author thomas.diesler(a)jboss.com
- * @since 13-May-2009
- */
-public class ParserTestCase extends OSGiTest
-{
- public void _testBlueprintDefaultAttributes() throws Exception
- {
- URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- Blueprint blueprint = new BlueprintParser().parse(xmlURL);
-
- // assert default attributes
- assertEquals(Availability.MANDATORY, blueprint.getDefaultAvailability());
- assertEquals(new BigInteger("300000"), blueprint.getDefaultTimeout());
- assertEquals(Boolean.FALSE, blueprint.isDefaultLazyInit());
- assertNull(blueprint.getDefaultInitMethod());
- assertNull(blueprint.getDefaultDestroyMethod());
- }
-
- public void _testBlueprintDescription() throws Exception
- {
- URL xmlURL = getResourceURL("parser/blueprint-basic-root.xml");
- Blueprint blueprint = new BlueprintParser().parse(xmlURL);
-
- // assert description
- assertEquals("some text", blueprint.getDescription());
- }
-
- public void testBasicBeans() throws Exception
- {
- URL xmlURL = getResourceURL("parser/blueprint-basic-beans.xml");
- Blueprint blueprint = new BlueprintParser().parse(xmlURL);
-
- List<ComponentMetadataImpl> compList = blueprint.getComponents();
- assertTrue(compList.size() > 0);
-
- BeanMetadata beanA = (BeanMetadata)compList.get(0);
- assertEquals(BeanA.class.getName(), beanA.getClassName());
- assertEquals("A", beanA.getId());
-
- BeanMetadata beanB = (BeanMetadata)compList.get(1);
- assertEquals(BeanB.class.getName(), beanB.getClassName());
- assertEquals("B", beanB.getId());
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/log4j.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -38,10 +38,11 @@
</category>
-->
- <!-- Show jboss deployer traces -->
+ <!-- Show jboss deployer traces
<category name="org.jboss.xb">
<priority value="TRACE" />
</category>
+ -->
<!-- ======================= -->
<!-- Setup the Root category -->
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-beans.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/parser/blueprint-basic-beans.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,11 +1,11 @@
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd schema/blueprint.xsd">
- <bean id="A" class="org.jboss.test.osgi.blueprint.parser.BeanA">
+ <bean id="beanA" class="org.jboss.test.osgi.blueprint.parser.BeanA">
</bean>
- <bean id="B" class="org.jboss.test.osgi.blueprint.parser.BeanB">
- <property name="beanA" ref="A"/>
+ <bean id="beanB" class="org.jboss.test.osgi.blueprint.parser.BeanB">
+ <property name="beanA" ref="beanA"/>
</bean>
</blueprint>
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/jmx/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/pom.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jmx/pom.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -61,16 +61,24 @@
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
<Bundle-Activator>org.jboss.osgi.jmx.internal.ServiceActivator</Bundle-Activator>
<Import-Package>
+
+ <!-- system -->
javax.management*,
javax.naming,
- javax.naming.spi,
- org.jboss.net.sockets,
- org.jboss.osgi.common.log,
- org.jboss.osgi.jndi,
- org.jnp.interfaces,
+ javax.naming.spi,
+
+ <!-- jboss-osgi -->
+ org.jboss.osgi.common.log,
+
+ <!-- osgi -->
org.osgi.framework;version=1.4,
org.osgi.service.log,
org.osgi.util.tracker,
+
+ <!-- optional -->
+ org.jboss.osgi.jndi;resolution:=optional,
+ org.jboss.net.sockets;resolution:=optional,
+ org.jnp.interfaces;resolution:=optional,
</Import-Package>
</instructions>
</configuration>
Modified: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/ServiceActivator.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/ServiceActivator.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -32,7 +32,6 @@
import javax.naming.StringRefAddr;
import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.jndi.NamingService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -103,14 +102,14 @@
public NamingServiceTracker(BundleContext context, String rmiAdaptorPath)
{
- super(context, NamingService.class.getName(), null);
+ super(context, InitialContext.class.getName(), null);
this.rmiAdaptorPath = rmiAdaptorPath;
}
@Override
public Object addingService(ServiceReference reference)
{
- NamingService naming = (NamingService)super.addingService(reference);
+ InitialContext iniCtx = (InitialContext)super.addingService(reference);
// Start JMXConnectorService
if (jmxConnector == null)
@@ -122,7 +121,6 @@
// Bind the RMIAdaptor
try
{
- InitialContext iniCtx = naming.getInitialContext();
iniCtx.createSubcontext("jmx").createSubcontext("invoker");
StringRefAddr addr = new StringRefAddr(JMXServiceURL.class.getName(), jmxConnector.getServiceURL().toString());
Reference ref = new Reference(MBeanServerConnection.class.getName(), addr, RMIAdaptorFactory.class.getName(), null);
@@ -135,13 +133,13 @@
log.log(LogService.LOG_ERROR, "Cannot bind RMIAdoaptor", ex);
}
- return naming;
+ return iniCtx;
}
@Override
public void removedService(ServiceReference reference, Object service)
{
- NamingService naming = (NamingService)service;
+ InitialContext iniCtx = (InitialContext)service;
// Stop JMXConnectorService
stopJMXConnectorService();
@@ -149,7 +147,6 @@
// Unbind the RMIAdaptor
try
{
- InitialContext iniCtx = naming.getInitialContext();
iniCtx.unbind(rmiAdaptorPath);
log.log(LogService.LOG_INFO, "MBeanServerConnection unbound from: " + rmiAdaptorPath);
Modified: projects/jboss-osgi/trunk/bundle/jndi/.classpath
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/.classpath 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jndi/.classpath 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Deleted: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/NamingService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/NamingService.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/NamingService.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jndi;
-
-//$Id$
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-/**
- * A service that gives access to JNDI
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public interface NamingService
-{
- /**
- * Get the InitialContext
- * @throws NamingException if a naming exception is encountered
- */
- InitialContext getInitialContext() throws NamingException;
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/InitialContextFactory.java (from rev 88709, projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/InitialContextFactory.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/InitialContextFactory.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -0,0 +1,82 @@
+/*
+ * 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.jndi.internal;
+
+//$Id$
+
+import java.util.Hashtable;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.naming.NamingContextFactory;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A {@link ServiceFactory} for the {@link NamingService}
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class InitialContextFactory implements ServiceFactory
+{
+ private String jndiHost, jndiPort;
+
+ public InitialContextFactory(String jndiHost, String jndiPort)
+ {
+ this.jndiHost = jndiHost;
+ this.jndiPort = jndiPort;
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getService(Bundle bundle, ServiceRegistration registration)
+ {
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", NamingContextFactory.class.getName());
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
+
+ InitialContext iniCtx = new InitialContext(env);
+ return iniCtx;
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot get the InitialContext", ex);
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ {
+ // nothing to do
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceFactory.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jndi.internal;
-
-//$Id$
-
-import java.util.Hashtable;
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.naming.NamingContextFactory;
-import org.jboss.osgi.jndi.NamingService;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A {@link ServiceFactory} for the {@link NamingService}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class NamingServiceFactory implements ServiceFactory
-{
- private String jndiHost, jndiPort;
-
- public NamingServiceFactory(String jndiHost, String jndiPort)
- {
- this.jndiHost = jndiHost;
- this.jndiPort = jndiPort;
- }
-
- @SuppressWarnings("unchecked")
- public Object getService(Bundle bundle, ServiceRegistration registration)
- {
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- Hashtable env = new Hashtable();
- env.put("java.naming.factory.initial", NamingContextFactory.class.getName());
- env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
-
- InitialContext iniCtx = new InitialContext(env);
- return new NamingServiceImpl(iniCtx);
- }
- catch (NamingException ex)
- {
- throw new IllegalStateException("Cannot get the InitialContext", ex);
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
- {
- // nothing to do
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jndi.internal;
-
-//$Id$
-
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.osgi.jndi.NamingService;
-
-/**
- * An implementation of the {@link NamingService}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class NamingServiceImpl implements NamingService
-{
- private InitialContext initialContext;
-
- public NamingServiceImpl(InitialContext initialContext)
- {
- this.initialContext = initialContext;
- }
-
- public InitialContext getInitialContext() throws NamingException
- {
- return initialContext;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -23,8 +23,9 @@
//$Id$
+import javax.naming.InitialContext;
+
import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.jndi.NamingService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogService;
@@ -63,8 +64,8 @@
jnpServer = new JNPServer(context, jndiHost, Integer.parseInt(jndiPort), Integer.parseInt(jndiRmiPort));
jnpServer.start();
- context.registerService(NamingService.class.getName(), new NamingServiceFactory(jndiHost, jndiPort), null);
- log.log(LogService.LOG_DEBUG, "NamingService registered");
+ context.registerService(InitialContext.class.getName(), new InitialContextFactory(jndiHost, jndiPort), null);
+ log.log(LogService.LOG_DEBUG, "InitialContext registered");
}
public void stop(BundleContext context)
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -58,13 +58,13 @@
<version.jboss.jacc>1.1.0.GA</version.jboss.jacc>
<version.jboss.jdocbook.plugin>2.1.2</version.jboss.jdocbook.plugin>
<version.jboss.jdocbook.style>1.1.0</version.jboss.jdocbook.style>
- <version.jboss.logging.spi>2.0.5.GA</version.jboss.logging.spi>
- <version.jboss.logging.log4j>2.0.5.GA</version.jboss.logging.log4j>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
<version.jboss.metadata>1.0.0.CR11</version.jboss.metadata>
<version.jboss.microcontainer>2.0.4.GA</version.jboss.microcontainer>
+ <version.jboss.osgi.husky>1.0.0-SNAPSHOT</version.jboss.osgi.husky>
<version.jboss.test>1.0.5.GA</version.jboss.test>
<version.jbossxb.bundle>2.0.0-SNAPSHOT</version.jbossxb.bundle>
- <version.junit>4.4</version.junit>
+ <version.junit>4.6</version.junit>
<version.knopflerfish>2.2.0</version.knopflerfish>
<version.log4j>1.2.14</version.log4j>
<version.osgi>r4v41</version.osgi>
@@ -152,12 +152,12 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-spi</artifactId>
- <version>${version.jboss.logging.spi}</version>
+ <version>${version.jboss.logging}</version>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging-log4j</artifactId>
- <version>${version.jboss.logging.log4j}</version>
+ <version>${version.jboss.logging}</version>
</dependency>
<dependency>
<groupId>org.jboss.metadata</groupId>
@@ -179,6 +179,11 @@
<artifactId>jnpserver</artifactId>
<version>${version.jbossas}</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-husky-harness</artifactId>
+ <version>${version.jboss.osgi.husky}</version>
+ </dependency>
<!-- Bundle Dependencies -->
<dependency>
@@ -341,6 +346,10 @@
<name>org.apache.xerces.xni.parser.XMLParserConfiguration</name>
<value>org.apache.xerces.parsers.XIncludeAwareParserConfiguration</value>
</property>
+ <property>
+ <name>org.jboss.osgi.husky.Invoker</name>
+ <value>org.jboss.osgi.husky.internal.LocalInvoker</value>
+ </property>
<!--
Implement URLStreamHandlerService
https://jira.jboss.org/jira/browse/JBOSGI-75
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -163,7 +163,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot install bundle: " + bundleURL, ex);
}
}
@@ -179,7 +180,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot install bundle: " + bundleURL, ex);
}
}
}
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -156,7 +156,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot install bundle: " + bundleURL, ex);
}
}
@@ -175,7 +176,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot start bundle: " + bundleURL, ex);
}
}
}
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/framework/KnopflerfishIntegration.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -213,7 +213,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot install bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot install bundle: " + bundleURL, ex);
}
}
@@ -229,7 +230,8 @@
}
catch (BundleException ex)
{
- log.error("Cannot start bundle: " + bundleURL, ex);
+ stop();
+ throw new IllegalStateException("Cannot start bundle: " + bundleURL, ex);
}
}
}
Modified: projects/jboss-osgi/trunk/spi/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/spi/pom.xml 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/spi/pom.xml 2009-05-19 14:29:27 UTC (rev 89051)
@@ -17,7 +17,23 @@
<!-- Dependencies -->
<dependencies>
+
+ <!-- Compile Dependencies -->
<dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-spi</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.deployers</groupId>
+ <artifactId>jboss-deployers-vfs</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -30,19 +46,13 @@
<dependency>
<groupId>org.jboss.deployers</groupId>
<artifactId>jboss-deployers-client-spi</artifactId>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-vfs</artifactId>
- </dependency>
- <dependency>
<groupId>org.jboss.microcontainer</groupId>
<artifactId>jboss-kernel</artifactId>
+ <scope>provided</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
</dependencies>
<build>
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -37,7 +37,7 @@
import java.util.Set;
import org.jboss.osgi.spi.NotImplementedException;
-import org.jboss.util.StringPropertyReplacer;
+import org.jboss.osgi.spi.internal.StringPropertyReplacer;
/**
* A simple properties based bootstrap provider
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -26,7 +26,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.jboss.osgi.jndi.NamingService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
@@ -41,10 +40,9 @@
{
public void start(BundleContext context)
{
- NamingService service = getNamingService(context);
try
{
- InitialContext iniCtx = service.getInitialContext();
+ InitialContext iniCtx = getInitialContext(context);
iniCtx.createSubcontext("test").bind("Foo", new String("Bar"));
}
catch (NamingException ex)
@@ -55,10 +53,9 @@
public void stop(BundleContext context)
{
- NamingService service = getNamingService(context);
try
{
- InitialContext iniCtx = service.getInitialContext();
+ InitialContext iniCtx = getInitialContext(context);
iniCtx.unbind("test");
}
catch (NamingException ex)
@@ -67,13 +64,13 @@
}
}
- private NamingService getNamingService(BundleContext context)
+ private InitialContext getInitialContext(BundleContext context)
{
- ServiceReference sref = context.getServiceReference(NamingService.class.getName());
+ ServiceReference sref = context.getServiceReference(InitialContext.class.getName());
if (sref == null)
- throw new IllegalStateException("NamingService not available");
+ throw new IllegalStateException("Cannot access the InitialContext");
- NamingService service = (NamingService)context.getService(sref);
- return service;
+ InitialContext initContext = (InitialContext)context.getService(sref);
+ return initContext;
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd 2009-05-19 14:29:27 UTC (rev 89051)
@@ -3,4 +3,4 @@
Bundle-SymbolicName: example-jndi
Bundle-Activator: org.jboss.test.osgi.example.jndi.bundle.ServiceActivator
Export-Package: org.jboss.test.osgi.example.jndi.bundle
-Import-Package: javax.naming, org.osgi.framework, org.jboss.osgi.jndi
\ No newline at end of file
+Import-Package: javax.naming, org.osgi.framework
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java 2009-05-19 14:16:57 UTC (rev 89050)
+++ projects/jboss-osgi/trunk/testsuite/trailblazer/src/test/java/org/jboss/test/osgi/trailblazer/shop/sports/ClimbingStore.java 2009-05-19 14:29:27 UTC (rev 89051)
@@ -32,7 +32,6 @@
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
-import org.jboss.osgi.jndi.NamingService;
import org.jboss.test.osgi.trailblazer.PaymentService;
import org.jboss.test.osgi.trailblazer.Product;
import org.jboss.test.osgi.trailblazer.Shop;
@@ -54,10 +53,9 @@
{
this.context = context;
- NamingService namingService = getNamingService(context);
try
{
- Context ctx = namingService.getInitialContext();
+ Context ctx = getInitialContext(context);
ctx = ctx.createSubcontext("shop");
ctx = ctx.createSubcontext("climbing");
ctx = ctx.createSubcontext("products");
@@ -99,8 +97,7 @@
Collection<Product> products = new ArrayList<Product>();
try
{
- NamingService namingService = getNamingService(context);
- InitialContext iniCtx = namingService.getInitialContext();
+ InitialContext iniCtx = getInitialContext(context);
NamingEnumeration<NameClassPair> list = iniCtx.list("shop/climbing/products");
while (list.hasMoreElements())
@@ -126,8 +123,7 @@
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- NamingService namingService = getNamingService(context);
- InitialContext iniCtx = namingService.getInitialContext();
+ InitialContext iniCtx = getInitialContext(context);
product = (Product)iniCtx.lookup("shop/climbing/products/" + name);
product.setShop(this);
}
@@ -147,13 +143,13 @@
ctx.bind(p.getName(), p);
}
- private NamingService getNamingService(BundleContext context)
+ private InitialContext getInitialContext(BundleContext context)
{
- ServiceReference sref = context.getServiceReference(NamingService.class.getName());
+ ServiceReference sref = context.getServiceReference(InitialContext.class.getName());
if (sref == null)
- throw new IllegalStateException("Cannot access the NamingService");
+ throw new IllegalStateException("Cannot access the InitialContext");
- NamingService namingService = (NamingService)context.getService(sref);
- return namingService;
+ InitialContext initContext = (InitialContext)context.getService(sref);
+ return initContext;
}
}
17 years, 2 months
JBoss-OSGI SVN: r89049 - projects/jboss-osgi/projects/husky/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-19 10:08:07 -0400 (Tue, 19 May 2009)
New Revision: 89049
Modified:
projects/jboss-osgi/projects/husky/trunk/pom.xml
Log:
Add parent to point to jboss-osgi
Modified: projects/jboss-osgi/projects/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-19 14:05:44 UTC (rev 89048)
+++ projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-19 14:08:07 UTC (rev 89049)
@@ -25,6 +25,13 @@
<version>1.0.0-SNAPSHOT</version>
+ <!-- Parent -->
+ <parent>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi</artifactId>
+ <version>1.0.0.Beta2</version>
+ </parent>
+
<!-- Properties -->
<properties>
<version.aqute.bnd>0.0.323</version.aqute.bnd>
17 years, 2 months
JBoss-OSGI SVN: r89047 - in projects/jboss-osgi/projects/husky/trunk/harness: src/main/java/org/jboss/osgi/husky/internal and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-19 10:05:01 -0400 (Tue, 19 May 2009)
New Revision: 89047
Added:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitPackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitRunner.java
Removed:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
Modified:
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.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/runtime/Runner.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
Log:
Add propper OSGi support
Modified: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-19 14:05:01 UTC (rev 89047)
@@ -66,7 +66,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.husky.internal.Activator</Bundle-Activator>
+ <Bundle-Activator>org.jboss.osgi.husky.runtime.osgi.Activator</Bundle-Activator>
<Private-Package>
org.jboss.osgi.husky.internal,
org.jboss.osgi.husky.runtime*,
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 17-May-2009
- */
-public class Activator implements BundleActivator
-{
- private JMXConnector connector;
-
- public void start(BundleContext context) throws Exception
- {
- connector = new JMXConnector(context);
- connector.start();
-
- context.addBundleListener(new Extender(context));
- }
-
- public void stop(BundleContext context) throws Exception
- {
- if (connector != null)
- {
- connector.stop();
- connector = null;
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -71,7 +71,7 @@
className = System.getProperty(Invoker.class.getName());
if (className == null)
- throw new IllegalStateException("Cannot load invoker: " + className);
+ throw new IllegalStateException("Cannot obtain value for invoker property: " + Invoker.class.getName());
invoker = (Invoker)Util.loadInstance(className, props);
}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import javax.management.MBeanServer;
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.husky.runtime.PackageListener;
-import org.jboss.osgi.husky.runtime.junit.JUnitPackageListener;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleEvent;
-import org.osgi.framework.BundleListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 17-May-2009
- */
-public class Extender implements BundleListener
-{
- private BundleContext context;
- private LogService log;
-
- public Extender(BundleContext context)
- {
- this.log = new LogServiceTracker(context);
- this.context = context;
- }
-
- public void bundleChanged(BundleEvent event)
- {
- if (event.getType() == BundleEvent.STARTED)
- {
- Bundle bundle = event.getBundle();
- String testPackage = (String)bundle.getHeaders().get("Test-Package");
- if (testPackage != null)
- {
- log.log(LogService.LOG_INFO, "Test-Package: " + testPackage + " in bundle: " + bundle);
- registerPackageListener(bundle, testPackage.split("[, ]"));
- }
- }
- }
-
- private void registerPackageListener(Bundle bundle, String[] testPackages)
- {
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref == null)
- {
- log.log(LogService.LOG_WARNING, "Cannot obtain MBeanServer service");
- return;
- }
-
- JUnitPackageListener listener = new JUnitPackageListener(bundle, testPackages);
- MBeanServer server = (MBeanServer)context.getService(sref);
- if (server.isRegistered(JMXConnector.OBJECT_NAME) == false)
- {
- log.log(LogService.LOG_WARNING, "Cannot obtain connector: " + JMXConnector.OBJECT_NAME);
- return;
- }
-
- try
- {
- server.invoke(JMXConnector.OBJECT_NAME, "addPackageListener", new Object[] { listener }, new String[] { PackageListener.class.getName() });
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot register package listener", ex);
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -1,125 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.log.LogService;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 17-May-2009
- */
-public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
-{
- public static ObjectName OBJECT_NAME;
- static
- {
- try
- {
- OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
- }
- catch (MalformedObjectNameException e)
- {
- // should never get here
- }
- }
-
- private LogService log;
- private BundleContext context;
-
- public JMXConnector(BundleContext context)
- {
- this.log = new LogServiceTracker(context);
- this.context = context;
- }
-
- public void start() throws Exception
- {
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref == null)
- throw new IllegalStateException("Cannot obtain MBeanServer service");
-
- MBeanServer server = (MBeanServer)context.getService(sref);
- server.registerMBean(this, OBJECT_NAME);
- log.log(LogService.LOG_INFO, "JMXConnector registered: " + OBJECT_NAME);
- }
-
- public void stop() throws Exception
- {
- ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
- if (sref != null)
- {
- MBeanServer server = (MBeanServer)context.getService(sref);
- if (server.isRegistered(OBJECT_NAME));
- server.unregisterMBean(OBJECT_NAME);
- }
- }
-
- public InputStream process(InputStream reqStream)
- {
- try
- {
- // Unmarshall the Request
- ObjectInputStream ois = new ObjectInputStream(reqStream);
- Request request = (Request)ois.readObject();
-
- // Field the request through the abstract connector
- Response response = process(request);
- if (response == null)
- throw new IllegalStateException("response cannot be null");
-
- // Marshall the Response
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- ObjectOutputStream oos = new ObjectOutputStream(baos);
- oos.writeObject(response);
- oos.close();
-
- return new ByteArrayInputStream(baos.toByteArray());
- }
- catch (RuntimeException rte)
- {
- throw rte;
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot process request", ex);
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-//$Id$
-
-import java.io.InputStream;
-
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
-import org.jboss.osgi.husky.runtime.PackageListener;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 17-May-2009
- */
-public interface JMXConnectorMBean
-{
- /**
- * Consumes the serialized version of an {@link Request} and
- * return the the {@link Response} from the test run
- *
- * @param reqStream the input stream to read the {@link Request} from
- * @return the input stream to read the {@link Response} from
- */
- InputStream process(InputStream reqStream);
-
- /**
- * Add a {@link PackageListener} to this connector
- */
- void addPackageListener(PackageListener listener);
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -42,6 +42,7 @@
import org.jboss.osgi.husky.runtime.Connector;
import org.jboss.osgi.husky.runtime.Runner;
import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
+import org.jboss.osgi.husky.runtime.osgi.JMXConnector;
/**
* [TODO]
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -53,4 +53,9 @@
* Note, some test frameworks may choose to use an instance per test method.
*/
Response runTests(Context context, Class<?> testClass);
+
+ /**
+ * Inject the {@link Context} inte the test case instance
+ */
+ void injectContext(Object test, Context context) throws Exception;
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -26,33 +26,26 @@
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.internal.AbstractPackageListener;
import org.jboss.osgi.husky.internal.BasicContext;
+import org.jboss.osgi.husky.internal.Util;
import org.jboss.osgi.husky.runtime.Runner;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
- * An implementation of a {@link Runner} that uses the
- * JUnit4 Test Runner.
+ * An implementation of a {@link Runner} that uses the JUnit4 Test Runner.
*
* @author Thomas.Diesler(a)jboss.com
* @since 16-May-2009
*/
public class JUnitPackageListener extends AbstractPackageListener
{
- private Bundle bundle;
-
- public JUnitPackageListener(Bundle bundle, String[] testPackages)
+ public JUnitPackageListener(String[] testPackages)
{
super(testPackages);
- this.bundle = bundle;
}
@Override
public Context getContext()
{
BasicContext context = new BasicContext();
- context.addAttachment(Bundle.class, bundle);
- context.addAttachment(BundleContext.class, bundle.getBundleContext());
return context;
}
@@ -65,6 +58,6 @@
@Override
public Class<?> loadTestClass(String className) throws ClassNotFoundException
{
- return bundle.loadClass(className);
+ return Util.loadClass(className);
}
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-05-19 14:03:15 UTC (rev 89046)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -59,22 +59,7 @@
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);
- }
- }
+ injectContext(test, context);
return test;
}
};
@@ -102,4 +87,25 @@
Response response = new JUnitResponse(result);
return response;
}
+
+ public void injectContext(Object test, Context context) throws Exception
+ {
+ Class<? extends Object> testClass = test.getClass();
+ 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);
+ }
+ }
+ }
}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java (from rev 89040, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Activator.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime.osgi;
+
+// $Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class Activator implements BundleActivator
+{
+ private JMXConnector connector;
+
+ public void start(BundleContext context) throws Exception
+ {
+ connector = new JMXConnector(context);
+ connector.start();
+
+ context.addBundleListener(new Extender(context));
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ connector = null;
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java (from rev 89041, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/Extender.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime.osgi;
+
+// $Id$
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.runtime.PackageListener;
+import org.jboss.osgi.husky.runtime.junit.JUnitPackageListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class Extender implements BundleListener
+{
+ private BundleContext context;
+ private LogService log;
+
+ public Extender(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ if (event.getType() == BundleEvent.STARTED)
+ {
+ Bundle bundle = event.getBundle();
+ String testPackage = (String)bundle.getHeaders().get("Test-Package");
+ if (testPackage != null)
+ {
+ log.log(LogService.LOG_INFO, "Test-Package: " + testPackage + " in bundle: " + bundle);
+ registerPackageListener(bundle, testPackage.split("[, ]"));
+ }
+ }
+ }
+
+ private void registerPackageListener(Bundle bundle, String[] testPackages)
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain MBeanServer service");
+ return;
+ }
+
+ JUnitPackageListener listener = new OSGiJUnitPackageListener(bundle, testPackages);
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(JMXConnector.OBJECT_NAME) == false)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain connector: " + JMXConnector.OBJECT_NAME);
+ return;
+ }
+
+ try
+ {
+ server.invoke(JMXConnector.OBJECT_NAME, "addPackageListener", new Object[] { listener }, new String[] { PackageListener.class.getName() });
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register package listener", ex);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java (from rev 89040, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnector.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,126 @@
+/*
+ * 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.runtime.osgi;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.internal.AbstractConnector;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
+{
+ public static ObjectName OBJECT_NAME;
+ static
+ {
+ try
+ {
+ OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
+ }
+ catch (MalformedObjectNameException e)
+ {
+ // should never get here
+ }
+ }
+
+ private LogService log;
+ private BundleContext context;
+
+ public JMXConnector(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void start() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain MBeanServer service");
+
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ server.registerMBean(this, OBJECT_NAME);
+ log.log(LogService.LOG_INFO, "JMXConnector registered: " + OBJECT_NAME);
+ }
+
+ public void stop() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref != null)
+ {
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(OBJECT_NAME));
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
+
+ public InputStream process(InputStream reqStream)
+ {
+ try
+ {
+ // Unmarshall the Request
+ ObjectInputStream ois = new ObjectInputStream(reqStream);
+ Request request = (Request)ois.readObject();
+
+ // Field the request through the abstract connector
+ Response response = process(request);
+ if (response == null)
+ throw new IllegalStateException("response cannot be null");
+
+ // Marshall the Response
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(response);
+ oos.close();
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot process request", ex);
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java (from rev 89041, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/JMXConnectorMBean.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime.osgi;
+
+//$Id$
+
+import java.io.InputStream;
+
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.PackageListener;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public interface JMXConnectorMBean
+{
+ /**
+ * Consumes the serialized version of an {@link Request} and
+ * return the the {@link Response} from the test run
+ *
+ * @param reqStream the input stream to read the {@link Request} from
+ * @return the input stream to read the {@link Response} from
+ */
+ InputStream process(InputStream reqStream);
+
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitPackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitPackageListener.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime.osgi;
+
+// $Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.internal.BasicContext;
+import org.jboss.osgi.husky.runtime.Runner;
+import org.jboss.osgi.husky.runtime.junit.JUnitPackageListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of a {@link Runner} that uses the
+ * JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class OSGiJUnitPackageListener extends JUnitPackageListener
+{
+ private Bundle bundle;
+
+ public OSGiJUnitPackageListener(Bundle bundle, String[] testPackages)
+ {
+ super(testPackages);
+ this.bundle = bundle;
+ }
+
+ @Override
+ public Context getContext()
+ {
+ BasicContext context = new BasicContext();
+ context.addAttachment(Bundle.class, bundle);
+ context.addAttachment(BundleContext.class, bundle.getBundleContext());
+ return context;
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new OSGiJUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ return bundle.loadClass(className);
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitPackageListener.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/runtime/osgi/OSGiJUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitRunner.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitRunner.java 2009-05-19 14:05:01 UTC (rev 89047)
@@ -0,0 +1,79 @@
+/*
+ * 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.runtime.osgi;
+
+// $Id$
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.husky.runtime.Runner;
+import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of a {@link Runner} that uses the JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class OSGiJUnitRunner extends JUnitRunner
+{
+ public void injectContext(Object test, Context context) throws Exception
+ {
+ BundleContext bundleContext = context.getAttachment(BundleContext.class);
+ Class<? extends Object> testClass = test.getClass();
+
+ for (Field field : testClass.getFields())
+ {
+ ProvideContext anProvide = field.getAnnotation(ProvideContext.class);
+ if (anProvide != null)
+ {
+ if (field.getType().isAssignableFrom(BundleContext.class))
+ {
+ field.set(test, bundleContext);
+ }
+ else
+ {
+ field.set(test, context);
+ }
+ }
+ }
+ for (Method method : testClass.getDeclaredMethods())
+ {
+ ProvideContext anProvide = method.getAnnotation(ProvideContext.class);
+ if (anProvide != null)
+ {
+ if (method.getParameterTypes()[0].isAssignableFrom(BundleContext.class))
+ {
+ method.invoke(test, bundleContext);
+ }
+ else
+ {
+ method.invoke(test, context);
+ }
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/osgi/OSGiJUnitRunner.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 2 months
JBoss-OSGI SVN: r89041 - in projects/jboss-osgi/projects/husky/trunk/harness: src/main/java/org/jboss/osgi/husky and 4 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-19 08:28:25 -0400 (Tue, 19 May 2009)
New Revision: 89041
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/BridgeFactory.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/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/internal/BasicBridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Connector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/PackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitFailure.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitResponse.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/package.html
Removed:
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/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/junit/
Modified:
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
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/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/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
Log:
API restructure
Modified: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-19 12:28:25 UTC (rev 89041)
@@ -69,7 +69,7 @@
<Bundle-Activator>org.jboss.osgi.husky.internal.Activator</Bundle-Activator>
<Private-Package>
org.jboss.osgi.husky.internal,
- org.jboss.osgi.husky.junit
+ org.jboss.osgi.husky.runtime*,
</Private-Package>
<Export-Package>
org.jboss.osgi.husky;version=${version},
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.husky.internal.AbstractBridge;
-import org.jboss.osgi.husky.internal.Util;
-
-/**
- * A basic {@link Bridge} implementation that can be associated
- * with an arbitrary {@link Invoker}.
- *
- * @author Thomas.Diesler(a)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)Util.loadInstance(className, props);
- }
- return invoker;
- }
-
- /**
- * Set the associated invoker
- */
- public void setInvoker(Invoker invoker)
- {
- this.invoker = invoker;
- }
-}
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,105 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $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(a)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);
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java (from rev 88983, 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-19 12:28:25 UTC (rev 89041)
@@ -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;
+
+
+// $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(a)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);
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,65 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.husky.internal.Util;
-
-/**
- * Loads the configured test {@link Bridge} instance.
- *
- * @author Thomas.Diesler(a)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)Util.loadInstance(className, props);
- }
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java (from rev 89009, 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-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,66 @@
+/*
+ * 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.BasicBridge;
+import org.jboss.osgi.husky.internal.Util;
+
+/**
+ * Loads the configured test {@link Bridge} instance.
+ *
+ * @author Thomas.Diesler(a)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)Util.loadInstance(className, props);
+ }
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $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(a)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) throws ClassNotFoundException;
-
- /**
- * Add a {@link PackageListener} to this connector
- */
- void addPackageListener(PackageListener listener);
-
- /**
- * Remove a {@link PackageListener} from this connector
- */
- void removePackageListener(PackageListener listener);
-}
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,160 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-import java.util.Collection;
-
-/**
- * The Context is a bucket of typed/named attachemnts.
- *
- * @author Thomas.Diesler(a)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
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java (from rev 88983, 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-19 12:28:25 UTC (rev 89041)
@@ -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(a)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
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-import java.io.Serializable;
-
-/**
- * An abstraction of a test failure that is associated with a test {@link Response}.
- *
- * @author Thomas.Diesler(a)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
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Failure.java (from rev 88983, 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-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,59 @@
+/*
+ * 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(a)jboss.com
+ * @since 16-May-2009
+ */
+public interface Failure extends Serializable
+{
+ /**
+ * Get the name of the test class that failed
+ */
+ String getClassName();
+
+ /**
+ * Get the name of the test method that failed
+ */
+ String getMethodName();
+
+ /**
+ * Get the test failure message
+ */
+ String getMessage();
+
+ /**
+ * Get the exceoption that caused the failure.
+ * In case of a failure due to an assertion, this will be
+ * RuntimeException or Error thrown by the test framework.
+ */
+ Throwable getException();
+}
\ No newline at end of file
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,39 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-/**
- * An Invoker is the sending side of a test request.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public interface Invoker
-{
- /**
- * Invokes the associated {@link Connector} with a given test
- * {@link Request}
- */
- Response invoke(Request req);
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Invoker.java (from rev 88983, 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-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,41 @@
+/*
+ * 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;
+
+import org.jboss.osgi.husky.runtime.Connector;
+
+// $Id$
+
+/**
+ * An Invoker is the sending side of a test request.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public interface Invoker
+{
+ /**
+ * Invokes the associated {@link Connector} with a given test
+ * {@link Request}
+ */
+ Response invoke(Request req);
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,50 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $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(a)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) throws ClassNotFoundException;
-
-}
\ No newline at end of file
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Request.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,45 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-//$Id$
-
-import java.io.Serializable;
-
-/**
- * An abstraction of a test request.
- *
- * @author Thomas.Diesler(a)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();
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Request.java (from rev 88983, 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-19 12:28:25 UTC (rev 89041)
@@ -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(a)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();
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-// $Id$
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * An abstraction of a test response.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public interface Response extends Serializable
-{
- /**
- * Get the list of test failures
- * @return an empty list if the test was successful
- */
- List<Failure> getFailures();
-
- /**
- * Add a list of failures to the response
- */
- void addAllFailures(List<Failure> failures);
-
- /**
- * Add a failure to the response
- */
- void addFailure(Failure failure);
-}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java (from rev 89009, 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-19 12:28:25 UTC (rev 89041)
@@ -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 java.io.Serializable;
+import java.util.List;
+
+
+
+/**
+ * An abstraction of a test response.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public interface Response extends Serializable
+{
+ /**
+ * Get the list of test failures
+ * @return an empty list if the test was successful
+ */
+ List<Failure> getFailures();
+
+ /**
+ * Add a list of failures to the response
+ */
+ void addAllFailures(List<Failure> failures);
+
+ /**
+ * Add a failure to the response
+ */
+ void addFailure(Failure failure);
+}
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Runner.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky;
-
-//$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(a)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);
-}
Modified: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -29,7 +29,7 @@
import java.lang.annotation.Target;
import org.jboss.osgi.husky.Context;
-import org.jboss.osgi.husky.Runner;
+import org.jboss.osgi.husky.runtime.Runner;
/**
* An annotation that instructs the {@link Runner} to inject
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -26,10 +26,10 @@
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;
+import org.jboss.osgi.husky.runtime.Connector;
+import org.jboss.osgi.husky.runtime.PackageListener;
/**
* [TODO]
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -26,10 +26,10 @@
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;
+import org.jboss.osgi.husky.runtime.PackageListener;
+import org.jboss.osgi.husky.runtime.Runner;
/**
* [TODO]
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java (from rev 89009, 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/internal/BasicBridge.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -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.internal;
+
+// $Id$
+
+import java.util.Properties;
+
+import org.jboss.osgi.husky.Bridge;
+import org.jboss.osgi.husky.Invoker;
+
+/**
+ * A basic {@link Bridge} implementation that can be associated
+ * with an arbitrary {@link Invoker}.
+ *
+ * @author Thomas.Diesler(a)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)Util.loadInstance(className, props);
+ }
+ return invoker;
+ }
+
+ /**
+ * Set the associated invoker
+ */
+ public void setInvoker(Invoker invoker)
+ {
+ this.invoker = invoker;
+ }
+}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -26,8 +26,8 @@
import javax.management.MBeanServer;
import org.jboss.osgi.common.log.LogServiceTracker;
-import org.jboss.osgi.husky.PackageListener;
-import org.jboss.osgi.husky.junit.JUnitPackageListener;
+import org.jboss.osgi.husky.runtime.PackageListener;
+import org.jboss.osgi.husky.runtime.junit.JUnitPackageListener;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleEvent;
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -25,9 +25,9 @@
import java.io.InputStream;
-import org.jboss.osgi.husky.PackageListener;
import org.jboss.osgi.husky.Request;
import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.runtime.PackageListener;
/**
* [TODO]
Deleted: 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 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitFailure.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,72 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import org.jboss.osgi.husky.Failure;
-import org.junit.runner.Description;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)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;
- }
-}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import org.junit.runner.Result;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public class JUnitResponse extends BasicResponse
-{
- private static final long serialVersionUID = 1L;
-
- public JUnitResponse(Result result)
- {
- for (org.junit.runner.notification.Failure failure: result.getFailures())
- {
- addFailure(new JUnitFailure(failure));
- }
- }
-
-}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-19 11:48:57 UTC (rev 89040)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -35,13 +35,13 @@
import javax.management.MBeanServerFactory;
import javax.management.RuntimeMBeanException;
-import org.jboss.osgi.husky.Connector;
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Invoker;
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;
+import org.jboss.osgi.husky.runtime.Connector;
+import org.jboss.osgi.husky.runtime.Runner;
+import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
/**
* [TODO]
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Connector.java (from rev 89009, 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/runtime/Connector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Connector.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,60 @@
+/*
+ * 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.runtime;
+
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
+// $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(a)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) throws ClassNotFoundException;
+
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
+
+ /**
+ * Remove a {@link PackageListener} from this connector
+ */
+ void removePackageListener(PackageListener listener);
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/PackageListener.java (from rev 89009, 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/runtime/PackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/PackageListener.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime;
+
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
+// $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(a)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) throws ClassNotFoundException;
+
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java (from rev 88983, 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/runtime/Runner.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,56 @@
+/*
+ * 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.runtime;
+
+//$Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
+
+/**
+ * An abstraction of a test runner that executes the given
+ * test case in the isolated test environment.
+ *
+ * @author Thomas.Diesler(a)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);
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitFailure.java (from rev 88983, 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/runtime/junit/JUnitFailure.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitFailure.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -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.runtime.junit;
+
+// $Id$
+
+import org.jboss.osgi.husky.Failure;
+import org.junit.runner.Description;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)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;
+ }
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java (from rev 89009, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitPackageListener.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.runtime.junit;
+
+// $Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.internal.AbstractPackageListener;
+import org.jboss.osgi.husky.internal.BasicContext;
+import org.jboss.osgi.husky.runtime.Runner;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of a {@link Runner} that uses the
+ * JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitPackageListener extends AbstractPackageListener
+{
+ private Bundle bundle;
+
+ public JUnitPackageListener(Bundle bundle, String[] testPackages)
+ {
+ super(testPackages);
+ this.bundle = bundle;
+ }
+
+ @Override
+ public Context getContext()
+ {
+ BasicContext context = new BasicContext();
+ context.addAttachment(Bundle.class, bundle);
+ context.addAttachment(BundleContext.class, bundle.getBundleContext());
+ return context;
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new JUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ return bundle.loadClass(className);
+ }
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitResponse.java (from rev 89009, 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/runtime/junit/JUnitResponse.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitResponse.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -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.runtime.junit;
+
+// $Id$
+
+import org.jboss.osgi.husky.internal.BasicResponse;
+import org.junit.runner.Result;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitResponse extends BasicResponse
+{
+ private static final long serialVersionUID = 1L;
+
+ public JUnitResponse(Result result)
+ {
+ for (org.junit.runner.notification.Failure failure: result.getFailures())
+ {
+ addFailure(new JUnitFailure(failure));
+ }
+ }
+
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java (from rev 88983, 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/runtime/junit/JUnitRunner.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-05-19 12:28:25 UTC (rev 89041)
@@ -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.runtime.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.annotation.ProvideContext;
+import org.jboss.osgi.husky.runtime.Runner;
+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(a)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;
+ }
+}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/package.html (from rev 88983, 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/runtime/junit/package.html (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/package.html 2009-05-19 12:28:25 UTC (rev 89041)
@@ -0,0 +1,4 @@
+<body>
+JUnit specific implementations
+</body>
+
\ No newline at end of file
17 years, 2 months
JBoss-OSGI SVN: r89010 - in projects/jboss-osgi/projects/husky/trunk/testsuite: scripts and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-18 13:06:36 -0400 (Mon, 18 May 2009)
New Revision: 89010
Added:
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
Log:
Embedded bundle testing ok
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml 2009-05-18 17:06:36 UTC (rev 89010)
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id$ -->
+
+<project default="build-test-jars">
+
+ <description>OSGi test archive builder</description>
+
+ <!-- ================================================================== -->
+ <!-- Init -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+
+ <!-- Property override when not called from maven -->
+ <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+ <property name="tests.output.dir" value="${basedir}/../target" />
+
+ <mkdir dir="${tests.output.dir}/test-libs" />
+ <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+ <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties">
+ <classpath>
+ <pathelement path="${maven.runtime.classpath}" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
+
+ <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+ <!-- Please add alphabetically -->
+
+ <!-- simple-all-in-one -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/simple-all-in-one.jar" files="${tests.resources.dir}/osgi/simple/simple-all-in-one.bnd" />
+
+ <!-- Please add alphabetically -->
+
+ </target>
+
+</project>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/antrun-test-jars.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml 2009-05-18 17:06:36 UTC (rev 89010)
@@ -0,0 +1,31 @@
+<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
+
+ <id>deploy-artifacts</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <!-- Dependency Sets -->
+ <dependencySets>
+
+ <!-- bundle -->
+ <dependencySet>
+ <outputDirectory>bundles</outputDirectory>
+ <outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
+ <includes>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-logging:jar</include>
+ <include>*:jboss-osgi-husky-harness:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
+ </includes>
+ <useStrictFiltering>true</useStrictFiltering>
+ <scope>provided</scope>
+ <unpack>false</unpack>
+ </dependencySet>
+
+ </dependencySets>
+</assembly>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/scripts/assembly-bundles.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 2 months
JBoss-OSGI SVN: r89009 - in projects/jboss-osgi/projects/husky/trunk: harness and 11 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-18 13:05:41 -0400 (Mon, 18 May 2009)
New Revision: 89009
Added:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/internal/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/
projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd
Removed:
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java
Modified:
projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java
projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
projects/jboss-osgi/projects/husky/trunk/pom.xml
projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
Log:
Embedded bundle testing ok
Modified: projects/jboss-osgi/projects/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -18,7 +18,7 @@
<name>JBossOSGi - Husky Harness</name>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky-harness</artifactId>
- <packaging>jar</packaging>
+ <packaging>bundle</packaging>
<parent>
<groupId>org.jboss.osgi</groupId>
@@ -32,15 +32,58 @@
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
+
+ <!-- Budle Dependencies -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Provided Dependencies -->
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<build>
<plugins>
<plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.jboss.osgi.husky.internal.Activator</Bundle-Activator>
+ <Private-Package>
+ org.jboss.osgi.husky.internal,
+ org.jboss.osgi.husky.junit
+ </Private-Package>
+ <Export-Package>
+ org.jboss.osgi.husky;version=${version},
+ org.jboss.osgi.husky.annotation;version=${version}
+ </Export-Package>
+ <Embed-Transitive>true</Embed-Transitive>
+ <Embed-Dependency>
+ junit;inline=false,
+ </Embed-Dependency>
+ <_exportcontents>org.junit;version=${version.junit}</_exportcontents>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<quiet>true</quiet>
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BasicBridge.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -26,7 +26,7 @@
import java.util.Properties;
import org.jboss.osgi.husky.internal.AbstractBridge;
-import org.jboss.osgi.husky.internal.Utils;
+import org.jboss.osgi.husky.internal.Util;
/**
* A basic {@link Bridge} implementation that can be associated
@@ -73,7 +73,7 @@
if (className == null)
throw new IllegalStateException("Cannot load invoker: " + className);
- invoker = (Invoker)Utils.loadInstance(className, props);
+ invoker = (Invoker)Util.loadInstance(className, props);
}
return invoker;
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -25,7 +25,7 @@
import java.util.Properties;
-import org.jboss.osgi.husky.internal.Utils;
+import org.jboss.osgi.husky.internal.Util;
/**
* Loads the configured test {@link Bridge} instance.
@@ -60,6 +60,6 @@
if (className == null)
throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
- return (Bridge)Utils.loadInstance(className, props);
+ return (Bridge)Util.loadInstance(className, props);
}
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Connector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -43,9 +43,15 @@
*
* @throws RuntimeException if no {@link PackageListener} can
*/
- Response process(Request req);
+ Response process(Request req) throws ClassNotFoundException;
- void addPackagerListener(PackageListener listener);
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
- void removePackagerListener(PackageListener listener);
+ /**
+ * Remove a {@link PackageListener} from this connector
+ */
+ void removePackageListener(PackageListener listener);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/PackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -45,6 +45,6 @@
* Called by {@link Connector} when this listener indicated that it can
* handle the test request.
*/
- Response runTests(Request request);
+ Response runTests(Request request) throws ClassNotFoundException;
}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Response.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -39,4 +39,14 @@
* @return an empty list if the test was successful
*/
List<Failure> getFailures();
+
+ /**
+ * Add a list of failures to the response
+ */
+ void addAllFailures(List<Failure> failures);
+
+ /**
+ * Add a failure to the response
+ */
+ void addFailure(Failure failure);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -62,8 +62,8 @@
{
if (response == null)
{
- BasicRequest req = new BasicRequest(testClass.getName(), testMethod);
- response = getInvoker().invoke(req);
+ BasicRequest request = new BasicRequest(testClass.getName(), testMethod);
+ response = getInvoker().invoke(request);
}
List<Failure> failures = response.getFailures();
@@ -89,7 +89,7 @@
private Class<?> getCallerClass(String callerFrame)
{
String className = callerFrame.substring(0, callerFrame.lastIndexOf('.'));
- return Utils.loadClass(className);
+ return Util.loadClass(className);
}
private String getCallerMethod(String callerFrame)
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -41,23 +41,25 @@
{
private List<PackageListener> listeners = new ArrayList<PackageListener>();
- public void addPackagerListener(PackageListener listener)
+ public void addPackageListener(PackageListener listener)
{
listeners.add(listener);
}
- public void removePackagerListener(PackageListener listener)
+ public void removePackageListener(PackageListener listener)
{
listeners.remove(listener);
}
- public Response process(Request req)
+ public Response process(Request req) throws ClassNotFoundException
{
String testClass = req.getTestClass();
for (PackageListener listener : listeners)
{
if (listener.match(req))
+ {
return listener.runTests(req);
+ }
}
throw new IllegalStateException("Cannot find listener to handle: " + testClass + ", we have " + listeners);
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractPackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -61,7 +61,7 @@
return false;
}
- public Response runTests(Request request)
+ public Response runTests(Request request) throws ClassNotFoundException
{
String testClass = request.getTestClass();
return getRunner().runTests(getContext(), loadTestClass(testClass));
@@ -71,7 +71,7 @@
public abstract Context getContext();
- public abstract Class<?> loadTestClass(String className);
+ public abstract Class<?> loadTestClass(String className) throws ClassNotFoundException;
public String toString()
{
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+// $Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class Activator implements BundleActivator
+{
+ private JMXConnector connector;
+
+ public void start(BundleContext context) throws Exception
+ {
+ connector = new JMXConnector(context);
+ connector.start();
+
+ context.addBundleListener(new Extender(context));
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ if (connector != null)
+ {
+ connector.stop();
+ connector = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Activator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+// $Id$
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.osgi.husky.Failure;
+import org.jboss.osgi.husky.Response;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class BasicResponse implements Response
+{
+ private static final long serialVersionUID = 1L;
+
+ private List<Failure> failures = new ArrayList<Failure>();
+
+ public List<Failure> getFailures()
+ {
+ return Collections.unmodifiableList(failures);
+ }
+
+ public void addFailure(Failure failure)
+ {
+ failures.add(failure);
+ }
+
+ public void addAllFailures(List<Failure> fails)
+ {
+ for (Failure failure : fails)
+ {
+ failures.add(failure);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicResponse.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,95 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+// $Id$
+
+import javax.management.MBeanServer;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.PackageListener;
+import org.jboss.osgi.husky.junit.JUnitPackageListener;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleEvent;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class Extender implements BundleListener
+{
+ private BundleContext context;
+ private LogService log;
+
+ public Extender(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void bundleChanged(BundleEvent event)
+ {
+ if (event.getType() == BundleEvent.STARTED)
+ {
+ Bundle bundle = event.getBundle();
+ String testPackage = (String)bundle.getHeaders().get("Test-Package");
+ if (testPackage != null)
+ {
+ log.log(LogService.LOG_INFO, "Test-Package: " + testPackage + " in bundle: " + bundle);
+ registerPackageListener(bundle, testPackage.split("[, ]"));
+ }
+ }
+ }
+
+ private void registerPackageListener(Bundle bundle, String[] testPackages)
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain MBeanServer service");
+ return;
+ }
+
+ JUnitPackageListener listener = new JUnitPackageListener(bundle, testPackages);
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(JMXConnector.OBJECT_NAME) == false)
+ {
+ log.log(LogService.LOG_WARNING, "Cannot obtain connector: " + JMXConnector.OBJECT_NAME);
+ return;
+ }
+
+ try
+ {
+ server.invoke(JMXConnector.OBJECT_NAME, "addPackageListener", new Object[] { listener }, new String[] { PackageListener.class.getName() });
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot register package listener", ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Extender.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+import javax.management.MBeanServer;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.common.log.LogServiceTracker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogService;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class JMXConnector extends AbstractConnector implements JMXConnectorMBean
+{
+ public static ObjectName OBJECT_NAME;
+ static
+ {
+ try
+ {
+ OBJECT_NAME = ObjectName.getInstance("jboss.osgi.husky:service=jmx-connector");
+ }
+ catch (MalformedObjectNameException e)
+ {
+ // should never get here
+ }
+ }
+
+ private LogService log;
+ private BundleContext context;
+
+ public JMXConnector(BundleContext context)
+ {
+ this.log = new LogServiceTracker(context);
+ this.context = context;
+ }
+
+ public void start() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("Cannot obtain MBeanServer service");
+
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ server.registerMBean(this, OBJECT_NAME);
+ log.log(LogService.LOG_INFO, "JMXConnector registered: " + OBJECT_NAME);
+ }
+
+ public void stop() throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(MBeanServer.class.getName());
+ if (sref != null)
+ {
+ MBeanServer server = (MBeanServer)context.getService(sref);
+ if (server.isRegistered(OBJECT_NAME));
+ server.unregisterMBean(OBJECT_NAME);
+ }
+ }
+
+ public InputStream process(InputStream reqStream)
+ {
+ try
+ {
+ // Unmarshall the Request
+ ObjectInputStream ois = new ObjectInputStream(reqStream);
+ Request request = (Request)ois.readObject();
+
+ // Field the request through the abstract connector
+ Response response = process(request);
+ if (response == null)
+ throw new IllegalStateException("response cannot be null");
+
+ // Marshall the Response
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(response);
+ oos.close();
+
+ return new ByteArrayInputStream(baos.toByteArray());
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot process request", ex);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnector.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+//$Id$
+
+import java.io.InputStream;
+
+import org.jboss.osgi.husky.PackageListener;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public interface JMXConnectorMBean
+{
+ /**
+ * Consumes the serialized version of an {@link Request} and
+ * return the the {@link Response} from the test run
+ *
+ * @param reqStream the input stream to read the {@link Request} from
+ * @return the input stream to read the {@link Response} from
+ */
+ InputStream process(InputStream reqStream);
+
+ /**
+ * Add a {@link PackageListener} to this connector
+ */
+ void addPackageListener(PackageListener listener);
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JMXConnectorMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/JUnitResponse.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -23,12 +23,6 @@
// $Id$
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.jboss.osgi.husky.Failure;
-import org.jboss.osgi.husky.Response;
import org.junit.runner.Result;
/**
@@ -37,27 +31,16 @@
* @author Thomas.Diesler(a)jboss.com
* @since 16-May-2009
*/
-public class JUnitResponse implements Response
+public class JUnitResponse extends BasicResponse
{
private static final long serialVersionUID = 1L;
- private List<Failure> failures = new ArrayList<Failure>();
-
public JUnitResponse(Result result)
{
for (org.junit.runner.notification.Failure failure: result.getFailures())
{
- failures.add(new JUnitFailure(failure));
+ addFailure(new JUnitFailure(failure));
}
}
- public List<Failure> getFailures()
- {
- return Collections.unmodifiableList(failures);
- }
-
- public void addFailure(Failure failure)
- {
- failures.add(failure);
- }
}
Modified: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/LocalInvoker.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -23,6 +23,18 @@
// $Id$
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.management.MBeanServerFactory;
+import javax.management.RuntimeMBeanException;
+
import org.jboss.osgi.husky.Connector;
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Invoker;
@@ -39,19 +51,66 @@
*/
public class LocalInvoker implements Invoker
{
- private Connector connector;
-
- public LocalInvoker()
+ public Response invoke(Request req)
{
- connector = new LocalConnector();
- connector.addPackagerListener(new MatchAllJUnitPackageListener());
+ MBeanServerConnection server = getMBeanServer();
+ try
+ {
+ if (server.isRegistered(JMXConnector.OBJECT_NAME))
+ {
+ // Marshall the Request
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(req);
+ oos.close();
+
+ InputStream reqBytes = new ByteArrayInputStream(baos.toByteArray());
+
+ InputStream resBytes = (InputStream)server.invoke(JMXConnector.OBJECT_NAME, "process", new Object[] { reqBytes }, new String[] { InputStream.class.getName() });
+
+ // Unmarshall the Response
+ ObjectInputStream ois = new ObjectInputStream(resBytes);
+ Response response = (Response)ois.readObject();
+ return response;
+ }
+ else
+ {
+ Connector connector = new LocalConnector();
+ connector.addPackageListener(new MatchAllJUnitPackageListener());
+ return connector.process(req);
+ }
+ }
+ catch (RuntimeMBeanException rte)
+ {
+ throw rte.getTargetException();
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot invoke connector", ex);
+ }
}
- public Response invoke(Request req)
+ @SuppressWarnings("unchecked")
+ private MBeanServerConnection getMBeanServer()
{
- return connector.process(req);
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
}
-
+
class LocalConnector extends AbstractConnector
{
}
@@ -60,7 +119,7 @@
{
public MatchAllJUnitPackageListener()
{
- super(new String[] {"org.jboss.test"});
+ super(new String[] { "org.jboss.test" });
}
public Context getContext()
@@ -77,7 +136,7 @@
@Override
public Class<?> loadTestClass(String className)
{
- return Utils.loadClass(className);
+ return Util.loadClass(className);
}
}
}
Copied: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java (from rev 88983, projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java)
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,92 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.internal;
+
+// $Id$
+
+import java.lang.reflect.Constructor;
+import java.util.Properties;
+
+/**
+ * Loads the configured test {@link Bridge} instance.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public abstract class Util
+{
+ // Load an instance for a given class name.
+ // Use the SomeObject(Properties) ctor if present.
+ public static Object loadInstance(String className, Properties props)
+ {
+ // net bridge class
+ Class<?> instanceClass = loadClass(className);
+
+ // get instance with properties
+ Object instance = null;
+ try
+ {
+ Constructor<?> ctor = instanceClass.getConstructor(Properties.class);
+ instance = ctor.newInstance(props);
+ }
+ catch (NoSuchMethodException ex)
+ {
+ // ignore
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot load: " + className, ex);
+ }
+
+ // get instance with default ctor
+ if (instance == null)
+ {
+ try
+ {
+ instance = instanceClass.newInstance();
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot load: " + className, ex);
+ }
+ }
+
+ return instance;
+ }
+
+ // Load a given class name.
+ public static Class<?> loadClass(String className)
+ {
+ // net bridge class
+ Class<?> instanceClass;
+ try
+ {
+ instanceClass = Class.forName(className);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ throw new IllegalStateException("Cannot load: " + className, ex);
+ }
+
+ return instanceClass;
+ }
+}
Deleted: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Utils.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -1,92 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.husky.internal;
-
-// $Id$
-
-import java.lang.reflect.Constructor;
-import java.util.Properties;
-
-/**
- * Loads the configured test {@link Bridge} instance.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public abstract class Utils
-{
- // Load an instance for a given class name.
- // Use the SomeObject(Properties) ctor if present.
- public static Object loadInstance(String className, Properties props)
- {
- // net bridge class
- Class<?> instanceClass = loadClass(className);
-
- // get instance with properties
- Object instance = null;
- try
- {
- Constructor<?> ctor = instanceClass.getConstructor(Properties.class);
- instance = ctor.newInstance(props);
- }
- catch (NoSuchMethodException ex)
- {
- // ignore
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot load: " + className, ex);
- }
-
- // get instance with default ctor
- if (instance == null)
- {
- try
- {
- instance = instanceClass.newInstance();
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot load: " + className, ex);
- }
- }
-
- return instance;
- }
-
- // Load a given class name.
- public static Class<?> loadClass(String className)
- {
- // net bridge class
- Class<?> instanceClass;
- try
- {
- instanceClass = Class.forName(className);
- }
- catch (ClassNotFoundException ex)
- {
- throw new IllegalStateException("Cannot load: " + className, ex);
- }
-
- return instanceClass;
- }
-}
Added: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,70 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.husky.junit;
+
+// $Id$
+
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.Runner;
+import org.jboss.osgi.husky.internal.AbstractPackageListener;
+import org.jboss.osgi.husky.internal.BasicContext;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * An implementation of a {@link Runner} that uses the
+ * JUnit4 Test Runner.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public class JUnitPackageListener extends AbstractPackageListener
+{
+ private Bundle bundle;
+
+ public JUnitPackageListener(Bundle bundle, String[] testPackages)
+ {
+ super(testPackages);
+ this.bundle = bundle;
+ }
+
+ @Override
+ public Context getContext()
+ {
+ BasicContext context = new BasicContext();
+ context.addAttachment(Bundle.class, bundle);
+ context.addAttachment(BundleContext.class, bundle.getBundleContext());
+ return context;
+ }
+
+ @Override
+ public Runner getRunner()
+ {
+ return new JUnitRunner();
+ }
+
+ @Override
+ public Class<?> loadTestClass(String className) throws ClassNotFoundException
+ {
+ return bundle.loadClass(className);
+ }
+}
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/junit/JUnitPackageListener.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/husky/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -16,53 +16,87 @@
<modelVersion>4.0.0</modelVersion>
<name>JBossOSGi - Husky</name>
-
+
<description>JBoss OSGi Bundle Testsuite</description>
-
+
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky</artifactId>
<packaging>pom</packaging>
<version>1.0.0-SNAPSHOT</version>
- <modules>
- <module>harness</module>
- <module>testsuite</module>
- </modules>
-
<!-- Properties -->
<properties>
- <junit.version>4.6</junit.version>
- <log4j.version>1.2.14</log4j.version>
- <slf4j.version>1.5.3</slf4j.version>
+ <version.aqute.bnd>0.0.323</version.aqute.bnd>
+ <version.felix.log>1.0.0</version.felix.log>
+ <version.jboss.logging>2.0.5.GA</version.jboss.logging>
+ <version.jboss.osgi>1.0.0.Beta2</version.jboss.osgi>
+ <version.junit>4.6</version.junit>
+ <version.osgi>r4v41</version.osgi>
</properties>
<!-- DependencyManagement -->
<dependencyManagement>
<dependencies>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ <version>${version.aqute.bnd}</version>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <version>${version.felix.log}</version>
</dependency>
<dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
+ <version>${version.jboss.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
+ <version>${version.jboss.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <version>${version.osgi}</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>${junit.version}</version>
+ <version>${version.junit}</version>
</dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
- </dependency>
</dependencies>
</dependencyManagement>
+ <!-- Modules -->
+ <modules>
+ <module>harness</module>
+ <module>testsuite</module>
+ </modules>
+
<!-- Build -->
<build>
<plugins>
@@ -74,6 +108,24 @@
</configuration>
</plugin>
</plugins>
+
+ <!-- PluginManagement -->
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <dependencies>
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ <version>${version.aqute.bnd}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </pluginManagement>
</build>
<!-- SCM -->
@@ -95,15 +147,8 @@
<!-- DistributionManagement -->
<distributionManagement>
<!--
- Add this to your ~/.m2/settings.xml
- <servers>
- <server>
- <id>jbpm.dyndns.org</id>
- <username>yourname</username>
- <privateKey>/home/yourname/.ssh/id_rsa</privateKey>
- <passphrase>yourpass</passphrase>
- </server>
- </servers>
+ Add this to your ~/.m2/settings.xml <servers> <server> <id>jbpm.dyndns.org</id> <username>yourname</username> <privateKey>/home/yourname/.ssh/id_rsa</privateKey>
+ <passphrase>yourpass</passphrase> </server> </servers>
-->
<site>
<id>jbpm.dyndns.org</id>
Modified: projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/.classpath 2009-05-18 17:05:41 UTC (rev 89009)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-18 12:25:48 UTC (rev 89008)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/pom.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -29,29 +29,57 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+
+ <!-- Bundle Dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-husky-harness</artifactId>
<version>${version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
</dependency>
<!-- Test Dependencies -->
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging-log4j</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-felix</artifactId>
<scope>test</scope>
</dependency>
<dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
@@ -61,12 +89,59 @@
<!-- Plugins -->
<plugins>
<plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>bundles</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>directory-single</goal>
+ </goals>
+ <configuration>
+ <finalName>test-libs</finalName>
+ <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>scripts/assembly-bundles.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>build-test-jars</id>
+ <phase>test-compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
+ <property name="tests.output.dir" value="${project.build.directory}" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<failIfNoTests>false</failIfNoTests>
<systemProperties>
<property>
+ <name>test.archive.directory</name>
+ <value>${project.build.directory}/test-libs</value>
+ </property>
+ <property>
+ <name>log4j.output.dir</name>
+ <value>${basedir}/target</value>
+ </property>
+ <property>
<name>org.jboss.osgi.husky.Invoker</name>
<value>org.jboss.osgi.husky.internal.LocalInvoker</value>
</property>
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,89 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.husky.osgi.simple;
+
+// $Id$
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeNotNull;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 17-May-2009
+ */
+public class SimpleAllInOneTest
+{
+ @ProvideContext
+ public Context context;
+
+ private OSGiTestHelper helper;
+ private OSGiRuntime runtime;
+
+ @Before
+ public void setUp() throws BundleException
+ {
+ if (context == null)
+ {
+ helper = new OSGiTestHelper();
+ runtime = helper.getEmbeddedRuntime();
+
+ AbstractBundle bundle = runtime.installBundle("simple-all-in-one.jar");
+ bundle.start();
+ }
+ }
+
+ @After
+ public void tearDown()
+ {
+ if (context == null)
+ {
+ if (runtime != null)
+ runtime.shutdown();
+ }
+ }
+
+ @Test
+ public void testContextInjection()
+ {
+ if(context == null)
+ BridgeFactory.getBridge().run();
+
+ assumeNotNull(context);
+
+ Bundle bundle = context.getAttachment(Bundle.class);
+ assertEquals("simple-all-in-one", bundle.getSymbolicName());
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/java/org/jboss/test/husky/osgi/simple/SimpleAllInOneTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,34 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage=${test.archive.directory}/../osgi-store
+org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
+# org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi.testing, \
+ org.osgi.framework;version\=1.4, \
+ org.apache.log4j
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-husky-harness.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/jboss-osgi-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
+
+ <!-- ================================= -->
+ <!-- Preserve messages in a local file -->
+ <!-- ================================= -->
+
+ <appender name="FILE" class="org.apache.log4j.FileAppender">
+ <param name="File" value="${log4j.output.dir}/test.log"/>
+ <param name="Append" value="false"/>
+ <layout class="org.apache.log4j.PatternLayout">
+ <!-- The default pattern: Date Priority [Category] Message\n -->
+ <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
+ </layout>
+ </appender>
+
+ <!-- ============================== -->
+ <!-- Append messages to the console -->
+ <!-- ============================== -->
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%d{HH:mm:ss,SSS} %-5p [%c{1}] %m%n" />
+ </layout>
+ </appender>
+
+ <!-- ================ -->
+ <!-- Limit categories -->
+ <!-- ================ -->
+
+ <!-- Show jboss deployer traces
+ <category name="org.jboss.deployers">
+ <priority value="TRACE" />
+ </category>
+ -->
+
+ <!-- ======================= -->
+ <!-- Setup the Root category -->
+ <!-- ======================= -->
+
+ <root>
+ <!--appender-ref ref="CONSOLE"/-->
+ <appender-ref ref="FILE"/>
+ </root>
+
+</log4j:configuration>
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/log4j.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1 @@
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Added: projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd
===================================================================
--- projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd (rev 0)
+++ projects/jboss-osgi/projects/husky/trunk/testsuite/src/test/resources/osgi/simple/simple-all-in-one.bnd 2009-05-18 17:05:41 UTC (rev 89009)
@@ -0,0 +1,7 @@
+# bnd build -classpath target/test-classes -output target/test-libs/simple-all-in-one.jar src/test/resources/osgi/simple-all-in-one.bnd
+
+Bundle-SymbolicName: simple-all-in-one
+Export-Package: org.jboss.test.husky.osgi.simple
+
+# Register a PackageListener for this
+Test-Package: org.jboss.test.husky.osgi.simple
17 years, 2 months
JBoss-OSGI SVN: r88985 - in projects/jboss-osgi/projects/husky/trunk: testsuite and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-16 19:19:21 -0400 (Sat, 16 May 2009)
New Revision: 88985
Modified:
projects/jboss-osgi/projects/husky/trunk/harness/
projects/jboss-osgi/projects/husky/trunk/testsuite/
Log:
svn:ignore target
Property changes on: projects/jboss-osgi/projects/husky/trunk/harness
___________________________________________________________________
Name: svn:ignore
+ target
Property changes on: projects/jboss-osgi/projects/husky/trunk/testsuite
___________________________________________________________________
Name: svn:ignore
+ target
17 years, 2 months
JBoss-OSGI SVN: r88984 - projects/jboss-osgi/projects/husky/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-16 19:17:07 -0400 (Sat, 16 May 2009)
New Revision: 88984
Modified:
projects/jboss-osgi/projects/husky/trunk/
Log:
svn:ignore target
Property changes on: projects/jboss-osgi/projects/husky/trunk
___________________________________________________________________
Name: svn:ignore
+ target
17 years, 2 months
JBoss-OSGI SVN: r88983 - in projects/jboss-osgi/projects: husky and 24 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)jboss.com
+ * @since 16-May-2009
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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(a)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
17 years, 2 months
JBoss-OSGI SVN: r88982 - projects/jboss-osgi.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-16 19:13:31 -0400 (Sat, 16 May 2009)
New Revision: 88982
Added:
projects/jboss-osgi/projects/
Log:
Add husky test harness - first cut
17 years, 2 months