org.eclipse.scout.mockito-all ??? [message #1222779] |
Sat, 21 December 2013 10:47 |
Jeremie Bresson Messages: 1252 Registered: October 2011 |
Senior Member |
|
|
=== Background ===
- We want to use Mockito in our tests for Scout RT (Bug 409461).
- Mockito relies on hamcrest and objenesis and is distributed as fat jar distribution (mockito-all-1.9.5.jar) or as separate-jars distribution (mockito-core-1.9.5.jar + hamcrest.core-1.1.0.jar and objenesis-1.0.0.jar)
- Approved CQ 7600 allows to use mockito-core-1.9.5
- Thanks to Stephan Leicht mockito-core-1.9.5 is already available in Orbit: org.mockito_1.9.5.201306061252.jar (Integration build).
=== Problem ===
It is not possible to use the Orbit mockito, hamcrest and objenesis Bundles together in a tycho build.
See the Maven stack trace at the end of this message.
=== Possible solution ===
- Create a new bundle org.eclipse.scout.mockito-all, containing:
* mockito-core-1.9.5.jar from mockito.org (Corresponding to the CQ 0000)
* org.hamcrest.core_1.1.0.v20090501071000.jar from Eclipse Orbit
* org.objenesis_1.0.0.v201105211943.jar from Eclipse Orbit
- org.eclipse.scout.mockito-all isn't in any scout feature, it will not be distributed from the Scout project to the outside (exactly like test fragments).
- all tests fragments that requires mockito declare an additional bundle dependency
- org.eclipse.scout.mockito-all is built with the "testing-build" profile of the Scout RT build.
I have pushed this solution on my feature branch. features/jbr/mockito_bug409461
Content of the org.eclipse.scout.mockito-all Bundle:
org.eclipse.scout.mockito-all
| .classpath
| .project
| build.properties
| pom.xml
| trace.txt
|
+---.settings
| org.eclipse.jdt.core.prefs
|
+---bin
+---lib
| mockito-core-1.9.5.jar
| org.hamcrest.core_1.1.0.v20090501071000.jar
| org.objenesis_1.0.0.v201105211943.jar
|
+---META-INF
| MANIFEST.MF
|
\---src
=== Side Note 1 ===
I have tried to use the mockito version from orbit:
org.mockito-1.9.5.v201311280930.jar instead of mockito-core-1.9.5.jar
This should be the same, but with the version from Orbit, I get:
Caused by: java.lang.SecurityException: class "org.eclipse.scout.rt.client.ui.basic.cell.ICellObserver$$EnhancerByMockitoWithCGLIB$$d9869715"'s signer information does not match signer information of other classes in the same package
According to this stackoverflow question: Java SecurityException : signer information does not match, there is a problem with the cglib library.
If I unsign the Orbit jar, the SecurityException is gone.
=== Side Note 2 ===
As pointed out by Markus Keller (Bug 403676#c2) a good move could be to fix the hamcrest dendency problem in the mockito project itself.
This is something that is discussed on the mockito google group, and they have open issues that goes in this direction (for a version 2 of mockito).
=== Maven stack trace ===
Maven stacktrace if the Orbit bundle org.mockito-1.9.5.v201311280930.jar is in the target platform, without the proposed org.eclipse.scout.mockito-all bundle.
[ERROR] Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle org.eclipse.scout.rt.client.test cannot be resolved
[ERROR] Resolution errors:
[ERROR] Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
[ERROR] Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
[ERROR] Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
[ERROR] -> [Help 1]
org.apache.maven.InternalErrorException: Internal error: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle org.eclipse.scout.rt.client.test cannot be resolved
Resolution errors:
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:168)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.RuntimeException: org.osgi.framework.BundleException: Bundle org.eclipse.scout.rt.client.test cannot be resolved
Resolution errors:
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
at org.eclipse.tycho.core.osgitools.OsgiBundleProject.getResolverState(OsgiBundleProject.java:258)
at org.eclipse.tycho.core.osgitools.OsgiBundleProject.resolveClassPath(OsgiBundleProject.java:159)
at org.eclipse.tycho.core.resolver.DefaultTychoDependencyResolver.resolveProject(DefaultTychoDependencyResolver.java:122)
at org.eclipse.tycho.core.maven.TychoMavenLifecycleParticipant.afterProjectsRead(TychoMavenLifecycleParticipant.java:75)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:274)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
... 11 more
Caused by: org.osgi.framework.BundleException: Bundle org.eclipse.scout.rt.client.test cannot be resolved
Resolution errors:
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
Bundle org.eclipse.scout.rt.client.test - Missing Constraint: Import-Package: org.hamcrest; version="[1.3.0,2.0.0)"
at org.eclipse.tycho.core.osgitools.EquinoxResolver.assertResolved(EquinoxResolver.java:286)
at org.eclipse.tycho.core.osgitools.EquinoxResolver.newResolvedState(EquinoxResolver.java:72)
at org.eclipse.tycho.core.osgitools.OsgiBundleProject.getResolverState(OsgiBundleProject.java:256)
... 16 more
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/InternalErrorException
[Updated on: Sat, 21 December 2013 10:53] Report message to a moderator
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03681 seconds