Entries tagged [test]
JavaEE7プロジェクトでArquillianを使ってみる
TweetPosted on Saturday Jan 25, 2014 at 09:23PM in Technology
チュートリアルはJavaEE6ベースで書かれていたが、実際にはJavaEE7で作業したいのでJavaEE7で環境を作る方法
本当はArchetypeを作りたいのだが、まだMavenもEclipseも良くわかっていないのでまた後日
環境
- WildFly8.0.0.CR1
- Oracle JDK7u51
手順
- WildFly8.0.0CR1でサーブレットを動かしてみるの要領でjavaee7-essentials-archetypeでプロジェクトを作る
- java build pathを開き、test用のフォルダが欠けていたりする(test/resourcesとtest/java)のでそれらを作ってRefresh。test用のフォルダはOutput folderをtarget/test-classesに変更する。resourcesフォルダを作ったらExcludedを「**」にする
- プロジェクトの設定のdeployment assemblyを開いてテスト用の資源がデプロイされないようにする。test/resourcesがあれば削除
- java build pathのorder and exportで並び順を変更
- pom.xmlを編集する
pom.xml
こういう感じに改変してやれば良さげ。Arquillian Persistenceも入れておく
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>arquillian-javaee7</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.2.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>net.avh4.util</groupId>
<artifactId>imagecomparison</artifactId>
<version>0.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.CR1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-impl</artifactId>
<version>1.0.0.Alpha6</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
こういう感じのテストが走るようになる
[1]にあったサンプルを少し改変したもの。test-persistence.xmlやjbossas-ds.xmlはArquillianチュートリアルのJPAを使ったテストを走らせるところをやってみるのと同じ。
package org.arquillian.example;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.arquillian.persistence.ShouldMatchDataSet;
import org.jboss.arquillian.persistence.UsingDataSet;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class UserPersistenceTest {
@Deployment
public static Archive<?> createDeploymentPackage() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(UserAccount.class.getPackage())
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsWebInfResource("jbossas-ds.xml");
}
@PersistenceContext
EntityManager em;
@Test
@UsingDataSet("datasets/users.yml")
@ShouldMatchDataSet("datasets/expected-users.yml")
public void should_change_user_password() throws Exception {
// given
String expectedPassword = "LexLuthor";
UserAccount user = em.find(UserAccount.class, 2L);
// when
user.setPassword("LexLuthor");
user = em.merge(user);
// then
Assert.assertEquals(expectedPassword, user.getPassword());
}
}
テストを走らせると、log4jの設定が無い、slf4jの実装が無い、と怒られるのでそれは適宜対応。
参考文献
Tags: test
ArquillianをWildFly8.0.0.CR1で動かしてみる
TweetPosted on Saturday Jan 25, 2014 at 05:20PM in Technology
ArquillianチュートリアルのJPAを使ったテストを走らせるところをやってみるの続きです。WildFly8.0.0.CR1に対してremoteモードでArquillianのテストを走らせてみます。
環境
- WildFly 8.0.0.CR1
- Eclipse Kepler SR1
- Apache Maven 2.2.1 (r801777; 2009-08-07 04:16:01+0900)
- Oracle JDK7u51
- OS X 10.9.1
準備
pom.xmlの編集
[1]に書かれたdependency要素を使ってpom.xmlに新しいprofile要素を定義します。こうなる
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.arquillian.example</groupId>
<artifactId>arquillian-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>arquillian-tutorial</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.2.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>net.avh4.util</groupId>
<artifactId>imagecomparison</artifactId>
<version>0.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- clip -->
<profiles>
<profile>
<id>arquillian-weld-ee-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<profile>
<id>arquillian-glassfish-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<!-- clip -->
<profile>
<id>arquillian-jbossas-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<!-- clip -->
<profile>
<id>arquillian-jbossas-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<!-- wildfly start -->
<profile>
<id>arquillian-wildfly-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.CR1</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- wildfly end -->
</profiles>
<!-- clip -->
</project>
Profileの選択を変更
arquillian-wildfly-remoteだけチェックされた状態にしてOK

JVMの設定を変更
このままテストを走らせようとするとUnsupportedClassVersionErrorが出てしまいます。Arquillianを走らせるJREが1.6でWildFlyは1.7なのが原因っぽいのでプロジェクト側のJREを変更します。
プロジェクトの設定→Java Build Path→Librariesを開く
JRE System Library [JavaSE-1.6] を選択してEditを選択

ラジオボタンをAlternate JREに合わせてドロップダウンリストからJava SE 7を選択してOK

JRE System Library [Java SE 7] に変わっているのを確認してOK

テストを走らせる
WildFly8を起動して前回と同じやり方で走らせてみます
GreeterTest (JPA使ってない方)
WARNレベルのメッセージが若干出てますが普通に走ります
JUnit窓

ログ
17:41:30,906 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014900: Content added at location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/be/e45d12928bf1ee6b6f2f2206e4995f7b80ca61/content
17:41:30,909 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "arquillian-service" (runtime-name: "arquillian-service")
17:41:31,005 WARN [org.jboss.as.dependency.private] (MSC service thread 1-2) 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.
17:41:31,005 WARN [org.jboss.as.dependency.private] (MSC service thread 1-2) 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.
17:41:31,006 WARN [org.jboss.as.dependency.private] (MSC service thread 1-2) 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.
17:41:31,006 WARN [org.jboss.as.dependency.private] (MSC service thread 1-2) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.wildfly.security.manager:main") which may be changed or removed in future versions without notice.
17:41:31,011 WARN [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016012: Deployment deployment "arquillian-service" contains CDI annotations but no bean archive was not found. (No beans.xml nor class with bean defining annotations)
17:41:31,040 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018559: Deployed "arquillian-service" (runtime-name : "arquillian-service")
17:41:32,924 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014900: Content added at location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/ea/a3ef36deeeb6b7c9f983ca3a59bf1b078e3a7c/content
17:41:32,927 INFO [org.jboss.as.server.deployment] (MSC service thread 1-16) JBAS015876: Starting deployment of "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar" (runtime-name: "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar")
17:41:32,940 WARN [org.jboss.as.dependency.private] (MSC service thread 1-14) JBAS018567: Deployment "deployment.f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar" is using a private module ("org.wildfly.security.manager:main") which may be changed or removed in future versions without notice.
17:41:32,941 INFO [org.jboss.weld.deployer] (MSC service thread 1-14) JBAS016002: Processing weld deployment f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar
17:41:32,946 INFO [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016005: Starting Services for CDI deployment: f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar
17:41:32,950 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016008: Starting weld service for deployment f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar
17:41:32,950 INFO [org.jboss.as.arquillian] (MSC service thread 1-12) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar",unit=f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar,tests=[org.arquillian.example.GreeterTest]]
17:41:33,062 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018559: Deployed "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar" (runtime-name : "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar")
17:41:33,238 INFO [stdout] (pool-2-thread-2) Hello, Earthling!
17:41:33,298 INFO [org.jboss.weld.deployer] (MSC service thread 1-14) JBAS016009: Stopping weld service for deployment f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar
17:41:33,310 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar (runtime-name: f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar) in 19ms
17:41:33,322 INFO [org.jboss.as.repository] (management-handler-thread - 7) JBAS014901: Content removed from location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/ea/a3ef36deeeb6b7c9f983ca3a59bf1b078e3a7c/content
17:41:33,322 INFO [org.jboss.as.server] (management-handler-thread - 7) JBAS018558: Undeployed "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar" (runtime-name: "f4da79a4-4a77-4468-9fce-679cc1f8aa95.jar")
17:41:33,340 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment arquillian-service (runtime-name: arquillian-service) in 5ms
17:41:33,350 INFO [org.jboss.as.repository] (management-handler-thread - 8) JBAS014901: Content removed from location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/be/e45d12928bf1ee6b6f2f2206e4995f7b80ca61/content
17:41:33,350 INFO [org.jboss.as.server] (management-handler-thread - 8) JBAS018558: Undeployed "arquillian-service" (runtime-name: "arquillian-service")
GamePersistenceTest (JPA使っている方)
こちらもWARNレベルのメッセージが若干出てますが普通に走ります
JUnit窓

ログ
17:54:11,145 INFO [org.jboss.as.repository] (management-handler-thread - 17) JBAS014900: Content added at location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/7d/5f3376f9a12e783c3e26d6d58e51ffcf03c103/content
17:54:11,147 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "arquillian-service" (runtime-name: "arquillian-service")
17:54:11,206 WARN [org.jboss.as.dependency.private] (MSC service thread 1-7) 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.
17:54:11,206 WARN [org.jboss.as.dependency.private] (MSC service thread 1-7) 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.
17:54:11,207 WARN [org.jboss.as.dependency.private] (MSC service thread 1-7) 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.
17:54:11,207 WARN [org.jboss.as.dependency.private] (MSC service thread 1-7) JBAS018567: Deployment "deployment.arquillian-service" is using a private module ("org.wildfly.security.manager:main") which may be changed or removed in future versions without notice.
17:54:11,211 WARN [org.jboss.weld.deployer] (MSC service thread 1-12) JBAS016012: Deployment deployment "arquillian-service" contains CDI annotations but no bean archive was not found. (No beans.xml nor class with bean defining annotations)
17:54:11,222 INFO [org.jboss.as.server] (management-handler-thread - 17) JBAS018559: Deployed "arquillian-service" (runtime-name : "arquillian-service")
17:54:11,873 INFO [org.jboss.as.repository] (management-handler-thread - 17) JBAS014900: Content added at location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/ec/f5873a270286159d851f049b3d6d3d50d72491/content
17:54:11,875 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015876: Starting deployment of "test.war" (runtime-name: "test.war")
17:54:11,890 INFO [org.jboss.as.jpa] (MSC service thread 1-10) JBAS011401: Read persistence.xml for test
17:54:11,898 WARN [org.jboss.as.dependency.private] (MSC service thread 1-11) JBAS018567: Deployment "deployment.test.war" is using a private module ("org.wildfly.security.manager:main") which may be changed or removed in future versions without notice.
17:54:11,900 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:/jdbc/arquillian]
17:54:11,900 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 79) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'test.war#test'
17:54:11,901 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 79) HHH000204: Processing PersistenceUnitInfo [
name: test
...]
17:54:11,909 INFO [org.jboss.weld.deployer] (MSC service thread 1-11) JBAS016002: Processing weld deployment test.war
17:54:11,917 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016005: Starting Services for CDI deployment: test.war
17:54:11,920 INFO [org.jboss.weld.deployer] (MSC service thread 1-4) JBAS016008: Starting weld service for deployment test.war
17:54:11,921 INFO [org.jboss.as.arquillian] (MSC service thread 1-3) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."test.war",unit=test.war,tests=[org.arquillian.example.GreeterTest, org.arquillian.example.GamePersistenceTest]]
17:54:11,924 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 79) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'test.war#test'
17:54:11,932 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 79) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
17:54:11,933 WARN [org.hibernate.dialect.H2Dialect] (ServerService Thread Pool -- 79) HHH000431: Unable to determine H2 database version, certain features may not work
17:54:11,935 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 79) HHH000397: Using ASTQueryTranslatorFactory
17:54:11,945 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 79) HHH000227: Running hbm2ddl schema export
17:54:11,946 INFO [stdout] (ServerService Thread Pool -- 79) Hibernate: drop table Game if exists
17:54:11,946 INFO [stdout] (ServerService Thread Pool -- 79) Hibernate: drop sequence hibernate_sequence
17:54:11,947 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 79) HHH000389: Unsuccessful: drop sequence hibernate_sequence
17:54:11,947 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 79) シーケンス "HIBERNATE_SEQUENCE" が見つかりません
Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
drop sequence hibernate_sequence [90036-173]
17:54:11,947 INFO [stdout] (ServerService Thread Pool -- 79) Hibernate: create table Game (id bigint not null, title varchar(50) not null, primary key (id))
17:54:11,948 INFO [stdout] (ServerService Thread Pool -- 79) Hibernate: create sequence hibernate_sequence start with 1 increment by 1
17:54:11,948 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 79) HHH000230: Schema export complete
17:54:12,078 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017534: Register web context: /test
17:54:12,086 INFO [org.jboss.as.server] (management-handler-thread - 17) JBAS018559: Deployed "test.war" (runtime-name : "test.war")
17:54:12,197 INFO [stdout] (pool-2-thread-5) Dumping old records...
17:54:12,200 INFO [stdout] (pool-2-thread-5) Hibernate: delete from Game
17:54:12,202 INFO [stdout] (pool-2-thread-5) Inserting records...
17:54:12,202 INFO [stdout] (pool-2-thread-5) Hibernate: call next value for hibernate_sequence
17:54:12,203 INFO [stdout] (pool-2-thread-5) Hibernate: call next value for hibernate_sequence
17:54:12,204 INFO [stdout] (pool-2-thread-5) Hibernate: call next value for hibernate_sequence
17:54:12,209 INFO [stdout] (pool-2-thread-5) Hibernate: insert into Game (title, id) values (?, ?)
17:54:12,210 INFO [stdout] (pool-2-thread-5) Hibernate: insert into Game (title, id) values (?, ?)
17:54:12,211 INFO [stdout] (pool-2-thread-5) Hibernate: insert into Game (title, id) values (?, ?)
17:54:12,214 INFO [stdout] (pool-2-thread-5) Selecting (using JPQL)...
17:54:12,216 INFO [stdout] (pool-2-thread-5) Hibernate: select game0_.id as id1_0_, game0_.title as title2_0_ from Game game0_ order by game0_.id
17:54:12,218 INFO [stdout] (pool-2-thread-5) Found 3 games (using JPQL):
17:54:12,218 INFO [stdout] (pool-2-thread-5) * Game@649254855[id = 1; title = Super Mario Brothers]
17:54:12,218 INFO [stdout] (pool-2-thread-5) * Game@661937578[id = 2; title = Mario Kart]
17:54:12,218 INFO [stdout] (pool-2-thread-5) * Game@1219581986[id = 3; title = F-Zero]
17:54:12,247 INFO [org.wildfly.extension.undertow] (MSC service thread 1-14) JBAS017535: Unregister web context: /test
17:54:12,248 SEVERE [javax.faces] (MSC service thread 1-14) Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
17:54:12,248 SEVERE [javax.faces] (MSC service thread 1-14) Unable to call @PreDestroy annotated methods because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI?
17:54:12,248 SEVERE [javax.faces] (MSC service thread 1-14) Unable to obtain InjectionProvider from init time FacesContext. Does this container implement the Mojarra Injection SPI?
17:54:12,248 SEVERE [javax.faces] (MSC service thread 1-14) Unable to call @PreDestroy annotated methods because no InjectionProvider can be found. Does this container implement the Mojarra Injection SPI?
17:54:12,249 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 83) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'test.war#test'
17:54:12,250 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 83) HHH000227: Running hbm2ddl schema export
17:54:12,250 INFO [stdout] (ServerService Thread Pool -- 83) Hibernate: drop table Game if exists
17:54:12,251 INFO [stdout] (ServerService Thread Pool -- 83) Hibernate: drop sequence hibernate_sequence
17:54:12,252 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 83) HHH000230: Schema export complete
17:54:12,252 INFO [org.jboss.weld.deployer] (MSC service thread 1-14) JBAS016009: Stopping weld service for deployment test.war
17:54:12,256 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 83) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'test.war#test'
17:54:12,256 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010409: Unbound data source [java:/jdbc/arquillian]
17:54:12,260 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment test.war (runtime-name: test.war) in 14ms
17:54:12,270 INFO [org.jboss.as.repository] (management-handler-thread - 19) JBAS014901: Content removed from location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/ec/f5873a270286159d851f049b3d6d3d50d72491/content
17:54:12,271 INFO [org.jboss.as.server] (management-handler-thread - 19) JBAS018558: Undeployed "test.war" (runtime-name: "test.war")
17:54:12,286 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment arquillian-service (runtime-name: arquillian-service) in 3ms
17:54:12,294 INFO [org.jboss.as.repository] (management-handler-thread - 20) JBAS014901: Content removed from location /Users/kyle/apps/wildfly-8.0.0.CR1/standalone/data/content/7d/5f3376f9a12e783c3e26d6d58e51ffcf03c103/content
17:54:12,295 INFO [org.jboss.as.server] (management-handler-thread - 20) JBAS018558: Undeployed "arquillian-service" (runtime-name: "arquillian-service")
※ロガーを設定してみるで書いたHibernateのロガーの設定をしている場合は、Hibernateのログが2重に出力されてしまうので、一時的に以下のようにコンソールのログレベルを変えておくと良いかもしれません。以下jboss-cli用コマンド
/subsystem=logging/console-handler=CONSOLE:change-log-level(level=INFO)
参考文献
- Arquillian WildFly 8 Remote Container Adapter · Arquillian
- How to change JRE / JDK in Eclipse project.
添付資料
JREを変更しないと発生する例外
java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:160)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:111)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:97)
at org.jboss.arquillian.test.spi.TestRunnerAdaptorBuilder.build(TestRunnerAdaptorBuilder.java:52)
at org.jboss.arquillian.junit.Arquillian.run(Arquillian.java:93)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:156)
... 10 more
Caused by: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.core.impl.ManagerImpl
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:160)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:111)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:97)
at org.jboss.arquillian.core.spi.ManagerBuilder.create(ManagerBuilder.java:77)
at org.jboss.arquillian.test.impl.EventTestRunnerAdaptor.<init>(EventTestRunnerAdaptor.java:55)
... 15 more
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.jboss.arquillian.core.spi.SecurityActions.newInstance(SecurityActions.java:156)
... 19 more
Caused by: java.lang.UnsupportedClassVersionError: org/jboss/as/arquillian/container/remote/RemoteContainerExtension : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.jboss.arquillian.core.impl.loadable.JavaSPIExtensionLoader.load(JavaSPIExtensionLoader.java:108)
at org.jboss.arquillian.core.impl.loadable.JavaSPIExtensionLoader.all(JavaSPIExtensionLoader.java:65)
at org.jboss.arquillian.core.impl.loadable.JavaSPIExtensionLoader.load(JavaSPIExtensionLoader.java:53)
at org.jboss.arquillian.core.impl.loadable.LoadableExtensionLoader.load(LoadableExtensionLoader.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.arquillian.core.impl.ObserverImpl.invoke(ObserverImpl.java:94)
at org.jboss.arquillian.core.impl.EventContextImpl.invokeObservers(EventContextImpl.java:99)
at org.jboss.arquillian.core.impl.EventContextImpl.proceed(EventContextImpl.java:81)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:135)
at org.jboss.arquillian.core.impl.ManagerImpl.fire(ManagerImpl.java:115)
at org.jboss.arquillian.core.impl.ManagerImpl.fireProcessing(ManagerImpl.java:316)
at org.jboss.arquillian.core.impl.ManagerImpl.<init>(ManagerImpl.java:98)
... 24 more
Tags: test
ArquillianチュートリアルのJPAを使ったテストを走らせるところをやってみる
TweetPosted on Saturday Jan 25, 2014 at 02:29PM in Technology
Arquillianチュートリアルのリモートコンテナでテストを走らせるところをやってみるの続きです。JPAを使ったテストを走らせるところをやってみます。今回も基本的にはチュートリアル[1]なぞるだけです。
環境
- JBoss AS 7.1.1.Final
- Eclipse Kepler SR1
- Apache Maven 2.2.1 (r801777; 2009-08-07 04:16:01+0900)
- Apple JDK6u65
- OS X 10.9.1
準備
チュートリアルにはGlassFishでテストを走らせる方法についても書いてありますが、ここではJBossで必要なものだけ用意します
何を作るか
この画像で選択されている4つのリソースを作ります 
Game.java (エンティティクラス)
package org.arquillian.example;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@Entity
public class Game implements Serializable {
private Long id;
private String title;
public Game() {}
public Game(String title) {
this.title = title;
}
@Id @GeneratedValue
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@NotNull
@Size(min = 3, max = 50)
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public String toString() {
return "Game@" + hashCode() + "[id = " + id + "; title = " + title + "]";
}
}
GamePersistenceTest.java (テストクラス)
このチュートリアルではEntityManagerを叩いているのはこのテストクラスだけです。本当はJPAを使ったEJBのテストをしたいところですが、とりあえずこれでやってみます
package org.arquillian.example;
import java.util.List;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.transaction.UserTransaction;
import org.junit.Before;
import org.junit.After;
import org.junit.Test;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.junit.Assert;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.shrinkwrap.api.Archive;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.EmptyAsset;
import org.jboss.shrinkwrap.api.spec.WebArchive;
import org.junit.runner.RunWith;
@RunWith(Arquillian.class)
public class GamePersistenceTest {
@Deployment
public static Archive<?> createDeployment() {
return ShrinkWrap.create(WebArchive.class, "test.war")
.addPackage(Game.class.getPackage())
.addAsResource("test-persistence.xml", "META-INF/persistence.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsWebInfResource("jbossas-ds.xml");
}
private static final String[] GAME_TITLES = {
"Super Mario Brothers",
"Mario Kart",
"F-Zero"
};
@PersistenceContext
EntityManager em;
@Inject
UserTransaction utx;
@Before
public void preparePersistenceTest() throws Exception {
clearData();
insertData();
startTransaction();
}
private void clearData() throws Exception {
utx.begin();
em.joinTransaction();
System.out.println("Dumping old records...");
em.createQuery("delete from Game").executeUpdate();
utx.commit();
}
private void insertData() throws Exception {
utx.begin();
em.joinTransaction();
System.out.println("Inserting records...");
for (String title : GAME_TITLES) {
Game game = new Game(title);
em.persist(game);
}
utx.commit();
// clear the persistence context (first-level cache)
em.clear();
}
private void startTransaction() throws Exception {
utx.begin();
em.joinTransaction();
}
@After
public void commitTransaction() throws Exception {
utx.commit();
}
@Test
public void shouldFindAllGamesUsingJpqlQuery() throws Exception {
// given
String fetchingAllGamesInJpql = "select g from Game g order by g.id";
// when
System.out.println("Selecting (using JPQL)...");
List<Game> games = em.createQuery(fetchingAllGamesInJpql, Game.class).getResultList();
// then
System.out.println("Found " + games.size() + " games (using JPQL):");
assertContainsAllGames(games);
}
private static void assertContainsAllGames(Collection<Game> retrievedGames) {
Assert.assertEquals(GAME_TITLES.length, retrievedGames.size());
final Set<String> retrievedGameTitles = new HashSet<String>();
for (Game game : retrievedGames) {
System.out.println("* " + game);
retrievedGameTitles.add(game.getTitle());
}
Assert.assertTrue(retrievedGameTitles.containsAll(Arrays.asList(GAME_TITLES)));
}
}
jbossas-ds.xml (データソース定義)
データソース定義をこのファイルに書いておけば、テスト実行する度に一時的にデータソース定義を行ってくれます。APサーバ側のコンソールをいじってデータソース定義をやる必要はありません。これは便利。
本当はPostgreSQLあたりを使ってリアルにレコードを確認したいところですが、簡単のためとりあえずチュートリアル通りに標準搭載のH2を使ってインメモリデータベースを使います
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.jboss.org/ironjacamar/schema
http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource enabled="true"
jndi-name="jdbc/arquillian"
pool-name="ArquillianEmbeddedH2Pool">
<connection-url>jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
</datasource>
</datasources>
test-persistence.xml (永続化コンテキスト定義)
JTAトランザクションのJavaEEなJPAの定義ですね。JavaSEのと違ってエンティティクラス名の列挙は必要ありません。良い。
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="test">
<jta-data-source>jdbc/arquillian</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
<property name="hibernate.show_sql" value="true"/>
</properties>
</persistence-unit>
</persistence>
テスト実行
- 前回同様、右クリック→Run As→JUnit Test
- Profileも前回同様JBossのremoteで
JUnit窓

ログ
16:22:40,034 INFO [org.jboss.as.repository] (management-handler-thread - 17) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/48/93a135faeb37e43d3d9346ea59cc2bfc3c784c/content
16:22:40,040 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "arquillian-service"
16:22:40,100 WARN [org.jboss.as.dependency.private] (MSC service thread 1-5) 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.
16:22:40,101 WARN [org.jboss.as.dependency.private] (MSC service thread 1-5) 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.
16:22:40,101 WARN [org.jboss.as.dependency.private] (MSC service thread 1-5) 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.
16:22:40,102 WARN [org.jboss.as.dependency.private] (MSC service thread 1-5) 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.
16:22:40,102 WARN [org.jboss.as.dependency.private] (MSC service thread 1-5) 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.
16:22:40,123 INFO [org.jboss.as.server] (management-handler-thread - 17) JBAS018559: Deployed "arquillian-service"
16:22:40,251 INFO [org.jboss.as.repository] (management-handler-thread - 18) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/ed/a8915f6ceb2f30ae6c44b37a827c3c0064d992/content
16:22:40,253 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "test.war"
16:22:40,307 INFO [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for test
16:22:40,350 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016002: Processing weld deployment test.war
16:22:40,387 INFO [org.jboss.weld.deployer] (MSC service thread 1-15) JBAS016005: Starting Services for CDI deployment: test.war
16:22:40,401 INFO [org.jboss.as.arquillian] (MSC service thread 1-9) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."test.war",unit=test.war,tests=[org.arquillian.example.GreeterTest, org.arquillian.example.GamePersistenceTest]]
16:22:40,402 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [jdbc/arquillian]
16:22:40,403 INFO [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011402: Starting Persistence Unit Service 'test.war#test'
16:22:40,498 INFO [org.hibernate.annotations.common.Version] (MSC service thread 1-2) HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
16:22:40,503 INFO [org.hibernate.Version] (MSC service thread 1-2) HHH000412: Hibernate Core {4.0.1.Final}
16:22:40,505 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000206: hibernate.properties not found
16:22:40,506 INFO [org.hibernate.cfg.Environment] (MSC service thread 1-2) HHH000021: Bytecode provider name : javassist
16:22:40,525 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-2) HHH000204: Processing PersistenceUnitInfo [
name: test
...]
16:22:40,648 INFO [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-2) HHH000130: Instantiating explicit connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
16:22:40,830 INFO [org.hibernate.dialect.Dialect] (MSC service thread 1-2) HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
16:22:40,835 WARN [org.hibernate.dialect.H2Dialect] (MSC service thread 1-2) HHH000431: Unable to determine H2 database version, certain features may not work
16:22:40,838 INFO [org.hibernate.engine.jdbc.internal.LobCreatorBuilder] (MSC service thread 1-2) HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4
16:22:40,845 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC service thread 1-2) HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory
16:22:40,848 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (MSC service thread 1-2) HHH000397: Using ASTQueryTranslatorFactory
16:22:40,875 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-2) Hibernate Validator 4.2.0.Final
16:22:41,079 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000227: Running hbm2ddl schema export
16:22:41,083 INFO [stdout] (MSC service thread 1-2) Hibernate: drop table Game if exists
16:22:41,083 INFO [stdout] (MSC service thread 1-2) Hibernate: drop sequence hibernate_sequence
16:22:41,090 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000389: Unsuccessful: drop sequence hibernate_sequence
16:22:41,090 ERROR [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) シーケンス "HIBERNATE_SEQUENCE" が見つかりません
Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
drop sequence hibernate_sequence [90036-161]
16:22:41,090 INFO [stdout] (MSC service thread 1-2) Hibernate: create table Game (id bigint not null, title varchar(50) not null, primary key (id))
16:22:41,091 INFO [stdout] (MSC service thread 1-2) Hibernate: create sequence hibernate_sequence start with 1 increment by 1
16:22:41,093 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-2) HHH000230: Schema export complete
16:22:41,113 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016008: Starting weld service for deployment test.war
16:22:41,239 INFO [org.jboss.web] (MSC service thread 1-6) JBAS018210: Registering web context: /test
16:22:41,248 INFO [org.jboss.as.server] (management-handler-thread - 18) JBAS018559: Deployed "test.war"
16:22:41,407 INFO [stdout] (pool-4-thread-4) Dumping old records...
16:22:41,501 INFO [stdout] (pool-4-thread-4) Hibernate: delete from Game
16:22:41,515 INFO [stdout] (pool-4-thread-4) Inserting records...
16:22:41,517 INFO [stdout] (pool-4-thread-4) Hibernate: call next value for hibernate_sequence
16:22:41,549 INFO [stdout] (pool-4-thread-4) Hibernate: call next value for hibernate_sequence
16:22:41,550 INFO [stdout] (pool-4-thread-4) Hibernate: call next value for hibernate_sequence
16:22:41,566 INFO [stdout] (pool-4-thread-4) Hibernate: insert into Game (title, id) values (?, ?)
16:22:41,568 INFO [stdout] (pool-4-thread-4) Hibernate: insert into Game (title, id) values (?, ?)
16:22:41,569 INFO [stdout] (pool-4-thread-4) Hibernate: insert into Game (title, id) values (?, ?)
16:22:41,573 INFO [stdout] (pool-4-thread-4) Selecting (using JPQL)...
16:22:41,584 INFO [stdout] (pool-4-thread-4) Hibernate: select game0_.id as id0_, game0_.title as title0_ from Game game0_ order by game0_.id
16:22:41,588 INFO [stdout] (pool-4-thread-4) Found 3 games (using JPQL):
16:22:41,588 INFO [stdout] (pool-4-thread-4) * Game@1954523691[id = 1; title = Super Mario Brothers]
16:22:41,589 INFO [stdout] (pool-4-thread-4) * Game@402776278[id = 2; title = Mario Kart]
16:22:41,589 INFO [stdout] (pool-4-thread-4) * Game@592449002[id = 3; title = F-Zero]
16:22:41,641 INFO [org.jboss.weld.deployer] (MSC service thread 1-14) JBAS016009: Stopping weld service for deployment test.war
16:22:41,643 INFO [org.jboss.as.jpa] (MSC service thread 1-14) JBAS011403: Stopping Persistence Unit Service 'test.war#test'
16:22:41,643 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-14) HHH000227: Running hbm2ddl schema export
16:22:41,644 INFO [stdout] (MSC service thread 1-14) Hibernate: drop table Game if exists
16:22:41,647 INFO [stdout] (MSC service thread 1-14) Hibernate: drop sequence hibernate_sequence
16:22:41,647 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (MSC service thread 1-14) HHH000230: Schema export complete
16:22:41,648 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010409: Unbound data source [jdbc/arquillian]
16:22:41,656 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment test.war in 40ms
16:22:41,664 INFO [org.jboss.as.repository] (management-handler-thread - 20) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/ed/a8915f6ceb2f30ae6c44b37a827c3c0064d992/content
16:22:41,665 INFO [org.jboss.as.server] (management-handler-thread - 20) JBAS018558: Undeployed "test.war"
16:22:41,685 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015877: Stopped deployment arquillian-service in 5ms
16:22:41,693 INFO [org.jboss.as.repository] (management-handler-thread - 17) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/48/93a135faeb37e43d3d9346ea59cc2bfc3c784c/content
16:22:41,693 INFO [org.jboss.as.server] (management-handler-thread - 17) JBAS018558: Undeployed "arquillian-service"
備考
特に問題なさげですね。しかも速い。クラスの数も少なくアプリケーションアーカイブのサイズも小さいので当然かもしれませんが3〜4秒です。これならJPAのマニアックな機能を使った複雑な機能の実装とテストも怖くないですね。
というか本家のチュートリアル[1]がよくできてて日本語訳も読みやすいので読みましょう。
ちなみにチュートリアルにも書かれていますが埋め込みモードではJPAを使ったテストは動かないそうです。ただし埋め込みGlassFishは可。
続き
ArquillianをWildFly8.0.0.CR1で動かしてみる
参考文献
Tags: test
Arquillianチュートリアルのリモートコンテナでテストを走らせるところをやってみる
TweetPosted on Saturday Jan 25, 2014 at 11:21AM in Technology
ArquillianチュートリアルのJBoss AS7でテストを走らせるところをやってみるの続きです。チュートリアル[1]のremoteモード(すでに動いているアプリケーションサーバでテストをする)でテストを走らせるところをやってみます。
環境
- JBoss AS 7.1.1.Final
- 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をEclipseに登録して起動
remoteモードでは手動でJBossの立ち上げをやらないといけないので、とりあえずEclipseに登録して起動しておきます
Server窓で右クリック→New→Server

JBoss Communityの中のJBoss AS 7.1を選んでNext

JBossを展開したディレクトリを入力しJavaSE1.6のJREを選んでFinish

登録された事を確認

JBoss 7.1 Runtime Serverを右クリックしてStartを選択

コンソールを見て起動する事を確認

pom.xmlの編集
新たなProfile「arquillian-jbossas-remote」を追加します。チュートリアルにはGlassFish3用の設定法も書かれていますが飛ばします。結果こうなる
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.arquillian.example</groupId>
<artifactId>arquillian-tutorial</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>arquillian-tutorial</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.2.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-integration</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>net.avh4.util</groupId>
<artifactId>imagecomparison</artifactId>
<version>0.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<!-- clip -->
<profiles>
<profile>
<id>arquillian-weld-ee-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-weld-ee-embedded-1.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<profile>
<id>arquillian-glassfish-embedded</id>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<!-- clip -->
<profile>
<id>arquillian-jbossas-managed</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.protocol</groupId>
<artifactId>arquillian-protocol-servlet</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
<!-- clip -->
<profile>
<id>arquillian-jbossas-remote</id>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<version>7.1.1.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
<!-- clip -->
</profiles>
<!-- clip -->
</project>
Profileを変更
プロジェクトを右クリック→Maven→Select Maven Profilesを選択

arquillian-jbossas-remoteだけチェックされた状態にしてOK

Eclipseからテスト実行
前回同様テストクラスを右クリック→Run As→JUnit Testで実行します。
コンソール

JUnit窓

ログ
14:22:09,297 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/01/428305db821001575772a3e91a1fc2db39bf0e/content
14:22:09,307 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015876: Starting deployment of "arquillian-service"
14:22:09,497 WARN [org.jboss.as.dependency.private] (MSC service thread 1-9) 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.
14:22:09,498 WARN [org.jboss.as.dependency.private] (MSC service thread 1-9) 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.
14:22:09,498 WARN [org.jboss.as.dependency.private] (MSC service thread 1-9) 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.
14:22:09,499 WARN [org.jboss.as.dependency.private] (MSC service thread 1-9) 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.
14:22:09,499 WARN [org.jboss.as.dependency.private] (MSC service thread 1-9) 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.
14:22:09,574 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018559: Deployed "arquillian-service"
14:22:09,826 INFO [org.jboss.as.repository] (management-handler-thread - 6) JBAS014900: Content added at location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/ca/98d99cb1a5a4e11c31041af98a99d4adb7c05c/content
14:22:09,829 INFO [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015876: Starting deployment of "2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar"
14:22:09,848 INFO [org.jboss.weld.deployer] (MSC service thread 1-13) JBAS016002: Processing weld deployment 2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar
14:22:09,856 INFO [org.jboss.weld.deployer] (MSC service thread 1-7) JBAS016005: Starting Services for CDI deployment: 2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar
14:22:09,901 INFO [org.jboss.weld.Version] (MSC service thread 1-7) WELD-000900 1.1.5 (AS71)
14:22:09,914 INFO [org.jboss.weld.deployer] (MSC service thread 1-3) JBAS016008: Starting weld service for deployment 2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar
14:22:09,914 INFO [org.jboss.as.arquillian] (MSC service thread 1-2) Arquillian deployment detected: ArquillianConfig[service=jboss.arquillian.config."2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar",unit=2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar,tests=[org.arquillian.example.GreeterTest]]
14:22:10,143 INFO [org.jboss.as.server] (management-handler-thread - 6) JBAS018559: Deployed "2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar"
14:22:10,307 INFO [stdout] (pool-4-thread-1) Hello, Earthling!
14:22:10,346 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016009: Stopping weld service for deployment 2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar
14:22:10,358 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment 2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar in 16ms
14:22:10,367 INFO [org.jboss.as.repository] (management-handler-thread - 8) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/ca/98d99cb1a5a4e11c31041af98a99d4adb7c05c/content
14:22:10,368 INFO [org.jboss.as.server] (management-handler-thread - 8) JBAS018558: Undeployed "2cfbb74d-9ab5-4b63-9bad-9b2257442d92.jar"
14:22:10,386 INFO [org.jboss.as.server.deployment] (MSC service thread 1-13) JBAS015877: Stopped deployment arquillian-service in 9ms
14:22:10,395 INFO [org.jboss.as.repository] (management-handler-thread - 5) JBAS014901: Content removed from location /Users/kyle/apps/jboss-as-7.1.1.Final/standalone/data/content/01/428305db821001575772a3e91a1fc2db39bf0e/content
14:22:10,396 INFO [org.jboss.as.server] (management-handler-thread - 5) JBAS018558: Undeployed "arquillian-service"
mvnからテスト実行
kyle-no-MacBook:arquillian-tutorial kyle$ JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home mvn test -Parquillian-jbossas-remote -Dtest=GreeterTest
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building arquillian-tutorial
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /Users/kyle/Documents/workspace/arquillian-tutorial/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
Running org.arquillian.example.GreeterTest
2014/01/25 14:31:06 org.jboss.arquillian.container.impl.MapObject populate
警告: Configuration contain properties not supported by the backing object org.jboss.as.arquillian.container.remote.RemoteContainerConfiguration
Unused property entries: {javaVmArguments=-Dfile.encoding=UTF-8, jbossHome=/Users/kyle/apps/jboss-as-7.1.1.Final}
Supported property names: [managementPort, username, managementAddress, password]
2014/01/25 14:31:06 org.jboss.as.arquillian.protocol.jmx.ArquillianServiceDeployer doServiceDeploy
INFO: Deploy arquillian service: arquillian-service: 1001 assets
2014/01/25 14:31:06 org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.3.GA
2014/01/25 14:31:06 org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.3.GA
2014/01/25 14:31:06 org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.2.GA
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.906 sec
2014/01/25 14:31:08 org.jboss.as.arquillian.protocol.jmx.ArquillianServiceDeployer undeploy
INFO: Undeploy arquillian service: arquillian-service: 1002 assets
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4 seconds
[INFO] Finished at: Sat Jan 25 14:31:08 JST 2014
[INFO] Final Memory: 43M/90M
[INFO] ------------------------------------------------------------------------
kyle-no-MacBook:arquillian-tutorial kyle$
前回使ったmanaged用の設定項目が残ったままな点だけ警告が出てますが普通に動いてます。
その他
managedで9秒強かかっていたのが2〜3秒で終わるようになっています。速い。良いですね。
あとはJPAを使ったコンポーネントのテストと、JRE7とWildFly8でJavaEE7アプリのテストをしてみたいと思います
続き
ArquillianチュートリアルのJPAを使ったテストを走らせるところをやってみる
参考文献
Tags: test
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