我正在尝试为要使用 Picketlink 部署在 Wildfly 上的 Web 应用程序编写 Arquillian 测试。我的设置在我添加 Picketlink 之前工作,看起来我可以打包和部署我的应用程序而无需任何测试(它不起作用,这就是我想要测试以便开发的原因)。这是我的部署:
@Deployment
public static WebArchive deployment () {
WebArchive w = ShrinkWrap.create (WebArchive.class, "test.war");
w = w.addPackages (true, "us.levk.willow", "org.apache.deltaspike", "org.picketlink");
w = w.addAsWebInfResource ("beans.xml", "beans.xml");
w = w.addAsResource ("persistence.xml", "META-INF/persistence.xml");
w = w.addAsWebInfResource ("jboss-web.xml", "jboss-web.xml");
w = w.setWebXML ("web.xml");
return w;
}
由于缺少大量 CDI 依赖项,运行测试会导致部署失败;此处的相关日志输出:https ://pastebin.com/sTD1x1Ag
beans.xml
添加org.apache.deltaspike.security.impl.extension.SecurityInterceptor
,jboss-web.xml
将我的应用程序绑定到上下文根,web.xml
添加 resteasy,这是arquillian.xml
:
<arquillian xmlns="http://jboss.org/schema/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Sets the protocol which is how Arquillian talks and executes the tests inside the container -->
<defaultProtocol type="Servlet 3.0" />
<!-- Configuration to be used when the WildFly managed profile is active -->
<container qualifier="widlfly-managed" default="true">
<configuration>
<property name="jbossHome">${jbossHome:target/wildfly-10.1.0.Final}</property>
</configuration>
</container>
</arquillian>