JBoss-OSGI SVN: r88423 - in projects/jboss-osgi/trunk: bundle/microcontainer/src/main/resources/META-INF and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 07:44:20 -0400 (Fri, 08 May 2009)
New Revision: 88423
Modified:
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
Log:
Fix unresolved constraint
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-08 11:33:07 UTC (rev 88422)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-08 11:44:20 UTC (rev 88423)
@@ -79,7 +79,8 @@
<!-- The Framework Management -->
<bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
- <property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=BundleContext" /></property>
+ <property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
</bean>
<bean name="BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-08 11:33:07 UTC (rev 88422)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-08 11:44:20 UTC (rev 88423)
@@ -519,6 +519,50 @@
</dependencies>
</profile>
+ <!--
+ Name: jboss510
+ Descr: Setup for jboss510 integration testing
+ -->
+ <profile>
+ <id>jboss510</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss510</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <!--
+ Name: jboss600
+ Descr: Setup for jboss600 integration testing
+ -->
+ <profile>
+ <id>jboss600</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss600</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 11:33:07 UTC (rev 88422)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 11:44:20 UTC (rev 88423)
@@ -29,6 +29,7 @@
org.jboss.osgi.jndi,
org.jboss.osgi.jmx,
org.jboss.osgi.microcontainer,
+ org.jboss.osgi.spi,
org.jboss.osgi.spi.logging,
org.jboss.osgi.spi.management,
17 years, 2 months
JBoss-OSGI SVN: r88421 - in projects/jboss-osgi/trunk: bundle/remotelog and 19 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 07:30:04 -0400 (Fri, 08 May 2009)
New Revision: 88421
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemotePackageAdmin.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/SomeService.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeService.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeServiceActivator.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/internal/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/deployer/
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/.classpath
projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/SomeInternal.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/FooMBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/META-INF/jbosgi36-jboss-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/jbosgi36.bnd
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
All fuctional tests migrated and ok in embedded and jbossas
Modified: projects/jboss-osgi/trunk/bundle/blueprint/.classpath
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/.classpath 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/bundle/blueprint/.classpath 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
- <classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
- <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
Modified: projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -96,6 +96,7 @@
org.apache.log4j,
org.jboss.logging,
org.jboss.mx.util;resolution:=optional,
+ org.jboss.osgi.spi,
org.jboss.osgi.spi.logging,
org.jboss.remoting;resolution:=optional,
org.jboss.remoting.*;resolution:=optional,
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -64,6 +64,7 @@
<!-- The Framework Management -->
<bean name="jboss.osgi:service=ManagedFramework" class="org.jboss.osgi.spi.management.ManagedFramework">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFramework.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -23,6 +23,9 @@
//$Id$
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import javax.management.MBeanServer;
@@ -31,6 +34,10 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.Constants;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.packageadmin.PackageAdmin;
/**
* The managed view of an OSGi Framework
@@ -44,12 +51,18 @@
final Logger log = Logger.getLogger(ManagedFramework.class);
private MBeanServer mbeanServer;
+ private BundleContext systemContext;
public void setMbeanServer(MBeanServer server)
{
this.mbeanServer = server;
}
+ public void setSystemContext(BundleContext systemContext)
+ {
+ this.systemContext = systemContext;
+ }
+
@SuppressWarnings("unchecked")
public ObjectName getBundle(String symbolicName)
{
@@ -77,19 +90,25 @@
return names;
}
- // Accept names like "jboss.osgi:bundle=*"
- static class IsBundleQueryExp implements QueryExp
+ public void refreshPackages(String[] symbolicNames)
{
- private static final long serialVersionUID = 1L;
-
- public boolean apply(ObjectName name)
+ ServiceReference sref = systemContext.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin service = (PackageAdmin)systemContext.getService(sref);
+
+ Bundle[] bundles = null;
+ if (symbolicNames != null)
{
- return name.getKeyProperty("bundle") != null;
+ List<String> nameList = Arrays.asList(symbolicNames);
+ Set<Bundle> bundleSet = new HashSet<Bundle>();
+ for (Bundle bundle : systemContext.getBundles())
+ {
+ if (nameList.contains(bundle.getSymbolicName()))
+ bundleSet.add(bundle);
+ }
+ bundles = new Bundle[bundleSet.size()];
+ bundleSet.toArray(bundles);
}
-
- public void setMBeanServer(MBeanServer server)
- {
- }
+ service.refreshPackages(bundles);
}
public void start()
@@ -104,4 +123,19 @@
log.warn("Cannot register: " + ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
}
}
+
+ // Accept names like "jboss.osgi:bundle=*"
+ static class IsBundleQueryExp implements QueryExp
+ {
+ private static final long serialVersionUID = 1L;
+
+ public boolean apply(ObjectName name)
+ {
+ return name.getKeyProperty("bundle") != null;
+ }
+
+ public void setMBeanServer(MBeanServer server)
+ {
+ }
+ }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/ManagedFrameworkMBean.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -47,4 +47,9 @@
* Get the installed bundle
*/
ObjectName getBundle(String symbolicName);
+
+ /**
+ * Refresh packages through the PackageAdmin service
+ */
+ void refreshPackages(String[] symbolicNames);
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemotePackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemotePackageAdmin.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemotePackageAdmin.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -0,0 +1,64 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemotePackageAdmin extends AbstractPackageAdmin
+{
+ private RemoteRuntime runtime;
+
+ public RemotePackageAdmin(RemoteRuntime runtime)
+ {
+ this.runtime = runtime;
+ }
+
+ @Override
+ public void refreshPackages(AbstractBundle[] bundles)
+ {
+ String[] bundleArr = null;
+ if (bundles != null)
+ {
+ bundleArr = new String[bundles.length];
+ for (int i=0; i < bundles.length; i++)
+ {
+ bundleArr[i] = bundles[i].getSymbolicName();
+ }
+ }
+ try
+ {
+ ManagedFrameworkMBean mbeanProxy = runtime.getMBeanProxy(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK);
+ mbeanProxy.refreshPackages(bundleArr);
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new IllegalStateException("Cannot refresh packages", ex);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemotePackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -37,7 +37,6 @@
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.framework.RemoteBundle;
import org.jboss.osgi.spi.framework.RemoteFramework;
import org.jboss.osgi.spi.framework.RemoteFrameworkException;
@@ -227,7 +226,7 @@
public AbstractPackageAdmin getPackageAdmin()
{
- throw new NotImplementedException();
+ return new RemotePackageAdmin(this);
}
private RemoteFramework getRemoteFramework() throws Exception
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -18,6 +18,14 @@
<properties>
</properties>
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.microcontainer</groupId>
+ <artifactId>jboss-aop-mc-int</artifactId>
+ </dependency>
+ </dependencies>
+
<!-- Build -->
<build>
<plugins>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -44,14 +44,14 @@
<!-- Please add alphabetically -->
- <!-- jbosgi36 -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi36-bundle.jar" files="${tests.resources.dir}/deployer/jbosgi36/jbosgi36.bnd" />
+ <!-- jbossas/jbosgi36 -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi36-bundle.jar" files="${tests.resources.dir}/jbossas/jbosgi36/jbosgi36.bnd" />
<jar jarfile="${tests.output.dir}/test-libs/jbosgi36-mbean.jar">
<fileset dir="${tests.classes.dir}">
- <include name="org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.class" />
- <include name="org/jboss/test/osgi/deployer/jbosgi36/mbean/FooMBean.class" />
+ <include name="org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.class" />
+ <include name="org/jboss/test/osgi/jbossas/jbosgi36/mbean/FooMBean.class" />
</fileset>
- <fileset dir="${tests.resources.dir}/deployer/jbosgi36">
+ <fileset dir="${tests.resources.dir}/jbossas/jbosgi36">
<include name="META-INF/jbosgi36-jboss-beans.xml" />
</fileset>
</jar>
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,116 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployer.jbosgi36;
-
-//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.JMXCapability;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.MicrocontainerCapability;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.deployer.jbosgi36.mbean.FooMBean;
-
-/**
- * [JBOSGI-36] Bundle classes leak into system classloader
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-36
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Feb-2009
- */
-public class OSGI36RemoteTestCase extends OSGiTest
-{
- static OSGiRuntime runtime;
-
- public static Test suite()
- {
- TestSetup setup = new OSGiTestSetup(OSGI36RemoteTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- runtime.addCapability(new JMXCapability());
- runtime.addCapability(new MicrocontainerCapability());
-
- runtime.deploy("jbosgi36-bundle.jar");
- runtime.deploy("jbosgi36-mbean.jar");
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.undeploy("jbosgi36-mbean.jar");
- runtime.undeploy("jbosgi36-bundle.jar");
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testAccessMBean() throws Exception
- {
- assertEquals("hello", getFooMBean().echo("hello"));
- }
-
- public void testAccessSomeService() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeService();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- public void testAccessSomeInternal() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeInternal();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- private FooMBean getFooMBean() throws MBeanProxyException
- {
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
- return foo;
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeService.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeService.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployer.jbosgi36.bundle;
-
-import org.jboss.test.osgi.deployer.jbosgi36.bundle.internal.SomeInternal;
-
-//$Id: SomeService.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-public class SomeService
-{
- public String doStuff()
- {
- return SomeInternal.class.getName();
- }
-}
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeServiceActivator.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeServiceActivator.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployer.jbosgi36.bundle;
-
-//$Id: SomeServiceActivator.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * A Service Activator
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Feb-2009
- */
-public class SomeServiceActivator implements BundleActivator
-{
- public void start(BundleContext context)
- {
- SomeService service = new SomeService();
- context.registerService(SomeService.class.getName(), service, null);
- }
-
- public void stop(BundleContext context)
- {
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -49,7 +49,7 @@
*/
public void testInstallStartX() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -57,6 +57,8 @@
bundleX.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
+
+ bundleX.uninstall();
}
finally
{
@@ -69,7 +71,7 @@
*/
public void testInstallXBeforeB() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -80,6 +82,9 @@
bundleB.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
}
finally
{
@@ -92,7 +97,7 @@
*/
public void testInstallBBeforeA() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -106,6 +111,10 @@
bundleA.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ bundleB.uninstall();
+ bundleX.uninstall();
}
finally
{
@@ -118,7 +127,7 @@
*/
public void testInstallBBeforeX() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
@@ -139,6 +148,9 @@
bundleB.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
}
finally
{
@@ -151,7 +163,7 @@
*/
public void testInstallABeforeB() throws Exception
{
- OSGiRuntime runtime = getDefaultRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
@@ -178,6 +190,10 @@
bundleA.start();
assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+
+ bundleA.uninstall();
+ bundleB.uninstall();
+ bundleX.uninstall();
}
finally
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -66,8 +66,11 @@
bundleB.start();
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
}
finally
{
@@ -96,7 +99,7 @@
bundleB.start();
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
// Uninstall X before B
@@ -128,7 +131,7 @@
bundleB.start();
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
// Uninstall X before B
@@ -156,7 +159,7 @@
bundleB.start();
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertTrue("Bundle resolved", + Bundle.RESOLVED == bundleX.getState() || Bundle.ACTIVE == bundleX.getState());
assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
bundleB.uninstall();
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/OSGI36TestCase.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbossas.jbosgi36;
+
+//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.RemoteRuntime;
+import org.jboss.test.osgi.jbossas.jbosgi36.mbean.FooMBean;
+
+/**
+ * [JBOSGI-36] Bundle classes leak into system classloader
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-36
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Feb-2009
+ */
+public class OSGI36TestCase extends OSGiTest
+{
+ static RemoteRuntime runtime;
+
+ public static Test suite()
+ {
+ TestSetup setup = new OSGiTestSetup(OSGI36TestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getRemoteRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new MicrocontainerCapability());
+
+ runtime.deploy("jbosgi36-bundle.jar");
+ runtime.deploy("jbosgi36-mbean.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.undeploy("jbosgi36-mbean.jar");
+ runtime.undeploy("jbosgi36-bundle.jar");
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testAccessMBean() throws Exception
+ {
+ assertEquals("hello", getFooMBean().echo("hello"));
+ }
+
+ public void testAccessSomeService() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeService();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ public void testAccessSomeInternal() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeInternal();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ private FooMBean getFooMBean() throws MBeanProxyException
+ {
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
+ return foo;
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/SomeService.java (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeService.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/SomeService.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/SomeService.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbossas.jbosgi36.bundle;
+
+import org.jboss.test.osgi.jbossas.jbosgi36.bundle.internal.SomeInternal;
+
+//$Id: SomeService.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+public class SomeService
+{
+ public String doStuff()
+ {
+ return SomeInternal.class.getName();
+ }
+}
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/internal)
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/ServiceActivator.java (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/SomeServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/ServiceActivator.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -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.test.osgi.jbossas.jbosgi36.bundle.internal;
+
+//$Id: SomeServiceActivator.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+import org.jboss.test.osgi.jbossas.jbosgi36.bundle.SomeService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Feb-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ public void start(BundleContext context)
+ {
+ SomeService service = new SomeService();
+ context.registerService(SomeService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/SomeInternal.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/bundle/internal/SomeInternal.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/bundle/internal/SomeInternal.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.deployer.jbosgi36.bundle.internal;
+package org.jboss.test.osgi.jbossas.jbosgi36.bundle.internal;
//$Id: SomeInternal.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean)
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -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.test.osgi.deployer.jbosgi36.mbean;
-
-//$Id: Foo.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
-
-@JMX (exposedInterface = FooMBean.class, name = "jboss.osgi:test=jbosgi36", registerDirectly = true)
-public class Foo implements FooMBean
-{
- public String echo(String msg)
- {
- return msg;
- }
-
- public String accessSomeService() throws ClassNotFoundException
- {
- ClassLoader loader = getClass().getClassLoader();
- loader.loadClass("org.jboss.test.osgi.deployer.jbosgi36.bundle.SomeService");
- return loader.toString();
- }
-
- public String accessSomeInternal() throws ClassNotFoundException
- {
- ClassLoader loader = getClass().getClassLoader();
- loader.loadClass("org.jboss.test.osgi.deployer.jbosgi36.bundle.internal.SomeInternal");
- return loader.toString();
- }
-}
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java (from rev 88419, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/Foo.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -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.test.osgi.jbossas.jbosgi36.mbean;
+
+import org.jboss.aop.microcontainer.aspects.jmx.JMX;
+
+//$Id: Foo.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+@JMX (exposedInterface = FooMBean.class, name = "jboss.osgi:test=jbosgi36", registerDirectly = true)
+public class Foo implements FooMBean
+{
+ public String echo(String msg)
+ {
+ return msg;
+ }
+
+ public String accessSomeService() throws ClassNotFoundException
+ {
+ ClassLoader loader = getClass().getClassLoader();
+ loader.loadClass("org.jboss.test.osgi.deployer.jbosgi36.bundle.SomeService");
+ return loader.toString();
+ }
+
+ public String accessSomeInternal() throws ClassNotFoundException
+ {
+ ClassLoader loader = getClass().getClassLoader();
+ loader.loadClass("org.jboss.test.osgi.deployer.jbosgi36.bundle.internal.SomeInternal");
+ return loader.toString();
+ }
+}
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/FooMBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/FooMBean.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbossas/jbosgi36/mbean/FooMBean.java 2009-05-08 11:30:04 UTC (rev 88421)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.deployer.jbosgi36.mbean;
+package org.jboss.test.osgi.jbossas.jbosgi36.mbean;
// $Id: FooMBean.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 11:30:04 UTC (rev 88421)
@@ -16,18 +16,34 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
+ org.apache.log4j, \
org.jboss.logging, \
+ org.jboss.net.protocol, \
org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.logging, \
org.jboss.osgi.spi.management, \
org.jboss.virtual, \
org.jboss.virtual.plugins.registry, \
org.jboss.virtual.plugins.context.jar, \
org.jboss.virtual.plugins.vfs.helpers, \
- org.jboss.net.protocol, \
- org.jboss.virtual.protocol
+ org.jboss.virtual.protocol, \
+ org.osgi.framework;version\=1.4, \
+ org.apache.log4j, \
+ org.jboss.util, \
+ org.jboss.util.id, \
+ org.jboss.util.threadpool, \
+ org.jboss.util.propertyeditor
+# These are needed by jboss-remoting
+# org.apache.log4j, \
+# org.jboss.util, \
+# org.jboss.util.id, \
+# org.jboss.util.threadpool, \
+# org.jboss.util.propertyeditor
+
# Bundles that need to be installed with the Framework automatically
-# org.jboss.osgi.spi.framework.autoInstall=
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
# Bundles that need to be started automatically
org.jboss.osgi.spi.framework.autoStart=\
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas (from rev 88418, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/deployer)
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/META-INF/jbosgi36-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/deployer/jbosgi36/META-INF/jbosgi36-jboss-beans.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/META-INF/jbosgi36-jboss-beans.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,6 +1,6 @@
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="Foo" class="org.jboss.test.osgi.deployer.jbosgi36.mbean.Foo"/>
+ <bean name="Foo" class="org.jboss.test.osgi.jbossas.jbosgi36.mbean.Foo"/>
</deployment>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/jbosgi36.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/deployer/jbosgi36/jbosgi36.bnd 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbossas/jbosgi36/jbosgi36.bnd 2009-05-08 11:30:04 UTC (rev 88421)
@@ -1,7 +1,7 @@
# bnd build -classpath target/test-classes -output target/test-libs/jbosgi36-bundle.jar src/test/resources/jbosgi36/jbosgi36.bnd
Bundle-SymbolicName: jbosgi36
-Bundle-Activator: org.jboss.test.osgi.deployer.jbosgi36.bundle.SomeServiceActivator
-Export-Package: org.jboss.test.osgi.deployer.jbosgi36.bundle
-Private-Package: org.jboss.test.osgi.deployer.jbosgi36.bundle.internal
+Bundle-Activator: org.jboss.test.osgi.jbossas.jbosgi36.bundle.internal.ServiceActivator
+Export-Package: org.jboss.test.osgi.jbossas.jbosgi36.bundle
+Private-Package: org.jboss.test.osgi.jbossas.jbosgi36.bundle.internal
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 11:27:33 UTC (rev 88420)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 11:30:04 UTC (rev 88421)
@@ -325,8 +325,7 @@
<configuration>
<excludes>
<!-- Exclude tests that require remote access -->
- <exclude>org/jboss/test/osgi/deployer/**</exclude>
- <exclude>org/jboss/test/osgi/**/*RemoteTestCase.java</exclude>
+ <exclude>org/jboss/test/osgi/jbossas/**</exclude>
</excludes>
</configuration>
</plugin>
@@ -335,6 +334,33 @@
</profile>
<!--
+ Name: runtime-tesing
+ Descr: Setup for runtime integration testing
+ -->
+ <profile>
+ <id>runtime-tesing</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>runtime</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <!-- Exclude tests that require jboss access -->
+ <exclude>org/jboss/test/osgi/jbossas/**</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <!--
Name: remote-testing
Descr: Setup for remote integration testing
-->
17 years, 2 months
JBoss-OSGI SVN: r88419 - in projects/jboss-osgi/trunk: bundle/blueprint/src and 26 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 06:12:51 -0400 (Fri, 08 May 2009)
New Revision: 88419
Added:
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/ServiceActivator.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteLogCapability.java
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/example-jmx.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/log/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java
Removed:
projects/jboss-osgi/trunk/bundle/blueprint/scripts/
projects/jboss-osgi/trunk/bundle/blueprint/src/test/
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/NotImplementedException.java
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogActivator.java
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/example/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/jmx-test.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/jndi-test.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleB.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/SomeBean.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogListener.java
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogEntry.java
projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogReaderServiceImpl.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/Foo.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/FooMBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/JMXTestService.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBeanMBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
All examples migrated and ok in embedded and jbossas
Modified: projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -24,147 +24,14 @@
<artifactId>jboss-osgi-spi</artifactId>
<version>${version}</version>
</dependency>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
-
- <!-- Provided Dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.naming</groupId>
- <artifactId>jnpserver</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- Bundle Dependencies -->
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>apache-xerces-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jaxb-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-common-core-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-logging</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-microcontainer</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jbossxb-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <!-- Test Dependencies -->
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-runtime-felix</artifactId>
- <version>${version}</version>
- <scope>test</scope>
- </dependency>
</dependencies>
+ <!-- Build -->
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <executions>
- <execution>
- <id>bundles</id>
- <phase>test-compile</phase>
- <goals>
- <goal>directory-single</goal>
- </goals>
- <configuration>
- <finalName>test-libs</finalName>
- <ignoreDirFormatExtensions>true</ignoreDirFormatExtensions>
- <appendAssemblyId>false</appendAssemblyId>
- <descriptors>
- <descriptor>scripts/assembly-bundles.xml</descriptor>
- </descriptors>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <id>build-test-jars</id>
- <phase>test-compile</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <tasks>
- <property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
- <property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-test-jars.xml" />
- </tasks>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
</build>
<!-- Profiles -->
<profiles>
-
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/bundle/remotelog/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/pom.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -78,7 +78,7 @@
<configuration>
<instructions>
<Bundle-SymbolicName>${artifactId}</Bundle-SymbolicName>
- <Bundle-Activator>org.jboss.osgi.service.remotelog.RemoteLogActivator</Bundle-Activator>
+ <Bundle-Activator>org.jboss.osgi.service.remotelog.internal.ServiceActivator</Bundle-Activator>
<Export-Package>org.jboss.osgi.service.remotelog;version=${version}</Export-Package>
<Import-Package>
org.osgi.framework,
Deleted: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/NotImplementedException.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/NotImplementedException.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/NotImplementedException.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,43 +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.service.remotelog;
-
-// $Id$
-
-/**
- * A RuntimeException that should be thrown for unimplemented features
- *
- * @author thomas.diesler(a)jboss.com
- * @since 18-Jun-2008
- */
-@SuppressWarnings("serial")
-public class NotImplementedException extends RuntimeException
-{
- public NotImplementedException()
- {
- }
-
- public NotImplementedException(String message)
- {
- super(message);
- }
-}
Deleted: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogActivator.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogActivator.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,109 +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.service.remotelog;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.service.remotelog.internal.RemoteLogReaderServiceImpl;
-import org.jboss.osgi.spi.logging.RemoteLogReaderService;
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class RemoteLogActivator implements BundleActivator
-{
- public static final String REMOTE_LOG_SENDER = "org.jboss.osgi.service.remote.log.sender";
- public static final String REMOTE_LOG_READER = "org.jboss.osgi.service.remote.log.reader";
- public static final String REMOTE_LOG_HOST = "org.jboss.osgi.service.remote.log.host";
- public static final String REMOTE_LOG_PORT = "org.jboss.osgi.service.remote.log.port";
-
- private Boolean isReader = Boolean.FALSE;
- private Boolean isSender = Boolean.FALSE;
- private RemoteLogReaderServiceImpl readerService;
- private RemoteLogListener remoteSender;
-
- public void start(BundleContext context)
- {
- String readerProp = context.getProperty(REMOTE_LOG_READER);
- String senderProp = context.getProperty(REMOTE_LOG_SENDER);
- String hostProp = context.getProperty(REMOTE_LOG_HOST);
- String portProp = context.getProperty(REMOTE_LOG_PORT);
-
- if (readerProp != null)
- isReader = Boolean.valueOf(readerProp);
-
- if (senderProp != null)
- isSender = Boolean.valueOf(senderProp);
-
- String host = hostProp != null ? hostProp : "localhost";
- String port = portProp != null ? portProp : "5400";
-
- Properties props = new Properties();
- props.put(REMOTE_LOG_HOST, host);
- props.put(REMOTE_LOG_PORT, port);
-
- ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
- try
- {
- Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
-
- if (isReader == true)
- {
- readerService = new RemoteLogReaderServiceImpl(context, props);
- context.registerService(RemoteLogReaderService.class.getName(), readerService, props);
- readerService.start();
- }
-
- if (isSender == true)
- {
- remoteSender = new RemoteLogListener(context, props);
- remoteSender.start();
- }
- }
- finally
- {
- Thread.currentThread().setContextClassLoader(ctxLoader);
- }
- }
-
- public void stop(BundleContext context) throws Exception
- {
- if (isReader == true)
- {
- readerService.stop();
- readerService = null;
- }
-
- if (isSender == true)
- {
- remoteSender.stop();
- remoteSender = null;
- }
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogListener.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogListener.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogListener.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -25,6 +25,7 @@
import java.util.Properties;
+import org.jboss.osgi.service.remotelog.internal.ServiceActivator;
import org.jboss.osgi.service.remotelog.internal.RemoteLogEntry;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
@@ -53,8 +54,8 @@
public RemoteLogListener(BundleContext context, Properties props)
{
this.context = context;
- this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
- this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
+ this.host = props.getProperty(ServiceActivator.REMOTE_LOG_HOST);
+ this.port = new Integer(props.getProperty(ServiceActivator.REMOTE_LOG_PORT));
// Get the remoting client
try
Modified: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogEntry.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogEntry.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogEntry.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -32,7 +32,7 @@
import java.util.Dictionary;
import java.util.Enumeration;
-import org.jboss.osgi.service.remotelog.NotImplementedException;
+import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
Modified: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogReaderServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogReaderServiceImpl.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/RemoteLogReaderServiceImpl.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -30,8 +30,7 @@
import javax.management.MBeanServer;
-import org.jboss.osgi.service.remotelog.NotImplementedException;
-import org.jboss.osgi.service.remotelog.RemoteLogActivator;
+import org.jboss.osgi.spi.NotImplementedException;
import org.jboss.osgi.spi.logging.RemoteLogReaderService;
import org.jboss.remoting.InvocationRequest;
import org.jboss.remoting.InvokerLocator;
@@ -59,8 +58,8 @@
public RemoteLogReaderServiceImpl(BundleContext context, Properties props)
{
- this.host = props.getProperty(RemoteLogActivator.REMOTE_LOG_HOST);
- this.port = new Integer(props.getProperty(RemoteLogActivator.REMOTE_LOG_PORT));
+ this.host = props.getProperty(ServiceActivator.REMOTE_LOG_HOST);
+ this.port = new Integer(props.getProperty(ServiceActivator.REMOTE_LOG_PORT));
}
public void addLogListener(LogListener listener)
Copied: projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/ServiceActivator.java (from rev 88408, projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/RemoteLogActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/remotelog/src/main/java/org/jboss/osgi/service/remotelog/internal/ServiceActivator.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,109 @@
+/*
+ * 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.service.remotelog.internal;
+
+//$Id$
+
+import java.util.Properties;
+
+import org.jboss.osgi.service.remotelog.RemoteLogListener;
+import org.jboss.osgi.spi.logging.RemoteLogReaderService;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ public static final String REMOTE_LOG_SENDER = "org.jboss.osgi.service.remote.log.sender";
+ public static final String REMOTE_LOG_READER = "org.jboss.osgi.service.remote.log.reader";
+ public static final String REMOTE_LOG_HOST = "org.jboss.osgi.service.remote.log.host";
+ public static final String REMOTE_LOG_PORT = "org.jboss.osgi.service.remote.log.port";
+
+ private Boolean isReader = Boolean.FALSE;
+ private Boolean isSender = Boolean.FALSE;
+ private RemoteLogReaderServiceImpl readerService;
+ private RemoteLogListener remoteSender;
+
+ public void start(BundleContext context)
+ {
+ String readerProp = context.getProperty(REMOTE_LOG_READER);
+ String senderProp = context.getProperty(REMOTE_LOG_SENDER);
+ String hostProp = context.getProperty(REMOTE_LOG_HOST);
+ String portProp = context.getProperty(REMOTE_LOG_PORT);
+
+ if (readerProp != null)
+ isReader = Boolean.valueOf(readerProp);
+
+ if (senderProp != null)
+ isSender = Boolean.valueOf(senderProp);
+
+ String host = hostProp != null ? hostProp : "localhost";
+ String port = portProp != null ? portProp : "5400";
+
+ Properties props = new Properties();
+ props.put(REMOTE_LOG_HOST, host);
+ props.put(REMOTE_LOG_PORT, port);
+
+ ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+ try
+ {
+ Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
+ if (isReader == true)
+ {
+ readerService = new RemoteLogReaderServiceImpl(context, props);
+ context.registerService(RemoteLogReaderService.class.getName(), readerService, props);
+ readerService.start();
+ }
+
+ if (isSender == true)
+ {
+ remoteSender = new RemoteLogListener(context, props);
+ remoteSender.start();
+ }
+ }
+ finally
+ {
+ Thread.currentThread().setContextClassLoader(ctxLoader);
+ }
+ }
+
+ public void stop(BundleContext context) throws Exception
+ {
+ if (isReader == true)
+ {
+ readerService.stop();
+ readerService = null;
+ }
+
+ if (isSender == true)
+ {
+ remoteSender.stop();
+ remoteSender = null;
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -98,24 +98,23 @@
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
+ super.startLogEntryTracking(logEntryCache);
+
// Track the LogReaderService to add the LogEntryCache as LogListener
ServiceTracker tracker = new ServiceTracker(getBundleContext(), LogReaderService.class.getName(), null)
{
@Override
public Object addingService(ServiceReference sref)
{
- LogReaderService service = (LogReaderService)super.addingService(sref);
- service.addLogListener(logEntryCache);
- return service;
+ LogReaderService logReaderService = (LogReaderService)super.addingService(sref);
+ logReaderService.addLogListener(logEntryCache);
+ setLogReaderService(logReaderService);
+ return logReaderService;
}
};
tracker.open();
}
- public void stopLogEntryTracking()
- {
- }
-
@Override
public void shutdown()
{
@@ -124,7 +123,7 @@
bootProvider.getFramework().stop();
}
- private BundleContext getBundleContext()
+ public BundleContext getBundleContext()
{
OSGiBootstrapProvider bootProvider = getTestHelper().getBootstrapProvider();
OSGiFramework framework = bootProvider.getFramework();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -22,10 +22,12 @@
package org.jboss.osgi.spi.testing;
import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxyException;
import org.osgi.framework.BundleException;
/**
@@ -56,6 +58,8 @@
InitialContext getInitialContext() throws NamingException;
+ <T> T getMBeanProxy(Class<T> mbeanInterface, ObjectName objectName) throws MBeanProxyException;
+
MBeanServerConnection getMBeanServer();
String getServerHost();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -27,7 +27,6 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
/**
* An OSGi Test Helper
@@ -76,7 +75,7 @@
return runtime;
}
- public OSGiRuntimeImpl getEmbeddedRuntime()
+ public EmbeddedRuntime getEmbeddedRuntime()
{
return new EmbeddedRuntime(this);
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteLogCapability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteLogCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteLogCapability.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -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.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class RemoteLogCapability extends Capability
+{
+ public RemoteLogCapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.jboss.osgi.service.remote.log.reader", "true");
+ props.setProperty("org.jboss.osgi.remote.log.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.remote.log.port", "5400");
+
+ addBundle("bundles/jboss-osgi-remotelog.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteLogCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -42,13 +42,18 @@
import org.jboss.osgi.spi.framework.RemoteFramework;
import org.jboss.osgi.spi.framework.RemoteFrameworkException;
import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.logging.RemoteLogReaderService;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
+import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.log.LogReaderService;
+import org.osgi.util.tracker.ServiceTracker;
/**
* [TODO]
@@ -61,6 +66,10 @@
private MBeanServerConnection mbeanServer;
private ManagedFrameworkMBean managedFramework;
private Set<Class<?>> ignoredCaps = new HashSet<Class<?>>();
+
+ // Needed for remote logging
+ private EmbeddedRuntime embeddedRuntime;
+ private RemoteLogCapability remoteLogCapability;
public RemoteRuntime(OSGiTestHelper helper)
{
@@ -119,16 +128,73 @@
public AbstractBundle[] getBundles()
{
- throw new NotImplementedException();
+ try
+ {
+ Set<RemoteBundle> remoteBundles = getRemoteFramework().getBundles();
+ Set<AbstractBundle> bundles = new HashSet<AbstractBundle>();
+ for (RemoteBundle remoteBundle : remoteBundles)
+ bundles.add(new RemoteBundleBadName(this, remoteBundle, null));
+
+ AbstractBundle[] bundleArr = new AbstractBundle[bundles.size()];
+ bundles.toArray(bundleArr);
+
+ return bundleArr;
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException("Cannot obtain remote bundles", ex);
+ }
}
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
- throw new NotImplementedException();
+ super.startLogEntryTracking(logEntryCache);
+
+ try
+ {
+ remoteLogCapability = new RemoteLogCapability();
+ addCapability(remoteLogCapability);
+
+ embeddedRuntime = getTestHelper().getEmbeddedRuntime();
+ embeddedRuntime.addCapability(remoteLogCapability);
+
+ // Track the RemoteLogReaderService to add the LogEntryCache as LogListener
+ BundleContext context = embeddedRuntime.getBundleContext();
+ ServiceTracker tracker = new ServiceTracker(context, RemoteLogReaderService.class.getName(), null)
+ {
+ @Override
+ public Object addingService(ServiceReference sref)
+ {
+ LogReaderService logReaderService = (LogReaderService)super.addingService(sref);
+ logReaderService.addLogListener(logEntryCache);
+ setLogReaderService(logReaderService);
+ return logReaderService;
+ }
+ };
+ tracker.open();
+ }
+ catch (BundleException ex)
+ {
+ throw new IllegalStateException("Cannot start log entry tracking", ex);
+ }
}
+ @Override
public void stopLogEntryTracking()
{
+ if (remoteLogCapability != null)
+ {
+ removeCapability(remoteLogCapability);
+ remoteLogCapability = null;
+ }
+
+ if (embeddedRuntime != null)
+ {
+ embeddedRuntime.shutdown();
+ embeddedRuntime = null;
+ }
+
+ super.stopLogEntryTracking();
}
public MBeanServerConnection getMBeanServer()
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -31,11 +31,15 @@
import javax.management.ObjectName;
import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.Capability;
import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
import org.osgi.framework.BundleException;
+import org.osgi.service.log.LogReaderService;
/**
* [TODO]
@@ -51,7 +55,10 @@
private OSGiTestHelper helper;
private Map<String, AbstractBundle> bundles = new HashMap<String, AbstractBundle>();
private List<Capability> capabilities = new ArrayList<Capability>();
+ private LogReaderService logReaderService;
+ private LogEntryCache logEntryCache;
+
public OSGiRuntimeImpl(OSGiTestHelper helper)
{
this.helper = helper;
@@ -62,6 +69,16 @@
return helper;
}
+ protected void setLogReaderService(LogReaderService logReaderService)
+ {
+ this.logReaderService = logReaderService;
+ }
+
+ protected LogReaderService getLogReaderService()
+ {
+ return logReaderService;
+ }
+
public void addCapability(Capability capability) throws BundleException
{
for (String location : capability.getBundles())
@@ -95,8 +112,25 @@
}
}
+ public void startLogEntryTracking(LogEntryCache logEntryCache)
+ {
+ this.logEntryCache = logEntryCache;
+ }
+
+ public void stopLogEntryTracking()
+ {
+ if (logReaderService != null && logEntryCache != null)
+ {
+ logReaderService.removeLogListener(logEntryCache);
+ logReaderService = null;
+ logEntryCache = null;
+ }
+ }
+
public void shutdown()
{
+ stopLogEntryTracking();
+
while (capabilities.size() > 0)
{
Capability capability = capabilities.get(0);
@@ -122,6 +156,11 @@
getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
}
+ public <T> T getMBeanProxy(Class<T> mbeanInterface, ObjectName objectName) throws MBeanProxyException
+ {
+ return MBeanProxy.get(mbeanInterface, objectName, getMBeanServer());
+ }
+
public String getServerHost()
{
return System.getProperty("jboss.bind.address", "localhost");
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -18,89 +18,6 @@
<properties>
</properties>
- <!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-runtime-deployer</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- </dependency>
-
- <!-- Bundle Dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.http.jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-logging</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-remotelog</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
<!-- Build -->
<build>
<plugins>
@@ -150,7 +67,7 @@
<tasks>
<property name="maven.runtime.classpath" refid="maven.runtime.classpath" />
<property name="tests.output.dir" value="${project.build.directory}" />
- <ant antfile="scripts/antrun-example-jars.xml" />
+ <ant antfile="scripts/antrun-test-jars.xml" />
</tasks>
</configuration>
</execution>
Deleted: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,55 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ============================================================ -->
-<!-- JBoss, the OpenSource J2EE webOS -->
-<!-- Distributable under LGPL license. -->
-<!-- See terms of license at http://www.gnu.org. -->
-<!-- ============================================================ -->
-
-<!-- $Id: antrun-example-jars.xml 87329 2009-04-15 10:34:21Z thomas.diesler(a)jboss.com $ -->
-
-<project default="build-example-jars">
-
- <description>OSGi test archive builder</description>
-
- <!-- ================================================================== -->
- <!-- Init -->
- <!-- ================================================================== -->
-
- <target name="init">
-
- <!-- Property override when not called from maven -->
- <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
- <property name="tests.output.dir" value="${basedir}/../target" />
-
- <mkdir dir="${tests.output.dir}/test-libs/example" />
- <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
- <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
-
- <taskdef resource="aQute/bnd/ant/taskdef.properties">
- <classpath>
- <pathelement path="${maven.runtime.classpath}" />
- </classpath>
- </taskdef>
-
- </target>
-
- <!-- ================================================================== -->
- <!-- Building -->
- <!-- ================================================================== -->
-
- <target name="build-example-jars" depends="init" description="Build the test deployments">
-
- <!-- Please add alphabetically -->
-
- <!-- example/http -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example/example-http.jar" files="${tests.resources.dir}/example/http/example-http.bnd" />
-
- <!-- example/log -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example/example-log.jar" files="${tests.resources.dir}/example/log/example-log.bnd" />
-
- <!-- Please add alphabetically -->
-
- </target>
-
-</project>
Copied: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml (from rev 88417, projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-test-jars.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- ============================================================ -->
+<!-- JBoss, the OpenSource J2EE webOS -->
+<!-- Distributable under LGPL license. -->
+<!-- See terms of license at http://www.gnu.org. -->
+<!-- ============================================================ -->
+
+<!-- $Id: antrun-example-jars.xml 87329 2009-04-15 10:34:21Z thomas.diesler(a)jboss.com $ -->
+
+<project default="build-test-jars">
+
+ <description>OSGi test archive builder</description>
+
+ <!-- ================================================================== -->
+ <!-- Init -->
+ <!-- ================================================================== -->
+
+ <target name="init">
+
+ <!-- Property override when not called from maven -->
+ <property name="maven.runtime.classpath" value="/usr/java/bnd.jar" />
+ <property name="tests.output.dir" value="${basedir}/../target" />
+
+ <mkdir dir="${tests.output.dir}/test-libs" />
+ <property name="tests.classes.dir" value="${tests.output.dir}/test-classes" />
+ <property name="tests.resources.dir" value="${tests.output.dir}/test-classes" />
+
+ <taskdef resource="aQute/bnd/ant/taskdef.properties">
+ <classpath>
+ <pathelement path="${maven.runtime.classpath}" />
+ </classpath>
+ </taskdef>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!-- Building -->
+ <!-- ================================================================== -->
+
+ <target name="build-test-jars" depends="init" description="Build the test deployments">
+
+ <!-- Please add alphabetically -->
+
+ <!-- http -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-http.jar" files="${tests.resources.dir}/http/example-http.bnd" />
+
+ <!-- jmx -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-jmx.jar" files="${tests.resources.dir}/jmx/example-jmx.bnd" />
+
+ <!-- jndi -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-jndi.jar" files="${tests.resources.dir}/jndi/example-jndi.bnd" />
+
+ <!-- log -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-log.jar" files="${tests.resources.dir}/log/example-log.bnd" />
+
+ <!-- mcservice -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleA.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleA.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example-mcservice-bundleB.jar" files="${tests.resources.dir}/mcservice/example-mcservice-bundleB.bnd" />
+
+ <!-- Please add alphabetically -->
+
+ </target>
+
+</project>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -15,14 +15,21 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <include>*:apache-xerces-bundle:jar</include>
+ <include>*:jaxb-bundle:jar</include>
+ <include>*:jboss-common-core-bundle:jar</include>
+ <include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
+ <include>*:jboss-osgi-logging:jar</include>
+ <include>*:jboss-osgi-microcontainer:jar</include>
+ <include>*:jboss-osgi-remotelog:jar</include>
+ <include>*:jbossxb-bundle:jar</include>
<include>*:org.apache.felix.configadmin:jar</include>
<include>*:org.apache.felix.http.jetty:jar</include>
<include>*:org.apache.felix.log:jar</include>
<include>*:org.apache.felix.metatype:jar</include>
<include>*:org.osgi.compendium:jar</include>
- <include>*:jboss-osgi-common:jar</include>
- <include>*:jboss-osgi-logging:jar</include>
- <include>*:jboss-osgi-remotelog:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
<scope>provided</scope>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -59,8 +59,11 @@
runtime = getDefaultRuntime();
runtime.addCapability(new ConfigAdminCapability());
runtime.addCapability(new HttpCapability());
+
Thread.sleep(500);
- testBundle = runtime.installBundle("example/example-http.jar");
+
+ testBundle = runtime.installBundle("example-http.jar");
+ testBundle.start();
}
@Override
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/JMXTestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.jmx;
+
+//$Id: JMXTestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler(a)jboss.com $
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.test.osgi.example.jmx.bundle.FooMBean;
+
+/**
+ * A test that deployes a bundle that registeres an MBean
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Feb-2009
+ */
+public class JMXTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle bundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+
+ bundle = runtime.installBundle("example-jmx.jar");
+ bundle.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ bundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testMBeanAccess() throws Exception
+ {
+ ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, runtime.getMBeanServer());
+ assertEquals("hello", foo.echo("hello"));
+ }
+
+ public void testRMIAdaptor() throws Exception
+ {
+ // Lookup the MBeanServerConnection
+ InitialContext iniCtx = runtime.getInitialContext();
+ MBeanServerConnection rmiAdaptor = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+
+ // Access the MBean through the MBeanServerConnection
+ ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, rmiAdaptor);
+ assertEquals("hello", foo.echo("hello"));
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/Foo.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/Foo.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/Foo.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.jmx.bundle;
+package org.jboss.test.osgi.example.jmx.bundle;
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/FooMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/FooMBean.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/FooMBean.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.jmx.bundle;
+package org.jboss.test.osgi.example.jmx.bundle;
//$Id$
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/JMXTestService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/JMXTestService.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.jmx.bundle;
+package org.jboss.test.osgi.example.jmx.bundle;
//$Id$
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/ServiceActivator.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jmx/bundle/ServiceActivator.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.jmx.bundle;
+package org.jboss.test.osgi.example.jmx.bundle;
//$Id$
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/JNDITestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.jndi;
+
+//$Id: JNDITestCase.java 88356 2009-05-07 13:13:26Z thomas.diesler(a)jboss.com $
+
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.osgi.framework.Bundle;
+
+/**
+ * A test that deployes a bundle that binds a String to JNDI
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JNDITestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testJNDIAccess() throws Exception
+ {
+ AbstractBundle bundle = runtime.installBundle("example-jndi.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+
+ InitialContext iniCtx = runtime.getInitialContext();
+ String lookup = (String)iniCtx.lookup("test/Foo");
+ assertEquals("JNDI bound String expected", "Bar", lookup);
+
+ // Uninstall should unbind the object
+ bundle.uninstall();
+
+ try
+ {
+ iniCtx.lookup("test/Foo");
+ fail("NameNotFoundException expected");
+ }
+ catch (NameNotFoundException ex)
+ {
+ // expected
+ }
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle/ServiceActivator.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/jndi/bundle/ServiceActivator.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.jndi.bundle;
+package org.jboss.test.osgi.example.jndi.bundle;
//$Id$
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -59,14 +59,14 @@
@Override
protected void tearDown() throws Exception
{
- runtime.stopLogEntryTracking();
+ runtime.shutdown();
super.tearDown();
}
public void testLogEntryFilter() throws Exception
{
// Install and start the test bundle
- AbstractBundle bundleA = runtime.installBundle("example/example-log.jar");
+ AbstractBundle bundleA = runtime.installBundle("example-log.jar");
bundleA.start();
// Verify that the bundle is active
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MicrocontainerTestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,125 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.microcontainer;
+
+//$Id$
+
+import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL;
+import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
+import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
+import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+
+import java.util.List;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+
+/**
+ * A test that checks whether the MicrocontainerService can be accessed
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Feb-2009
+ */
+public class MicrocontainerTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new MicrocontainerCapability());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testServiceAccess() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
+ List<String> registeredBeans = mcService.getRegisteredBeans();
+ assertTrue("BundleContext registered with MC", registeredBeans.contains(BEAN_SYSTEM_BUNDLE_CONTEXT));
+ assertTrue("MBeanServer registered with MC", registeredBeans.contains(BEAN_MBEAN_SERVER));
+ assertTrue("Kernel registered with MC", registeredBeans.contains(BEAN_KERNEL));
+ }
+
+ /**
+ * Test whether the bundle can be deployed through the MicrocontainerServiceMBean
+ */
+ public void testBundleDeployment() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
+ mcService.deploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
+
+ ManagedFrameworkMBean frameworkMBean = runtime.getMBeanProxy(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK);
+ Set<ObjectName> bundles = frameworkMBean.getBundles();
+ assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=example-mcservice-bundleA") > 0);
+
+ mcService.undeploy(getTestArchiveURL("example-mcservice-bundleA.jar"));
+}
+
+ public void testBeansDeployment() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = runtime.getMBeanProxy(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE);
+ mcService.deploy(getTestArchiveURL("example-mcservice-bundleB.jar"));
+
+ ManagedFrameworkMBean frameworkMBean = runtime.getMBeanProxy(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK);
+ Set<ObjectName> bundles = frameworkMBean.getBundles();
+ assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=example-mcservice-bundleB") > 0);
+
+ // Check whether the bean is registered
+ List<String> registeredBeans = mcService.getRegisteredBeans();
+ assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
+
+ mcService.undeploy(getTestArchiveURL("example-mcservice-bundleB.jar"));
+
+ // Check whether the bean is unregistered
+ registeredBeans = mcService.getRegisteredBeans();
+ assertFalse("SomeBean unregistered", registeredBeans.contains("SomeBean"));
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleA)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleA/ServiceActivator.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/ServiceActivator.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.mcservice.bundleA;
+package org.jboss.test.osgi.example.microcontainer.bundleA;
//$Id$
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleA/SomeService.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleA/SomeService.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.mcservice.bundleA;
+package org.jboss.test.osgi.example.microcontainer.bundleA;
//$Id$
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBean.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBean.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.mcservice.bundleB;
+package org.jboss.test.osgi.example.microcontainer.bundleB;
//$Id$
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBeanMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBeanMBean.java 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundleB/SomeBeanMBean.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.blueprint.mcservice.bundleB;
+package org.jboss.test.osgi.example.microcontainer.bundleB;
//$Id$
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/http (from rev 88408, projects/jboss-osgi/trunk/testsuite/example/src/test/resources/example/http)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 10:12:51 UTC (rev 88419)
@@ -16,17 +16,31 @@
# Extra System Packages
org.osgi.framework.system.packages.extra=\
+ org.apache.log4j, \
org.jboss.logging, \
org.jboss.net.protocol, \
org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.logging, \
org.jboss.osgi.spi.management, \
org.jboss.virtual, \
org.jboss.virtual.plugins.registry, \
org.jboss.virtual.plugins.context.jar, \
org.jboss.virtual.plugins.vfs.helpers, \
org.jboss.virtual.protocol, \
- org.osgi.framework;version\=1.4
+ org.osgi.framework;version\=1.4, \
+ org.apache.log4j, \
+ org.jboss.util, \
+ org.jboss.util.id, \
+ org.jboss.util.threadpool, \
+ org.jboss.util.propertyeditor
+# These are needed by jboss-remoting
+# org.apache.log4j, \
+# org.jboss.util, \
+# org.jboss.util.id, \
+# org.jboss.util.threadpool, \
+# org.jboss.util.propertyeditor
+
# Bundles that need to be installed with the Framework automatically
org.jboss.osgi.spi.framework.autoInstall=\
file://${test.archive.directory}/bundles/org.osgi.compendium.jar
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jmx)
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/example-jmx.bnd (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jmx/jmx-test.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/example-jmx.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/example-jmx.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example-jmx.jar src/test/resources/jmx/example-jmx.bnd
+
+Bundle-SymbolicName: example-jmx
+Bundle-Activator: org.jboss.test.osgi.example.jmx.bundle.ServiceActivator
+Export-Package: org.jboss.test.osgi.example.jmx.bundle
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/jmx-test.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jmx/jmx-test.bnd 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jmx/jmx-test.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jmx-test.jar src/test/resources/jmx/jmx-test.bnd
-
-Bundle-SymbolicName: jmx-test
-Bundle-Activator: org.jboss.test.osgi.blueprint.jmx.bundle.ServiceActivator
-Export-Package: org.jboss.test.osgi.blueprint.jmx.bundle
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi)
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi/jndi-test.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/example-jndi.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jndi-test.jar src/test/resources/jndi/jndi-test.bnd
+
+Bundle-SymbolicName: example-jndi
+Bundle-Activator: org.jboss.test.osgi.example.jndi.bundle.ServiceActivator
+Export-Package: org.jboss.test.osgi.example.jndi.bundle
+Import-Package: javax.naming, org.osgi.framework, org.jboss.osgi.jndi
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/jndi-test.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi/jndi-test.bnd 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi/jndi-test.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jndi-test.jar src/test/resources/jndi/jndi-test.bnd
-
-Bundle-SymbolicName: jndi-test
-Bundle-Activator: org.jboss.test.osgi.blueprint.jndi.bundle.ServiceActivator
-Export-Package: org.jboss.test.osgi.blueprint.jndi.bundle
-Import-Package: javax.naming, org.osgi.framework, org.jboss.osgi.jndi
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/log (from rev 88408, projects/jboss-osgi/trunk/testsuite/example/src/test/resources/example/log)
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice)
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/META-INF/mcservice-jboss-beans.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,6 +1,6 @@
<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
- <bean name="SomeBean" class="org.jboss.test.osgi.blueprint.mcservice.bundleB.SomeBean">
+ <bean name="SomeBean" class="org.jboss.test.osgi.example.microcontainer.bundleB.SomeBean">
<property name="mbeanServer"><inject bean="jboss.osgi:service=MBeanServer"/></property>
</bean>
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleA.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleA.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/example-mcservice-bundleA.jar src/test/resources/mcservice/example-mcservice-bundleA.bnd
+
+Bundle-SymbolicName: example-mcservice-bundleA
+Bundle-Activator: org.jboss.test.osgi.example.microcontainer.bundleA.ServiceActivator
+Export-Package: org.jboss.test.osgi.example.microcontainer.bundleA
+Import-Package: org.jboss.osgi.microcontainer, org.osgi.framework
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/example-mcservice-bundleB.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,6 @@
+# bnd build -classpath target/test-classes -output target/test-libs/mcservice-bundleB.jar src/test/resources/mcservice/mcservice-bundleB.bnd
+
+Bundle-SymbolicName: example-mcservice-bundleB
+Export-Package: org.jboss.test.osgi.example.microcontainer.bundleB
+Import-Package: javax.management
+Include-Resource: META-INF/mcservice-jboss-beans.xml=META-INF/mcservice-jboss-beans.xml
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleA.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleA.bnd 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleA.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/mcservice-bundleA.jar src/test/resources/mcservice/mcservice-bundleA.bnd
-
-Bundle-SymbolicName: mcservice-bundleA
-Bundle-Activator: org.jboss.test.osgi.blueprint.mcservice.bundleA.ServiceActivator
-Export-Package: org.jboss.test.osgi.blueprint.mcservice.bundleA
-Import-Package: org.jboss.osgi.microcontainer, org.osgi.framework
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd 2009-05-08 05:54:51 UTC (rev 88408)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/mcservice/mcservice-bundleB.bnd 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,6 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/mcservice-bundleB.jar src/test/resources/mcservice/mcservice-bundleB.bnd
-
-Bundle-SymbolicName: mcservice-bundleB
-Export-Package: org.jboss.test.osgi.blueprint.mcservice.bundleB
-Import-Package: javax.management
-Include-Resource: META-INF/mcservice-jboss-beans.xml=META-INF/mcservice-jboss-beans.xml
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -18,115 +18,6 @@
<properties>
</properties>
- <!-- Dependencies -->
- <dependencies>
- <dependency>
- <groupId>biz.aQute</groupId>
- <artifactId>bnd</artifactId>
- </dependency>
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-runtime-deployer</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.microcontainer</groupId>
- <artifactId>jboss-aop-mc-int</artifactId>
- </dependency>
-
- <!-- Bundle Dependencies -->
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.configadmin</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.http.jetty</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.log</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.metatype</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>apache-xerces-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jaxb-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-common-core-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jmx</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-jndi</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-logging</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-microcontainer</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-remotelog</artifactId>
- <version>${version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jbossxb-bundle</artifactId>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
<!-- Build -->
<build>
<plugins>
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java (from rev 88408, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BundleTestCase.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -0,0 +1,143 @@
+/*
+ * 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.
+ */
+
+
+//$Id$
+package org.jboss.test.osgi.bootstrap;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * Test OSGi System bundle access
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class BundleTestCase extends OSGiTest
+{
+ public void testApacheXercesBundle() throws BundleException
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ public void testJAXBBundle() throws BundleException
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/jaxb-bundle.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ public void testJBossCommonCoreBundle() throws BundleException
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ public void testJBossXBBundle() throws BundleException
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle = runtime.installBundle("bundles/jaxb-bundle.jar");
+ bundle = runtime.installBundle("bundles/jbossxb-bundle.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ public void testJNDIBundle() throws BundleException
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-osgi-jndi.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ public void testJMXBundle() throws Exception
+ {
+ OSGiRuntime runtime = getEmbeddedRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-osgi-jndi.jar");
+ bundle = runtime.installBundle("bundles/jboss-osgi-jmx.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,86 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.bootstrap;
-
-//$Id: MockFramework.java 84917 2009-03-02 08:18:40Z thomas.diesler(a)jboss.com $
-
-import java.net.URL;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * A mock framework
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Feb-2009
- */
-public class MockFramework implements OSGiFramework
-{
- public Bundle getBundle()
- {
- return null;
- }
-
- public BundleContext getBundleContext()
- {
- return null;
- }
-
- public List<URL> getAutoInstall()
- {
- return null;
- }
-
- public List<URL> getAutoStart()
- {
- return null;
- }
-
- public Map<String, Object> getProperties()
- {
- return null;
- }
-
- public void setAutoInstall(List<URL> autoInstall)
- {
- }
-
- public void setAutoStart(List<URL> autoStart)
- {
- }
-
- public void setProperties(Map<String, Object> props)
- {
- }
-
- public void start()
- {
- }
-
- public void stop()
- {
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/SomeBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/SomeBean.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/SomeBean.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -1,35 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.bootstrap;
-
-//$Id: SomeBean.java 84917 2009-03-02 08:18:40Z thomas.diesler(a)jboss.com $
-
-
-/**
- * Some pojo
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Feb-2009
- */
-public class SomeBean
-{
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/mbean/Foo.java 2009-05-08 10:12:51 UTC (rev 88419)
@@ -23,9 +23,8 @@
//$Id: Foo.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-import org.jboss.aop.microcontainer.aspects.jmx.JMX;
-@JMX (exposedInterface = FooMBean.class, name = "jboss.osgi:test=jbosgi36", registerDirectly = true)
+//@JMX (exposedInterface = FooMBean.class, name = "jboss.osgi:test=jbosgi36", registerDirectly = true)
public class Foo implements FooMBean
{
public String echo(String msg)
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 09:45:27 UTC (rev 88418)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-08 10:12:51 UTC (rev 88419)
@@ -19,6 +19,104 @@
<module>functional</module>
</modules>
+ <!-- Dependencies -->
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>biz.aQute</groupId>
+ <artifactId>bnd</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
+
+ <!-- Bundle Dependencies -->
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.jetty</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.log</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jaxb-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-common-core-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jmx</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-jndi</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-microcontainer</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-remotelog</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ <scope>provided</scope>
+ </dependency>
+
+ <!-- Test Dependencies -->
+ <dependency>
+ <groupId>org.jboss.naming</groupId>
+ <artifactId>jnpserver</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
<!-- Build -->
<build>
<testResources>
17 years, 2 months
JBoss-OSGI SVN: r88417 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/service and 17 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 03:50:42 -0400 (Fri, 08 May 2009)
New Revision: 88417
Added:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java
Removed:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/package.html
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/package.html
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/bundle/
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/example/microcontainer/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java
Modified:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceA.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Log:
Migrate tests - done (WIP)
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,53 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.service.microcontainer;
-
-//$Id$
-
-import javax.management.MBeanServer;
-
-import org.jboss.kernel.Kernel;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-@Deprecated
-public interface MicrocontainerService
-{
- /**
- * Get the Microcontainer Kernel
- */
- Kernel getKernel();
-
- /**
- * Get MBeanServer
- */
- MBeanServer getMbeanServer();
-
- /**
- * Get a registered bean from the Kernel.
- */
- Object getRegisteredBean(String beanName);
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/package.html
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/package.html 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/package.html 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,5 +0,0 @@
-<html>
-<body>
-Provides access to the Kernel and MBeanServer.
-</body>
-</html>
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/package.html
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/package.html 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/package.html 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,5 +0,0 @@
-<html>
-<body>
-A collection of SPI provided services.
-</body>
-</html>
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -31,13 +31,17 @@
*/
public abstract class AbstractBundle
{
+ public abstract long getBundleId();
+
+ public abstract String getSymbolicName();
+
+ public abstract int getState();
+
+ public abstract String getProperty(String key);
+
public abstract void start() throws BundleException;
public abstract void stop() throws BundleException;
public abstract void uninstall() throws BundleException;
-
- public abstract int getState();
-
- public abstract String getSymbolicName();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -45,32 +45,44 @@
}
@Override
- public void start() throws BundleException
+ public int getState()
{
- bundle.start();
+ return bundle.getState();
}
@Override
- public void stop() throws BundleException
+ public String getSymbolicName()
{
- bundle.stop();
+ return bundle.getSymbolicName();
}
@Override
- public void uninstall() throws BundleException
+ public long getBundleId()
{
- bundle.uninstall();
+ return bundle.getBundleId();
}
@Override
- public int getState()
+ public String getProperty(String key)
{
- return bundle.getState();
+ return bundle.getBundleContext().getProperty(key);
}
@Override
- public String getSymbolicName()
+ public void start() throws BundleException
{
- return bundle.getSymbolicName();
+ bundle.start();
}
+
+ @Override
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ bundle.uninstall();
+ }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -36,6 +36,14 @@
*/
public interface OSGiRuntime
{
+ void addCapability(Capability capability) throws BundleException;
+
+ void removeCapability(Capability capability);
+
+ void startLogEntryTracking(LogEntryCache logEntryCache);
+
+ void stopLogEntryTracking();
+
AbstractBundle installBundle(String location) throws BundleException;
void deploy(String location) throws Exception;
@@ -44,10 +52,6 @@
AbstractBundle[] getBundles();
- void addCapability(Capability capability) throws BundleException;
-
- void removeCapability(Capability capability);
-
AbstractPackageAdmin getPackageAdmin();
InitialContext getInitialContext() throws NamingException;
@@ -56,9 +60,5 @@
String getServerHost();
- void startLogEntryTracking(LogEntryCache logEntryCache);
-
- void stopLogEntryTracking();
-
void shutdown();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -48,6 +48,30 @@
}
@Override
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+
+ @Override
+ public long getBundleId()
+ {
+ return bundle.getBundleId();
+ }
+
+ @Override
+ public String getProperty(String key)
+ {
+ return bundle.getProperty(key);
+ }
+
+ @Override
public void start() throws BundleException
{
bundle.start();
@@ -75,16 +99,4 @@
log.error("Cannot uninstall: " + location);
}
}
-
- @Override
- public int getState()
- {
- return bundle.getState();
- }
-
- @Override
- public String getSymbolicName()
- {
- return bundle.getSymbolicName();
- }
}
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/antrun-example-jars.xml 2009-05-08 07:50:42 UTC (rev 88417)
@@ -48,9 +48,6 @@
<!-- example/log -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example/example-log.jar" files="${tests.resources.dir}/example/log/example-log.bnd" />
- <!-- example/microcontainer -->
- <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/example/example-microcontainer.jar" files="${tests.resources.dir}/example/microcontainer/example-microcontainer.bnd" />
-
<!-- Please add alphabetically -->
</target>
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.http;
-
-//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.ConfigAdminCapability;
-import org.jboss.osgi.spi.testing.HttpCapability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-
-import junit.framework.Test;
-
-/**
- * A test that deployes a bundle that containes a HttpServlet which
- * is registered through the OSGi HttpService
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class HttpServiceRemoteTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
- private static AbstractBundle testBundle;
-
- public static Test suite()
- {
- OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceRemoteTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new ConfigAdminCapability());
- runtime.addCapability(new HttpCapability());
- Thread.sleep(500);
- testBundle = runtime.installBundle("example/example-http.jar");
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- testBundle.uninstall();
- runtime.shutdown();
- super.tearDown();
- }
- };
- return testSetup;
- }
-
- public void testServletAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
- }
-
- public void testServletInitProps() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
- }
-
- public void testServletBundleContext() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
- }
-
- public void testServletStartLevel() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
- }
-
- public void testResourceAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java (from rev 88408, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.http;
+
+//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.ConfigAdminCapability;
+import org.jboss.osgi.spi.testing.HttpCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+
+import junit.framework.Test;
+
+/**
+ * A test that deployes a bundle that containes a HttpServlet which
+ * is registered through the OSGi HttpService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class HttpServiceTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle testBundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new ConfigAdminCapability());
+ runtime.addCapability(new HttpCapability());
+ Thread.sleep(500);
+ testBundle = runtime.installBundle("example/example-http.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ testBundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return testSetup;
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Servlet", br.readLine());
+ }
+
+ public void testServletInitProps() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("initProp=SomeValue", br.readLine());
+ }
+
+ public void testServletBundleContext() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("example-http", br.readLine());
+ }
+
+ public void testServletStartLevel() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("startLevel=1", br.readLine());
+ }
+
+ public void testResourceAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Resource", br.readLine());
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceRemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.log;
-
-//$Id: LogServiceRemoteTestCase.java 87339 2009-04-15 12:23:20Z thomas.diesler(a)jboss.com $
-
-import java.util.List;
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.jboss.osgi.spi.logging.LogEntryFilter;
-import org.jboss.osgi.spi.logging.RemoteLogReaderService;
-import org.osgi.framework.Bundle;
-import org.osgi.service.log.LogEntry;
-import org.osgi.service.log.LogService;
-
-/**
- * This example demonstrates the usage of the {@link RemoteLogReaderService}
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Apr-2009
- */
-public class LogServiceRemoteTestCase extends IntegrationTest
-{
- private LogEntryCache logEntryCache;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
- startRemoteLogEntryTracking(logEntryCache);
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- stopRemoteLogEntryTracking();
- super.tearDown();
- }
-
- public void testServiceA() throws Exception
- {
- // Deploy the test bundle
- RemoteBundle bundleA = deployBundle("example/example-log.jar");
-
- // Verify that the bundle is active
- assertEquals("Remote bundle ACTIVE", Bundle.ACTIVE, bundleA.getState());
-
- // Wait a little for the asynchronous log entry to arrive
- Thread.sleep(200);
-
- // Undeploy the test bundle
- undeployBundle("example/example-log.jar");
-
- // Verify the received log entries
- List<LogEntry> entries = logEntryCache.getLog();
- assertEquals("Number of entries", 1, entries.size());
- assertEquals("[ServiceA] new Service", entries.get(0).getMessage());
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.microcontainer;
-
-//$Id: MBeanServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.jboss.osgi.spi.junit.IntegrationTestSetup;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.test.osgi.example.microcontainer.bundle.FooMBean;
-import org.jboss.test.osgi.example.microcontainer.bundle.MBeanTestService;
-
-/**
- * A test that deployes a bundle that registeres an MBean
- *
- * @author thomas.diesler(a)jboss.com
- * @since 12-Feb-2009
- */
-public class MBeanServiceRemoteTestCase extends IntegrationTest
-{
- public static Test suite()
- {
- return new IntegrationTestSetup(MBeanServiceRemoteTestCase.class, "example/example-microcontainer.jar");
- }
-
- public void testMBeanAccess() throws Exception
- {
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBeanTestService.OBJECT_NAME, getMBeanServerConnection());
- assertEquals("hello", foo.echo("hello"));
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-08 07:50:42 UTC (rev 88417)
@@ -8,8 +8,13 @@
org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.jboss.logging, \
org.jboss.net.protocol, \
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-08 07:50:42 UTC (rev 88417)
@@ -46,6 +46,11 @@
<!-- Bundle Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.jetty</artifactId>
<scope>provided</scope>
</dependency>
@@ -55,6 +60,11 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-08 07:50:42 UTC (rev 88417)
@@ -15,7 +15,6 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
- <include>*:org.apache.felix.http.jetty:jar</include>
<include>*:apache-xerces-bundle:jar</include>
<include>*:jaxb-bundle:jar</include>
<include>*:jboss-common-core-bundle:jar</include>
@@ -26,7 +25,10 @@
<include>*:jboss-osgi-microcontainer:jar</include>
<include>*:jboss-osgi-remotelog:jar</include>
<include>*:jbossxb-bundle:jar</include>
+ <include>*:org.apache.felix.configadmin:jar</include>
+ <include>*:org.apache.felix.http.jetty:jar</include>
<include>*:org.apache.felix.log:jar</include>
+ <include>*:org.apache.felix.metatype:jar</include>
<include>*:org.osgi.compendium:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37RemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37RemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,66 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi37;
-
-//$Id$
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-37] Prevent creation of deployment unit for nested jars
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-37
- *
- * @author thomas.diesler(a)jboss.com
- * @since 09-Apr-2009
- */
-public class OSGI37RemoteTestCase extends IntegrationTest
-{
- public void testNestedBundle() throws Exception
- {
- RemoteBundle bundleA = deployBundle("jbosgi37-bundleA.jar");
- try
- {
- assertEquals("Bundle started", Bundle.ACTIVE, bundleA.getState());
-
- List<String> relevant = new ArrayList<String>();
- for (RemoteBundle bundle : getRemoteFramework().getBundles())
- {
- String symbolicName = bundle.getSymbolicName();
- if (symbolicName.startsWith("jbosgi37"))
- relevant.add(symbolicName);
- }
-
- assertEquals("No Sub Bundle", 1, relevant.size());
- assertEquals("jbosgi37-bundleA", relevant.get(0));
- }
- finally
- {
- undeployBundle("jbosgi37-bundleA.jar");
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38RemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,131 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi38;
-
-//$Id: OSGI38RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-38] Investigate bundle install/start behaviour with random deployment order
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-38
- *
- * Bundle A depends on bundle B, both share bundle X.
- *
- * A ---> B
- * A ---> X <--- B
- *
- * @author thomas.diesler(a)jboss.com
- * @since 02-Mar-2009
- */
-public class OSGI38RemoteTestCase extends IntegrationTest
-{
- /*
- * Install/Start the common bundle
- */
- public void testInstallStartX() throws Exception
- {
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
-
- undeployBundle("jbosgi38-bundleX.jar");
- }
-
- /*
- * Install X, B
- */
- public void testInstallXBeforeB() throws Exception
- {
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- undeployBundle("jbosgi38-bundleB.jar");
- undeployBundle("jbosgi38-bundleX.jar");
- }
-
- /*
- * Install X, B, A
- */
- public void testInstallBBeforeA() throws Exception
- {
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
- RemoteBundle bundleA = deployBundle("jbosgi38-bundleA.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-
- undeployBundle("jbosgi38-bundleA.jar");
- undeployBundle("jbosgi38-bundleB.jar");
- undeployBundle("jbosgi38-bundleX.jar");
- }
-
- /*
- * Install B, X
- */
- public void testInstallBBeforeX() throws Exception
- {
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- undeployBundle("jbosgi38-bundleB.jar");
- undeployBundle("jbosgi38-bundleX.jar");
- }
-
- /*
- * Install A, B, X
- */
- public void testInstallABeforeB() throws Exception
- {
- RemoteBundle bundleA = deployBundle("jbosgi38-bundleA.jar");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
-
- RemoteBundle bundleB = deployBundle("jbosgi38-bundleB.jar");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- RemoteBundle bundleX = deployBundle("jbosgi38-bundleX.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-
- undeployBundle("jbosgi38-bundleA.jar");
- undeployBundle("jbosgi38-bundleB.jar");
- undeployBundle("jbosgi38-bundleX.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39RemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi39;
-
-//$Id: OSGI39RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleException;
-
-/**
- * [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-39
- *
- * Bundle B depends on bundle X.
- *
- * B ---> X
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class OSGI39RemoteTestCase extends IntegrationTest
-{
- public void testVerifyUnresolved() throws Exception
- {
- RemoteBundle bundleB = deployBundle("jbosgi39-bundleB.jar");
-
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
-
- RemoteBundle bundleX = deployBundle("jbosgi39-bundleX.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- undeployBundle("jbosgi39-bundleB.jar");
- undeployBundle("jbosgi39-bundleX.jar");
- }
-
- /*
- * 4.3.11 Uninstalling Bundles
- *
- * Once this method returns, the state of the OSGi Service Platform must be the same as if the bundle had never been installed, unless:
- *
- * - The uninstalled bundle has exported any packages (via its Export-Package manifest header)
- * - The uninstalled bundle was selected by the Framework as the exporter of these packages.
- *
- * If none of the old exports are used, then the old exports must be removed. Otherwise, all old exports must remain available
- * for existing bundles and future resolves until the refreshPackages method is called or the Framework is restarted.
- */
- public void testWiringToUninstalled() throws Exception
- {
- RemoteBundle bundleX = deployBundle("jbosgi39-bundleX.jar");
- RemoteBundle bundleB = deployBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.ACTIVE, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- // Undeploy X before B
- undeployBundle("jbosgi39-bundleX.jar");
- undeployBundle("jbosgi39-bundleB.jar");
-
- // Install B without X
- bundleB = deployBundle("jbosgi39-bundleB.jar");
-
- bundleB.start();
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- undeployBundle("jbosgi39-bundleB.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,67 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.jbosgi41;
-
-//$Id: OSGI41RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-
-/**
- * [JBOSGI-41] Verify persistent file storage
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-41
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-Mar-2009
- */
-public class OSGI41RemoteTestCase extends IntegrationTest
-{
- public void testFirstRun() throws Exception
- {
- RemoteBundle bundleA = deployBundle("jbosgi41-bundleA.jar");
- assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
-
- File dataFile = getBundleDataFile(bundleA, "config/jbosgi41.txt");
- assertTrue("File exists: " + dataFile, dataFile.exists());
-
- BufferedReader br = new BufferedReader(new FileReader(dataFile));
- String symbolicName = br.readLine();
- assertEquals("jbosgi41-bundleA", symbolicName);
-
- undeployBundle("jbosgi41-bundleA.jar");
- }
-
- private File getBundleDataFile(RemoteBundle bundleA, String filename)
- {
- String storageRoot = bundleA.getProperty("org.osgi.framework.storage");
- assertNotNull("Storage dir not null", storageRoot);
-
- File dataFile = new File(storageRoot + "/bundle" + bundleA.getBundleId() + "/data/" + filename);
- return dataFile;
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java (from rev 88408, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41RemoteTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/OSGI41TestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -0,0 +1,80 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi41;
+
+//$Id: OSGI41RemoteTestCase.java 87182 2009-04-13 13:47:53Z thomas.diesler(a)jboss.com $
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.ConfigAdminCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.framework.Bundle;
+
+/**
+ * [JBOSGI-41] Verify persistent file storage
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-41
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-Mar-2009
+ */
+public class OSGI41TestCase extends OSGiTest
+{
+ public void testFirstRun() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ runtime.addCapability(new ConfigAdminCapability());
+
+ AbstractBundle bundleA = runtime.installBundle("jbosgi41-bundleA.jar");
+ bundleA.start();
+
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleA.getState());
+
+ File dataFile = getBundleDataFile(bundleA, "config/jbosgi41.txt");
+ assertTrue("File exists: " + dataFile, dataFile.exists());
+
+ BufferedReader br = new BufferedReader(new FileReader(dataFile));
+ assertEquals("jbosgi41-bundleA", br.readLine());
+
+ bundleA.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+
+ private File getBundleDataFile(AbstractBundle bundleA, String filename)
+ {
+ String storageRoot = bundleA.getProperty("org.osgi.framework.storage");
+ assertNotNull("Storage dir not null", storageRoot);
+
+ File dataFile = new File(storageRoot + "/bundle" + bundleA.getBundleId() + "/data/" + filename);
+ return dataFile;
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceA.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceA.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -28,7 +28,9 @@
import java.io.IOException;
import java.io.OutputStreamWriter;
+import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.BundleContext;
+import org.osgi.service.log.LogService;
/**
* ServiceA writes a file
@@ -38,21 +40,25 @@
*/
public class ServiceA
{
+ private LogService log;
+
ServiceA(BundleContext context)
{
+ log = new LogServiceTracker(context);
+
context.getDataFile("config").mkdirs();
File dataFile = context.getDataFile("config/jbosgi41.txt");
try
{
- System.out.println("dataFile: " + dataFile);
+ log.log(LogService.LOG_INFO, "dataFile: " + dataFile);
OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(dataFile));
out.write(context.getBundle().getSymbolicName());
out.close();
}
catch (IOException ex)
{
- ex.printStackTrace(System.err);
+ log.log(LogService.LOG_ERROR, "Cannot write data file", ex);
}
}
}
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi41/bundleA/ServiceB.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -27,12 +27,14 @@
import java.util.Dictionary;
import java.util.Hashtable;
+import org.jboss.osgi.common.log.LogServiceTracker;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
+import org.osgi.service.log.LogService;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -44,17 +46,18 @@
public class ServiceB implements ManagedService
{
private ConfigurationAdmin configAdmin;
+ private LogService log;
ServiceB(BundleContext context)
{
- System.out.println("ServiceB");
+ log = new LogServiceTracker(context);
ServiceTracker tracker = new ServiceTracker(context, ConfigurationAdmin.class.getName(), null)
{
@Override
public Object addingService(ServiceReference sref)
{
- System.out.println("addingService");
+ log.log(LogService.LOG_INFO, "addingService ConfigurationAdmin");
configAdmin = (ConfigurationAdmin)super.addingService(sref);
return configAdmin;
}
@@ -65,7 +68,7 @@
@SuppressWarnings("unchecked")
public void updateConfig(String key, String value)
{
- System.out.println("updateConfig");
+ log.log(LogService.LOG_INFO, "updateConfig");
if (configAdmin != null)
{
try
@@ -81,7 +84,7 @@
config.update(props);
Configuration[] configs = configAdmin.listConfigurations(null);
- System.out.println(Arrays.asList(configs));
+ log.log(LogService.LOG_DEBUG, Arrays.asList(configs).toString());
}
catch (Exception ex)
{
@@ -93,6 +96,6 @@
@SuppressWarnings("unchecked")
public void updated(Dictionary props) throws ConfigurationException
{
- System.out.println("updated: " + props);
+ log.log(LogService.LOG_INFO, "updated: " + props);
}
}
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.service.startlevel;
-
-//$Id: StartLevelRemoteTestCase.java 87336 2009-04-15 11:31:26Z thomas.diesler(a)jboss.com $
-
-import org.jboss.osgi.spi.framework.RemoteBundle;
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.osgi.framework.Bundle;
-
-/**
- * Deploy a bundle that accesses the StartLevel service
- *
- * @author thomas.diesler(a)jboss.com
- * @since 04-Mar-2009
- */
-public class StartLevelRemoteTestCase extends IntegrationTest
-{
- public void testStartLevel() throws Exception
- {
- RemoteBundle bundle = deployBundle("service/service-startlevel.jar");
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
-
- undeployBundle("service/service-startlevel.jar");
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java (from rev 88408, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelRemoteTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/service/startlevel/StartLevelTestCase.java 2009-05-08 07:50:42 UTC (rev 88417)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.startlevel;
+
+//$Id: StartLevelRemoteTestCase.java 87336 2009-04-15 11:31:26Z thomas.diesler(a)jboss.com $
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.osgi.framework.Bundle;
+
+/**
+ * Deploy a bundle that accesses the StartLevel service
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 04-Mar-2009
+ */
+public class StartLevelTestCase extends OSGiTest
+{
+ public void testStartLevel() throws Exception
+ {
+ OSGiRuntime runtime = getDefaultRuntime();
+ try
+ {
+ AbstractBundle bundle = runtime.installBundle("service/service-startlevel.jar");
+ bundle.start();
+
+ assertEquals("Bundle active", Bundle.ACTIVE, bundle.getState());
+
+ bundle.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 07:17:10 UTC (rev 88416)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-08 07:50:42 UTC (rev 88417)
@@ -8,8 +8,13 @@
org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
# Properties to configure the Framework
+org.osgi.framework.storage=${basedir}/target/osgi-store
org.osgi.framework.storage.clean=onFirstInit
+
+# Framework bootdelegation
org.osgi.framework.bootdelegation=org.osgi.service.log
+
+# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.jboss.logging, \
org.jboss.osgi.spi, \
17 years, 2 months
JBoss-OSGI SVN: r88414 - in projects/jboss-osgi/trunk/runtime: jbossas/src/main/java/org/jboss/osgi/jmx/internal and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-08 02:46:28 -0400 (Fri, 08 May 2009)
New Revision: 88414
Added:
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java
Removed:
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
Modified:
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
Log:
Blueprint/JBossAS - ok
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-08 06:46:28 UTC (rev 88414)
@@ -1,7 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ $Id$
+-->
+
<deployment xmlns="urn:jboss:bean-deployer:2.0">
+ <!--
+ ********************************
+ * *
+ * Framework *
+ * *
+ ********************************
+ -->
+
<!-- The OSGiFramework -->
<bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
<property name="properties">
@@ -76,7 +88,7 @@
</bean>
<!-- A Service that gives access to the MBeanServer -->
- <bean name="jboss.osgi:service=MBeanServer" class="org.jboss.osgi.jmx.internal.MBeanServerServiceImpl">
+ <bean name="jboss.osgi:service=Management" class="org.jboss.osgi.jmx.internal.ManagementServiceImpl">
<property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
Deleted: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java 2009-05-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java 2009-05-08 06:46:28 UTC (rev 88414)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.jmx.internal;
-
-//$Id$
-
-import javax.management.MBeanServer;
-
-import org.osgi.framework.BundleContext;
-
-/**
- * A service that gives access to the MBeanServer
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class MBeanServerServiceImpl
-{
- private MBeanServer mbeanServer;
- private BundleContext context;
-
- public void setSystemContext(BundleContext context)
- {
- this.context = context;
- }
-
- public void setMbeanServer(MBeanServer mbeanServer)
- {
- this.mbeanServer = mbeanServer;
- }
-
- public void start()
- {
- context.registerService(MBeanServer.class.getName(), mbeanServer, null);
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java (from rev 88408, projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java)
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/ManagementServiceImpl.java 2009-05-08 06:46:28 UTC (rev 88414)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to the MBeanServer
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class ManagementServiceImpl
+{
+ private MBeanServer mbeanServer;
+ private BundleContext context;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void start()
+ {
+ context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-08 06:02:20 UTC (rev 88413)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-08 06:46:28 UTC (rev 88414)
@@ -29,6 +29,7 @@
import java.util.List;
import javax.management.MBeanServer;
+import javax.management.ObjectName;
import javax.management.StandardMBean;
import org.jboss.dependency.plugins.AbstractController;
@@ -43,7 +44,6 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.microcontainer.MicrocontainerService;
import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.BundleContext;
/**
@@ -57,7 +57,7 @@
private BundleContext context;
private MBeanServer mbeanServer;
private Kernel kernel;
-
+
public void setSystemContext(BundleContext context)
{
this.context = context;
@@ -75,14 +75,20 @@
public void deploy(URL url) throws Exception
{
- throw new NotImplementedException();
+ invokeMainDeployer("deploy", url);
}
public void undeploy(URL url) throws Exception
{
- throw new NotImplementedException();
+ invokeMainDeployer("undeploy", url);
}
+ private void invokeMainDeployer(String method, URL archiveURL) throws Exception
+ {
+ ObjectName oname = new ObjectName("jboss.system:service=MainDeployer");
+ mbeanServer.invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+ }
+
public Kernel getKernel()
{
return kernel;
@@ -95,7 +101,7 @@
AbstractController controller = (AbstractController)getKernel().getController();
for (ControllerContext ctx : controller.getAllContexts())
{
- if (ctx instanceof KernelControllerContext)
+ if (ctx instanceof KernelControllerContext || ctx instanceof PreInstalledControllerContext)
names.add(ctx.getName().toString());
}
@@ -111,14 +117,15 @@
public void start()
{
context.registerService(MicrocontainerService.class.getName(), this, null);
-
+
try
{
KernelController controller = kernel.getController();
ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
-
+ controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
+
StandardMBean mbean = new StandardMBean(this, MicrocontainerServiceMBean.class);
mbeanServer.registerMBean(mbean, MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE);
}
@@ -127,7 +134,7 @@
throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
}
}
-
+
static class PreInstalledControllerContext extends AbstractControllerContext
{
public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
17 years, 2 months
JBoss-OSGI SVN: r88386 - in projects/jboss-osgi/trunk: build/distribution and 25 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 17:23:09 -0400 (Thu, 07 May 2009)
New Revision: 88386
Added:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/runtime/jbossas/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
Removed:
projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/deployer/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
Modified:
projects/jboss-osgi/trunk/build/distribution/pom.xml
projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/jbossas/pom.xml
projects/jboss-osgi/trunk/runtime/pom.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
More work on OSGiRuntime - blueprint tests pass against jbossas
Modified: projects/jboss-osgi/trunk/build/distribution/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/build/distribution/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -46,6 +46,17 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
+ <classifier>sources</classifier>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-spi</artifactId>
<version>${version}</version>
</dependency>
Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -280,6 +280,7 @@
<!-- deployers/osgi.deployer -->
<fileset dir="@{deploy.artifacts.dir}/lib" targetdir="${jbossInstallPath}/server/${jbossTargetServer}/deployers/osgi.deployer" override="true">
<include name="jboss-osgi-runtime-deployer.jar" />
+ <include name="jboss-osgi-runtime-jbossas.jar" />
<include name="jboss-osgi-spi.jar" />
</fileset>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -162,4 +162,9 @@
</plugins>
</build>
+ <!-- Profiles -->
+ <profiles>
+
+ </profiles>
+
</project>
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -26,7 +26,7 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.osgi.jmx.ObjectNameFactory;
+import org.jboss.osgi.spi.management.ObjectNameFactory;
import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -24,11 +24,10 @@
//$Id$
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_KERNEL;
-import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MAIN_DEPLOYER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
+import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import java.util.List;
import java.util.Set;
@@ -37,9 +36,9 @@
import junit.framework.Test;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -86,7 +85,6 @@
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
List<String> registeredBeans = mcService.getRegisteredBeans();
assertTrue("BundleContext registered with MC", registeredBeans.contains(BEAN_SYSTEM_BUNDLE_CONTEXT));
- assertTrue("MainDeployer registered with MC", registeredBeans.contains(BEAN_MAIN_DEPLOYER));
assertTrue("MBeanServer registered with MC", registeredBeans.contains(BEAN_MBEAN_SERVER));
assertTrue("Kernel registered with MC", registeredBeans.contains(BEAN_KERNEL));
}
Added: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/tst.policy 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,4 @@
+grant {
+ permission java.security.AllPermission;
+};
+
Deleted: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/ObjectNameFactory.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,74 +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.jmx;
-
-// $Id$
-
-import java.util.Hashtable;
-
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
-
-/**
- * A simple factory for creating safe object names.
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 08-May-2006
- */
-public class ObjectNameFactory
-{
- public static ObjectName create(String name)
- {
- try
- {
- return new ObjectName(name);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + name + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, String key, String value)
- {
- try
- {
- return new ObjectName(domain, key, value);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + key + "," + value + "; " + e);
- }
- }
-
- public static ObjectName create(String domain, Hashtable<String, String> table)
- {
- try
- {
- return new ObjectName(domain, table);
- }
- catch (MalformedObjectNameException e)
- {
- throw new Error("Invalid ObjectName: " + domain + "," + table + "; " + e);
- }
- }
-}
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -112,7 +112,6 @@
org.jboss.joinpoint.*,
org.jboss.logging,
org.jboss.osgi.common.log,
- org.jboss.osgi.jmx,
org.jboss.osgi.spi,
org.jboss.osgi.spi.management,
org.jboss.reflect.*,
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -37,33 +37,28 @@
public interface MicrocontainerService
{
/*
- * * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
*/
String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
/*
- * * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
+ * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
*/
String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
/*
- * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ * The name under which the KernelController is registered: 'jboss.kernel:service=KernelController'
*/
- String BEAN_MAIN_DEPLOYER = "jboss.osgi:service=MainDeployer";
+ String BEAN_KERNEL_CONTROLLER = "jboss.kernel:service=KernelController";
/*
- * * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
+ * The name under which the Kernel is registered: 'jboss.kernel:service=Kernel'
*/
- String BEAN_KERNEL_CONTROLLER = "jboss.osgi:service=KernelController";
+ String BEAN_KERNEL = "jboss.kernel:service=Kernel";
/*
- * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ * Get the Microcontainer Kernel
*/
- String BEAN_KERNEL = "jboss.osgi:service=Kernel";
-
- /*
- * * Get the Microcontainer Kernel
- */
Kernel getKernel();
/*
Copied: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (from rev 88378, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.microcontainer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+ /**
+ * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
+ */
+ ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+ /**
+ * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -50,7 +50,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.microcontainer.MicrocontainerService;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleContext;
@@ -114,7 +114,7 @@
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
VirtualFile file = VFS.createNewRoot(url);
VFSDeployment deployment = deploymentFactory.createVFSDeployment(file);
mainDeployer.addDeployment(deployment);
@@ -138,7 +138,7 @@
String deploymentName = contextMap.remove(url);
if (deploymentName != null)
{
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean("MainDeployer");
mainDeployer.removeDeployment(deploymentName);
mainDeployer.process();
}
@@ -160,8 +160,8 @@
KernelController controller = kernel.getController();
ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
+ controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
controller.install(new PreInstalledControllerContext(BEAN_KERNEL_CONTROLLER, actions, controller));
- controller.install(new PreInstalledControllerContext(BEAN_KERNEL, actions, kernel));
controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
URL deployersURL = context.getBundle().getResource("META-INF/base-deployers-beans.xml");
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -8,7 +8,7 @@
<deployment xmlns="urn:jboss:bean-deployer:2.0">
<!-- The MainDeployer -->
- <bean name="jboss.osgi:service=MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
+ <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
<property name="structuralDeployers"><inject bean="StructuralDeployers" /></property>
<property name="deployers"><inject bean="Deployers" /></property>
</bean>
@@ -34,7 +34,7 @@
<!-- The holder for deployers that do real deployment -->
<bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.osgi:service=KernelController"/></parameter></constructor>
+ <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
<!-- Accept any implementor of deployer -->
<incallback method="addDeployer"/>
<uncallback method="removeDeployer"/>
@@ -72,7 +72,7 @@
<bean name="KernelDeploymentDeployer" class="org.jboss.osgi.deployer.BundleContainedBeansDeployer">
</bean>
<bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.osgi:service=Kernel"/></parameter></constructor>
+ <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
</bean>
<!-- OSGi Deployment -->
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -35,6 +35,8 @@
<!-- Properties -->
<properties>
+ <surefire.security.args>-Djava.security.manager -Djava.security.policy=src/test/resources/tst.policy</surefire.security.args>
+
<version.apache.xerces.bundle>2.9.1-SNAPSHOT</version.apache.xerces.bundle>
<version.aqute.bnd>0.0.323</version.aqute.bnd>
<version.equinox>3.4.2</version.equinox>
@@ -454,6 +456,7 @@
</plugins>
</reporting>
+ <!-- Profiles -->
<profiles>
<!--
@@ -494,6 +497,28 @@
</properties>
</profile>
+ <!--
+ Name: jboss501
+ Descr: Setup for jboss501 integration testing
+ -->
+ <profile>
+ <id>jboss501</id>
+ <activation>
+ <property>
+ <name>target.container</name>
+ <value>jboss501</value>
+ </property>
+ </activation>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.jbossas</groupId>
+ <artifactId>jboss-as-client</artifactId>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ </dependencies>
+ </profile>
+
</profiles>
</project>
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -11,23 +11,16 @@
<entry><key>org.osgi.service.http.port</key><value>8090</value></entry>
<entry><key>felix.cm.dir</key><value>${jboss.server.data.dir}/osgi-configadmin</value></entry>
<entry>
- <key>org.osgi.framework.system.packages</key>
+ <key>org.osgi.framework.system.packages.extra</key>
<value>
- javax.management,
- javax.xml.parsers,
org.jboss.logging,
+ org.jboss.osgi.jndi,
+ org.jboss.osgi.jmx,
+ org.jboss.osgi.microcontainer,
org.jboss.osgi.spi.logging,
org.jboss.osgi.spi.management,
- org.jboss.osgi.spi.service.microcontainer,
- org.osgi.framework; version=1.4,
- org.osgi.service.packageadmin; version=1.2,
- org.osgi.service.startlevel; version=1.1,
- org.xml.sax,
<!-- needed by jboss-remoting -->
- javax.naming,
- javax.net,
- javax.net.ssl,
org.apache.log4j,
org.jboss.util,
org.jboss.util.id,
@@ -62,13 +55,40 @@
<property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
</bean>
- <!-- A Service that gives access to the Microcontainer Kernel -->
- <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
+ <!--
+ ********************************
+ * *
+ * Services *
+ * *
+ ********************************
+ -->
+
+ <!-- A Service that gives access to the Microcontainer -->
+ <bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.microcontainer.internal.MicrocontainerServiceImpl">
<property name="systemContext"><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>
+ <!-- A Service that gives access to JNDI -->
+ <bean name="jboss.osgi:service=Naming" class="org.jboss.osgi.jndi.internal.NamingServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ </bean>
+
+ <!-- A Service that gives access to the MBeanServer -->
+ <bean name="jboss.osgi:service=MBeanServer" class="org.jboss.osgi.jmx.internal.MBeanServerServiceImpl">
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext"/></property>
+ <property name="mbeanServer"><inject bean="JMXKernel" property="mbeanServer"/></property>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * Deployers *
+ * *
+ ********************************
+ -->
+
<!-- The OSGi MetaData Deployer -->
<bean name="jboss.osgi:service=BundleMetaDataDeployer" class="org.jboss.osgi.deployer.BundleMetaDataDeployer" />
Copied: projects/jboss-osgi/trunk/runtime/jbossas (from rev 88378, projects/jboss-osgi/trunk/runtime/deployer)
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas
___________________________________________________________________
Name: svn:ignore
+ target
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/runtime/jbossas/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/pom.xml 2009-05-07 17:38:04 UTC (rev 88378)
+++ projects/jboss-osgi/trunk/runtime/jbossas/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -2,10 +2,10 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
- <name>JBossOSGi - Runtime Deployer</name>
+ <name>JBossOSGi - Runtime JBossAS</name>
<groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-runtime-deployer</artifactId>
+ <artifactId>jboss-osgi-runtime-jbossas</artifactId>
<packaging>jar</packaging>
<parent>
@@ -21,6 +21,11 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.jboss.osgi</groupId>
+ <artifactId>jboss-osgi-spi</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
@@ -30,21 +35,6 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.jboss.osgi</groupId>
- <artifactId>jboss-osgi-spi</artifactId>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.deployers</groupId>
- <artifactId>jboss-deployers-spi</artifactId>
- <version>${version.jboss.deployers}</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-system-jmx</artifactId>
- <scope>provided</scope>
- </dependency>
</dependencies>
<!-- Build -->
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jmx.internal;
+
+//$Id$
+
+import javax.management.MBeanServer;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to the MBeanServer
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class MBeanServerServiceImpl
+{
+ private MBeanServer mbeanServer;
+ private BundleContext context;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void start()
+ {
+ context.registerService(MBeanServer.class.getName(), mbeanServer, null);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jmx/internal/MBeanServerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jndi;
+
+//$Id$
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+/**
+ * A service that gives access to JNDI
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public interface NamingService
+{
+ /**
+ * Get the InitialContext
+ * @throws NamingException if a naming exception is encountered
+ */
+ InitialContext getInitialContext() throws NamingException;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/NamingService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.jndi.internal;
+
+//$Id$
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.jndi.NamingService;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service that gives access to JNDI
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class NamingServiceImpl implements NamingService
+{
+ private BundleContext context;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ /**
+ * Get the InitialContext
+ *
+ * @throws NamingException if a naming exception is encountered
+ */
+ public InitialContext getInitialContext() throws NamingException
+ {
+ return new InitialContext();
+ }
+
+ public void start()
+ {
+ context.registerService(NamingService.class.getName(), this, null);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,84 @@
+/*
+ * 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.microcontainer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import org.jboss.kernel.Kernel;
+
+/**
+ * A service the gives access to the Microcontainer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerService
+{
+ /*
+ * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ */
+ String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
+
+ /*
+ * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
+ */
+ String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
+
+ /*
+ * The name under which the KernelController is registered: 'jboss.kernel:service=KernelController'
+ */
+ String BEAN_KERNEL_CONTROLLER = "jboss.kernel:service=KernelController";
+
+ /*
+ * The name under which the Kernel is registered: 'jboss.kernel:service=Kernel'
+ */
+ String BEAN_KERNEL = "jboss.kernel:service=Kernel";
+
+ /*
+ * * Get the Microcontainer Kernel
+ */
+ Kernel getKernel();
+
+ /*
+ * * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /*
+ * * Get a registered bean from the Kernel.
+ * @return null if there is no bean registered under this name
+ */
+ Object getRegisteredBean(String beanName);
+
+ /*
+ * * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /*
+ * * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.microcontainer;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+import org.jboss.osgi.spi.management.ObjectNameFactory;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+ /**
+ * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
+ */
+ ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+ /**
+ * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,138 @@
+/*
+ * 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.microcontainer.internal;
+
+//$Id$
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import javax.management.MBeanServer;
+import javax.management.StandardMBean;
+
+import org.jboss.dependency.plugins.AbstractController;
+import org.jboss.dependency.plugins.AbstractControllerContext;
+import org.jboss.dependency.plugins.AbstractControllerContextActions;
+import org.jboss.dependency.plugins.action.ControllerContextAction;
+import org.jboss.dependency.spi.ControllerContext;
+import org.jboss.dependency.spi.ControllerContextActions;
+import org.jboss.dependency.spi.ControllerState;
+import org.jboss.kernel.Kernel;
+import org.jboss.kernel.spi.dependency.KernelController;
+import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.microcontainer.MicrocontainerService;
+import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.NotImplementedException;
+import org.osgi.framework.BundleContext;
+
+/**
+ * A service the gives access to the Microcontainer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerServiceImpl implements MicrocontainerService, MicrocontainerServiceMBean
+{
+ private BundleContext context;
+ private MBeanServer mbeanServer;
+ private Kernel kernel;
+
+ public void setSystemContext(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ public void setMbeanServer(MBeanServer mbeanServer)
+ {
+ this.mbeanServer = mbeanServer;
+ }
+
+ public void setKernel(Kernel kernel)
+ {
+ this.kernel = kernel;
+ }
+
+ public void deploy(URL url) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ public void undeploy(URL url) throws Exception
+ {
+ throw new NotImplementedException();
+ }
+
+ public Kernel getKernel()
+ {
+ return kernel;
+ }
+
+ public List<String> getRegisteredBeans()
+ {
+ List<String> names = new ArrayList<String>();
+
+ AbstractController controller = (AbstractController)getKernel().getController();
+ for (ControllerContext ctx : controller.getAllContexts())
+ {
+ if (ctx instanceof KernelControllerContext)
+ names.add(ctx.getName().toString());
+ }
+
+ return names;
+ }
+
+ public Object getRegisteredBean(String beanName)
+ {
+ ControllerContext context = getKernel().getController().getInstalledContext(beanName);
+ return context != null ? context.getTarget() : null;
+ }
+
+ public void start()
+ {
+ context.registerService(MicrocontainerService.class.getName(), this, null);
+
+ try
+ {
+ KernelController controller = kernel.getController();
+ ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
+ controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
+ controller.install(new PreInstalledControllerContext(BEAN_MBEAN_SERVER, actions, mbeanServer));
+
+ StandardMBean mbean = new StandardMBean(this, MicrocontainerServiceMBean.class);
+ mbeanServer.registerMBean(mbean, MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE);
+ }
+ catch (Throwable ex)
+ {
+ throw new IllegalStateException("Cannot register MicrocontainerServiceMBean", ex);
+ }
+ }
+
+ static class PreInstalledControllerContext extends AbstractControllerContext
+ {
+ public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
+ {
+ super(name, actions, null, target);
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/runtime/jbossas/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/runtime/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/runtime/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -12,6 +12,7 @@
</parent>
<modules>
+ <module>jbossas</module>
<module>deployer</module>
<module>equinox</module>
<module>felix</module>
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,58 +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.management;
-
-//$Id$
-
-import java.net.URL;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerServiceMBean
-{
- /**
- * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
- */
- ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
-
- /**
- * Get the list of registered beans.
- */
- List<String> getRegisteredBeans();
-
- /**
- * Deploy MC beans from URL
- */
- void deploy(URL url) throws Exception;
-
- /**
- * Undeploy MC beans from URL
- */
- void undeploy(URL url) throws Exception;
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -23,8 +23,6 @@
// $Id$
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -41,8 +39,6 @@
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -72,20 +68,6 @@
return new EmbeddedBundle(bundle);
}
- public void deploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(archiveURL);
- }
-
- public void undeploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.undeploy(archiveURL);
- }
-
public AbstractBundle[] getBundles()
{
List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -23,12 +23,9 @@
// $Id$
-import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
-import java.net.URL;
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set;
@@ -49,7 +46,6 @@
import org.jboss.osgi.spi.management.MBeanProxyException;
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -112,20 +108,6 @@
}
}
- public void deploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(archiveURL);
- }
-
- public void undeploy(String location) throws Exception
- {
- URL archiveURL = getTestHelper().getTestArchiveURL(location);
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.undeploy(archiveURL);
- }
-
@Override
public void addCapability(Capability capability) throws BundleException
{
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -21,12 +21,15 @@
*/
package org.jboss.osgi.spi.testing.internal;
+import java.net.URL;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import javax.management.ObjectName;
+
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.Capability;
@@ -101,6 +104,24 @@
}
}
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ invokeMainDeployer("deploy", archiveURL);
+ }
+
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ invokeMainDeployer("undeploy", archiveURL);
+ }
+
+ private void invokeMainDeployer(String method, URL archiveURL) throws Exception
+ {
+ ObjectName oname = new ObjectName("jboss.system:service=MainDeployer");
+ getMBeanServer().invoke(oname, method, new Object[] { archiveURL }, new String[] { "java.net.URL" });
+ }
+
public String getServerHost()
{
return System.getProperty("jboss.bind.address", "localhost");
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java (from rev 88378, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.http;
+
+//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.ConfigAdminCapability;
+import org.jboss.osgi.spi.testing.HttpCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+
+import junit.framework.Test;
+
+/**
+ * A test that deployes a bundle that containes a HttpServlet which
+ * is registered through the OSGi HttpService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class HttpServiceRemoteTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle testBundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceRemoteTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new ConfigAdminCapability());
+ runtime.addCapability(new HttpCapability());
+ Thread.sleep(500);
+ testBundle = runtime.installBundle("example/example-http.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ testBundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return testSetup;
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Servlet", br.readLine());
+ }
+
+ public void testServletInitProps() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("initProp=SomeValue", br.readLine());
+ }
+
+ public void testServletBundleContext() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("example-http", br.readLine());
+ }
+
+ public void testServletStartLevel() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("startLevel=1", br.readLine());
+ }
+
+ public void testResourceAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Resource", br.readLine());
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-07 21:23:09 UTC (rev 88386)
@@ -1,111 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.http;
-
-//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.ConfigAdminCapability;
-import org.jboss.osgi.spi.testing.HttpCapability;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-
-import junit.framework.Test;
-
-/**
- * A test that deployes a bundle that containes a HttpServlet which
- * is registered through the OSGi HttpService
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class HttpServiceTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
- private static AbstractBundle testBundle;
-
- public static Test suite()
- {
- OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new ConfigAdminCapability());
- runtime.addCapability(new HttpCapability());
- Thread.sleep(500);
- testBundle = runtime.installBundle("example/example-http.jar");
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- testBundle.uninstall();
- runtime.shutdown();
- super.tearDown();
- }
- };
- return testSetup;
- }
-
- public void testServletAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
- }
-
- public void testServletInitProps() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
- }
-
- public void testServletBundleContext() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
- }
-
- public void testServletStartLevel() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
- }
-
- public void testResourceAccess() throws Exception
- {
- URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 21:22:14 UTC (rev 88385)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 21:23:09 UTC (rev 88386)
@@ -247,14 +247,6 @@
<name>target.container</name>
</property>
</activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <scope>test</scope>
- <type>pom</type>
- </dependency>
- </dependencies>
<build>
<plugins>
<plugin>
17 years, 2 months
JBoss-OSGI SVN: r88362 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/testing and 7 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 10:00:45 -0400 (Thu, 07 May 2009)
New Revision: 88362
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/ConfigAdminCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HttpCapability.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java
Removed:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
Modified:
projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
Log:
Migrate HttpService test - WIP
Modified: projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/build/distribution/src/main/resources/installer/install-definition.xml 2009-05-07 14:00:45 UTC (rev 88362)
@@ -174,7 +174,6 @@
<include name="jboss-vfs.jar" />
<include name="log4j.jar" />
<include name="org.apache.felix.framework.jar" />
- <include name="org.osgi.core.jar" />
</fileset>
<!-- JBossOSGi Bundles -->
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/ConfigAdminCapability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/ConfigAdminCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/ConfigAdminCapability.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -0,0 +1,39 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class ConfigAdminCapability extends Capability
+{
+ public ConfigAdminCapability()
+ {
+ addBundle("bundles/org.apache.felix.metatype.jar");
+ addBundle("bundles/org.apache.felix.configadmin.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/ConfigAdminCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -170,10 +170,9 @@
public InitialContext getInitialContext() throws NamingException
{
Hashtable env = new Hashtable();
- String bindAddress = System.getProperty("jboss.bind.address", "localhost");
env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
- env.put("java.naming.provider.url", "jnp://" + bindAddress + ":1199");
+ env.put("java.naming.provider.url", "jnp://" + getServerHost() + ":1199");
return new InitialContext(env);
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HttpCapability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HttpCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HttpCapability.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -0,0 +1,43 @@
+/*
+ * 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.testing;
+
+import java.util.Properties;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class HttpCapability extends Capability
+{
+ public HttpCapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.osgi.service.http.port", "8090");
+
+ addBundle("bundles/org.apache.felix.http.jetty.jar");
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/HttpCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -54,6 +54,8 @@
MBeanServerConnection getMBeanServer();
+ String getServerHost();
+
void startLogEntryTracking(LogEntryCache logEntryCache);
void stopLogEntryTracking();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -27,6 +27,7 @@
import junit.framework.TestCase;
import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.jboss.virtual.VFS;
/**
@@ -80,7 +81,7 @@
return helper.getDefaultRuntime();
}
- protected EmbeddedRuntime getEmbeddedRuntime()
+ protected OSGiRuntimeImpl getEmbeddedRuntime()
{
return helper.getEmbeddedRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -27,6 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
/**
* An OSGi Test Helper
@@ -75,7 +76,7 @@
return runtime;
}
- public EmbeddedRuntime getEmbeddedRuntime()
+ public OSGiRuntimeImpl getEmbeddedRuntime()
{
return new EmbeddedRuntime(this);
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -28,6 +28,7 @@
import junit.framework.TestSuite;
import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
/**
* An OSGi Test Setup
@@ -69,7 +70,7 @@
return helper.getDefaultRuntime();
}
- protected EmbeddedRuntime getEmbeddedRuntime()
+ protected OSGiRuntimeImpl getEmbeddedRuntime()
{
return helper.getEmbeddedRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -71,6 +71,8 @@
super(helper);
// Initialize the ignored capabilities
+ ignoredCaps.add(ConfigAdminCapability.class);
+ ignoredCaps.add(HttpCapability.class);
ignoredCaps.add(JNDICapability.class);
ignoredCaps.add(JMXCapability.class);
ignoredCaps.add(MicrocontainerCapability.class);
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -100,4 +100,9 @@
removeCapability(capability);
}
}
+
+ public String getServerHost()
+ {
+ return System.getProperty("jboss.bind.address", "localhost");
+ }
}
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 14:00:45 UTC (rev 88362)
@@ -43,13 +43,28 @@
<artifactId>jboss-aop-mc-int</artifactId>
</dependency>
- <!-- Provided Dependencies -->
+ <!-- Bundle Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.configadmin</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.jetty</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.log</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.metatype</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
Modified: projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/example/scripts/assembly-bundles.xml 2009-05-07 14:00:45 UTC (rev 88362)
@@ -15,7 +15,11 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <include>*:org.apache.felix.configadmin:jar</include>
+ <include>*:org.apache.felix.http.jetty:jar</include>
<include>*:org.apache.felix.log:jar</include>
+ <include>*:org.apache.felix.metatype:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
<include>*:jboss-osgi-common:jar</include>
<include>*:jboss-osgi-logging:jar</include>
<include>*:jboss-osgi-remotelog:jar</include>
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.example.http;
-
-//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.net.URL;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.jboss.osgi.spi.junit.IntegrationTestSetup;
-
-/**
- * A test that deployes a bundle that containes a HttpServlet which
- * is registered through the OSGi HttpService
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public class HttpServiceRemoteTestCase extends IntegrationTest
-{
- public static Test suite()
- {
- return new IntegrationTestSetup(HttpServiceRemoteTestCase.class, "example/example-http.jar");
- }
-
- public void testServletAccess() throws Exception
- {
- URL url = new URL("http://" + getServerHost() + ":8090/servlet?test=plain");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Servlet", br.readLine());
- }
-
- public void testServletInitProps() throws Exception
- {
- URL url = new URL("http://" + getServerHost() + ":8090/servlet?test=initProp");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("initProp=SomeValue", br.readLine());
- }
-
- public void testServletBundleContext() throws Exception
- {
- URL url = new URL("http://" + getServerHost() + ":8090/servlet?test=context");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("example-http", br.readLine());
- }
-
- public void testServletStartLevel() throws Exception
- {
- URL url = new URL("http://" + getServerHost() + ":8090/servlet?test=startLevel");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("startLevel=1", br.readLine());
- }
-
- public void testResourceAccess() throws Exception
- {
- URL url = new URL("http://" + getServerHost() + ":8090/file/message.txt");
- BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
- assertEquals("Hello from Resource", br.readLine());
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java (from rev 88323, projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceRemoteTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/http/HttpServiceTestCase.java 2009-05-07 14:00:45 UTC (rev 88362)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.example.http;
+
+//$Id: HttpServiceRemoteTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.ConfigAdminCapability;
+import org.jboss.osgi.spi.testing.HttpCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+
+import junit.framework.Test;
+
+/**
+ * A test that deployes a bundle that containes a HttpServlet which
+ * is registered through the OSGi HttpService
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public class HttpServiceTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle testBundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup testSetup = new OSGiTestSetup(HttpServiceTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new ConfigAdminCapability());
+ runtime.addCapability(new HttpCapability());
+ Thread.sleep(500);
+ testBundle = runtime.installBundle("example/example-http.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ testBundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return testSetup;
+ }
+
+ public void testServletAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=plain");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Servlet", br.readLine());
+ }
+
+ public void testServletInitProps() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=initProp");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("initProp=SomeValue", br.readLine());
+ }
+
+ public void testServletBundleContext() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=context");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("example-http", br.readLine());
+ }
+
+ public void testServletStartLevel() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/servlet?test=startLevel");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("startLevel=1", br.readLine());
+ }
+
+ public void testResourceAccess() throws Exception
+ {
+ URL url = new URL("http://" + runtime.getServerHost() + ":8090/file/message.txt");
+ BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+ assertEquals("Hello from Resource", br.readLine());
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-07 14:00:45 UTC (rev 88362)
@@ -19,10 +19,12 @@
org.jboss.virtual.plugins.registry, \
org.jboss.virtual.plugins.context.jar, \
org.jboss.virtual.plugins.vfs.helpers, \
- org.jboss.virtual.protocol
+ org.jboss.virtual.protocol, \
+ org.osgi.framework;version\=1.4
# Bundles that need to be installed with the Framework automatically
-# org.jboss.osgi.spi.framework.autoInstall=
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
# Bundles that need to be started automatically
org.jboss.osgi.spi.framework.autoStart=\
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 14:00:45 UTC (rev 88362)
@@ -43,9 +43,14 @@
<artifactId>jboss-aop-mc-int</artifactId>
</dependency>
- <!-- Provided Dependencies -->
+ <!-- Bundle Dependencies -->
<dependency>
<groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.jetty</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.log</artifactId>
<scope>provided</scope>
</dependency>
@@ -54,8 +59,6 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
-
- <!-- Bundle DEpendencies -->
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
<artifactId>apache-xerces-bundle</artifactId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 13:57:53 UTC (rev 88361)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 14:00:45 UTC (rev 88362)
@@ -15,6 +15,7 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
+ <include>*:org.apache.felix.http.jetty:jar</include>
<include>*:apache-xerces-bundle:jar</include>
<include>*:jaxb-bundle:jar</include>
<include>*:jboss-common-core-bundle:jar</include>
17 years, 2 months
JBoss-OSGI SVN: r88356 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle and 12 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 09:13:26 -0400 (Thu, 07 May 2009)
New Revision: 88356
Added:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
Removed:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-bootstrap-beans.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix-beans.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle/ServiceActivator.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Log:
Migrate tests to use abstract OSGiRuntime - embedded ok
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,95 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint.jmx;
-
-//$Id$
-
-import javax.management.MBeanServerConnection;
-import javax.management.ObjectName;
-import javax.naming.InitialContext;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.JMXCapability;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.jmx.bundle.FooMBean;
-
-/**
- * A test that deployes a bundle that registeres an MBean
- *
- * @author thomas.diesler(a)jboss.com
- * @since 12-Feb-2009
- */
-public class JMXTestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- runtime.addCapability(new JMXCapability());
-
- AbstractBundle bundle = runtime.installBundle("jmx-test.jar");
- bundle.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testMBeanAccess() throws Exception
- {
- ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, runtime.getMBeanServer());
- assertEquals("hello", foo.echo("hello"));
- }
-
- public void testRMIAdaptor() throws Exception
- {
- // Lookup the MBeanServerConnection
- InitialContext iniCtx = new InitialContext();
- MBeanServerConnection rmiAdaptor = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
-
- // Access the MBean through the MBeanServerConnection
- ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, rmiAdaptor);
- assertEquals("hello", foo.echo("hello"));
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java (from rev 88347, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.jmx;
+
+//$Id$
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.test.osgi.blueprint.jmx.bundle.FooMBean;
+
+/**
+ * A test that deployes a bundle that registeres an MBean
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Feb-2009
+ */
+public class JMXTestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+ private static AbstractBundle bundle;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+
+ bundle = runtime.installBundle("jmx-test.jar");
+ bundle.start();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ bundle.uninstall();
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testMBeanAccess() throws Exception
+ {
+ ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, runtime.getMBeanServer());
+ assertEquals("hello", foo.echo("hello"));
+ }
+
+ public void testRMIAdaptor() throws Exception
+ {
+ // Lookup the MBeanServerConnection
+ InitialContext iniCtx = runtime.getInitialContext();
+ MBeanServerConnection rmiAdaptor = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+
+ // Access the MBean through the MBeanServerConnection
+ ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, rmiAdaptor);
+ assertEquals("hello", foo.echo("hello"));
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,59 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint.jmx.bundle;
-
-//$Id$
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.util.tracker.ServiceTracker;
-
-/**
- * A service that registers an MBean
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public class JMXTestService
-{
- public JMXTestService(BundleContext context)
- {
- ServiceTracker tracker = new ServiceTracker(context, MBeanServer.class.getName(), null);
- tracker.open();
-
- MBeanServer mbeanServer = (MBeanServer)tracker.getService();
- if (mbeanServer == null)
- throw new IllegalStateException("No MBeanServer");
-
- try
- {
- ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- mbeanServer.registerMBean(new Foo(), oname);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException(ex);
- }
- }
-}
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/JMXTestService.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -0,0 +1,85 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.jmx.bundle;
+
+//$Id$
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.jmx.ObjectNameFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * A service that registers an MBean
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 24-Apr-2009
+ */
+public class JMXTestService
+{
+ private ServiceTracker tracker;
+ private ObjectName objectName = ObjectNameFactory.create("jboss.osgi:service=mbean-test-service");
+
+ public JMXTestService(BundleContext context)
+ {
+ tracker = new ServiceTracker(context, MBeanServer.class.getName(), null);
+ tracker.open();
+
+ MBeanServer mbeanServer = getMBeanServer();
+ if (mbeanServer == null)
+ throw new IllegalStateException("No MBeanServer");
+ }
+
+ public void start()
+ {
+ try
+ {
+ MBeanServer mbeanServer = getMBeanServer();
+ mbeanServer.registerMBean(new Foo(), objectName);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ public void stop()
+ {
+ try
+ {
+ MBeanServer mbeanServer = getMBeanServer();
+ mbeanServer.isRegistered(objectName);
+ mbeanServer.unregisterMBean(objectName);
+ }
+ catch (Exception ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ private MBeanServer getMBeanServer()
+ {
+ return (MBeanServer)tracker.getService();
+ }
+}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/ServiceActivator.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/bundle/ServiceActivator.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -34,13 +34,22 @@
*/
public class ServiceActivator implements BundleActivator
{
+ private JMXTestService service;
+
public void start(BundleContext context)
{
- JMXTestService service = new JMXTestService(context);
+ service = new JMXTestService(context);
+ service.start();
+
context.registerService(JMXTestService.class.getName(), service, null);
}
public void stop(BundleContext context)
{
+ if (service != null)
+ {
+ service.stop();
+ service = null;
+ }
}
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,94 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint.jndi;
-
-//$Id$
-
-import javax.naming.InitialContext;
-import javax.naming.NameNotFoundException;
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
-import org.jboss.osgi.spi.testing.JNDICapability;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.osgi.framework.Bundle;
-
-/**
- * A test that deployes a bundle that binds a String to JNDI
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class JNDITestCase extends OSGiTest
-{
- private static OSGiRuntime runtime;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- runtime = getDefaultRuntime();
- runtime.addCapability(new JNDICapability());
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- runtime.shutdown();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testJNDIAccess() throws Exception
- {
- AbstractBundle bundle = runtime.installBundle("jndi-test.jar");
- bundle.start();
-
- assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
-
- InitialContext iniCtx = runtime.getInitialContext();
- String lookup = (String)iniCtx.lookup("test/Foo");
- assertEquals("JNDI bound String expected", "Bar", lookup);
-
- // Uninstall should unbind the object
- bundle.uninstall();
-
- try
- {
- iniCtx.lookup("test/Foo");
- fail("NameNotFoundException expected");
- }
- catch (NameNotFoundException ex)
- {
- // expected
- }
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java (from rev 88347, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -0,0 +1,94 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint.jndi;
+
+//$Id$
+
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.osgi.framework.Bundle;
+
+/**
+ * A test that deployes a bundle that binds a String to JNDI
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JNDITestCase extends OSGiTest
+{
+ private static OSGiRuntime runtime;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testJNDIAccess() throws Exception
+ {
+ AbstractBundle bundle = runtime.installBundle("jndi-test.jar");
+ bundle.start();
+
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+
+ InitialContext iniCtx = runtime.getInitialContext();
+ String lookup = (String)iniCtx.lookup("test/Foo");
+ assertEquals("JNDI bound String expected", "Bar", lookup);
+
+ // Uninstall should unbind the object
+ bundle.uninstall();
+
+ try
+ {
+ iniCtx.lookup("test/Foo");
+ fail("NameNotFoundException expected");
+ }
+ catch (NameNotFoundException ex)
+ {
+ // expected
+ }
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle/ServiceActivator.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/bundle/ServiceActivator.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -59,7 +59,7 @@
try
{
InitialContext iniCtx = service.getInitialContext();
- iniCtx.unbind("test/Foo");
+ iniCtx.unbind("test");
}
catch (NamingException ex)
{
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -40,10 +40,10 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
@@ -67,8 +67,8 @@
super.setUp();
runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
- //runtime.addCapability(new JMXCapability());
- //runtime.addCapability(new MicrocontainerCapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new MicrocontainerCapability());
}
@Override
@@ -81,10 +81,7 @@
return setup;
}
- public void testFoo() throws Exception
- {}
-
- public void _testServiceAccess() throws Exception
+ public void testServiceAccess() throws Exception
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
List<String> registeredBeans = mcService.getRegisteredBeans();
@@ -97,7 +94,7 @@
/**
* Test whether the bundle can be deployed through the MicrocontainerServiceMBean
*/
- public void _testBundleDeployment() throws Exception
+ public void testBundleDeployment() throws Exception
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
@@ -109,7 +106,7 @@
mcService.undeploy(getTestArchiveURL("mcservice-bundleA.jar"));
}
- public void _testBeansDeployment() throws Exception
+ public void testBeansDeployment() throws Exception
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
Modified: projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -28,6 +28,7 @@
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
import javax.management.MBeanServer;
import javax.management.remote.JMXConnectorServer;
@@ -50,36 +51,33 @@
private LogService log;
private JMXServiceURL serviceURL;
private JMXConnectorServer jmxConnectorServer;
+ private boolean shutdownRegistry;
+ private Registry rmiRegistry;
public JMXConnectorService(BundleContext context, MBeanServer mbeanServer, String host, int rmiPort)
{
log = new LogServiceTracker(context);
String jmxConnectorServerPath = "/jmxconnector";
-
+
try
{
InetAddress bindAddress = InetAddress.getByName(host);
-
+
// check to see if registry already created
- Registry rmiRegistry = LocateRegistry.getRegistry(host, rmiPort);
- if (rmiRegistry != null)
+ rmiRegistry = LocateRegistry.getRegistry(host, rmiPort);
+ try
{
- try
- {
- rmiRegistry.list();
- }
- catch (RemoteException e)
- {
- log.log(LogService.LOG_DEBUG, "No registry running at host '" + host + "', port '" + rmiPort + "'. Will create one.");
- rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(bindAddress));
- }
+ rmiRegistry.list();
+ log.log(LogService.LOG_DEBUG, "Registry running at host=" + host + ",port=" + rmiPort);
}
- else
+ catch (RemoteException e)
{
+ log.log(LogService.LOG_DEBUG, "No registry running at host=" + host + ",port=" + rmiPort + ". Will create one.");
rmiRegistry = LocateRegistry.createRegistry(rmiPort, null, new DefaultSocketFactory(bindAddress));
+ shutdownRegistry = true;
}
-
+
// create new connector server and start it
serviceURL = new JMXServiceURL("service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + rmiPort + jmxConnectorServerPath);
jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
@@ -105,12 +103,14 @@
{
if (jmxConnectorServer == null)
throw new IllegalStateException("JMXConnectorServer not available");
-
+
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
jmxConnectorServer.start();
+
log.log(LogService.LOG_INFO, "JMXConnectorServer started: " + serviceURL);
}
catch (IOException ex)
@@ -129,7 +129,13 @@
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
+
jmxConnectorServer.stop();
+
+ // Shutdown the registry if this service created it
+ if (shutdownRegistry == true)
+ UnicastRemoteObject.unexportObject(rmiRegistry, true);
+
log.log(LogService.LOG_DEBUG, "JMXConnectorServer stopped");
}
catch (IOException ex)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -75,7 +75,7 @@
return getClass().getName() + "." + getName();
}
- protected OSGiRuntime getRuntime()
+ protected OSGiRuntime getDefaultRuntime()
{
return helper.getDefaultRuntime();
}
@@ -85,6 +85,11 @@
return helper.getEmbeddedRuntime();
}
+ public RemoteRuntime getRemoteRuntime()
+ {
+ return helper.getRemoteRuntime();
+ }
+
protected URL getResourceURL(String resource)
{
return helper.getResourceURL(resource);
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -69,6 +69,16 @@
return helper.getDefaultRuntime();
}
+ protected EmbeddedRuntime getEmbeddedRuntime()
+ {
+ return helper.getEmbeddedRuntime();
+ }
+
+ public RemoteRuntime getRemoteRuntime()
+ {
+ return helper.getRemoteRuntime();
+ }
+
public URL getResourceURL(String resource)
{
return helper.getResourceURL(resource);
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -50,7 +50,7 @@
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
runtime.startLogEntryTracking(logEntryCache);
}
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-bootstrap-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,111 +0,0 @@
-<!--
- The bootstrap of the server. This should only have the minimum
- needed to bootstrap the mc kernel and profile service.
-
- $Id: jboss-osgi-bootstrap-beans.xml 86378 2009-03-26 12:02:32Z thomas.diesler(a)jboss.com $
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The MainDeployer -->
- <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
- <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
- <property name="deployers"><inject bean="Deployers"/></property>
- <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
- </bean>
-
- <!-- The ManagedDeploymentCreator implementation -->
- <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator" />
-
- <!-- ModificationType structure processor -->
- <bean name="ModificationTypeStructureProcessor" class="org.jboss.deployers.vfs.plugins.structure.modify.ModificationTypeStructureProcessor">
- <incallback method="addMatcher"/>
- <uncallback method="removeMatcher"/>
- </bean>
-
- <!-- The holder for deployers that determine structure -->
- <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
- <property name="structureBuilder">
- <!-- The consolidator of the structure information -->
- <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder">
- <property name="structureProcessor"><inject bean="ModificationTypeStructureProcessor"/></property>
- </bean>
- </property>
- <!-- Accept any implementor of structure deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- The holder for deployers that do real deployment -->
- <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
- <!-- Accept any implementor of deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- A declared structure descriptor deployer -->
- <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
-
- <!-- JAR Structure -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <property name="candidateStructureVisitorFactory">
- <!-- Any file that is not an ordinary directory is a candidate -->
- <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
- <!-- A filter to exclude some obvious non-subdeployments -->
- <property name="filter">
- <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
- <constructor><parameter>
- <list elementClass="java.lang.String">
- <!-- Exclude class files as subdeployments -->
- <value>.class</value>
- </list>
- </parameter></constructor>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-
- <!-- File Structure -->
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
- <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
- <constructor>
- <parameter>
- <set elementClass="java.lang.String">
- <value>-service.xml</value>
- <value>-beans.xml</value>
- </set>
- </parameter>
- </constructor>
- </bean>
-
- <!-- POJO Deployment -->
- <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
- <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
- <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
- </bean>
-
- <!-- VFS ClassLoader -->
- <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
- <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
- </bean>
- <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
- <incallback method="addModule" state="Configured"/>
- <uncallback method="removeModule" state="Configured"/>
- </bean>
- <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
- <property name="defaultMetaData">
- <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
- </property>
- </bean>
- <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- </bean>
- <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- <property name="system"><inject bean="ClassLoaderSystem"/></property>
- </bean>
-
-</deployment>
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,49 +0,0 @@
-<!--
- $Id$
--->
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The OSGiFramework -->
- <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- <property name="properties">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- <entry>
- <key>org.osgi.framework.system.packages</key>
- <value>
- org.jboss.osgi.spi.logging,
- org.osgi.framework; version=1.4,
- org.osgi.service.log; version=1.3,
- org.osgi.util.tracker; version=1.3,
-
- <!-- needed by jboss-remoting -->
- javax.management,
- javax.naming,
- javax.net,
- javax.net.ssl,
- org.apache.log4j,
- org.jboss.logging,
- org.jboss.util,
- org.jboss.util.id,
- org.jboss.util.threadpool,
- org.jboss.util.propertyeditor,
- </value>
- </entry>
- <!--
- Setup remote logging
- -->
- <entry><key>org.jboss.osgi.service.remote.log.reader</key><value>true</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
- </map>
- </property>
- <property name="autoStart">
- <list elementClass="java.net.URL">
- <value>file://${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-logging.jar</value>
- </list>
- </property>
- </bean>
-
-</deployment>
Added: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties 2009-05-07 13:13:26 UTC (rev 88356)
@@ -0,0 +1,31 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage.clean=onFirstInit
+org.osgi.framework.bootdelegation=org.osgi.service.log
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.net.protocol, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.management, \
+ org.jboss.virtual, \
+ org.jboss.virtual.plugins.registry, \
+ org.jboss.virtual.plugins.context.jar, \
+ org.jboss.virtual.plugins.vfs.helpers, \
+ org.jboss.virtual.protocol
+
+# Bundles that need to be installed with the Framework automatically
+# org.jboss.osgi.spi.framework.autoInstall=
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jboss-osgi-felix.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi.properties 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/jndi.properties 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1099
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -23,7 +23,6 @@
//$Id: BootstrapTestCase.java 86588 2009-04-01 13:39:25Z thomas.diesler(a)jboss.com $
-import org.jboss.deployers.client.spi.main.MainDeployer;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
@@ -48,9 +47,6 @@
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertNotNull("SymbolicName not null", bundle.getSymbolicName());
-
- MainDeployer mainDeployer = bootProvider.getInstance("MainDeployer", MainDeployer.class);
- assertNotNull("MainDeployer not null", mainDeployer);
}
public void testGetBootstrapProvider() throws Exception
@@ -59,34 +55,4 @@
OSGiBootstrapProvider bp2 = OSGiBootstrap.getBootstrapProvider();
assertNotSame("Multiple provider instances", bp1, bp2);
}
-
- public void testConfigureFromResource() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- bootProvider.configure("bootstrap/mock-bootstrap-beans.xml");
-
- SomeBean bean = bootProvider.getInstance("SomeBean", SomeBean.class);
- assertNotNull("Bean not null", bean);
-
- OSGiFramework framework = bootProvider.getFramework();
- assertNull("Framework null", framework);
-
- bootProvider.configure("bootstrap/mock-osgi-beans.xml");
- assertNotNull("Framework not null", bootProvider.getFramework());
- }
-
- public void testConfigureFromURL() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- bootProvider.configure(getResourceURL("bootstrap/mock-bootstrap-beans.xml"));
-
- SomeBean bean = bootProvider.getInstance("SomeBean", SomeBean.class);
- assertNotNull("Bean not null", bean);
-
- OSGiFramework framework = bootProvider.getFramework();
- assertNull("Framework null", framework);
-
- bootProvider.configure(getResourceURL("bootstrap/mock-osgi-beans.xml"));
- assertNotNull("Framework not null", bootProvider.getFramework());
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -43,7 +43,7 @@
{
public void testNestedBundle() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -49,7 +49,7 @@
*/
public void testInstallStartX() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -69,7 +69,7 @@
*/
public void testInstallXBeforeB() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -92,7 +92,7 @@
*/
public void testInstallBBeforeA() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -118,7 +118,7 @@
*/
public void testInstallBBeforeX() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
@@ -151,7 +151,7 @@
*/
public void testInstallABeforeB() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 13:13:26 UTC (rev 88356)
@@ -46,7 +46,7 @@
{
public void testVerifyUnresolved() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
@@ -88,7 +88,7 @@
*/
public void testWiringToUninstalled() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
@@ -120,7 +120,7 @@
public void testWiringToUninstalledPackageAdmin() throws Exception
{
- OSGiRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getDefaultRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-07 13:13:26 UTC (rev 88356)
@@ -9,6 +9,7 @@
# Properties to configure the Framework
org.osgi.framework.storage.clean=onFirstInit
+org.osgi.framework.bootdelegation=org.osgi.service.log
org.osgi.framework.system.packages.extra=\
org.jboss.logging, \
org.jboss.osgi.spi, \
@@ -21,8 +22,7 @@
org.jboss.virtual.protocol
# Bundles that need to be installed with the Framework automatically
-org.jboss.osgi.spi.framework.autoInstall=\
- file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+# org.jboss.osgi.spi.framework.autoInstall=
# Bundles that need to be started automatically
org.jboss.osgi.spi.framework.autoStart=\
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 12:50:07 UTC (rev 88355)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 13:13:26 UTC (rev 88356)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1199
17 years, 2 months
JBoss-OSGI SVN: r88347 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx and 9 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 06:47:13 -0400 (Thu, 07 May 2009)
New Revision: 88347
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
Removed:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
Migrate tests to use abstract osgi runtime
Use OSGiRuntime interface
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -25,7 +25,7 @@
package org.jboss.test.osgi.blueprint.bootstrap;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -40,7 +40,7 @@
{
public void testApacheXercesBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -56,7 +56,7 @@
public void testJAXBBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jaxb-bundle.jar");
@@ -72,7 +72,7 @@
public void testJBossCommonCoreBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -89,7 +89,7 @@
public void testJBossXBBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
@@ -108,7 +108,7 @@
public void testJNDIBundle() throws BundleException
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
@@ -125,7 +125,7 @@
public void testJMXBundle() throws Exception
{
- AbstractRuntime runtime = getEmbeddedRuntime();
+ OSGiRuntime runtime = getEmbeddedRuntime();
try
{
AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -31,7 +31,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
@@ -46,7 +46,7 @@
*/
public class JMXTestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -29,7 +29,7 @@
import junit.framework.Test;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
@@ -43,7 +43,7 @@
*/
public class JNDITestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -40,7 +40,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -55,7 +55,7 @@
*/
public class MicrocontainerTestCase extends OSGiTest
{
- private static AbstractRuntime runtime;
+ private static OSGiRuntime runtime;
public static Test suite()
{
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -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.spi.testing;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.management.MBeanServerConnection;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.osgi.framework.BundleException;
-
-/**
- * [TODO]
- *
- * @author Thomas.Diesler(a)jboss.org
- * @since 25-Sep-2008
- */
-public abstract class AbstractRuntime
-{
- // Provide logging
- final Logger log = Logger.getLogger(AbstractRuntime.class);
-
- private OSGiTestHelper helper;
- private Map<String, AbstractBundle> bundles = new HashMap<String, AbstractBundle>();
- private List<Capability> capabilities = new ArrayList<Capability>();
-
- public AbstractRuntime(OSGiTestHelper helper)
- {
- this.helper = helper;
- }
-
- public OSGiTestHelper getTestHelper()
- {
- return helper;
- }
-
- public abstract AbstractBundle installBundle(String location) throws BundleException;
-
- public abstract void deploy(String location) throws Exception;
-
- public abstract void undeploy(String location) throws Exception;
-
- public abstract AbstractBundle[] getBundles();
-
- public void addCapability(Capability capability) throws BundleException
- {
- for (String location : capability.getBundles())
- {
- AbstractBundle bundle = installBundle(location);
- bundle.start();
-
- bundles.put(location, bundle);
- }
- capabilities.add(capability);
- }
-
- public void removeCapability(Capability capability)
- {
- capabilities.remove(capability);
-
- List<String> bundleLocations = capability.getBundles();
- Collections.reverse(bundleLocations);
-
- for (String location : bundleLocations)
- {
- AbstractBundle bundle = bundles.get(location);
- try
- {
- bundle.uninstall();
- }
- catch (BundleException ex)
- {
- log.error("Cannot uninstall bundle: " + bundle);
- }
- }
- }
-
- public abstract AbstractPackageAdmin getPackageAdmin();
-
- public abstract InitialContext getInitialContext() throws NamingException;
-
- public abstract MBeanServerConnection getMBeanServer();
-
- public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
-
- public abstract void stopLogEntryTracking();
-
- public void shutdown()
- {
- while (capabilities.size() > 0)
- {
- Capability capability = capabilities.get(0);
- removeCapability(capability);
- }
- }
-}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -43,6 +43,7 @@
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
@@ -57,14 +58,13 @@
* @author Thomas.Diesler(a)jboss.org
* @since 25-Sep-2008
*/
-public class EmbeddedRuntime extends AbstractRuntime
+public class EmbeddedRuntime extends OSGiRuntimeImpl
{
public EmbeddedRuntime(OSGiTestHelper helper)
{
super(helper);
}
- @Override
public AbstractBundle installBundle(String location) throws BundleException
{
URL bundleURL = getTestHelper().getTestArchiveURL(location);
@@ -72,7 +72,6 @@
return new EmbeddedBundle(bundle);
}
- @Override
public void deploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -80,7 +79,6 @@
mcService.deploy(archiveURL);
}
- @Override
public void undeploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -88,7 +86,6 @@
mcService.undeploy(archiveURL);
}
- @Override
public AbstractBundle[] getBundles()
{
List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
@@ -117,7 +114,6 @@
super.addCapability(capability);
}
- @Override
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
// Track the LogReaderService to add the LogEntryCache as LogListener
@@ -134,7 +130,6 @@
tracker.open();
}
- @Override
public void stopLogEntryTracking()
{
}
@@ -154,7 +149,6 @@
return framework.getBundleContext();
}
- @Override
@SuppressWarnings("unchecked")
public MBeanServerConnection getMBeanServer()
{
@@ -172,7 +166,6 @@
return server;
}
- @Override
@SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
@@ -184,7 +177,6 @@
return new InitialContext(env);
}
- @Override
public AbstractPackageAdmin getPackageAdmin()
{
BundleContext context = getBundleContext();
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java (from rev 88346, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public interface OSGiRuntime
+{
+ AbstractBundle installBundle(String location) throws BundleException;
+
+ void deploy(String location) throws Exception;
+
+ void undeploy(String location) throws Exception;
+
+ AbstractBundle[] getBundles();
+
+ void addCapability(Capability capability) throws BundleException;
+
+ void removeCapability(Capability capability);
+
+ AbstractPackageAdmin getPackageAdmin();
+
+ InitialContext getInitialContext() throws NamingException;
+
+ MBeanServerConnection getMBeanServer();
+
+ void startLogEntryTracking(LogEntryCache logEntryCache);
+
+ void stopLogEntryTracking();
+
+ void shutdown();
+}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -75,7 +75,7 @@
return getClass().getName() + "." + getName();
}
- protected AbstractRuntime getRuntime()
+ protected OSGiRuntime getRuntime()
{
return helper.getDefaultRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -59,9 +59,9 @@
return bootProvider;
}
- public AbstractRuntime getDefaultRuntime()
+ public OSGiRuntime getDefaultRuntime()
{
- AbstractRuntime runtime;
+ OSGiRuntime runtime;
String target = System.getProperty("target.container");
if (target == null)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -64,7 +64,7 @@
log.debug("### END SETUP " + testCase.getName());
}
- public AbstractRuntime getDefaultRuntime()
+ public OSGiRuntime getDefaultRuntime()
{
return helper.getDefaultRuntime();
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -50,6 +50,7 @@
import org.jboss.osgi.spi.management.ManagedBundleMBean;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.testing.internal.OSGiRuntimeImpl;
import org.osgi.framework.BundleException;
import org.osgi.framework.Constants;
@@ -59,7 +60,7 @@
* @author Thomas.Diesler(a)jboss.org
* @since 25-Sep-2008
*/
-public class RemoteRuntime extends AbstractRuntime
+public class RemoteRuntime extends OSGiRuntimeImpl
{
private MBeanServerConnection mbeanServer;
private ManagedFrameworkMBean managedFramework;
@@ -75,7 +76,6 @@
ignoredCaps.add(MicrocontainerCapability.class);
}
- @Override
public AbstractBundle installBundle(String location) throws BundleException
{
String symbolicName = null;
@@ -110,7 +110,6 @@
}
}
- @Override
public void deploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -118,7 +117,6 @@
mcService.deploy(archiveURL);
}
- @Override
public void undeploy(String location) throws Exception
{
URL archiveURL = getTestHelper().getTestArchiveURL(location);
@@ -135,24 +133,20 @@
super.addCapability(capability);
}
- @Override
public AbstractBundle[] getBundles()
{
throw new NotImplementedException();
}
- @Override
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
throw new NotImplementedException();
}
- @Override
public void stopLogEntryTracking()
{
}
- @Override
public MBeanServerConnection getMBeanServer()
{
if (mbeanServer == null)
@@ -170,7 +164,6 @@
return mbeanServer;
}
- @Override
@SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
@@ -182,7 +175,6 @@
return new InitialContext(env);
}
- @Override
public AbstractPackageAdmin getPackageAdmin()
{
throw new NotImplementedException();
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -0,0 +1,103 @@
+/*
+ * 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.testing.internal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.Capability;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiRuntimeImpl implements OSGiRuntime
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(OSGiRuntimeImpl.class);
+
+ private OSGiTestHelper helper;
+ private Map<String, AbstractBundle> bundles = new HashMap<String, AbstractBundle>();
+ private List<Capability> capabilities = new ArrayList<Capability>();
+
+ public OSGiRuntimeImpl(OSGiTestHelper helper)
+ {
+ this.helper = helper;
+ }
+
+ public OSGiTestHelper getTestHelper()
+ {
+ return helper;
+ }
+
+ public void addCapability(Capability capability) throws BundleException
+ {
+ for (String location : capability.getBundles())
+ {
+ AbstractBundle bundle = installBundle(location);
+ bundle.start();
+
+ bundles.put(location, bundle);
+ }
+ capabilities.add(capability);
+ }
+
+ public void removeCapability(Capability capability)
+ {
+ capabilities.remove(capability);
+
+ List<String> bundleLocations = capability.getBundles();
+ Collections.reverse(bundleLocations);
+
+ for (String location : bundleLocations)
+ {
+ AbstractBundle bundle = bundles.get(location);
+ try
+ {
+ bundle.uninstall();
+ }
+ catch (BundleException ex)
+ {
+ log.error("Cannot uninstall bundle: " + bundle);
+ }
+ }
+ }
+
+ public void shutdown()
+ {
+ while (capabilities.size() > 0)
+ {
+ Capability capability = capabilities.get(0);
+ removeCapability(capability);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/internal/OSGiRuntimeImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -28,7 +28,7 @@
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.osgi.spi.logging.LogEntryFilter;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.service.log.LogEntry;
@@ -43,7 +43,7 @@
public class LogServiceTestCase extends OSGiTest
{
private LogEntryCache logEntryCache;
- private AbstractRuntime runtime;
+ private OSGiRuntime runtime;
@Override
protected void setUp() throws Exception
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -28,7 +28,7 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.JMXCapability;
import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.MicrocontainerCapability;
@@ -46,7 +46,7 @@
*/
public class OSGI36RemoteTestCase extends OSGiTest
{
- static AbstractRuntime runtime;
+ static OSGiRuntime runtime;
public static Test suite()
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -27,7 +27,7 @@
import java.util.List;
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
@@ -43,7 +43,7 @@
{
public void testNestedBundle() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -24,7 +24,7 @@
//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
import org.jboss.osgi.spi.testing.AbstractBundle;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -49,7 +49,7 @@
*/
public void testInstallStartX() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -69,7 +69,7 @@
*/
public void testInstallXBeforeB() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -92,7 +92,7 @@
*/
public void testInstallBBeforeA() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
@@ -118,7 +118,7 @@
*/
public void testInstallBBeforeX() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
@@ -151,7 +151,7 @@
*/
public void testInstallABeforeB() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:47:13 UTC (rev 88347)
@@ -25,7 +25,7 @@
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractPackageAdmin;
-import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiRuntime;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -46,7 +46,7 @@
{
public void testVerifyUnresolved() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
@@ -88,7 +88,7 @@
*/
public void testWiringToUninstalled() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
@@ -120,7 +120,7 @@
public void testWiringToUninstalledPackageAdmin() throws Exception
{
- AbstractRuntime runtime = getRuntime();
+ OSGiRuntime runtime = getRuntime();
try
{
AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
17 years, 2 months
JBoss-OSGI SVN: r88346 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint and 22 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 06:38:40 -0400 (Thu, 07 May 2009)
New Revision: 88346
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Removed:
projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Migrate tests to use abstract osgi runtime
Deleted: projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://localhost:1099
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class JMXCapability extends Capability
-{
- public JMXCapability()
- {
- Properties props = getProperties();
- props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
- props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
-
- addBundle("bundles/jboss-osgi-jmx.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -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.test.osgi.blueprint;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class JNDICapability extends Capability
-{
- public JNDICapability()
- {
- Properties props = getProperties();
- props.setProperty("org.jboss.osgi.jndi.host", System.getProperty("jboss.bind.address", "localhost"));
- props.setProperty("org.jboss.osgi.jndi.rmi.port", "1198");
- props.setProperty("org.jboss.osgi.jndi.port", "1199");
-
- addBundle("bundles/jboss-common-core-bundle.jar");
- addBundle("bundles/jboss-osgi-jndi.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class MicrocontainerCapability extends Capability
-{
- public MicrocontainerCapability()
- {
- addBundle("bundles/apache-xerces-bundle.jar");
- addBundle("bundles/jaxb-bundle.jar");
- addBundle("bundles/jbossxb-bundle.jar");
- addBundle("bundles/jboss-osgi-microcontainer.jar");
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -32,10 +32,10 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JMXCapability;
-import org.jboss.test.osgi.blueprint.JNDICapability;
import org.jboss.test.osgi.blueprint.jmx.bundle.FooMBean;
/**
@@ -56,7 +56,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
runtime.addCapability(new JMXCapability());
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -30,9 +30,9 @@
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JNDICapability;
import org.osgi.framework.Bundle;
/**
@@ -53,7 +53,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
}
@@ -74,7 +74,7 @@
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
- InitialContext iniCtx = new InitialContext();
+ InitialContext iniCtx = runtime.getInitialContext();
String lookup = (String)iniCtx.lookup("test/Foo");
assertEquals("JNDI bound String expected", "Bar", lookup);
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -27,8 +27,8 @@
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MAIN_DEPLOYER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
-import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import java.util.List;
import java.util.Set;
@@ -37,15 +37,15 @@
import junit.framework.Test;
-import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JMXCapability;
-import org.jboss.test.osgi.blueprint.JNDICapability;
-import org.jboss.test.osgi.blueprint.MicrocontainerCapability;
/**
* A test that checks whether the MicrocontainerService can be accessed
@@ -65,7 +65,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
//runtime.addCapability(new JMXCapability());
//runtime.addCapability(new MicrocontainerCapability());
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1199
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,33 +0,0 @@
-#
-# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
-#
-# $Id$
-#
-
-# The OSGiFramework implementation
-org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
-
-# Properties to configure the Framework
-org.osgi.framework.storage.clean=onFirstInit
-org.osgi.framework.system.packages.extra=\
- org.jboss.logging
-
-# JMX bundle properties
-org.jboss.osgi.jmx.host=(a)jboss.bind.address@
-org.jboss.osgi.jmx.rmi.port=1198
-
-# JNDI bundle properties
-org.jboss.osgi.jndi.host=(a)jboss.bind.address@
-org.jboss.osgi.jndi.rmi.port=1198
-org.jboss.osgi.jndi.port=1199
-
-# Bundles that need to be installed with the Framework automatically
-org.jboss.osgi.spi.framework.autoInstall=\
- file://${test.archive.directory}/bundles/org.osgi.compendium.jar
-
-# Bundles that need to be started automatically
-org.jboss.osgi.spi.framework.autoStart=\
- file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
-
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,6 +23,8 @@
//$Id$
+import java.util.Hashtable;
+
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -36,8 +38,16 @@
*/
public class NamingServiceImpl implements NamingService
{
+ private String jndiHost, jndiPort;
private InitialContext initialContext;
+ public NamingServiceImpl(String jndiHost, String jndiPort)
+ {
+ this.jndiHost = jndiHost;
+ this.jndiPort = jndiPort;
+ }
+
+ @SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
if (initialContext == null)
@@ -46,7 +56,13 @@
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- initialContext = new InitialContext();
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
+
+ initialContext = new InitialContext(env);
}
finally
{
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -63,7 +63,7 @@
jnpServer = new JNPServer(context, jndiHost, Integer.parseInt(jndiPort), Integer.parseInt(jndiRmiPort));
jnpServer.start();
- context.registerService(NamingService.class.getName(), new NamingServiceImpl(), null);
+ context.registerService(NamingService.class.getName(), new NamingServiceImpl(jndiHost, jndiPort), null);
log.log(LogService.LOG_DEBUG, "NamingService registered");
}
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -114,6 +114,7 @@
org.jboss.osgi.common.log,
org.jboss.osgi.jmx,
org.jboss.osgi.spi,
+ org.jboss.osgi.spi.management,
org.jboss.reflect.*,
org.jboss.util.*,
org.jboss.virtual*,
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -26,7 +26,6 @@
import java.net.URL;
import java.util.List;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.kernel.Kernel;
/**
@@ -37,54 +36,54 @@
*/
public interface MicrocontainerService
{
- /**
- * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ /*
+ * * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
*/
String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
- /**
- * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
+ /*
+ * * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
*/
String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
- /**
- * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ /*
+ * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
*/
String BEAN_MAIN_DEPLOYER = "jboss.osgi:service=MainDeployer";
- /**
- * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
+ /*
+ * * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
*/
String BEAN_KERNEL_CONTROLLER = "jboss.osgi:service=KernelController";
- /**
- * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ /*
+ * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
*/
String BEAN_KERNEL = "jboss.osgi:service=Kernel";
- /**
- * Get the Microcontainer Kernel
+ /*
+ * * Get the Microcontainer Kernel
*/
Kernel getKernel();
- /**
- * Get the list of registered beans.
+ /*
+ * * Get the list of registered beans.
*/
List<String> getRegisteredBeans();
-
- /**
- * Get a registered bean from the Kernel.
+
+ /*
+ * * Get a registered bean from the Kernel.
* @return null if there is no bean registered under this name
*/
Object getRegisteredBean(String beanName);
- /**
- * Deploy MC beans from URL
+ /*
+ * * Deploy MC beans from URL
*/
- void deploy(URL url) throws DeploymentException;
+ void deploy(URL url) throws Exception;
- /**
- * Undeploy MC beans from URL
+ /*
+ * * Undeploy MC beans from URL
*/
- void undeploy(URL url);
+ void undeploy(URL url) throws Exception;
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,61 +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.microcontainer;
-
-//$Id$
-
-import java.net.URL;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.osgi.jmx.ObjectNameFactory;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler(a)jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerServiceMBean
-{
- /**
- * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
- */
- ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
-
- /**
- * Get the list of registered beans.
- */
- List<String> getRegisteredBeans();
-
- /**
- * Deploy MC beans from URL
- */
- void deploy(URL url) throws DeploymentException;
-
- /**
- * Undeploy MC beans from URL
- */
- void undeploy(URL url);
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -50,7 +50,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.microcontainer.MicrocontainerService;
-import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleContext;
@@ -107,7 +107,7 @@
return context != null ? context.getTarget() : null;
}
- public void deploy(URL url) throws DeploymentException
+ public void deploy(URL url) throws Exception
{
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
@@ -133,21 +133,14 @@
}
}
- public void undeploy(URL url)
+ public void undeploy(URL url) throws Exception
{
String deploymentName = contextMap.remove(url);
if (deploymentName != null)
{
- try
- {
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
- mainDeployer.removeDeployment(deploymentName);
- mainDeployer.process();
- }
- catch (DeploymentException ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot undeploy: " + url, ex);
- }
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ mainDeployer.removeDeployment(deploymentName);
+ mainDeployer.process();
}
else
{
@@ -235,7 +228,7 @@
}
}
}
-
+
static class PreInstalledControllerContext extends AbstractControllerContext
{
public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -28,6 +28,8 @@
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
+import java.util.Enumeration;
+import java.util.Properties;
import org.jboss.logging.Logger;
@@ -119,10 +121,24 @@
private static void initSystemProperties()
{
- // Set the default bind address
- String bindAddress = System.getProperty("jboss.bind.address");
- if (bindAddress == null)
- System.setProperty("jboss.bind.address", "localhost");
+ log.debug("initSystemProperties");
+
+ Properties defaults = new Properties();
+ defaults.setProperty("jboss.bind.address", "localhost");
+ defaults.setProperty("java.protocol.handler.pkgs", "org.jboss.net.protocol|org.jboss.virtual.protocol");
+
+ Enumeration<?> defaultNames = defaults.propertyNames();
+ while(defaultNames.hasMoreElements())
+ {
+ String propName = (String)defaultNames.nextElement();
+ String sysValue = System.getProperty(propName);
+ if (sysValue == null)
+ {
+ String propValue = defaults.getProperty(propName);
+ System.setProperty(propName, propValue);
+ log.debug(" " + propName + "=" + propValue);
+ }
+ }
}
static class StartupThread extends Thread
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (from rev 88323, projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,58 @@
+/*
+ * 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.management;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+ /**
+ * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
+ */
+ ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+ /**
+ * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -33,6 +33,7 @@
* @author thomas.diesler(a)jboss.com
* @since 23-Jan-2009
*/
+@Deprecated
public interface MicrocontainerService
{
/**
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -36,6 +36,7 @@
* @author thomas.diesler(a)jboss.com
* @since 23-Jan-2009
*/
+@Deprecated
public class MicrocontainerServiceImpl implements MicrocontainerService
{
private BundleContext systemContext;
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -38,4 +38,6 @@
public abstract void uninstall() throws BundleException;
public abstract int getState();
+
+ public abstract String getSymbolicName();
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,34 @@
+/*
+ * 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.testing;
+
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractPackageAdmin
+{
+ public abstract void refreshPackages(AbstractBundle[] bundles);
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -27,7 +27,9 @@
import java.util.List;
import java.util.Map;
-import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.logging.LogEntryCache;
@@ -60,6 +62,12 @@
public abstract AbstractBundle installBundle(String location) throws BundleException;
+ public abstract void deploy(String location) throws Exception;
+
+ public abstract void undeploy(String location) throws Exception;
+
+ public abstract AbstractBundle[] getBundles();
+
public void addCapability(Capability capability) throws BundleException
{
for (String location : capability.getBundles())
@@ -93,8 +101,12 @@
}
}
- public abstract MBeanServer getMBeanServer();
+ public abstract AbstractPackageAdmin getPackageAdmin();
+ public abstract InitialContext getInitialContext() throws NamingException;
+
+ public abstract MBeanServerConnection getMBeanServer();
+
public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
public abstract void stopLogEntryTracking();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -39,6 +39,11 @@
this.bundle = bundle;
}
+ public Bundle getBundle()
+ {
+ return bundle;
+ }
+
@Override
public void start() throws BundleException
{
@@ -62,4 +67,10 @@
{
return bundle.getState();
}
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedPackageAdmin extends AbstractPackageAdmin
+{
+ private PackageAdmin packAdmin;
+
+ public EmbeddedPackageAdmin(PackageAdmin packAdmin)
+ {
+ this.packAdmin = packAdmin;
+ }
+
+ @Override
+ public void refreshPackages(AbstractBundle[] bundles)
+ {
+ Bundle[] bundleArr = null;
+ if (bundles != null)
+ {
+ bundleArr = new Bundle[bundles.length];
+ for (int i=0; i < bundles.length; i++)
+ {
+ bundleArr[i] = ((EmbeddedBundle)bundles[i]).getBundle();
+ }
+ }
+ packAdmin.refreshPackages(bundleArr);
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,22 +21,34 @@
*/
package org.jboss.osgi.spi.testing;
+// $Id$
+
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
import java.util.Properties;
import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
import javax.management.MBeanServerFactory;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogReaderService;
+import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -61,6 +73,35 @@
}
@Override
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(archiveURL);
+ }
+
+ @Override
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.undeploy(archiveURL);
+ }
+
+ @Override
+ public AbstractBundle[] getBundles()
+ {
+ List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
+ for (Bundle bundle : getBundleContext().getBundles())
+ {
+ absBundles.add(new EmbeddedBundle(bundle));
+ }
+ AbstractBundle[] bundleArr = new AbstractBundle[absBundles.size()];
+ absBundles.toArray(bundleArr);
+ return bundleArr;
+ }
+
+ @Override
public void addCapability(Capability capability) throws BundleException
{
// Copy the properties to the System props
@@ -115,7 +156,7 @@
@Override
@SuppressWarnings("unchecked")
- public MBeanServer getMBeanServer()
+ public MBeanServerConnection getMBeanServer()
{
ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
if (serverArr.size() > 1)
@@ -130,4 +171,25 @@
return server;
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public InitialContext getInitialContext() throws NamingException
+ {
+ Hashtable env = new Hashtable();
+ String bindAddress = System.getProperty("jboss.bind.address", "localhost");
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + bindAddress + ":1199");
+ return new InitialContext(env);
+ }
+
+ @Override
+ public AbstractPackageAdmin getPackageAdmin()
+ {
+ BundleContext context = getBundleContext();
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin packAdmin = (PackageAdmin)context.getService(sref);
+ return new EmbeddedPackageAdmin(packAdmin);
+ }
}
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JMXCapability extends Capability
+{
+ public JMXCapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
+
+ addBundle("bundles/jboss-osgi-jmx.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -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.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JNDICapability extends Capability
+{
+ public JNDICapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.jboss.osgi.jndi.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.jndi.rmi.port", "1198");
+ props.setProperty("org.jboss.osgi.jndi.port", "1199");
+
+ addBundle("bundles/jboss-common-core-bundle.jar");
+ addBundle("bundles/jboss-osgi-jndi.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerCapability extends Capability
+{
+ public MicrocontainerCapability()
+ {
+ addBundle("bundles/apache-xerces-bundle.jar");
+ addBundle("bundles/jaxb-bundle.jar");
+ addBundle("bundles/jbossxb-bundle.jar");
+ addBundle("bundles/jboss-osgi-microcontainer.jar");
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,11 +21,13 @@
*/
package org.jboss.osgi.spi.testing;
+import java.io.File;
import java.net.URL;
import junit.framework.TestCase;
import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
/**
* An OSGi Test Case
@@ -38,13 +40,19 @@
// Provide logging
final Logger log = Logger.getLogger(OSGiTest.class);
- private OSGiTestHelper delegate;
+ private OSGiTestHelper helper;
+ public OSGiTest()
+ {
+ // Prevent unknown protocol: vfsfile
+ VFS.init();
+ }
+
@Override
protected void setUp() throws Exception
{
log.debug("### START " + getLongName());
- delegate = new OSGiTestHelper();
+ helper = new OSGiTestHelper();
super.setUp();
}
@@ -69,21 +77,31 @@
protected AbstractRuntime getRuntime()
{
- return delegate.getRuntime();
+ return helper.getDefaultRuntime();
}
protected EmbeddedRuntime getEmbeddedRuntime()
{
- return delegate.getEmbeddedRuntime();
+ return helper.getEmbeddedRuntime();
}
protected URL getResourceURL(String resource)
{
- return delegate.getResourceURL(resource);
+ return helper.getResourceURL(resource);
}
+ protected File getResourceFile(String resource)
+ {
+ return helper.getResourceFile(resource);
+ }
+
protected URL getTestArchiveURL(String archive)
{
- return delegate.getTestArchiveURL(archive);
+ return helper.getTestArchiveURL(archive);
}
+
+ protected File getTestArchiveFile(String archive)
+ {
+ return helper.getTestArchiveFile(archive);
+ }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -59,9 +59,20 @@
return bootProvider;
}
- public AbstractRuntime getRuntime()
+ public AbstractRuntime getDefaultRuntime()
{
- return getEmbeddedRuntime();
+ AbstractRuntime runtime;
+
+ String target = System.getProperty("target.container");
+ if (target == null)
+ {
+ runtime = getEmbeddedRuntime();
+ }
+ else
+ {
+ runtime = getRemoteRuntime();
+ }
+ return runtime;
}
public EmbeddedRuntime getEmbeddedRuntime()
@@ -69,9 +80,9 @@
return new EmbeddedRuntime(this);
}
- public AbstractRuntime getRemoteRuntime()
+ public RemoteRuntime getRemoteRuntime()
{
- return null;
+ return new RemoteRuntime(this);
}
/** Try to discover the URL for the test resource */
@@ -104,7 +115,7 @@
}
/** Try to discover the File for the test resource */
- private File getResourceFile(String resource)
+ public File getResourceFile(String resource)
{
File file = new File(resource);
if (file.exists())
@@ -118,7 +129,7 @@
}
/** Try to discover the File for the deployment archive */
- private File getTestArchiveFile(String archive)
+ public File getTestArchiveFile(String archive)
{
File file = new File(archive);
if (file.exists())
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.spi.testing;
+import java.io.File;
import java.net.URL;
import junit.extensions.TestSetup;
@@ -63,9 +64,9 @@
log.debug("### END SETUP " + testCase.getName());
}
- public AbstractRuntime getRuntime()
+ public AbstractRuntime getDefaultRuntime()
{
- return helper.getRuntime();
+ return helper.getDefaultRuntime();
}
public URL getResourceURL(String resource)
@@ -73,8 +74,18 @@
return helper.getResourceURL(resource);
}
+ protected File getResourceFile(String resource)
+ {
+ return helper.getResourceFile(resource);
+ }
+
public URL getTestArchiveURL(String archive)
{
return helper.getTestArchiveURL(archive);
}
+
+ protected File getTestArchiveFile(String archive)
+ {
+ return helper.getTestArchiveFile(archive);
+ }
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,90 @@
+/*
+ * 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.testing;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.RemoteBundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteBundleBadName extends AbstractBundle
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(RemoteBundleBadName.class);
+
+ private RemoteRuntime runtime;
+ private RemoteBundle bundle;
+ private String location;
+
+ public RemoteBundleBadName(RemoteRuntime runtime, RemoteBundle bundle, String location)
+ {
+ this.runtime = runtime;
+ this.bundle = bundle;
+ this.location = location;
+ }
+
+ @Override
+ public void start() throws BundleException
+ {
+ bundle.start();
+ }
+
+ @Override
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ try
+ {
+ runtime.undeploy(location);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot uninstall: " + location);
+ }
+ }
+
+ @Override
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,233 @@
+/*
+ * 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.testing;
+
+// $Id$
+
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.framework.RemoteBundle;
+import org.jboss.osgi.spi.framework.RemoteFramework;
+import org.jboss.osgi.spi.framework.RemoteFrameworkException;
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.management.ManagedBundleMBean;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteRuntime extends AbstractRuntime
+{
+ private MBeanServerConnection mbeanServer;
+ private ManagedFrameworkMBean managedFramework;
+ private Set<Class<?>> ignoredCaps = new HashSet<Class<?>>();
+
+ public RemoteRuntime(OSGiTestHelper helper)
+ {
+ super(helper);
+
+ // Initialize the ignored capabilities
+ ignoredCaps.add(JNDICapability.class);
+ ignoredCaps.add(JMXCapability.class);
+ ignoredCaps.add(MicrocontainerCapability.class);
+ }
+
+ @Override
+ public AbstractBundle installBundle(String location) throws BundleException
+ {
+ String symbolicName = null;
+ try
+ {
+ File archiveFile = getTestHelper().getTestArchiveFile(location);
+ JarInputStream jarInputStream = new JarInputStream(new FileInputStream(archiveFile));
+ Attributes attribs = jarInputStream.getManifest().getMainAttributes();
+ symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ jarInputStream.close();
+ }
+ catch (IOException ex)
+ {
+
+ }
+ if (symbolicName == null)
+ throw new IllegalArgumentException("Cannot obtain Bundle-SymbolicName for: " + location);
+
+ try
+ {
+ deploy(location);
+ RemoteBundle bundle = getRemoteFramework().getBundle(symbolicName);
+ return new RemoteBundleBadName(this, bundle, location);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot install: " + location, ex);
+ }
+ }
+
+ @Override
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(archiveURL);
+ }
+
+ @Override
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.undeploy(archiveURL);
+ }
+
+ @Override
+ public void addCapability(Capability capability) throws BundleException
+ {
+ if (ignoredCaps.contains(capability.getClass()))
+ return;
+
+ super.addCapability(capability);
+ }
+
+ @Override
+ public AbstractBundle[] getBundles()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void startLogEntryTracking(final LogEntryCache logEntryCache)
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void stopLogEntryTracking()
+ {
+ }
+
+ @Override
+ public MBeanServerConnection getMBeanServer()
+ {
+ if (mbeanServer == null)
+ {
+ try
+ {
+ InitialContext iniCtx = getInitialContext();
+ mbeanServer = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot obtain MBeanServerConnection", ex);
+ }
+ }
+ return mbeanServer;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public InitialContext getInitialContext() throws NamingException
+ {
+ Hashtable env = new Hashtable();
+ String bindAddress = System.getProperty("jboss.bind.address", "localhost");
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + bindAddress + ":1099");
+ return new InitialContext(env);
+ }
+
+ @Override
+ public AbstractPackageAdmin getPackageAdmin()
+ {
+ throw new NotImplementedException();
+ }
+
+ private RemoteFramework getRemoteFramework() throws Exception
+ {
+ if (managedFramework == null)
+ managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+
+ return new RemoteFramework()
+ {
+ public RemoteBundle getBundle(String symbolicName)
+ {
+ ObjectName bundleOName = managedFramework.getBundle(symbolicName);
+ if (bundleOName == null)
+ throw new IllegalArgumentException("Cannot remote bundle for: " + symbolicName);
+
+ try
+ {
+ return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
+ }
+
+ public Set<RemoteBundle> getBundles()
+ {
+ Set<RemoteBundle> remBundles = new HashSet<RemoteBundle>();
+ for (ObjectName bundleOName : managedFramework.getBundles())
+ {
+ try
+ {
+ RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ remBundles.add(remBundle);
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
+ }
+ return remBundles;
+ }
+ };
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -88,12 +88,6 @@
<!-- Build -->
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -54,15 +54,26 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Bundle DEpendencies -->
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version}</version>
+ <artifactId>apache-xerces-bundle</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-logging</artifactId>
+ <artifactId>jaxb-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-common-core-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
@@ -80,20 +91,31 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-microcontainer</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-remotelog</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jbossxb-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<!-- Build -->
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -15,10 +15,18 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
- <include>*:org.apache.felix.log:jar</include>
+ <include>*:apache-xerces-bundle:jar</include>
+ <include>*:jaxb-bundle:jar</include>
+ <include>*:jboss-common-core-bundle:jar</include>
<include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
<include>*:jboss-osgi-logging:jar</include>
+ <include>*:jboss-osgi-microcontainer:jar</include>
<include>*:jboss-osgi-remotelog:jar</include>
+ <include>*:jbossxb-bundle:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
<scope>provided</scope>
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java (from rev 88323, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.deployer.jbosgi36;
+
+//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.test.osgi.deployer.jbosgi36.mbean.FooMBean;
+
+/**
+ * [JBOSGI-36] Bundle classes leak into system classloader
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-36
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 25-Feb-2009
+ */
+public class OSGI36RemoteTestCase extends OSGiTest
+{
+ static AbstractRuntime runtime;
+
+ public static Test suite()
+ {
+ TestSetup setup = new OSGiTestSetup(OSGI36RemoteTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new MicrocontainerCapability());
+
+ runtime.deploy("jbosgi36-bundle.jar");
+ runtime.deploy("jbosgi36-mbean.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.undeploy("jbosgi36-mbean.jar");
+ runtime.undeploy("jbosgi36-bundle.jar");
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testAccessMBean() throws Exception
+ {
+ assertEquals("hello", getFooMBean().echo("hello"));
+ }
+
+ public void testAccessSomeService() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeService();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ public void testAccessSomeInternal() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeInternal();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ private FooMBean getFooMBean() throws MBeanProxyException
+ {
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
+ return foo;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployer.jbosgi36;
-
-//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler(a)jboss.com $
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.jboss.osgi.spi.junit.IntegrationTestSetup;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.test.osgi.deployer.jbosgi36.mbean.FooMBean;
-
-/**
- * [JBOSGI-36] Bundle classes leak into system classloader
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-36
- *
- * @author thomas.diesler(a)jboss.com
- * @since 25-Feb-2009
- */
-public class OSGI36TestCase extends IntegrationTest
-{
- static IntegrationTestSetup setup;
-
- public static Test suite()
- {
- setup = new IntegrationTestSetup(OSGI36TestCase.class, "jbosgi36-bundle.jar, jbosgi36-mbean.jar");
- return setup;
- }
-
- public void testAccessMBean() throws Exception
- {
- assertEquals("hello", getFooMBean().echo("hello"));
- }
-
- public void testAccessSomeService() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeService();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- public void testAccessSomeInternal() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeInternal();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- private FooMBean getFooMBean() throws MBeanProxyException
- {
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getMBeanServerConnection());
- return foo;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -26,10 +26,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* [JBOSGI-37] Prevent creation of deployment unit for nested jars
@@ -41,26 +41,18 @@
*/
public class OSGI37TestCase extends OSGiTest
{
- private BundleContext sysContext;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- OSGiFramework framework = getBootstrapProvider().getFramework();
- sysContext = framework.getBundleContext();
- }
-
public void testNestedBundle() throws Exception
{
- Bundle bundleA = installBundle(sysContext, "jbosgi37-bundleA.jar", true);
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
+ bundleA.start();
+
assertEquals("Bundle started", Bundle.ACTIVE, bundleA.getState());
List<String> relevant = new ArrayList<String>();
- for (Bundle bundle : sysContext.getBundles())
+ for (AbstractBundle bundle : runtime.getBundles())
{
String symbolicName = bundle.getSymbolicName();
if (symbolicName.startsWith("jbosgi37"))
@@ -72,7 +64,7 @@
}
finally
{
- bundleA.uninstall();
+ runtime.shutdown();
}
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,11 +23,10 @@
//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
/**
@@ -50,13 +49,10 @@
*/
public void testInstallStartX() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleX.start();
@@ -64,7 +60,7 @@
}
finally
{
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -73,17 +69,13 @@
*/
public void testInstallXBeforeB() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
bundleB.start();
@@ -91,8 +83,7 @@
}
finally
{
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -101,21 +92,16 @@
*/
public void testInstallBBeforeA() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
bundleA.start();
@@ -123,9 +109,7 @@
}
finally
{
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -134,14 +118,10 @@
*/
public void testInstallBBeforeX() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
try
@@ -154,7 +134,7 @@
// expected
}
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleB.start();
@@ -162,8 +142,7 @@
}
finally
{
- uninstall(bundleX);
- uninstall(bundleB);
+ runtime.shutdown();
}
}
@@ -172,18 +151,13 @@
*/
public void testInstallABeforeB() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
try
@@ -196,7 +170,7 @@
// expected
}
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleB.start();
@@ -207,22 +181,7 @@
}
finally
{
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
-
- private void uninstall(Bundle bnd)
- {
- try
- {
- if (bnd != null)
- bnd.uninstall();
- }
- catch (BundleException ex)
- {
- System.err.println(ex.toString());
- }
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,13 +23,12 @@
//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractPackageAdmin;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
/**
* [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
@@ -47,31 +46,33 @@
{
public void testVerifyUnresolved() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
bundleB.start();
- fail("Unresolved constraint expected");
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
}
- catch (BundleException ex)
+ finally
{
- // expected
+ runtime.shutdown();
}
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
}
/*
@@ -87,74 +88,83 @@
*/
public void testWiringToUninstalled() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ AbstractRuntime runtime = getRuntime();
+ try
+ {
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Install B without X
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- bundleB.uninstall();
+ bundleB.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
}
public void testWiringToUninstalledPackageAdmin() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Forces the update (replacement) or removal of packages exported by the specified bundles.
- ServiceReference sref = sysContext.getServiceReference(PackageAdmin.class.getName());
- PackageAdmin packAdmin = (PackageAdmin)sysContext.getService(sref);
- packAdmin.refreshPackages(null);
-
- // Install B without X
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
bundleB.start();
- fail("Unresolved constraint expected");
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Forces the update (replacement) or removal of packages exported by the specified bundles.
+ AbstractPackageAdmin packAdmin = runtime.getPackageAdmin();
+ packAdmin.refreshPackages(null);
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
}
- catch (BundleException ex)
+ finally
{
- // expected
+ runtime.shutdown();
}
-
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
}
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,111 +0,0 @@
-<!--
- The bootstrap of the server. This should only have the minimum
- needed to bootstrap the mc kernel and profile service.
-
- $Id: jboss-osgi-bootstrap-beans.xml 86378 2009-03-26 12:02:32Z thomas.diesler(a)jboss.com $
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The MainDeployer -->
- <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
- <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
- <property name="deployers"><inject bean="Deployers"/></property>
- <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
- </bean>
-
- <!-- The ManagedDeploymentCreator implementation -->
- <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator" />
-
- <!-- ModificationType structure processor -->
- <bean name="ModificationTypeStructureProcessor" class="org.jboss.deployers.vfs.plugins.structure.modify.ModificationTypeStructureProcessor">
- <incallback method="addMatcher"/>
- <uncallback method="removeMatcher"/>
- </bean>
-
- <!-- The holder for deployers that determine structure -->
- <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
- <property name="structureBuilder">
- <!-- The consolidator of the structure information -->
- <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder">
- <property name="structureProcessor"><inject bean="ModificationTypeStructureProcessor"/></property>
- </bean>
- </property>
- <!-- Accept any implementor of structure deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- The holder for deployers that do real deployment -->
- <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
- <!-- Accept any implementor of deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- A declared structure descriptor deployer -->
- <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
-
- <!-- JAR Structure -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <property name="candidateStructureVisitorFactory">
- <!-- Any file that is not an ordinary directory is a candidate -->
- <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
- <!-- A filter to exclude some obvious non-subdeployments -->
- <property name="filter">
- <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
- <constructor><parameter>
- <list elementClass="java.lang.String">
- <!-- Exclude class files as subdeployments -->
- <value>.class</value>
- </list>
- </parameter></constructor>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-
- <!-- File Structure -->
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
- <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
- <constructor>
- <parameter>
- <set elementClass="java.lang.String">
- <value>-service.xml</value>
- <value>-beans.xml</value>
- </set>
- </parameter>
- </constructor>
- </bean>
-
- <!-- POJO Deployment -->
- <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
- <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
- <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
- </bean>
-
- <!-- VFS ClassLoader -->
- <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
- <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
- </bean>
- <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
- <incallback method="addModule" state="Configured"/>
- <uncallback method="removeModule" state="Configured"/>
- </bean>
- <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
- <property name="defaultMetaData">
- <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
- </property>
- </bean>
- <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- </bean>
- <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- <property name="system"><inject bean="ClassLoaderSystem"/></property>
- </bean>
-
-</deployment>
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,49 +0,0 @@
-<!--
- $Id$
--->
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The OSGiFramework -->
- <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- <property name="properties">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- <entry>
- <key>org.osgi.framework.system.packages</key>
- <value>
- org.jboss.osgi.spi.logging,
- org.osgi.framework; version=1.4,
- org.osgi.service.log; version=1.3,
- org.osgi.util.tracker; version=1.3,
-
- <!-- needed by jboss-remoting -->
- javax.management,
- javax.naming,
- javax.net,
- javax.net.ssl,
- org.apache.log4j,
- org.jboss.logging,
- org.jboss.util,
- org.jboss.util.id,
- org.jboss.util.threadpool,
- org.jboss.util.propertyeditor,
- </value>
- </entry>
- <!--
- Setup remote logging
- -->
- <entry><key>org.jboss.osgi.service.remote.log.reader</key><value>true</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
- </map>
- </property>
- <property name="autoStart">
- <list elementClass="java.net.URL">
- <value>file://${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-logging.jar</value>
- </list>
- </property>
- </bean>
-
-</deployment>
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,31 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage.clean=onFirstInit
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.management, \
+ org.jboss.virtual, \
+ org.jboss.virtual.plugins.registry, \
+ org.jboss.virtual.plugins.context.jar, \
+ org.jboss.virtual.plugins.vfs.helpers, \
+ org.jboss.net.protocol, \
+ org.jboss.virtual.protocol
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +1,3 @@
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1099
+java.naming.provider.url=jnp://@jboss.bind.address@:1199
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -19,6 +19,16 @@
<module>functional</module>
</modules>
+ <!-- Build -->
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ </build>
+
<!-- Profiles -->
<profiles>
@@ -56,7 +66,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-felix-beans.xml</value>
+ <value>jboss-osgi-felix.properties</value>
</property>
</systemProperties>
</configuration>
@@ -100,7 +110,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-felix-beans.xml</value>
+ <value>jboss-osgi-felix.properties</value>
</property>
</systemProperties>
</configuration>
@@ -145,7 +155,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-equinox-beans.xml</value>
+ <value>jboss-osgi-equinox.properties</value>
</property>
</systemProperties>
</configuration>
@@ -190,7 +200,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-knopflerfish-beans.xml</value>
+ <value>jboss-osgi-knopflerfish.properties</value>
</property>
</systemProperties>
</configuration>
@@ -227,11 +237,11 @@
</profile>
<!--
- Name: remote-tesing
+ Name: remote-testing
Descr: Setup for remote integration testing
-->
<profile>
- <id>remote-tesing</id>
+ <id>remote-testing</id>
<activation>
<property>
<name>target.container</name>
17 years, 2 months