[jboss-cvs] JBossAS SVN: r88346 - in projects/jboss-osgi/trunk: bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint and 22 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu May 7 06:38:40 EDT 2009
Author: thomas.diesler at jboss.com
Date: 2009-05-07 06:38:40 -0400 (Thu, 07 May 2009)
New Revision: 88346
Added:
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
Removed:
projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml
Modified:
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/pom.xml
projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Migrate tests to use abstract osgi runtime
Deleted: projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/build/distribution/runtime/conf/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://localhost:1099
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,46 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 05-May-2009
- */
-public class JMXCapability extends Capability
-{
- public JMXCapability()
- {
- Properties props = getProperties();
- props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
- props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
-
- addBundle("bundles/jboss-osgi-jmx.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,48 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 05-May-2009
- */
-public class JNDICapability extends Capability
-{
- public JNDICapability()
- {
- Properties props = getProperties();
- props.setProperty("org.jboss.osgi.jndi.host", System.getProperty("jboss.bind.address", "localhost"));
- props.setProperty("org.jboss.osgi.jndi.rmi.port", "1198");
- props.setProperty("org.jboss.osgi.jndi.port", "1199");
-
- addBundle("bundles/jboss-common-core-bundle.jar");
- addBundle("bundles/jboss-osgi-jndi.jar");
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,43 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.blueprint;
-
-//$Id$
-
-import org.jboss.osgi.spi.testing.Capability;
-
-/**
- * [TODO]
- *
- * @author thomas.diesler at jboss.com
- * @since 05-May-2009
- */
-public class MicrocontainerCapability extends Capability
-{
- public MicrocontainerCapability()
- {
- addBundle("bundles/apache-xerces-bundle.jar");
- addBundle("bundles/jaxb-bundle.jar");
- addBundle("bundles/jbossxb-bundle.jar");
- addBundle("bundles/jboss-osgi-microcontainer.jar");
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jmx/JMXTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -32,10 +32,10 @@
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JMXCapability;
-import org.jboss.test.osgi.blueprint.JNDICapability;
import org.jboss.test.osgi.blueprint.jmx.bundle.FooMBean;
/**
@@ -56,7 +56,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
runtime.addCapability(new JMXCapability());
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/jndi/JNDITestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -30,9 +30,9 @@
import org.jboss.osgi.spi.testing.AbstractBundle;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JNDICapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JNDICapability;
import org.osgi.framework.Bundle;
/**
@@ -53,7 +53,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
}
@@ -74,7 +74,7 @@
assertEquals("Test bundle ACTIVE", Bundle.ACTIVE, bundle.getState());
- InitialContext iniCtx = new InitialContext();
+ InitialContext iniCtx = runtime.getInitialContext();
String lookup = (String)iniCtx.lookup("test/Foo");
assertEquals("JNDI bound String expected", "Bar", lookup);
Modified: projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/mcservice/MicrocontainerTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -27,8 +27,8 @@
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MAIN_DEPLOYER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_MBEAN_SERVER;
import static org.jboss.osgi.microcontainer.MicrocontainerService.BEAN_SYSTEM_BUNDLE_CONTEXT;
-import static org.jboss.osgi.microcontainer.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import static org.jboss.osgi.spi.management.ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK;
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
import java.util.List;
import java.util.Set;
@@ -37,15 +37,15 @@
import junit.framework.Test;
-import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.management.MBeanProxy;
import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestSetup;
-import org.jboss.test.osgi.blueprint.JMXCapability;
-import org.jboss.test.osgi.blueprint.JNDICapability;
-import org.jboss.test.osgi.blueprint.MicrocontainerCapability;
/**
* A test that checks whether the MicrocontainerService can be accessed
@@ -65,7 +65,7 @@
protected void setUp() throws Exception
{
super.setUp();
- runtime = getRuntime();
+ runtime = getDefaultRuntime();
runtime.addCapability(new JNDICapability());
//runtime.addCapability(new JMXCapability());
//runtime.addCapability(new MicrocontainerCapability());
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +0,0 @@
-java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1199
Deleted: projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties
===================================================================
--- projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/blueprint/src/test/resources/old-basic-felix-framework.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,33 +0,0 @@
-#
-# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
-#
-# $Id$
-#
-
-# The OSGiFramework implementation
-org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
-
-# Properties to configure the Framework
-org.osgi.framework.storage.clean=onFirstInit
-org.osgi.framework.system.packages.extra=\
- org.jboss.logging
-
-# JMX bundle properties
-org.jboss.osgi.jmx.host=@jboss.bind.address@
-org.jboss.osgi.jmx.rmi.port=1198
-
-# JNDI bundle properties
-org.jboss.osgi.jndi.host=@jboss.bind.address@
-org.jboss.osgi.jndi.rmi.port=1198
-org.jboss.osgi.jndi.port=1199
-
-# Bundles that need to be installed with the Framework automatically
-org.jboss.osgi.spi.framework.autoInstall=\
- file://${test.archive.directory}/bundles/org.osgi.compendium.jar
-
-# Bundles that need to be started automatically
-org.jboss.osgi.spi.framework.autoStart=\
- file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
- file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
-
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/NamingServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,6 +23,8 @@
//$Id$
+import java.util.Hashtable;
+
import javax.naming.InitialContext;
import javax.naming.NamingException;
@@ -36,8 +38,16 @@
*/
public class NamingServiceImpl implements NamingService
{
+ private String jndiHost, jndiPort;
private InitialContext initialContext;
+ public NamingServiceImpl(String jndiHost, String jndiPort)
+ {
+ this.jndiHost = jndiHost;
+ this.jndiPort = jndiPort;
+ }
+
+ @SuppressWarnings("unchecked")
public InitialContext getInitialContext() throws NamingException
{
if (initialContext == null)
@@ -46,7 +56,13 @@
try
{
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
- initialContext = new InitialContext();
+
+ Hashtable env = new Hashtable();
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + jndiHost + ":" + jndiPort);
+
+ initialContext = new InitialContext(env);
}
finally
{
Modified: projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/jndi/src/main/java/org/jboss/osgi/jndi/internal/ServiceActivator.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -63,7 +63,7 @@
jnpServer = new JNPServer(context, jndiHost, Integer.parseInt(jndiPort), Integer.parseInt(jndiRmiPort));
jnpServer.start();
- context.registerService(NamingService.class.getName(), new NamingServiceImpl(), null);
+ context.registerService(NamingService.class.getName(), new NamingServiceImpl(jndiHost, jndiPort), null);
log.log(LogService.LOG_DEBUG, "NamingService registered");
}
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -114,6 +114,7 @@
org.jboss.osgi.common.log,
org.jboss.osgi.jmx,
org.jboss.osgi.spi,
+ org.jboss.osgi.spi.management,
org.jboss.reflect.*,
org.jboss.util.*,
org.jboss.virtual*,
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerService.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -26,7 +26,6 @@
import java.net.URL;
import java.util.List;
-import org.jboss.deployers.spi.DeploymentException;
import org.jboss.kernel.Kernel;
/**
@@ -37,54 +36,54 @@
*/
public interface MicrocontainerService
{
- /**
- * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
+ /*
+ * * The name under which the system bundle context is registered: 'jboss.osgi:service=BundleContext'
*/
String BEAN_SYSTEM_BUNDLE_CONTEXT = "jboss.osgi:service=BundleContext";
- /**
- * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
+ /*
+ * * The name under which the MBeanServer is registered: 'jboss.osgi:service=MBeanServer'
*/
String BEAN_MBEAN_SERVER = "jboss.osgi:service=MBeanServer";
- /**
- * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ /*
+ * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
*/
String BEAN_MAIN_DEPLOYER = "jboss.osgi:service=MainDeployer";
- /**
- * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
+ /*
+ * * The name under which the KernelController is registered: 'jboss.osgi:service=KernelController'
*/
String BEAN_KERNEL_CONTROLLER = "jboss.osgi:service=KernelController";
- /**
- * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
+ /*
+ * * The name under which the Kernel is registered: 'jboss.osgi:service=Kernel'
*/
String BEAN_KERNEL = "jboss.osgi:service=Kernel";
- /**
- * Get the Microcontainer Kernel
+ /*
+ * * Get the Microcontainer Kernel
*/
Kernel getKernel();
- /**
- * Get the list of registered beans.
+ /*
+ * * Get the list of registered beans.
*/
List<String> getRegisteredBeans();
-
- /**
- * Get a registered bean from the Kernel.
+
+ /*
+ * * Get a registered bean from the Kernel.
* @return null if there is no bean registered under this name
*/
Object getRegisteredBean(String beanName);
- /**
- * Deploy MC beans from URL
+ /*
+ * * Deploy MC beans from URL
*/
- void deploy(URL url) throws DeploymentException;
+ void deploy(URL url) throws Exception;
- /**
- * Undeploy MC beans from URL
+ /*
+ * * Undeploy MC beans from URL
*/
- void undeploy(URL url);
+ void undeploy(URL url) throws Exception;
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,61 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.microcontainer;
-
-//$Id$
-
-import java.net.URL;
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.jboss.deployers.spi.DeploymentException;
-import org.jboss.osgi.jmx.ObjectNameFactory;
-
-/**
- * An OSGi Service the gives access to the Kernel and MBeanServer.
- *
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public interface MicrocontainerServiceMBean
-{
- /**
- * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
- */
- ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
-
- /**
- * Get the list of registered beans.
- */
- List<String> getRegisteredBeans();
-
- /**
- * Deploy MC beans from URL
- */
- void deploy(URL url) throws DeploymentException;
-
- /**
- * Undeploy MC beans from URL
- */
- void undeploy(URL url);
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -50,7 +50,7 @@
import org.jboss.kernel.spi.dependency.KernelControllerContext;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.microcontainer.MicrocontainerService;
-import org.jboss.osgi.microcontainer.MicrocontainerServiceMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.jboss.virtual.VFS;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.BundleContext;
@@ -107,7 +107,7 @@
return context != null ? context.getTarget() : null;
}
- public void deploy(URL url) throws DeploymentException
+ public void deploy(URL url) throws Exception
{
ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
try
@@ -133,21 +133,14 @@
}
}
- public void undeploy(URL url)
+ public void undeploy(URL url) throws Exception
{
String deploymentName = contextMap.remove(url);
if (deploymentName != null)
{
- try
- {
- MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
- mainDeployer.removeDeployment(deploymentName);
- mainDeployer.process();
- }
- catch (DeploymentException ex)
- {
- log.log(LogService.LOG_ERROR, "Cannot undeploy: " + url, ex);
- }
+ MainDeployer mainDeployer = (MainDeployer)getRegisteredBean(BEAN_MAIN_DEPLOYER);
+ mainDeployer.removeDeployment(deploymentName);
+ mainDeployer.process();
}
else
{
@@ -235,7 +228,7 @@
}
}
}
-
+
static class PreInstalledControllerContext extends AbstractControllerContext
{
public PreInstalledControllerContext(Object name, ControllerContextActions actions, Object target)
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/framework/OSGiBootstrap.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -28,6 +28,8 @@
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
+import java.util.Enumeration;
+import java.util.Properties;
import org.jboss.logging.Logger;
@@ -119,10 +121,24 @@
private static void initSystemProperties()
{
- // Set the default bind address
- String bindAddress = System.getProperty("jboss.bind.address");
- if (bindAddress == null)
- System.setProperty("jboss.bind.address", "localhost");
+ log.debug("initSystemProperties");
+
+ Properties defaults = new Properties();
+ defaults.setProperty("jboss.bind.address", "localhost");
+ defaults.setProperty("java.protocol.handler.pkgs", "org.jboss.net.protocol|org.jboss.virtual.protocol");
+
+ Enumeration<?> defaultNames = defaults.propertyNames();
+ while(defaultNames.hasMoreElements())
+ {
+ String propName = (String)defaultNames.nextElement();
+ String sysValue = System.getProperty(propName);
+ if (sysValue == null)
+ {
+ String propValue = defaults.getProperty(propName);
+ System.setProperty(propName, propValue);
+ log.debug(" " + propName + "=" + propValue);
+ }
+ }
}
static class StartupThread extends Thread
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (from rev 88323, projects/jboss-osgi/trunk/bundle/microcontainer/src/main/java/org/jboss/osgi/microcontainer/MicrocontainerServiceMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/management/MicrocontainerServiceMBean.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.management;
+
+//$Id$
+
+import java.net.URL;
+import java.util.List;
+
+import javax.management.ObjectName;
+
+/**
+ * An OSGi Service the gives access to the Kernel and MBeanServer.
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public interface MicrocontainerServiceMBean
+{
+ /**
+ * The object name under which the MicrocontainerService is registered: 'jboss.osgi:service=MicrocontainerService'
+ */
+ ObjectName MBEAN_MICROCONTAINER_SERVICE = ObjectNameFactory.create("jboss.osgi:service=MicrocontainerService");
+
+ /**
+ * Get the list of registered beans.
+ */
+ List<String> getRegisteredBeans();
+
+ /**
+ * Deploy MC beans from URL
+ */
+ void deploy(URL url) throws Exception;
+
+ /**
+ * Undeploy MC beans from URL
+ */
+ void undeploy(URL url) throws Exception;
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/MicrocontainerService.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -33,6 +33,7 @@
* @author thomas.diesler at jboss.com
* @since 23-Jan-2009
*/
+ at Deprecated
public interface MicrocontainerService
{
/**
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/service/microcontainer/internal/MicrocontainerServiceImpl.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -36,6 +36,7 @@
* @author thomas.diesler at jboss.com
* @since 23-Jan-2009
*/
+ at Deprecated
public class MicrocontainerServiceImpl implements MicrocontainerService
{
private BundleContext systemContext;
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractBundle.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -38,4 +38,6 @@
public abstract void uninstall() throws BundleException;
public abstract int getState();
+
+ public abstract String getSymbolicName();
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,34 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public abstract class AbstractPackageAdmin
+{
+ public abstract void refreshPackages(AbstractBundle[] bundles);
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/AbstractRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -27,7 +27,9 @@
import java.util.List;
import java.util.Map;
-import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.jboss.logging.Logger;
import org.jboss.osgi.spi.logging.LogEntryCache;
@@ -60,6 +62,12 @@
public abstract AbstractBundle installBundle(String location) throws BundleException;
+ public abstract void deploy(String location) throws Exception;
+
+ public abstract void undeploy(String location) throws Exception;
+
+ public abstract AbstractBundle[] getBundles();
+
public void addCapability(Capability capability) throws BundleException
{
for (String location : capability.getBundles())
@@ -93,8 +101,12 @@
}
}
- public abstract MBeanServer getMBeanServer();
+ public abstract AbstractPackageAdmin getPackageAdmin();
+ public abstract InitialContext getInitialContext() throws NamingException;
+
+ public abstract MBeanServerConnection getMBeanServer();
+
public abstract void startLogEntryTracking(LogEntryCache logEntryCache);
public abstract void stopLogEntryTracking();
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedBundle.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -39,6 +39,11 @@
this.bundle = bundle;
}
+ public Bundle getBundle()
+ {
+ return bundle;
+ }
+
@Override
public void start() throws BundleException
{
@@ -62,4 +67,10 @@
{
return bundle.getState();
}
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class EmbeddedPackageAdmin extends AbstractPackageAdmin
+{
+ private PackageAdmin packAdmin;
+
+ public EmbeddedPackageAdmin(PackageAdmin packAdmin)
+ {
+ this.packAdmin = packAdmin;
+ }
+
+ @Override
+ public void refreshPackages(AbstractBundle[] bundles)
+ {
+ Bundle[] bundleArr = null;
+ if (bundles != null)
+ {
+ bundleArr = new Bundle[bundles.length];
+ for (int i=0; i < bundles.length; i++)
+ {
+ bundleArr[i] = ((EmbeddedBundle)bundles[i]).getBundle();
+ }
+ }
+ packAdmin.refreshPackages(bundleArr);
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedPackageAdmin.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/EmbeddedRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,22 +21,34 @@
*/
package org.jboss.osgi.spi.testing;
+// $Id$
+
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.List;
import java.util.Properties;
import javax.management.MBeanServer;
+import javax.management.MBeanServerConnection;
import javax.management.MBeanServerFactory;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
import org.jboss.osgi.spi.framework.OSGiFramework;
import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.log.LogReaderService;
+import org.osgi.service.packageadmin.PackageAdmin;
import org.osgi.util.tracker.ServiceTracker;
/**
@@ -61,6 +73,35 @@
}
@Override
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(archiveURL);
+ }
+
+ @Override
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.undeploy(archiveURL);
+ }
+
+ @Override
+ public AbstractBundle[] getBundles()
+ {
+ List<AbstractBundle> absBundles = new ArrayList<AbstractBundle>();
+ for (Bundle bundle : getBundleContext().getBundles())
+ {
+ absBundles.add(new EmbeddedBundle(bundle));
+ }
+ AbstractBundle[] bundleArr = new AbstractBundle[absBundles.size()];
+ absBundles.toArray(bundleArr);
+ return bundleArr;
+ }
+
+ @Override
public void addCapability(Capability capability) throws BundleException
{
// Copy the properties to the System props
@@ -115,7 +156,7 @@
@Override
@SuppressWarnings("unchecked")
- public MBeanServer getMBeanServer()
+ public MBeanServerConnection getMBeanServer()
{
ArrayList<MBeanServer> serverArr = MBeanServerFactory.findMBeanServer(null);
if (serverArr.size() > 1)
@@ -130,4 +171,25 @@
return server;
}
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public InitialContext getInitialContext() throws NamingException
+ {
+ Hashtable env = new Hashtable();
+ String bindAddress = System.getProperty("jboss.bind.address", "localhost");
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + bindAddress + ":1199");
+ return new InitialContext(env);
+ }
+
+ @Override
+ public AbstractPackageAdmin getPackageAdmin()
+ {
+ BundleContext context = getBundleContext();
+ ServiceReference sref = context.getServiceReference(PackageAdmin.class.getName());
+ PackageAdmin packAdmin = (PackageAdmin)context.getService(sref);
+ return new EmbeddedPackageAdmin(packAdmin);
+ }
}
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JMXCapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JMXCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class JMXCapability extends Capability
+{
+ public JMXCapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.jboss.osgi.jmx.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.jmx.rmi.port", "1198");
+
+ addBundle("bundles/jboss-osgi-jmx.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/JNDICapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/JNDICapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,47 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+import java.util.Properties;
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class JNDICapability extends Capability
+{
+ public JNDICapability()
+ {
+ Properties props = getProperties();
+ props.setProperty("org.jboss.osgi.jndi.host", System.getProperty("jboss.bind.address", "localhost"));
+ props.setProperty("org.jboss.osgi.jndi.rmi.port", "1198");
+ props.setProperty("org.jboss.osgi.jndi.port", "1199");
+
+ addBundle("bundles/jboss-common-core-bundle.jar");
+ addBundle("bundles/jboss-osgi-jndi.jar");
+ }
+}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java (from rev 88323, projects/jboss-osgi/trunk/bundle/blueprint/src/test/java/org/jboss/test/osgi/blueprint/MicrocontainerCapability.java)
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/MicrocontainerCapability.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+//$Id$
+
+
+/**
+ * [TODO]
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 05-May-2009
+ */
+public class MicrocontainerCapability extends Capability
+{
+ public MicrocontainerCapability()
+ {
+ addBundle("bundles/apache-xerces-bundle.jar");
+ addBundle("bundles/jaxb-bundle.jar");
+ addBundle("bundles/jbossxb-bundle.jar");
+ addBundle("bundles/jboss-osgi-microcontainer.jar");
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTest.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,11 +21,13 @@
*/
package org.jboss.osgi.spi.testing;
+import java.io.File;
import java.net.URL;
import junit.framework.TestCase;
import org.jboss.logging.Logger;
+import org.jboss.virtual.VFS;
/**
* An OSGi Test Case
@@ -38,13 +40,19 @@
// Provide logging
final Logger log = Logger.getLogger(OSGiTest.class);
- private OSGiTestHelper delegate;
+ private OSGiTestHelper helper;
+ public OSGiTest()
+ {
+ // Prevent unknown protocol: vfsfile
+ VFS.init();
+ }
+
@Override
protected void setUp() throws Exception
{
log.debug("### START " + getLongName());
- delegate = new OSGiTestHelper();
+ helper = new OSGiTestHelper();
super.setUp();
}
@@ -69,21 +77,31 @@
protected AbstractRuntime getRuntime()
{
- return delegate.getRuntime();
+ return helper.getDefaultRuntime();
}
protected EmbeddedRuntime getEmbeddedRuntime()
{
- return delegate.getEmbeddedRuntime();
+ return helper.getEmbeddedRuntime();
}
protected URL getResourceURL(String resource)
{
- return delegate.getResourceURL(resource);
+ return helper.getResourceURL(resource);
}
+ protected File getResourceFile(String resource)
+ {
+ return helper.getResourceFile(resource);
+ }
+
protected URL getTestArchiveURL(String archive)
{
- return delegate.getTestArchiveURL(archive);
+ return helper.getTestArchiveURL(archive);
}
+
+ protected File getTestArchiveFile(String archive)
+ {
+ return helper.getTestArchiveFile(archive);
+ }
}
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestHelper.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -59,9 +59,20 @@
return bootProvider;
}
- public AbstractRuntime getRuntime()
+ public AbstractRuntime getDefaultRuntime()
{
- return getEmbeddedRuntime();
+ AbstractRuntime runtime;
+
+ String target = System.getProperty("target.container");
+ if (target == null)
+ {
+ runtime = getEmbeddedRuntime();
+ }
+ else
+ {
+ runtime = getRemoteRuntime();
+ }
+ return runtime;
}
public EmbeddedRuntime getEmbeddedRuntime()
@@ -69,9 +80,9 @@
return new EmbeddedRuntime(this);
}
- public AbstractRuntime getRemoteRuntime()
+ public RemoteRuntime getRemoteRuntime()
{
- return null;
+ return new RemoteRuntime(this);
}
/** Try to discover the URL for the test resource */
@@ -104,7 +115,7 @@
}
/** Try to discover the File for the test resource */
- private File getResourceFile(String resource)
+ public File getResourceFile(String resource)
{
File file = new File(resource);
if (file.exists())
@@ -118,7 +129,7 @@
}
/** Try to discover the File for the deployment archive */
- private File getTestArchiveFile(String archive)
+ public File getTestArchiveFile(String archive)
{
File file = new File(archive);
if (file.exists())
Modified: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/OSGiTestSetup.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -21,6 +21,7 @@
*/
package org.jboss.osgi.spi.testing;
+import java.io.File;
import java.net.URL;
import junit.extensions.TestSetup;
@@ -63,9 +64,9 @@
log.debug("### END SETUP " + testCase.getName());
}
- public AbstractRuntime getRuntime()
+ public AbstractRuntime getDefaultRuntime()
{
- return helper.getRuntime();
+ return helper.getDefaultRuntime();
}
public URL getResourceURL(String resource)
@@ -73,8 +74,18 @@
return helper.getResourceURL(resource);
}
+ protected File getResourceFile(String resource)
+ {
+ return helper.getResourceFile(resource);
+ }
+
public URL getTestArchiveURL(String archive)
{
return helper.getTestArchiveURL(archive);
}
+
+ protected File getTestArchiveFile(String archive)
+ {
+ return helper.getTestArchiveFile(archive);
+ }
}
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+import org.jboss.logging.Logger;
+import org.jboss.osgi.spi.framework.RemoteBundle;
+import org.osgi.framework.BundleException;
+
+/**
+ * An OSGi Test Case
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteBundleBadName extends AbstractBundle
+{
+ // Provide logging
+ private static final Logger log = Logger.getLogger(RemoteBundleBadName.class);
+
+ private RemoteRuntime runtime;
+ private RemoteBundle bundle;
+ private String location;
+
+ public RemoteBundleBadName(RemoteRuntime runtime, RemoteBundle bundle, String location)
+ {
+ this.runtime = runtime;
+ this.bundle = bundle;
+ this.location = location;
+ }
+
+ @Override
+ public void start() throws BundleException
+ {
+ bundle.start();
+ }
+
+ @Override
+ public void stop() throws BundleException
+ {
+ bundle.stop();
+ }
+
+ @Override
+ public void uninstall() throws BundleException
+ {
+ try
+ {
+ runtime.undeploy(location);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ log.error("Cannot uninstall: " + location);
+ }
+ }
+
+ @Override
+ public int getState()
+ {
+ return bundle.getState();
+ }
+
+ @Override
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteBundleBadName.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
===================================================================
--- projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java (rev 0)
+++ projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,233 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.osgi.spi.testing;
+
+// $Id$
+
+import static org.jboss.osgi.spi.management.MicrocontainerServiceMBean.MBEAN_MICROCONTAINER_SERVICE;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.JarInputStream;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.jboss.osgi.spi.NotImplementedException;
+import org.jboss.osgi.spi.framework.RemoteBundle;
+import org.jboss.osgi.spi.framework.RemoteFramework;
+import org.jboss.osgi.spi.framework.RemoteFrameworkException;
+import org.jboss.osgi.spi.logging.LogEntryCache;
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.management.ManagedBundleMBean;
+import org.jboss.osgi.spi.management.ManagedFrameworkMBean;
+import org.jboss.osgi.spi.management.MicrocontainerServiceMBean;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+/**
+ * [TODO]
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 25-Sep-2008
+ */
+public class RemoteRuntime extends AbstractRuntime
+{
+ private MBeanServerConnection mbeanServer;
+ private ManagedFrameworkMBean managedFramework;
+ private Set<Class<?>> ignoredCaps = new HashSet<Class<?>>();
+
+ public RemoteRuntime(OSGiTestHelper helper)
+ {
+ super(helper);
+
+ // Initialize the ignored capabilities
+ ignoredCaps.add(JNDICapability.class);
+ ignoredCaps.add(JMXCapability.class);
+ ignoredCaps.add(MicrocontainerCapability.class);
+ }
+
+ @Override
+ public AbstractBundle installBundle(String location) throws BundleException
+ {
+ String symbolicName = null;
+ try
+ {
+ File archiveFile = getTestHelper().getTestArchiveFile(location);
+ JarInputStream jarInputStream = new JarInputStream(new FileInputStream(archiveFile));
+ Attributes attribs = jarInputStream.getManifest().getMainAttributes();
+ symbolicName = attribs.getValue(Constants.BUNDLE_SYMBOLICNAME);
+ jarInputStream.close();
+ }
+ catch (IOException ex)
+ {
+
+ }
+ if (symbolicName == null)
+ throw new IllegalArgumentException("Cannot obtain Bundle-SymbolicName for: " + location);
+
+ try
+ {
+ deploy(location);
+ RemoteBundle bundle = getRemoteFramework().getBundle(symbolicName);
+ return new RemoteBundleBadName(this, bundle, location);
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ throw new BundleException("Cannot install: " + location, ex);
+ }
+ }
+
+ @Override
+ public void deploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.deploy(archiveURL);
+ }
+
+ @Override
+ public void undeploy(String location) throws Exception
+ {
+ URL archiveURL = getTestHelper().getTestArchiveURL(location);
+ MicrocontainerServiceMBean mcService = MBeanProxy.get(MicrocontainerServiceMBean.class, MBEAN_MICROCONTAINER_SERVICE, getMBeanServer());
+ mcService.undeploy(archiveURL);
+ }
+
+ @Override
+ public void addCapability(Capability capability) throws BundleException
+ {
+ if (ignoredCaps.contains(capability.getClass()))
+ return;
+
+ super.addCapability(capability);
+ }
+
+ @Override
+ public AbstractBundle[] getBundles()
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void startLogEntryTracking(final LogEntryCache logEntryCache)
+ {
+ throw new NotImplementedException();
+ }
+
+ @Override
+ public void stopLogEntryTracking()
+ {
+ }
+
+ @Override
+ public MBeanServerConnection getMBeanServer()
+ {
+ if (mbeanServer == null)
+ {
+ try
+ {
+ InitialContext iniCtx = getInitialContext();
+ mbeanServer = (MBeanServerConnection)iniCtx.lookup("jmx/invoker/RMIAdaptor");
+ }
+ catch (NamingException ex)
+ {
+ throw new IllegalStateException("Cannot obtain MBeanServerConnection", ex);
+ }
+ }
+ return mbeanServer;
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public InitialContext getInitialContext() throws NamingException
+ {
+ Hashtable env = new Hashtable();
+ String bindAddress = System.getProperty("jboss.bind.address", "localhost");
+ env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
+ env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
+ env.put("java.naming.provider.url", "jnp://" + bindAddress + ":1099");
+ return new InitialContext(env);
+ }
+
+ @Override
+ public AbstractPackageAdmin getPackageAdmin()
+ {
+ throw new NotImplementedException();
+ }
+
+ private RemoteFramework getRemoteFramework() throws Exception
+ {
+ if (managedFramework == null)
+ managedFramework = MBeanProxy.get(ManagedFrameworkMBean.class, ManagedFrameworkMBean.MBEAN_MANAGED_FRAMEWORK, getMBeanServer());
+
+ return new RemoteFramework()
+ {
+ public RemoteBundle getBundle(String symbolicName)
+ {
+ ObjectName bundleOName = managedFramework.getBundle(symbolicName);
+ if (bundleOName == null)
+ throw new IllegalArgumentException("Cannot remote bundle for: " + symbolicName);
+
+ try
+ {
+ return MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
+ }
+
+ public Set<RemoteBundle> getBundles()
+ {
+ Set<RemoteBundle> remBundles = new HashSet<RemoteBundle>();
+ for (ObjectName bundleOName : managedFramework.getBundles())
+ {
+ try
+ {
+ RemoteBundle remBundle = MBeanProxy.get(ManagedBundleMBean.class, bundleOName, getMBeanServer());
+ remBundles.add(remBundle);
+ }
+ catch (MBeanProxyException ex)
+ {
+ throw new RemoteFrameworkException(ex);
+ }
+ }
+ return remBundles;
+ }
+ };
+ }
+}
Property changes on: projects/jboss-osgi/trunk/spi/src/main/java/org/jboss/osgi/spi/testing/RemoteRuntime.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -88,12 +88,6 @@
<!-- Build -->
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -54,15 +54,26 @@
<artifactId>org.osgi.compendium</artifactId>
<scope>provided</scope>
</dependency>
+
+ <!-- Bundle DEpendencies -->
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
- <version>${version}</version>
+ <artifactId>apache-xerces-bundle</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-logging</artifactId>
+ <artifactId>jaxb-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-common-core-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
@@ -80,20 +91,31 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-logging</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-microcontainer</artifactId>
+ <version>${version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-remotelog</artifactId>
<version>${version}</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jbossxb-bundle</artifactId>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
<!-- Build -->
<build>
- <testResources>
- <testResource>
- <directory>src/test/resources</directory>
- <filtering>true</filtering>
- </testResource>
- </testResources>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/assembly-bundles.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -15,10 +15,18 @@
<outputDirectory>bundles</outputDirectory>
<outputFileNameMapping>${artifact.artifactId}${dashClassifier?}.${artifact.extension}</outputFileNameMapping>
<includes>
- <include>*:org.apache.felix.log:jar</include>
+ <include>*:apache-xerces-bundle:jar</include>
+ <include>*:jaxb-bundle:jar</include>
+ <include>*:jboss-common-core-bundle:jar</include>
<include>*:jboss-osgi-common:jar</include>
+ <include>*:jboss-osgi-jmx:jar</include>
+ <include>*:jboss-osgi-jndi:jar</include>
<include>*:jboss-osgi-logging:jar</include>
+ <include>*:jboss-osgi-microcontainer:jar</include>
<include>*:jboss-osgi-remotelog:jar</include>
+ <include>*:jbossxb-bundle:jar</include>
+ <include>*:org.apache.felix.log:jar</include>
+ <include>*:org.osgi.compendium:jar</include>
</includes>
<useStrictFiltering>true</useStrictFiltering>
<scope>provided</scope>
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java (from rev 88323, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36RemoteTestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,116 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.deployer.jbosgi36;
+
+//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler at jboss.com $
+
+import junit.extensions.TestSetup;
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.management.MBeanProxy;
+import org.jboss.osgi.spi.management.MBeanProxyException;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.JMXCapability;
+import org.jboss.osgi.spi.testing.JNDICapability;
+import org.jboss.osgi.spi.testing.MicrocontainerCapability;
+import org.jboss.osgi.spi.testing.OSGiTest;
+import org.jboss.osgi.spi.testing.OSGiTestSetup;
+import org.jboss.test.osgi.deployer.jbosgi36.mbean.FooMBean;
+
+/**
+ * [JBOSGI-36] Bundle classes leak into system classloader
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-36
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 25-Feb-2009
+ */
+public class OSGI36RemoteTestCase extends OSGiTest
+{
+ static AbstractRuntime runtime;
+
+ public static Test suite()
+ {
+ TestSetup setup = new OSGiTestSetup(OSGI36RemoteTestCase.class)
+ {
+ @Override
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+ runtime = getDefaultRuntime();
+ runtime.addCapability(new JNDICapability());
+ runtime.addCapability(new JMXCapability());
+ runtime.addCapability(new MicrocontainerCapability());
+
+ runtime.deploy("jbosgi36-bundle.jar");
+ runtime.deploy("jbosgi36-mbean.jar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception
+ {
+ runtime.undeploy("jbosgi36-mbean.jar");
+ runtime.undeploy("jbosgi36-bundle.jar");
+ runtime.shutdown();
+ super.tearDown();
+ }
+ };
+ return setup;
+ }
+
+ public void testAccessMBean() throws Exception
+ {
+ assertEquals("hello", getFooMBean().echo("hello"));
+ }
+
+ public void testAccessSomeService() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeService();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ public void testAccessSomeInternal() throws Exception
+ {
+ try
+ {
+ String loaderName = getFooMBean().accessSomeInternal();
+ fail("Unexpected classloader: " + loaderName);
+ }
+ catch (ClassNotFoundException ex)
+ {
+ // expected
+ }
+ }
+
+ private FooMBean getFooMBean() throws MBeanProxyException
+ {
+ FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, runtime.getMBeanServer());
+ return foo;
+ }
+}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/deployer/jbosgi36/OSGI36TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,88 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.test.osgi.deployer.jbosgi36;
-
-//$Id: OSGI36TestCase.java 86968 2009-04-08 15:51:12Z thomas.diesler at jboss.com $
-
-import junit.framework.Test;
-
-import org.jboss.osgi.spi.junit.IntegrationTest;
-import org.jboss.osgi.spi.junit.IntegrationTestSetup;
-import org.jboss.osgi.spi.management.MBeanProxy;
-import org.jboss.osgi.spi.management.MBeanProxyException;
-import org.jboss.test.osgi.deployer.jbosgi36.mbean.FooMBean;
-
-/**
- * [JBOSGI-36] Bundle classes leak into system classloader
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-36
- *
- * @author thomas.diesler at jboss.com
- * @since 25-Feb-2009
- */
-public class OSGI36TestCase extends IntegrationTest
-{
- static IntegrationTestSetup setup;
-
- public static Test suite()
- {
- setup = new IntegrationTestSetup(OSGI36TestCase.class, "jbosgi36-bundle.jar, jbosgi36-mbean.jar");
- return setup;
- }
-
- public void testAccessMBean() throws Exception
- {
- assertEquals("hello", getFooMBean().echo("hello"));
- }
-
- public void testAccessSomeService() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeService();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- public void testAccessSomeInternal() throws Exception
- {
- try
- {
- String loaderName = getFooMBean().accessSomeInternal();
- fail("Unexpected classloader: " + loaderName);
- }
- catch (ClassNotFoundException ex)
- {
- // expected
- }
- }
-
- private FooMBean getFooMBean() throws MBeanProxyException
- {
- FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, FooMBean.OBJECT_NAME, getMBeanServerConnection());
- return foo;
- }
-}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi37/OSGI37TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -26,10 +26,10 @@
import java.util.ArrayList;
import java.util.List;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
/**
* [JBOSGI-37] Prevent creation of deployment unit for nested jars
@@ -41,26 +41,18 @@
*/
public class OSGI37TestCase extends OSGiTest
{
- private BundleContext sysContext;
-
- @Override
- protected void setUp() throws Exception
- {
- super.setUp();
-
- OSGiFramework framework = getBootstrapProvider().getFramework();
- sysContext = framework.getBundleContext();
- }
-
public void testNestedBundle() throws Exception
{
- Bundle bundleA = installBundle(sysContext, "jbosgi37-bundleA.jar", true);
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleA = runtime.installBundle("jbosgi37-bundleA.jar");
+ bundleA.start();
+
assertEquals("Bundle started", Bundle.ACTIVE, bundleA.getState());
List<String> relevant = new ArrayList<String>();
- for (Bundle bundle : sysContext.getBundles())
+ for (AbstractBundle bundle : runtime.getBundles())
{
String symbolicName = bundle.getSymbolicName();
if (symbolicName.startsWith("jbosgi37"))
@@ -72,7 +64,7 @@
}
finally
{
- bundleA.uninstall();
+ runtime.shutdown();
}
}
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi38/OSGI38TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,11 +23,10 @@
//$Id: OSGI38TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
/**
@@ -50,13 +49,10 @@
*/
public void testInstallStartX() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleX.start();
@@ -64,7 +60,7 @@
}
finally
{
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -73,17 +69,13 @@
*/
public void testInstallXBeforeB() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
bundleB.start();
@@ -91,8 +83,7 @@
}
finally
{
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -101,21 +92,16 @@
*/
public void testInstallBBeforeA() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
bundleA.start();
@@ -123,9 +109,7 @@
}
finally
{
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
@@ -134,14 +118,10 @@
*/
public void testInstallBBeforeX() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
try
@@ -154,7 +134,7 @@
// expected
}
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleB.start();
@@ -162,8 +142,7 @@
}
finally
{
- uninstall(bundleX);
- uninstall(bundleB);
+ runtime.shutdown();
}
}
@@ -172,18 +151,13 @@
*/
public void testInstallABeforeB() throws Exception
{
- OSGiFramework framework = OSGiBootstrap.getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleA = null;
- Bundle bundleB = null;
- Bundle bundleX = null;
+ AbstractRuntime runtime = getRuntime();
try
{
- bundleA = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleA.jar").toExternalForm());
+ AbstractBundle bundleA = runtime.installBundle("jbosgi38-bundleA.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleA.getState());
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleB.jar").toExternalForm());
+ AbstractBundle bundleB = runtime.installBundle("jbosgi38-bundleB.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
try
@@ -196,7 +170,7 @@
// expected
}
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi38-bundleX.jar").toExternalForm());
+ AbstractBundle bundleX = runtime.installBundle("jbosgi38-bundleX.jar");
assertEquals("Bundle installed", Bundle.INSTALLED, bundleX.getState());
bundleB.start();
@@ -207,22 +181,7 @@
}
finally
{
- uninstall(bundleA);
- uninstall(bundleB);
- uninstall(bundleX);
+ runtime.shutdown();
}
}
-
- private void uninstall(Bundle bnd)
- {
- try
- {
- if (bnd != null)
- bnd.uninstall();
- }
- catch (BundleException ex)
- {
- System.err.println(ex.toString());
- }
- }
}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi39/OSGI39TestCase.java 2009-05-07 10:38:40 UTC (rev 88346)
@@ -23,13 +23,12 @@
//$Id: OSGI39TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler at jboss.com $
-import org.jboss.osgi.spi.framework.OSGiFramework;
-import org.jboss.osgi.spi.junit.OSGiTest;
+import org.jboss.osgi.spi.testing.AbstractBundle;
+import org.jboss.osgi.spi.testing.AbstractPackageAdmin;
+import org.jboss.osgi.spi.testing.AbstractRuntime;
+import org.jboss.osgi.spi.testing.OSGiTest;
import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.packageadmin.PackageAdmin;
/**
* [JBOSGI-39] Bundle gets wired to an already uninstalled bundle
@@ -47,31 +46,33 @@
{
public void testVerifyUnresolved() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
- assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
-
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+ assertEquals("Bundle installed", Bundle.INSTALLED, bundleB.getState());
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
bundleB.start();
- fail("Unresolved constraint expected");
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
}
- catch (BundleException ex)
+ finally
{
- // expected
+ runtime.shutdown();
}
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
}
/*
@@ -87,74 +88,83 @@
*/
public void testWiringToUninstalled() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ AbstractRuntime runtime = getRuntime();
+ try
+ {
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Install B without X
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
- bundleB.uninstall();
+ bundleB.uninstall();
+ }
+ finally
+ {
+ runtime.shutdown();
+ }
}
public void testWiringToUninstalledPackageAdmin() throws Exception
{
- OSGiFramework framework = getBootstrapProvider().getFramework();
- BundleContext sysContext = framework.getBundleContext();
-
- Bundle bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
- Bundle bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- // Uninstall X before B
- bundleX.uninstall();
- bundleB.uninstall();
-
- // Forces the update (replacement) or removal of packages exported by the specified bundles.
- ServiceReference sref = sysContext.getServiceReference(PackageAdmin.class.getName());
- PackageAdmin packAdmin = (PackageAdmin)sysContext.getService(sref);
- packAdmin.refreshPackages(null);
-
- // Install B without X
- bundleB = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleB.jar").toExternalForm());
-
+ AbstractRuntime runtime = getRuntime();
try
{
+ AbstractBundle bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+ AbstractBundle bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
bundleB.start();
- fail("Unresolved constraint expected");
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ // Uninstall X before B
+ bundleX.uninstall();
+ bundleB.uninstall();
+
+ // Forces the update (replacement) or removal of packages exported by the specified bundles.
+ AbstractPackageAdmin packAdmin = runtime.getPackageAdmin();
+ packAdmin.refreshPackages(null);
+
+ // Install B without X
+ bundleB = runtime.installBundle("jbosgi39-bundleB.jar");
+
+ try
+ {
+ bundleB.start();
+ fail("Unresolved constraint expected");
+ }
+ catch (BundleException ex)
+ {
+ // expected
+ }
+
+ bundleX = runtime.installBundle("jbosgi39-bundleX.jar");
+
+ bundleB.start();
+
+ assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
+ assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
+
+ bundleB.uninstall();
+ bundleX.uninstall();
}
- catch (BundleException ex)
+ finally
{
- // expected
+ runtime.shutdown();
}
-
- bundleX = sysContext.installBundle(getTestArchiveURL("jbosgi39-bundleX.jar").toExternalForm());
-
- bundleB.start();
-
- assertEquals("Bundle resolved", Bundle.RESOLVED, bundleX.getState());
- assertEquals("Bundle active", Bundle.ACTIVE, bundleB.getState());
-
- bundleB.uninstall();
- bundleX.uninstall();
}
}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-bootstrap-beans.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,111 +0,0 @@
-<!--
- The bootstrap of the server. This should only have the minimum
- needed to bootstrap the mc kernel and profile service.
-
- $Id: jboss-osgi-bootstrap-beans.xml 86378 2009-03-26 12:02:32Z thomas.diesler at jboss.com $
--->
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The MainDeployer -->
- <bean name="MainDeployer" class="org.jboss.deployers.plugins.main.MainDeployerImpl">
- <property name="structuralDeployers"><inject bean="StructuralDeployers"/></property>
- <property name="deployers"><inject bean="Deployers"/></property>
- <property name="mgtDeploymentCreator"><inject bean="ManagedDeploymentCreator"/></property>
- </bean>
-
- <!-- The ManagedDeploymentCreator implementation -->
- <bean name="ManagedDeploymentCreator" class="org.jboss.deployers.plugins.managed.DefaultManagedDeploymentCreator" />
-
- <!-- ModificationType structure processor -->
- <bean name="ModificationTypeStructureProcessor" class="org.jboss.deployers.vfs.plugins.structure.modify.ModificationTypeStructureProcessor">
- <incallback method="addMatcher"/>
- <uncallback method="removeMatcher"/>
- </bean>
-
- <!-- The holder for deployers that determine structure -->
- <bean name="StructuralDeployers" class="org.jboss.deployers.vfs.plugins.structure.VFSStructuralDeployersImpl">
- <property name="structureBuilder">
- <!-- The consolidator of the structure information -->
- <bean name="StructureBuilder" class="org.jboss.deployers.vfs.plugins.structure.VFSStructureBuilder">
- <property name="structureProcessor"><inject bean="ModificationTypeStructureProcessor"/></property>
- </bean>
- </property>
- <!-- Accept any implementor of structure deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- The holder for deployers that do real deployment -->
- <bean name="Deployers" class="org.jboss.deployers.plugins.deployers.DeployersImpl">
- <constructor><parameter><inject bean="jboss.kernel:service=KernelController"/></parameter></constructor>
- <!-- Accept any implementor of deployer -->
- <incallback method="addDeployer"/>
- <uncallback method="removeDeployer"/>
- </bean>
-
- <!-- A declared structure descriptor deployer -->
- <bean name="DeclaredStructure" class="org.jboss.deployers.vfs.plugins.structure.explicit.DeclaredStructure"/>
-
- <!-- JAR Structure -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure">
- <property name="candidateStructureVisitorFactory">
- <!-- Any file that is not an ordinary directory is a candidate -->
- <bean name="JARStructureCandidates" class="org.jboss.deployers.vfs.spi.structure.helpers.DefaultCandidateStructureVisitorFactory">
- <!-- A filter to exclude some obvious non-subdeployments -->
- <property name="filter">
- <bean name="JARFilter" class="org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter">
- <constructor><parameter>
- <list elementClass="java.lang.String">
- <!-- Exclude class files as subdeployments -->
- <value>.class</value>
- </list>
- </parameter></constructor>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-
- <!-- File Structure -->
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure">
- <!-- Unless specified the default list of suffixes is -service.xml, -beans.xml, -ds.xml, -aop.xml -->
- <constructor>
- <parameter>
- <set elementClass="java.lang.String">
- <value>-service.xml</value>
- <value>-beans.xml</value>
- </set>
- </parameter>
- </constructor>
- </bean>
-
- <!-- POJO Deployment -->
- <bean name="BeanDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanDeployer"/>
- <bean name="KernelDeploymentDeployer" class="org.jboss.deployers.vfs.deployer.kernel.KernelDeploymentDeployer"/>
- <bean name="BeanMetaDataDeployer" class="org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataDeployer">
- <constructor><parameter class="org.jboss.kernel.Kernel"><inject bean="jboss.kernel:service=Kernel"/></parameter></constructor>
- </bean>
-
- <!-- VFS ClassLoader -->
- <bean name="ClassLoaderSystem" class="org.jboss.classloader.spi.ClassLoaderSystem">
- <constructor factoryClass="org.jboss.classloader.spi.ClassLoaderSystem" factoryMethod="getInstance"/>
- </bean>
- <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
- <incallback method="addModule" state="Configured"/>
- <uncallback method="removeModule" state="Configured"/>
- </bean>
- <bean name="ClassLoadingDefaultDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDefaultDeployer">
- <property name="defaultMetaData">
- <classloading xmlns="urn:jboss:classloading:1.0" export-all="NON_EMPTY" import-all="true"/>
- </property>
- </bean>
- <bean name="ClassLoaderClassPathDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderClassPathDeployer"/>
- <bean name="ClassLoaderDescribeDeployer" class="org.jboss.deployers.vfs.plugins.classloader.VFSClassLoaderDescribeDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- </bean>
- <bean name="ClassLoaderDeployer" class="org.jboss.deployers.plugins.classloading.AbstractLevelClassLoaderSystemDeployer">
- <property name="classLoading"><inject bean="ClassLoading"/></property>
- <property name="system"><inject bean="ClassLoaderSystem"/></property>
- </bean>
-
-</deployment>
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix-beans.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,49 +0,0 @@
-<!--
- $Id$
--->
-<deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd" xmlns="urn:jboss:bean-deployer:2.0">
-
- <!-- The OSGiFramework -->
- <bean name="jboss.osgi:service=Framework" class="org.jboss.osgi.felix.framework.FelixIntegration">
- <property name="properties">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- <entry>
- <key>org.osgi.framework.system.packages</key>
- <value>
- org.jboss.osgi.spi.logging,
- org.osgi.framework; version=1.4,
- org.osgi.service.log; version=1.3,
- org.osgi.util.tracker; version=1.3,
-
- <!-- needed by jboss-remoting -->
- javax.management,
- javax.naming,
- javax.net,
- javax.net.ssl,
- org.apache.log4j,
- org.jboss.logging,
- org.jboss.util,
- org.jboss.util.id,
- org.jboss.util.threadpool,
- org.jboss.util.propertyeditor,
- </value>
- </entry>
- <!--
- Setup remote logging
- -->
- <entry><key>org.jboss.osgi.service.remote.log.reader</key><value>true</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.host</key><value>localhost</value></entry>
- <entry><key>org.jboss.osgi.service.remote.log.port</key><value>5400</value></entry>
- </map>
- </property>
- <property name="autoStart">
- <list elementClass="java.net.URL">
- <value>file://${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
- <value>file://${test.archive.directory}/bundles/jboss-osgi-logging.jar</value>
- </list>
- </property>
- </bean>
-
-</deployment>
Added: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -0,0 +1,31 @@
+#
+# Properties read by the org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
+#
+# $Id$
+#
+
+# The OSGiFramework implementation
+org.jboss.osgi.spi.framework.impl=org.jboss.osgi.felix.framework.FelixIntegration
+
+# Properties to configure the Framework
+org.osgi.framework.storage.clean=onFirstInit
+org.osgi.framework.system.packages.extra=\
+ org.jboss.logging, \
+ org.jboss.osgi.spi, \
+ org.jboss.osgi.spi.management, \
+ org.jboss.virtual, \
+ org.jboss.virtual.plugins.registry, \
+ org.jboss.virtual.plugins.context.jar, \
+ org.jboss.virtual.plugins.vfs.helpers, \
+ org.jboss.net.protocol, \
+ org.jboss.virtual.protocol
+
+# Bundles that need to be installed with the Framework automatically
+org.jboss.osgi.spi.framework.autoInstall=\
+ file://${test.archive.directory}/bundles/org.osgi.compendium.jar
+
+# Bundles that need to be started automatically
+org.jboss.osgi.spi.framework.autoStart=\
+ file://${test.archive.directory}/bundles/org.apache.felix.log.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-common.jar \
+ file://${test.archive.directory}/bundles/jboss-osgi-logging.jar
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jboss-osgi-felix.properties
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jndi.properties 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1,3 +1,3 @@
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
-java.naming.provider.url=jnp://@jboss.bind.address@:1099
+java.naming.provider.url=jnp://@jboss.bind.address@:1199
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/org.jboss.osgi.spi.framework.OSGiBootstrapProvider 2009-05-07 10:38:40 UTC (rev 88346)
@@ -1 +1 @@
-org.jboss.osgi.spi.internal.MicrocontainerBootstrapProvider
\ No newline at end of file
+org.jboss.osgi.spi.framework.PropertiesBootstrapProvider
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 09:59:18 UTC (rev 88345)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-05-07 10:38:40 UTC (rev 88346)
@@ -19,6 +19,16 @@
<module>functional</module>
</modules>
+ <!-- Build -->
+ <build>
+ <testResources>
+ <testResource>
+ <directory>src/test/resources</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
+ </build>
+
<!-- Profiles -->
<profiles>
@@ -56,7 +66,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-felix-beans.xml</value>
+ <value>jboss-osgi-felix.properties</value>
</property>
</systemProperties>
</configuration>
@@ -100,7 +110,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-felix-beans.xml</value>
+ <value>jboss-osgi-felix.properties</value>
</property>
</systemProperties>
</configuration>
@@ -145,7 +155,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-equinox-beans.xml</value>
+ <value>jboss-osgi-equinox.properties</value>
</property>
</systemProperties>
</configuration>
@@ -190,7 +200,7 @@
</property>
<property>
<name>jboss.osgi.framework.config</name>
- <value>jboss-osgi-knopflerfish-beans.xml</value>
+ <value>jboss-osgi-knopflerfish.properties</value>
</property>
</systemProperties>
</configuration>
@@ -227,11 +237,11 @@
</profile>
<!--
- Name: remote-tesing
+ Name: remote-testing
Descr: Setup for remote integration testing
-->
<profile>
- <id>remote-tesing</id>
+ <id>remote-testing</id>
<activation>
<property>
<name>target.container</name>
More information about the jboss-cvs-commits
mailing list