That's a good suggestion - although I am still struggling to understand how to 
view/debug the embedded felix container being started here. I don't see a 
felix.jar, so does pax embed the binaries somewhere? How can I verify what 
bundles this embedded felix installs - or is that just tallying the 
dependencies in the pom(s)?

Phil Helm | Principal Software Engineer | Global Employee Benefits
5411 Page Road, 4th Floor, C4145 | Durham, NC 27703
Office: 919.907.4118 | E-mail: [email protected]

From: [email protected] [mailto:[email protected]] On 
Behalf Of Christian Schneider
Sent: Thursday, February 12, 2015 10:26 AM
To: OSGi Developer Mail List
Subject: Re: [osgi-dev] Integration Testing framework recommendation

You can only install the bundles in pax exam. For json there is a servicemix 
bundle:
mavenBundle("org.apache.servicemix.bundles", 
"org.apache.servicemix.bundles.oro").version("2.0.8_6"),
mavenBundle("org.apache.servicemix.bundles","org.apache.servicemix.bundles.json-lib").version("2.4_1"),

The error you get sounds like duplicate packages of the specs. You should try 
to install the exact same bundles in a regular felix and check if there are 
problems.

Christian

On 12.02.2015 16:03, Helm, Phil wrote:
Thanks for the help so far Christian. I can only read so many books/blogs/docs 
before I just need to get my hands dirty - getting direct feedback is nice.

I changed to the most current version of pax.

I agree about specifying bundle file names - my problem is that not every 
dependency is an actual osgi bundle (for example, the json jar does not export 
a package). I have made the changes to mavenBundle as you suggested, but 
leaving the json jar as is (I just modified it locally to add Export-Package to 
the manifest).

I also added the depends plugin, thanks for that guidance. I wasn't sure about 
the versioning as it seemed to be in multiple places.

Anyway, (hope I am not going backwards) I am now getting a strange error that I 
hope is just a simple setup thing based on my changes:

ERROR: Bundle org.ops4j.pax.exam [1] Error starting 
link:classpath:META-INF/links/org.ops4j.pax.exam.link 
(java.lang.IncompatibleClassChangeError: Class 
org.apache.felix.framework.wiring.BundleRequirementImpl does not implement the 
requested interface org
.osgi.resource.Requirement)
java.lang.IncompatibleClassChangeError: Class 
org.apache.felix.framework.wiring.BundleRequirementImpl does not implement the 
requested interface org.osgi.resource.Requirement
        at 
org.apache.felix.framework.StatefulResolver.findProvidersInternal(StatefulResolver.java:190)
        at 
org.apache.felix.framework.ResolveContextImpl.findProviders(ResolveContextImpl.java:83)
        at 
org.apache.felix.framework.resolver.Candidates.populateRevision(Candidates.java:269)
        at 
org.apache.felix.framework.resolver.Candidates.populate(Candidates.java:155)
        at 
org.apache.felix.framework.resolver.ResolverImpl.resolve(ResolverImpl.java:91)
        at 
org.apache.felix.framework.StatefulResolver.resolve(StatefulResolver.java:412)
        at 
org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4088)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2114)
        at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1368)
        at 
org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
        at java.lang.Thread.run(Thread.java:745)

I updated the repository: https://github.com/dendron8/paxosgi

Phil Helm | Principal Software Engineer | Global Employee Benefits
5411 Page Road, 4th Floor, C4145 | Durham, NC 27703
Office: 919.907.4118 |E-mail: [email protected]<mailto:[email protected]>

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Christian Schneider
Sent: Thursday, February 12, 2015 9:00 AM
To: OSGi Developer Mail List
Subject: Re: [osgi-dev] Integration Testing framework recommendation

Not sure about the RMI problems but I see you specify the bundles with a file 
name. This is very fragile and for example I can not run your test as the files 
are not present on my machine.
Try to use mavenBundle and the maven coordinates. You should also use the 
maven-depends-plugin. It creates a file in target that pax exam uses for 
.versionAsInProject(). This means you only
need to specify the versions in the pom file.

You also should consider using the newest pax exam:
https://ops4j1.jira.com/wiki/display/PAXEXAM4/OSGi+Containers
The pax exam version 2.5 you use is quite ancient.

This is a snippet for the depends plugin:
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>depends-maven-plugin</artifactId>
                <version>1.2</version>
                <executions>
                    <execution>
                        <id>generate-depends-file</id>
                        <goals>
                            <goal>generate-depends-file</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

Christian

n 12.02.2015 14:43, Helm, Phil wrote:
Thanks for the response Christian. I separated the service code and the test 
code into two separate bundles, as well as added the ds as a dependency in the 
service project and loaded the ds bundle in the test project. Updated code (as 
well as the maven output - debug.out) is here:  
https://github.com/dendron8/paxosgi

How can I verify that the service bundle is installed? I know how to do it in a 
standalone Felix environment, but I am not sure about this pax-embeded one.

After making these changes I am getting the same error. I turned on maven debug 
(-X) in hopes I would see more meaningful messages from the Felix runtime, but 
the only Felix message I see is this

[FelixStartLevel] INFO org.ops4j.pax.exam.rbc.internal.Activator - Name, port 
or host is null. So this RBC remains inactive.

Previously I was getting an RMI timeout and I had to edit my hosts file to map 
local host (127.0.0.1) to my machine name to bypass the error.

Phil Helm | Principal Software Engineer | Global Employee Benefits
5411 Page Road, 4th Floor, C4145 | Durham, NC 27703
Office: 919.907.4118 |E-mail: [email protected]<mailto:[email protected]>

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Christian Schneider
Sent: Wednesday, February 11, 2015 3:28 PM
To: OSGi Developer Mail List
Subject: Re: [osgi-dev] Integration Testing framework recommendation

Looks like the code you want to test is inside the same project as the pax exam 
test. This will not work.

Move the test to a separate project and mae sure you also install the bundle 
that contains the service.
As your service seems to use declarative services you will also need a ds 
runtime in the pax test setup.

Christian


On 11.02.2015 20:24, Helm, Phil wrote:
Thanks Toni.

Sample code here: https://github.com/dendron8/paxosgi

Phil Helm | Principal Software Engineer | Global Employee Benefits
5411 Page Road, 4th Floor, C4145 | Durham, NC 27703
Office: 919.907.4118 |E-mail: [email protected]<mailto:[email protected]>






--

Christian Schneider

http://www.liquid-reality.de



Open Source Architect

http://www.talend.com
The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.




_______________________________________________

OSGi Developer Mail List

[email protected]<mailto:[email protected]>

https://mail.osgi.org/mailman/listinfo/osgi-dev





--

Christian Schneider

http://www.liquid-reality.de



Open Source Architect

http://www.talend.com
The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.



_______________________________________________

OSGi Developer Mail List

[email protected]<mailto:[email protected]>

https://mail.osgi.org/mailman/listinfo/osgi-dev




--

Christian Schneider

http://www.liquid-reality.de



Open Source Architect

http://www.talend.com
The information contained in this message may be CONFIDENTIAL and is for the 
intended addressee only.  Any unauthorized use, dissemination of the 
information, or copying of this message is prohibited.  If you are not the 
intended addressee, please notify the sender immediately and delete this 
message.
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to