JBoss-OSGI SVN: r95882 - in projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta: internal and 1 other directory.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-31 08:07:21 -0400 (Sat, 31 Oct 2009)
New Revision: 95882
Added:
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
Modified:
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
Log:
Register JTA services conditionally
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-10-31 11:26:44 UTC (rev 95881)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionCapability.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -46,7 +46,7 @@
{
public TransactionCapability()
{
- super(TransactionManager.class.getName());
+ super(TransactionService.class.getName());
if (new File("target").exists())
addSystemProperty(Environment.OBJECTSTORE_DIR, "target/ObjectStore");
Added: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java (rev 0)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -0,0 +1,35 @@
+/*
+ * 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.jta;
+
+//$Id$
+
+
+/**
+ * A marker service for the jboss-osgi-jta bundle.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 27-Oct-2009
+ */
+public interface TransactionService
+{
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/TransactionService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-10-31 11:26:44 UTC (rev 95881)
+++ projects/jboss-osgi/trunk/reactor/jta/src/main/java/org/jboss/osgi/jta/internal/TransactionServiceActivator.java 2009-10-31 12:07:21 UTC (rev 95882)
@@ -26,6 +26,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;
+import org.jboss.osgi.jta.TransactionService;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceFactory;
@@ -44,18 +45,30 @@
public void start(BundleContext context)
{
+ // Always register the marker service
+ TransactionService markerService = new TransactionService(){};
+ context.registerService(TransactionService.class.getName(), markerService, null);
+
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- // Register the TransactionManager service
- TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
- transactionManagerReg = context.registerService(TransactionManager.class.getName(), tm, null);
+ // Register the TransactionManager service if is not already available
+ // which would be the case for jbossas integration
+ if (context.getServiceReference(TransactionManager.class.getName()) == null)
+ {
+ TransactionManager tm = com.arjuna.ats.jta.TransactionManager.transactionManager();
+ transactionManagerReg = context.registerService(TransactionManager.class.getName(), tm, null);
+ }
- // Register the UserTransaction service
- ServiceFactory txFactory = new UserTransactionServiceFactory();
- userTransactionReg = context.registerService(UserTransaction.class.getName(), txFactory, null);
+ // Register the UserTransaction service if is not already available
+ // which would be the case for jbossas integration
+ if (context.getServiceReference(UserTransaction.class.getName()) == null)
+ {
+ ServiceFactory txFactory = new UserTransactionServiceFactory();
+ userTransactionReg = context.registerService(UserTransaction.class.getName(), txFactory, null);
+ }
}
finally
{
14 years, 6 months
JBoss-OSGI SVN: r95881 - in projects/jboss-osgi: projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-31 07:26:44 -0400 (Sat, 31 Oct 2009)
New Revision: 95881
Added:
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
Removed:
projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/
Modified:
projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
Log:
Provide AS integration for the JTA services
Modified: projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/pom.xml 2009-10-31 11:26:44 UTC (rev 95881)
@@ -29,7 +29,16 @@
<version>1.0.4-SNAPSHOT</version>
</parent>
+ <!-- Subversion -->
+ <scm>
+ <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
+ <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
+ <url>http://fisheye.jboss.com/qsearch/JBossOSGi</url>
+ </scm>
+
+ <!-- Properties -->
<properties>
+ <version.jboss.osgi.jta>1.0.0-SNAPSHOT</version.jboss.osgi.jta>
<version.jboss.osgi.microcontainer>2.0.9-SNAPSHOT</version.jboss.osgi.microcontainer>
<version.osgi>4.2.0</version.osgi>
</properties>
@@ -38,6 +47,11 @@
<dependencies>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jta</artifactId>
+ <version>${version.jboss.osgi.jta}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-microcontainer</artifactId>
<version>${version.jboss.osgi.microcontainer}</version>
</dependency>
@@ -86,11 +100,5 @@
</plugins>
</build>
- <!-- Subversion -->
- <scm>
- <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/jboss-osgi/projec...</connection>
- <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/jboss-osgi/projects/...</developerConnection>
- <url>http://fisheye.jboss.com/qsearch/JBossOSGi/projects/runtime/jbossas/trunk</url>
- </scm>
</project>
\ No newline at end of file
Copied: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java (from rev 95880, projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/microcontainer/integration/MicrocontainerServiceBean.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/MicrocontainerServiceBean.java 2009-10-31 11:26:44 UTC (rev 95881)
@@ -0,0 +1,120 @@
+/*
+ * 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.integration.jbossas;
+
+
+//$Id$
+
+import java.util.Properties;
+
+import javax.management.MBeanServer;
+
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.logging.Logger;
+import org.jboss.osgi.deployment.deployer.DeployerService;
+import org.jboss.osgi.microcontainer.integration.AbstractMicrocontainerService;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.service.MicrocontainerService;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+/**
+ * An implementation of the {@link DeployerService} and {@link MicrocontainerService}
+ * which is installed as MC bean in jbossas.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerServiceBean extends AbstractMicrocontainerService implements MicrocontainerServiceMBean
+{
+ private static Logger log = Logger.getLogger(MicrocontainerServiceBean.class);
+
+ private BundleContext bundleContext;
+ private MBeanServer mbeanServer;
+ private Kernel kernel;
+
+ public void setBundleContext(BundleContext bundleContext)
+ {
+ this.bundleContext = bundleContext;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ @Override
+ public void logDebug(String message)
+ {
+ log.debug(message);
+ }
+
+ @Override
+ public void logWarning(String message, Exception ex)
+ {
+ log.warn(message, ex);
+ }
+
+ public void start() throws Exception
+ {
+ Kernel kernel = getKernel();
+ KernelController controller = kernel.getController();
+
+ // Preregister some MC beans
+ installBean(controller, BEAN_SYSTEM_BUNDLE_CONTEXT, bundleContext);
+ installBean(controller, BEAN_KERNEL, kernel);
+ installBean(controller, BEAN_KERNEL_CONTROLLER, controller);
+ installBean(controller, BEAN_MBEAN_SERVER, mbeanServer);
+
+ // Register the MicrocontainerService
+ log.debug("Register MicrocontainerService");
+ bundleContext.registerService(MicrocontainerService.class.getName(), this, null);
+ log.debug("MicrocontainerService registered");
+
+ // Register the DeployerService
+ Properties props = new Properties();
+ props.setProperty("provider", "microcontainer");
+ props.put(Constants.SERVICE_RANKING, Integer.MAX_VALUE);
+ bundleContext.registerService(DeployerService.class.getName(), this, props);
+ log.debug("DeployerService registered");
+
+ // Register the MicrocontainerServiceMBean
+ registerMicrocontainerServiceMBean(mbeanServer);
+ log.debug("MicrocontainerServiceMBean registered");
+ }
+
+ void stop()
+ {
+ unregisterMicrocontainerServiceMBean(mbeanServer);
+ }
+}
\ No newline at end of file
Added: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
===================================================================
--- projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java 2009-10-31 11:26:44 UTC (rev 95881)
@@ -0,0 +1,76 @@
+/*
+ * 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.integration.jbossas;
+
+//$Id$
+
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * JBossAS intergration of the TransactionManager and UserTransaction service.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 31-Oct-2009
+ */
+public class TransactionServiceBean
+{
+ private BundleContext context;
+ private TransactionManager transactionManager;
+ private UserTransaction userTransaction;
+
+ private ServiceRegistration txManagerRegistration;
+ private ServiceRegistration userTxRegistration;
+
+ public void setBundleContext(BundleContext bundleContext)
+ {
+ this.context = bundleContext;
+ }
+
+ public void setTransactionManager(TransactionManager transactionManager)
+ {
+ this.transactionManager = transactionManager;
+ }
+
+ public void setUserTransaction(UserTransaction userTransaction)
+ {
+ this.userTransaction = userTransaction;
+ }
+
+ public void start() throws Exception
+ {
+ txManagerRegistration = context.registerService(TransactionManager.class.getName(), transactionManager, null);
+ userTxRegistration = context.registerService(UserTransaction.class.getName(), userTransaction, null);
+ }
+
+ void stop()
+ {
+ if (txManagerRegistration != null)
+ txManagerRegistration.unregister();
+
+ if (userTxRegistration != null)
+ userTxRegistration.unregister();
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/projects/runtime/jbossas/trunk/src/main/java/org/jboss/osgi/integration/jbossas/TransactionServiceBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-31 11:26:44 UTC (rev 95881)
@@ -40,10 +40,12 @@
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.internal.StringPropertyReplacer;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
+import org.jboss.osgi.spi.util.ServiceLoader;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -82,7 +84,7 @@
* @author thomas.diesler(a)jboss.com
* @since 24-Apr-2009
*/
-public abstract class PropertiesBootstrapProvider implements OSGiBootstrapProvider
+public class PropertiesBootstrapProvider implements OSGiBootstrapProvider
{
// Provide logging
final Logger log = LoggerFactory.getLogger(PropertiesBootstrapProvider.class);
@@ -191,7 +193,12 @@
}
/** Overwrite to create the framework */
- protected abstract Framework createFramework(Map<String, Object> properties);
+ protected Framework createFramework(Map<String, Object> properties)
+ {
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(properties);
+ return framework;
+ }
/**
* Overwrite to register system services before bundles get installed.
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/installer/install-definition.xml 2009-10-31 11:26:44 UTC (rev 95881)
@@ -236,6 +236,7 @@
<!-- all -->
<include name="jboss-osgi-apache-xerces.jar" />
<include name="jboss-osgi-blueprint.jar" />
+ <include name="jboss-osgi-husky.jar" />
<include name="jboss-osgi-jaxb.jar" />
<include name="jboss-osgi-jta.jar" />
<include name="jboss-osgi-xml-binding.jar" />
@@ -366,6 +367,7 @@
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer" override="true">
<include name="jboss-osgi-deployers.jar" />
<include name="jboss-osgi-deployment.jar" />
+ <include name="jboss-osgi-runtime-jbossas.jar" />
<include name="jboss-osgi-spi.jar" />
</fileset>
@@ -375,6 +377,7 @@
<include name="jboss-osgi-blueprint.jar" />
<include name="jboss-osgi-common.jar" />
<include name="jboss-osgi-common-core.jar" />
+ <include name="jboss-osgi-husky.jar" />
<include name="jboss-osgi-jaxb.jar" />
<include name="jboss-osgi-jmx.jar" />
<include name="jboss-osgi-jndi.jar" />
@@ -389,7 +392,6 @@
<fileset condition="isFelix" dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer"
override="true">
<include name="jboss-osgi-runtime-felix.jar" />
- <include name="jboss-osgi-runtime-jbossas.jar" />
<include name="org.apache.felix.framework.jar" />
</fileset>
<singlefile condition="isFelix" src="@{deploy.artifacts.dir}/resources/jbossas/jboss-beans-felix.xml" target="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer/META-INF/jboss-osgi-jboss-beans.xml"
@@ -408,7 +410,6 @@
<fileset condition="isEquinox" dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer"
override="true">
<include name="jboss-osgi-runtime-equinox.jar" />
- <include name="jboss-osgi-runtime-jbossas.jar" />
<include name="org.apache.equinox.framework.jar" />
<include name="org.eclipse.osgi.jar" />
</fileset>
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-equinox.xml 2009-10-31 11:26:44 UTC (rev 95881)
@@ -84,12 +84,19 @@
-->
<!-- Microcontainer Service -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.integration.MicrocontainerServiceBean">
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
+ <!-- Transaction Service -->
+ <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+ <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ </bean>
+
<!--
********************************
* *
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-31 11:26:44 UTC (rev 95881)
@@ -107,12 +107,19 @@
-->
<!-- Microcontainer Service -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.integration.MicrocontainerServiceBean">
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.integration.jbossas.MicrocontainerServiceBean">
<property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
<property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
</bean>
+ <!-- Transaction Service -->
+ <bean name="jboss.osgi:service=Transaction" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <property name="bundleContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+ <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ </bean>
+
<!--
********************************
* *
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-31 07:00:36 UTC (rev 95880)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-jbossmc.xml 2009-10-31 11:26:44 UTC (rev 95881)
@@ -198,4 +198,19 @@
<constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
</bean>
+
+ <!--
+ ********************************
+ * *
+ * Generic OSGi Services *
+ * *
+ ********************************
+ -->
+
+ <bean name="OSGiTransactionService" class="org.jboss.osgi.integration.jbossas.TransactionServiceBean">
+ <property name="bundleContext"><inject bean="OSGiBundleManager" property="systemContext"/></property>
+ <property name="transactionManager"><inject bean="RealTransactionManager"/></property>
+ <property name="userTransaction"><inject bean="DefaultUserTransactionprovider"/></property>
+ </bean>
+
</deployment>
\ No newline at end of file
14 years, 6 months
JBoss-OSGI SVN: r95880 - in projects/jboss-osgi: projects/bundles/husky/trunk/testsuite/src/test/resources/META-INF/services and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-31 03:00:36 -0400 (Sat, 31 Oct 2009)
New Revision: 95880
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Log:
Allow grace period for managed bundles to get registered
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java 2009-10-31 03:27:41 UTC (rev 95879)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteFramework.java 2009-10-31 07:00:36 UTC (rev 95880)
@@ -43,11 +43,13 @@
/**
* Get the installed bundle
+ * @return A managed bundle MBean or null if the identifier does not match any installed bundle.
*/
ManagedBundleMBean getBundle(String symbolicName, String version);
/**
* Get the installed bundle by id
+ * @return A managed bundle MBean or null if the identifier does not match any installed bundle.
*/
ManagedBundleMBean getBundle(long bundleId);
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2009-10-31 03:27:41 UTC (rev 95879)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/internal/RemoteRuntime.java 2009-10-31 07:00:36 UTC (rev 95880)
@@ -69,12 +69,23 @@
{
URL bundleURL = getTestHelper().getTestArchiveURL(location);
BundleInfo bundleInfo = BundleInfo.createBundleInfo(bundleURL);
+ String symbolicName = bundleInfo.getSymbolicName();
+ String version = bundleInfo.getVersion().toString();
deployInternal(location, true);
- String symbolicName = bundleInfo.getSymbolicName();
- String version = bundleInfo.getVersion().toString();
+ // The remote framework uses a BundleTracker that works of an asynchronous
+ // event to register the installed bundle. It is not available immediately.
+ int timeout = 50;
ManagedBundleMBean bundleMBean = getRemoteFramework().getBundle(symbolicName, version);
+ while (bundleMBean == null && 0 < timeout--)
+ {
+ Thread.sleep(200);
+ bundleMBean = getRemoteFramework().getBundle(symbolicName, version);
+ }
+ if (bundleMBean == null)
+ throw new IllegalStateException("Cannot find installed bundle: " + symbolicName + "-" + version);
+
RemoteBundle bundle = new RemoteBundle(this, bundleMBean, location);
return registerBundle(location, bundle);
}
@@ -144,7 +155,6 @@
OSGiBundle[] bundleArr = new OSGiBundle[bundles.size()];
bundles.toArray(bundleArr);
-
return bundleArr;
}
catch (Exception ex)
@@ -228,36 +238,40 @@
return new RemoteFramework()
{
- public ManagedBundleMBean getBundle(String symbolicName, String version)
+ public ManagedBundleMBean getBundle(String name, String version)
{
- ObjectName oname = managedFramework.getBundle(symbolicName, version);
- if (oname == null)
- throw new IllegalArgumentException("Cannot get remote bundle for: " + symbolicName);
-
- try
+ ManagedBundleMBean bundleMBean = null;
+ ObjectName oname = managedFramework.getBundle(name, version);
+ if (oname != null)
{
- return MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ try
+ {
+ bundleMBean = MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
}
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
+ return bundleMBean;
}
public ManagedBundleMBean getBundle(long bundleId)
{
+ ManagedBundleMBean bundleMBean = null;
ObjectName oname = managedFramework.getBundle(bundleId);
- if (oname == null)
- throw new IllegalArgumentException("Cannot get remote bundle for: " + bundleId);
-
- try
+ if (oname != null)
{
- return MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ try
+ {
+ bundleMBean = MBeanProxy.get(ManagedBundleMBean.class, oname, getMBeanServer());
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
}
- catch (MBeanProxyException ex)
- {
- throw new RemoteFrameworkException(ex);
- }
+ return bundleMBean;
}
public Set<ManagedBundleMBean> getBundles()
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-10-31 03:27:41 UTC (rev 95879)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/META-INF/services/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-10-31 07:00:36 UTC (rev 95880)
@@ -1 +1 @@
-org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.felix.FelixBootstrapProvider
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-31 03:27:41 UTC (rev 95879)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-31 07:00:36 UTC (rev 95880)
@@ -25,6 +25,7 @@
import static org.jboss.osgi.spi.OSGiConstants.DOMAIN_NAME;
import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_SYMBOLIC_NAME;
+import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_VERSION;
import static org.jboss.osgi.spi.management.ManagedBundle.PROPERTY_ID;
import java.util.ArrayList;
@@ -93,12 +94,11 @@
{
ObjectName oname = null;
- ObjectName pattern = ObjectNameFactory.create(DOMAIN_NAME + ":" + PROPERTY_SYMBOLIC_NAME + "=" + symbolicName + ",*");
- Set<ObjectName> names = mbeanServer.queryNames(pattern, null);
+ String namestr = DOMAIN_NAME + ":" + PROPERTY_SYMBOLIC_NAME + "=" + symbolicName + "," + PROPERTY_VERSION + "=" + version + ",*" ;
+ Set<ObjectName> names = mbeanServer.queryNames(ObjectNameFactory.create(namestr), null);
if (names.size() > 0)
{
- // [TODO] Support bundle version
if (names.size() > 1)
log.warn("Multiple bundles found: " + names);
14 years, 6 months
JBoss-OSGI SVN: r95869 - projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 15:52:35 -0400 (Fri, 30 Oct 2009)
New Revision: 95869
Modified:
projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
Log:
Use the bundle with the highest id
Modified: projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-30 19:48:35 UTC (rev 95868)
+++ projects/jboss-osgi/trunk/reactor/jmx/src/main/java/org/jboss/osgi/jmx/internal/ManagedFrameworkImpl.java 2009-10-30 19:52:35 UTC (rev 95869)
@@ -73,13 +73,13 @@
throw new IllegalArgumentException("Null BundleContext");
if (mbeanServer == null)
throw new IllegalArgumentException("Null MBeanServer");
-
+
if (context.getBundle().getBundleId() != 0)
throw new IllegalArgumentException("Not the system bundle context: " + context);
-
+
this.context = context;
this.mbeanServer = mbeanServer;
-
+
this.bundleTracker = new ManagedBundleTracker(context, mbeanServer);
}
@@ -100,9 +100,19 @@
{
// [TODO] Support bundle version
if (names.size() > 1)
- throw new IllegalArgumentException("Multiple bundles found: " + names);
+ log.warn("Multiple bundles found: " + names);
- oname = names.iterator().next();
+ // Use the bundle with the highest id
+ for (ObjectName aux : names)
+ {
+ if (oname == null)
+ oname = aux;
+
+ Integer bestId = new Integer(oname.getKeyProperty(PROPERTY_ID));
+ Integer auxId = new Integer(aux.getKeyProperty(PROPERTY_ID));
+ if (bestId < auxId)
+ oname = aux;
+ }
}
return oname;
@@ -213,7 +223,7 @@
{
// Start tracking the bundles
bundleTracker.open();
-
+
try
{
if (mbeanServer != null)
14 years, 6 months
JBoss-OSGI SVN: r95864 - in projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas: jboss501 and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 15:43:28 -0400 (Fri, 30 Oct 2009)
New Revision: 95864
Modified:
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss501/war-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss510/war-deployers-jboss-beans.xml
Log:
Fix jbossas felix issues
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-30 18:54:56 UTC (rev 95863)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss-beans-felix.xml 2009-10-30 19:43:28 UTC (rev 95864)
@@ -35,7 +35,7 @@
<!-- jboss-osgi -->
org.jboss.osgi.deployment.deployer;version=1.0,
- org.jboss.osgi.deployment.internal;version=1.0,
+ org.jboss.osgi.deployment.interceptor;version=1.0,
org.jboss.osgi.jbossxb;version=2.0,
org.jboss.osgi.microcontainer;version=1.0,
org.jboss.osgi.spi;version=1.0,
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss501/war-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss501/war-deployers-jboss-beans.xml 2009-10-30 18:54:56 UTC (rev 95863)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss501/war-deployers-jboss-beans.xml 2009-10-30 19:43:28 UTC (rev 95864)
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Web application deployers
-$Id$
+ Web application deployers
+
+ Replaced by JBossOSGi to disable the WebXmlLessDeployer
+
+ $Id$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
Modified: projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss510/war-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss510/war-deployers-jboss-beans.xml 2009-10-30 18:54:56 UTC (rev 95863)
+++ projects/jboss-osgi/trunk/distribution/installer/src/main/resources/jbossas/jboss510/war-deployers-jboss-beans.xml 2009-10-30 19:43:28 UTC (rev 95864)
@@ -1,8 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
-Web application deployers
-$Id$
+ Web application deployers
+
+ Replaced by JBossOSGi to disable the WebXmlLessDeployer
+
+ $Id$
-->
<deployment xmlns="urn:jboss:bean-deployer:2.0">
14 years, 6 months
JBoss-OSGI SVN: r95857 - in projects/jboss-osgi: projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 12:56:03 -0400 (Fri, 30 Oct 2009)
New Revision: 95857
Removed:
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java
Modified:
projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
projects/jboss-osgi/trunk/reactor/jta/pom.xml
Log:
Fix Felix runtime logging
Modified: projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/bundles/microcontainer/trunk/pom.xml 2009-10-30 16:56:03 UTC (rev 95857)
@@ -42,7 +42,7 @@
<version.jboss.deployers>2.0.5.SP1</version.jboss.deployers>
<version.jboss.microcontainer>2.0.9.GA</version.jboss.microcontainer>
<version.jboss.osgi.runtime.deployers>1.0.2</version.jboss.osgi.runtime.deployers>
- <version.jboss.osgi.deployment>0.0.1-SNAPSHOT</version.jboss.osgi.deployment>
+ <version.jboss.osgi.deployment>1.0.0-SNAPSHOT</version.jboss.osgi.deployment>
<version.jboss.osgi.spi>1.0.3-SNAPSHOT</version.jboss.osgi.spi>
<version.jboss.osgi.xml.binding>2.0.1.SP1</version.jboss.osgi.xml.binding>
<version.osgi>4.2.0</version.osgi>
@@ -137,7 +137,6 @@
org.jboss.joinpoint.*,
org.jboss.logging,
org.jboss.osgi.common.log;version=1.0,
- org.jboss.osgi.deployment.common,
org.jboss.osgi.deployment.deployer,
org.jboss.osgi.jbossxb;version=2.0,
org.jboss.osgi.spi;version=1.0,
Modified: projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/equinox/trunk/src/main/java/org/jboss/osgi/equinox/EquinoxBootstrapProvider.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -23,11 +23,14 @@
//$Id$
-import java.net.URL;
+import java.util.Map;
import org.jboss.osgi.deployment.DeploymentActivator;
import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+import org.jboss.osgi.spi.util.ServiceLoader;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,14 +48,17 @@
private DeploymentActivator deploymentActivator;
@Override
- public void configure(URL urlConfig)
+ protected Framework createFramework(Map<String, Object> properties)
{
- super.configure(urlConfig);
-
// Log INFO about this implementation
String implTitle = getClass().getPackage().getImplementationTitle();
String impVersion = getClass().getPackage().getImplementationVersion();
log.info(implTitle + " - " + impVersion);
+
+ // Load the framework instance
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(properties);
+ return framework;
}
@Override
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBootstrapProvider.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -23,12 +23,14 @@
//$Id$
-import java.net.URL;
+import java.util.Map;
import org.jboss.osgi.deployment.DeploymentActivator;
import org.jboss.osgi.spi.framework.PropertiesBootstrapProvider;
+import org.jboss.osgi.spi.util.ServiceLoader;
import org.osgi.framework.BundleContext;
import org.osgi.framework.launch.Framework;
+import org.osgi.framework.launch.FrameworkFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -46,21 +48,24 @@
private DeploymentActivator deploymentActivator;
@Override
- public void configure(URL urlConfig)
+ protected Framework createFramework(Map<String, Object> properties)
{
- super.configure(urlConfig);
-
// Log INFO about this implementation
String implTitle = getClass().getPackage().getImplementationTitle();
String impVersion = getClass().getPackage().getImplementationVersion();
log.info(implTitle + " - " + impVersion);
- }
+
+ // When a Felix instance is embedded in a host application,
+ // the host application must inform the Felix instance that it is embedded
+ properties.put("felix.embedded.execution", "true");
- @Override
- public Framework getFramework()
- {
- Framework framework = super.getFramework();
- return new FelixFrameworkWrapper(framework);
+ // An instance of Logger that the framework uses as its default logger
+ properties.put("felix.log.logger", new FelixLogger());
+
+ // Load the framework instance
+ FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
+ Framework framework = factory.newFramework(properties);
+ return framework;
}
@Override
Deleted: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixBundleContextWrapper.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -1,48 +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.felix;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.BundleContextWrapper;
-import org.osgi.framework.BundleContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Wraps the BundleContext provided by the Felix implementation.
- *
- * It provides additional functionality on bundle install.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Oct-2009
- */
-public class FelixBundleContextWrapper extends BundleContextWrapper
-{
- // Provide logging
- final Logger log = LoggerFactory.getLogger(FelixBundleContextWrapper.class);
-
- public FelixBundleContextWrapper(BundleContext context)
- {
- super(context);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixFrameworkWrapper.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.felix;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.FrameworkWrapper;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * Wraps the Framework provided by the Felix implementation.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 15-Oct-2009
- */
-class FelixFrameworkWrapper extends FrameworkWrapper
-{
- FelixFrameworkWrapper(Framework framework)
- {
- super(framework);
- }
-
- @Override
- public BundleContext getBundleContext()
- {
- BundleContext context = super.getBundleContext();
- return new FelixBundleContextWrapper(context);
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java
===================================================================
--- projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/runtime/felix/trunk/src/main/java/org/jboss/osgi/felix/FelixLogger.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -32,7 +32,7 @@
* An integration with the Felix Logger.
*
* This Logger gets registered with the Felix framework and
- * delegates framework log messages to the JBoss logger.
+ * delegates framework log messages to SLF4J.
*
* @author thomas.diesler(a)jboss.com
* @since 04-Mar-2009
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-30 16:56:03 UTC (rev 95857)
@@ -40,12 +40,10 @@
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.internal.StringPropertyReplacer;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
-import org.jboss.osgi.spi.util.ServiceLoader;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.launch.Framework;
-import org.osgi.framework.launch.FrameworkFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,7 +82,7 @@
* @author thomas.diesler(a)jboss.com
* @since 24-Apr-2009
*/
-public class PropertiesBootstrapProvider implements OSGiBootstrapProvider
+public abstract class PropertiesBootstrapProvider implements OSGiBootstrapProvider
{
// Provide logging
final Logger log = LoggerFactory.getLogger(PropertiesBootstrapProvider.class);
@@ -123,8 +121,7 @@
final Map<String, Object> props = getBootstrapProperties(urlConfig);
// Load the framework instance
- FrameworkFactory factory = ServiceLoader.loadService(FrameworkFactory.class);
- final Framework frameworkImpl = factory.newFramework(props);
+ final Framework frameworkImpl = createFramework(props);
framework = new FrameworkWrapper(frameworkImpl)
{
@Override
@@ -193,6 +190,9 @@
configured = true;
}
+ /** Overwrite to create the framework */
+ protected abstract Framework createFramework(Map<String, Object> properties);
+
/**
* Overwrite to register system services before bundles get installed.
*/
Modified: projects/jboss-osgi/trunk/reactor/jta/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/jta/pom.xml 2009-10-30 16:54:05 UTC (rev 95856)
+++ projects/jboss-osgi/trunk/reactor/jta/pom.xml 2009-10-30 16:56:03 UTC (rev 95857)
@@ -101,7 +101,7 @@
javax.management,
javax.naming,
javax.naming.spi,
- javax.transaction,
+ javax.transaction;version="[1.0,1.1)",
javax.xml.parsers,
org.apache.commons.logging,
org.jboss.osgi.spi.capability;version="[1.0,1.1)",
14 years, 6 months
JBoss-OSGI SVN: r95839 - projects/jboss-osgi/trunk/testsuite/example.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 11:56:11 -0400 (Fri, 30 Oct 2009)
New Revision: 95839
Modified:
projects/jboss-osgi/trunk/testsuite/example/pom.xml
Log:
Disable WebAppExtenderTestCase on jbossmc
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-30 15:44:49 UTC (rev 95838)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-10-30 15:56:11 UTC (rev 95839)
@@ -290,6 +290,7 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
+ <exclude>org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.class</exclude>
</excludes>
</configuration>
</plugin>
@@ -330,6 +331,7 @@
<configuration>
<excludes>
<exclude>${target.container.excludes}</exclude>
+ <exclude>org/jboss/test/osgi/example/webapp/WebAppExtenderTestCase.class</exclude>
</excludes>
</configuration>
</plugin>
14 years, 6 months
JBoss-OSGI SVN: r95826 - in projects/jboss-osgi: projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal and 15 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 09:44:32 -0400 (Fri, 30 Oct 2009)
New Revision: 95826
Added:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/RuntimeContext.java
Removed:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/bundle/
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd
Log:
Migrate JTA test to Husky
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java (from rev 95824, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -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;
+
+
+// $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
+{
+ /**
+ * Get the caller's class
+ */
+ Class<?> getCallerClass();
+
+ /**
+ * Get the caller's method
+ */
+ String getCallerMethod();
+
+ /**
+ * Get the caller's concatination of class name and method.
+ */
+ String getCallerFrame();
+
+ /**
+ * 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/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java (from rev 95824, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -0,0 +1,93 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.osgi.husky.internal.BasicBridge;
+import org.jboss.osgi.husky.internal.Util;
+
+/**
+ * Loads the configured {@link Bridge} instance.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public abstract class BridgeFactory
+{
+ private static Map<Object, Bridge> bridgeCache = new HashMap<Object, Bridge>();
+
+ /**
+ * 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();
+ return getBridgeInternal(null, props);
+ }
+
+ /**
+ * Get the cached instance of the bridge class that is configed through the system property {@link Bridge}.
+ * If there is no cached instance it creates a new instance.
+ */
+ public static Bridge getBridge(Object key)
+ {
+ Properties props = System.getProperties();
+ return getBridgeInternal(key, 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(Object key, Properties props)
+ {
+ String className = props.getProperty(Bridge.class.getName());
+ if (className == null)
+ throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
+
+ return getBridgeInternal(key, props);
+ }
+
+ private static Bridge getBridgeInternal(Object key, Properties props)
+ {
+ Bridge bridge = bridgeCache.get(key);
+ if (bridge == null)
+ {
+ String className = props.getProperty(Bridge.class.getName(), BasicBridge.class.getName());
+ bridge = (Bridge)Util.loadInstance(className, props);
+
+ if (key != null)
+ bridgeCache.put(key, bridge);
+ }
+ return bridge;
+ }
+}
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java (from rev 95824, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -0,0 +1,49 @@
+/*
+ * 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.runtime.Connector;
+import org.jboss.osgi.spi.capability.Capability;
+import org.jboss.osgi.testing.OSGiRuntime;
+
+/**
+ * Adds the Husky testing capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if a Husky connector is already registered.
+ *
+ * Installed bundles: jboss-osgi-husky.jar
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class HuskyCapability extends Capability
+{
+ public HuskyCapability()
+ {
+ super(Connector.class.getName());
+
+ addBundle("bundles/jboss-osgi-husky.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/RuntimeContext.java (from rev 95825, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/RuntimeContext.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/RuntimeContext.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -0,0 +1,46 @@
+/*
+ * 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.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.osgi.husky.runtime.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 RuntimeContext
+{
+
+}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -32,10 +32,9 @@
import junit.framework.AssertionFailedError;
+import org.jboss.osgi.husky.Bridge;
import org.jboss.osgi.husky.Failure;
-import org.jboss.osgi.husky.Invoker;
import org.jboss.osgi.husky.Response;
-import org.jboss.osgi.testing.Bridge;
/**
* An abstract {@link Bridge} implementation.
@@ -125,8 +124,7 @@
line = br.readLine().trim();
String bridgePackage = Bridge.class.getPackage().getName();
- String invokerPackage = Invoker.class.getPackage().getName();
- while (line.startsWith("at " + bridgePackage) || line.startsWith("at " + invokerPackage))
+ while (line.startsWith("at " + bridgePackage))
{
line = br.readLine().trim();
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -25,8 +25,8 @@
import java.util.Properties;
+import org.jboss.osgi.husky.Bridge;
import org.jboss.osgi.husky.Invoker;
-import org.jboss.osgi.testing.Bridge;
/**
* A basic {@link Bridge} implementation that can be associated
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -29,7 +29,7 @@
import java.lang.reflect.Constructor;
import java.util.Properties;
-import org.jboss.osgi.testing.Bridge;
+import org.jboss.osgi.husky.Bridge;
/**
* Loads the configured test {@link Bridge} instance.
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -25,8 +25,8 @@
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
-import org.jboss.osgi.testing.RuntimeContext;
/**
* An abstraction of a test runner that executes the given
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -30,8 +30,8 @@
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.husky.runtime.Runner;
-import org.jboss.osgi.testing.RuntimeContext;
import org.junit.runner.Result;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -1,126 +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.testing;
-
-import org.jboss.osgi.husky.Invoker;
-import org.jboss.osgi.husky.Request;
-import org.jboss.osgi.husky.Response;
-
-
-
-// $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
-{
- /**
- * Get the caller's class
- */
- Class<?> getCallerClass();
-
- /**
- * Get the caller's method
- */
- String getCallerMethod();
-
- /**
- * Get the caller's concatination of class name and method.
- */
- String getCallerFrame();
-
- /**
- * 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/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -1,93 +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.testing;
-
-// $Id$
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.osgi.husky.internal.BasicBridge;
-import org.jboss.osgi.husky.internal.Util;
-
-/**
- * Loads the configured {@link Bridge} instance.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public abstract class BridgeFactory
-{
- private static Map<Object, Bridge> bridgeCache = new HashMap<Object, Bridge>();
-
- /**
- * 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();
- return getBridgeInternal(null, props);
- }
-
- /**
- * Get the cached instance of the bridge class that is configed through the system property {@link Bridge}.
- * If there is no cached instance it creates a new instance.
- */
- public static Bridge getBridge(Object key)
- {
- Properties props = System.getProperties();
- return getBridgeInternal(key, 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(Object key, Properties props)
- {
- String className = props.getProperty(Bridge.class.getName());
- if (className == null)
- throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
-
- return getBridgeInternal(key, props);
- }
-
- private static Bridge getBridgeInternal(Object key, Properties props)
- {
- Bridge bridge = bridgeCache.get(key);
- if (bridge == null)
- {
- String className = props.getProperty(Bridge.class.getName(), BasicBridge.class.getName());
- bridge = (Bridge)Util.loadInstance(className, props);
-
- if (key != null)
- bridgeCache.put(key, bridge);
- }
- return bridge;
- }
-}
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -1,48 +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.testing;
-
-//$Id$
-
-import org.jboss.osgi.husky.runtime.Connector;
-import org.jboss.osgi.spi.capability.Capability;
-
-/**
- * Adds the Husky testing capability to the {@link OSGiRuntime}
- * under test.
- *
- * It is ignored if a Husky connector is already registered.
- *
- * Installed bundles: jboss-osgi-husky.jar
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class HuskyCapability extends Capability
-{
- public HuskyCapability()
- {
- super(Connector.class.getName());
-
- addBundle("bundles/jboss-osgi-husky.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -1,47 +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.testing;
-
-// $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.runtime.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 RuntimeContext
-{
-
-}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd 2009-10-30 13:44:32 UTC (rev 95826)
@@ -6,6 +6,7 @@
Import-Package: \
org.jboss.osgi.spi.capability, \
+ org.jboss.osgi.husky, \
org.jboss.osgi.testing, \
org.junit, \
org.osgi.framework
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -36,14 +36,14 @@
import javax.management.MBeanServer;
import org.jboss.osgi.blueprint.BlueprintCapability;
+import org.jboss.osgi.husky.Bridge;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.jmx.JMXCapability;
-import org.jboss.osgi.testing.Bridge;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.blueprint.container.bundle.BeanA;
import org.jboss.test.osgi.blueprint.container.bundle.BeanB;
import org.jboss.test.osgi.blueprint.container.bundle.ServiceA;
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd 2009-10-30 13:44:32 UTC (rev 95826)
@@ -9,6 +9,7 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
+ org.jboss.osgi.husky, \
org.jboss.osgi.jmx, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.testing, \
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -30,13 +30,13 @@
import javax.management.MBeanServer;
import org.jboss.osgi.blueprint.BlueprintCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.jmx.JMXCapability;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.example.blueprint.bundle.BeanA;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceA;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceB;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -23,17 +23,29 @@
//$Id$
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assume.assumeNotNull;
+import javax.transaction.Status;
+import javax.transaction.Synchronization;
+import javax.transaction.Transaction;
+import javax.transaction.TransactionManager;
+import javax.transaction.UserTransaction;
+
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
+import org.jboss.osgi.jmx.JMXCapability;
import org.jboss.osgi.jta.TransactionCapability;
-import org.jboss.osgi.testing.HuskyCapability;
-import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
/**
* An example of OSGi JTA.
@@ -43,31 +55,107 @@
*/
public class TransactionTestCase
{
+ @RuntimeContext
+ public BundleContext context;
+
private OSGiRuntime runtime;
@Before
public void setUp() throws Exception
{
- runtime = new OSGiTestHelper().getDefaultRuntime();
- runtime.addCapability(new HuskyCapability());
- runtime.addCapability(new HuskyCapability());
- runtime.addCapability(new TransactionCapability());
+ if (context == null)
+ {
+ runtime = new OSGiTestHelper().getDefaultRuntime();
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new HuskyCapability());
+ runtime.addCapability(new TransactionCapability());
+ runtime.installBundle("example-jta.jar").start();
+ }
}
@After
public void tearDown() throws Exception
{
- runtime.shutdown();
- runtime = null;
+ if (context == null)
+ runtime.shutdown();
}
@Test
public void testUserTransaction() throws Exception
{
- OSGiBundle bundle = runtime.installBundle("example-jta.jar");
- assertEquals(Bundle.INSTALLED, bundle.getState());
+ if (context == null)
+ BridgeFactory.getBridge().run();
- bundle.start();
- assertEquals(Bundle.ACTIVE, bundle.getState());
+ // Tell Husky to run this test method within the OSGi Runtime
+ if (context == null)
+ BridgeFactory.getBridge().run();
+
+ // Stop here if the context is not injected
+ assumeNotNull(context);
+
+ ServiceReference sref = context.getServiceReference(UserTransaction.class.getName());
+ assertNotNull("UserTransaction service not null", sref);
+
+ UserTransaction userTx = (UserTransaction)context.getService(sref);
+ assertNotNull("UserTransaction not null", userTx);
+
+ Transactional txObj = new Transactional();
+
+ userTx.begin();
+ try
+ {
+ txObj.register(context);
+
+ txObj.setMessage("Hello World");
+ assertNull("Uncommited message null", txObj.getMessage());
+
+ userTx.commit();
+ }
+ catch (Exception e)
+ {
+ userTx.setRollbackOnly();
+ }
+
+ assertEquals("Hello World", txObj.getMessage());
}
+
+ class Transactional implements Synchronization
+ {
+ private String volatileMessage;
+ private String message;
+
+ public void beforeCompletion()
+ {
+ }
+
+ public void afterCompletion(int status)
+ {
+ if (status == Status.STATUS_COMMITTED)
+ message = volatileMessage;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessage(String message)
+ {
+ this.volatileMessage = message;
+ }
+
+ void register(BundleContext context) throws Exception
+ {
+ ServiceReference sref = context.getServiceReference(TransactionManager.class.getName());
+ assertNotNull("TransactionManager service not null", sref);
+
+ TransactionManager tm = (TransactionManager)context.getService(sref);
+ assertNotNull("TransactionManager not null", tm);
+
+ Transaction tx = tm.getTransaction();
+ assertNotNull("Transaction not null", tx);
+
+ tx.registerSynchronization(this);
+ }
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -27,12 +27,12 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.example.simple.bundle.SimpleService;
import org.junit.After;
import org.junit.Before;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -34,14 +34,14 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.jaxb.JAXBCapability;
import org.jboss.osgi.jaxb.JAXBService;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -33,12 +33,12 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.osgi.xml.XMLParserCapability;
import org.junit.After;
import org.junit.Before;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java 2009-10-30 13:44:32 UTC (rev 95826)
@@ -32,12 +32,12 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.jboss.osgi.testing.BridgeFactory;
-import org.jboss.osgi.testing.HuskyCapability;
+import org.jboss.osgi.husky.BridgeFactory;
+import org.jboss.osgi.husky.HuskyCapability;
+import org.jboss.osgi.husky.RuntimeContext;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.osgi.xml.XMLParserCapability;
import org.junit.After;
import org.junit.Before;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-10-30 13:44:32 UTC (rev 95826)
@@ -7,6 +7,7 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
+ org.jboss.osgi.husky, \
org.jboss.osgi.jmx, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.testing, \
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jta/example-jta.bnd 2009-10-30 13:44:32 UTC (rev 95826)
@@ -1,6 +1,11 @@
# bnd build -classpath target/test-classes -output target/test-libs/example-jta.jar src/test/resources/jta/example-jta.bnd
Bundle-SymbolicName: example-jta
-Bundle-Activator: org.jboss.test.osgi.example.jta.bundle.TransactionActivator
-Private-Package: org.jboss.test.osgi.example.jta.bundle
-Import-Package: javax.transaction, org.junit, org.osgi.framework
+Export-Package: org.jboss.test.osgi.example.jta
+Import-Package: \
+ javax.transaction, \
+ org.jboss.osgi.jmx, org.jboss.osgi.husky, org.jboss.osgi.testing, org.jboss.osgi.jta, org.jboss.osgi.spi.capability, \
+ org.junit, org.osgi.framework
+
+# Tell Husky that there are test cases in this package
+Test-Package: org.jboss.test.osgi.example.jta
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd 2009-10-30 13:18:51 UTC (rev 95825)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd 2009-10-30 13:44:32 UTC (rev 95826)
@@ -6,7 +6,7 @@
Export-Package: org.jboss.test.osgi.example.xml.jaxb
Import-Package: com.sun.xml.bind.v2, javax.xml.bind*, javax.xml.datatype, javax.xml.namespace, \
- org.jboss.osgi.jaxb, org.jboss.osgi.spi*, org.jboss.osgi.testing, org.junit, org.osgi.framework
+ org.jboss.osgi.jaxb, org.jboss.osgi.spi*, org.jboss.osgi.husky, org.jboss.osgi.testing, org.junit, org.osgi.framework
Include-Resource: booking.xml, booking.xsd
14 years, 6 months
JBoss-OSGI SVN: r95825 - in projects/jboss-osgi: projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit and 19 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 09:18:51 -0400 (Fri, 30 Oct 2009)
New Revision: 95825
Added:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/Attachments.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkException.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/AttachmentSupport.java
Removed:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/FrameworkException.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkIntegrationBean.java
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java
projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/util/DeploymentUnitAttachments.java
projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd
Log:
Provide Attachments as part of the SPI
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -26,7 +26,7 @@
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Response;
import org.jboss.osgi.husky.runtime.junit.JUnitRunner;
-import org.jboss.osgi.testing.ProvideContext;
+import org.jboss.osgi.testing.RuntimeContext;
/**
* An abstraction of a test runner that executes the given
@@ -45,7 +45,7 @@
*
* <ol>
* <li>Instanciate the test case</li>
- * <li>Inject the context in the field marked by {@link ProvideContext}</li>
+ * <li>Inject the context in the field marked by {@link RuntimeContext}</li>
* <li>Run the individual test methods</li>
* <li>Collect the test results and wrap them in the {@link Response}</li>
* </ol>
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -31,7 +31,7 @@
import org.jboss.osgi.husky.Context;
import org.jboss.osgi.husky.Response;
import org.jboss.osgi.husky.runtime.Runner;
-import org.jboss.osgi.testing.ProvideContext;
+import org.jboss.osgi.testing.RuntimeContext;
import org.junit.runner.Result;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
@@ -108,7 +108,7 @@
{
for (Field field : testClass.getDeclaredFields())
{
- ProvideContext anProvide = field.getAnnotation(ProvideContext.class);
+ RuntimeContext anProvide = field.getAnnotation(RuntimeContext.class);
if (anProvide != null)
{
if ((field.getModifiers() & Modifier.STATIC) != 0 || target != null)
@@ -117,7 +117,7 @@
}
for (Method method : testClass.getDeclaredMethods())
{
- ProvideContext anProvide = method.getAnnotation(ProvideContext.class);
+ RuntimeContext anProvide = method.getAnnotation(RuntimeContext.class);
if (anProvide != null)
{
if ((method.getModifiers() & Modifier.STATIC) != 0 || target != null)
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -1,47 +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.testing;
-
-// $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.runtime.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
-{
-
-}
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java (from rev 95824, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/RuntimeContext.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -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.testing;
+
+// $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.runtime.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 RuntimeContext
+{
+
+}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -31,7 +31,7 @@
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.ProvideContext;
+import org.jboss.osgi.testing.RuntimeContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -47,7 +47,7 @@
*/
public class ContextTestCase
{
- @ProvideContext
+ @RuntimeContext
public BundleContext context;
private OSGiRuntime runtime;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -31,7 +31,7 @@
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.ProvideContext;
+import org.jboss.osgi.testing.RuntimeContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -46,7 +46,7 @@
*/
public class MultipleMethodsTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -31,7 +31,7 @@
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
-import org.jboss.osgi.testing.ProvideContext;
+import org.jboss.osgi.testing.RuntimeContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -47,7 +47,7 @@
*/
public class StaticContextTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/Attachments.java (from rev 95820, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/Attachments.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/Attachments.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -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.spi;
+
+// $Id$
+
+import java.util.Collection;
+
+/**
+ * An interface for general Attachments
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 20-Apr-2007
+ */
+public interface Attachments
+{
+ /** Get attachment keys */
+ Collection<Key> getAttachmentKeys();
+
+ /** Add arbitrary attachment */
+ <T> T addAttachment(Class<T> clazz, T value);
+
+ /** Add arbitrary attachment with name */
+ <T> T addAttachment(String name, T value, Class<T> clazz);
+
+ /** 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(String name, Class<T> clazz);
+
+ /** 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
+ */
+ public static class Key
+ {
+ private Class<?> clazz;
+ private String name;
+
+ /**
+ * Construct the key with optional class and name
+ */
+ public Key(String name, Class<?> clazz)
+ {
+ 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(namePart, classPart);
+ }
+ 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/spi/trunk/src/main/java/org/jboss/osgi/spi/FrameworkException.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/FrameworkException.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/FrameworkException.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -1,49 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi;
-
-// $Id$
-
-/**
- * An OSGi Framework Exception that should be thrown on unrecoverable errors.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jan-2009
- */
-@SuppressWarnings("serial")
-public class FrameworkException extends RuntimeException
-{
- public FrameworkException(String message)
- {
- super(message);
- }
-
- public FrameworkException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public FrameworkException(Throwable cause)
- {
- super(cause);
- }
-}
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkException.java (from rev 95735, projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/FrameworkException.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkException.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkException.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -0,0 +1,49 @@
+/*
+ * 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.spi.framework;
+
+// $Id$
+
+/**
+ * An OSGi Framework Exception that should be thrown on unrecoverable errors.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 18-Jan-2009
+ */
+@SuppressWarnings("serial")
+public class FrameworkException extends RuntimeException
+{
+ public FrameworkException(String message)
+ {
+ super(message);
+ }
+
+ public FrameworkException(String message, Throwable cause)
+ {
+ super(message, cause);
+ }
+
+ public FrameworkException(Throwable cause)
+ {
+ super(cause);
+ }
+}
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkIntegrationBean.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkIntegrationBean.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/FrameworkIntegrationBean.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -29,7 +29,6 @@
import java.util.List;
import java.util.Map;
-import org.jboss.osgi.spi.FrameworkException;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/framework/PropertiesBootstrapProvider.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -37,7 +37,6 @@
import java.util.Properties;
import java.util.Set;
-import org.jboss.osgi.spi.FrameworkException;
import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.internal.StringPropertyReplacer;
import org.jboss.osgi.spi.util.ExportedPackageHelper;
Copied: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/AttachmentSupport.java (from rev 95820, projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java)
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/AttachmentSupport.java (rev 0)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/util/AttachmentSupport.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -0,0 +1,113 @@
+/*
+ * 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.spi.util;
+
+// $Id$
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jboss.osgi.spi.Attachments;
+
+/**
+ * Basic attachment support.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 20-Apr-2007
+ */
+public abstract class AttachmentSupport implements Attachments
+{
+ private Map<Key, Object> attachments = new HashMap<Key, Object>();
+
+ /** Construct with no attachments */
+ public AttachmentSupport()
+ {
+ }
+
+ /** Construct with given attachments */
+ public AttachmentSupport(AttachmentSupport att)
+ {
+ attachments = att.attachments;
+ }
+
+ public Collection<Key> getAttachmentKeys()
+ {
+ return attachments.keySet();
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(null, clazz));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T getAttachment(String name, Class<T> clazz)
+ {
+ return (T)attachments.get(new Key(name, clazz));
+ }
+
+ public Object getAttachment(String name)
+ {
+ return attachments.get(new Key(name, null));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(Class<T> clazz, T obj)
+ {
+ return (T)attachments.put(new Key(null, clazz), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T addAttachment(String name, T obj, Class<T> clazz)
+ {
+ return (T)attachments.put(new Key(name, clazz), obj);
+ }
+
+ public Object addAttachment(String name, Object obj)
+ {
+ return attachments.put(new Key(name, null), obj);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz)
+ {
+ return (T)attachments.remove(new Key(null, clazz));
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T> T removeAttachment(Class<T> clazz, String name)
+ {
+ return (T)attachments.remove(new Key(name, clazz));
+ }
+
+ public Object removeAttachment(String name)
+ {
+ return attachments.remove(new Key(name, null));
+ }
+
+ public String toString()
+ {
+ return attachments.toString();
+ }
+}
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -36,14 +36,14 @@
import javax.management.MBeanServer;
import org.jboss.osgi.blueprint.BlueprintCapability;
-import org.jboss.osgi.husky.Bridge;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.testing.Bridge;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.blueprint.container.bundle.BeanA;
import org.jboss.test.osgi.blueprint.container.bundle.BeanB;
import org.jboss.test.osgi.blueprint.container.bundle.ServiceA;
@@ -68,7 +68,7 @@
*/
public class BlueprintContainerTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd
===================================================================
--- projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/blueprint/testsuite/src/test/resources/container/container-basic.bnd 2009-10-30 13:18:51 UTC (rev 95825)
@@ -9,8 +9,6 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
- org.jboss.osgi.husky, \
- org.jboss.osgi.husky.annotation, \
org.jboss.osgi.jmx, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.testing, \
Deleted: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Attachments.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -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.deployment.deployer;
-
-// $Id$
-
-import java.util.Collection;
-
-/**
- * An interface for general Attachments
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
- */
-public interface Attachments
-{
- /** Get attachment keys */
- Collection<Key> getAttachmentKeys();
-
- /** Add arbitrary attachment */
- <T> T addAttachment(Class<T> clazz, T value);
-
- /** Add arbitrary attachment with name */
- <T> T addAttachment(String name, T value, Class<T> clazz);
-
- /** 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(String name, Class<T> clazz);
-
- /** 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
- */
- public static class Key
- {
- private Class<?> clazz;
- private String name;
-
- /**
- * Construct the key with optional class and name
- */
- public Key(String name, Class<?> clazz)
- {
- 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(namePart, classPart);
- }
- 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
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/deployer/Deployment.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -23,6 +23,7 @@
import java.net.URL;
+import org.jboss.osgi.spi.Attachments;
import org.jboss.virtual.VirtualFile;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/interceptor/InvocationContext.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -23,7 +23,7 @@
//$Id$
-import org.jboss.osgi.deployment.deployer.Attachments;
+import org.jboss.osgi.spi.Attachments;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Deleted: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/AttachmentSupport.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -1,113 +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.deployment.internal;
-
-// $Id$
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.jboss.osgi.deployment.deployer.Attachments;
-
-/**
- * Basic attachment support.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 20-Apr-2007
- */
-public abstract class AttachmentSupport implements Attachments
-{
- private Map<Key, Object> attachments = new HashMap<Key, Object>();
-
- /** Construct with no attachments */
- public AttachmentSupport()
- {
- }
-
- /** Construct with given attachments */
- public AttachmentSupport(AttachmentSupport att)
- {
- attachments = att.attachments;
- }
-
- public Collection<Key> getAttachmentKeys()
- {
- return attachments.keySet();
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(Class<T> clazz)
- {
- return (T)attachments.get(new Key(null, clazz));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T getAttachment(String name, Class<T> clazz)
- {
- return (T)attachments.get(new Key(name, clazz));
- }
-
- public Object getAttachment(String name)
- {
- return attachments.get(new Key(name, null));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(Class<T> clazz, T obj)
- {
- return (T)attachments.put(new Key(null, clazz), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T addAttachment(String name, T obj, Class<T> clazz)
- {
- return (T)attachments.put(new Key(name, clazz), obj);
- }
-
- public Object addAttachment(String name, Object obj)
- {
- return attachments.put(new Key(name, null), obj);
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz)
- {
- return (T)attachments.remove(new Key(null, clazz));
- }
-
- @SuppressWarnings("unchecked")
- public <T> T removeAttachment(Class<T> clazz, String name)
- {
- return (T)attachments.remove(new Key(name, clazz));
- }
-
- public Object removeAttachment(String name)
- {
- return attachments.remove(new Key(name, null));
- }
-
- public String toString()
- {
- return attachments.toString();
- }
-}
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/DeploymentImpl.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -26,6 +26,7 @@
import java.net.URL;
import org.jboss.osgi.deployment.deployer.Deployment;
+import org.jboss.osgi.spi.util.AttachmentSupport;
import org.jboss.osgi.spi.util.BundleInfo;
import org.jboss.virtual.VirtualFile;
Modified: projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/deployment/src/main/java/org/jboss/osgi/deployment/internal/InvocationContextImpl.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -25,8 +25,8 @@
import java.util.Collection;
-import org.jboss.osgi.deployment.deployer.Attachments;
import org.jboss.osgi.deployment.interceptor.InvocationContext;
+import org.jboss.osgi.spi.Attachments;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
Modified: projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/util/DeploymentUnitAttachments.java
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/util/DeploymentUnitAttachments.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/framework/src/main/java/org/jboss/osgi/framework/util/DeploymentUnitAttachments.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -28,7 +28,7 @@
import java.util.Set;
import org.jboss.deployers.structure.spi.DeploymentUnit;
-import org.jboss.osgi.deployment.deployer.Attachments;
+import org.jboss.osgi.spi.Attachments;
/**
* An implementation of {@link Attachments} that delegates to a
Modified: projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/reactor/framework/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-10-30 13:18:51 UTC (rev 95825)
@@ -18,12 +18,13 @@
<entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
<entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
<entry><key>org.osgi.framework.system.packages.extra</key><value>
+
org.jboss.logging;version=2.0,
+
+ org.jboss.osgi.spi;version=1.0,
org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.logging;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.testing;version=1.0,
org.jboss.osgi.spi.util;version=1.0,
org.osgi.framework,
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/blueprint/BlueprintTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -30,13 +30,13 @@
import javax.management.MBeanServer;
import org.jboss.osgi.blueprint.BlueprintCapability;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
import org.jboss.osgi.jmx.JMXCapability;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.example.blueprint.bundle.BeanA;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceA;
import org.jboss.test.osgi.example.blueprint.bundle.ServiceB;
@@ -56,7 +56,7 @@
*/
public class BlueprintTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jta/TransactionTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -25,8 +25,8 @@
import static org.junit.Assert.*;
-import org.jboss.osgi.husky.HuskyCapability;
import org.jboss.osgi.jta.TransactionCapability;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/simple/SimpleHuskyTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -27,12 +27,12 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.test.osgi.example.simple.bundle.SimpleService;
import org.junit.After;
import org.junit.Before;
@@ -51,7 +51,7 @@
*/
public class SimpleHuskyTestCase
{
- @ProvideContext
+ @RuntimeContext
public BundleContext context;
private OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/jaxb/JAXBTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -34,14 +34,14 @@
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
import org.jboss.osgi.jaxb.JAXBCapability;
import org.jboss.osgi.jaxb.JAXBService;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -56,7 +56,7 @@
*/
public class JAXBTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/DOMParserTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -33,12 +33,12 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.osgi.xml.XMLParserCapability;
import org.junit.After;
import org.junit.Before;
@@ -60,7 +60,7 @@
*/
public class DOMParserTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/xml/parser/SAXParserTestCase.java 2009-10-30 13:18:51 UTC (rev 95825)
@@ -32,12 +32,12 @@
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.RuntimeContext;
import org.jboss.osgi.xml.XMLParserCapability;
import org.junit.After;
import org.junit.Before;
@@ -58,7 +58,7 @@
*/
public class SAXParserTestCase
{
- @ProvideContext
+ @RuntimeContext
public static BundleContext context;
private static OSGiRuntime runtime;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/blueprint/example-blueprint.bnd 2009-10-30 13:18:51 UTC (rev 95825)
@@ -7,8 +7,6 @@
Import-Package: \
javax.management, \
org.jboss.osgi.blueprint, \
- org.jboss.osgi.husky, \
- org.jboss.osgi.husky.annotation, \
org.jboss.osgi.jmx, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.testing, \
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd 2009-10-30 13:05:42 UTC (rev 95824)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/xml/jaxb/example-xml-jaxb.bnd 2009-10-30 13:18:51 UTC (rev 95825)
@@ -6,8 +6,7 @@
Export-Package: org.jboss.test.osgi.example.xml.jaxb
Import-Package: com.sun.xml.bind.v2, javax.xml.bind*, javax.xml.datatype, javax.xml.namespace, \
- org.jboss.osgi.husky*, org.jboss.osgi.jaxb, org.jboss.osgi.spi*, org.jboss.osgi.testing, \
- org.junit, org.osgi.framework
+ org.jboss.osgi.jaxb, org.jboss.osgi.spi*, org.jboss.osgi.testing, org.junit, org.osgi.framework
Include-Resource: booking.xml, booking.xsd
14 years, 6 months
JBoss-OSGI SVN: r95824 - in projects/jboss-osgi/projects/bundles/husky/trunk: harness/src/main/java/org/jboss/osgi/husky and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-10-30 09:05:42 -0400 (Fri, 30 Oct 2009)
New Revision: 95824
Added:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java
Removed:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/
Modified:
projects/jboss-osgi/projects/bundles/husky/trunk/harness/pom.xml
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
Log:
WIP
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/pom.xml 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/pom.xml 2009-10-30 13:05:42 UTC (rev 95824)
@@ -67,13 +67,13 @@
<Bundle-Activator>org.jboss.osgi.husky.runtime.osgi.HuskyActivator</Bundle-Activator>
<Export-Package>
org.jboss.osgi.husky;version=${version},
- org.jboss.osgi.husky.annotation;version=${version},
org.jboss.osgi.testing;version=${version},
</Export-Package>
<Import-Package>
javax.management,
javax.naming,
org.jboss.osgi.deployment.interceptor;version="[1.0,1.1)",
+ org.jboss.osgi.spi;version="[1.0,1.1)",
org.jboss.osgi.spi.capability;version="[1.0,1.1)",
org.jboss.osgi.spi.management;version="[1.0,1.1)",
org.jboss.osgi.spi.util;version="[1.0,1.1)",
Deleted: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -1,122 +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
-{
- /**
- * Get the caller's class
- */
- Class<?> getCallerClass();
-
- /**
- * Get the caller's method
- */
- String getCallerMethod();
-
- /**
- * Get the caller's concatination of class name and method.
- */
- String getCallerFrame();
-
- /**
- * 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/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -1,93 +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.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.jboss.osgi.husky.internal.BasicBridge;
-import org.jboss.osgi.husky.internal.Util;
-
-/**
- * Loads the configured {@link Bridge} instance.
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 16-May-2009
- */
-public abstract class BridgeFactory
-{
- private static Map<Object, Bridge> bridgeCache = new HashMap<Object, Bridge>();
-
- /**
- * 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();
- return getBridgeInternal(null, props);
- }
-
- /**
- * Get the cached instance of the bridge class that is configed through the system property {@link Bridge}.
- * If there is no cached instance it creates a new instance.
- */
- public static Bridge getBridge(Object key)
- {
- Properties props = System.getProperties();
- return getBridgeInternal(key, 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(Object key, Properties props)
- {
- String className = props.getProperty(Bridge.class.getName());
- if (className == null)
- throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
-
- return getBridgeInternal(key, props);
- }
-
- private static Bridge getBridgeInternal(Object key, Properties props)
- {
- Bridge bridge = bridgeCache.get(key);
- if (bridge == null)
- {
- String className = props.getProperty(Bridge.class.getName(), BasicBridge.class.getName());
- bridge = (Bridge)Util.loadInstance(className, props);
-
- if (key != null)
- bridgeCache.put(key, bridge);
- }
- return bridge;
- }
-}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Context.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -23,7 +23,7 @@
// $Id$
-import java.util.Collection;
+import org.jboss.osgi.spi.Attachments;
/**
* The Context is a bucket of typed/named attachemnts.
@@ -31,130 +31,6 @@
* @author Thomas.Diesler(a)jboss.com
* @since 20-Apr-2007
*/
-public interface Context
+public interface Context extends Attachments
{
- /** 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/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -1,51 +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;
-
-import org.jboss.osgi.husky.runtime.Connector;
-import org.jboss.osgi.spi.capability.Capability;
-
-
-
-//$Id$
-
-
-/**
- * Adds the Husky testing capability to the {@link OSGiRuntime}
- * under test.
- *
- * It is ignored if a Husky connector is already registered.
- *
- * Installed bundles: jboss-osgi-husky.jar
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class HuskyCapability extends Capability
-{
- public HuskyCapability()
- {
- super(Connector.class.getName());
-
- addBundle("bundles/jboss-osgi-husky.jar");
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractBridge.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -32,9 +32,10 @@
import junit.framework.AssertionFailedError;
-import org.jboss.osgi.husky.Bridge;
import org.jboss.osgi.husky.Failure;
+import org.jboss.osgi.husky.Invoker;
import org.jboss.osgi.husky.Response;
+import org.jboss.osgi.testing.Bridge;
/**
* An abstract {@link Bridge} implementation.
@@ -124,7 +125,8 @@
line = br.readLine().trim();
String bridgePackage = Bridge.class.getPackage().getName();
- while (line.startsWith("at " + bridgePackage))
+ String invokerPackage = Invoker.class.getPackage().getName();
+ while (line.startsWith("at " + bridgePackage) || line.startsWith("at " + invokerPackage))
{
line = br.readLine().trim();
}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/AbstractConnector.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -110,7 +110,7 @@
{
try
{
- Thread.currentThread().wait(200);
+ Thread.sleep(200);
}
catch (InterruptedException e)
{
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicBridge.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -25,8 +25,8 @@
import java.util.Properties;
-import org.jboss.osgi.husky.Bridge;
import org.jboss.osgi.husky.Invoker;
+import org.jboss.osgi.testing.Bridge;
/**
* A basic {@link Bridge} implementation that can be associated
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/BasicContext.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -23,11 +23,8 @@
// $Id$
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
import org.jboss.osgi.husky.Context;
+import org.jboss.osgi.spi.util.AttachmentSupport;
/**
* The Context is a bucket of typed/named attachemnts.
@@ -35,87 +32,6 @@
* @author Thomas.Diesler(a)jboss.com
* @since 20-Apr-2007
*/
-public class BasicContext implements Context
+public class BasicContext extends AttachmentSupport 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
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/internal/Util.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -29,7 +29,7 @@
import java.lang.reflect.Constructor;
import java.util.Properties;
-import org.jboss.osgi.husky.Bridge;
+import org.jboss.osgi.testing.Bridge;
/**
* Loads the configured test {@link Bridge} instance.
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/Runner.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -25,8 +25,8 @@
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;
+import org.jboss.osgi.testing.ProvideContext;
/**
* An abstraction of a test runner that executes the given
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/runtime/junit/JUnitRunner.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -30,8 +30,8 @@
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.jboss.osgi.testing.ProvideContext;
import org.junit.runner.Result;
import org.junit.runner.notification.RunListener;
import org.junit.runner.notification.RunNotifier;
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java (from rev 95821, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/Bridge.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/Bridge.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -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.testing;
+
+import org.jboss.osgi.husky.Invoker;
+import org.jboss.osgi.husky.Request;
+import org.jboss.osgi.husky.Response;
+
+
+
+// $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
+{
+ /**
+ * Get the caller's class
+ */
+ Class<?> getCallerClass();
+
+ /**
+ * Get the caller's method
+ */
+ String getCallerMethod();
+
+ /**
+ * Get the caller's concatination of class name and method.
+ */
+ String getCallerFrame();
+
+ /**
+ * 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/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java (from rev 95821, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/BridgeFactory.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/BridgeFactory.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -0,0 +1,93 @@
+/*
+ * 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.testing;
+
+// $Id$
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+import org.jboss.osgi.husky.internal.BasicBridge;
+import org.jboss.osgi.husky.internal.Util;
+
+/**
+ * Loads the configured {@link Bridge} instance.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 16-May-2009
+ */
+public abstract class BridgeFactory
+{
+ private static Map<Object, Bridge> bridgeCache = new HashMap<Object, Bridge>();
+
+ /**
+ * 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();
+ return getBridgeInternal(null, props);
+ }
+
+ /**
+ * Get the cached instance of the bridge class that is configed through the system property {@link Bridge}.
+ * If there is no cached instance it creates a new instance.
+ */
+ public static Bridge getBridge(Object key)
+ {
+ Properties props = System.getProperties();
+ return getBridgeInternal(key, 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(Object key, Properties props)
+ {
+ String className = props.getProperty(Bridge.class.getName());
+ if (className == null)
+ throw new IllegalStateException("Cannot find property: " + Bridge.class.getName());
+
+ return getBridgeInternal(key, props);
+ }
+
+ private static Bridge getBridgeInternal(Object key, Properties props)
+ {
+ Bridge bridge = bridgeCache.get(key);
+ if (bridge == null)
+ {
+ String className = props.getProperty(Bridge.class.getName(), BasicBridge.class.getName());
+ bridge = (Bridge)Util.loadInstance(className, props);
+
+ if (key != null)
+ bridgeCache.put(key, bridge);
+ }
+ return bridge;
+ }
+}
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java (from rev 95821, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/HuskyCapability.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/HuskyCapability.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -0,0 +1,48 @@
+/*
+ * 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.testing;
+
+//$Id$
+
+import org.jboss.osgi.husky.runtime.Connector;
+import org.jboss.osgi.spi.capability.Capability;
+
+/**
+ * Adds the Husky testing capability to the {@link OSGiRuntime}
+ * under test.
+ *
+ * It is ignored if a Husky connector is already registered.
+ *
+ * Installed bundles: jboss-osgi-husky.jar
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class HuskyCapability extends Capability
+{
+ public HuskyCapability()
+ {
+ super(Connector.class.getName());
+
+ addBundle("bundles/jboss-osgi-husky.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java (from rev 95821, projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/husky/annotation/ProvideContext.java)
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java (rev 0)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/harness/src/main/java/org/jboss/osgi/testing/ProvideContext.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -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.testing;
+
+// $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.runtime.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
+{
+
+}
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/ContextTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.ProvideContext;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/MultipleMethodsTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.ProvideContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/java/org/jboss/test/osgi/husky/context/StaticContextTestCase.java 2009-10-30 13:05:42 UTC (rev 95824)
@@ -26,12 +26,12 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeNotNull;
-import org.jboss.osgi.husky.BridgeFactory;
-import org.jboss.osgi.husky.HuskyCapability;
-import org.jboss.osgi.husky.annotation.ProvideContext;
+import org.jboss.osgi.testing.BridgeFactory;
+import org.jboss.osgi.testing.HuskyCapability;
import org.jboss.osgi.testing.OSGiBundle;
import org.jboss.osgi.testing.OSGiRuntime;
import org.jboss.osgi.testing.OSGiTestHelper;
+import org.jboss.osgi.testing.ProvideContext;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Modified: projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd
===================================================================
--- projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd 2009-10-30 12:29:02 UTC (rev 95823)
+++ projects/jboss-osgi/projects/bundles/husky/trunk/testsuite/src/test/resources/context/context-basic.bnd 2009-10-30 13:05:42 UTC (rev 95824)
@@ -5,8 +5,6 @@
Export-Package: org.jboss.test.osgi.husky.context
Import-Package: \
- org.jboss.osgi.husky, \
- org.jboss.osgi.husky.annotation, \
org.jboss.osgi.spi.capability, \
org.jboss.osgi.testing, \
org.junit, \
14 years, 6 months