我们切换到JBoss EAP 7,这与JBoss Wildfly 10大致相同。
这是一个新版本的Arquillian,现在我正在尝试测试一切。
测试在我的本地机器上运行,在本地JBoss上运行。但是,当我尝试在应该连接到JBoss服务器(另一台机器)的构建服务器上运行它们时,测试失败。
我可以在服务器日志中看到测试后部署和删除了测试WAR。但是,在测试期间,Arquillian想要连接到localhost:
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 10.294 sec <<< FAILURE! - in itest.com.mydomain.esv.dds.bo.DDSDokumentI18NTest
testI18NKeys(itest.com.mydomain.esv.dds.bo.DDSDokumentI18NTest) Time elapsed: 1.024 sec <<< ERROR!
java.lang.IllegalStateException: Error launching test itest.com.mydomain.esv.dds.bo.DDSDokumentI18NTest public void com.mydomain.esv.util.testing.i18n.I18NTestBase.testI18NKeys()
...
Caused by: java.lang.IllegalStateException: Error launching request at http://localhost:8080/dds-adapter-api-itest/ArquillianServletRunner?outputMode=serializedObject&className=itest.com.mydomain.esv.dds.bo.DDSDokumentI18NTest&methodName=testI18NKeys. No result returned
at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.executeWithRetry(ServletMethodExecutor.java:139)
at org.jboss.arquillian.protocol.servlet.ServletMethodExecutor.invoke(ServletMethodExecutor.java:99)
at org.jboss.arquillian.container.test.impl.execution.RemoteTestExecuter.execute(RemoteTestExecuter.java:109)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
这是我的arquillian.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it is the most mature -->
<defaultProtocol type="Servlet 3.0" />
<!-- Example configuration for a remote JBoss EAP instance -->
<container qualifier="jboss-remote" default="true">
<configuration>
<property name="managementAddress">foobar.mydomain.com</property>
<property name="managementPort">9990</property>
<property name="username">admin</property>
<property name="password">password</property>
</configuration>
</container>
</arquillian>
这些是我的相关依赖项(我们使用的是JBoss EAP 7.0.4):
<dependency>
<groupId>org.jboss.bom</groupId>
<artifactId>jboss-eap-javaee7-with-tools</artifactId>
<version>7.0.4.GA</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
<version>2.2.2</version>
<exclusions>
<exclusion>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</exclusion>
<exclusion>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.11.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>2.0.0.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<version>1.1.11.Final</version>
<scope>test</scope>
</dependency>
这是测试类:
@RunWith(Arquillian.class)
public class DDSDokumentI18NTest extends DDSArquillianI18NFieldEnumSupplierTest {
/**
* {@inheritDoc}
*/
@Override
protected FieldEnumSupplier getFieldEnumSupplier() {
return new DDSDokument();
}
}
及其基类:
@RunWith(Arquillian.class)
public abstract class DDSArquillianI18NFieldEnumSupplierTest extends FieldEnumSupplierI18NTestBase<I18NService> {
@Inject
private I18NService i18nService;
/**
* Creates the deployment for the test.
* @return the deployment
*/
@Deployment
public static Archive<?> createDeployment() {
return DDSArquillianIntegrationTest.createCoreDeployment();
}
/**
* {@inheritDoc}
*/
@Override
protected Map<String, String> getI18NKeysAndValues() {
final Map<I18NLanguage, Map<String, String>> values = getService().getValues(DDSArquillianI18NTest.I18N_PATTERNS);
return values.get(I18NLanguage.GERMAN);
}
/**
* {@inheritDoc}
*/
@Override
public I18NService getService() {
return this.i18nService;
}
}
我做错了什么?
答案 0 :(得分:0)
答案可以找到here。
您需要在arquillian.xml
。
<container qualifier="wildfly" default="true">
<protocol type="Servlet 3.0">
<property name="host">test.example.com</property>
<property name="port">8181</property>
</protocol>
</container>