0

Pact プロバイダー テスト用の h2 データベースを含むプロジェクトで Arquillian テストを実行しようとしています。

しかし、次のエラーメッセージが表示されます:

2018-10-17 14:43:15,826 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 28) [/] - WFLYCTL0013: 操作 (「追加」) が失敗しました - アドレス: ([ ("subsystem" => "datasources"), ("jdbc-driver" => "h2") ]) - 失敗の説明: "WFLYJCA0041: ドライバー [com.h2database.h2] のモジュールのロードに失敗しました"

私の project-defaults.yaml には以下が含まれます:

datasources:
  jdbc-drivers:
    h2:
      driver-class-name: org.h2.Driver
      xa-datasource-class-name: org.h2.jdbcx.JdbcDataSource
      driver-module-name: com.h2database.h2
  data-sources:
    ExmapleDS:
      driver-name: h2
      connection-url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE
      user-name: sa
      password: sa

私の Arquillian の配置

@Deployment(testable = false)
public static WebArchive createDeployment() {
    PomEquippedResolveStage pomFile = Maven.resolver().loadPomFromFile("pom.xml");

    File[] libs = Maven.configureResolver().loadPomFromFile("pom.xml")
    .importRuntimeAndTestDependencies().resolve()
    .withTransitivity().asFile();

    WebArchive archive = ShrinkWrap.create(WebArchive.class)
    .addAsLibraries(pomFile.resolve("org.apache.commons:commons-lang3").withTransitivity().asFile())
    .addAsLibraries(pomFile.resolve("io.thorntail:datasources:2.2.0.Final").withTransitivity().asFile())
    .addAsLibraries(pomFile.resolve("com.h2database:h2:1.4.197").withTransitivity().asFile())
    .addAsLibraries(pomFile.resolve("org.assertj:assertj-core").withTransitivity().asFile())
    .addAsLibraries(libs)
    .addPackage(ShoppingCart.class.getPackage())
    .addClass(Product.class)
    .addClass(TracerResolver.class)
    .addClass(ShoppingCartOpenApiFilter.class)
    .addPackage(Persistence.class.getPackage())
    .addPackage(ShoppingCartResource.class.getPackage())
    .addAsResource("import.sql")
    .addAsWebInfResource("test-persistence.xml", "META-INF/persistence.xml")
    .addAsResource("project-defaults.yml")
    .addAsWebInfResource(EmptyAsset.INSTANCE, ArchivePaths.create("META-INF/beans.xml"));

    LOG.debug(archive.toString(true));
    return archive;
}

そして私のtest-persistence.xml

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
         http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
         version="2.1">
  <persistence-unit name="ExampleDS" transaction-type="JTA">
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
      <property name="javax.persistence.schema-generation.create-source" value="metadata"/>
      <property name="javax.persistence.schema-generation.drop-source" value="metadata"/>
      <property name="javax.persistence.sql-load-script-source" value="import.sql"/>
    </properties>
  </persistence-unit>
</persistence>
4

1 に答える 1