Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cbi-dev] CBI - Tycho - Mockito - signed bundles - problem

I think I've seen a similar issue in EGit plain JUnit tests (not related to mockito though).

What happened there is the following:

1. you have two bundle jars providing the same java package (but different classes), at least one of them is signed
2. you put both of those bundle jars on a flat JVM classpath (this is what happens if you use plain maven-surefire; tycho-surefire runs test inside an OSGi runtime)

since both jars are loaded by the same classloader, the validation fails because the package is not signed consistently.

In the EGit case, using tycho-surefire instead of maven-surefire seemed to solve the problem.
I think this is because in the OSGi runtime, bundle jars are loaded by separate classloaders.

HTH
Jan




From: cbi-dev-bounces@xxxxxxxxxxx [mailto:cbi-dev-bounces@xxxxxxxxxxx] On Behalf Of Markus Knauer
Sent: Mittwoch, 7. November 2012 17:29
To: Common-build Developers discussion
Subject: [cbi-dev] CBI - Tycho - Mockito - signed bundles - problem

Hi all,

I am currently running into a problem with my Tycho-based build for RAP that is using various components from CBI, including the signing plug-in. Maybe someone has already a workaround, a good idea how to circumvent it, or maybe others are facing the same problem.

The short simplified description:
- There is a bundle A.bundle and a fragment with the test cases B.fragment.
- The jar files are signed with the new CBI signing plug-in (1.0.1)
- The tests are using Mockito...

(1) Tycho compiles A.bundle and creates the jar file
(2) tycho-pack200a, eclipse-jarsigner, and tycho-pack200b are doing their job and sign the A.bundle.jar
(3) Tycho compiles the B.fragment
(4) maven-surefire-plugin executes the plain JUnit tests from B.fragment
(4.1) Tests try to mock classes with Mockito from A.bundle but these cannot run because of this error:
'Caused by: org.apache.maven.surefire.testset.TestSetFailedException: org.eclipse.rap.rwt.osgi.internal.ApplicationLauncherImpl_Test; nested exception is java.lang.SecurityException: class "org.eclipse.rap.rwt.osgi.internal.ApplicationReferenceImpl"'s signer information does not match signer information of other classes in the same package'

A similar problem is described in [1], and [2] refers to exactly my problem.

Has anyone seen a similar problem, or has anyone a good suggestion how to solve this?

Thanks,
Markus


[1] BugĀ 349164 - Mockito cannot mock the classes under development
https://bugs.eclipse.org/bugs/show_bug.cgi?id=349164

[2] Issue 393: SecurityException when using spy() on class from signed JAR file
http://code.google.com/p/mockito/issues/detail?id=393


Back to the top