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

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

生活随笔

當(dāng)前位置: 首頁(yè) > 编程资源 > 编程问答 >内容正文

编程问答

在OpenShift上托管的WildFly实例上进行Arquillian测试

發(fā)布時(shí)間:2023/12/3 编程问答 52 豆豆
生活随笔 收集整理的這篇文章主要介紹了 在OpenShift上托管的WildFly实例上进行Arquillian测试 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

技術(shù)提示#54解釋了如何為現(xiàn)有Java EE項(xiàng)目啟用Arquillian。 在該技巧中,測(cè)試是針對(duì)本地安裝的WildFly服務(wù)器運(yùn)行的。 如果此WildFly實(shí)例在OpenShift上運(yùn)行,那么同一個(gè)適配器也可以工作嗎? 沒(méi)有!

因?yàn)榕cxlocalhost相比,PaaS的安全性約束和要求是不同的。 讓我們看一下對(duì)OpenShift上托管的WildFly實(shí)例在javaee7-simple-sample中運(yùn)行測(cè)試所需要的條件。

讓我們開(kāi)始吧!

  • 如技術(shù)提示52中所述 ,在OpenShift上創(chuàng)建WildFly應(yīng)用程序,如下所示: workspaces>rhc app-create mywildfly jboss-wildfly-8 Application Options ------------------- Domain: milestogo Cartridges: jboss-wildfly-8 Gear Size: default Scaling: noCreating application 'mywildfly' ... Artifacts deployed: ./ROOT.war doneWildFly 8 administrator added. Please make note of these credentials:Username: adminMYtMTDbPassword: tq1K-QYLFgBDrun 'rhc port-forward mywildfly' to access the web admin area on port 9990.Waiting for your DNS name to be available ... doneCloning into 'mywildfly'... Warning: Permanently added the RSA host key for IP address '54.163.64.193' to the list of known hosts.Your application 'mywildfly' is now available.URL: http://mywildfly-milestogo.rhcloud.com/SSH to: 54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.comGit remote: ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/Cloned to: /Users/arungupta/workspaces/mywildflyRun 'rhc show-app mywildfly' for more details about your app.

    從日志中記下ssh用戶(hù)名。 這是@之前與SSH to對(duì)應(yīng)的值中的部分。

  • 在FORGEPLUGINS-177解決之前,我們需要手動(dòng)添加Maven配置文件并在“ arquillian.xml”中提供容器配置信息。 將以下<profile>添加到“ pom.xml”: <profile><id>arquillian-wildfly-openshift</id><build><plugins><plugin><artifactId>maven-surefire-plugin</artifactId><version>2.14.1</version><configuration><systemPropertyVariables><arquillian.launch>arquillian-wildfly-openshift</arquillian.launch></systemPropertyVariables></configuration></plugin></plugins></build><dependencies><dependency><groupId>org.jboss.arquillian.container</groupId><artifactId>arquillian-openshift</artifactId><version>1.0.0.Final-SNAPSHOT</version><scope>test</scope></dependency></dependencies> </profile>

    這是使用arquillian-openshift容器,并引用arquillian-wildfly-openshift配置,該配置將與“ arquillian.xml”中的相應(yīng)容器匹配。 因此,這就是更新的“ arquillian.xml”的外觀:

    <?xml version="1.0" encoding="UTF-8" standalone="no"?> <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="arquillian-wildfly-remote"/><container qualifier="arquillian-wildfly-openshift"><configuration><property name="namespace">milestogo</property><property name="application">mywildfly</property><property name="libraDomain">rhcloud.com</property><property name="sshUserName">54699516ecb8d41cb8000016</property><property name="login">arungupta@redhat.com</property><property name="deploymentTimeoutInSeconds">300</property><property name="disableStrictHostChecking">true</property> </configuration></container> </arquillian>

    注意帶有限定符arquillian-wildfly-openshift的新<container> 。 它提供有關(guān)服務(wù)器位置以及其他一些配置屬性的信息。 sshUserName屬性值應(yīng)與先前創(chuàng)建的WildFly實(shí)例的值相同。

  • 就是這樣,現(xiàn)在您可以在OpenShift上針對(duì)WildFly實(shí)例運(yùn)行測(cè)試: javaee7-simple-sample> mvn test -Parquillian-wildfly-openshift [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 17, 2014 11:18:24 AM org.jboss.arquillian.container.openshift.OpenShiftContainer start INFO: Preparing Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.com Nov 17, 2014 11:19:19 AM org.jboss.arquillian.container.openshift.OpenShiftRepository push INFO: Pushed to the remote repository ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/ Nov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftRepository push INFO: Pushed to the remote repository ssh://54699516ecb8d41cb8000016@mywildfly-milestogo.rhcloud.com/~/git/mywildfly.git/ Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 152.653 sec Nov 17, 2014 11:20:56 AM org.jboss.arquillian.container.openshift.OpenShiftContainer stop INFO: Shutting down Arquillian OpenShift container at http://mywildfly-milestogo.rhcloud.comResults :Tests run: 2, Failures: 0, Errors: 0, Skipped: 0[INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 05:46 min [INFO] Finished at: 2014-11-17T11:24:09+02:00 [INFO] Final Memory: 12M/309M [INFO] ------------------------------------------------------------------------
    • 完整的源代碼可在github.com/javaee-samples/javaee7-simple-sample中找到 。

    請(qǐng)享用!

    翻譯自: https://www.javacodegeeks.com/2014/11/arquillian-tests-on-a-wildfly-instance-hosted-on-openshift.html

    總結(jié)

    以上是生活随笔為你收集整理的在OpenShift上托管的WildFly实例上进行Arquillian测试的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

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