aburgos/opennaas — comment on commit 070db1bc38607b455aedf3d56b684238bff9dace
File:  line 0
By gbehrmann:

When I run this I have one failure left:

Caused by: org.opennaas.core.resources.protocol.ProtocolException: Could not find a session factory associated to the wonesys protocol
at org.opennaas.core.protocols.sessionmanager.impl.ProtocolManager.getSessionFactory(ProtocolManager.java:136)
at org.opennaas.core.protocols.sessionmanager.impl.ProtocolSessionManager.createProtocolSession(ProtocolSessionManager.java:135)

This is were a little knowledge about OpenNaaS is required. The protocol session manager has a plugin structure in which manticore bundles can implement protocols which are then discovered by the protocol session manager. What happens here is that you run the test before the bundle implementing the wonesys protocol had a chance to register itself with the protocol session manager.

What you need to do is to add a dependency so that you wait for that bundle to start. So which bundle is it? Well, that's a bit of detective work :-)

If you look at manticore/bundles/net.i2cat.luminis.protocols.wonesys/src/main/resources/OSGI-INF/blueprint/core.xml you see this fragment:

This looks like the service the protocol session manager is looking for. So what you need to do is to inject a BlueprintContainer reference for that bundle. This will ensure that the test isn't executed until the bundle started:

@Inject
@Filter("(osgi.blueprint.container.symbolicname=net.i2cat.luminis.protocols.wonesys)")
BlueprintContainer wonesysProtocolService;

The bundle symbolic name here happens to be the same as the directory name of the bundle. This is usually the case (although it doesn't have to be).

I believe that if you add this dependency the test will pass.