Running JUnit Tests in eclipse
ascheerer Feb 5, 2010 10:57 AMHello,
i would like to run a functional junit test against the equinox framework within eclipse using the vm argument -Dframework=equinox. But I get the following log error output showing, that the jboss osgi framework is used to load the equinox util and services bundles which results in a execution environment mismatch:
15:23:26,554 INFO [VFSCacheFactory] Using VFSCache [NoopVFSCache] 15:23:26,600 INFO [CopyMechanism] VFS temp dir: /tmp 15:23:28,561 INFO [OSGiBundleManager] null - null 15:23:28,581 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=1 classes=[org.osgi.service.startlevel.StartLevel]} 15:23:28,638 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=2 classes=[org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService]} 15:23:28,641 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=3 classes=[org.osgi.service.packageadmin.PackageAdmin]} 15:23:28,645 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=4 classes=[org.jboss.osgi.spi.service.MicrocontainerService]} 15:23:28,669 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=5 classes=[org.jboss.osgi.deployment.deployer.DeploymentRegistryService]} 15:23:28,675 INFO [FrameworkEventsPluginImpl] Service REGISTERED: Service{id=6 classes=[org.jboss.osgi.deployment.deployer.DeployerService]} 15:23:28,676 INFO [FrameworkEventsPluginImpl] Bundle STARTED: Bundle{system.bundle-0.0.0} 15:23:28,791 INFO [FrameworkEventsPluginImpl] Bundle INSTALLED: Bundle{org.eclipse.osgi.services-3.2.0.v20090520-1800} 15:23:28,910 INFO [FrameworkEventsPluginImpl] Bundle INSTALLED: Bundle{org.eclipse.osgi.util-3.2.0.v20090520-1800} 15:23:28,941 ERROR [OSGiBundleManager] Cannot find any of the required execution environments [OSGi/Minimum-1.2, CDC-1.1/Foundation-1.1, J2SE-1.4], we have: J2SE-1.5, JavaSE-1.6 15:23:28,941 ERROR [OSGiBundleManager] Cannot find any of the required execution environments [OSGi/Minimum-1.2, CDC-1.1/Foundation-1.1, J2SE-1.4], we have: J2SE-1.5, JavaSE-1.6 15:23:28,941 ERROR [PackageAdminImpl] Controller could not resolve: [Bundle{org.eclipse.osgi.services-3.2.0.v20090520-1800}, Bundle{org.eclipse.osgi.util-3.2.0.v20090520-1800}] 15:23:29,011 INFO [FrameworkEventsPluginImpl] Bundle UNINSTALLED: Bundle{org.eclipse.osgi.util-3.2.0.v20090520-1800} 15:23:29,051 INFO [FrameworkEventsPluginImpl] Bundle UNINSTALLED: Bundle{org.eclipse.osgi.services-3.2.0.v20090520-1800} 15:23:29,053 INFO [FrameworkEventsPluginImpl] Service UNREGISTERING: Service{id=4 classes=[org.jboss.osgi.spi.service.MicrocontainerService]} 15:23:29,054 INFO [FrameworkEventsPluginImpl] Service UNREGISTERING: Service{id=3 classes=[org.osgi.service.packageadmin.PackageAdmin]} 15:23:29,055 INFO [FrameworkEventsPluginImpl] Service UNREGISTERING: Service{id=2 classes=[org.jboss.osgi.deployment.interceptor.LifecycleInterceptorService]} 15:23:29,056 INFO [FrameworkEventsPluginImpl] Service UNREGISTERING: Service{id=1 classes=[org.osgi.service.startlevel.StartLevel]}
I use the following vm arguments to run the test:
-Dlog4j.configuration=log4j-console.xml -Dorg.jboss.osgi.husky.Invoker=org.jboss.osgi.husky.internal.OSGiInvoker -Dtest.archive.directory=${workspace_loc:jboss-osgi-testsuite-functional/target}/test-libs -Djboss.osgi.framework.properties=jboss-osgi-equinox.properties -Dframework=equinox
Running the test with maven and equinox works fine:
svnm134@PC00295:~/proj/jboss-osgi/subversion_home/trunk/testsuite/functional$ mvn -Dtest=StartLevelTestCase -Dframework=equinox -Dlog4.configuration=log4j-console.xml install [...] ------------------------------------------------------- T E S T S ------------------------------------------------------- Running org.jboss.test.osgi.service.startlevel.StartLevelTestCase 16:12:21,300 INFO [VFSCacheFactory] Using VFSCache [NoopVFSCache] 16:12:21,352 INFO [CopyMechanism] VFS temp dir: /tmp 16:12:21,434 INFO [EquinoxBootstrapProvider] JBossOSGi Equinox - 3.5.1 16:12:22,449 INFO [ServiceActivator] StartLevel service: org.eclipse.osgi.framework.internal.core.StartLevelManager Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.631 sec Results : Tests run: 1, Failures: 0, Errors: 0, Skipped: 0 [...]
I looked at the system properties maven sets before executing the tests, but i was not able to find a property that solves the problem.
Is there a way to run unit tests in eclipse using a different osgi framework at all? That would be great!
-
runconfiguration.png 90.5 KB