Jakarta ee JUnit/Arquillian:运行托管的Wildfly 8.1容器

Jakarta ee JUnit/Arquillian:运行托管的Wildfly 8.1容器,jakarta-ee,junit,wildfly,jboss-arquillian,Jakarta Ee,Junit,Wildfly,Jboss Arquillian,我正在尝试运行一个简单的测试用例: 关于如何在托管的Wildfly 8容器上运行JavaEE集成测试,是否有一套清晰的说明? 我只想通过mvn test在一个新下载的Wildfly容器中运行一个简单的测试用例 对于嵌入式案例,maven dependency插件的unpack目标可用于下载Wildfly并自动解压缩 我想让容器得到管理,确保测试用例有一个单独的JVM,由Arquillian自己管理 现在我必须在哪里引用Wildfly文件夹? 1) 我可以通过以下方式在我的test/resou

我正在尝试运行一个简单的测试用例:

关于如何在托管的Wildfly 8容器上运行JavaEE集成测试,是否有一套清晰的说明?
  • 我只想通过
    mvn test
    在一个新下载的Wildfly容器中运行一个简单的测试用例

  • 对于嵌入式案例,maven dependency插件的
    unpack
    目标可用于下载Wildfly并自动解压缩

  • 我想让容器得到管理,确保测试用例有一个单独的JVM,由Arquillian自己管理

现在我必须在哪里引用Wildfly文件夹? 1) 我可以通过以下方式在我的
test/resource/arquillian.xml中完成:

<container qualifier="arquillian-wildfly8-managed" default="true">
    <configuration>
        <property name="jbossHome">target/wildfly-8.1.0.Final</property>
        <property name="modulePath">target/wildfly-8.1.0.Final/modules</property>
    </configuration>
</container>
。。。i、 e.找不到类

摘自我的pom文件:

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
        </plugin>
    </plugins>
</build>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <version>1.1.5.Final</version>
            <artifactId>arquillian-bom</artifactId>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <!-- <version>1.1.5.Final</version> -->
        <scope>test</scope>
    </dependency>
</dependencies>

    <profile>
        <id>arquillian-wildfly8-managed</id>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-6.0</artifactId>
                <version>3.0.1.Final</version>
                <type>pom</type>
                <scope>test</scope>
            </dependency>
            <!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) -->
            <dependency>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
                <version>2.7.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-arquillian-container-managed</artifactId>
                <version>8.1.0.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <!-- You need the maven dependency plugin to download locally a zip 
                            with the server, unless you provide your own, it will download under the 
                            /target directory -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <version>8.1.0.Final</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </profile>

maven编译器插件
2.3.2
1.6
1.6
maven surefire插件
2.17
org.jboss.arquillian
1.1.5.最终版本
阿奎利安bom
进口
聚甲醛
朱尼特
朱尼特
4.8.1
测试
org.jboss.arquillian.junit
arquillian junit容器
测试
arquillian-wildfly8-managed
org.jboss.spec
jboss-javaee-6.0
3.0.1.最终版本
聚甲醛
测试
沙兰
沙兰
2.7.1
测试
野生蝇
wildfly arquillian容器管理
8.1.0.1最终版本
测试
org.apache.maven.plugins
maven依赖插件
2.8
打开
过程测试类
打开
野生蝇
野蝇区
8.1.0.1最终版本
拉链
假的
目标

我很困惑。我无法找到一个简单的设置来通过Arquillian/Wildfly以正确的方式运行测试用例。您有什么想法、提示或链接吗?

我强烈建议不要自动下载包含服务器的.zip文件,而是自己提供服务器实例

我可以在test/resource/arquillian.xml中完成

是的,这就是方法

另一种方法是配置surefire插件的

没必要。不要忘记将Arquillian.xml文件作为pom中的测试资源提供:

<testResources>
     <testResource>
           <directory>path/to/resources</directory>
     </testResource>

非常感谢你的提示。因此,据我所知,服务器不应该位于repos/target目录中,而应该位于其他任何地方,对吗?我将立即测试您的提示,非常感谢!是的,不在回购协议中。非常感谢你的提示。我决定跳过嵌入式容器实现,并尝试使用托管/远程容器。这真的不管用。无法连接。您或其他人是否可能有使用WildFly托管容器的aquillian链接的完整工作示例?您是否可以使用已做的更改和新的结果/错误更新您的问题?这里有一个关于使用arquillian设置wildfly的非常好的示例。它几乎包含了你从乞讨以来一直在做的事情。>我强烈建议不要自动下载包含服务器的.zip文件,而是自己提供一个服务器实例@我不明白。那么Maven项目是如何可移植的呢?
<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
        </plugin>
    </plugins>
</build>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <version>1.1.5.Final</version>
            <artifactId>arquillian-bom</artifactId>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.1</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <!-- <version>1.1.5.Final</version> -->
        <scope>test</scope>
    </dependency>
</dependencies>

    <profile>
        <id>arquillian-wildfly8-managed</id>
        <dependencies>
            <dependency>
                <groupId>org.jboss.spec</groupId>
                <artifactId>jboss-javaee-6.0</artifactId>
                <version>3.0.1.Final</version>
                <type>pom</type>
                <scope>test</scope>
            </dependency>
            <!-- Required by jboss-javaee-6.0:3.0.2.Final (https://issues.jboss.org/browse/JBBUILD-708) -->
            <dependency>
                <groupId>xalan</groupId>
                <artifactId>xalan</artifactId>
                <version>2.7.1</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.wildfly</groupId>
                <artifactId>wildfly-arquillian-container-managed</artifactId>
                <version>8.1.0.Final</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <pluginManagement>
                <plugins>
                    <plugin>
                        <!-- You need the maven dependency plugin to download locally a zip 
                            with the server, unless you provide your own, it will download under the 
                            /target directory -->
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-dependency-plugin</artifactId>
                        <version>2.8</version>
                        <executions>
                            <execution>
                                <id>unpack</id>
                                <phase>process-test-classes</phase>
                                <goals>
                                    <goal>unpack</goal>
                                </goals>
                                <configuration>
                                    <artifactItems>
                                        <artifactItem>
                                            <groupId>org.wildfly</groupId>
                                            <artifactId>wildfly-dist</artifactId>
                                            <version>8.1.0.Final</version>
                                            <type>zip</type>
                                            <overWrite>false</overWrite>
                                            <outputDirectory>target</outputDirectory>
                                        </artifactItem>
                                    </artifactItems>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
    </profile>
<testResources>
     <testResource>
           <directory>path/to/resources</directory>
     </testResource>
<dependency>
                    <groupId>org.jboss.spec</groupId>
                    <artifactId>jboss-javaee-7.0</artifactId>
                    <version>1.0.0.Final</version>
                    <type>pom</type>
                    <scope>provided</scope>
                </dependency>