Hi,
This is a really an interesting debate that you have started here. We
can compare this situation with Apache Camel, Web or EJB projects where
we need a container to test the code. With plain spring project, we do
not a container except for JPA stuff and Spring creates for you the
Injection container in a transparent way.
For OSGI project like Apache Karaf you must create a test case based on
Pax-exam to emulate an OSGI runtime where the bundles are deployed and
could be tested. An interesting alternative would be that we setup a
container behind the scene like this is done with Camel to deploy the
camel routes.
I'm figure out that we could create a KarafContainer who will allow to
run and make tests with an OSGI platform using Pax-exam transparently.
That means that we should been able to deploy the bundles that we would
like to test using a RegisterHelper class or something like that.
Regards,
Charles
Apache Committer
On 25/03/11 04:22, Andreas Pieber wrote:
I'm not sure, but I think don't think that this is what Matt means.
There are situations when it make sense to retrieve your beans
directly via the blueprint.xml instead of mocking them. Situations are
when you like to check if the file is correct or when you configure
your persistence via blueprint and want to test it. AFAIK (as also
said by KCTang) there is currently no way to do this in blueprint.
Since springdm-2 also implements the blueprint spec there may be a
workaround using spring-dm to retrieve beans from your blueprint
files, though I'm wondering if it would be possible to extend Aries
with such a blueprint test framework (similar to the one of spring)?
Kind regards,
Andreas
On Fri, Mar 25, 2011 at 1:26 AM, Tang Kin Chuen<[email protected]> wrote:
Matt,
If you're trying to create& lookup the beans in spring context, I think
you'll have to create separate spring application context. It is not the
same as the stuff declared in blueprint.xml. They just look similar because
of its spring/springdm heritage.
It is probably cleaner anyway, as you can specify the required mock objects
within your spring test contexts.
On Fri, Mar 25, 2011 at 12:07 AM, Matt Madhavan<[email protected]>
wrote:
Hi Kc,
I would like to do Unit Testing of the bundles before the Integration
testing. I know how to do that if I'm using SpringDM. I can separate the
bean creation and service declaration in separate spring.xml files and use
the bean file to do unit testing.
There has to be a way to create just the beans using blueprint.xml and
lookup the beans based on the bean name. Any ideas?
Thanks
Matt
On Thu, Mar 24, 2011 at 5:25 AM, KcTang<[email protected]> wrote:
Hi, afaik, that's not possible. They don't share same schema.
What is your use case? Is it for unit testing only?
On 24 Mar 2011 01:19, "Matt Madhavan"<[email protected]> wrote:
Hello,
I would like to know how I can use the blueprint.xml to define beans
(No
Services) and instantiate beans and look them up like I would normally
do
using plain spring.xml configuration?
For instance I would like to do something similar (Spring) below using
BluePrint(Aries) instead Spring,
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations =
{"classpath:/com/hcsc/itf/osgi/samples/bp_ojpa_ctw_sdm/datasource/DataSourceTest-context.xml"})
Or loading Spring Application Context
--------------------------
ClassPathApplicationContext ctx = new ClassPathApplicationContext
("springbeans.xml")
Only in my case I would like to load my beans from bluepring.xml (With
no
services defined - only regular beans).
Any help would be appreciated.
Thanks in advance!
Matt