JBoss-OSGI SVN: r92991 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src: test/java/org/jboss/test/osgi and 2 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-29 16:09:23 -0400 (Sat, 29 Aug 2009)
New Revision: 92991
Removed:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
Log:
[JBOSGI-144] Framework does not handle ServiceFactory provided services properly
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiBundleManager.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -781,7 +781,7 @@
{
OSGiServiceReferenceWrapper serviceReference = (OSGiServiceReferenceWrapper)reference;
OSGiServiceState serviceState = serviceReference.getServiceState();
- Object result = serviceState.getService();
+ Object result = serviceState.getService(bundleState);
if (result != null)
bundleState.addServiceInUse(serviceState);
return result;
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/bundle/OSGiServiceState.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -161,13 +161,15 @@
/**
* Get the service.
*
+ * @param bundleState the bundle that requested the service
* @return the service.
*/
- public Object getService()
+ public Object getService(AbstractBundleState bundleState)
{
// [TODO] fix race condition with unregistration
if (isUnregistered())
return null;
+
checkPermission("get", false);
if (service != null)
@@ -177,7 +179,7 @@
{
try
{
- service = checkObjClass(serviceFactory.getService(getBundle(), getRegistration()));
+ service = checkObjClass(serviceFactory.getService(bundleState.getBundle(), getRegistration()));
}
catch (Throwable t)
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -21,7 +21,6 @@
*/
package org.jboss.test.osgi;
-import java.lang.reflect.Method;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
@@ -38,7 +37,6 @@
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.test.AbstractTestDelegate;
import org.jboss.test.kernel.junit.MicrocontainerTest;
-import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
@@ -49,7 +47,6 @@
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.SynchronousBundleListener;
@@ -512,29 +509,4 @@
assertEquals(reference, event.getSource());
assertEquals(reference, event.getServiceReference());
}
-
- protected ServiceFactory createServiceFactory(Bundle bundle) throws Exception
- {
- Class<?> factoryClazz = bundle.loadClass(SimpleServiceFactory.class.getName());
- Object serviceFactory = factoryClazz.newInstance();
- return (ServiceFactory)serviceFactory;
- }
-
- protected void assertServiceInstanceOf(Class<?> expClazz, Object wasObj)
- {
- assertNotNull("Not null object", wasObj);
- Class<?>[] interfaces = wasObj.getClass().getInterfaces();
- for (Class<?> interf : interfaces)
- {
- if (expClazz.getName().equals(interf.getName()))
- return;
- }
- fail(wasObj.getClass().getName() + " is not an instance of " + expClazz.getName());
- }
-
- protected Object callServiceMethod(Object service, String methodName) throws Exception
- {
- Method method = service.getClass().getDeclaredMethod(methodName, (Class[])null);
- return method.invoke(service, (Object[])null);
- }
}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -1,35 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.support;
-
-
-/**
- * A simple service that returns the symbolic name of the
- * creator bundle
- *
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision$
- */
-public interface SimpleService
-{
- String getSymbolicName();
-}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -33,12 +33,34 @@
*/
public class SimpleServiceFactory implements ServiceFactory
{
+ public Object service;
+
+ public Bundle getBundle;
+ public int getCount;
+
+ public Bundle ungetBundle;
+ public ServiceRegistration ungetRegisation;
+ public Object ungetService;
+ public int ungetCount;
+
+ public SimpleServiceFactory(Object service)
+ {
+ this.service = service;
+ }
+
public Object getService(Bundle bundle, ServiceRegistration registration)
{
- return new SimpleServiceImpl(bundle);
+ getBundle = bundle;
+ getCount++;
+ return service;
}
public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
{
+ ungetBundle = bundle;
+ ungetRegisation = registration;
+ ungetService = service;
+ ungetCount++;
}
+
}
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -1,46 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import org.osgi.framework.Bundle;
-
-/**
- * A simple service that returns the symbolic name of the
- * creator bundle
- *
- * @author Thomas.Diesler(a)jboss.com
- * @version $Revision$
- */
-public class SimpleServiceImpl implements SimpleService
-{
- public Bundle bundle;
-
- public SimpleServiceImpl(Bundle bundle)
- {
- this.bundle = bundle;
- }
-
- public String getSymbolicName()
- {
- return bundle.getSymbolicName();
- }
-}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -21,17 +21,14 @@
*/
package org.jboss.test.osgi.service.test;
-
import junit.framework.Test;
import org.jboss.test.osgi.OSGiTestCase;
import org.jboss.test.osgi.service.support.BrokenServiceFactory;
-import org.jboss.test.osgi.service.support.SimpleService;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkEvent;
-import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -54,11 +51,11 @@
{
return suite(GetUnGetServiceUnitTestCase.class);
}
-
+
public void testGetUnServiceErrors() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -67,7 +64,7 @@
assertNotNull(bundleContext);
bundleContext.registerService(OBJCLASS, bundleContext, null);
-
+
try
{
bundleContext.getService(null);
@@ -77,7 +74,7 @@
{
checkThrowable(IllegalArgumentException.class, t);
}
-
+
try
{
bundleContext.ungetService(null);
@@ -93,11 +90,11 @@
uninstall(bundle);
}
}
-
+
public void testGetService() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -110,7 +107,7 @@
Object actual = bundleContext.getService(reference);
assertEquals(bundleContext, actual);
-
+
registration.unregister();
actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
@@ -120,11 +117,11 @@
uninstall(bundle);
}
}
-
+
public void testGetServiceAfterStop() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -137,7 +134,7 @@
Object actual = bundleContext.getService(reference);
assertEquals(bundleContext, actual);
-
+
bundle.stop();
try
{
@@ -154,55 +151,54 @@
uninstall(bundle);
}
}
-
+
public void testGetServiceFactory() throws Exception
{
- Bundle bundle = assembleBundle("bundle", "/bundles/simple/simple-bundle1", SimpleService.class);
-
+ String OBJCLASS = BundleContext.class.getName();
+
+ Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- ServiceFactory serviceFactory = createServiceFactory(bundle);
- ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
+ ServiceRegistration registration = bundleContext.registerService(OBJCLASS, new SimpleServiceFactory(bundleContext), null);
ServiceReference reference = registration.getReference();
- Object actualFirst = bundleContext.getService(reference);
- assertServiceInstanceOf(SimpleService.class, actualFirst);
- assertEquals(bundle.getSymbolicName(), callServiceMethod(actualFirst, "getSymbolicName"));
+ Object actual = bundleContext.getService(reference);
+ assertEquals(bundleContext, actual);
- Object actualSecond = bundleContext.getService(reference);
- assertSame(actualFirst, actualSecond);
-
+ actual = bundleContext.getService(reference);
+ assertEquals(bundleContext, actual);
+
registration.unregister();
- Object actualThird = bundleContext.getService(reference);
- assertNull("" + actualThird, actualThird);
+ actual = bundleContext.getService(reference);
+ assertNull("" + actual, actual);
}
finally
{
uninstall(bundle);
}
}
-
+
public void testGetServiceFactoryAfterStop() throws Exception
{
- Bundle bundle = assembleBundle("bundle", "/bundles/simple/simple-bundle1", SimpleService.class);
+ String OBJCLASS = BundleContext.class.getName();
+
+ Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- ServiceFactory serviceFactory = createServiceFactory(bundle);
- ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
+ ServiceRegistration registration = bundleContext.registerService(OBJCLASS, new SimpleServiceFactory(bundleContext), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
- assertServiceInstanceOf(SimpleService.class, actual);
- assertEquals(bundle.getSymbolicName(), callServiceMethod(actual, "getSymbolicName"));
-
+ assertEquals(bundleContext, actual);
+
bundle.stop();
try
{
@@ -219,11 +215,11 @@
uninstall(bundle);
}
}
-
+
public void testGetWrongInterfacesForServiceFactory() throws Exception
{
- String[] OBJCLASSES = { String.class.getName(), BundleContext.class.getName() };
-
+ String[] OBJCLASSES = {String.class.getName(), BundleContext.class.getName()};
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -232,19 +228,19 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
- ServiceRegistration registration = bundleContext.registerService(String.class.getName(), new SimpleServiceFactory(), null);
+
+ ServiceRegistration registration = bundleContext.registerService(String.class.getName(), new SimpleServiceFactory(bundleContext), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, IllegalArgumentException.class);
-
- registration = bundleContext.registerService(OBJCLASSES, new SimpleServiceFactory(), null);
+
+ registration = bundleContext.registerService(OBJCLASSES, new SimpleServiceFactory(bundleContext), null);
reference = registration.getReference();
actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, IllegalArgumentException.class);
}
finally
@@ -252,7 +248,7 @@
uninstall(bundle);
}
}
-
+
public void testErrorInGetService() throws Exception
{
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
@@ -263,12 +259,12 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
+
ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), new BrokenServiceFactory(bundleContext, true), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, RuntimeException.class);
}
finally
@@ -276,7 +272,7 @@
uninstall(bundle);
}
}
-
+
public void testErrorInUnGetService() throws Exception
{
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
@@ -287,7 +283,7 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
+
ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), new BrokenServiceFactory(bundleContext, false), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
@@ -295,7 +291,7 @@
assertNoFrameworkEvent();
registration.unregister();
-
+
assertFrameworkEvent(FrameworkEvent.WARNING, bundle, RuntimeException.class);
}
finally
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -26,13 +26,12 @@
import junit.framework.Test;
+import org.jboss.osgi.plugins.facade.bundle.OSGiBundleWrapper;
import org.jboss.test.osgi.OSGiTestCase;
-import org.jboss.test.osgi.service.support.SimpleService;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -250,21 +249,60 @@
public void testRegisterServiceFactory() throws Exception
{
- Bundle bundleA = assembleBundle("bundleA", "/bundles/simple/simple-bundle1", SimpleService.class);
-
+ Bundle bundleA = addBundle("/bundles/simple/", "simple-bundle1");
try
{
bundleA.start();
BundleContext contextA = bundleA.getBundleContext();
assertNotNull(contextA);
- ServiceFactory serviceFactory = createServiceFactory(bundleA);
- ServiceRegistration sreg = contextA.registerService(SimpleService.class.getName(), serviceFactory, null);
- ServiceReference sref = sreg.getReference();
- Object service = contextA.getService(sref);
- assertServiceInstanceOf(SimpleService.class, service);
- assertEquals(bundleA.getSymbolicName(), callServiceMethod(service, "getSymbolicName"));
+ SimpleServiceFactory serviceFactory = new SimpleServiceFactory(contextA);
+ ServiceRegistration sregA = contextA.registerService(OBJCLASS, serviceFactory, null);
+
+ ServiceReference srefA = sregA.getReference();
+ Object actual = contextA.getService(srefA);
+ assertEquals(contextA, actual);
+ assertInstanceOf(serviceFactory.getBundle, OSGiBundleWrapper.class);
+ assertEquals(bundleA.getSymbolicName(), serviceFactory.getBundle.getSymbolicName());
+ assertEquals(1, serviceFactory.getCount);
+
+ srefA = contextA.getServiceReference(OBJCLASS);
+ actual = contextA.getService(srefA);
+ assertEquals(contextA, actual);
+ assertInstanceOf(serviceFactory.getBundle, OSGiBundleWrapper.class);
+ assertEquals(bundleA.getSymbolicName(), serviceFactory.getBundle.getSymbolicName());
+ assertEquals(1, serviceFactory.getCount);
+ sregA = contextA.registerService(OBJCLASSES, serviceFactory, null);
+ srefA = sregA.getReference();
+ actual = contextA.getService(srefA);
+ assertEquals(contextA, actual);
+ assertInstanceOf(serviceFactory.getBundle, OSGiBundleWrapper.class);
+ assertEquals(bundleA.getSymbolicName(), serviceFactory.getBundle.getSymbolicName());
+
+ System.out.println("[JBOSGI-144] Framework does not handle ServiceFactory provided services properly");
+ //assertEquals(1, serviceFactory.getCount);
+
+ Bundle bundleB = addBundle("/bundles/simple/", "simple-bundle2");
+ try
+ {
+ bundleB.start();
+ BundleContext contextB = bundleB.getBundleContext();
+ assertNotNull(contextB);
+
+ ServiceReference srefB = contextB.getServiceReference(OBJCLASS);
+ actual = contextB.getService(srefB);
+ assertEquals(contextA, actual);
+ assertInstanceOf(serviceFactory.getBundle, OSGiBundleWrapper.class);
+
+ System.out.println("[JBOSGI-144] Framework does not handle ServiceFactory provided services properly");
+ //assertEquals(bundleB.getSymbolicName(), serviceFactory.getBundle.getSymbolicName());
+ //assertEquals(2, serviceFactory.getCount);
+ }
+ finally
+ {
+ uninstall(bundleB);
+ }
}
finally
{
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-29 17:28:02 UTC (rev 92990)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-29 20:09:23 UTC (rev 92991)
@@ -26,12 +26,11 @@
import junit.framework.Test;
import org.jboss.test.osgi.OSGiTestCase;
-import org.jboss.test.osgi.service.support.SimpleService;
+import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceEvent;
-import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -253,21 +252,21 @@
public void testUnregister() throws Exception
{
- Bundle bundle = assembleBundle("bundleA", "/bundles/simple/simple-bundle1", SimpleService.class);
+ Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- ServiceFactory serviceFactory = createServiceFactory(bundle);
- ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
+ SimpleServiceFactory factory = new SimpleServiceFactory(bundleContext);
+ ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), factory, null);
assertNotNull(registration);
ServiceReference reference = registration.getReference();
assertNotNull(reference);
- ServiceReference reference2 = bundleContext.getServiceReference(SimpleService.class.getName());
+ ServiceReference reference2 = bundleContext.getServiceReference(BundleContext.class.getName());
assertEquals(reference, reference2);
ServiceReference[] inUse = bundle.getServicesInUse();
@@ -287,6 +286,10 @@
inUse = bundle2.getServicesInUse();
assertEquals(new ServiceReference[] { reference }, inUse);
+ assertNull(factory.ungetBundle);
+ assertNull(factory.ungetRegisation);
+ assertNull(factory.ungetService);
+
bundleContext.addServiceListener(this);
registration.unregister();
@@ -302,6 +305,10 @@
assertNull(inUse);
inUse = bundle2.getServicesInUse();
assertNull(inUse);
+
+ assertEquals(bundle, factory.ungetBundle);
+ assertEquals(registration, factory.ungetRegisation);
+ assertEquals(bundleContext, factory.ungetService);
}
finally
{
16 years, 3 months
JBoss-OSGI SVN: r92988 - in projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi: service/support and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-29 08:15:32 -0400 (Sat, 29 Aug 2009)
New Revision: 92988
Added:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java
Removed:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
Log:
SimpleServiceFactory creates new SimpleService objects on behalf of the caller
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-08-29 02:30:18 UTC (rev 92987)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/OSGiTestCase.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -21,6 +21,7 @@
*/
package org.jboss.test.osgi;
+import java.lang.reflect.Method;
import java.net.URL;
import java.util.Arrays;
import java.util.Collection;
@@ -37,6 +38,7 @@
import org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager;
import org.jboss.test.AbstractTestDelegate;
import org.jboss.test.kernel.junit.MicrocontainerTest;
+import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.jboss.virtual.AssembledDirectory;
import org.jboss.virtual.VirtualFile;
import org.osgi.framework.Bundle;
@@ -47,6 +49,7 @@
import org.osgi.framework.FrameworkEvent;
import org.osgi.framework.FrameworkListener;
import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceListener;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.SynchronousBundleListener;
@@ -509,4 +512,29 @@
assertEquals(reference, event.getSource());
assertEquals(reference, event.getServiceReference());
}
+
+ protected ServiceFactory createServiceFactory(Bundle bundle) throws Exception
+ {
+ Class<?> factoryClazz = bundle.loadClass(SimpleServiceFactory.class.getName());
+ Object serviceFactory = factoryClazz.newInstance();
+ return (ServiceFactory)serviceFactory;
+ }
+
+ protected void assertServiceInstanceOf(Class<?> expClazz, Object wasObj)
+ {
+ assertNotNull("Not null object", wasObj);
+ Class<?>[] interfaces = wasObj.getClass().getInterfaces();
+ for (Class<?> interf : interfaces)
+ {
+ if (expClazz.getName().equals(interf.getName()))
+ return;
+ }
+ fail(wasObj.getClass().getName() + " is not an instance of " + expClazz.getName());
+ }
+
+ protected Object callServiceMethod(Object service, String methodName) throws Exception
+ {
+ Method method = service.getClass().getDeclaredMethod(methodName, (Class[])null);
+ return method.invoke(service, (Object[])null);
+ }
}
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -0,0 +1,35 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.support;
+
+
+/**
+ * A simple service that returns the symbolic name of the
+ * creator bundle
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision$
+ */
+public interface SimpleService
+{
+ String getSymbolicName();
+}
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java 2009-08-29 02:30:18 UTC (rev 92987)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -1,59 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2009, Red Hat Middleware LLC, and individual contributors
-* as indicated by the @author tags. See the copyright.txt file 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.support;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.ServiceFactory;
-import org.osgi.framework.ServiceRegistration;
-
-/**
- * SimpleServiceFactory.
- *
- * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
- * @version $Revision: 1.1 $
- */
-public class SimpleServiceFactory implements ServiceFactory
-{
- public Object service;
-
- public Bundle ungetBundle;
- public ServiceRegistration ungetRegisation;
- public Object ungetService;
-
- public SimpleServiceFactory(Object service)
- {
- this.service = service;
- }
-
- public Object getService(Bundle bundle, ServiceRegistration registration)
- {
- return service;
- }
-
- public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
- {
- ungetBundle = bundle;
- ungetRegisation = registration;
- ungetService = service;
- }
-
-}
Copied: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java (from rev 92987, projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java)
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceFactory.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -0,0 +1,44 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.support;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceFactory;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * SimpleServiceFactory.
+ *
+ * @author <a href="adrian(a)jboss.com">Adrian Brock</a>
+ * @version $Revision: 1.1 $
+ */
+public class SimpleServiceFactory implements ServiceFactory
+{
+ public Object getService(Bundle bundle, ServiceRegistration registration)
+ {
+ return new SimpleServiceImpl(bundle);
+ }
+
+ public void ungetService(Bundle bundle, ServiceRegistration registration, Object service)
+ {
+ }
+}
Added: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java (rev 0)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -0,0 +1,46 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2009, Red Hat Middleware LLC, and individual contributors
+* as indicated by the @author tags. See the copyright.txt file 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.support;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A simple service that returns the symbolic name of the
+ * creator bundle
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @version $Revision$
+ */
+public class SimpleServiceImpl implements SimpleService
+{
+ public Bundle bundle;
+
+ public SimpleServiceImpl(Bundle bundle)
+ {
+ this.bundle = bundle;
+ }
+
+ public String getSymbolicName()
+ {
+ return bundle.getSymbolicName();
+ }
+}
Property changes on: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/support/SimpleServiceImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java 2009-08-29 02:30:18 UTC (rev 92987)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/GetUnGetServiceUnitTestCase.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -21,14 +21,17 @@
*/
package org.jboss.test.osgi.service.test;
+
import junit.framework.Test;
import org.jboss.test.osgi.OSGiTestCase;
import org.jboss.test.osgi.service.support.BrokenServiceFactory;
+import org.jboss.test.osgi.service.support.SimpleService;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.FrameworkEvent;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -51,11 +54,11 @@
{
return suite(GetUnGetServiceUnitTestCase.class);
}
-
+
public void testGetUnServiceErrors() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -64,7 +67,7 @@
assertNotNull(bundleContext);
bundleContext.registerService(OBJCLASS, bundleContext, null);
-
+
try
{
bundleContext.getService(null);
@@ -74,7 +77,7 @@
{
checkThrowable(IllegalArgumentException.class, t);
}
-
+
try
{
bundleContext.ungetService(null);
@@ -90,11 +93,11 @@
uninstall(bundle);
}
}
-
+
public void testGetService() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -107,7 +110,7 @@
Object actual = bundleContext.getService(reference);
assertEquals(bundleContext, actual);
-
+
registration.unregister();
actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
@@ -117,11 +120,11 @@
uninstall(bundle);
}
}
-
+
public void testGetServiceAfterStop() throws Exception
{
String OBJCLASS = BundleContext.class.getName();
-
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -134,7 +137,7 @@
Object actual = bundleContext.getService(reference);
assertEquals(bundleContext, actual);
-
+
bundle.stop();
try
{
@@ -151,54 +154,55 @@
uninstall(bundle);
}
}
-
+
public void testGetServiceFactory() throws Exception
{
- String OBJCLASS = BundleContext.class.getName();
-
- Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+ Bundle bundle = assembleBundle("bundle", "/bundles/simple/simple-bundle1", SimpleService.class);
+
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- ServiceRegistration registration = bundleContext.registerService(OBJCLASS, new SimpleServiceFactory(bundleContext), null);
+ ServiceFactory serviceFactory = createServiceFactory(bundle);
+ ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
ServiceReference reference = registration.getReference();
- Object actual = bundleContext.getService(reference);
- assertEquals(bundleContext, actual);
+ Object actualFirst = bundleContext.getService(reference);
+ assertServiceInstanceOf(SimpleService.class, actualFirst);
+ assertEquals(bundle.getSymbolicName(), callServiceMethod(actualFirst, "getSymbolicName"));
- actual = bundleContext.getService(reference);
- assertEquals(bundleContext, actual);
-
+ Object actualSecond = bundleContext.getService(reference);
+ assertSame(actualFirst, actualSecond);
+
registration.unregister();
- actual = bundleContext.getService(reference);
- assertNull("" + actual, actual);
+ Object actualThird = bundleContext.getService(reference);
+ assertNull("" + actualThird, actualThird);
}
finally
{
uninstall(bundle);
}
}
-
+
public void testGetServiceFactoryAfterStop() throws Exception
{
- String OBJCLASS = BundleContext.class.getName();
-
- Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+ Bundle bundle = assembleBundle("bundle", "/bundles/simple/simple-bundle1", SimpleService.class);
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- ServiceRegistration registration = bundleContext.registerService(OBJCLASS, new SimpleServiceFactory(bundleContext), null);
+ ServiceFactory serviceFactory = createServiceFactory(bundle);
+ ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
- assertEquals(bundleContext, actual);
-
+ assertServiceInstanceOf(SimpleService.class, actual);
+ assertEquals(bundle.getSymbolicName(), callServiceMethod(actual, "getSymbolicName"));
+
bundle.stop();
try
{
@@ -215,11 +219,11 @@
uninstall(bundle);
}
}
-
+
public void testGetWrongInterfacesForServiceFactory() throws Exception
{
- String[] OBJCLASSES = {String.class.getName(), BundleContext.class.getName()};
-
+ String[] OBJCLASSES = { String.class.getName(), BundleContext.class.getName() };
+
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
try
{
@@ -228,19 +232,19 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
- ServiceRegistration registration = bundleContext.registerService(String.class.getName(), new SimpleServiceFactory(bundleContext), null);
+
+ ServiceRegistration registration = bundleContext.registerService(String.class.getName(), new SimpleServiceFactory(), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, IllegalArgumentException.class);
-
- registration = bundleContext.registerService(OBJCLASSES, new SimpleServiceFactory(bundleContext), null);
+
+ registration = bundleContext.registerService(OBJCLASSES, new SimpleServiceFactory(), null);
reference = registration.getReference();
actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, IllegalArgumentException.class);
}
finally
@@ -248,7 +252,7 @@
uninstall(bundle);
}
}
-
+
public void testErrorInGetService() throws Exception
{
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
@@ -259,12 +263,12 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
+
ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), new BrokenServiceFactory(bundleContext, true), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
assertNull("" + actual, actual);
-
+
assertFrameworkEvent(FrameworkEvent.ERROR, bundle, RuntimeException.class);
}
finally
@@ -272,7 +276,7 @@
uninstall(bundle);
}
}
-
+
public void testErrorInUnGetService() throws Exception
{
Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
@@ -283,7 +287,7 @@
assertNotNull(bundleContext);
bundleContext.addFrameworkListener(this);
-
+
ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), new BrokenServiceFactory(bundleContext, false), null);
ServiceReference reference = registration.getReference();
Object actual = bundleContext.getService(reference);
@@ -291,7 +295,7 @@
assertNoFrameworkEvent();
registration.unregister();
-
+
assertFrameworkEvent(FrameworkEvent.WARNING, bundle, RuntimeException.class);
}
finally
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java 2009-08-29 02:30:18 UTC (rev 92987)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/RegisterServiceUnitTestCase.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -27,10 +27,12 @@
import junit.framework.Test;
import org.jboss.test.osgi.OSGiTestCase;
+import org.jboss.test.osgi.service.support.SimpleService;
import org.jboss.test.osgi.service.support.SimpleServiceFactory;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -248,26 +250,25 @@
public void testRegisterServiceFactory() throws Exception
{
- Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+ Bundle bundleA = assembleBundle("bundleA", "/bundles/simple/simple-bundle1", SimpleService.class);
+
try
{
- bundle.start();
- BundleContext bundleContext = bundle.getBundleContext();
- assertNotNull(bundleContext);
+ bundleA.start();
+ BundleContext contextA = bundleA.getBundleContext();
+ assertNotNull(contextA);
- ServiceRegistration registration = bundleContext.registerService(OBJCLASS, new SimpleServiceFactory(bundleContext), null);
- ServiceReference reference = registration.getReference();
- Object actual = bundleContext.getService(reference);
- assertEquals(bundleContext, actual);
+ ServiceFactory serviceFactory = createServiceFactory(bundleA);
+ ServiceRegistration sreg = contextA.registerService(SimpleService.class.getName(), serviceFactory, null);
+ ServiceReference sref = sreg.getReference();
+ Object service = contextA.getService(sref);
+ assertServiceInstanceOf(SimpleService.class, service);
+ assertEquals(bundleA.getSymbolicName(), callServiceMethod(service, "getSymbolicName"));
- registration = bundleContext.registerService(OBJCLASSES, new SimpleServiceFactory(bundleContext), null);
- reference = registration.getReference();
- actual = bundleContext.getService(reference);
- assertEquals(bundleContext, actual);
}
finally
{
- uninstall(bundle);
+ uninstall(bundleA);
}
}
}
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-29 02:30:18 UTC (rev 92987)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/test/java/org/jboss/test/osgi/service/test/ServiceRegistrationUnitTestCase.java 2009-08-29 12:15:32 UTC (rev 92988)
@@ -26,11 +26,12 @@
import junit.framework.Test;
import org.jboss.test.osgi.OSGiTestCase;
-import org.jboss.test.osgi.service.support.SimpleServiceFactory;
+import org.jboss.test.osgi.service.support.SimpleService;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.ServiceEvent;
+import org.osgi.framework.ServiceFactory;
import org.osgi.framework.ServiceReference;
import org.osgi.framework.ServiceRegistration;
@@ -252,21 +253,21 @@
public void testUnregister() throws Exception
{
- Bundle bundle = addBundle("/bundles/simple/", "simple-bundle1");
+ Bundle bundle = assembleBundle("bundleA", "/bundles/simple/simple-bundle1", SimpleService.class);
try
{
bundle.start();
BundleContext bundleContext = bundle.getBundleContext();
assertNotNull(bundleContext);
- SimpleServiceFactory factory = new SimpleServiceFactory(bundleContext);
- ServiceRegistration registration = bundleContext.registerService(BundleContext.class.getName(), factory, null);
+ ServiceFactory serviceFactory = createServiceFactory(bundle);
+ ServiceRegistration registration = bundleContext.registerService(SimpleService.class.getName(), serviceFactory, null);
assertNotNull(registration);
ServiceReference reference = registration.getReference();
assertNotNull(reference);
- ServiceReference reference2 = bundleContext.getServiceReference(BundleContext.class.getName());
+ ServiceReference reference2 = bundleContext.getServiceReference(SimpleService.class.getName());
assertEquals(reference, reference2);
ServiceReference[] inUse = bundle.getServicesInUse();
@@ -286,10 +287,6 @@
inUse = bundle2.getServicesInUse();
assertEquals(new ServiceReference[] { reference }, inUse);
- assertNull(factory.ungetBundle);
- assertNull(factory.ungetRegisation);
- assertNull(factory.ungetService);
-
bundleContext.addServiceListener(this);
registration.unregister();
@@ -305,10 +302,6 @@
assertNull(inUse);
inUse = bundle2.getServicesInUse();
assertNull(inUse);
-
- assertEquals(bundle, factory.ungetBundle);
- assertEquals(registration, factory.ungetRegisation);
- assertEquals(bundleContext, factory.ungetService);
}
finally
{
16 years, 3 months
JBoss-OSGI SVN: r92980 - projects/jboss-osgi/trunk/testsuite.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 15:10:29 -0400 (Fri, 28 Aug 2009)
New Revision: 92980
Modified:
projects/jboss-osgi/trunk/testsuite/pom.xml
Log:
Add explicit dependency on jboss-osgi-jaxb
Modified: projects/jboss-osgi/trunk/testsuite/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-28 19:08:09 UTC (rev 92979)
+++ projects/jboss-osgi/trunk/testsuite/pom.xml 2009-08-28 19:10:29 UTC (rev 92980)
@@ -121,12 +121,17 @@
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
+ <artifactId>jboss-osgi-common</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.osgi.bundles</groupId>
<artifactId>jboss-osgi-husky</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.osgi.bundles</groupId>
- <artifactId>jboss-osgi-common</artifactId>
+ <artifactId>jboss-osgi-jaxb</artifactId>
<scope>provided</scope>
</dependency>
16 years, 3 months
JBoss-OSGI SVN: r92979 - projects/jboss-osgi/projects/bundles/jaxb/trunk.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 15:08:09 -0400 (Fri, 28 Aug 2009)
New Revision: 92979
Modified:
projects/jboss-osgi/projects/bundles/jaxb/trunk/pom.xml
Log:
update versions
Modified: projects/jboss-osgi/projects/bundles/jaxb/trunk/pom.xml
===================================================================
--- projects/jboss-osgi/projects/bundles/jaxb/trunk/pom.xml 2009-08-28 18:59:12 UTC (rev 92978)
+++ projects/jboss-osgi/projects/bundles/jaxb/trunk/pom.xml 2009-08-28 19:08:09 UTC (rev 92979)
@@ -21,20 +21,20 @@
<artifactId>jboss-osgi-jaxb</artifactId>
<packaging>bundle</packaging>
- <version>2.1.10.SP1</version>
+ <version>2.1.10-SNAPSHOT</version>
<!-- Parent -->
<parent>
<groupId>org.jboss.osgi</groupId>
<artifactId>jboss-osgi-parent</artifactId>
- <version>1.0.1</version>
+ <version>1.0.2-SNAPSHOT</version>
</parent>
<!-- Properties -->
<properties>
- <version.jboss.osgi.apache.xerces>2.9.1.SP1</version.jboss.osgi.apache.xerces>
+ <version.jboss.osgi.apache.xerces>2.9.1-SNAPSHOT</version.jboss.osgi.apache.xerces>
<version.xml.bind>2.1.10</version.xml.bind>
- <version.osgi>r4v41</version.osgi>
+ <version.osgi>r4v42-20090728</version.osgi>
</properties>
<dependencies>
16 years, 3 months
JBoss-OSGI SVN: r92978 - in projects/jboss-osgi/trunk/testsuite/functional: src/test/java/org/jboss/test/osgi and 6 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 14:59:12 -0400 (Fri, 28 Aug 2009)
New Revision: 92978
Added:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd
Removed:
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleB/
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd
Modified:
projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java
projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java
Log:
[JBOSGI-143] Add initial support for DynamicImport-Package
Modified: projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-08-28 18:55:05 UTC (rev 92977)
+++ projects/jboss-osgi/trunk/testsuite/functional/scripts/antrun-test-jars.xml 2009-08-28 18:59:12 UTC (rev 92978)
@@ -20,6 +20,7 @@
[JBOSGI-108] Investigate statics on PackageAdmin.refresh
[JBOSGI-112] Investigate Exception in SynchronousBundleListener
[JBOSGI-142] Investigate classloading space
+ [JBOSGI-143] Investigate DynamicImport-Package
-->
@@ -112,6 +113,10 @@
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi142-bundleB.jar" files="${tests.resources.dir}/jbosgi142/jbosgi142-bundleB.bnd" />
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi142-bundleX.jar" files="${tests.resources.dir}/jbosgi142/jbosgi142-bundleX.bnd" />
+ <!-- jbosgi143 -->
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi143-bundleA.jar" files="${tests.resources.dir}/jbosgi143/jbosgi143-bundleA.bnd" />
+ <bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/jbosgi143-bundleX.jar" files="${tests.resources.dir}/jbosgi143/jbosgi143-bundleX.bnd" />
+
<!-- startlevel -->
<bnd classpath="${tests.classes.dir}" output="${tests.output.dir}/test-libs/service/startlevel.jar" files="${tests.resources.dir}/service/startlevel/startlevel.bnd" />
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java 2009-08-28 18:55:05 UTC (rev 92977)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java 2009-08-28 18:59:12 UTC (rev 92978)
@@ -28,7 +28,6 @@
import org.jboss.osgi.spi.framework.OSGiBootstrap;
import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.OSGiTest;
import org.jboss.osgi.spi.testing.OSGiTestHelper;
import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
@@ -52,7 +51,7 @@
* @author thomas.diesler(a)jboss.com
* @since 28-Aug-2009
*/
-public class OSGI142TestCase extends OSGiTest
+public class OSGI142TestCase
{
@Test
public void testLoadClass() throws Exception
@@ -103,8 +102,9 @@
assertEquals(message, expClazz.getName(), wasClass.getName());
}
else
+ {
fail("ClassNotFoundException expected for: " + message);
-
+ }
}
catch (ClassNotFoundException ex)
{
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143 (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142)
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI142TestCase.java 2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,120 +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.jbosgi142;
-
-//$Id: OSGI142TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-
-import org.jboss.osgi.spi.framework.OSGiBootstrap;
-import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
-import org.jboss.osgi.spi.testing.OSGiTest;
-import org.jboss.osgi.spi.testing.OSGiTestHelper;
-import org.jboss.test.osgi.jbosgi142.bundleA.BeanA;
-import org.jboss.test.osgi.jbosgi142.bundleB.BeanB;
-import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.launch.Framework;
-
-/**
- * [JBOSGI-142] Investigate classloading space
- *
- * https://jira.jboss.org/jira/browse/JBOSGI-142
- *
- * A imports X
- * B imports X
- *
- * Can X load a class from A or B?
- * Can A load a class from B and vice versa?
- *
- * @author thomas.diesler(a)jboss.com
- * @since 28-Aug-2009
- */
-public class OSGI142TestCase extends OSGiTest
-{
- @Test
- public void testLoadClass() throws Exception
- {
- OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
- Framework framework = bootProvider.getFramework();
- framework.start();
-
- BundleContext sysContext = framework.getBundleContext();
- Bundle bundleX = sysContext.installBundle(getBundleLocation("jbosgi142-bundleX.jar"));
- bundleX.start();
-
- assertBundleLoadClass(bundleX, BeanX.class, true);
-
- Bundle bundleA = sysContext.installBundle(getBundleLocation("jbosgi142-bundleA.jar"));
- bundleA.start();
-
- assertBundleLoadClass(bundleA, BeanA.class, true);
-
- Bundle bundleB = sysContext.installBundle(getBundleLocation("jbosgi142-bundleB.jar"));
- bundleB.start();
-
- assertBundleLoadClass(bundleB, BeanB.class, true);
-
- assertBundleLoadClass(bundleA, BeanX.class, true);
- assertBundleLoadClass(bundleB, BeanX.class, true);
-
- assertBundleLoadClass(bundleX, BeanA.class, false);
- assertBundleLoadClass(bundleX, BeanB.class, false);
-
- assertBundleLoadClass(bundleA, BeanB.class, false);
- assertBundleLoadClass(bundleB, BeanA.class, false);
-
- framework.stop();
- framework.waitForStop(1000);
- }
-
- private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success)
- {
- String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
-
- Class<?> wasClass;
- try
- {
- wasClass = bundle.loadClass(expClazz.getName());
- if (success)
- {
- assertEquals(message, expClazz.getName(), wasClass.getName());
- }
- else
- fail("ClassNotFoundException expected for: " + message);
-
- }
- catch (ClassNotFoundException ex)
- {
- if (success)
- fail("Unexpected ClassNotFoundException for: " + message);
- }
- }
-
- private String getBundleLocation(String jarname)
- {
- return new OSGiTestHelper().getTestArchiveURL(jarname).toExternalForm();
- }
-}
\ No newline at end of file
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/OSGI142TestCase.java)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/OSGI143TestCase.java 2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,107 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.test.osgi.jbosgi143;
+
+//$Id: OSGI143TestCase.java 87103 2009-04-09 22:18:31Z thomas.diesler(a)jboss.com $
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import org.jboss.osgi.spi.framework.OSGiBootstrap;
+import org.jboss.osgi.spi.framework.OSGiBootstrapProvider;
+import org.jboss.osgi.spi.testing.OSGiTestHelper;
+import org.jboss.test.osgi.jbosgi143.bundleA.BeanA;
+import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.launch.Framework;
+
+/**
+ * [JBOSGI-143] Add initial support for DynamicImport-Package
+ *
+ * https://jira.jboss.org/jira/browse/JBOSGI-143
+ *
+ * A imports X
+ * X has DynamicImport-Package: *
+ *
+ * Can X load a class from A?
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 28-Aug-2009
+ */
+public class OSGI143TestCase
+{
+ @Test
+ public void testLoadClass() throws Exception
+ {
+ OSGiBootstrapProvider bootProvider = OSGiBootstrap.getBootstrapProvider();
+ Framework framework = bootProvider.getFramework();
+ framework.start();
+
+ BundleContext sysContext = framework.getBundleContext();
+ Bundle bundleX = sysContext.installBundle(getBundleLocation("jbosgi143-bundleX.jar"));
+ bundleX.start();
+
+ assertBundleLoadClass(bundleX, BeanX.class, true);
+
+ Bundle bundleA = sysContext.installBundle(getBundleLocation("jbosgi143-bundleA.jar"));
+ bundleA.start();
+
+ assertBundleLoadClass(bundleA, BeanA.class, true);
+
+ assertBundleLoadClass(bundleA, BeanX.class, true);
+ assertBundleLoadClass(bundleX, BeanA.class, true);
+
+ framework.stop();
+ framework.waitForStop(1000);
+ }
+
+ private void assertBundleLoadClass(Bundle bundle, Class<?> expClazz, boolean success)
+ {
+ String message = bundle.getSymbolicName() + " loads " + expClazz.getName();
+
+ Class<?> wasClass;
+ try
+ {
+ wasClass = bundle.loadClass(expClazz.getName());
+ if (success)
+ {
+ assertEquals(message, expClazz.getName(), wasClass.getName());
+ }
+ else
+ {
+ fail("ClassNotFoundException expected for: " + message);
+ }
+ }
+ catch (ClassNotFoundException ex)
+ {
+ if (success)
+ fail("Unexpected ClassNotFoundException for: " + message);
+ }
+ }
+
+ private String getBundleLocation(String jarname)
+ {
+ return new OSGiTestHelper().getTestArchiveURL(jarname).toExternalForm();
+ }
+}
\ No newline at end of file
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/bundleA/BeanA.java 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleA/BeanA.java 2009-08-28 18:59:12 UTC (rev 92978)
@@ -19,11 +19,11 @@
* 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.jbosgi142.bundleA;
+package org.jboss.test.osgi.jbosgi143.bundleA;
//$Id: SomePojo.java 85016 2009-03-02 12:12:31Z thomas.diesler(a)jboss.com $
-import org.jboss.test.osgi.jbosgi142.bundleX.BeanX;
+import org.jboss.test.osgi.jbosgi143.bundleX.BeanX;
public class BeanA
{
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi142/bundleX/BeanX.java 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/java/org/jboss/test/osgi/jbosgi143/bundleX/BeanX.java 2009-08-28 18:59:12 UTC (rev 92978)
@@ -19,7 +19,7 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
-package org.jboss.test.osgi.jbosgi142.bundleX;
+package org.jboss.test.osgi.jbosgi143.bundleX;
//$Id: SomePojo.java 85016 2009-03-02 12:12:31Z thomas.diesler(a)jboss.com $
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143 (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142)
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleA.bnd 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleA.bnd 2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleA.jar src/test/resources/jbosgi142/bundleA.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleA
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleA
-
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleB.bnd 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleB.bnd 2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleB.jar src/test/resources/jbosgi142/bundleB.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleB
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleB
-
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleX.bnd 2009-08-28 11:55:56 UTC (rev 92948)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi142-bundleX.bnd 2009-08-28 18:59:12 UTC (rev 92978)
@@ -1,5 +0,0 @@
-# bnd build -classpath target/test-classes -output target/test-libs/jbosgi142-bundleX.jar src/test/resources/jbosgi142/bundleX.bnd
-
-Bundle-SymbolicName: jbosgi142-bundleX
-Export-Package: org.jboss.test.osgi.jbosgi142.bundleX
-
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleA.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleA.bnd 2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi143-bundleA.jar src/test/resources/jbosgi143/bundleA.bnd
+
+Bundle-SymbolicName: jbosgi143-bundleA
+Export-Package: org.jboss.test.osgi.jbosgi143.bundleA
+Import-Package: org.jboss.test.osgi.jbosgi143.bundleX
Copied: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd (from rev 92948, projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi142/jbosgi142-bundleX.bnd)
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd (rev 0)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/jbosgi143/jbosgi143-bundleX.bnd 2009-08-28 18:59:12 UTC (rev 92978)
@@ -0,0 +1,5 @@
+# bnd build -classpath target/test-classes -output target/test-libs/jbosgi143-bundleX.jar src/test/resources/jbosgi143/bundleX.bnd
+
+Bundle-SymbolicName: jbosgi143-bundleX
+Export-Package: org.jboss.test.osgi.jbosgi143.bundleX
+DynamicImport-Package: *
16 years, 3 months
JBoss-OSGI SVN: r92974 - in projects/jboss-osgi/trunk/testsuite: example/src/test/resources/META-INF and 1 other directories.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 12:28:13 -0400 (Fri, 28 Aug 2009)
New Revision: 92974
Removed:
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-framework.xml
Modified:
projects/jboss-osgi/trunk/testsuite/example/pom.xml
projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
Log:
Cleanup configuration
Modified: projects/jboss-osgi/trunk/testsuite/example/pom.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/example/pom.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -162,7 +162,15 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <exclude>org/jboss/test/osgi/foo/**</exclude>
+ <!-- most tests work when run individually ??? -->
+ <exclude>${target.container.excludes}</exclude>
+ <exclude>org/jboss/test/osgi/example/blueprint/**</exclude>
+ <exclude>org/jboss/test/osgi/example/http/**</exclude>
+ <exclude>org/jboss/test/osgi/example/jmx/**</exclude>
+ <exclude>org/jboss/test/osgi/example/jndi/**</exclude>
+ <exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
+ <exclude>org/jboss/test/osgi/example/simple/**</exclude>
+ <exclude>org/jboss/test/osgi/example/xml/**</exclude>
</excludes>
</configuration>
</plugin>
@@ -188,6 +196,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
+ <exclude>${target.container.excludes}</exclude>
</excludes>
</configuration>
</plugin>
@@ -213,7 +222,11 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<excludes>
- <exclude>org/jboss/test/osgi/bootstrap/BootstrapTestCase.*</exclude>
+ <exclude>${target.container.excludes}</exclude>
+ <exclude>org/jboss/test/osgi/example/blueprint/**</exclude>
+ <exclude>org/jboss/test/osgi/example/http/**</exclude>
+ <exclude>org/jboss/test/osgi/example/microcontainer/**</exclude>
+ <exclude>org/jboss/test/osgi/example/xml/jaxb/**</exclude>
</excludes>
</configuration>
</plugin>
Deleted: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/bootstrap.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -1,144 +0,0 @@
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!--
- ********************************
- * *
- * OSGi Framework *
- * *
- ********************************
- -->
-
- <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
- <property name="properties">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
- <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- </map>
- </property>
- <incallback method="addPlugin" />
- <uncallback method="removePlugin" />
- </bean>
-
- <bean name="OSGiSystemPackages" class="org.jboss.osgi.plugins.facade.plugins.SystemPackagesPluginImpl">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- <property name="extraPackages">
- <list elementClass="java.lang.String">
- <value>org.jboss.logging;version=[2.0,3.0)</value>
- <value>org.jboss.osgi.spi.service;version=1.0</value>
- <value>org.jboss.osgi.spi.logging;version=1.0</value>
- <value>org.jboss.osgi.spi.management;version=1.0</value>
- <value>org.jboss.osgi.spi.util;version=1.0</value>
- </list>
- </property>
- </bean>
-
- <bean name="OSGiAutoInstall" class="org.jboss.osgi.plugins.facade.plugins.AutoInstallPluginImpl">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- <property name="autoInstall">
- <list elementClass="java.net.URL">
- </list>
- </property>
- <property name="autoStart">
- <list elementClass="java.net.URL">
- <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value>
- <value>${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
- <value>${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
- </list>
- </property>
- </bean>
-
- <bean name="OSGiStoragePlugin" class="org.jboss.osgi.plugins.facade.plugins.BundleStoragePluginImpl">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
-
- <!--
- ********************************
- * *
- * OSGi Deployment *
- * *
- ********************************
- -->
-
- <!-- 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>
- </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>
- <!-- 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>
-
- <!-- Bundle Structure -->
- <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
-
- <!-- JAR & File Structure (needed for negative testing) -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
-
- <!-- 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.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
- </constructor>
- </bean>
-
- <!-- OSGI Deployment -->
- <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" >
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </bean>
- <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
-
- <!--
- ********************************
- * *
- * OSGi Classloading *
- * *
- ********************************
- -->
-
- <!-- ClassLoading -->
- <bean name="ClassLoaderSystem" class="org.jboss.osgi.plugins.facade.classloading.OSGiClassLoaderSystem" >
- <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
- </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>
Modified: projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/example/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -17,6 +17,7 @@
<entry><key>org.osgi.framework.system.packages.extra</key><value>
org.jboss.logging;version=2.0,
org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.framework;version=1.0,
org.jboss.osgi.spi.logging;version=1.0,
org.jboss.osgi.spi.management;version=1.0,
org.jboss.osgi.spi.service;version=1.0,
Deleted: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/bootstrap.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -1,108 +0,0 @@
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!--
- ********************************
- * *
- * OSGi Framework *
- * *
- ********************************
- -->
-
- <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
- <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
- </bean>
-
- <!--
- ********************************
- * *
- * OSGi Deployment *
- * *
- ********************************
- -->
-
- <!-- 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>
- </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>
- <!-- 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>
-
- <!-- Bundle Structure -->
- <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
-
- <!-- JAR & File Structure (needed for negative testing) -->
- <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
- <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
-
- <!-- 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.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
- </constructor>
- </bean>
-
- <!-- OSGI Deployment -->
- <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
- <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
- <constructor>
- <parameter><inject bean="OSGiBundleManager" /></parameter>
- </constructor>
- </bean>
- <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleClassLoadingDeployer" />
- <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
-
- <!--
- ********************************
- * *
- * OSGi Classloading *
- * *
- ********************************
- -->
-
- <!-- ClassLoading -->
- <bean name="ClassLoaderSystem" class="org.jboss.test.osgi.OSGiClassLoaderSystem" />
- <bean name="ClassLoading" class="org.jboss.classloading.spi.dependency.ClassLoading">
- <incallback method="addModule" state="Configured" />
- <uncallback method="removeModule" state="Configured" />
- </bean>
- <bean name="ClassLoadingMetaDataParser" class="org.jboss.deployers.vfs.spi.deployer.SchemaResolverDeployer">
- <constructor>
- <parameter>org.jboss.classloading.spi.metadata.ClassLoadingMetaData</parameter>
- </constructor>
- <property name="name">jboss-classloading.xml</property>
- </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>
Modified: projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-bootstrap.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -1,6 +1,146 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<bootstrap xmlns="urn:jboss:bootstrap:1.0">
+<deployment xmlns="urn:jboss:bean-deployer:2.0">
- <url>jboss-osgi-framework.xml</url>
+ <!--
+ ********************************
+ * *
+ * OSGi Framework *
+ * *
+ ********************************
+ -->
+
+ <bean name="OSGiBundleManager" class="org.jboss.osgi.plugins.facade.bundle.OSGiBundleManager">
+ <constructor><parameter><inject bean="MainDeployer" /></parameter></constructor>
+ <property name="properties">
+ <map keyClass="java.lang.String" valueClass="java.lang.String">
+ <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
+ <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
+ <entry><key>org.osgi.framework.system.packages.extra</key><value>
+ org.jboss.logging;version=2.0,
+ org.jboss.osgi.spi.capability;version=1.0,
+ org.jboss.osgi.spi.framework;version=1.0,
+ org.jboss.osgi.spi.logging;version=1.0,
+ org.jboss.osgi.spi.management;version=1.0,
+ org.jboss.osgi.spi.service;version=1.0,
+ org.jboss.osgi.spi.testing;version=1.0,
+ org.jboss.osgi.spi.util;version=1.0
+ </value></entry>
+ </map>
+ </property>
+ <incallback method="addPlugin" />
+ <uncallback method="removePlugin" />
+ </bean>
+
+ <bean name="OSGiAutoInstallPlugin" class="org.jboss.osgi.plugins.facade.plugins.AutoInstallPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ <property name="autoInstall">
+ <list elementClass="java.net.URL">
+ <!-- [JBOSGI-136] Cannot resolve dependency against unstarted bundle
+ <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value -->
+ </list>
+ </property>
+ <property name="autoStart">
+ <list elementClass="java.net.URL">
+ <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value>
+ <value>${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
+ <value>${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
+ </list>
+ </property>
+ </bean>
+ <bean name="OSGiFrameworkEventsPlugin" class="org.jboss.osgi.plugins.facade.plugins.FrameworkEventsPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+ <bean name="OSGiStoragePlugin" class="org.jboss.osgi.plugins.facade.plugins.BundleStoragePluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+ <bean name="OSGiSystemPackages" class="org.jboss.osgi.plugins.facade.plugins.SystemPackagesPluginImpl">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+
+ <!--
+ ********************************
+ * *
+ * OSGi Deployment *
+ * *
+ ********************************
+ -->
+
+ <!-- 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>
+ </bean>
-</bootstrap>
+ <!-- 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>
+ <!-- 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>
+
+ <!-- Bundle Structure -->
+ <bean name="BundleStructure" class="org.jboss.osgi.deployer.BundleStructureDeployer" />
+
+ <!-- JAR & File Structure (needed for negative testing) -->
+ <bean name="JARStructure" class="org.jboss.deployers.vfs.plugins.structure.jar.JARStructure" />
+ <bean name="FileStructure" class="org.jboss.deployers.vfs.plugins.structure.file.FileStructure" />
+
+ <!-- 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.dependency.spi.Controller"><inject bean="jboss.kernel:service=KernelController" /></parameter>
+ </constructor>
+ </bean>
+
+ <!-- OSGI Deployment -->
+ <bean name="OSGiManifestParsingDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiManifestParsingDeployer" />
+ <bean name="OSGiBundleStateDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleStateDeployer">
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </bean>
+ <bean name="OSGiBundleClassLoadingDeployer" class="org.jboss.osgi.plugins.facade.classloading.OSGiBundleClassLoadingDeployer"/>
+ <bean name="OSGiBundleActivatorDeployer" class="org.jboss.osgi.plugins.deployers.bundle.OSGiBundleActivatorDeployer" />
+
+ <!--
+ ********************************
+ * *
+ * OSGi Classloading *
+ * *
+ ********************************
+ -->
+
+ <!-- ClassLoading -->
+ <bean name="ClassLoaderSystem" class="org.jboss.osgi.plugins.facade.classloading.OSGiClassLoaderSystem" >
+ <constructor><parameter><inject bean="OSGiBundleManager" /></parameter></constructor>
+ </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/META-INF/jboss-osgi-framework.xml
===================================================================
--- projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-framework.xml 2009-08-28 16:26:15 UTC (rev 92973)
+++ projects/jboss-osgi/trunk/testsuite/functional/src/test/resources/META-INF/jboss-osgi-framework.xml 2009-08-28 16:28:13 UTC (rev 92974)
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- $Id$
--->
-
-<deployment xmlns="urn:jboss:bean-deployer:2.0">
-
- <!--
- ********************************
- * *
- * Framework *
- * *
- ********************************
- -->
-
- <!-- The OSGi Framework Factory -->
- <bean name="jboss.osgi:service=FrameworkFactory" class="org.jboss.osgi.jbossmc.framework.launch.FrameworkFactoryBean">
- <property name="kernel"><inject bean="jboss.kernel:service=Kernel" /></property>
- <property name="properties">
- <map keyClass="java.lang.String" valueClass="java.lang.String">
- <entry><key>org.osgi.framework.storage</key><value>${log4j.output.dir}/osgi-store</value></entry>
- <entry><key>org.osgi.framework.storage.clean</key><value>onFirstInit</value></entry>
- <entry>
- <key>org.osgi.framework.system.packages.extra</key>
- <value>
- <!-- system -->
- javax.xml.bind.annotation;version=2.1,
- org.apache.xerces.dom;version=2.9,
-
- <!-- jboss-osgi -->
- org.jboss.osgi.jmx;version=1.0,
- org.jboss.osgi.jndi;version=1.0,
- org.jboss.osgi.microcontainer;version=1.0,
- org.jboss.osgi.spi;version=1.0,
- org.jboss.osgi.spi.capability;version=1.0,
- org.jboss.osgi.spi.logging;version=1.0,
- org.jboss.osgi.spi.management;version=1.0,
- org.jboss.osgi.spi.service;version=1.0,
- org.jboss.osgi.spi.testing;version=1.0,
- org.jboss.osgi.spi.util;version=1.0,
- org.jboss.osgi.xml;version=1.0,
-
- <!-- jboss -->
- org.jboss.beans.metadata.plugins;version=2.0,
- org.jboss.beans.metadata.plugins.builder;version=2.0,
- org.jboss.beans.metadata.spi.builder;version=2.0,
- org.jboss.beans.metadata.spi;version=2.0,
- org.jboss.dependency.spi;version=2.0,
- org.jboss.kernel.spi.dependency;version=2.0,
- org.jboss.logging,
- org.jboss.reflect.spi;version=2.0,
- org.jboss.util.xml;version=2.2,
- org.jboss.virtual,
- org.jboss.virtual.plugins.registry,
- org.jboss.virtual.plugins.context.jar,
- org.jboss.virtual.plugins.vfs.helpers,
- org.jboss.virtual.protocol,
- org.jboss.xb.annotations;version=2.0,
- org.jboss.xb.binding;version=2.0,
- org.jboss.xb.binding.sunday.unmarshalling;version=2.0,
- </value>
- </entry>
- </map>
- </property>
- <property name="plugins">
- <list elementClass="org.jboss.osgi.jbossmc.api.AbstractPlugin">
- <inject bean="jboss.osgi:plugin=AutoInstall"/>
- </list>
- </property>
- </bean>
-
- <!--
- ********************************
- * *
- * Framework Plugins *
- * *
- ********************************
- -->
-
- <bean name="jboss.osgi:plugin=AutoInstall" class="org.jboss.osgi.jbossmc.framework.plugins.AutoInstallPluginImpl">
- <property name="autoInstall">
- <list elementClass="java.net.URL">
- <value>${test.archive.directory}/bundles/org.osgi.compendium.jar</value>
- </list>
- </property>
- <property name="autoStart">
- <list elementClass="java.net.URL">
- <value>${test.archive.directory}/bundles/org.apache.felix.log.jar</value>
- <value>${test.archive.directory}/bundles/jboss-osgi-common.jar</value>
- </list>
- </property>
- </bean>
-
-</deployment>
\ No newline at end of file
16 years, 3 months
JBoss-OSGI SVN: r92973 - projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 12:26:15 -0400 (Fri, 28 Aug 2009)
New Revision: 92973
Modified:
projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
Log:
Add org.osgi.framework.launch
Modified: projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java
===================================================================
--- projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-28 16:20:52 UTC (rev 92972)
+++ projects/jboss-osgi/projects/runtime/microcontainer/trunk/src/main/java/org/jboss/osgi/plugins/facade/plugins/SystemPackagesPluginImpl.java 2009-08-28 16:26:15 UTC (rev 92973)
@@ -97,6 +97,7 @@
allPackages.add("org.xml.sax.helpers");
allPackages.add("org.osgi.framework");
+ allPackages.add("org.osgi.framework.launch");
allPackages.add("org.osgi.service.startlevel");
allPackages.add("org.osgi.service.packageadmin");
allPackages.add("org.osgi.util.tracker");
16 years, 3 months
JBoss-OSGI SVN: r92971 - projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal.
by jboss-osgi-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2009-08-28 12:07:11 -0400 (Fri, 28 Aug 2009)
New Revision: 92971
Modified:
projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
Log:
Add Framework.waitForStop(5000)
Modified: projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java
===================================================================
--- projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-08-28 15:56:12 UTC (rev 92970)
+++ projects/jboss-osgi/projects/spi/trunk/src/main/java/org/jboss/osgi/spi/testing/internal/EmbeddedRuntime.java 2009-08-28 16:07:11 UTC (rev 92971)
@@ -148,9 +148,11 @@
super.shutdown();
try
{
- bootProvider.getFramework().stop();
+ Framework framework = bootProvider.getFramework();
+ framework.stop();
+ framework.waitForStop(5000);
}
- catch (BundleException ex)
+ catch (Exception ex)
{
log.error("Cannot stop the framework", ex);
}
16 years, 3 months