JBoss-OSGI SVN: r88331 - in projects/jboss-osgi/trunk/runtime: felix/src/main/resources and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-07 02:03:39 -0400 (Thu, 07 May 2009)
New Revision: 88331
Modified:
projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
Log:
Fix reference to bundleContext
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 05:59:02 UTC (rev 88330)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 06:03:39 UTC (rev 88331)
@@ -41,7 +41,7 @@
<!-- A Service that gives access to the Microcontainer Kernel -->
<bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
+ <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>
@@ -51,18 +51,18 @@
<!-- The OSGi Bundle Deployer -->
<bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
<property name="skipBundles"><inject bean="jboss.osgi:service=Framework" property="autoInstall" /></property>
</bean>
<!-- The Bundle ClassLoader Deployer -->
<bean name="jboss.osgi:service=BundleClassLoaderDeployer" class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Start/Stop Deployer -->
<bean name="jboss.osgi:service=BundleStartStopDeployer" class="org.jboss.osgi.deployer.BundleStartStopDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Management Deployer -->
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 05:59:02 UTC (rev 88330)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 06:03:39 UTC (rev 88331)
@@ -64,7 +64,7 @@
<!-- A Service that gives access to the Microcontainer Kernel -->
<bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
+ <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>
@@ -77,18 +77,18 @@
<!-- The OSGi Bundle Deployer -->
<bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
<property name="skipBundles"><inject bean="jboss.osgi:service=Framework" property="autoInstall" /></property>
</bean>
<!-- The Bundle ClassLoader Deployer -->
<bean name="jboss.osgi:service=BundleClassLoaderDeployer" class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Start/Stop Deployer -->
<bean name="jboss.osgi:service=BundleStartStopDeployer" class="org.jboss.osgi.deployer.BundleStartStopDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Management Deployer -->
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 05:59:02 UTC (rev 88330)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/resources/osgi-deployers-jboss-beans.xml 2009-05-07 06:03:39 UTC (rev 88331)
@@ -40,7 +40,7 @@
<!-- A Service that gives access to the Microcontainer Kernel -->
<bean name="jboss.osgi:service=Microcontainer" class="org.jboss.osgi.spi.service.microcontainer.internal.MicrocontainerServiceImpl">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext"/></property>
+ <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>
@@ -53,18 +53,18 @@
<!-- The OSGi Bundle Deployer -->
<bean name="jboss.osgi:service=BundleRealDeployer" class="org.jboss.osgi.deployer.BundleRealDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
<property name="skipBundles"><inject bean="jboss.osgi:service=Framework" property="autoInstall" /></property>
</bean>
<!-- The Bundle ClassLoader Deployer -->
<bean name="jboss.osgi:service=BundleClassLoaderDeployer" class="org.jboss.osgi.deployer.BundleClassLoaderDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Start/Stop Deployer -->
<bean name="jboss.osgi:service=BundleStartStopDeployer" class="org.jboss.osgi.deployer.BundleStartStopDeployer">
- <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="systemBundleContext" /></property>
+ <property name="systemContext"><inject bean="jboss.osgi:service=Framework" property="bundleContext" /></property>
</bean>
<!-- The Bundle Management Deployer -->
17 years, 2 months
JBoss-OSGI SVN: r88304 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap and 11 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-06 16:29:26 -0400 (Wed, 06 May 2009)
New Revision: 88304
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/Capability.java
Removed:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java
Modified:
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/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.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/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.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/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/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java
Log:
Migrate tests to use abstract osgi runtime
Modified: 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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -21,14 +21,12 @@
*/
package org.jboss.test.osgi.blueprint;
+//$Id$
+
import java.util.Properties;
-import org.jboss.osgi.spi.junit.Capability;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
+import org.jboss.osgi.spi.testing.Capability;
-//$Id$
-
/**
* [TODO]
*
@@ -39,15 +37,10 @@
{
public JMXCapability()
{
- Properties props = new Properties();
+ 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");
- setProperties(props);
+
+ addBundle("bundles/jboss-osgi-jmx.jar");
}
-
- public void deploy(BundleContext context) throws BundleException
- {
- super.deploy(context);
- deploy(context, "bundles/jboss-osgi-jmx.jar", true);
- }
}
\ No newline at end of file
Modified: 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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -21,14 +21,12 @@
*/
package org.jboss.test.osgi.blueprint;
+//$Id$
+
import java.util.Properties;
-import org.jboss.osgi.spi.junit.Capability;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
+import org.jboss.osgi.spi.testing.Capability;
-//$Id$
-
/**
* [TODO]
*
@@ -39,17 +37,12 @@
{
public JNDICapability()
{
- Properties props = new Properties();
+ 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");
- setProperties(props);
+
+ addBundle("bundles/jboss-common-core-bundle.jar");
+ addBundle("bundles/jboss-osgi-jndi.jar");
}
-
- public void deploy(BundleContext context) throws BundleException
- {
- super.deploy(context);
- deploy(context, "bundles/jboss-common-core-bundle.jar", true);
- deploy(context, "bundles/jboss-osgi-jndi.jar", true);
- }
}
\ No newline at end of file
Modified: 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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -21,14 +21,10 @@
*/
package org.jboss.test.osgi.blueprint;
-import java.util.Properties;
-
-import org.jboss.osgi.spi.junit.Capability;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
//$Id$
+import org.jboss.osgi.spi.testing.Capability;
+
/**
* [TODO]
*
@@ -39,16 +35,9 @@
{
public MicrocontainerCapability()
{
- Properties props = new Properties();
- setProperties(props);
+ addBundle("bundles/apache-xerces-bundle.jar");
+ addBundle("bundles/jaxb-bundle.jar");
+ addBundle("bundles/jbossxb-bundle.jar");
+ addBundle("bundles/jboss-osgi-microcontainer.jar");
}
-
- public void deploy(BundleContext context) throws BundleException
- {
- super.deploy(context);
- deploy(context, "bundles/apache-xerces-bundle.jar", true);
- deploy(context, "bundles/jaxb-bundle.jar", true);
- deploy(context, "bundles/jbossxb-bundle.jar", true);
- deploy(context, "bundles/jboss-osgi-microcontainer.jar", true);
- }
}
\ No newline at end of file
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -24,12 +24,10 @@
//$Id$
package org.jboss.test.osgi.blueprint.bootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-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;
/**
@@ -42,116 +40,104 @@
{
public void testApacheXercesBundle() throws BundleException
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
+ AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
+ bundle.start();
- Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
-
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
public void testJAXBBundle() throws BundleException
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
-
- Bundle bundle = installBundle(context, "bundles/jaxb-bundle.jar", true);
-
+ AbstractBundle bundle = runtime.installBundle("bundles/jaxb-bundle.jar");
+ bundle.start();
+
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
public void testJBossCommonCoreBundle() throws BundleException
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
+ AbstractBundle bundle = runtime.installBundle("bundles/apache-xerces-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle.start();
- Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
- bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
-
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
public void testJBossXBBundle() throws BundleException
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
+ 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();
- Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
- bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
- bundle = installBundle(context, "bundles/jaxb-bundle.jar", true);
- bundle = installBundle(context, "bundles/jbossxb-bundle.jar", true);
-
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
public void testJNDIBundle() throws BundleException
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
+ AbstractBundle bundle = runtime.installBundle("bundles/jboss-common-core-bundle.jar");
+ bundle = runtime.installBundle("bundles/jboss-osgi-jndi.jar");
+ bundle.start();
- Bundle bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
- bundle = installBundle(context, "bundles/jboss-osgi-jndi.jar", true);
-
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
public void testJMXBundle() throws Exception
{
- OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- OSGiFramework framework = configProvider.getFramework();
+ AbstractRuntime runtime = getEmbeddedRuntime();
try
{
- BundleContext context = framework.getBundleContext();
+ 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();
- Bundle bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
- bundle = installBundle(context, "bundles/jboss-osgi-jndi.jar", true);
- bundle = installBundle(context, "bundles/jboss-osgi-jmx.jar", true);
-
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
}
finally
{
- framework.stop();
+ runtime.shutdown();
}
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -27,7 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
/**
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -29,14 +29,14 @@
import junit.framework.Test;
-import org.jboss.osgi.spi.junit.OSGiFrameworkWrapper;
-import org.jboss.osgi.spi.junit.OSGiTest;
-import org.jboss.osgi.spi.junit.OSGiTestSetup;
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.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;
-import org.osgi.framework.BundleContext;
/**
* A test that deployes a bundle that registeres an MBean
@@ -46,7 +46,7 @@
*/
public class JMXTestCase extends OSGiTest
{
- private static OSGiFrameworkWrapper framework;
+ private static AbstractRuntime runtime;
public static Test suite()
{
@@ -56,18 +56,18 @@
protected void setUp() throws Exception
{
super.setUp();
- framework = wrapFramework(getBootstrapProvider().getFramework());
- framework.addCapability(new JNDICapability());
- framework.addCapability(new JMXCapability());
+ runtime = getRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
- BundleContext sysContext = framework.getBundleContext();
- installBundle(sysContext, "jmx-test.jar", true);
+ AbstractBundle bundle = runtime.installBundle("jmx-test.jar");
+ bundle.start();
}
@Override
protected void tearDown() throws Exception
{
- framework.stop();
+ runtime.shutdown();
super.tearDown();
}
};
@@ -77,7 +77,7 @@
public void testMBeanAccess() throws Exception
{
ObjectName oname = new ObjectName("jboss.osgi:service=mbean-test-service");
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, getMBeanServer());
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, oname, runtime.getMBeanServer());
assertEquals("hello", foo.echo("hello"));
}
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -28,12 +28,12 @@
import junit.framework.Test;
-import org.jboss.osgi.spi.junit.OSGiFrameworkWrapper;
-import org.jboss.osgi.spi.junit.OSGiTest;
-import org.jboss.osgi.spi.junit.OSGiTestSetup;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+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;
-import org.osgi.framework.BundleContext;
/**
* A test that deployes a bundle that binds a String to JNDI
@@ -43,7 +43,7 @@
*/
public class JNDITestCase extends OSGiTest
{
- private static OSGiFrameworkWrapper framework;
+ private static AbstractRuntime runtime;
public static Test suite()
{
@@ -53,14 +53,14 @@
protected void setUp() throws Exception
{
super.setUp();
- framework = wrapFramework(getBootstrapProvider().getFramework());
- framework.addCapability(new JNDICapability());
+ runtime = getRuntime();
+ runtime.addCapability(new JNDICapability());
}
@Override
protected void tearDown() throws Exception
{
- framework.stop();
+ runtime.shutdown();
super.tearDown();
}
};
@@ -69,9 +69,9 @@
public void testJNDIAccess() throws Exception
{
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundle = installBundle(sysContext, "jndi-test.jar", true);
+ AbstractBundle bundle = runtime.installBundle("jndi-test.jar");
+ bundle.start();
+
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
InitialContext iniCtx = new InitialContext();
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -38,11 +38,11 @@
import junit.framework.Test;
import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
-import org.jboss.osgi.spi.junit.OSGiFrameworkWrapper;
-import org.jboss.osgi.spi.junit.OSGiTest;
-import org.jboss.osgi.spi.junit.OSGiTestSetup;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+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;
@@ -55,7 +55,7 @@
*/
public class MicrocontainerTestCase extends OSGiTest
{
- private static OSGiFrameworkWrapper framework;
+ private static AbstractRuntime runtime;
public static Test suite()
{
@@ -65,16 +65,16 @@
protected void setUp() throws Exception
{
super.setUp();
- framework = wrapFramework(getBootstrapProvider().getFramework());
- framework.addCapability(new JNDICapability());
- //framework.addCapability(new JMXCapability());
- //framework.addCapability(new MicrocontainerCapability());
+ runtime = getRuntime();
+ runtime.addCapability(new JNDICapability());
+ //runtime.addCapability(new JMXCapability());
+ //runtime.addCapability(new MicrocontainerCapability());
}
@Override
protected void tearDown() throws Exception
{
- framework.stop();
+ runtime.shutdown();
super.tearDown();
}
};
@@ -86,7 +86,7 @@
public void _testServiceAccess() throws Exception
{
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ 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));
@@ -99,10 +99,10 @@
*/
public void _testBundleDeployment() throws Exception
{
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
- ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, runtime.getMBeanServer());
Set<ObjectName> bundles = frameworkMBean.getBundles();
assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleA") > 0);
@@ -111,10 +111,10 @@
public void _testBeansDeployment() throws Exception
{
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, runtime.getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
- ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, runtime.getMBeanServer());
Set<ObjectName> bundles = frameworkMBean.getBundles();
assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleB") > 0);
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -27,7 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
/**
Modified: projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -27,7 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
/**
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -27,7 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
/**
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -1,107 +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.junit;
-
-import java.util.ArrayList;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-//$Id$
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public abstract class Capability
-{
- private OSGiFrameworkWrapper framework;
- private Properties props;
- private List<Bundle> bundles = new ArrayList<Bundle>();
-
- public Capability()
- {
- }
-
- public Capability(Properties props)
- {
- this.props = props;
- }
-
- public Properties getProperties()
- {
- return props;
- }
-
- public void setProperties(Properties props)
- {
- this.props = props;
- }
-
- public void setFrameworkWrapper(OSGiFrameworkWrapper framework)
- {
- this.framework = framework;
- }
-
- protected void initProperties(BundleContext context)
- {
- if (props != null)
- {
- Enumeration<?> keys = props.propertyNames();
- while (keys.hasMoreElements())
- {
- String key = (String)keys.nextElement();
- String value = props.getProperty(key);
- System.setProperty(key, value);
- }
- }
- }
-
- protected void deploy(BundleContext context, String bundlePath, boolean start) throws BundleException
- {
- addBundle(framework.installBundle(context, bundlePath, start));
- }
-
- protected void addBundle(Bundle bundle)
- {
- bundles.add(0, bundle);
- }
-
- public void deploy(BundleContext context) throws BundleException
- {
- initProperties(context);
- }
-
- public void undeploy(BundleContext context) throws BundleException
- {
- for (Bundle bundle : bundles)
- {
- bundle.uninstall();
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -1,51 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.spi.junit;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public class EmbeddedFrameworkWrapper extends OSGiFrameworkWrapper
-{
- private OSGiTestHelper helper = new OSGiTestHelper();
-
- public EmbeddedFrameworkWrapper(OSGiFramework framework)
- {
- super(framework);
- }
-
- @Override
- public Bundle installBundle(BundleContext context, String bundlePath, boolean start) throws BundleException
- {
- return helper.installBundle(context, bundlePath, start);
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -1,76 +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.junit;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler(a)jboss.com
- * @since 05-May-2009
- */
-public abstract class OSGiFrameworkWrapper
-{
- private OSGiFramework framework;
-
- public OSGiFrameworkWrapper(OSGiFramework framework)
- {
- this.framework = framework;
- }
-
- public BundleContext getBundleContext()
- {
- return framework.getBundleContext();
- }
-
- public void addCapability(Capability cap) throws BundleException
- {
- cap.setFrameworkWrapper(this);
- BundleContext context = framework.getBundleContext();
- cap.deploy(context);
- }
-
- public void removeCapability(Capability cap) throws BundleException
- {
- BundleContext context = framework.getBundleContext();
- cap.undeploy(context);
- }
-
- public abstract Bundle installBundle(BundleContext context, String bundlePath, boolean start) throws BundleException;
-
- public void start()
- {
- framework.start();
- }
-
- public void stop()
- {
- framework.stop();
- }
-
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -31,7 +31,6 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.virtual.VFS;
import org.osgi.framework.Bundle;
@@ -146,9 +145,4 @@
{
return delegate.getMBeanServer();
}
-
- protected OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
- {
- return delegate.wrapFramework(framework);
- }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -207,9 +207,4 @@
return server;
}
-
- public OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
- {
- return new EmbeddedFrameworkWrapper(framework);
- }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -32,7 +32,6 @@
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.virtual.VFS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -116,9 +115,4 @@
{
return delegate.getMBeanServer();
}
-
- protected OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
- {
- return delegate.wrapFramework(framework);
- }
}
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -21,8 +21,15 @@
*/
package org.jboss.osgi.spi.testing;
-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.MBeanServer;
+
+import org.jboss.logging.Logger;
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.osgi.framework.BundleException;
@@ -34,13 +41,70 @@
*/
public abstract class AbstractRuntime
{
- public abstract AbstractBundle installBundle(URL bundleURL) throws BundleException;
+ // 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 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 MBeanServer getMBeanServer();
+
public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
public abstract void stopLogEntryTracking();
+
+ public void shutdown()
{
- // TODO Auto-generated method stub
-
+ while (capabilities.size() > 0)
+ {
+ Capability capability = capabilities.get(0);
+ removeCapability(capability);
+ }
}
}
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/Capability.java (from rev 88284, projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/Capability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/Capability.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -0,0 +1,59 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public abstract class Capability
+{
+ private Properties props = new Properties();
+ private List<String> bundles = new ArrayList<String>();
+
+ public Capability()
+ {
+ }
+
+ public Properties getProperties()
+ {
+ return props;
+ }
+
+ protected void addBundle(String bundle)
+ {
+ bundles.add(bundle);
+ }
+
+ public List<String> getBundles()
+ {
+ return new ArrayList<String>(bundles);
+ }
+}
\ 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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -22,7 +22,13 @@
package org.jboss.osgi.spi.testing;
import java.net.URL;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.Properties;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
@@ -41,21 +47,36 @@
*/
public class EmbeddedRuntime extends AbstractRuntime
{
- private OSGiBootstrapProvider bootProvider;
-
- public EmbeddedRuntime(OSGiBootstrapProvider bootProvider)
+ public EmbeddedRuntime(OSGiTestHelper helper)
{
- this.bootProvider = bootProvider;
+ super(helper);
}
@Override
- public AbstractBundle installBundle(URL bundleURL) throws BundleException
+ public AbstractBundle installBundle(String location) throws BundleException
{
+ URL bundleURL = getTestHelper().getTestArchiveURL(location);
Bundle bundle = getBundleContext().installBundle(bundleURL.toExternalForm());
return new EmbeddedBundle(bundle);
}
@Override
+ public void addCapability(Capability capability) throws BundleException
+ {
+ // Copy the properties to the System props
+ Properties props = capability.getProperties();
+ Enumeration<?> names = props.propertyNames();
+ while (names.hasMoreElements())
+ {
+ String key = (String)names.nextElement();
+ String value = props.getProperty(key);
+ System.setProperty(key, value);
+ }
+
+ super.addCapability(capability);
+ }
+
+ @Override
public void startLogEntryTracking(final LogEntryCache logEntryCache)
{
// Track the LogReaderService to add the LogEntryCache as LogListener
@@ -77,9 +98,36 @@
{
}
+ @Override
+ public void shutdown()
+ {
+ super.shutdown();
+ OSGiBootstrapProvider bootProvider = getTestHelper().getBootstrapProvider();
+ bootProvider.getFramework().stop();
+ }
+
private BundleContext getBundleContext()
{
+ OSGiBootstrapProvider bootProvider = getTestHelper().getBootstrapProvider();
OSGiFramework framework = bootProvider.getFramework();
return framework.getBundleContext();
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public MBeanServer getMBeanServer()
+ {
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
+ }
}
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -38,12 +38,13 @@
// Provide logging
final Logger log = Logger.getLogger(OSGiTest.class);
- private OSGiTestHelper delegate = new OSGiTestHelper();
+ private OSGiTestHelper delegate;
@Override
protected void setUp() throws Exception
{
log.debug("### START " + getLongName());
+ delegate = new OSGiTestHelper();
super.setUp();
}
@@ -71,6 +72,11 @@
return delegate.getRuntime();
}
+ protected EmbeddedRuntime getEmbeddedRuntime()
+ {
+ return delegate.getEmbeddedRuntime();
+ }
+
protected URL getResourceURL(String resource)
{
return delegate.getResourceURL(resource);
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -39,6 +39,7 @@
private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+ // The OSGiBootstrapProvider is a lazy property of the helper
private OSGiBootstrapProvider bootProvider;
private static String testResourcesDir;
@@ -50,19 +51,24 @@
testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
}
+ public OSGiBootstrapProvider getBootstrapProvider()
+ {
+ if (bootProvider == null)
+ bootProvider = OSGiBootstrap.getBootstrapProvider();
+
+ return bootProvider;
+ }
+
public AbstractRuntime getRuntime()
{
return getEmbeddedRuntime();
}
- public AbstractRuntime getEmbeddedRuntime()
+ public EmbeddedRuntime getEmbeddedRuntime()
{
- if (bootProvider == null)
- bootProvider = OSGiBootstrap.getBootstrapProvider();
-
- return new EmbeddedRuntime(bootProvider);
+ return new EmbeddedRuntime(this);
}
-
+
public AbstractRuntime getRemoteRuntime()
{
return null;
@@ -84,6 +90,19 @@
return resURL;
}
+ /** Try to discover the URL for the deployment archive */
+ public URL getTestArchiveURL(String archive)
+ {
+ try
+ {
+ return getTestArchiveFile(archive).toURI().toURL();
+ }
+ catch (MalformedURLException ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
/** Try to discover the File for the test resource */
private File getResourceFile(String resource)
{
@@ -98,19 +117,6 @@
throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
}
- /** Try to discover the URL for the deployment archive */
- public URL getTestArchiveURL(String archive)
- {
- try
- {
- return getTestArchiveFile(archive).toURI().toURL();
- }
- catch (MalformedURLException ex)
- {
- throw new IllegalStateException(ex);
- }
- }
-
/** Try to discover the File for the deployment archive */
private File getTestArchiveFile(String archive)
{
@@ -124,5 +130,4 @@
throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
}
-
}
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -21,22 +21,12 @@
*/
package org.jboss.osgi.spi.testing;
-import java.io.File;
-import java.net.MalformedURLException;
import java.net.URL;
-import javax.management.MBeanServer;
-
import junit.extensions.TestSetup;
import junit.framework.TestSuite;
import org.jboss.logging.Logger;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.virtual.VFS;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
/**
* An OSGi Test Setup
@@ -49,7 +39,7 @@
// Provide logging
final Logger log = Logger.getLogger(OSGiTestSetup.class);
- private OSGiTestHelper delegate = new OSGiTestHelper();
+ private OSGiTestHelper helper;
private Class<?> testCase;
public OSGiTestSetup(Class<?> testCase)
@@ -62,6 +52,7 @@
protected void setUp() throws Exception
{
log.debug("### START SETUP " + testCase.getName());
+ helper = new OSGiTestHelper();
super.setUp();
}
@@ -71,4 +62,19 @@
super.tearDown();
log.debug("### END SETUP " + testCase.getName());
}
+
+ public AbstractRuntime getRuntime()
+ {
+ return helper.getRuntime();
+ }
+
+ public URL getResourceURL(String resource)
+ {
+ return helper.getResourceURL(resource);
+ }
+
+ public URL getTestArchiveURL(String archive)
+ {
+ return helper.getTestArchiveURL(archive);
+ }
}
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -23,17 +23,14 @@
//$Id: LogServiceTestCase.java 87330 2009-04-15 10:57:57Z thomas.diesler(a)jboss.com $
-import java.net.URL;
import java.util.List;
-import org.jboss.osgi.spi.framework.OSGiFramework;
+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.OSGiTest;
-import org.jboss.osgi.spi.logging.LogEntryCache;
-import org.jboss.osgi.spi.logging.LogEntryFilter;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.service.log.LogEntry;
import org.osgi.service.log.LogService;
@@ -69,8 +66,7 @@
public void testLogEntryFilter() throws Exception
{
// Install and start the test bundle
- URL testURL = getTestArchiveURL("example/example-log.jar");
- AbstractBundle bundleA = runtime.installBundle(testURL);
+ AbstractBundle bundleA = runtime.installBundle("example/example-log.jar");
bundleA.start();
// Verify that the bundle is active
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-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -27,7 +27,7 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
/**
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-05-06 20:01:26 UTC (rev 88303)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-05-06 20:29:26 UTC (rev 88304)
@@ -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.jbosgi39;
-
-//$Id$
-
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-
-/**
- * [FELIX-1040] Bundle may start with unresolved packages
- *
- * https://issues.apache.org/jira/browse/FELIX-1040
- *
- * @author thomas.diesler(a)jboss.com
- * @since 17-Apr-2009
- */
-public class FELIX1040TestCase extends OSGiTest
-{
- public void testVerifyUnresolved() throws Exception
- {
- OSGiFramework fwOne = createBootstrapProvider().getFramework();
- try
- {
- BundleContext ctxOne = fwOne.getBundleContext();
-
- Bundle bundleA = ctxOne.installBundle(getTestArchiveURL("jbosgi37-bundleA.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
-
- bundleA.start();
- }
- finally
- {
- fwOne.stop();
- }
-
- OSGiFramework fwTwo = createBootstrapProvider().getFramework();
- try
- {
- BundleContext ctxTwo = fwTwo.getBundleContext();
-
- Bundle bundleB = ctxTwo.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
- try
- {
- bundleB.start();
- fail("Unresolved constraint expected");
- }
- catch (BundleException ex)
- {
- // expected
- }
- }
- finally
- {
- fwTwo.stop();
- }
- }
-}
\ No newline at end of file
17 years, 2 months
JBoss-OSGI SVN: r88278 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/testing and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-06 13:41:51 -0400 (Wed, 06 May 2009)
New Revision: 88278
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/
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
Modified:
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java
Log:
Migrate tests to use abstract osgi runtime
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractBundle
+{
+ public abstract void start() throws BundleException;
+
+ public abstract void stop() throws BundleException;
+
+ public abstract void uninstall() throws BundleException;
+
+ public abstract int getState();
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.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/AbstractRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -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;
+
+import java.net.URL;
+
+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
+{
+ public abstract AbstractBundle installBundle(URL bundleURL) throws BundleException;
+
+ public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
+
+ public abstract void stopLogEntryTracking();
+ {
+ // TODO Auto-generated method stub
+
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.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/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,65 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedBundle extends AbstractBundle
+{
+ private Bundle bundle;
+
+ public EmbeddedBundle(Bundle bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ @Override
+ public void start() throws BundleException
+ {
+ bundle.start();
+ }
+
+ @Override
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ bundle.uninstall();
+ }
+
+ @Override
+ public int getState()
+ {
+ return bundle.getState();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.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/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -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.osgi.spi.testing;
+
+import java.net.URL;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.logging.LogEntryCache;
+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.util.tracker.ServiceTracker;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedRuntime extends AbstractRuntime
+{
+ private OSGiBootstrapProvider bootProvider;
+
+ public EmbeddedRuntime(OSGiBootstrapProvider bootProvider)
+ {
+ this.bootProvider = bootProvider;
+ }
+
+ @Override
+ public AbstractBundle installBundle(URL bundleURL) throws BundleException
+ {
+ Bundle bundle = getBundleContext().installBundle(bundleURL.toExternalForm());
+ return new EmbeddedBundle(bundle);
+ }
+
+ @Override
+ public void startLogEntryTracking(final LogEntryCache 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;
+ }
+ };
+ tracker.open();
+ }
+
+ @Override
+ public void stopLogEntryTracking()
+ {
+ }
+
+ private BundleContext getBundleContext()
+ {
+ OSGiFramework framework = bootProvider.getFramework();
+ return framework.getBundleContext();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.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/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+import org.jboss.logging.Logger;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class OSGiTest extends TestCase
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(OSGiTest.class);
+
+ private OSGiTestHelper delegate = new OSGiTestHelper();
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ log.debug("### START " + getLongName());
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ log.debug("### END " + getLongName());
+ }
+
+ protected String getShortName()
+ {
+ String shortName = getClass().getName();
+ shortName = shortName.substring(shortName.lastIndexOf(".") + 1);
+ return shortName;
+ }
+
+ protected String getLongName()
+ {
+ return getClass().getName() + "." + getName();
+ }
+
+ protected AbstractRuntime getRuntime()
+ {
+ return delegate.getRuntime();
+ }
+
+ protected URL getResourceURL(String resource)
+ {
+ return delegate.getResourceURL(resource);
+ }
+
+ protected URL getTestArchiveURL(String archive)
+ {
+ return delegate.getTestArchiveURL(archive);
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.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/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,128 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+
+/**
+ * An OSGi Test Helper
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class OSGiTestHelper
+{
+ private static final String SYSPROP_TEST_RESOURCES_DIRECTORY = "test.resources.directory";
+ private static final String SYSPROP_TEST_ARCHIVE_DIRECTORY = "test.archive.directory";
+
+ private OSGiBootstrapProvider bootProvider;
+
+ private static String testResourcesDir;
+ private static String testArchiveDir;
+
+ public OSGiTestHelper()
+ {
+ testResourcesDir = System.getProperty(SYSPROP_TEST_RESOURCES_DIRECTORY, "target/test-classes");
+ testArchiveDir = System.getProperty(SYSPROP_TEST_ARCHIVE_DIRECTORY, "target/test-libs");
+ }
+
+ public AbstractRuntime getRuntime()
+ {
+ return getEmbeddedRuntime();
+ }
+
+ public AbstractRuntime getEmbeddedRuntime()
+ {
+ if (bootProvider == null)
+ bootProvider = OSGiBootstrap.getBootstrapProvider();
+
+ return new EmbeddedRuntime(bootProvider);
+ }
+
+ public AbstractRuntime getRemoteRuntime()
+ {
+ return null;
+ }
+
+ /** Try to discover the URL for the test resource */
+ public URL getResourceURL(String resource)
+ {
+ URL resURL = null;
+ try
+ {
+ File resourceFile = getResourceFile(resource);
+ resURL = resourceFile.toURI().toURL();
+ }
+ catch (MalformedURLException e)
+ {
+ // ignore
+ }
+ return resURL;
+ }
+
+ /** Try to discover the File for the test resource */
+ private File getResourceFile(String resource)
+ {
+ File file = new File(resource);
+ if (file.exists())
+ return file;
+
+ file = new File(testResourcesDir + "/" + resource);
+ if (file.exists())
+ return file;
+
+ throw new IllegalArgumentException("Cannot obtain '" + testResourcesDir + "/" + resource + "'");
+ }
+
+ /** Try to discover the URL for the deployment archive */
+ public URL getTestArchiveURL(String archive)
+ {
+ try
+ {
+ return getTestArchiveFile(archive).toURI().toURL();
+ }
+ catch (MalformedURLException ex)
+ {
+ throw new IllegalStateException(ex);
+ }
+ }
+
+ /** Try to discover the File for the deployment archive */
+ private File getTestArchiveFile(String archive)
+ {
+ File file = new File(archive);
+ if (file.exists())
+ return file;
+
+ file = new File(testArchiveDir + "/" + archive);
+ if (file.exists())
+ return file;
+
+ throw new IllegalArgumentException("Cannot obtain '" + testArchiveDir + "/" + archive + "'.");
+ }
+
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.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/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -0,0 +1,74 @@
+/*
+ * 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.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.management.MBeanServer;
+
+import junit.extensions.TestSetup;
+import junit.framework.TestSuite;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.virtual.VFS;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Setup
+ *
+ * @author Thomas.Diesler(a)jboss.org
+ * @since 25-Sep-2008
+ */
+public class OSGiTestSetup extends TestSetup
+{
+ // Provide logging
+ final Logger log = Logger.getLogger(OSGiTestSetup.class);
+
+ private OSGiTestHelper delegate = new OSGiTestHelper();
+ private Class<?> testCase;
+
+ public OSGiTestSetup(Class<?> testCase)
+ {
+ super(new TestSuite(testCase));
+ this.testCase = testCase;
+ }
+
+ @Override
+ protected void setUp() throws Exception
+ {
+ log.debug("### START SETUP " + testCase.getName());
+ super.setUp();
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ super.tearDown();
+ log.debug("### END SETUP " + testCase.getName());
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.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-06 17:33:01 UTC (rev 88277)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-06 17:41:51 UTC (rev 88278)
@@ -27,7 +27,9 @@
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.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.osgi.spi.logging.LogEntryFilter;
import org.osgi.framework.Bundle;
@@ -44,32 +46,31 @@
public class LogServiceTestCase extends OSGiTest
{
private LogEntryCache logEntryCache;
+ private AbstractRuntime runtime;
@Override
protected void setUp() throws Exception
{
super.setUp();
+ runtime = getRuntime();
logEntryCache = new LogEntryCache(new LogEntryFilter("example-log(.*)", LogService.LOG_INFO, "\\[ServiceA\\](.*)"));
- startLogEntryTracking(logEntryCache);
+ runtime.startLogEntryTracking(logEntryCache);
}
+
@Override
protected void tearDown() throws Exception
{
- stopLogEntryTracking();
+ runtime.stopLogEntryTracking();
super.tearDown();
}
public void testLogEntryFilter() throws Exception
{
- // Bootstrap the Framework and get the system bundle
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
// Install and start the test bundle
URL testURL = getTestArchiveURL("example/example-log.jar");
- Bundle bundleA = sysContext.installBundle(testURL.toExternalForm());
+ AbstractBundle bundleA = runtime.installBundle(testURL);
bundleA.start();
// Verify that the bundle is active
17 years, 2 months
JBoss-OSGI SVN: r88261 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap and 20 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-06 09:23:23 -0400 (Wed, 06 May 2009)
New Revision: 88261
Added:
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/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java
Removed:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/BlueprintTest.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.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/bootstrap/SystemBundleTestCase.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/resources/jboss-osgi-framework.properties
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java
projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/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/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java
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/MockFramework.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/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/FELIX1040TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
Log:
Abstract bundle deployment to Capabilities - WIP
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/BlueprintTest.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/BlueprintTest.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/BlueprintTest.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import java.util.ArrayList;
-
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-
-import org.jboss.osgi.spi.junit.OSGiTest;
-
-/**
- * The base class for Blueprint Service tests
- *
- * @author thomas.diesler(a)jboss.com
- * @since 24-Apr-2009
- */
-public abstract class BlueprintTest extends OSGiTest
-{
- @SuppressWarnings("unchecked")
- protected MBeanServer getMBeanServer()
- {
- ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
- if (serverArr.size() > 1)
- throw new IllegalStateException("Multiple MBeanServer instances not supported");
-
- MBeanServer server = null;
- if (serverArr.size() == 1)
- server = serverArr.get(0);
-
- if (server == null)
- server = MBeanServerFactory.createMBeanServer();
-
- return server;
- }
-}
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,53 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint;
+
+import java.util.Properties;
+
+import org.jboss.osgi.spi.junit.Capability;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JMXCapability extends Capability
+{
+ public JMXCapability()
+ {
+ Properties props = new Properties();
+ props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
+ setProperties(props);
+ }
+
+ public void deploy(BundleContext context) throws BundleException
+ {
+ super.deploy(context);
+ deploy(context, "bundles/jboss-osgi-jmx.jar", true);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -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.test.osgi.blueprint;
+
+import java.util.Properties;
+
+import org.jboss.osgi.spi.junit.Capability;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class JNDICapability extends Capability
+{
+ public JNDICapability()
+ {
+ Properties props = new Properties();
+ 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");
+ setProperties(props);
+ }
+
+ public void deploy(BundleContext context) throws BundleException
+ {
+ super.deploy(context);
+ deploy(context, "bundles/jboss-common-core-bundle.jar", true);
+ deploy(context, "bundles/jboss-osgi-jndi.jar", true);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.blueprint;
+
+import java.util.Properties;
+
+import org.jboss.osgi.spi.junit.Capability;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerCapability extends Capability
+{
+ public MicrocontainerCapability()
+ {
+ Properties props = new Properties();
+ setProperties(props);
+ }
+
+ public void deploy(BundleContext context) throws BundleException
+ {
+ super.deploy(context);
+ deploy(context, "bundles/apache-xerces-bundle.jar", true);
+ deploy(context, "bundles/jaxb-bundle.jar", true);
+ deploy(context, "bundles/jbossxb-bundle.jar", true);
+ deploy(context, "bundles/jboss-osgi-microcontainer.jar", true);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/BundleTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -43,12 +43,10 @@
public void testApacheXercesBundle() throws BundleException
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
@@ -63,12 +61,10 @@
public void testJAXBBundle() throws BundleException
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/jaxb-bundle.jar", true);
@@ -83,12 +79,10 @@
public void testJBossCommonCoreBundle() throws BundleException
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
@@ -104,12 +98,10 @@
public void testJBossXBBundle() throws BundleException
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/apache-xerces-bundle.jar", true);
bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
@@ -127,12 +119,10 @@
public void testJNDIBundle() throws BundleException
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
bundle = installBundle(context, "bundles/jboss-osgi-jndi.jar", true);
@@ -148,12 +138,10 @@
public void testJMXBundle() throws Exception
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
- configProvider.configure("basic-felix-framework.properties");
-
OSGiFramework framework = configProvider.getFramework();
try
{
- BundleContext context = framework.getSystemBundleContext();
+ BundleContext context = framework.getBundleContext();
Bundle bundle = installBundle(context, "bundles/jboss-common-core-bundle.jar", true);
bundle = installBundle(context, "bundles/jboss-osgi-jndi.jar", true);
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/bootstrap/SystemBundleTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
OSGiFramework framework = configProvider.getFramework();
try
{
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.apache.felix.framework", bundle.getSymbolicName());
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -29,12 +29,13 @@
import junit.framework.Test;
-import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.jboss.osgi.spi.junit.OSGiFrameworkWrapper;
+import org.jboss.osgi.spi.junit.OSGiTest;
import org.jboss.osgi.spi.junit.OSGiTestSetup;
import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.test.osgi.blueprint.BlueprintTest;
+import org.jboss.test.osgi.blueprint.JMXCapability;
+import org.jboss.test.osgi.blueprint.JNDICapability;
import org.jboss.test.osgi.blueprint.jmx.bundle.FooMBean;
-import org.jboss.test.osgi.blueprint.mcservice.MicrocontainerServiceTestCase;
import org.osgi.framework.BundleContext;
/**
@@ -43,22 +44,23 @@
* @author thomas.diesler(a)jboss.com
* @since 12-Feb-2009
*/
-public class JMXTestCase extends BlueprintTest
+public class JMXTestCase extends OSGiTest
{
- private static OSGiFramework framework;
+ private static OSGiFrameworkWrapper framework;
public static Test suite()
{
- OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerServiceTestCase.class)
+ OSGiTestSetup setup = new OSGiTestSetup(JMXTestCase.class)
{
@Override
protected void setUp() throws Exception
{
super.setUp();
- framework = getBootstrapProvider().getFramework();
- framework.start();
+ framework = wrapFramework(getBootstrapProvider().getFramework());
+ framework.addCapability(new JNDICapability());
+ framework.addCapability(new JMXCapability());
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
installBundle(sysContext, "jmx-test.jar", true);
}
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -26,8 +26,12 @@
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.test.osgi.blueprint.BlueprintTest;
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.junit.OSGiFrameworkWrapper;
+import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.junit.OSGiTestSetup;
+import org.jboss.test.osgi.blueprint.JNDICapability;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -37,38 +41,54 @@
* @author thomas.diesler(a)jboss.com
* @since 05-May-2009
*/
-public class JNDITestCase extends BlueprintTest
+public class JNDITestCase extends OSGiTest
{
- public void testJNDIAccess() throws Exception
+ private static OSGiFrameworkWrapper framework;
+
+ public static Test suite()
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
-
- try
+ OSGiTestSetup setup = new OSGiTestSetup(JNDITestCase.class)
{
- Bundle bundle = installBundle(sysContext, "jndi-test.jar", true);
- assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
-
- InitialContext iniCtx = new InitialContext();
- String lookup = (String)iniCtx.lookup("test/Foo");
- assertEquals("JNDI bound String expected", "Bar", lookup);
-
- // Uninstall should unbind the object
- bundle.uninstall();
-
- try
+ @Override
+ protected void setUp() throws Exception
{
- iniCtx.lookup("test/Foo");
- fail("NameNotFoundException expected");
+ super.setUp();
+ framework = wrapFramework(getBootstrapProvider().getFramework());
+ framework.addCapability(new JNDICapability());
}
- catch (NameNotFoundException ex)
+
+ @Override
+ protected void tearDown() throws Exception
{
- // expected
+ framework.stop();
+ super.tearDown();
}
+ };
+ return setup;
+ }
+
+ public void testJNDIAccess() throws Exception
+ {
+ BundleContext sysContext = framework.getBundleContext();
+
+ Bundle bundle = installBundle(sysContext, "jndi-test.jar", true);
+ assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
+
+ InitialContext iniCtx = new InitialContext();
+ 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");
}
- finally
+ catch (NameNotFoundException ex)
{
- framework.stop();
+ // expected
}
}
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -1,123 +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.mcservice;
-
-//$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 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.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTestSetup;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
-import org.jboss.test.osgi.blueprint.BlueprintTest;
-
-/**
- * A test that checks whether the MicrocontainerService can be accessed
- *
- * @author thomas.diesler(a)jboss.com
- * @since 12-Feb-2009
- */
-public class MicrocontainerServiceTestCase extends BlueprintTest
-{
- private static OSGiFramework framework;
-
- public static Test suite()
- {
- OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerServiceTestCase.class)
- {
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
- framework = getBootstrapProvider().getFramework();
- framework.start();
- }
-
- @Override
- protected void tearDown() throws Exception
- {
- framework.stop();
- super.tearDown();
- }
- };
- return setup;
- }
-
- public void testServiceAccess() throws Exception
- {
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, 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));
- }
-
- /**
- * Test whether the bundle can be deployed through the MicrocontainerServiceMBean
- */
- public void testBundleDeployment() throws Exception
- {
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
-
- ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
- Set<ObjectName> bundles = frameworkMBean.getBundles();
- assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleA") > 0);
-
- mcService.undeploy(getTestArchiveURL("mcservice-bundleA.jar"));
-}
-
- public void testBeansDeployment() throws Exception
- {
- MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
- mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
-
- ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
- Set<ObjectName> bundles = frameworkMBean.getBundles();
- assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleB") > 0);
-
- // Check whether the bean is registered
- List<String> registeredBeans = mcService.getRegisteredBeans();
- assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
-
- mcService.undeploy(getTestArchiveURL("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/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java (from rev 88253, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,131 @@
+/*
+ * 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.mcservice;
+
+//$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 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.junit.OSGiFrameworkWrapper;
+import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.junit.OSGiTestSetup;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+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
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 12-Feb-2009
+ */
+public class MicrocontainerTestCase extends OSGiTest
+{
+ private static OSGiFrameworkWrapper framework;
+
+ public static Test suite()
+ {
+ OSGiTestSetup setup = new OSGiTestSetup(MicrocontainerTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ framework = wrapFramework(getBootstrapProvider().getFramework());
+ framework.addCapability(new JNDICapability());
+ //framework.addCapability(new JMXCapability());
+ //framework.addCapability(new MicrocontainerCapability());
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ framework.stop();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testFoo() throws Exception
+ {}
+
+ public void _testServiceAccess() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, 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));
+ }
+
+ /**
+ * Test whether the bundle can be deployed through the MicrocontainerServiceMBean
+ */
+ public void _testBundleDeployment() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
+
+ ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ Set<ObjectName> bundles = frameworkMBean.getBundles();
+ assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleA") > 0);
+
+ mcService.undeploy(getTestArchiveURL("mcservice-bundleA.jar"));
+}
+
+ public void _testBeansDeployment() throws Exception
+ {
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
+
+ ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ Set<ObjectName> bundles = frameworkMBean.getBundles();
+ assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleB") > 0);
+
+ // Check whether the bean is registered
+ List<String> registeredBeans = mcService.getRegisteredBeans();
+ assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
+
+ mcService.undeploy(getTestArchiveURL("mcservice-bundleB.jar"));
+
+ // Check whether the bean is unregistered
+ registeredBeans = mcService.getRegisteredBeans();
+ assertFalse("SomeBean unregistered", registeredBeans.contains("SomeBean"));
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-06 13:23:23 UTC (rev 88261)
@@ -20,15 +20,6 @@
org.jboss.net.protocol, \
org.jboss.virtual.protocol
-# 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
@@ -36,13 +27,5 @@
# 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/apache-xerces-bundle.jar \
- file://${test.archive.directory}/bundles/jboss-common-core-bundle.jar \
- file://${test.archive.directory}/bundles/jaxb-bundle.jar \
- file://${test.archive.directory}/bundles/jbossxb-bundle.jar \
file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-logging.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-jndi.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-jmx.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-microcontainer.jar
-
\ No newline at end of file
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Added: 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 (rev 0)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,33 @@
+#
+# 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
Property changes on: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -80,10 +80,12 @@
namingMain.setRmiBindAddress(jndiHost);
namingMain.setRmiPort(jndiRmiPort);
+
+ log.log(LogService.LOG_DEBUG, "Naming server created");
}
catch (IOException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot create JMXConnectorServer", ex);
+ log.log(LogService.LOG_ERROR, "Cannot create Naming server", ex);
}
}
@@ -95,11 +97,11 @@
try
{
namingMain.start();
- log.log(LogService.LOG_DEBUG, "JNDI server started");
+ log.log(LogService.LOG_DEBUG, "Naming server started");
}
catch (Exception ex)
{
- log.log(LogService.LOG_ERROR, "Cannot start JNDI server", ex);
+ log.log(LogService.LOG_ERROR, "Cannot start Naming server", ex);
}
}
@@ -108,7 +110,7 @@
if (namingMain != null)
{
namingMain.stop();
- log.log(LogService.LOG_DEBUG, "JMXConnector stopped");
+ log.log(LogService.LOG_DEBUG, "Naming server stopped");
}
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/main/java/org/jboss/osgi/equinox/framework/EquinoxIntegration.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -87,14 +87,14 @@
this.autoStart = autoStart;
}
- public Bundle getSystemBundle()
+ public Bundle getBundle()
{
return framework.getBundle(0);
}
- public BundleContext getSystemBundleContext()
+ public BundleContext getBundleContext()
{
- return getSystemBundle().getBundleContext();
+ return getBundle().getBundleContext();
}
public void create()
@@ -130,7 +130,7 @@
public void start()
{
// Get system bundle context
- BundleContext context = getSystemBundleContext();
+ BundleContext context = getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
Modified: projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/equinox/src/test/java/org/jboss/test/osgi/equinox/SystemBundleTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
framework.create();
framework.start();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.eclipse.osgi", bundle.getSymbolicName());
@@ -54,7 +54,7 @@
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
OSGiFramework framework = configProvider.getFramework();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.eclipse.osgi", bundle.getSymbolicName());
Modified: projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/felix/src/main/java/org/jboss/osgi/felix/framework/FelixIntegration.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -85,16 +85,16 @@
this.autoStart = autoStart;
}
- public Bundle getSystemBundle()
+ public Bundle getBundle()
{
assertFrameworkStart();
return framework;
}
- public BundleContext getSystemBundleContext()
+ public BundleContext getBundleContext()
{
assertFrameworkStart();
- return getSystemBundle().getBundleContext();
+ return getBundle().getBundleContext();
}
public void create()
Modified: projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/felix/src/test/java/org/jboss/test/osgi/felix/SystemBundleTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
framework.create();
framework.start();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.apache.felix.framework", bundle.getSymbolicName());
@@ -54,7 +54,7 @@
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
OSGiFramework framework = configProvider.getFramework();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "org.apache.felix.framework", bundle.getSymbolicName());
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/main/java/org/jboss/osgi/knopflerfish/KnopflerfishIntegration.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -87,14 +87,14 @@
this.autoStart = autoStart;
}
- public Bundle getSystemBundle()
+ public Bundle getBundle()
{
return framework.getSystemBundleContext().getBundle();
}
- public BundleContext getSystemBundleContext()
+ public BundleContext getBundleContext()
{
- return getSystemBundle().getBundleContext();
+ return getBundle().getBundleContext();
}
public void create()
@@ -156,7 +156,7 @@
public void start()
{
// Get system bundle context
- BundleContext context = getSystemBundleContext();
+ BundleContext context = getBundleContext();
if (context == null)
throw new FrameworkException("Cannot obtain system context");
Modified: projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/runtime/knopflerfish/src/test/java/org/jboss/test/osgi/knopflerfish/SystemBundleTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
framework.create();
framework.start();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
@@ -54,7 +54,7 @@
{
OSGiBootstrapProvider configProvider = OSGiBootstrap.getBootstrapProvider();
OSGiFramework framework = configProvider.getFramework();
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertEquals("SymbolicName", "system.bundle", bundle.getSymbolicName());
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiFramework.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -84,10 +84,10 @@
/**
* Get the System Bundle associated with this Framework
*/
- Bundle getSystemBundle();
+ Bundle getBundle();
/**
* Get the System Bundle Context associated with this Framework
*/
- BundleContext getSystemBundleContext();
+ BundleContext getBundleContext();
}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,107 @@
+/*
+ * 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.junit;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+//$Id$
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public abstract class Capability
+{
+ private OSGiFrameworkWrapper framework;
+ private Properties props;
+ private List<Bundle> bundles = new ArrayList<Bundle>();
+
+ public Capability()
+ {
+ }
+
+ public Capability(Properties props)
+ {
+ this.props = props;
+ }
+
+ public Properties getProperties()
+ {
+ return props;
+ }
+
+ public void setProperties(Properties props)
+ {
+ this.props = props;
+ }
+
+ public void setFrameworkWrapper(OSGiFrameworkWrapper framework)
+ {
+ this.framework = framework;
+ }
+
+ protected void initProperties(BundleContext context)
+ {
+ if (props != null)
+ {
+ Enumeration<?> keys = props.propertyNames();
+ while (keys.hasMoreElements())
+ {
+ String key = (String)keys.nextElement();
+ String value = props.getProperty(key);
+ System.setProperty(key, value);
+ }
+ }
+ }
+
+ protected void deploy(BundleContext context, String bundlePath, boolean start) throws BundleException
+ {
+ addBundle(framework.installBundle(context, bundlePath, start));
+ }
+
+ protected void addBundle(Bundle bundle)
+ {
+ bundles.add(0, bundle);
+ }
+
+ public void deploy(BundleContext context) throws BundleException
+ {
+ initProperties(context);
+ }
+
+ public void undeploy(BundleContext context) throws BundleException
+ {
+ for (Bundle bundle : bundles)
+ {
+ bundle.uninstall();
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/Capability.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.junit;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public class EmbeddedFrameworkWrapper extends OSGiFrameworkWrapper
+{
+ private OSGiTestHelper helper = new OSGiTestHelper();
+
+ public EmbeddedFrameworkWrapper(OSGiFramework framework)
+ {
+ super(framework);
+ }
+
+ @Override
+ public Bundle installBundle(BundleContext context, String bundlePath, boolean start) throws BundleException
+ {
+ return helper.installBundle(context, bundlePath, start);
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/EmbeddedFrameworkWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -105,9 +105,9 @@
return getDelegate().getRemoteFramework();
}
- protected MBeanServerConnection getMBeanServer()
+ protected MBeanServerConnection getMBeanServerConnection()
{
- return getDelegate().getMBeanServer();
+ return getDelegate().getMBeanServerConnection();
}
protected String getServerHost()
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -74,7 +74,7 @@
{
// Bootstrap the Framework and get the system bundle
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
// Track the RemoteLogReaderService to add the LogEntryCache as LogListener
ServiceTracker tracker = new ServiceTracker(sysContext, RemoteLogReaderService.class.getName(), null)
@@ -140,7 +140,7 @@
try
{
ObjectName oname = new ObjectName("jboss.system:type=ServerConfig");
- jbossVersion = (String)getMBeanServer().getAttribute(oname, "SpecificationVersion");
+ jbossVersion = (String)getMBeanServerConnection().getAttribute(oname, "SpecificationVersion");
}
catch (Exception ex)
{
@@ -156,7 +156,7 @@
}
@SuppressWarnings("unchecked")
- public MBeanServerConnection getMBeanServer()
+ public MBeanServerConnection getMBeanServerConnection()
{
if (server == null)
{
@@ -179,7 +179,7 @@
{
if (isRemoteIntegration())
{
- return new RemoteArchiveDeployer(getMBeanServer());
+ return new RemoteArchiveDeployer(getMBeanServerConnection());
}
else
{
@@ -212,7 +212,7 @@
public RemoteFramework getRemoteFramework() throws Exception
{
if (managedFramework == null)
- managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServerConnection());
return new RemoteFramework()
{
@@ -224,7 +224,7 @@
try
{
- return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServerConnection());
}
catch (MBeanProxyException ex)
{
@@ -239,7 +239,7 @@
{
try
{
- RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServerConnection());
remBundles.add(remBundle);
}
catch (MBeanProxyException ex)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -78,9 +78,9 @@
return getDelegate().isTargetJBoss50();
}
- public MBeanServerConnection getMBeanServer()
+ public MBeanServerConnection getMBeanServerConnection()
{
- return getDelegate().getMBeanServer();
+ return getDelegate().getMBeanServerConnection();
}
public String getServerHost()
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -0,0 +1,76 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.junit;
+
+//$Id$
+
+import org.jboss.osgi.spi.framework.OSGiFramework;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 05-May-2009
+ */
+public abstract class OSGiFrameworkWrapper
+{
+ private OSGiFramework framework;
+
+ public OSGiFrameworkWrapper(OSGiFramework framework)
+ {
+ this.framework = framework;
+ }
+
+ public BundleContext getBundleContext()
+ {
+ return framework.getBundleContext();
+ }
+
+ public void addCapability(Capability cap) throws BundleException
+ {
+ cap.setFrameworkWrapper(this);
+ BundleContext context = framework.getBundleContext();
+ cap.deploy(context);
+ }
+
+ public void removeCapability(Capability cap) throws BundleException
+ {
+ BundleContext context = framework.getBundleContext();
+ cap.undeploy(context);
+ }
+
+ public abstract Bundle installBundle(BundleContext context, String bundlePath, boolean start) throws BundleException;
+
+ public void start()
+ {
+ framework.start();
+ }
+
+ public void stop()
+ {
+ framework.stop();
+ }
+
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiFrameworkWrapper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTest.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -25,10 +25,13 @@
import java.net.MalformedURLException;
import java.net.URL;
+import javax.management.MBeanServer;
+
import junit.framework.TestCase;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
import org.jboss.virtual.VFS;
import org.osgi.framework.Bundle;
@@ -138,4 +141,14 @@
{
return delegate.installBundle(sysContext, bundlePath, start);
}
+
+ protected MBeanServer getMBeanServer()
+ {
+ return delegate.getMBeanServer();
+ }
+
+ protected OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
+ {
+ return delegate.wrapFramework(framework);
+ }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestHelper.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -24,7 +24,11 @@
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+
import org.jboss.osgi.spi.framework.ExportedPackageHelper;
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
@@ -76,7 +80,7 @@
{
// Bootstrap the Framework and get the system bundle
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
// Track the RemoteLogReaderService to add the LogEntryCache as LogListener
ServiceTracker tracker = new ServiceTracker(sysContext, LogReaderService.class.getName(), null)
@@ -186,4 +190,26 @@
return bundle;
}
+
+ @SuppressWarnings("unchecked")
+ public MBeanServer getMBeanServer()
+ {
+ ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
+ if (serverArr.size() > 1)
+ throw new IllegalStateException("Multiple MBeanServer instances not supported");
+
+ MBeanServer server = null;
+ if (serverArr.size() == 1)
+ server = serverArr.get(0);
+
+ if (server == null)
+ server = MBeanServerFactory.createMBeanServer();
+
+ return server;
+ }
+
+ public OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
+ {
+ return new EmbeddedFrameworkWrapper(framework);
+ }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/OSGiTestSetup.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -25,11 +25,14 @@
import java.net.MalformedURLException;
import java.net.URL;
+import javax.management.MBeanServer;
+
import junit.extensions.TestSetup;
import junit.framework.TestSuite;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.virtual.VFS;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -108,4 +111,14 @@
{
return delegate.installBundle(sysContext, bundlePath, start);
}
+
+ protected MBeanServer getMBeanServer()
+ {
+ return delegate.getMBeanServer();
+ }
+
+ protected OSGiFrameworkWrapper wrapFramework(OSGiFramework framework)
+ {
+ return delegate.wrapFramework(framework);
+ }
}
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/log/LogServiceTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -65,7 +65,7 @@
{
// Bootstrap the Framework and get the system bundle
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
// Install and start the test bundle
URL testURL = getTestArchiveURL("example/example-log.jar");
Modified: 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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -46,7 +46,7 @@
public void testMBeanAccess() throws Exception
{
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBeanTestService.OBJECT_NAME, getMBeanServer());
+ 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/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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/BootstrapTestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
OSGiFramework framework = bootProvider.getFramework();
assertNotNull("Framework not null", framework);
- Bundle bundle = framework.getSystemBundle();
+ Bundle bundle = framework.getBundle();
assertEquals("BundleId == 0", 0, bundle.getBundleId());
assertNotNull("SymbolicName not null", bundle.getSymbolicName());
Modified: 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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/bootstrap/MockFramework.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -39,12 +39,12 @@
*/
public class MockFramework implements OSGiFramework
{
- public Bundle getSystemBundle()
+ public Bundle getBundle()
{
return null;
}
- public BundleContext getSystemBundleContext()
+ public BundleContext getBundleContext()
{
return null;
}
Modified: 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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -82,7 +82,7 @@
private FooMBean getFooMBean() throws MBeanProxyException
{
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getMBeanServer());
+ 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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -49,7 +49,7 @@
super.setUp();
OSGiFramework framework = getBootstrapProvider().getFramework();
- sysContext = framework.getSystemBundleContext();
+ sysContext = framework.getBundleContext();
}
public void testNestedBundle() throws Exception
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -51,7 +51,7 @@
public void testInstallStartX() throws Exception
{
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleX = null;
try
@@ -74,7 +74,7 @@
public void testInstallXBeforeB() throws Exception
{
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleB = null;
Bundle bundleX = null;
@@ -102,7 +102,7 @@
public void testInstallBBeforeA() throws Exception
{
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleA = null;
Bundle bundleB = null;
@@ -135,7 +135,7 @@
public void testInstallBBeforeX() throws Exception
{
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleB = null;
Bundle bundleX = null;
@@ -173,7 +173,7 @@
public void testInstallABeforeB() throws Exception
{
OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleA = null;
Bundle bundleB = null;
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-05-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/FELIX1040TestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -44,7 +44,7 @@
OSGiFramework fwOne = createBootstrapProvider().getFramework();
try
{
- BundleContext ctxOne = fwOne.getSystemBundleContext();
+ BundleContext ctxOne = fwOne.getBundleContext();
Bundle bundleA = ctxOne.installBundle(getTestArchiveURL("jbosgi37-bundleA.jar").toExternalForm());
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
@@ -59,7 +59,7 @@
OSGiFramework fwTwo = createBootstrapProvider().getFramework();
try
{
- BundleContext ctxTwo = fwTwo.getSystemBundleContext();
+ BundleContext ctxTwo = fwTwo.getBundleContext();
Bundle bundleB = ctxTwo.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
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-06 13:12:42 UTC (rev 88260)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-06 13:23:23 UTC (rev 88261)
@@ -48,7 +48,7 @@
public void testVerifyUnresolved() throws Exception
{
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
@@ -88,7 +88,7 @@
public void testWiringToUninstalled() throws Exception
{
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
@@ -115,7 +115,7 @@
public void testWiringToUninstalledPackageAdmin() throws Exception
{
OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getSystemBundleContext();
+ BundleContext sysContext = framework.getBundleContext();
Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
17 years, 2 months
JBoss-OSGI SVN: r88253 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB and 4 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-06 04:56:53 -0400 (Wed, 06 May 2009)
New Revision: 88253
Added:
projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBean.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBeanMBean.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd
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
Log:
Bundle contained beans deployment - ok
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 08:56:53 UTC (rev 88253)
@@ -80,7 +80,7 @@
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
List<String> registeredBeans = mcService.getRegisteredBeans();
- assertTrue("MicrocontainerService registered with MC", registeredBeans.contains(BEAN_SYSTEM_BUNDLE_CONTEXT));
+ 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));
@@ -89,7 +89,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, getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleA.jar"));
@@ -105,5 +105,19 @@
{
MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
+
+ ManagedFrameworkMBean frameworkMBean = MBeanProxy.get(ManagedFrameworkMBean.class, MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+ Set<ObjectName> bundles = frameworkMBean.getBundles();
+ assertTrue("Managed bundle registered", bundles.toString().indexOf("jboss.osgi:bundle=mcservice-bundleB") > 0);
+
+ // Check whether the bean is registered
+ List<String> registeredBeans = mcService.getRegisteredBeans();
+ assertTrue("SomeBean registered", registeredBeans.contains("SomeBean"));
+
+ mcService.undeploy(getTestArchiveURL("mcservice-bundleB.jar"));
+
+ // Check whether the bean is unregistered
+ registeredBeans = mcService.getRegisteredBeans();
+ assertFalse("SomeBean unregistered", registeredBeans.contains("SomeBean"));
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBean.java 2009-05-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBean.java 2009-05-06 08:56:53 UTC (rev 88253)
@@ -26,10 +26,6 @@
import javax.management.MBeanServer;
import javax.management.ObjectName;
-import org.jboss.test.osgi.blueprint.mcservice.bundleA.SomeService;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-
/**
* An MC bean that accesses some OSGi service
*
@@ -38,14 +34,8 @@
*/
public class SomeBean implements SomeBeanMBean
{
- private BundleContext context;
private MBeanServer mbeanServer;
- public void setBundleContext(BundleContext context)
- {
- this.context = context;
- }
-
public void setMbeanServer(MBeanServer server)
{
this.mbeanServer = server;
@@ -53,21 +43,14 @@
public void create() throws Exception
{
- mbeanServer.registerMBean(this, new ObjectName("jboss.osgi:service=SomeBean"));
+ mbeanServer.registerMBean(this, new ObjectName("jboss.osgi:bean=SomeBean"));
}
public void destroy() throws Exception
{
- mbeanServer.unregisterMBean(new ObjectName("jboss.osgi:service=SomeBean"));
+ mbeanServer.unregisterMBean(new ObjectName("jboss.osgi:bean=SomeBean"));
}
- public String callSomeService(String msg)
- {
- ServiceReference sref = context.getServiceReference(SomeService.class.getName());
- SomeService service = (SomeService)context.getService(sref);
- return service.echo(msg);
- }
-
public String echo(String msg)
{
return msg;
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBeanMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBeanMBean.java 2009-05-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/bundleB/SomeBeanMBean.java 2009-05-06 08:56:53 UTC (rev 88253)
@@ -25,7 +25,5 @@
public interface SomeBeanMBean
{
- String callSomeService(String msg);
-
String echo(String msg);
}
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd 2009-05-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/mcservice/mcservice-bundleB.bnd 2009-05-06 08:56:53 UTC (rev 88253)
@@ -2,5 +2,5 @@
Bundle-SymbolicName: mcservice-bundleB
Export-Package: org.jboss.test.osgi.blueprint.mcservice.bundleB
-Import-Package: javax.management, org.osgi.framework, org.jboss.test.osgi.blueprint.mcservice.bundleA
+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/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-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-06 08:56:53 UTC (rev 88253)
@@ -47,6 +47,7 @@
import org.jboss.deployers.vfs.spi.client.VFSDeploymentFactory;
import org.jboss.kernel.Kernel;
import org.jboss.kernel.spi.dependency.KernelController;
+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;
@@ -92,7 +93,10 @@
AbstractController controller = (AbstractController)getKernel().getController();
for (ControllerContext ctx : controller.getAllContexts())
- names.add(ctx.getName().toString());
+ {
+ if (ctx instanceof KernelControllerContext || ctx instanceof PreInstalledControllerContext)
+ names.add(ctx.getName().toString());
+ }
return names;
}
@@ -162,10 +166,10 @@
Kernel kernel = getKernel();
KernelController controller = kernel.getController();
ControllerContextActions actions = new AbstractControllerContextActions(new HashMap<ControllerState, ControllerContextAction>());
- controller.install(new AbstractControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, null, context));
- controller.install(new AbstractControllerContext(BEAN_KERNEL_CONTROLLER, actions, null, controller));
- controller.install(new AbstractControllerContext(BEAN_KERNEL, actions, null, kernel));
- controller.install(new AbstractControllerContext(BEAN_MBEAN_SERVER, actions, null, mbeanServer));
+ controller.install(new PreInstalledControllerContext(BEAN_SYSTEM_BUNDLE_CONTEXT, actions, context));
+ 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");
deployer.deploy(deployersURL);
@@ -231,4 +235,12 @@
}
}
}
+
+ static class PreInstalledControllerContext extends AbstractControllerContext
+ {
+ public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
+ {
+ super(name, actions, null, target);
+ }
+ }
}
\ No newline at end of file
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-06 08:01:55 UTC (rev 88252)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/resources/META-INF/base-deployers-beans.xml 2009-05-06 08:56:53 UTC (rev 88253)
@@ -69,7 +69,7 @@
<bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer">
<property name="suffix">jboss-beans.xml</property>
</bean>
- <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer">
+ <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>
Added: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
===================================================================
--- projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java (rev 0)
+++ projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java 2009-05-06 08:56:53 UTC (rev 88253)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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.deployer;
+
+// $Id$
+
+import java.util.Collections;
+import java.util.List;
+
+import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.deployers.spi.DeploymentException;
+import org.jboss.deployers.spi.deployer.helpers.AbstractComponentDeployer;
+import org.jboss.deployers.structure.spi.ClassLoaderFactory;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor;
+import org.jboss.kernel.spi.deployment.KernelDeployment;
+import org.osgi.framework.Bundle;
+
+public class BundleContainedBeansDeployer extends AbstractComponentDeployer<KernelDeployment, BeanMetaData>
+{
+ /*
+ * Create a new KernelDeploymentDeployer.
+ */
+ public BundleContainedBeansDeployer()
+ {
+ addInput(Bundle.class);
+ addInput(ClassLoaderFactory.class);
+ setDeploymentVisitor(new KernelDeploymentVisitor());
+ setComponentVisitor(new BeanMetaDataVisitor());
+ }
+
+ /*
+ * KernelDeploymentVisitor.
+ */
+ public static class KernelDeploymentVisitor extends BeanMetaDataFactoryVisitor<KernelDeployment>
+ {
+ @Override
+ public void deploy(DeploymentUnit unit, KernelDeployment deployment) throws DeploymentException
+ {
+ ClassLoaderFactory factory = unit.getAttachment(ClassLoaderFactory.class);
+ unit.createClassLoader(factory);
+
+ super.deploy(unit, deployment);
+ }
+
+ public Class<KernelDeployment> getVisitorType()
+ {
+ return KernelDeployment.class;
+ }
+
+ protected List<BeanMetaData> getBeans(KernelDeployment deployment)
+ {
+ return deployment.getBeans();
+ }
+ }
+
+ /*
+ * BeanMetaDataVisitor.
+ */
+ public static class BeanMetaDataVisitor extends BeanMetaDataFactoryVisitor<BeanMetaData>
+ {
+ public Class<BeanMetaData> getVisitorType()
+ {
+ return BeanMetaData.class;
+ }
+
+ protected List<BeanMetaData> getBeans(BeanMetaData deployment)
+ {
+ return Collections.singletonList(deployment);
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/runtime/deployer/src/main/java/org/jboss/osgi/deployer/BundleContainedBeansDeployer.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
17 years, 2 months
JBoss-OSGI SVN: r88250 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice and 5 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-06 03:00:29 -0400 (Wed, 06 May 2009)
New Revision: 88250
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/pom.xml
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java
projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java
Log:
Upgrade to Felix-1.6.1
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerServiceTestCase.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -103,7 +103,7 @@
public void testBeansDeployment() throws Exception
{
-// MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
-// mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(getTestArchiveURL("mcservice-bundleB.jar"));
}
}
\ No newline at end of file
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-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/bundle/jmx/src/main/java/org/jboss/osgi/jmx/internal/JMXConnectorService.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -84,7 +84,7 @@
serviceURL = new JMXServiceURL("service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + rmiPort + jmxConnectorServerPath);
jmxConnectorServer = JMXConnectorServerFactory.newJMXConnectorServer(serviceURL, null, mbeanServer);
- log.log(LogService.LOG_DEBUG, "JMX Connector created: " + serviceURL);
+ log.log(LogService.LOG_DEBUG, "JMXConnectorServer created: " + serviceURL);
}
catch (RuntimeException rte)
{
@@ -92,7 +92,7 @@
}
catch (Exception ex)
{
- log.log(LogService.LOG_ERROR, "Cannot create JMXConnector", ex);
+ log.log(LogService.LOG_ERROR, "Cannot create JMXConnectorServer", ex);
}
}
@@ -104,18 +104,18 @@
public void start()
{
if (jmxConnectorServer == null)
- throw new IllegalStateException("JMXConnector not available");
+ throw new IllegalStateException("JMXConnectorServer not available");
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
jmxConnectorServer.start();
- log.log(LogService.LOG_INFO, "JMXConnector started: " + serviceURL);
+ log.log(LogService.LOG_INFO, "JMXConnectorServer started: " + serviceURL);
}
catch (IOException ex)
{
- log.log(LogService.LOG_ERROR, "Cannot start JMXConnector", ex);
+ log.log(LogService.LOG_ERROR, "Cannot start JMXConnectorServer", ex);
}
finally
{
@@ -130,11 +130,11 @@
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
jmxConnectorServer.stop();
- log.log(LogService.LOG_DEBUG, "JMXConnector stopped");
+ log.log(LogService.LOG_DEBUG, "JMXConnectorServer stopped");
}
catch (IOException ex)
{
- log.log(LogService.LOG_WARNING, "Cannot stop JMXConnector", ex);
+ log.log(LogService.LOG_WARNING, "Cannot stop JMXConnectorServer", ex);
}
finally
{
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-06 07:00:29 UTC (rev 88250)
@@ -149,6 +149,7 @@
jboss-kernel;inline=false,
</Embed-Dependency>
<_exportcontents>
+ .,
org.jboss.dependency*,
org.jboss.deployers*,
</_exportcontents>
Modified: projects/jboss-osgi/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/pom.xml 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/pom.xml 2009-05-06 07:00:29 UTC (rev 88250)
@@ -39,7 +39,7 @@
<version.aqute.bnd>0.0.323</version.aqute.bnd>
<version.equinox>3.4.2</version.equinox>
<version.felix.configadmin>1.0.10</version.felix.configadmin>
- <version.felix.framework>1.6.0</version.felix.framework>
+ <version.felix.framework>1.6.1</version.felix.framework>
<version.felix.http.jetty>1.0.0</version.felix.http.jetty>
<version.felix.javax.servlet>1.0.0</version.felix.javax.servlet>
<version.felix.log>1.0.0</version.felix.log>
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTest.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -105,9 +105,9 @@
return getDelegate().getRemoteFramework();
}
- protected MBeanServerConnection getServer()
+ protected MBeanServerConnection getMBeanServer()
{
- return getDelegate().getServer();
+ return getDelegate().getMBeanServer();
}
protected String getServerHost()
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -140,7 +140,7 @@
try
{
ObjectName oname = new ObjectName("jboss.system:type=ServerConfig");
- jbossVersion = (String)getServer().getAttribute(oname, "SpecificationVersion");
+ jbossVersion = (String)getMBeanServer().getAttribute(oname, "SpecificationVersion");
}
catch (Exception ex)
{
@@ -156,7 +156,7 @@
}
@SuppressWarnings("unchecked")
- public MBeanServerConnection getServer()
+ public MBeanServerConnection getMBeanServer()
{
if (server == null)
{
@@ -179,7 +179,7 @@
{
if (isRemoteIntegration())
{
- return new RemoteArchiveDeployer(getServer());
+ return new RemoteArchiveDeployer(getMBeanServer());
}
else
{
@@ -212,7 +212,7 @@
public RemoteFramework getRemoteFramework() throws Exception
{
if (managedFramework == null)
- managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getServer());
+ managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
return new RemoteFramework()
{
@@ -224,7 +224,7 @@
try
{
- return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getServer());
+ return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
}
catch (MBeanProxyException ex)
{
@@ -239,7 +239,7 @@
{
try
{
- RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getServer());
+ RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
remBundles.add(remBundle);
}
catch (MBeanProxyException ex)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java 2009-05-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestSetup.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -78,9 +78,9 @@
return getDelegate().isTargetJBoss50();
}
- public MBeanServerConnection getServer()
+ public MBeanServerConnection getMBeanServer()
{
- return getDelegate().getServer();
+ return getDelegate().getMBeanServer();
}
public String getServerHost()
Modified: 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-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/java/org/jboss/test/osgi/example/microcontainer/MBeanServiceRemoteTestCase.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -46,7 +46,7 @@
public void testMBeanAccess() throws Exception
{
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBeanTestService.OBJECT_NAME, getServer());
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBeanTestService.OBJECT_NAME, getMBeanServer());
assertEquals("hello", foo.echo("hello"));
}
}
\ No newline at end of file
Modified: 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-06 06:57:49 UTC (rev 88249)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-06 07:00:29 UTC (rev 88250)
@@ -82,7 +82,7 @@
private FooMBean getFooMBean() throws MBeanProxyException
{
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getServer());
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getMBeanServer());
return foo;
}
}
\ No newline at end of file
17 years, 2 months
JBoss-OSGI SVN: r88229 - projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-05 15:53:54 -0400 (Tue, 05 May 2009)
New Revision: 88229
Modified:
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
Log:
Set the RMI BindAddress
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-05 19:42:24 UTC (rev 88228)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/JNPServer.java 2009-05-05 19:53:54 UTC (rev 88229)
@@ -74,9 +74,12 @@
namingMain = new Main();
namingMain.setNamingInfo(namingBean);
+
namingMain.setBindAddress(jndiHost);
+ namingMain.setPort(jndiPort);
+
+ namingMain.setRmiBindAddress(jndiHost);
namingMain.setRmiPort(jndiRmiPort);
- namingMain.setPort(jndiPort);
}
catch (IOException ex)
{
17 years, 2 months
JBoss-OSGI SVN: r88228 - in projects/jboss-osgi/trunk: spi/src/main/java/org/jboss/osgi/spi/framework and 3 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-05 15:42:24 -0400 (Tue, 05 May 2009)
New Revision: 88228
Modified:
projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties
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/junit/IntegrationTestHelper.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
Log:
WIP
Modified: projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties 2009-05-05 19:25:56 UTC (rev 88227)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/jboss-osgi-framework.properties 2009-05-05 19:42:24 UTC (rev 88228)
@@ -8,7 +8,30 @@
org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
# Properties to configure the Framework
+org.osgi.framework.storage=${osgi.home}/data/osgi-store
org.osgi.framework.storage.clean=onFirstInit
+
+# HTTP Service Port
+org.osgi.service.http.port=8090
+
+# Config Admin Service
+felix.cm.dir=${osgi.home}/data/osgi-configadmin
+
+# JMX bundle properties
+org.jboss.osgi.jmx.host=${jboss.bind.address}
+org.jboss.osgi.jmx.rmi.port=1098
+
+# JNDI bundle properties
+org.jboss.osgi.jndi.host=${jboss.bind.address}
+org.jboss.osgi.jndi.rmi.port=1098
+org.jboss.osgi.jndi.port=1099
+
+# Remote Logging
+org.jboss.osgi.service.remote.log.sender=true
+org.jboss.osgi.service.remote.log.host=${jboss.bind.address}
+org.jboss.osgi.service.remote.log.port=5400
+
+# Extra System Packages
org.osgi.framework.system.packages.extra=\
org.jboss.logging, \
org.jboss.osgi.spi, \
@@ -35,5 +58,9 @@
file://${osgi.home}/bundles/jboss-osgi-logging.jar \
file://${osgi.home}/bundles/jboss-osgi-jndi.jar \
file://${osgi.home}/bundles/jboss-osgi-jmx.jar \
- file://${osgi.home}/bundles/jboss-osgi-microcontainer.jar
+ file://${osgi.home}/bundles/jboss-osgi-microcontainer.jar \
+ file://${osgi.home}/bundles/org.apache.felix.metatype.jar \
+ file://${osgi.home}/bundles/org.apache.felix.configadmin.jar \
+ file://${osgi.home}/bundles/org.apache.felix.http.jetty.jar \
+ file://${osgi.home}/bundles/jboss-osgi-webconsole.jar
\ No newline at end of file
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-05 19:25:56 UTC (rev 88227)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-05-05 19:42:24 UTC (rev 88228)
@@ -105,6 +105,8 @@
public static void main(String[] args)
{
+ initSystemProperties();
+
OSGiBootstrapProvider bootProvider = getBootstrapProvider();
OSGiFramework framework = bootProvider.getFramework();
@@ -115,6 +117,14 @@
thread.start();
}
+ 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");
+ }
+
static class StartupThread extends Thread
{
private OSGiFramework framework;
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-05 19:25:56 UTC (rev 88227)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/junit/IntegrationTestHelper.java 2009-05-05 19:42:24 UTC (rev 88228)
@@ -219,6 +219,9 @@
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, getServer());
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-05 19:25:56 UTC (rev 88227)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-05 19:42:24 UTC (rev 88228)
@@ -62,6 +62,18 @@
</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>
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-05 19:25:56 UTC (rev 88227)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-05 19:42:24 UTC (rev 88228)
@@ -68,6 +68,18 @@
</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-remotelog</artifactId>
<version>${version}</version>
<scope>provided</scope>
17 years, 2 months
JBoss-OSGI SVN: r88226 - projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-05 14:33:44 -0400 (Tue, 05 May 2009)
New Revision: 88226
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/basic-felix-framework.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
Log:
Use different JNDI ports for basic frametwork tests
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/basic-felix-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/basic-felix-framework.properties 2009-05-05 18:01:36 UTC (rev 88225)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/basic-felix-framework.properties 2009-05-05 18:33:44 UTC (rev 88226)
@@ -12,6 +12,15 @@
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
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-05 18:01:36 UTC (rev 88225)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-05 18:33:44 UTC (rev 88226)
@@ -19,8 +19,12 @@
org.jboss.virtual.plugins.vfs.helpers, \
org.jboss.net.protocol, \
org.jboss.virtual.protocol
+
+# 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
17 years, 2 months
JBoss-OSGI SVN: r88225 - projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-05-05 14:01:36 -0400 (Tue, 05 May 2009)
New Revision: 88225
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
Log:
Use different JNDI ports for embedded frametwork tests
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-05 17:41:25 UTC (rev 88224)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jboss-osgi-framework.properties 2009-05-05 18:01:36 UTC (rev 88225)
@@ -20,7 +20,10 @@
org.jboss.net.protocol, \
org.jboss.virtual.protocol
org.jboss.osgi.jmx.host=(a)jboss.bind.address@
+org.jboss.osgi.jmx.rmi.port=1198
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=\
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-05 17:41:25 UTC (rev 88224)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-05 18:01:36 UTC (rev 88225)
@@ -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
17 years, 2 months