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

技术提示#54解释了如何为现有Java EE项目启用Arquillian。 在该技巧中,测试是针对本地安装的WildFly服务器运行的。 如果此WildFly实例在OpenShift上运行,那么同一个适配器也可以工作吗? 没有!

因为与xlocalhost相比,PaaS的安全性约束和要求是不同的。 让我们看一下对OpenShift上托管的WildFly实例在javaee7-simple-sample中运行测试所需要的条件。

让我们开始吧!

  1. 如技术提示52中所述 ,在OpenShift上创建WildFly应用程序,如下所示:
    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用户名。 这是@之前与SSH to对应的值中的部分。

  2. 在FORGEPLUGINS-177解决之前,我们需要手动添加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”中的相应容器匹配。 因此,这就是更新的“ 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> 。 它提供有关服务器位置以及其他一些配置属性的信息。 sshUserName属性值应与先前创建的WildFly实例的值相同。

  3. 就是这样,现在您可以在OpenShift上针对WildFly实例运行测试:
    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中找到 。

请享用!

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

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/361428.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

js基础---数组方法

数组数据的排序及去重   sort无形参的排序方式 arr1[2,12,3,15];var aarr1.sort();console.log(arr1);console.log(a);//排序会改变原本数组是顺序&#xff0c;是依据首个字符的大小开始排名sort有形参的排序方式方法1arr2[2,12,3,15];var barr2.sort(function(n1,n2){if(n1&…

扩展Asterisk1.8.7的CLI接口

我之前有一篇文章&#xff08;http://www.cnblogs.com/MikeZhang/archive/2012/04/14/asteriskCLIAppTest20120414.html&#xff09;介绍过如何扩展asterisk的cli接口&#xff0c;本篇是它的继续&#xff0c;总结下&#xff0c;也方便我以后查阅。 大部分情况下&#xff0c;配置…

CSS中的 ',' 、''、'+'、'~'

1、群组选择器&#xff08;,&#xff09; /* 表示既h1&#xff0c;又h2 */ h1, h2 {color: red; } 2、后代选择器&#xff08;空格&#xff09; /* 表示 h1 下面的所有 span 元素&#xff0c;不管是否以 h1 为直接父元素 */ h1 span {} 3、子元素选择器&#xff08;>&#x…

避免不必要的Spring配置组件扫描

我在堆栈溢出中遇到了一个有趣的问题。 Brett Ryan有问题&#xff0c;Spring Security配置被初始化了两次。 当我查看他的代码时&#xff0c;我发现了问题所在。 让我展示显示代码。 他有相当标准的Spring应用程序&#xff08;不使用Spring Boot&#xff09;。 使用基于Spring…

正则表达式 小结

时间&#xff1a;2018年1月21日 18:29:01 用于&#xff1a;此小结是学习正则表达式的总结 正则表达式&#xff08;regular expression&#xff09;小结1. . 表示出断行外任意一个字符   ^行首   $行尾   [] 表示范围 如&#xff1a;[a-z]指a到z范围的一个字符 [\u]表…

js 之for..in、表单及事件触发

<html ><body> <script type"text/javascript">var x;var mycarsnew Array();mycars[0] "saa";mycars[1] "Va";mycars[2] "BMW";for(x in mycars)//x是变量用来指定变量&#xff0c;指定的变量可以是数组元素&…

移动端,fixed bottom问题

//不显示 .bar {position:fixed;bottom:0;z-index:99; }//显示 .bar{position:fixed;bottom:calc(90vh); /*当前屏幕高度百分比90%*/z-index:99; } 转载于:https://www.cnblogs.com/qq917937712/p/11475310.html

js 判断一个字符在字符串中出现的次数

<script type"text/javascript">var sdjh.doiwe.esd.d.ddd0sdd.d.; var n(s.split(.)).length-1; document.write(n);</script> 结果&#xff1a;6 更多专业前端知识&#xff0c;请上 【猿2048】www.mk2048.com

Spring Boot微服务的黑匣子测试是如此简单

当我需要进行原型设计&#xff0c;概念验证或在空闲时间使用一些新技术时&#xff0c;开始新项目对于Maven来说总是有点烦人。 不得不说&#xff0c;设置Maven项目并不难&#xff0c;您可以使用Maven原型。 但是原型通常是过时的。 谁想玩旧技术&#xff1f; 因此&#xff0c;我…

sharepoint ECMAScript对象模型系列

转载&#xff1a;Sharepoint学习笔记—ECMAScript对象模型系列-- 8、组与用户操作(一) http://www.cnblogs.com/wsdj-ITtech/archive/2012/06/08/2416967.html 转载于:https://www.cnblogs.com/EricLee007/archive/2012/06/08/2541636.html

c++ static关键字的作用

名称  全局静态变量  局部静态变量   静态函数  类的静态成员类的静态函数形式  全局变量前加static局部变量前加static 函数返回类型前加static类成员前加static类成员函数前加static存储区域 静态存储区 运行期间一直存在 静态存储区 运行期间一直存在 作用域…

单片机第三季-第七课:STM32中断体系

目录 1&#xff0c;NVIC 2&#xff0c;中断和事件的区别 3&#xff0c;优先级的概念 4&#xff0c;如何实际编程使用外部中断 5&#xff0c;STM32开发板通过按键控制LED 5.1&#xff0c;打开相应GPIO模块时钟 5.2&#xff0c;NVIC设置 5.3&#xff0c;外部中断线和配套…

【学亮IT手记】angularJS select2多选下拉框实例

永远保持对大部分知识的好奇心&#xff0c;学习从不枯燥&#xff0c;也没有被逼学习一说&#xff0c;乐此不疲才是该有的心态和境界&#xff01;&#xff01;&#xff01; 引入相关js库&#xff1a; html部分代码&#xff1a; angularJS定义数据源变量&#xff1a; 更多专业前端…

虚拟主机相关业务知识介绍

什么是虚拟主机&#xff1f; 虚拟主机是使用特殊的软硬件技术&#xff0c;把一台运行在因特网上的服务器主机分成一台台“虚拟”的主机&#xff0c;每一台虚拟主机都具有独立的域名&#xff0c;具有完整的Internet服务器&#xff08;WWW、FTP、Email等&#xff09;功能&#xf…

在CXF API和拦截器中添加Gzip压缩

如今&#xff0c;由于我们在响应中发送大量数据&#xff0c;因此必须对API响应执行Gzip压缩。 它节省了网络带宽和交付时间&#xff0c;当然还节省了Internet上的空间。 CXF提供了以多种方式使用Gzip压缩的选项。 蓝图 注解 蓝图&#xff1a; <bean id"gZipInterce…

zTree树形菜单交互选项卡效果实现

1、 添加自定义属性 page 2、 为 ztree 每个树形节点&#xff0c;添加点击事件 1 <!DOCTYPE html>2 <html>3 4 <head>5 <meta charset"UTF-8">6 <title>ztree树形菜单的使用</title>7 <!-- 导入…

windows 服务部署管理

通过创建bat文件&#xff0c;能够快速的对服务进行部署和卸载。 部署的命令如下&#xff1a; $SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe [exename] Net Start [servicename] sc config [servicename] startauto 卸载的命令如下: $SystemRoot%\Microsof…

oracle中sql语句的优化(转帖)

一、执行顺序及优化细则 1.表名顺序优化 (1) 基础表放下面,当两表进行关联时数据量少的表的表名放右边 表或视图: Student_info (30000条数据) Description_info (30条数据) select * from description_info di ,student_info si --学生信息表 where si.student…

Devoxx Hackergarten的企业Web应用程序原型

我已经连续10年参加DevoxxBe了 。 这是我最喜欢的Java会议&#xff0c;但是谈话时间表并不总是最佳的&#xff1a;有时我想同时看2个精彩的谈话&#xff01; 因此&#xff0c;在Devoxx的Hackergarten&#xff0c;在参加讲座之间&#xff0c;我们中的一些人开始构建Web应用程序以…

C# 加载C++的dll

[DllImport("kernel32")] private static extern IntPtr LoadLibrary([MarshalAs(UnmanagedType.LPStr)]string fileName) 转载于:https://www.cnblogs.com/sky-jyq/p/11509059.html