karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Achim Nierbeck <bcanh...@googlemail.com>
Subject Re: Help testing in Karaf 2.3.1
Date Wed, 17 Apr 2013 09:50:57 GMT
Hi,

pax-exam is actually more a tool for integration tests, therefore usually
used for existing bundles.
If you want to use it in the same module/bundle you still have the option
of building a "testable" bundle of your just compiled sources on the fly.
For example take a look at the simple sample below, it's part of the
configure method:

streamBundle(bundle().add(SomeClass.class)
.add(OtherClass.class)
.add(YetAnotherClass.class)
.add("OSGI-INF/blueprint/blueprint.xml", new
File("src/main/resources/OSGI-INF/blueprint/blueprint.xml").toURL())
                                .set(Constants.BUNDLE_SYMBOLICNAME,
"symbolicName")
.set(Constants.DYNAMICIMPORT_PACKAGE, "*")
.set(Constants.EXPORT_PACKAGE, "package.to.exportl").build())
.start()


regards, Achim



2013/4/16 glsilverman <glsilverman@pssd.com>

> Yes, you are correct. The path should be OSGI-INF/... I used the correct
> path
> in my test. The problem, as was pointed out earlier, is a timing issue, so
> the test fails. The only way I found around this was to put the bluepring
> file oustide the test path and install it directly, with a call to
>
> executeCommand("osgi:install -s spring:file:<PATH_TO_BLUEPRINT_FILE>"); at
> the end of my installKaraf method, after all the dependencies have been
> loaded. That seems to work OK, but only if the beans in the blueprint file
> are instantiated from class files in src/test/java. The blueprint file will
> install, but won't start if the class files are in src/main/java. That's
> the
> biggest problem I'm having right now with the Karaf test container.
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Help-testing-in-Karaf-2-3-1-tp4028453p4028464.html
> Sent from the Karaf - Dev mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message