2015-04-22 69 views
0

我一直在使用中的EclipseLink項目OSGi的測試與大同考試3.3.0下面的代碼片段:PAX-4考試沒有菲利克斯()方法

@Configuration 
public static Option[] config() { 
    return options(
      repositories("http://repo1.maven.org/maven2"), 
      mavenBundle().groupId("org.osgi").artifactId("org.osgi.compendium").version("4.3.0"), 
      mavenBundle().groupId("org.eclipse.persistence").artifactId("org.eclipse.persistence.asm") 
        .version("2.5.1"), 
      //JAXB API 
      bundle("file:" + PLUGINS_DIR + "javax.xml.bind_2.2.12.v201410011542.jar"), 
      //WS API 
      bundle("file:" + PLUGINS_DIR + "javax.ws.rs_1.1.1.v20101004-1200.jar"), 
      //EclipseLink bundles 
      bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.moxy_2.7.0." + QUALIFIER + ".jar"), 
      bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.core_2.7.0." + QUALIFIER + ".jar"), 
      bundle("file:" + PLUGINS_DIR + "org.eclipse.persistence.asm_5.0.1.v201405080102.jar"), 

      junitBundles(), 
      felix()); 
} 

現在,我們切換構建爲JDK 8和我正在使用Pax Exam 4.4.0,因爲Pax Exam 3.x不能與JDK 8一起構建。我的問題是Pax Exam 4不再提供方便的org.ops4j.pax.exam.CoreOptions.felix()方法。我該如何解決這個問題?我的目標是以儘可能少的配置運行OSGi測試。

如果我刪除菲利克斯()方法中,我得到以下錯誤:

Running org.eclipse.persistence.testing.osgi.OSGiBundleTest 
[main] INFO org.ops4j.pax.exam.spi.DefaultExamSystem - Pax Exam System (Version: 4.4.0) created. 
[main] INFO org.ops4j.pax.exam.junit.impl.ProbeRunner - creating PaxExam runner for class org.eclipse.persistence.testing.osgi.OSGiBundleTest 
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.167 sec <<< FAILURE! 
initializationError(org.eclipse.persistence.testing.osgi.OSGiBundleTest) Time elapsed: 0.01 sec <<< ERROR! 
org.ops4j.pax.exam.TestContainerException: No service org.osgi.framework.launch.FrameworkFactory found in META-INF/services on classpath 

感謝

回答

3

felix()和其他框架選項在很久以前已經過時,大同考試3.3之前。 0,如果我沒有記錯,所以我對你的版本信息感到有點驚訝。

無論如何,如果您想在Felix上運行測試,只需確保Felix是您的類路徑中唯一的OSGi實現,就是這樣。不需要明確的選項。