日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

使用Forge插件在现有Java EE项目上启用Arquillian

發(fā)布時(shí)間:2023/12/3 java 44 豆豆
生活随笔 收集整理的這篇文章主要介紹了 使用Forge插件在现有Java EE项目上启用Arquillian 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

技術(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)完成了!

  • 下載并安裝Forge。 您可以在自己喜歡的位置下載ZIP并解壓縮,也可以使用下面的命令為您完成: Downloads> curl http://forge.jboss.org/sh | sh% Total % Received % Xferd Average Speed Time Time Time CurrentDload Upload Total Spent Left Speed 100 2725 0 2725 0 0 4641 0 --:--:-- --:--:-- --:--:-- 4642 /usr/bin/java Downloading Forge ######################################################################## 100.0% Archive: /Users/arungupta/.forge/forge_installer.zipcreating: /Users/arungupta/forge/forge-distribution-2.12.2.Final/creating: /Users/arungupta/forge/forge-distribution-2.12.2.Final/img/. . .If you have not yet seen the Forge built-in commands, you may either press TAB to see a list of the currently available commands, or get a more descriptive list by typing:$ command-listThen to get started - see the docs at http://forge.jboss.org/documentation Consider installing Git and Maven 3.1+ (both optional)Restart Terminal to use forge.
  • 克隆simple-javaee7-sample倉(cāng)庫(kù) : git clone https://github.com/javaee-samples/javaee7-simple-sample.git
  • 將目錄更改為javaee7-simple-sample并啟動(dòng)Forge: javaee7-simple-sample> ~/tools/forge-distribution-2.12.2.Final/bin/forge Using Forge at /Users/arungupta/tools/forge-distribution-2.12.2.Final_____ | ___|__ _ __ __ _ ___ | |_ / _ \| `__/ _` |/ _ \ \\| _| (_) | | | (_| | __/ //|_| \___/|_| \__, |\___| |__/ JBoss Forge, version [ 2.12.2.Final ] - JBoss, by Red Hat, Inc. [ http://forge.jboss.org ]
  • 安裝Forge-Arquillian附加組件: [javaee7-simple-sample]$ addon-install-from-git --url https://github.com/forge/addon-arquillian.git ***INFO*** Installing Addon from Git [0/4] ... ***INFO*** Installing Addon from Git:Cloning repository in /var/folders/3v/syxsk5zx3yqd_8g9m206py_h0000gn/T/1416131293813-0 [0/4] ... ***INFO*** Installing Addon from Git:Installing project into local repository [1/4] ... [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building Arquillian Forge Addon 1.0.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] . . .Downloading: http://repo1.maven.org/maven2/org/jboss/forge/addon/maven-impl-projects/2.12.2.Final/maven-impl-projects-2.12.2.Final.pom Downloaded: http://repo1.maven.org/maven2/org/jboss/forge/addon/maven-impl-projects/2.12.2.Final/maven-impl-projects-2.12.2.Final.pom (4 KB at 16.9 KB/sec) ***SUCCESS*** Addon org.arquillian.forge:arquillian-addon,1.0.0-SNAPSHOT was installed successfully.
  • 配置Arquillian附加組件并安裝WildFly適配器: [javaee7-simple-sample]$ arquillian-setup --testFramework junit --containerAdapter wildfly-remote Downloading: http://repo1.maven.org/maven2/org/wildfly/wildfly-arquillian-container-remote/maven-metadata.xml Downloaded: http://repo1.maven.org/maven2/org/wildfly/wildfly-arquillian-container-remote/maven-metadata.xml (702 B at 4.2 KB/sec) ***SUCCESS*** Arquillian setup complete ***SUCCESS*** Installed Arquillian 1.1.5.Final ***SUCCESS*** Installed junit ***SUCCESS*** Installed Arquillian Container WildFly Remote 8.x ***SUCCESS*** Installed Arquillian Container WildFly Remote 8.x dependencies

    適配器列表如下所示:

    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)此處 。

  • 在修復(fù)FORGE-2148之前,您還需要添加JAX-RS實(shí)現(xiàn)以及相應(yīng)的JAXB提供程序。 該測(cè)試使用的是RESTEasy,因此需要添加以下內(nèi)容: org.jboss.resteasyresteasy-client3.0.5.Finaltestorg.jboss.resteasyresteasy-jaxb-provider3.0.5.Finaltest

    可以在概要文件或項(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)題。

    如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。