使用Forge插件在现有Java EE项目上启用Arquillian
技術(shù)提示#34解釋了如何創(chuàng)建可測(cè)試的Java EE 7應(yīng)用程序。 如果要啟動(dòng)新的應(yīng)用程序,這將很有用。 但是,如果您已經(jīng)有一個(gè)應(yīng)用程序并啟用Arquillian怎么辦?
這就是Forge和Forge-Arquillian附加組件派上用場(chǎng)的地方。 這就是我在javaee7-simple-sample中添加對(duì)Arquillian的支持的方式。
讓我們看看已經(jīng)完成了!
適配器列表如下所示:
glassfish-embedded-3.1 jetty-embedded-6.1 tomee-remote glassfish-managed-3.1 jetty-embedded-7 was-embedded-8 glassfish-remote-3.1 openejb-embedded-3.1 was-remote-7 jbossas-embedded-6 openejb-embedded-4 was-remote-8 jbossas-managed-4.2 openshift-express weld-ee-embedded-1.1 jbossas-managed-5.1 openwebbeans-embedded-1 weld-se-embedded-1 jbossas-managed-6 tomcat-embedded-6 weld-se-embedded-1.1 jbossas-managed-7 tomcat-embedded-7 wildfly-managed jbossas-remote-4.2 tomcat-managed-5.5 wildfly-remote jbossas-remote-5 tomcat-managed-6 wls-remote-10.3 jbossas-remote-5.1 tomcat-managed-7 jbossas-remote-6 tomcat-remote-6這使您可以配置所選的容器。 這會(huì)將以下配置文件添加到您的“ pom.xml”中:
arquillian-wildfly-remotemaven-surefire-plugin2.14.1arquillian-wildfly-remoteorg.wildflywildfly-arquillian-container-remote8.1.0.Finaltest該配置文件包括“ wildfly-arquillian-container-remote”依賴(lài)性,該依賴(lài)性使Arquillian可以與在遠(yuǎn)程“模式”下運(yùn)行的WildFly連接。 默認(rèn)主機(jī)為“ localhost”,端口為“ 8080”。 “ maven-surefire-plugin”將傳遞一個(gè)值為“ arquillian-wildfly-remote”的“ arquillian.launch”配置屬性。 這與生成的“ arquillian.xml”中的“容器”限定符匹配?!?arquillian.xml”用于定義配置設(shè)置以定位容器或與容器通信。 在我們的情況下,WildFly在默認(rèn)主機(jī)和端口上運(yùn)行,因此無(wú)需更新此文件。 要注意的重要部分是“容器”限定符與“ arquillian.launch”限定符值匹配。
這個(gè)文件。 有關(guān)此配置文件的更多詳細(xì)信息, 請(qǐng)參見(jiàn)此處 。
可以在概要文件或項(xiàng)目范圍的依賴(lài)項(xiàng)中添加它。
現(xiàn)在,您可以進(jìn)行測(cè)試了!
下載WildFly 8.1并解壓縮。 以以下方式啟動(dòng)服務(wù)器:
./bin/standalone.sh運(yùn)行測(cè)試:
javaee7-simple-sample> mvn test [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building helloworld 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ helloworld --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ helloworld --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ helloworld --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 1 resource [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ helloworld --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- maven-surefire-plugin:2.14.1:test (default-test) @ helloworld --- [INFO] Surefire report directory: /Users/arungupta/workspaces/javaee7-simple-sample/target/surefire-reports-------------------------------------------------------T E S T S ------------------------------------------------------- Running org.javaee7.sample.PersonTest Nov 16, 2014 1:53:57 PM org.xnio.Xnio INFO: XNIO version 3.2.0.Beta4 Nov 16, 2014 1:53:57 PM org.xnio.nio.NioXnio INFO: XNIO NIO Implementation Version 3.2.0.Beta4 Nov 16, 2014 1:53:57 PM org.jboss.remoting3.EndpointImpl INFO: JBoss Remoting version (unknown) Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.963 secResults :Tests run: 2, Failures: 0, Errors: 0, Skipped: 0[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.403 s [INFO] Finished at: 2014-11-16T13:53:59+02:00 [INFO] Final Memory: 17M/309M [INFO] ------------------------------------------------------------------------現(xiàn)在,您已經(jīng)使用Arquillian啟用了現(xiàn)有項(xiàng)目!
在此處提交任何問(wèn)題 。
請(qǐng)享用!
翻譯自: https://www.javacodegeeks.com/2014/11/enable-arquillian-on-an-existing-java-ee-project-using-forge-addon.html
總結(jié)
以上是生活随笔為你收集整理的使用Forge插件在现有Java EE项目上启用Arquillian的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 乌兹别克斯坦面积多少平方公里(国家乌兹别
- 下一篇: 使用Java EE 7,WildFly和