felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Gilmer <kgil...@gmail.com>
Subject Re: Suggestions on OSGi-context testing
Date Sat, 10 Dec 2011 06:46:53 GMT
Hi Karl,

  Thanks for the additional guidance.  So I spent some time setting up
a vanilla maven osgi bundle project.  I was able to add pojosr and
create a simple test case that started my bundle, retrieved the
service via the pojosr service registry, and executed the service.

  I then moved to integrating pojosr into httplite so I could begin
writing tests.  As my bundle starts in my test case, I ran into a
problem where "org.osgi.vendor.framework" is an undefined system
property.  I did some digging and determined that the FrameworkUtil
class tries to be dynamically loaded based on the root classname as
defined by "org.osgi.vendor.framework".  Setting to this to
"org.osgi.framework", (which is the root package name for the class
contained in pojosr) resulted in a stack overflow.  The FrameworkUtil
in the Felix framework is available but has all sorts of private
dependencies and is not easy to pull out into my own package. It
appears that the pojosr implementation is just calling itself, or
expecting another class to be available?  Any suggestions?


On Thu, Dec 8, 2011 at 6:58 PM, Karl Pauls <karlpauls@gmail.com> wrote:
> On Thu, Dec 8, 2011 at 8:59 AM, Ken Gilmer <kgilmer@gmail.com> wrote:
>> Thanks Andreas, Karl, and Arjun!
>> Andreas,
>>  I spent some time learning the basics of Pax Exam.  One of my
>> particular requirements is JUnit3/Java1.4.  I see it mentioned in a
>> JIRA issue that support has been added but cannot find a suitable
>> example of how this works.  Ideally for me, the Pax Exam documentation
>> would contain the initial description of what Pax Exam is, and then
>> want to see only a maven-based project with:
>> a) a service definition (public api)
>> b) some implementation (private)
>> c) a test that gets the service and executes a method via junit
>> d) the minimal POM that builds the regular bundle and also runs the junit test
>>  The existing example code is helpful but doesn't really answer my
>> immediate needs of getting started quickly, (as one who is not too
>> familiar with Maven yet).
>> Karl,
>>  Regarding PojoSR, I probably do not need a full OSGi framework for
>> my tests, so it could be suitable for me.  However I need a bit more
>> guidance on how to set up running a test (I can visualize how to
>> compose a test) in Maven.  Can you point me to an existing pom.xml
>> that uses PojoSR to execute JUnit tests against a service?
> I guess there are (at least could be) several approaches which also
> depend on your needs. One public example I know of is the work
> Guillaume Nodet (and maybe others) did for fuse:
> https://github.com/fusesource/fuse/tree/master/fabric/fabric-itests/fabric-pojosr
> Does that help?
>>  Regarding bnd, it seems to utilize Ant makefiles.  I'd like to avoid
>> that if possible.  Nothing against Ant, in fact I have my own
>> Ant-based osgi test framework, but I'd like to keep the test stuff as
>> simple as I can and keep things in Maven.
> It might not be impossible to hook it up to maven (if nothing else, by
> executing the and file from there). I think it is mostly based on bnd
> and the ant files are just very lightweight wrappers around it but I
> can't say whether it would be easy or not. You can see an example in
> ricks sandbox (the example requires you to use ant to execute the
> tests but it uses maven to get the thing assembled iirc) :
> http://svn.apache.org/repos/asf/felix/sandbox/rickhall/bnd-test/
> regards,
> Karl
>> Arjun,
>>  For me, the most difficult part is the Maven integration.  I want
>> the tests to run and fail as part of the build.  In any case it's good
>> to know you've got that, I'll check it out.
>> thx,
>> ken
>> On Tue, Dec 6, 2011 at 6:56 PM, Karl Pauls <karlpauls@gmail.com> wrote:
>>> To use PojoSR for testing with your dependencies from maven I guess
>>> you could just use the exec-maven-plugin, hook it up to the test phase
>>> and have it start with all dependencies from the test scope.
>>> regards,
>>> Karl
>>> On Tue, Dec 6, 2011 at 9:25 AM, Karl Pauls <karlpauls@gmail.com> wrote:
>>>> If you are looking for real integration testing, Pax Exam is probably
>>>> what you want.
>>>> However, if you want to test you services without a full OSGi
>>>> framework you might want to have  a look at PojoSR:
>>>> http://pojosr.googlecode.com
>>>> I know that some people use it for JUnit testing their services.
>>>> Finally, bnd itself can be used for testing (we use that in the
>>>> framework) and it is used by the OSGi ct.
>>>> regards,
>>>> Karl
>>>> On Tue, Dec 6, 2011 at 9:17 AM, Andreas Pieber <anpieber@gmail.com>
>>>>> Hey Ken,
>>>>> You might want to give Pax Exam a look for integration tests with OSGi:
>>>>> http://team.ops4j.org/wiki/display/paxexam/Pax+Exam
>>>>> Kind regards,
>>>>> Andreas
>>>>> On Tue, Dec 6, 2011 at 09:11, Ken Gilmer <kgilmer@gmail.com> wrote:
>>>>>> Hi,
>>>>>>  I'd like to begin adding some test cases to the httplite bundle.
>>>>>> I'd like my tests executed within an OSGi context so I don't have
to mock
>>>>>> anything, and the test environment is as close as possible to a real
>>>>>> instance.  Also I'd like my tests to execute as part of the maven
>>>>>> process.  Can anyone suggest an existing and somewhat current Felix
>>>>>> that does this or provide other suggestions?
>>>>>> Thanks!
>>>>>> ken
>>>> --
>>>> Karl Pauls
>>>> karlpauls@gmail.com
>>>> http://twitter.com/karlpauls
>>>> http://www.linkedin.com/in/karlpauls
>>>> https://profiles.google.com/karlpauls
>>> --
>>> Karl Pauls
>>> karlpauls@gmail.com
>>> http://twitter.com/karlpauls
>>> http://www.linkedin.com/in/karlpauls
>>> https://profiles.google.com/karlpauls
> --
> Karl Pauls
> karlpauls@gmail.com
> http://twitter.com/karlpauls
> http://www.linkedin.com/in/karlpauls
> https://profiles.google.com/karlpauls

View raw message