コード例 #1
0
  /**
   * Lifecycle start, before the suite is executed
   *
   * @throws Throwable throwable exception
   */
  @BeforeClass
  public static void beforeClass() throws Throwable {
    // Create and set an embedded JCA instance
    embedded = EmbeddedFactory.create(false);

    // Startup
    embedded.startup();

    // Deploy Naming and Transaction
    URL naming = XATxConnectionManagerTestCase.class.getClassLoader().getResource("naming.xml");
    URL transaction =
        XATxConnectionManagerTestCase.class.getClassLoader().getResource("transaction.xml");

    embedded.deploy(naming);
    embedded.deploy(transaction);

    TransactionIntegration ti =
        embedded.lookup("TransactionIntegration", TransactionIntegration.class);
    assertNotNull(ti);

    mcf = new MockManagedConnectionFactory();
    PoolConfiguration pc = new PoolConfiguration();
    PoolFactory pf = new PoolFactory();

    Pool pool = pf.create(PoolStrategy.ONE_POOL, mcf, pc, true, true);

    ConnectionManagerFactory cmf = new ConnectionManagerFactory();
    ConnectionManager connectionManager =
        cmf.createTransactional(
            TransactionSupportLevel.XATransaction,
            pool,
            null,
            null,
            false,
            null,
            true,
            true,
            false,
            null,
            FlushStrategy.FAILING_CONNECTION_ONLY,
            null,
            null,
            ti,
            Boolean.FALSE,
            null,
            null,
            null,
            null);
    assertNotNull(connectionManager);

    assertTrue(connectionManager instanceof TxConnectionManager);

    txConnectionManager = (TxConnectionManager) connectionManager;
  }
コード例 #2
0
  /**
   * Lifecycle start, before the suite is executed
   *
   * @throws Throwable throwable exception
   */
  @BeforeClass
  public static void beforeClass() throws Throwable {
    // Create and set an embedded JCA instance
    embedded = EmbeddedFactory.create(false);

    // Startup
    embedded.startup();

    // Deploy Naming, Transaction and WorkManager
    URL naming = ManageThreadTestCase.class.getClassLoader().getResource("naming.xml");
    URL transaction = ManageThreadTestCase.class.getClassLoader().getResource("transaction.xml");
    URL wm = ManageThreadTestCase.class.getClassLoader().getResource("workmanager.xml");

    embedded.deploy(naming);
    embedded.deploy(transaction);
    embedded.deploy(wm);
  }