PojoSR and Blueprint unit testing

53 views
Skip to first unread message

lennart...@gmail.com

unread,
Feb 19, 2013, 1:02:55 PM2/19/13
to pojosr-...@googlegroups.com
Hello all,

I have what looked like a trivial problem in using PojoSR during unit testing, but cannot see the forest for all its trees...
I would simply like to devise a way to register all instances within an Aries ComponentDefinitionRegistry into the PojoServiceRegistry,
as illustrated in the code snippet below.

// Create the PojoServiceRegistry instance.
final ServiceLoader<PojoServiceRegistryFactory> loader = ServiceLoader.load(PojoServiceRegistryFactory.class);
final PojoServiceRegistry registry = loader.iterator().next().newPojoServiceRegistry(serviceRegistryConfiguration);

// Kickstart the D.I. blueprint configuration.
final ServiceReference parserServiceReference = registry.getServiceReference(ParserService.class.getName());

// Parse the Blueprint configuration XML
final ParserService parserService = (ParserService) registry.getService(parserServiceReference);
Assert.assertNotNull("Could not find the blueprint ParserService", parserService);

final URL testBlueprintXml = getClass().getClassLoader().getResource(blueprintConfigurationPath);
Assert.assertNotNull("Could not find the blueprint XML configuration at ["
                + blueprintConfigurationPath + "]", testBlueprintXml);

final ComponentDefinitionRegistry result = parserService.parse(testBlueprintXml, registry.getBundleContext().getBundle());

// Now add all Blueprint-generated instances, services etc. to the PojoSR registry...
// ... but how?

Johan Martinsson

unread,
Dec 12, 2013, 5:05:23 AM12/12/13
to pojosr-...@googlegroups.com
I would be interested in knowing if you made this work. However looking at the content of the PojoSR library I don't see anything related to blueprint parsing. Perhaps we have to manually integrate SpringDM or something similar?

Karl Pauls

unread,
Dec 12, 2013, 5:16:58 AM12/12/13
to pojosr-...@googlegroups.com
I guess I'm confused as to what you are trying to do exactly. If all you want to do is to use blueprint inside a pojosr, wouldn't it be enough to just put the blueprint bundle(s) on the class path?

regards,

Karl


--
Sie erhalten diese Nachricht, weil Sie Mitglied der Google Groups-Gruppe "pojosr-discuss" sind.
Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine E-Mail an pojosr-discus...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out



--
Karl Pauls
karl...@gmail.com
http://twitter.com/karlpauls
http://www.linkedin.com/in/karlpauls
https://profiles.google.com/karlpauls

Lennart Jörelid

unread,
Dec 12, 2013, 6:41:10 AM12/12/13
to pojosr-...@googlegroups.com
Hello there,

No - I never got this to work properly.
I did not receive any answers to the question back in february.

Karl Pauls

unread,
Dec 12, 2013, 6:51:27 AM12/12/13
to pojosr-...@googlegroups.com
Again, I'm not sure I understand the use case correctly. It seems to me that all you want to do is put the blueprint bundles on the class path and things should start to work - if you really need to do this externally you'd have to explain it to me in more details.

regards,

Karl


--
Sie erhalten diese Nachricht, weil Sie Mitglied der Google Groups-Gruppe "pojosr-discuss" sind.
Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine E-Mail an pojosr-discus...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out
Reply all
Reply to author
Forward
0 new messages