ArquillianチュートリアルのJBoss AS7でテストを走らせるところをやってみる
TweetPosted on Saturday Jan 25, 2014 at 09:58AM in Technology
Arquillianチュートリアルの埋め込みGlassFish3でテストを走らせるところをやってみるの続きです。今回も本家のチュートリアル[1]なぞるだけです。JBoss AS7でテストを走らせます。
環境
- Eclipse Kepler SR1
- Apache Maven 2.2.1 (r801777; 2009-08-07 04:16:01+0900)
- Apple JDK6u65
- OS X 10.9.1
準備
JBoss AS7.1.1をダウンロードして展開
[2]からJBoss AS7.1.1を取ってきます。私はjboss-as-7.1.1.Final.tar.gzというやつを取ってきました。チュートリアルにはMavenに取ってこさせる方法も紹介されていますがサイズもでかい(132MB)ので手で取ってきます。取ってきたら適当な場所に展開します。
arquillian.xmlを作る
ArquillianにJBoss AS7の場所を教えてやる必要が有り、チュートリアルにはJBOSS_HOME環境変数にセットするように書かれていますが、環境変数に定義したくないのでこうします。
あと私の環境だとコンソールの出力が文字化けしてしまうので文字化けを防ぐ設定も入れます
作る場所
内容
<?xml version="1.0" encoding="UTF-8"?> <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="jbossas-managed" default="true"> <configuration> <property name="jbossHome">/Users/kyle/apps/jboss-as-7.1.1.Final</property> <property name="javaVmArguments">-Dfile.encoding=UTF-8</property> </configuration> </container> </arquillian>
Profileをarquillian-jbossas-managedに変更
プロジェクトを右クリック→Maven→Select Maven Profilesを選択、arquillian-jbossas-managedだけチェックされた状態にしてOK
OKを押すと右下の進捗バーが動き出すので終わるまで待ちます。GlassFishの時より時間かかる。
テスト実行
テストクラスを右クリック→Run As→JUnit Test
コンソール
JUnit窓
備考
以下が走るようです
- JBossの起動
- テスト資源のデプロイ
- テストコード実行
- テスト資源のアンデプロイ
- JBossの停止
全部で9秒強。それでも楽ですね。今回は起動停止までArquillianが面倒を見るmanagedというモードを試したのですが、すでに動いているJBossを使うremoteというモードもあるそうなので、それでやった方が実行時間は短く済むような気がします。またそのうちやってみる
ログ
2014/01/25 11:08:53 org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal 情報: Starting container with: [/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java, -Dfile.encoding=UTF-8, -ea, -Djboss.home.dir=/Users/kyle/apps/jboss-as-7.1.1.Final, -Dorg.jboss.boot.log.file=/Users/kyle/apps/jboss-as-7.1.1.Final/standalone/log/boot.log, -Dlogging.configuration=file:/Users/kyle/apps/jboss-as-7.1.1.Final/standalone/configuration/logging.properties, -Djboss.modules.dir=/Users/kyle/apps/jboss-as-7.1.1.Final/modules, -Djboss.bundles.dir=/Users/kyle/apps/jboss-as-7.1.1.Final/bundles, -jar, /Users/kyle/apps/jboss-as-7.1.1.Final/jboss-modules.jar, -mp, /Users/kyle/apps/jboss-as-7.1.1.Final/modules, -jaxpmodule, javax.xml.jaxp-provider, org.jboss.as.standalone, -server-config, standalone.xml] 2014/01/25 11:08:53 org.xnio.Xnio <clinit> INFO: XNIO Version 3.0.0.GA 2014/01/25 11:08:53 org.xnio.nio.NioXnio <clinit> INFO: XNIO NIO Implementation Version 3.0.0.GA 2014/01/25 11:08:53 org.jboss.remoting3.EndpointImpl <clinit> INFO: JBoss Remoting version 3.2.3.GA 11:08:53,852 情報 [org.jboss.modules] JBoss Modules version 1.1.1.GA 11:08:54,196 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA 11:08:54,233 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting 11:08:54,850 INFO [org.xnio] XNIO Version 3.0.3.GA 11:08:54,851 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http) 11:08:54,856 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA 11:08:54,862 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA 11:08:54,878 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers 11:08:54,880 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem 11:08:54,884 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem. 11:08:54,890 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem 11:08:54,897 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem 11:08:54,902 INFO [org.jboss.as.connector] (MSC service thread 1-13) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final) 11:08:54,910 INFO [org.jboss.as.naming] (MSC service thread 1-10) JBAS011802: Starting Naming Service 11:08:54,914 INFO [org.jboss.as.mail.extension] (MSC service thread 1-9) JBAS015400: Bound mail session [java:jboss/mail/Default] 11:08:54,936 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem 11:08:54,939 INFO [org.jboss.as.security] (MSC service thread 1-13) JBAS013100: Current PicketBox version=4.0.7.Final 11:08:54,954 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension 11:08:54,955 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 11:08:55,029 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-8) Coyote HTTP/1.1を http--127.0.0.1-8080 で起動します 11:08:55,137 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.2.GA 11:08:55,212 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 11:08:55,326 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) JBAS015012: Started FileSystemDeploymentService for directory /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/deployments 11:08:55,345 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on /127.0.0.1:4447 11:08:55,345 INFO [org.jboss.as.remoting] (MSC service thread 1-1) JBAS017100: Listening on /127.0.0.1:9999 11:08:55,398 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 11:08:55,399 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.1.Final "Brontes" started in 1813ms - Started 133 of 208 services (74 services are passive or on-demand) 2014/01/25 11:09:00 org.jboss.as.arquillian.protocol.jmx.ArquillianServiceDeployer doServiceDeploy INFO: Deploy arquillian service: arquillian-service: 1001 assets 11:09:00,655 INFO [org.jboss.as.repository] (management-handler-thread - 2) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/fd/d2bc84b645ec6211439baf0f0ac0f5b5e6edaa/content 11:09:00,667 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "arquillian-service" 11:09:00,876 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.jmx:main") which may be changed or removed in future versions without notice. 11:09:00,876 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.server:main") which may be changed or removed in future versions without notice. 11:09:00,877 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.as.osgi:main") which may be changed or removed in future versions without notice. 11:09:00,878 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.jandex:main") which may be changed or removed in future versions without notice. 11:09:00,878 WARN [org.jboss.as.dependency.private] (MSC service thread 1-8) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.jboss.osgi.framework:main") which may be changed or removed in future versions without notice. 11:09:00,950 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS018559: Deployed "arquillian-service" 11:09:01,234 INFO [org.jboss.as.repository] (management-handler-thread - 3) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/df/66c1c9dd842d5f94bc469ed4deb8309334ed1a/content 11:09:01,238 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015876: Starting deployment of "a65375aa-bafb-4037-82ff-1ac105d8bace.jar" 11:09:01,257 INFO [org.jboss.weld.deployer] (MSC service thread 1-9) JBAS016002: Processing weld deployment a65375aa-bafb-4037-82ff-1ac105d8bace.jar 11:09:01,267 INFO [org.jboss.weld.deployer] (MSC service thread 1-1) JBAS016005: Starting Services for CDI deployment: a65375aa-bafb-4037-82ff-1ac105d8bace.jar 11:09:01,313 INFO [org.jboss.weld.Version] (MSC service thread 1-1) WELD-000900 1.1.5 (AS71) 11:09:01,324 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016008: Starting weld service for deployment a65375aa-bafb-4037-82ff-1ac105d8bace.jar 11:09:01,325 INFO [org.jboss.as.arquillian] (MSC service thread 1-11) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."a65375aa-bafb-4037-82ff-1ac105d8bace.jar",unit=a65375aa-bafb-4037-82ff-1ac105d8bace.jar,tests=[org.arquillian.example.GreeterTest]] 11:09:01,544 INFO [org.jboss.as.server] (management-handler-thread - 3) JBAS018559: Deployed "a65375aa-bafb-4037-82ff-1ac105d8bace.jar" 11:09:01,728 INFO [stdout] (pool-4-thread-1) Hello, Earthling! 11:09:01,769 INFO [org.jboss.weld.deployer] (MSC service thread 1-10) JBAS016009: Stopping weld service for deployment a65375aa-bafb-4037-82ff-1ac105d8bace.jar 11:09:01,779 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015877: Stopped deployment a65375aa-bafb-4037-82ff-1ac105d8bace.jar in 13ms 11:09:01,790 INFO [org.jboss.as.repository] (management-handler-thread - 1) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/df/66c1c9dd842d5f94bc469ed4deb8309334ed1a/content 11:09:01,791 INFO [org.jboss.as.server] (management-handler-thread - 1) JBAS018558: Undeployed "a65375aa-bafb-4037-82ff-1ac105d8bace.jar" 2014/01/25 11:09:01 org.jboss.as.arquillian.protocol.jmx.ArquillianServiceDeployer undeploy INFO: Undeploy arquillian service: arquillian-service: 1002 assets 11:09:01,805 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment arquillian-service in 4ms 11:09:01,814 INFO [org.jboss.as.repository] (management-handler-thread - 2) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/fd/d2bc84b645ec6211439baf0f0ac0f5b5e6edaa/content 11:09:01,815 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS018558: Undeployed "arquillian-service"
続き
Arquillianチュートリアルのリモートコンテナでテストを走らせるところをやってみる
参考文献
Tags: test