나는 arquillian의 초보자입니다.Arquillian이있는 Java EE Microservice 테스트
우리는 Microfly를 Wildfly 10.1.0으로 구축합니다. 우리는 SessionBean에 대한 의존성을 가진 "WAR"를 개발했습니다. SessionBean은 "JAR"로 개발됩니다. SessionBean의 인터페이스는 추가 "JAR"로 개발되어 "WildFly 모듈"로 추가됩니다. 내 문제는 내가 arquillian과 테스트를 구축해야한다는 것입니다. 관리되는 야생 플라이와 함께 작업했지만 인터페이스 클래스가 arquillian의 "test.war"에서 발견되지 않는 오류가 발생했습니다.
WildFly 모듈에 대한 종속성을 가진 arquillian의 "test.war"를 어떻게 개발할 수 있습니까?
myTestClass
package com.example.controller.dataConnector;
import javax.inject.Inject;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.example.controller.global.Global;
import com.example.ejb.interfaces.SessionBeanLogic_Interface;
import com.example.model.dataModel1;
import com.example.model.dataModel2;
@RunWith(Arquillian.class)
public class dataConnectorTest
{
@Inject
dataConnector dataConnector;
@Deployment
public static JavaArchive createShrinkWrap()
{
return ShrinkWrap.create(JavaArchive.class).addClasses(dataConnector.class, Global.class, dataModel1.class, dataModel2.class, SessionBeanLogic_Interface.class).addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
}
@Test
public void should_say_hello()
{
Assert.assertEquals("Testversuch", dataConnector.getStr_Value());
System.out.println(siebeldaten.getStr_Value());
}
}
MyArquillian.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">
<container qualifier="wildfly10" default="true">
<configuration>
<property name="jbossHome">F:/jboss/wildfly-10.1.0.Final</property>
</configuration>
</container>
</arquillian>
myPOM.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>DataFrontend</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>DataFrontend</name>
<properties>
<endorsed.dir>${project.build.directory}/endorsed</endorsed.dir>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.12.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>EJB_Logic_Interface</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.14</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
</dependency>
<dependency>
<groupId>org.wildfly.arquillian</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<version>2.0.0.Final</version>
</dependency>
</dependencies>
<build>
<plugins>
<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-ejb-plugin</artifactId>
<version>2.3</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
<archive>
<manifestEntries>
<Dependencies>com.example.Interfaces.Logic_Interface, com.example.gson.280</Dependencies>
</manifestEntries>
</archive>
</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>
</plugins>
</build>
<repositories>
<repository>
<url>http://repository.primefaces.org/</url>
<id>PrimeFaces-maven-lib</id>
<layout>default</layout>
<name>Repository for library PrimeFaces-maven-lib</name>
</repository>
</repositories>
</project>
* "하지만 인터페이스 클래스가 arquillian"*의 "test.war"에서 발견되지 않는 오류가 발생했습니다. 질문에 대한 전체 오류를 추가하십시오. – Gimby
전체 스택 트레이스를 사용하면 문제를 해결하는 데 도움이됩니다. –