Я борюсь с реализацией теста Арквилиана в один простой класс.
Это ошибка, которую я получаю: java.lang.IllegalArgumentException: ArquillianServletRunner не найден. Не удалось определить ContextRoot из ProtocolMetadata, обратитесь к разработчику DeployableContainer
Мой pom.xml выглядит следующим образом
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.oraldveizi.project</groupId>
<artifactId>java-ee-app</artifactId>
<version>1.0</version>
<packaging>war</packaging>
<name>java-ee-app</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Test -->
<version.junit>4.12</version.junit>
<version.arquillian>1.2.0.1</version.arquillian>
<version.arquillian.wildfly>2.0.2.Final</version.arquillian.wildfly>
<version.shrinkwrap>1.2.6</version.shrinkwrap>
<!-- Plugins -->
<version.surefire.plugin>2.19.1</version.surefire.plugin>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.arquillian</groupId>
<artifactId>arquillian-universe</artifactId>
<version>${version.arquillian}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<!-- MySQL Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-agroal</artifactId>
<version>5.4.0.Final</version>
<type>pom</type>
</dependency>
<!-- TEST -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.arquillian.universe</groupId>
<artifactId>arquillian-junit</artifactId>
<scope>test</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jboss.shrinkwrap</groupId>
<artifactId>shrinkwrap-api</artifactId>
<version>${version.shrinkwrap}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>${version.arquillian.wildfly}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>bookstore-back</finalName>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
<configuration>
<systemPropertyVariables>
<arquillian.launch>arquillian-wildfly-remote</arquillian.launch>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<outputDirectory>${endorsed.dir}</outputDirectory>
<silent>true</silent>
<artifactItems>
<artifactItem>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>7.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>src</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
The arquillian.xml:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<arquillian xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jboss.org/schema/arquillian"
xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<container qualifier="arquillian-wildfly-remote"/>
</arquillian>
UserServices.java:
package com.oraldveizi.project.services;
import com.oraldveizi.project.DAO.interfaces.UserDAO;
import com.oraldveizi.project.controllers.UserController;
import com.oraldveizi.project.model.User;
public class UserServices {
private static UserDAO userDAO;
//private static CurrentSession session;
public UserServices() {
userDAO = new UserDAO();
}
public static void presist(User user) {
userDAO.openCurrentSessionWithTransaction();
userDAO.persist(user);
userDAO.closeCurrentSessionWithTransaction();
}
public static void update(User user) {
userDAO.openCurrentSessionWithTransaction();
userDAO.update(user);
userDAO.closeCurrentSessionWithTransaction();
}
public static void findyID(Integer id) {
userDAO.openCurrentSessionWithTransaction();
userDAO.findById(id);
userDAO.closeCurrentSessionWithTransaction();
}
}
И UserServicesTest.java:
package com.oraldveizi.project.services;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.junit.InSequence;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class UserServicesTest {
@Deployment
public static JavaArchive createDeployment() {
return ShrinkWrap.create(JavaArchive.class)
.addClass(UserServices.class)
.addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Test
public void update() throws Exception{
}
}
Что-то не так в зависимостях pom.xml?