问题
I am trying to test a Service in my web app with JUnit and Arquillian but when I launch the test, console show the following error:
java.lang.IllegalStateException: Error launching test at http://127.0.0.1:8080/avisoLegalTest/ArquillianServletRunner?outputMode=serializedObject&className=es.dia.altatienda.service.AvisoLegalServiceTest&methodName=findActivo&cmd=event. Got 302 (Found)
My Code:
JUnit test:
@RunWith(Arquillian.class)
@SpringWebConfiguration
public class AvisoLegalServiceTest {
@Autowired
AvisoLegalService avisoLegalService;
/**
* <p>
* Creates the test deployment.
* </p>
*
* @return the test deployment
*/
@Deployment
@OverProtocol("Servlet 3.0")
public static WebArchive createTestArchive() {
System.setProperty(
MavenSettingsBuilder.ALT_GLOBAL_SETTINGS_XML_LOCATION,
"C:\\DEVELOPMENT_ENV\\TOOLS\\MAVEN\\apache-maven-3.3.9\\conf\\settings.xml");
System.setProperty(MavenSettingsBuilder.ALT_USER_SETTINGS_XML_LOCATION,
"C:\\DEVELOPMENT_ENV\\TOOLS\\MAVEN\\apache-maven-3.3.9\\conf\\settings.xml");
return Deployments.createDeployment();
}
@Test
public void findActivo() {
try {
AvisoLegal avisoLegal = avisoLegalService.findActivo();
assertNotNull(avisoLegal);
} catch (IOException e) {
assertFalse(e.getMessage(), Boolean.FALSE);
}
}
}
My 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">
<defaultProtocol type="Servlet 3.0"/>
<!-- Configuration to be used when the WidlFly remote profile is active -->
<container qualifier="widlfly-remote" default="true">
<configuration>
<property name="managementAddress">127.0.0.1</property>
<property name="managementPort">9990</property>
<property name="username">admin</property>
<property name="password">123456</property>
</configuration>
<protocol type="Servlet 3.0">
<property name="host">127.0.0.1</property>
<property name="port">8080</property>
</protocol>
</container>
</arquillian>
My pom dependencies:
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.11.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.core</groupId>
<artifactId>arquillian-core-api</artifactId>
<version>1.1.11.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-service-deployer-spring-3</artifactId>
<version>1.0.0.Beta3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-service-integration-spring-javaconfig</artifactId>
<version>1.0.0.Beta3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.2.1.Final</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-server</artifactId>
<version>8.2.1.Final</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>jboss-logging</artifactId>
<groupId>org.jboss.logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-service-integration-spring-inject</artifactId>
<version>1.0.0.Beta3</version>
</dependency>
I need to test the service with Arquillian because I have activeMQ configuration (queues) over my Wildfly Server.
My project work with: Spring 4.1.4.RELEASE (Java based configuration), Java 1.8 and Wildfly 10.1.0.
Any ideas about that could be happening? Thanks in advanced.
来源:https://stackoverflow.com/questions/40736894/arquillian-got-302-found