[jboss-cvs] JBossAS SVN: r84745 - in projects/jboss-osgi/trunk: hudson/hudson-home/jobs/JBoss-OSGi-JDK1.6 and 18 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 25 11:11:41 EST 2009
Author: thomas.diesler at jboss.com
Date: 2009-02-25 11:11:41 -0500 (Wed, 25 Feb 2009)
New Revision: 84745
Added:
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeService.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeServiceActivator.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/JBOSGI36Test.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/Foo.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/FooMBean.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointService.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointServlet.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/Foo.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/FooMBean.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit/
Removed:
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointService.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointServlet.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/junit/
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/Foo.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/FooMBean.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/MBeanTestService.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/ServiceActivator.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/junit/
Modified:
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.5/config.xml
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.6/config.xml
projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-Matrix/config.xml
projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit/EndpointServiceTest.java
projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit/MicrocontainerServiceTest.java
projects/jboss-osgi/trunk/testsuite/src/test/resources/service/http/http-service.bnd
projects/jboss-osgi/trunk/testsuite/src/test/resources/service/microcontainer/microcontainer-service.bnd
Log:
[JBOSGI-36] Add test case
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.5/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.5/config.xml 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.5/config.xml 2009-02-25 16:11:41 UTC (rev 84745)
@@ -41,8 +41,6 @@
WORKSPACE=`pwd`
OSGIDIR=$WORKSPACE/jboss-osgi
-export CONTAINER=$container
-
export HUDSON_BASE=@hudson.base@
export OSGI_VERSION=@version.id@
export JBOSS_SERVER=@jboss.server.instance@
@@ -60,7 +58,7 @@
</builders>
<publishers class="vector">
<hudson.tasks.junit.JUnitResultArchiver>
- <testResults>jboss-osgi/modules/**/target/surefire-reports/TEST-*.xml</testResults>
+ <testResults>jboss-osgi/**/target/surefire-reports/TEST-*.xml</testResults>
</hudson.tasks.junit.JUnitResultArchiver>
<hudson.tasks.Mailer>
<recipients>@hudson.mail.recipients@</recipients>
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.6/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.6/config.xml 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-JDK1.6/config.xml 2009-02-25 16:11:41 UTC (rev 84745)
@@ -41,8 +41,6 @@
WORKSPACE=`pwd`
OSGIDIR=$WORKSPACE/jboss-osgi
-export CONTAINER=$container
-
export HUDSON_BASE=@hudson.base@
export OSGI_VERSION=@version.id@
export JBOSS_SERVER=@jboss.server.instance@
@@ -60,7 +58,7 @@
</builders>
<publishers class="vector">
<hudson.tasks.junit.JUnitResultArchiver>
- <testResults>jboss-osgi/modules/**/target/surefire-reports/TEST-*.xml</testResults>
+ <testResults>jboss-osgi/**/target/surefire-reports/TEST-*.xml</testResults>
</hudson.tasks.junit.JUnitResultArchiver>
<hudson.tasks.Mailer>
<recipients>@hudson.mail.recipients@</recipients>
Modified: projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-Matrix/config.xml
===================================================================
--- projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-Matrix/config.xml 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/hudson/hudson-home/jobs/JBoss-OSGi-Matrix/config.xml 2009-02-25 16:11:41 UTC (rev 84745)
@@ -70,7 +70,7 @@
</builders>
<publishers class="vector">
<hudson.tasks.junit.JUnitResultArchiver>
- <testResults>jboss-osgi/modules/**/target/surefire-reports/TEST-*.xml</testResults>
+ <testResults>jboss-osgi/**/target/surefire-reports/TEST-*.xml</testResults>
</hudson.tasks.junit.JUnitResultArchiver>
<hudson.tasks.Mailer>
<recipients>@hudson.mail.recipients@</recipients>
Modified: projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/scripts/antrun-test-jars.xml 2009-02-25 16:11:41 UTC (rev 84745)
@@ -40,11 +40,17 @@
<target name="build-test-jars" depends="init" description="Build the test deployments">
- <!-- http-service-test -->
+ <!-- Please add alphabetically -->
+
+ <!-- jbosgi36 -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi36-bundle.jar"
+ files="${tests.resources.dir}/jbosgi36/jbosgi36.bnd"/>
+
+ <!-- http-service -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/http-service.jar"
files="${tests.resources.dir}/service/http/http-service.bnd"/>
- <!-- microcontainer-service-test -->
+ <!-- microcontainer-service -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/microcontainer-service.jar"
files="${tests.resources.dir}/service/microcontainer/microcontainer-service.bnd"/>
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointService.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointService.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,99 +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.test.service.http;
-
-//$Id$
-
-import java.util.Properties;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-import org.osgi.service.http.HttpService;
-
-/**
- * A service that creates an Http context through the HttpService
- *
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public class EndpointService implements ServiceListener
-{
- private BundleContext context;
-
- public EndpointService(BundleContext context)
- {
- this.context = context;
- context.addServiceListener(this);
- }
-
- private void registerService()
- {
- try
- {
- HttpService httpService = getHttpService();
-
- Properties initParams = new Properties();
- initParams.setProperty("initProp", "SomeValue");
- httpService.registerServlet("/servlet", new EndpointServlet(context), initParams, null);
- httpService.registerResources("/file", "/res", null);
- }
- catch (Exception ex)
- {
- throw new RuntimeException("Cannot register context", ex);
- }
- }
-
- private void unregisterService()
- {
- HttpService httpService = getHttpService();
- httpService.unregister("/servlet");
- httpService.unregister("/file");
- context.removeServiceListener(this);
- }
-
- private HttpService getHttpService()
- {
- ServiceReference sref = context.getServiceReference(HttpService.class.getName());
- if (sref == null)
- throw new IllegalStateException("HttpService not registered");
-
- return (HttpService)context.getService(sref);
- }
-
- public void serviceChanged(ServiceEvent event)
- {
- Object service = context.getService(event.getServiceReference());
- if (service == this)
- {
- if (event.getType() == ServiceEvent.REGISTERED)
- {
- registerService();
- }
- else if (event.getType() == ServiceEvent.UNREGISTERING)
- {
- unregisterService();
- }
- }
- }
-}
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointServlet.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointServlet.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointServlet.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.test.service.http;
-
-//$Id$
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.service.startlevel.StartLevel;
-import org.osgi.util.tracker.ServiceTracker;
-
- at SuppressWarnings("serial")
-public class EndpointServlet extends HttpServlet
-{
- private BundleContext context;
-
- // This hides the default ctor and verifies that this instance is used
- public EndpointServlet(BundleContext context)
- {
- this.context = context;
- }
-
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
- {
- PrintWriter out = res.getWriter();
-
- String testParam = req.getParameter("test");
- if ("plain".equals(testParam))
- {
- out.println("Hello from Servlet");
- }
- else if ("initProp".equals(testParam))
- {
- String value = getInitParameter(testParam);
- out.println(testParam + "=" + value);
- }
- else if ("context".equals(testParam))
- {
- out.println(context.getBundle().getSymbolicName());
- }
- else if ("startLevel".equals(testParam))
- {
- ServiceTracker tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
- tracker.open();
-
- StartLevel service = (StartLevel)tracker.getService();
- out.println("startLevel=" + service.getStartLevel());
- }
- else
- {
- throw new IllegalArgumentException("Invalid 'test' parameter: " + testParam);
- }
-
- out.close();
- }
-}
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/ServiceActivator.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/ServiceActivator.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -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.test.service.http;
-
-//$Id$
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A Service Activator
- *
- * @author thomas.diesler at jboss.com
- * @since 04-Feb-2009
- */
-public class ServiceActivator implements BundleActivator
-{
- private ServiceRegistration registration;
-
- /*
- * Implements BundleActivator.start().
- * Registers an instance of a HttpEndpoint Service using the bundle context.
- */
- public void start(BundleContext context)
- {
- EndpointService service = new EndpointService(context);
- registration = context.registerService(EndpointService.class.getName(), service, null);
- }
-
- /*
- * Implements BundleActivator.stop().
- */
- public void stop(BundleContext context)
- {
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- }
- }
-}
\ No newline at end of file
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/Foo.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/Foo.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/Foo.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,32 +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.test.service.microcontainer;
-
-//$Id$
-
-public class Foo implements FooMBean
-{
- public String echo(String msg)
- {
- return msg;
- }
-}
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/FooMBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/FooMBean.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/FooMBean.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,29 +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.test.service.microcontainer;
-
-//$Id$
-
-public interface FooMBean
-{
- String echo(String msg);
-}
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/MBeanTestService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/MBeanTestService.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/MBeanTestService.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,106 +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.test.service.microcontainer;
-
-//$Id$
-
-import javax.management.MBeanServer;
-import javax.management.ObjectName;
-
-import org.jboss.osgi.service.MicrocontainerService;
-import org.jboss.osgi.spi.jmx.ObjectNameFactory;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceListener;
-import org.osgi.framework.ServiceReference;
-
-/**
- * A service that registers an MBean
- *
- * @author thomas.diesler at jboss.com
- * @since 23-Jan-2009
- */
-public class MBeanTestService implements ServiceListener
-{
- public static ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.osgi:service=mbean-test-service");
-
- private BundleContext context;
- private MBeanServer mbeanServer;
-
- public MBeanTestService(BundleContext context)
- {
- this.context = context;
- context.addServiceListener(this);
- }
-
- private void registerService()
- {
- try
- {
- MicrocontainerService mcService = getMicrocontainerService();
- mbeanServer = mcService.getMbeanServer();
- mbeanServer.registerMBean(new Foo(), OBJECT_NAME);
- }
- catch (Exception ex)
- {
- throw new RuntimeException("Cannot register mbean", ex);
- }
- }
-
- private void unregisterService()
- {
- try
- {
- if (mbeanServer != null && mbeanServer.isRegistered(OBJECT_NAME))
- mbeanServer.unregisterMBean(OBJECT_NAME);
- }
- catch (Exception ex)
- {
- throw new RuntimeException("Cannot unregister mbean", ex);
- }
- }
-
- private MicrocontainerService getMicrocontainerService()
- {
- ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
- if (sref == null)
- throw new IllegalStateException("HttpService not registered");
-
- return (MicrocontainerService)context.getService(sref);
- }
-
- public void serviceChanged(ServiceEvent event)
- {
- Object service = context.getService(event.getServiceReference());
- if (service == this)
- {
- if (event.getType() == ServiceEvent.REGISTERED)
- {
- registerService();
- }
- else if (event.getType() == ServiceEvent.UNREGISTERING)
- {
- unregisterService();
- }
- }
- }
-}
Deleted: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/ServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/ServiceActivator.java 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/ServiceActivator.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,54 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.osgi.test.service.microcontainer;
-
-//$Id$
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * A Service Activator
- *
- * @author thomas.diesler at jboss.com
- * @since 04-Feb-2009
- */
-public class ServiceActivator implements BundleActivator
-{
- private ServiceRegistration registration;
-
- public void start(BundleContext context)
- {
- MBeanTestService service = new MBeanTestService(context);
- registration = context.registerService(MBeanTestService.class.getName(), service, null);
- }
-
- public void stop(BundleContext context)
- {
- if (registration != null)
- {
- registration.unregister();
- registration = null;
- }
- }
-}
\ No newline at end of file
Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeService.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeService.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeService.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbosgi36.bundle;
+
+//$Id$
+
+public class SomeService
+{
+ public String serviceEcho(String msg)
+ {
+ return msg;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeServiceActivator.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeServiceActivator.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi36.bundle;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Feb-2009
+ */
+public class SomeServiceActivator implements BundleActivator
+{
+ private ServiceRegistration registration;
+
+ public void start(BundleContext context)
+ {
+ SomeService service = new SomeService();
+ registration = context.registerService(SomeService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/bundle/SomeServiceActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/JBOSGI36Test.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/JBOSGI36Test.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/JBOSGI36Test.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi36.junit;
+
+//$Id$
+
+import junit.framework.Test;
+
+import org.jboss.osgi.spi.jmx.MBeanProxy;
+import org.jboss.osgi.spi.junit.IntegrationTestCase;
+import org.jboss.osgi.spi.junit.IntegrationTestSetup;
+import org.jboss.test.osgi.service.microcontainer.FooMBean;
+import org.jboss.test.osgi.service.microcontainer.MBeanTestService;
+
+/**
+ * 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 JBOSGI36Test extends IntegrationTestCase
+{
+ public static Test suite()
+ {
+ return new IntegrationTestSetup(JBOSGI36Test.class, "jbosgi36-bundle.jar");
+ }
+
+ public void testAccess() throws Exception
+ {
+ //FooMBean foo = (FooMBean)MBeanProxy.get(FooMBean.class, MBeanTestService.OBJECT_NAME, getServer());
+ //assertEquals("hello", foo.echo("hello"));
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/junit/JBOSGI36Test.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/Foo.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/Foo.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/Foo.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,32 @@
+/*
+ * 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.jbosgi36.mbean;
+
+//$Id$
+
+public class Foo implements FooMBean
+{
+ public String echo(String msg)
+ {
+ return msg;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/Foo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/FooMBean.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/FooMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/FooMBean.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,29 @@
+/*
+ * 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.jbosgi36.mbean;
+
+//$Id$
+
+public interface FooMBean
+{
+ String echo(String msg);
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/jbosgi36/mbean/FooMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointService.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointService.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointService.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointService.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.http;
+
+//$Id$
+
+import java.util.Properties;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+
+/**
+ * A service that creates an Http context through the HttpService
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class EndpointService implements ServiceListener
+{
+ private BundleContext context;
+
+ public EndpointService(BundleContext context)
+ {
+ this.context = context;
+ context.addServiceListener(this);
+ }
+
+ private void registerService()
+ {
+ try
+ {
+ HttpService httpService = getHttpService();
+
+ Properties initParams = new Properties();
+ initParams.setProperty("initProp", "SomeValue");
+ httpService.registerServlet("/servlet", new EndpointServlet(context), initParams, null);
+ httpService.registerResources("/file", "/res", null);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Cannot register context", ex);
+ }
+ }
+
+ private void unregisterService()
+ {
+ HttpService httpService = getHttpService();
+ httpService.unregister("/servlet");
+ httpService.unregister("/file");
+ context.removeServiceListener(this);
+ }
+
+ private HttpService getHttpService()
+ {
+ ServiceReference sref = context.getServiceReference(HttpService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("HttpService not registered");
+
+ return (HttpService)context.getService(sref);
+ }
+
+ public void serviceChanged(ServiceEvent event)
+ {
+ Object service = context.getService(event.getServiceReference());
+ if (service == this)
+ {
+ if (event.getType() == ServiceEvent.REGISTERED)
+ {
+ registerService();
+ }
+ else if (event.getType() == ServiceEvent.UNREGISTERING)
+ {
+ unregisterService();
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointServlet.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/EndpointServlet.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointServlet.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointServlet.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.http;
+
+//$Id$
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.startlevel.StartLevel;
+import org.osgi.util.tracker.ServiceTracker;
+
+ at SuppressWarnings("serial")
+public class EndpointServlet extends HttpServlet
+{
+ private BundleContext context;
+
+ // This hides the default ctor and verifies that this instance is used
+ public EndpointServlet(BundleContext context)
+ {
+ this.context = context;
+ }
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+ {
+ PrintWriter out = res.getWriter();
+
+ String testParam = req.getParameter("test");
+ if ("plain".equals(testParam))
+ {
+ out.println("Hello from Servlet");
+ }
+ else if ("initProp".equals(testParam))
+ {
+ String value = getInitParameter(testParam);
+ out.println(testParam + "=" + value);
+ }
+ else if ("context".equals(testParam))
+ {
+ out.println(context.getBundle().getSymbolicName());
+ }
+ else if ("startLevel".equals(testParam))
+ {
+ ServiceTracker tracker = new ServiceTracker(context, StartLevel.class.getName(), null);
+ tracker.open();
+
+ StartLevel service = (StartLevel)tracker.getService();
+ out.println("startLevel=" + service.getStartLevel());
+ }
+ else
+ {
+ throw new IllegalArgumentException("Invalid 'test' parameter: " + testParam);
+ }
+
+ out.close();
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/EndpointServlet.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/ServiceActivator.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/ServiceActivator.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.http;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Feb-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private ServiceRegistration registration;
+
+ /*
+ * Implements BundleActivator.start().
+ * Registers an instance of a HttpEndpoint Service using the bundle context.
+ */
+ public void start(BundleContext context)
+ {
+ EndpointService service = new EndpointService(context);
+ registration = context.registerService(EndpointService.class.getName(), service, null);
+ }
+
+ /*
+ * Implements BundleActivator.stop().
+ */
+ public void stop(BundleContext context)
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/ServiceActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/junit)
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit/EndpointServiceTest.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/http/junit/EndpointServiceTest.java 2009-02-25 12:57:23 UTC (rev 84730)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/http/junit/EndpointServiceTest.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.test.service.http.junit;
+package org.jboss.test.osgi.service.http.junit;
//$Id$
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/Foo.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/Foo.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/Foo.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/Foo.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,32 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.microcontainer;
+
+//$Id$
+
+public class Foo implements FooMBean
+{
+ public String echo(String msg)
+ {
+ return msg;
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/Foo.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/FooMBean.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/FooMBean.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/FooMBean.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/FooMBean.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.microcontainer;
+
+//$Id$
+
+public interface FooMBean
+{
+ String echo(String msg);
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/FooMBean.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/MBeanTestService.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,106 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.microcontainer;
+
+//$Id$
+
+import javax.management.MBeanServer;
+import javax.management.ObjectName;
+
+import org.jboss.osgi.service.MicrocontainerService;
+import org.jboss.osgi.spi.jmx.ObjectNameFactory;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * A service that registers an MBean
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 23-Jan-2009
+ */
+public class MBeanTestService implements ServiceListener
+{
+ public static ObjectName OBJECT_NAME = ObjectNameFactory.create("jboss.osgi:service=mbean-test-service");
+
+ private BundleContext context;
+ private MBeanServer mbeanServer;
+
+ public MBeanTestService(BundleContext context)
+ {
+ this.context = context;
+ context.addServiceListener(this);
+ }
+
+ private void registerService()
+ {
+ try
+ {
+ MicrocontainerService mcService = getMicrocontainerService();
+ mbeanServer = mcService.getMbeanServer();
+ mbeanServer.registerMBean(new Foo(), OBJECT_NAME);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Cannot register mbean", ex);
+ }
+ }
+
+ private void unregisterService()
+ {
+ try
+ {
+ if (mbeanServer != null && mbeanServer.isRegistered(OBJECT_NAME))
+ mbeanServer.unregisterMBean(OBJECT_NAME);
+ }
+ catch (Exception ex)
+ {
+ throw new RuntimeException("Cannot unregister mbean", ex);
+ }
+ }
+
+ private MicrocontainerService getMicrocontainerService()
+ {
+ ServiceReference sref = context.getServiceReference(MicrocontainerService.class.getName());
+ if (sref == null)
+ throw new IllegalStateException("HttpService not registered");
+
+ return (MicrocontainerService)context.getService(sref);
+ }
+
+ public void serviceChanged(ServiceEvent event)
+ {
+ Object service = context.getService(event.getServiceReference());
+ if (service == this)
+ {
+ if (event.getType() == ServiceEvent.REGISTERED)
+ {
+ registerService();
+ }
+ else if (event.getType() == ServiceEvent.UNREGISTERING)
+ {
+ unregisterService();
+ }
+ }
+ }
+}
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/MBeanTestService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/ServiceActivator.java (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/ServiceActivator.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/ServiceActivator.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/ServiceActivator.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.service.microcontainer;
+
+//$Id$
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * A Service Activator
+ *
+ * @author thomas.diesler at jboss.com
+ * @since 04-Feb-2009
+ */
+public class ServiceActivator implements BundleActivator
+{
+ private ServiceRegistration registration;
+
+ public void start(BundleContext context)
+ {
+ MBeanTestService service = new MBeanTestService(context);
+ registration = context.registerService(MBeanTestService.class.getName(), service, null);
+ }
+
+ public void stop(BundleContext context)
+ {
+ if (registration != null)
+ {
+ registration.unregister();
+ registration = null;
+ }
+ }
+}
\ No newline at end of file
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/ServiceActivator.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:mergeinfo
+
Name: svn:eol-style
+ LF
Copied: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit (from rev 84730, projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/junit)
Property changes on: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit
___________________________________________________________________
Name: svn:mergeinfo
+
Modified: projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit/MicrocontainerServiceTest.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/osgi/test/service/microcontainer/junit/MicrocontainerServiceTest.java 2009-02-25 12:57:23 UTC (rev 84730)
+++ projects/jboss-osgi/trunk/testsuite/src/test/java/org/jboss/test/osgi/service/microcontainer/junit/MicrocontainerServiceTest.java 2009-02-25 16:11:41 UTC (rev 84745)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.osgi.test.service.microcontainer.junit;
+package org.jboss.test.osgi.service.microcontainer.junit;
//$Id$
@@ -28,8 +28,8 @@
import org.jboss.osgi.spi.jmx.MBeanProxy;
import org.jboss.osgi.spi.junit.IntegrationTestCase;
import org.jboss.osgi.spi.junit.IntegrationTestSetup;
-import org.jboss.osgi.test.service.microcontainer.FooMBean;
-import org.jboss.osgi.test.service.microcontainer.MBeanTestService;
+import org.jboss.test.osgi.service.microcontainer.FooMBean;
+import org.jboss.test.osgi.service.microcontainer.MBeanTestService;
/**
* A test that deployes a bundle that registeres an MBean
Modified: projects/jboss-osgi/trunk/testsuite/src/test/resources/service/http/http-service.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/resources/service/http/http-service.bnd 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/resources/service/http/http-service.bnd 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,8 +1,8 @@
# bnd build -classpath target/test-classes -output target/test-libs/http-service.jar src/test/resources/service/http/http-service.bnd
Bundle-SymbolicName: http-service-test
-Bundle-Activator: org.jboss.osgi.test.service.http.ServiceActivator
-Export-Package: org.jboss.osgi.test.service.http
+Bundle-Activator: org.jboss.test.osgi.service.http.ServiceActivator
+Export-Package: org.jboss.test.osgi.service.http
Include-Resource: res/message.txt=message.txt
# For some reason this does not work
Modified: projects/jboss-osgi/trunk/testsuite/src/test/resources/service/microcontainer/microcontainer-service.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/src/test/resources/service/microcontainer/microcontainer-service.bnd 2009-02-25 16:08:19 UTC (rev 84744)
+++ projects/jboss-osgi/trunk/testsuite/src/test/resources/service/microcontainer/microcontainer-service.bnd 2009-02-25 16:11:41 UTC (rev 84745)
@@ -1,5 +1,5 @@
# bnd build -classpath target/test-classes -output target/test-libs/microcontainer-service.jar src/test/resources/service/microcontainer/microcontainer-service.bnd
Bundle-SymbolicName: microcontainer-service-test
-Bundle-Activator: org.jboss.osgi.test.service.microcontainer.ServiceActivator
-Export-Package: org.jboss.osgi.test.service.microcontainer
+Bundle-Activator: org.jboss.test.osgi.service.microcontainer.ServiceActivator
+Export-Package: org.jboss.test.osgi.service.microcontainer
More information about the jboss-cvs-commits
mailing list