>>>>> Steinar Bang <[email protected]>:

> Plan going forward:
>  1. Create a feature file in the test project (ie. a real artifact and
>     not a test scope thing), using karaf-maven-plugin and the above
>     three bundles as compile dependencies of the test project
>  2. Add the feature file to the pax-exam config and install the mockito
>     feature 

This worked fine in getting karaf to start and the service to be
produced, but actually using mockito mocks failed:
 java.lang.LinkageError: loader constraint violation in interface itable 
initialization: when resolving method 
"$javax.servlet.http.HttpServletRequest$$EnhancerByMockitoWithCGLIB$$22025fbe.newInstance([Ljava/lang/Class;[Ljava/lang/Object;[Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;"
 the class loader (instance of 
org/mockito/internal/creation/util/SearchingClassLoader) of the current class, 
$javax/servlet/http/HttpServletRequest$$EnhancerByMockitoWithCGLIB$$22025fbe, 
and the class loader (instance of 
org/apache/felix/framework/BundleWiringImpl$BundleClassLoader) for interface 
org/mockito/cglib/proxy/Factory have different Class objects for the type 
[Lorg/mockito/cglib/proxy/Callback; used in the signature
        at 
sun.reflect.GeneratedSerializationConstructorAccessor25.newInstance(Unknown 
Source)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at 
org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
        at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
        at 
org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:14)
        at 
org.mockito.internal.creation.cglib.ClassImposterizer.createProxy(ClassImposterizer.java:143)
        at 
org.mockito.internal.creation.cglib.ClassImposterizer.imposterise(ClassImposterizer.java:58)
        at 
org.mockito.internal.creation.cglib.ClassImposterizer.imposterise(ClassImposterizer.java:49)
        at 
org.mockito.internal.creation.cglib.CglibMockMaker.createMock(CglibMockMaker.java:24)
        at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:33)
        at org.mockito.internal.MockitoCore.mock(MockitoCore.java:59)
        at org.mockito.Mockito.mock(Mockito.java:1285)
        at org.mockito.Mockito.mock(Mockito.java:1163)
        at 
no.priv.bang.fildele.tests.FildeleIntegrationTest.testServlet(FildeleIntegrationTest.java:66)

This is the code that fails:
 
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildeleintegrationtest-java-L64

I don't have any idea how to fix this, or even if it's fixable...?

This is what I did:
 1. Added the following config to the pom of the test project:
     
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildele-tests-pom-xml-L12
     
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildele-tests-pom-xml-L106
    the pluginManagement setting in the parent, is:
     
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-parent-pom-xml-L163
 2. Added the feature repo and the feature to the pax-exam config:
     
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildeleintegrationtest-java-L44
     
https://gist.github.com/steinarb/5534a87dd42827fad7a461732d6d5684#file-fildeleintegrationtest-java-L59

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to