我正在尝试为我的包创建集成测试。基本上我想模仿我在普通网络应用程序项目中的设置(其中测试在 src/test 文件夹中)
我几乎就在那里,只是当捆绑包尝试激活时出现异常
本机容器异常
Running com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.196 sec <<< FAILURE! - in com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest
whenSuppliedNullNameThenThrowException(com.grundfos.wcm.impl.HelloWorldServiceImplIntegrationTest) Time elapsed: 0.792 sec <<< ERROR!
java.lang.AbstractMethodError: org.apache.felix.framework.BundleImpl.adapt(Ljava/lang/Class;)Ljava/lang/Object; at org.ops4j.pax.exam.nat.internal.NativeTestContainer.installAndStartBundles(NativeTestContainer.java:311)
at org.ops4j.pax.exam.nat.internal.NativeTestContainer.start(NativeTestContainer.java:177)
at org.ops4j.pax.exam.spi.reactors.AllConfinedStagedReactor.invoke(AllConfinedStagedReactor.java:79)
at org.ops4j.pax.exam.junit.impl.ProbeRunner$2.evaluate(ProbeRunner.java:264)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:98)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
分叉容器异常
java.lang.ClassCastException: org.ops4j.pax.exam.inject.internal.Activator cannot be cast to org.osgi.framework.BundleActivator
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3814)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1899)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
at java.lang.Thread.run(Thread.java:745)
java.lang.ClassCastException: org.ops4j.pax.exam.raw.extender.intern.Activator cannot be cast to org.osgi.framework.BundleActivator
我尝试向他们的官方 JIRA 委员会提交,但我无权这样做:
有人可以帮我解决我的问题吗?我已经走到尽头了:(
示例项目(如果项目文件不起作用,请告诉我):
http://www.mediafire.com/download/qnh2gzgygys9982/cq-training.zip
命令: mvn clean 验证
谢谢