Author: thomas.diesler(a)jboss.com
Date: 2009-06-19 08:48:23 -0400 (Fri, 19 Jun 2009)
New Revision: 90470
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java
Log:
BP register services - ok
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/AbstractManager.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -26,12 +26,15 @@
import static org.jboss.osgi.spi.service.MicrocontainerService.BEAN_KERNEL_CONTROLLER;
import org.jboss.beans.metadata.spi.BeanMetaData;
+import org.jboss.dependency.spi.ControllerContext;
import org.jboss.kernel.spi.dependency.KernelController;
import org.jboss.kernel.spi.dependency.KernelControllerContext;
+import org.jboss.osgi.blueprint.reflect.ComponentMetadataImpl;
import org.jboss.osgi.common.log.LogServiceTracker;
import org.jboss.osgi.spi.service.MicrocontainerService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceReference;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.ComponentMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -55,13 +58,15 @@
{
protected LogService log;
protected BundleContext context;
+ protected BlueprintContainer container;
private ComponentMetadata component;
- public AbstractManager(BundleContext context, ComponentMetadata component)
+ public AbstractManager(BundleContext context, BlueprintContainer container,
ComponentMetadata component)
{
this.log = new LogServiceTracker(context);
this.context = context;
+ this.container = container;
this.component = component;
}
@@ -95,6 +100,17 @@
log.log(LogService.LOG_DEBUG, "shutdown: " + component);
}
+ public Object getTargetBean()
+ {
+ KernelController controller = getKernelController();
+ ComponentMetadataImpl impl = (ComponentMetadataImpl)component;
+ ControllerContext ctrlContext = controller.getContext(impl.getKey(), null);
+ if (ctrlContext == null)
+ throw new IllegalStateException("Cannot obtain controller context for:
" + impl.getKey());
+
+ return ctrlContext.getTarget();
+ }
+
protected KernelControllerContext installKernelBean(BeanMetaData kernelBean)
{
try
@@ -133,18 +149,18 @@
return controller;
}
- static AbstractManager createManager(BundleContext context, ComponentMetadata comp)
+ static AbstractManager createManager(BundleContext context, BlueprintContainer
container, ComponentMetadata comp)
{
AbstractManager manager = null;
if (comp instanceof BeanMetadata)
- manager = new BeanManager(context, (BeanMetadata)comp);
+ manager = new BeanManager(context, container, (BeanMetadata)comp);
else if (comp instanceof ServiceMetadata)
- manager = new ServiceManager(context, (ServiceMetadata)comp);
+ manager = new ServiceManager(context, container, (ServiceMetadata)comp);
else if (comp instanceof ServiceReferenceMetadata)
- manager = new ServiceReferenceManager(context, (ServiceReferenceMetadata)comp);
+ manager = new ServiceReferenceManager(context, container,
(ServiceReferenceMetadata)comp);
if (manager == null)
throw new IllegalArgumentException("Unsupported component type: " +
comp);
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BeanManager.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -28,6 +28,7 @@
import org.jboss.beans.metadata.spi.builder.BeanMetaDataBuilder;
import org.jboss.osgi.blueprint.reflect.BeanMetadataImpl;
import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
/**
@@ -55,9 +56,9 @@
private BeanMetadataImpl beanMetadata;
private BeanMetaData kernelBean;
- public BeanManager(BundleContext context, BeanMetadata compMetadata)
+ public BeanManager(BundleContext context, BlueprintContainer container, BeanMetadata
compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.beanMetadata = (BeanMetadataImpl)compMetadata;
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/BlueprintContainerImpl.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -36,7 +36,6 @@
import org.jboss.osgi.blueprint.parser.BlueprintParser;
import org.jboss.osgi.blueprint.reflect.BlueprintMetadata;
-import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
@@ -130,10 +129,7 @@
public ComponentMetadata getComponentMetadata(String name)
{
- AbstractManager manager = managers.get(name);
- if (manager == null)
- throw new NoSuchComponentException(name);
-
+ AbstractManager manager = getComponentManager(name);
return manager.getComponentMetadata();
}
@@ -149,10 +145,20 @@
}
return Collections.unmodifiableList(compMetadata);
}
+
+ public AbstractManager getComponentManager(String name)
+ {
+ AbstractManager manager = managers.get(name);
+ if (manager == null)
+ throw new NoSuchComponentException(name);
+
+ return manager;
+ }
public Object getComponentInstance(String id)
{
- throw new NotImplementedException();
+ AbstractManager manager = getComponentManager(id);
+ return manager.getTargetBean();
}
private void registerBlueprintContainerService()
@@ -170,7 +176,7 @@
{
for (ComponentMetadata comp : bpMetadata.getComponents())
{
- AbstractManager manager = AbstractManager.createManager(context, comp);
+ AbstractManager manager = AbstractManager.createManager(context, this, comp);
String key = manager.getId();
if (key == null)
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceManager.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -30,8 +30,11 @@
import org.jboss.osgi.blueprint.reflect.ServiceMetadataImpl;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.BeanMetadata;
+import org.osgi.service.blueprint.reflect.RefMetadata;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
+import org.osgi.service.blueprint.reflect.Target;
/**
* Service managers maintain the registration of an OSGi service
@@ -50,15 +53,15 @@
private BeanManager anonymousBean;
private List<ServiceRegistration> serviceRegs = new
ArrayList<ServiceRegistration>();
- public ServiceManager(BundleContext context, ServiceMetadata compMetadata)
+ public ServiceManager(BundleContext context, BlueprintContainer container,
ServiceMetadata compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.serviceMetadata = (ServiceMetadataImpl)compMetadata;
// Create the anonymous bean manager
- BeanMetadata beanMetadata = (BeanMetadata)serviceMetadata.getServiceComponent();
- if (beanMetadata != null)
- anonymousBean = (BeanManager)AbstractManager.createManager(context,
beanMetadata);
+ Target target = serviceMetadata.getServiceComponent();
+ if (target instanceof BeanMetadata)
+ anonymousBean = (BeanManager)AbstractManager.createManager(context, container,
(BeanMetadata)target);
}
@Override
@@ -75,16 +78,24 @@
{
super.activate();
+ // Get the BeanManager that backs this service
BeanManager beanManager = anonymousBean;
if (beanManager == null)
{
+ RefMetadata target = (RefMetadata)serviceMetadata.getServiceComponent();
+ BlueprintContainerImpl impl = (BlueprintContainerImpl)container;
+ beanManager = (BeanManager)impl.getComponentManager(target.getComponentId());
}
- // Register the services
+ // Activate the BeanManager that backs this service
+ beanManager.activate();
+
+ // Register the the target bean as a services
+ Object targetBean = beanManager.getTargetBean();
for (String interf : serviceMetadata.getInterfaces())
{
- //ServiceRegistration sreg = context.registerService(interf, this, null);
- //serviceRegs.add(sreg);
+ ServiceRegistration sreg = context.registerService(interf, targetBean, null);
+ serviceRegs.add(sreg);
}
}
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/container/ServiceReferenceManager.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -25,6 +25,7 @@
import org.jboss.osgi.blueprint.reflect.ServiceReferenceMetadataImpl;
import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.container.BlueprintContainer;
import org.osgi.service.blueprint.reflect.ServiceReferenceMetadata;
/**
@@ -42,9 +43,9 @@
{
private ServiceReferenceMetadataImpl srefMetadata;
- public ServiceReferenceManager(BundleContext context, ServiceReferenceMetadata
compMetadata)
+ public ServiceReferenceManager(BundleContext context, BlueprintContainer container,
ServiceReferenceMetadata compMetadata)
{
- super(context, compMetadata);
+ super(context, container, compMetadata);
this.srefMetadata = (ServiceReferenceMetadataImpl)compMetadata;
}
}
\ No newline at end of file
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ComponentMetadataImpl.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -35,16 +35,13 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class ComponentMetadataImpl implements ComponentMetadata
+public class ComponentMetadataImpl extends MetadataImpl implements ComponentMetadata
{
- protected BundleContext context;
- protected BlueprintMetadata blueprint;
protected TComponent tComp;
public ComponentMetadataImpl(BundleContext context, BlueprintMetadata blueprint,
TComponent tComp)
{
- this.context = context;
- this.blueprint = blueprint;
+ super(context, blueprint);
this.tComp = tComp;
}
@@ -58,6 +55,15 @@
return tComp.getId();
}
+ public String getKey()
+ {
+ String key = tComp.getId();
+ if (key == null)
+ throw new IllegalStateException("Cannot obtain key for componenet: " +
tComp);
+
+ return key;
+ }
+
public int getInitialization()
{
return tComp.getInitialization();
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -0,0 +1,45 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint.reflect;
+
+// $Id$
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.Metadata;
+
+/**
+ * Top level metadata.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class MetadataImpl implements Metadata
+{
+ protected BundleContext context;
+ protected BlueprintMetadata blueprint;
+
+ public MetadataImpl(BundleContext context, BlueprintMetadata blueprint)
+ {
+ this.context = context;
+ this.blueprint = blueprint;
+ }
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/MetadataImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
(rev 0)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -0,0 +1,54 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.osgi.blueprint.reflect;
+
+// $Id$
+
+import org.osgi.framework.BundleContext;
+import org.osgi.service.blueprint.reflect.RefMetadata;
+
+/**
+ * A value which refers to another component in the module context by name.
+ *
+ * @author thomas.diesler(a)jboss.com
+ * @since 13-May-2009
+ */
+public class RefMetadataImpl extends MetadataImpl implements RefMetadata
+{
+ private String refId;
+
+ public RefMetadataImpl(BundleContext context, BlueprintMetadata blueprint, String
refId)
+ {
+ super(context, blueprint);
+ this.refId = refId;
+ }
+
+ public String getComponentId()
+ {
+ return refId;
+ }
+
+ public String toString()
+ {
+ return "Ref[id=" + getComponentId() + "]";
+ }
+}
Property changes on:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/RefMetadataImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/impl/src/main/java/org/jboss/osgi/blueprint/reflect/ServiceMetadataImpl.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -30,7 +30,6 @@
import org.jboss.osgi.blueprint.parser.xb.TService;
import org.jboss.osgi.spi.NotImplementedException;
import org.osgi.framework.BundleContext;
-import org.osgi.service.blueprint.reflect.BeanMetadata;
import org.osgi.service.blueprint.reflect.MapEntry;
import org.osgi.service.blueprint.reflect.RegistrationListener;
import org.osgi.service.blueprint.reflect.ServiceMetadata;
@@ -45,8 +44,8 @@
public class ServiceMetadataImpl extends ComponentMetadataImpl implements
ServiceMetadata
{
private TService tService;
- private BeanMetadata beanMetadata;
-
+ private Target target;
+
public ServiceMetadataImpl(BundleContext context, BlueprintMetadata blueprint,
TService tService)
{
super(context, blueprint, tService);
@@ -57,14 +56,14 @@
{
int modeValue = AUTO_EXPORT_DISABLED;
TAutoExportModes mode = tService.getAutoExportMode();
-
+
if (mode == TAutoExportModes.ALL_CLASSES)
- modeValue = AUTO_EXPORT_ALL_CLASSES;
+ modeValue = AUTO_EXPORT_ALL_CLASSES;
else if (mode == TAutoExportModes.CLASS_HIERARCHY)
- modeValue = AUTO_EXPORT_CLASS_HIERARCHY;
+ modeValue = AUTO_EXPORT_CLASS_HIERARCHY;
else if (mode == TAutoExportModes.INTERFACES)
- modeValue = AUTO_EXPORT_INTERFACES;
-
+ modeValue = AUTO_EXPORT_INTERFACES;
+
return modeValue;
}
@@ -85,30 +84,30 @@
public Target getServiceComponent()
{
- if (beanMetadata == null)
+ if (target == null)
{
if (tService.getBean() != null)
{
ComponentFactory factory = new ComponentFactory(context, blueprint);
- beanMetadata = (BeanMetadata)factory.createComponent(this,
tService.getBean(), true);
+ target = (Target)factory.createComponent(this, tService.getBean(), true);
}
- //else if (tService.getRef() != null)
- //{
- // beanMetadata = (BeanMetadata)blueprint.getComponent(tService.getRef());
- //}
+ else if (tService.getRef() != null)
+ {
+ target = new RefMetadataImpl(context, blueprint, tService.getRef());
+ }
}
-
- //if (beanMetadata == null)
- // throw new IllegalStateException("Cannot get service component");
-
- return beanMetadata;
+
+ if (target == null)
+ throw new IllegalStateException("Cannot get service component");
+
+ return target;
}
public List<MapEntry> getServiceProperties()
{
throw new NotImplementedException();
}
-
+
public String toString()
{
return "Service[id=" + getId() + "]";
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/BlueprintContainerTestCase.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -49,7 +49,6 @@
import org.jboss.test.osgi.blueprint.container.bundle.ServiceB;
import org.junit.AfterClass;
import org.junit.BeforeClass;
-import org.junit.Ignore;
import org.junit.Test;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
@@ -138,7 +137,6 @@
}
@Test
- @Ignore
public void getComponent() throws Exception
{
if (context == null)
@@ -147,10 +145,33 @@
assumeNotNull(context);
BlueprintContainer bpContainer = getBlueprintContainer();
- bpContainer.getComponentInstance("beanA");
+ BeanA beanA = (BeanA)bpContainer.getComponentInstance("beanA");
+ assertNotNull("ComponentInstance available", beanA);
}
@Test
+ public void getService() throws Exception
+ {
+ if (context == null)
+ huskyBridge.run();
+
+ assumeNotNull(context);
+
+ ServiceReference srefA = context.getServiceReference(ServiceA.class.getName());
+ assertNotNull("ServiceReference available", srefA);
+
+ ServiceA serviceA = (ServiceA)context.getService(srefA);
+ assertNotNull("Service available", serviceA);
+
+ ServiceReference srefB = context.getServiceReference(ServiceB.class.getName());
+ assertNotNull("ServiceReference available", srefB);
+
+ ServiceB serviceB = (ServiceB)context.getService(srefB);
+ assertNotNull("Service available", serviceB);
+
+ }
+
+ @Test
public void testComponentMetadataByName() throws Exception
{
if (context == null)
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanA.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -32,7 +32,7 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class BeanA
+public class BeanA implements ServiceA
{
private MBeanServer mbeanServer;
private BeanB beanB;
Modified:
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java
===================================================================
---
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java 2009-06-19
11:38:07 UTC (rev 90469)
+++
projects/jboss-osgi/trunk/blueprint/testsuite/src/test/java/org/jboss/test/osgi/blueprint/container/bundle/BeanB.java 2009-06-19
12:48:23 UTC (rev 90470)
@@ -30,7 +30,7 @@
* @author thomas.diesler(a)jboss.com
* @since 13-May-2009
*/
-public class BeanB
+public class BeanB implements ServiceB
{
private BeanA beanA;