Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gemini » Spring OSGI Testing Framework
Spring OSGI Testing Framework [message #915945] Tue, 18 September 2012 05:15 Go to next message
Thorsten Schlathölter is currently offline Thorsten Schlathölter
Messages: 208
Registered: February 2012
Location: Düsseldorf
Senior Member
Hi,
I have a question regarding the Spring Osgi Testing Framework (spring-osgi-test). The base test class uses a local maven repository to resolve the framework bundles needed to be installed in the osgi platform. I have not much experience with maven and I am having a hard time setting up a maven project with the respective dependencies. Does somebody has an example pom to be used and an example settings.xml that shows the required repositories?

Regards,
Thorsten

Re: Spring OSGI Testing Framework [message #916036 is a reply to message #915945] Tue, 18 September 2012 08:46 Go to previous messageGo to next message
Thorsten Schlathölter is currently offline Thorsten Schlathölter
Messages: 208
Registered: February 2012
Location: Düsseldorf
Senior Member
Meanwhile I found the following valuable information:

http://static.springsource.org/spring/docs/upgrade/spring3/html/ch02s07.html

Which states that one has to use the SpringSource EBR in conjunction with OSGI which I did not. EBR and maven central have different naming conventions. The maven central repository for example hosts the org.springframework.osgi:spring-osgi-test artifact but that artifact has dependencies of type org.springframework:org.springframework.test, which is EBR style. This artifact is not hosted by maven central. At least not with that artifactId. The artifactId in maven central is spring-test. Using the EBR I managed to run my first test-case.

Since there are a couple of reads for this thread but no comments I wonder if it is really a good idea to use the OSGI Testing Framework. Is that maybe old-fashion and testing should be performed differently?

Regards,
Thorsten
Re: Spring OSGI Testing Framework [message #920396 is a reply to message #916036] Sat, 22 September 2012 22:28 Go to previous messageGo to next message
Aaron Whiteside is currently offline Aaron Whiteside
Messages: 3
Registered: January 2012
Junior Member
Hi Thorsten,

spring-osgi-test is no longer maintained, it has become gemini-blueprint-test.

<dependency>
<groupId>org.eclipse.gemini.blueprint</groupId>
<artifactId>gemini-blueprint-test</artifactId>
<version>1.0.2.RELEASE</version>
</dependency>

Alas at the moment Gemini Blueprint is not deployed to any official Maven repository (so this dependency won't work without manual intervention), rest assured we are working on getting it out there.

In the meantime you could clone the project source and # mvn install the 1.0.2.RELEASE version. This will make it available locally to use as a dependency for projects on your machine. Alternatively if have a company wide Maven repository you could deploy it there for everyone (in your company) to use.

From what I can tell from working with Blueprint and it's integration tests, it's not really intended to be used outside of the project. But if you still want to try, some of this information might be of help to you.

Examples of its usage can also be found under gemini-blueprint/integration-tests/tests.

As you mentioned it looks for bundles to deploy, for tests/ing, from the local Maven repository. This means ~/.m2/repository.

This local maven repository is used by Maven to stage artifacts from builds, so they can be resolved and used as dependencies. Maven will install project artifacts to its local repo if you run # mvn install.

I recommend you read through the Maven lifecycle guide, as the lifecycle is very important regarding how Maven works.

h t t p ://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

If your tests extend AbstractConfigurableBundleCreatorTests you can build bundles dynamically from within the test, skipping the local Maven repo altogether.

See the javadoc/code on AbstractOnTheFlyBundleCreatorTests for more details.

I am sorry I cannot be more specific as I am still learning the in's and out's of Blueprint. But I hope I have given you something useful.

As for EBR that is what some OSGi platforms use to resolve bundles and their dependencies automatically. Think of yum for Redhat or apt-get for Ubuntu.. As far as I know it is not used by the blueprint test framework.

If you have any more questions, I'll be happy to try and help some more.

Regards,
Aaron
Re: Spring OSGI Testing Framework [message #923839 is a reply to message #920396] Wed, 26 September 2012 04:36 Go to previous message
Thorsten Schlathölter is currently offline Thorsten Schlathölter
Messages: 208
Registered: February 2012
Location: Düsseldorf
Senior Member
Thanks a lot for that detailed description. I started out with osgi-test because it was mentioned in the spring-osgi documentation. After a while a also realized that osgi-test is not really up to date. Actually I am using maven tycho now since tycho also supports JUnit4.
After setting up a local updatesite which provides my target platform, the tests are properly run by tycho.

Regards,
Thorsten
Previous Topic:required property 'bundleContext' has not been set
Next Topic:Gemini DBAccess 1.1.0 Milestone 3
Goto Forum:
  


Current Time: Fri Aug 01 07:58:17 EDT 2014

Powered by FUDForum. Page generated in 0.01543 seconds