camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Quinn Stevenson <>
Subject Re: CamelBlueprintTestSupport No bean could be found in the registry
Date Mon, 08 Feb 2016 15:19:12 GMT
I’m a little confused here - asService take the object implementing the interface and the
service property key/values - I’m not sure how that could even work as an interface instead
of the implementation object.  The service interface is provided earlier in the call ( the
key in services.put ), and I like having the string there as well so I don’t have to add
dependencies to my project all the time (when I’m using OSGi classes that are provided by
the framework).

That said, I’m always looking for ways to simplify tests - do you have an idea on how this
could work?  Maybe you could do a prototype that we could see?

> On Feb 7, 2016, at 6:43 PM, Brad Johnson <> wrote:
> According
> to my humble opinion, the asService() method should ideally have Interface
> instead of Implementation argument.
> The asService is there to create a proxy to the actual implementation class
> I believe.  What you are actually putting in the registry is a key of the
> value of the full package and class name of the interface.  That's what
> blueprint is going to look up the service based upon.  The value is what
> you put in as the implementation.
> In a true blueprint environment that implementation will be hidden behind a
> proxy object that exposes the interface.  Any bundle wanting to use that
> proxied implementation then just tells it what the package anc class name
> of the interface are.  In other words, when that interface is fetched from
> the OSGi registry and handed to the requester, the requester doesn't know
> what concrete implementation it is talking to. It may be a test stub, it
> may be the actual implementation.  In fact, if you try to then cast that to
> the concrete implementation of the class it will fail because what it finds
> is a proxy of the interface.  This also makes it possible to hot swap
> bundles at run time because the proxy stays the same but the implementation
> changes.
> I'm still mystified why your test class wasn't picking up the service from
> your first bundle though.  If you have have it exported and referenced and
> listed as a test dependency in your client bundle then it should be
> automatically loaded up.  One of those pieces sounds as if it is missing.
>  @Override
>    protected void
> addServicesOnStartup(Map<String,KeyValueHolder&lt;Object, Dictionary>>
> services) {
>        services.put( MyServiceInterface.class.getName(), asService(new
> StubServiceImplementation(), "implementation", "stub"));
>    }
> On Fri, Feb 5, 2016 at 4:53 PM, enigma <> wrote:
>> Thank you and Have a good weekend! :)
>> --
>> View this message in context:
>> Sent from the Camel - Users mailing list archive at

View raw message