Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] Setting a custom bundle configuration with tycho & surefire?

I work with Scott and wanted to report that the fix to this is to add dependencies in the configuration block. The reference card neglects to mention that for the bundle start level.

Jay

On Jun 19, 2012 3:20 PM, "shull3" <shull3@xxxxxxx> wrote:
Hello,

I am trying to execute a JUnit test that requires bundles to be started at with specific run levels (Eclipse Gemini and javax.persistence). In Eclipse, this works fine with a custom run configuration, but it fails when I build I with Tycho. I have edited my parent pom.xml to include a list of all of the bundles that need to be started in advance using the instructions on the Tycho Reference card, http://wiki.eclipse.org/Tycho/Reference_Card#Bundle_start_level.

Unfortunately this fails with an error that was fixed in Eclipse by setting the bundle start levels, (testPersistToDatabase.PersistenceException: No Persistence provider for EntityManager named gov.ornl.nice.niceitem).

The test application package, gov.ornl.nice.niceitem.test (in particular, ItemDatabaseTester.java within that package),  has a customized launch configuration within Eclipse to run the JUnit-Plugin tests to handle the JPA plugin startup requirements.  The launch file enables the required bundles to be started before the runtime of the unit test.  This allows for a successful test run of the methods on Item. I believe this is due to an incorrectly configured pom file and that I may not be enabling the bundles properly.

Attached is a working launch file configuration and the current working parent pom file.  The launch file launches the Junit plugin tests correctly, whereas the pom file does not.

Launch File: http://niceproject.svn.sourceforge.net/viewvc/niceproject/branches/JPABranch/gov.ornl.nice.niceitem.test/gov.ornl.nice.niceitem.test.jpalauncher_minimal.launch?revision=1021&view=markup
Pom.xml: http://niceproject.svn.sourceforge.net/viewvc/niceproject/trunk/build/gov.ornl.nice.build/eclipse/pom.xml?revision=1021&view=markup

Any suggestions on how to fix this? Can anyone point me to an example of configuring JUnit/Surefire to load bundles at a certain start level?

Scott

PS:  I have tried the following edit to the pom file.  It does not seem to be the correct course of action.  The pom file probably needs more than this for the Gemini-JPA to work.

<plugin>
                <groupId>org.eclipse.tycho</groupId>
                <artifactId>tycho-surefire-plugin</artifactId>
                <version>${tycho-version}</version>
                <configuration>
<--- New Stuff --->
                    <bundleStartLevel>
                        <bundle>
                        <id>org.eclipse.osgi</id>
                        <level>-1</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>javax.persistence</id>
                        <level>1</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.apache.derby</id>
                        <level>2</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>osgi.enterprise</id>
                        <level>2</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.gemini.dbaccess.derby</id>
                        <level>2</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.gemini.jpa</id>
                        <level>2</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.persistence.antlr</id>
                        <level>3</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.persistence.asm</id>
                        <level>3</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.persistence.core</id>
                        <level>3</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.persistence.jpa</id>
                        <level>3</level>
                        <autoStart>true</autoStart>
                        </bundle>
                        <bundle>
                        <id>org.eclipse.equinox.simpleconfigurator</id>
                        <level>1</level>
                        <autoStart>true</autoStart>
                        </bundle>
                    </bundleStartLevel>
                    <includes>
                        <include>**/*Tester.class</include>
                    </includes>
                    <argLine>${ui.test.vmargs}</argLine>
                </configuration>
            </plugin>




_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user


Back to the top