Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Arquillian功能测试中使用Maven耳伪影?_Maven_Jakarta Ee_Jboss Arquillian_Shrinkwrap_Arquillian Drone - Fatal编程技术网

如何在Arquillian功能测试中使用Maven耳伪影?

如何在Arquillian功能测试中使用Maven耳伪影?,maven,jakarta-ee,jboss-arquillian,shrinkwrap,arquillian-drone,Maven,Jakarta Ee,Jboss Arquillian,Shrinkwrap,Arquillian Drone,到目前为止,我遇到的所有示例都使用Arquillian的@Deployment(testable=false)公共静态存档createDeployment()来构建自己的WebArchive或EnterpriseArchive,从而可以快速、独立地测试应用程序的各个部分。然而,据我所知,在安装阶段完成后,直接从Maven测试生成的EAR(在多模块Java EE设置中)也是有意义的,即在EAR组件之后运行的单独模块中,例如使用 @Deployment(testable = false) publi

到目前为止,我遇到的所有示例都使用Arquillian的
@Deployment(testable=false)公共静态存档createDeployment()
来构建自己的
WebArchive
EnterpriseArchive
,从而可以快速、独立地测试应用程序的各个部分。然而,据我所知,在
安装
阶段完成后,直接从Maven测试生成的EAR(在多模块Java EE设置中)也是有意义的,即在EAR组件之后运行的单独模块中,例如使用

@Deployment(testable = false)
public static Archive<?> createDeployment() {
    EnterpriseArchive retValue = Maven.configureResolver().workOffline().resolve("richtercloud:arquillian-ear-it-ear:ear:1.0-SNAPSHOT").withoutTransitivity().asSingle(EnterpriseArchive.class);
    retValue.writeTo(System.out, Formatters.VERBOSE);
    return retValue;
}
此操作当前失败,因为注入的部署URL忽略了应用程序的
上下文路径
,从而导致对
索引的请求。xhtml
失败,因为
请求的资源不可用
和HTTP错误404

有趣的是,EAR的web模块出现在本地Maven缓存安装中,但在清单中缺失。在使用
retValue.addAsModule(Maven.configureResolver().workffline().resolve(“richtercloud:arquillian ear it web:war:1.0-SNAPSHOT”).withTransitivity().asSingle(WebArchive.class))显式添加它之后,情况仍然如此我当时一点也不懂。也许我误解了保鲜膜解决的问题

版本是

<properties>
    <powermock.version>1.7.0RC4</powermock.version>
    <version.org.jboss.arquillian>1.1.5.Final</version.org.jboss.arquillian>
    <version.org.wildfly>8.1.0.Final</version.org.wildfly>
    <version.junit>4.12</version.junit>
    <browser>phantomjs</browser>
</properties>
<dependencies>
    <dependency>
        <groupId>richtercloud</groupId>
        <artifactId>arquillian-ear-it-jar</artifactId>
        <version>1.0-SNAPSHOT</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.primefaces</groupId>
        <artifactId>primefaces</artifactId>
        <version>6.1</version>
    </dependency>
    <dependency>
        <groupId>net.glxn</groupId>
        <artifactId>qrgen</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>richtercloud</groupId>
        <artifactId>validation-tools</artifactId>
        <version>1.0-SNAPSHOT</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.5</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>xerces</groupId>
        <artifactId>xercesImpl</artifactId>
        <version>2.11.0</version>
        <scope>test</scope>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.2.2</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>${powermock.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>${powermock.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.sf.jmimemagic</groupId>
        <artifactId>jmimemagic</artifactId>
        <version>0.1.3</version>
        <exclusions>
            <exclusion>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
            </exclusion>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
            </exclusion>
            <exclusion>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.imgscalr</groupId>
        <artifactId>imgscalr-lib</artifactId>
        <version>4.2</version>
    </dependency>
    <dependency>
        <groupId>org.ocpsoft.prettytime</groupId>
        <artifactId>prettytime</artifactId>
        <version>3.2.7.Final</version>
    </dependency>
    <dependency>
        <groupId>org.bitbucket.cowwoc</groupId>
        <artifactId>diff-match-patch</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>org.rauschig</groupId>
        <artifactId>jarchivelib</artifactId>
        <version>0.7.1</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>

    <!-- Java EE integration testing -->
    <dependency>
        <groupId>org.jboss.shrinkwrap.descriptors</groupId>
        <artifactId>shrinkwrap-descriptors-api-javaee</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.shrinkwrap.resolver</groupId>
        <artifactId>shrinkwrap-resolver-depchain</artifactId>
        <type>pom</type>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.graphene</groupId>
        <artifactId>graphene-webdriver</artifactId>
        <version>2.3.2</version>
        <type>pom</type>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>com.codeborne</groupId>
                <artifactId>phantomjsdriver</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>htmlunit-driver</artifactId>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.htmlunit</groupId>
        <artifactId>htmlunit</artifactId>
        <version>2.26</version>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
    </dependency>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-core</artifactId>
        <version>2.9.2</version>
    </dependency>
    <dependency>
        <groupId>richtercloud</groupId>
        <artifactId>jsf-validation-service</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>richtercloud</groupId>
        <artifactId>selenium-tools</artifactId>
        <version>1.0-SNAPSHOT</version>
    </dependency>
</dependencies>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.arquillian</groupId>
            <artifactId>arquillian-bom</artifactId>
            <version>1.1.14.Final</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.selenium</groupId>
            <artifactId>selenium-bom</artifactId>
            <version>3.7.0</version>
                <!-- - 3.3.1, 3.2.0 and 3.1.0 cause   required: java.util.function.Function<? super org.openqa.selenium.WebDriver,V>
                        found: org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement>
                        reason: cannot infer type-variable(s) V
                        (argument mismatch; org.openqa.selenium.support.ui.ExpectedCondition<org.openqa.selenium.WebElement> cannot be converted to java.util.function.Function<? super org.openqa.selenium.WebDriver,V>)
                - 3.0.1 causes java.lang.IllegalAccessError: tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.phantomjs.PhantomJSDriverService when using phantomjs driver
                - 3.6.0 causes `Unrecognized platform: linux-unknown-64bit`
                    which one is supposed to work around using 3.5.3
                    <ref>https://github.com/SeleniumHQ/selenium/issues/4781</ref>-->
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.arquillian.extension</groupId>
            <artifactId>arquillian-drone-bom</artifactId>
            <version>2.4.3</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>
<profiles>
    <profile>
        <id>arquillian-glassfish-embedded</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <dependencies>
            <dependency>
                <groupId>org.jboss.arquillian.container</groupId>
                <artifactId>arquillian-glassfish-embedded-3.1</artifactId>
                <version>1.0.1</version>
            </dependency>
            <dependency>
                <groupId>fish.payara.extras</groupId>
                <artifactId>payara-embedded-all</artifactId>
                <version>4.1.2.174</version>
                    <!-- - 4.1.2.173 causes `java.lang.NoClassDefFoundError: fish/payara/nucleus/healthcheck/stuck/StuckThreadsStore`
                        - 4.1.2.172 causes `java.lang.ClassNotFoundException: fish.payara.notification.eventbus.EventbusMessage`
                        - 4.1.153 and 4.1.2.174 cause `java.lang.NullPointerException
                        at org.omnifaces.application.OmniApplication.createValidator(OmniApplication.java:114)` when using OmniFaces -->
                <scope>test</scope>
            </dependency>
        </dependencies>
        <build>
            <testResources>
                <testResource>
                    <directory>src/test/resources</directory>
                </testResource>
                <testResource>
                    <directory>src/test/resources-glassfish-embedded</directory>
                </testResource>
            </testResources>
        </build>
    </profile>
</profiles>

1.7.0RC4
1.1.5.最终版本
8.1.0.1最终版本
4.12
幻影
里氏云

说明了问题。

上述场景可以通过将上下文路径附加到部署URL来完成,例如:

browser.get(deploymentUrl+ "/arquillian-ear-it-web/index.xhtml");
在SSCCE中。上提供了工作版本

请注意,当使用
enterpriseArchive.writeTo(System.out,Formatters.VERBOSE)
打印内容时,web模块奇怪地没有列出,但它是存在的

browser.get(deploymentUrl+ "/arquillian-ear-it-web/index.xhtml");