首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pax-考试4无felix()方法

Pax-考试4无felix()方法
EN

Stack Overflow用户
提问于 2015-04-22 16:50:06
回答 1查看 398关注 0票数 0

我在project 3.3.0的OSGi项目中为EclipseLink测试使用了以下代码片段:

代码语言:javascript
复制
@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 4.4.0,因为Pax 3.x不使用JDK 8构建。我的问题是Pax 4不再提供方便的org.ops4j.pax.exam.CoreOptions.felix()方法。我该如何处理这个问题呢?我的目标是以尽可能少的配置运行OSGi测试。

如果删除felix()方法,将得到以下错误:

代码语言:javascript
复制
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

谢谢

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-04-22 17:08:13

felix()和其他框架选项早就被废弃了,早在Pax考试3.3.0之前,如果我没记错的话,所以我对您的版本信息感到有点惊讶。

无论如何,如果您想在Felix上运行测试,只需确保Felix是类路径上唯一的OSGi实现,仅此而已。不需要明确的选择。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29804071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档