当前位置: 首页>>代码示例>>Java>>正文


Java BitronixTransactionManager.commit方法代码示例

本文整理汇总了Java中bitronix.tm.BitronixTransactionManager.commit方法的典型用法代码示例。如果您正苦于以下问题:Java BitronixTransactionManager.commit方法的具体用法?Java BitronixTransactionManager.commit怎么用?Java BitronixTransactionManager.commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bitronix.tm.BitronixTransactionManager的用法示例。


在下文中一共展示了BitronixTransactionManager.commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testXAWorksWithJsr107

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXAWorksWithJsr107() throws Exception {
  BitronixTransactionManager transactionManager = TransactionManagerServices.getTransactionManager();
  URI uri = getClass().getResource("/configs/simple-xa.xml").toURI();
  CacheManager cacheManager = Caching.getCachingProvider().getCacheManager(uri, getClass().getClassLoader());

  Cache<String, String> xaCache = cacheManager.getCache("xaCache", String.class, String.class);

  transactionManager.begin();
  {
      xaCache.put("key", "one");
  }
  transactionManager.commit();

  cacheManager.close();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:17,代码来源:XA107Test.java

示例2: putIfAbsentAssertions

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
private void putIfAbsentAssertions(BitronixTransactionManager transactionManager, Cache<Long, String> txCache1) throws Exception {
  transactionManager.begin();
  {
    assertThat(txCache1.putIfAbsent(1L, "one"), is(nullValue()));
    assertThat(txCache1.putIfAbsent(1L, "un"), equalTo("one"));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "one");

  transactionManager.begin();
  {
    assertThat(txCache1.putIfAbsent(1L, "eins"), equalTo("one"));
    txCache1.remove(1L);
    assertThat(txCache1.putIfAbsent(1L, "een"), is(nullValue()));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "een");
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:21,代码来源:XACacheTest.java

示例3: replace2ArgsAssertions

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
private void replace2ArgsAssertions(BitronixTransactionManager transactionManager, Cache<Long, String> txCache1) throws Exception {
  transactionManager.begin();
  {
    assertThat(txCache1.replace(1L, "one"), is(nullValue()));
    txCache1.put(1L, "un");
    assertThat(txCache1.replace(1L, "eins"), equalTo("un"));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "eins");

  transactionManager.begin();
  {
    assertThat(txCache1.replace(1L, "een"), equalTo("eins"));
    txCache1.put(1L, "un");
    assertThat(txCache1.replace(1L, "een"), equalTo("un"));
    txCache1.remove(1L);
    assertThat(txCache1.replace(1L, "one"), is(nullValue()));
    assertThat(txCache1.get(1L), is(nullValue()));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, null);
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:25,代码来源:XACacheTest.java

示例4: replace3ArgsAssertions

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
private void replace3ArgsAssertions(BitronixTransactionManager transactionManager, Cache<Long, String> txCache1) throws Exception {
  transactionManager.begin();
  {
    assertThat(txCache1.replace(1L, "one", "un"), is(false));
    txCache1.put(1L, "un");
    assertThat(txCache1.replace(1L, "uno", "eins"), is(false));
    assertThat(txCache1.replace(1L, "un", "eins"), is(true));
    assertThat(txCache1.get(1L), equalTo("eins"));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "eins");

  transactionManager.begin();
  {
    assertThat(txCache1.replace(1L, "one", "un"), is(false));
    assertThat(txCache1.replace(1L, "eins", "un"), is(true));
    assertThat(txCache1.replace(1L, "uno", "een"), is(false));
    assertThat(txCache1.get(1L), equalTo("un"));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "un");
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:25,代码来源:XACacheTest.java

示例5: testXAWithStatefulSerializer

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXAWithStatefulSerializer() throws Exception {
  BitronixTransactionManager manager = TransactionManagerServices.getTransactionManager();
  try (CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
        .using(new LookupTransactionManagerProviderConfiguration(
          BitronixTransactionManagerLookup.class))
        .withCache("xaCache",
          CacheConfigurationBuilder
            .newCacheConfigurationBuilder(Long.class, Person.class,
              ResourcePoolsBuilder.heap(5))
            .withExpiry(ExpiryPolicyBuilder.noExpiration()).add(new XAStoreConfiguration("xaCache"))
            .build())
        .build(true)) {

    Cache<Long, Person> cache = cacheManager.getCache("xaCache", Long.class, Person.class);
    manager.begin();
    cache.put(1L, new Person("James", 42));
    manager.commit();

    manager.begin();
    assertNotNull(cache.get(1L));
    manager.commit();
  } finally {
    manager.shutdown();
  }
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:27,代码来源:StatefulSerializerTest.java

示例6: testSharedConnectionInGlobal

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
public void testSharedConnectionInGlobal() throws Exception {
    if (log.isDebugEnabled()) { log.debug("*** testSharedConnectionInGlobal: Starting getting TM"); }
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(120);

    if (log.isDebugEnabled()) { log.debug("*** before begin"); }
    tm.begin();
    if (log.isDebugEnabled()) { log.debug("*** after begin"); }

    if (log.isDebugEnabled()) { log.debug("*** getting connection from DS1"); }
    Connection connection1 = poolingDataSource1.getConnection();

    if (log.isDebugEnabled()) { log.debug("*** getting second connection from DS1"); }
    Connection connection2 = poolingDataSource1.getConnection();

    PooledConnectionProxy handle1 = (PooledConnectionProxy) connection1;
    PooledConnectionProxy handle2 = (PooledConnectionProxy) connection2;
    assertSame(handle1.getProxiedDelegate(), handle2.getProxiedDelegate());

    connection1.close();
    connection2.close();

    tm.commit();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:25,代码来源:JdbcSharedConnectionTest.java

示例7: testPrepares

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testPrepares() throws Exception {
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    tm.setTransactionTimeout(60);
    tm.begin();

    Connection connection = poolingDataSource2.getConnection();

    for (int i = 0; i < 1000; i++) {
        PreparedStatement prepareStatement = connection.prepareStatement("SELECT 1 FROM nothing WHERE a=? AND b=? AND c=? AND d=?");
        assertFalse(prepareStatement.isClosed());
        prepareStatement.close();
        assertTrue(prepareStatement.isClosed());
    }

    connection.close();

    tm.commit();
    tm.shutdown();
}
 
开发者ID:bitronix,项目名称:btm,代码行数:21,代码来源:JdbcProxyTest.java

示例8: remove2ArgsAssertions

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
private void remove2ArgsAssertions(BitronixTransactionManager transactionManager, Cache<Long, String> txCache1) throws Exception {
  transactionManager.begin();
  {
    assertThat(txCache1.remove(1L, "one"), is(false));
    assertThat(txCache1.putIfAbsent(1L, "un"), is(nullValue()));
    assertThat(txCache1.remove(1L, "one"), is(false));
    assertThat(txCache1.remove(1L, "un"), is(true));
    assertThat(txCache1.remove(1L, "un"), is(false));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, null);

  transactionManager.begin();
  {
    txCache1.put(1L, "one");
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, "one");

  transactionManager.begin();
  {
    assertThat(txCache1.remove(1L, "un"), is(false));
    assertThat(txCache1.remove(1L, "one"), is(true));
    assertThat(txCache1.remove(1L, "one"), is(false));
    assertThat(txCache1.putIfAbsent(1L, "un"), is(nullValue()));
    assertThat(txCache1.remove(1L, "one"), is(false));
    assertThat(txCache1.remove(1L, "un"), is(true));
  }
  transactionManager.commit();

  assertMapping(transactionManager, txCache1, 1L, null);
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:35,代码来源:XACacheTest.java

示例9: assertMapping

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
private void assertMapping(BitronixTransactionManager transactionManager, Cache<Long, String> cache, long key, String expected) throws Exception {
  transactionManager.begin();

  String value = cache.get(key);
  if (expected == null) {
    assertThat(value, is(nullValue()));
  } else {
    assertThat(value, equalTo(expected));
  }

  transactionManager.commit();
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:13,代码来源:XACacheTest.java

示例10: testSimpleXACache

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testSimpleXACache() throws Exception {
  // tag::testSimpleXACache[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <3>
                                                          ResourcePoolsBuilder.heap(10)) // <4>
          .add(new XAStoreConfiguration("xaCache")) // <5>
          .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = cacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <6>
  {
    xaCache.put(1L, "one"); // <7>
  }
  transactionManager.commit(); // <8>

  cacheManager.close();
  transactionManager.shutdown();
  // end::testSimpleXACache[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:28,代码来源:XAGettingStarted.java

示例11: testXACacheWithWriteThrough

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
@SuppressWarnings("unchecked")
public void testXACacheWithWriteThrough() throws Exception {
  // tag::testXACacheWithWriteThrough[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  Class<CacheLoaderWriter<?, ?>> klazz = (Class<CacheLoaderWriter<?, ?>>) (Class) (SampleLoaderWriter.class);

  CacheManager cacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <3>
                                                          ResourcePoolsBuilder.heap(10)) // <4>
              .add(new XAStoreConfiguration("xaCache")) // <5>
              .add(new DefaultCacheLoaderWriterConfiguration(klazz, singletonMap(1L, "eins"))) // <6>
              .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = cacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <7>
  {
    assertThat(xaCache.get(1L), equalTo("eins")); // <8>
    xaCache.put(1L, "one"); // <9>
  }
  transactionManager.commit(); // <10>

  cacheManager.close();
  transactionManager.shutdown();
  // end::testXACacheWithWriteThrough[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:33,代码来源:XAGettingStarted.java

示例12: testXACacheWithThreeTiers

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
@Test
public void testXACacheWithThreeTiers() throws Exception {
  // tag::testXACacheWithThreeTiers[]
  BitronixTransactionManager transactionManager =
      TransactionManagerServices.getTransactionManager(); // <1>

  PersistentCacheManager persistentCacheManager = CacheManagerBuilder.newCacheManagerBuilder()
      .using(new LookupTransactionManagerProviderConfiguration(BitronixTransactionManagerLookup.class)) // <2>
      .with(CacheManagerBuilder.persistence(new File(getStoragePath(), "testXACacheWithThreeTiers"))) // <3>
      .withCache("xaCache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, // <4>
              ResourcePoolsBuilder.newResourcePoolsBuilder() // <5>
                      .heap(10, EntryUnit.ENTRIES)
                      .offheap(10, MemoryUnit.MB)
                      .disk(20, MemoryUnit.MB, true)
              )
              .add(new XAStoreConfiguration("xaCache")) // <6>
              .build()
      )
      .build(true);

  final Cache<Long, String> xaCache = persistentCacheManager.getCache("xaCache", Long.class, String.class);

  transactionManager.begin(); // <7>
  {
    xaCache.put(1L, "one"); // <8>
  }
  transactionManager.commit(); // <9>

  persistentCacheManager.close();
  transactionManager.shutdown();
  // end::testXACacheWithThreeTiers[]
}
 
开发者ID:ehcache,项目名称:ehcache3,代码行数:33,代码来源:XAGettingStarted.java

示例13: testSimpleWorkingCase

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
public void testSimpleWorkingCase() throws Exception {
    if (log.isDebugEnabled()) { log.debug("*** getting TM"); }
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    if (log.isDebugEnabled()) { log.debug("*** before begin"); }
    tm.setTransactionTimeout(10);
    tm.begin();
    if (log.isDebugEnabled()) { log.debug("*** after begin"); }

    if (log.isDebugEnabled()) { log.debug("*** getting connection from CF1"); }
    Connection connection1 = poolingConnectionFactory1.createConnection();

    if (log.isDebugEnabled()) { log.debug("*** creating session 1 on connection 1"); }
    Session session1 = connection1.createSession(false, Session.AUTO_ACKNOWLEDGE);

    if (log.isDebugEnabled()) { log.debug("*** creating queue 1 on session 1"); }
    Queue queue1 = session1.createQueue("queue");

    if (log.isDebugEnabled()) { log.debug("*** creating producer1 on session 1"); }
    MessageProducer producer1 = session1.createProducer(queue1);

    if (log.isDebugEnabled()) { log.debug("*** sending message on producer1"); }
    producer1.send(session1.createTextMessage("testSimpleWorkingCase"));


    if (log.isDebugEnabled()) { log.debug("*** closing connection 1"); }
    connection1.close();

    if (log.isDebugEnabled()) { log.debug("*** committing"); }
    tm.commit();
    if (log.isDebugEnabled()) { log.debug("*** TX is done"); }

    // check flow
    List orderedEvents = EventRecorder.getOrderedEvents();
    log.info(EventRecorder.dumpToString());

    assertEquals(8, orderedEvents.size());
    int i=0;
    assertEquals(Status.STATUS_ACTIVE, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(XAResource.TMNOFLAGS, ((XAResourceStartEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(XAResource.TMSUCCESS, ((XAResourceEndEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(Status.STATUS_PREPARING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_PREPARED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_COMMITTING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(true, ((XAResourceCommitEvent) orderedEvents.get(i++)).isOnePhase());
    assertEquals(Status.STATUS_COMMITTED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
}
 
开发者ID:bitronix,项目名称:btm,代码行数:47,代码来源:JmsProperUsageMockTest.java

示例14: testDeferredCannotReuse

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
public void testDeferredCannotReuse() throws Exception {
    if (log.isDebugEnabled()) { log.debug("*** getting TM"); }
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();

    // Use DataSource2 because it does not have shared accessible connections
    XAPool pool2 = getPool(poolingDataSource2);

    if (log.isDebugEnabled()) { log.debug("*** before begin"); }
    tm.begin();
    if (log.isDebugEnabled()) { log.debug("*** after begin"); }

    assertEquals(POOL_SIZE, pool2.inPoolSize());

    if (log.isDebugEnabled()) { log.debug("*** getting connection 1 from DS1"); }
    Connection connection1 = poolingDataSource2.getConnection();
    connection1.createStatement();

    assertEquals(POOL_SIZE -1, pool2.inPoolSize());

    if (log.isDebugEnabled()) { log.debug("*** getting connection 2 from DS1"); }
    Connection connection2 = poolingDataSource2.getConnection();
    connection2.createStatement();

    assertEquals(POOL_SIZE -2, pool2.inPoolSize());

    if (log.isDebugEnabled()) { log.debug("*** closing connection 1"); }
    connection1.close();

    assertEquals(POOL_SIZE -2, pool2.inPoolSize());

    if (log.isDebugEnabled()) { log.debug("*** closing connection 2"); }
    connection2.close();

    assertEquals(POOL_SIZE -2, pool2.inPoolSize());

    if (log.isDebugEnabled()) { log.debug("*** committing"); }
    tm.commit();
    if (log.isDebugEnabled()) { log.debug("*** TX is done"); }

    assertEquals(POOL_SIZE, pool2.inPoolSize());

    // check flow
    List orderedEvents = EventRecorder.getOrderedEvents();
    log.info(EventRecorder.dumpToString());

    assertEquals(17, orderedEvents.size());
    int i=0;
    assertEquals(Status.STATUS_ACTIVE, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(DATASOURCE2_NAME, ((ConnectionDequeuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
    assertEquals(XAResource.TMNOFLAGS, ((XAResourceStartEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(DATASOURCE2_NAME, ((ConnectionDequeuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
    assertEquals(XAResource.TMNOFLAGS, ((XAResourceStartEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(XAResource.TMSUCCESS, ((XAResourceEndEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(XAResource.TMSUCCESS, ((XAResourceEndEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(Status.STATUS_PREPARING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(XAResource.XA_OK, ((XAResourcePrepareEvent) orderedEvents.get(i++)).getReturnCode());
    assertEquals(XAResource.XA_OK, ((XAResourcePrepareEvent) orderedEvents.get(i++)).getReturnCode());
    assertEquals(Status.STATUS_PREPARED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_COMMITTING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(false, ((XAResourceCommitEvent) orderedEvents.get(i++)).isOnePhase());
    assertEquals(false, ((XAResourceCommitEvent) orderedEvents.get(i++)).isOnePhase());
    assertEquals(Status.STATUS_COMMITTED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(DATASOURCE2_NAME, ((ConnectionQueuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
    assertEquals(DATASOURCE2_NAME, ((ConnectionQueuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
}
 
开发者ID:bitronix,项目名称:btm,代码行数:66,代码来源:NewJdbcStrangeUsageMockTest.java

示例15: testConnectionCloseInDifferentContext

import bitronix.tm.BitronixTransactionManager; //导入方法依赖的package包/类
public void testConnectionCloseInDifferentContext() throws Exception {
    if (log.isDebugEnabled()) { log.debug("*** getting TM"); }
    BitronixTransactionManager tm = TransactionManagerServices.getTransactionManager();
    if (log.isDebugEnabled()) { log.debug("*** beginning"); }
    tm.begin();

    if (log.isDebugEnabled()) { log.debug("*** getting connection from DS1"); }
    Connection connection1 = poolingDataSource1.getConnection();
    connection1.createStatement();

    if (log.isDebugEnabled()) { log.debug("*** getting connection from DS2"); }
    Connection connection2 = poolingDataSource2.getConnection();
    connection2.createStatement();

    if (log.isDebugEnabled()) { log.debug("*** closing connection 2"); }
    connection2.close();


    if (log.isDebugEnabled()) { log.debug("*** committing"); }
    tm.commit();
    if (log.isDebugEnabled()) { log.debug("*** TX is done"); }

    if (log.isDebugEnabled()) { log.debug("*** beginning"); }
    tm.begin();


    if (log.isDebugEnabled()) { log.debug("*** closing connection 1"); }
    connection1.close();

    if (log.isDebugEnabled()) { log.debug("*** committing"); }
    tm.commit();
    if (log.isDebugEnabled()) { log.debug("*** TX is done"); }

    // check flow
    List orderedEvents = EventRecorder.getOrderedEvents();
    log.info(EventRecorder.dumpToString());

    assertEquals(22, orderedEvents.size());
    int i=0;
    assertEquals(Status.STATUS_ACTIVE, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(DATASOURCE1_NAME, ((ConnectionDequeuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
    assertEquals(XAResource.TMNOFLAGS, ((XAResourceStartEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(DATASOURCE2_NAME, ((ConnectionDequeuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());
    assertEquals(XAResource.TMNOFLAGS, ((XAResourceStartEvent) orderedEvents.get(i++)).getFlag());

    assertEquals(XAResource.TMSUCCESS, ((XAResourceEndEvent) orderedEvents.get(i++)).getFlag());
    assertEquals(XAResource.TMSUCCESS, ((XAResourceEndEvent) orderedEvents.get(i++)).getFlag());

    assertEquals(Status.STATUS_PREPARING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(XAResource.XA_OK, ((XAResourcePrepareEvent) orderedEvents.get(i++)).getReturnCode());
    assertEquals(XAResource.XA_OK, ((XAResourcePrepareEvent) orderedEvents.get(i++)).getReturnCode());
    assertEquals(Status.STATUS_PREPARED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_COMMITTING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(false, ((XAResourceCommitEvent) orderedEvents.get(i++)).isOnePhase());
    assertEquals(false, ((XAResourceCommitEvent) orderedEvents.get(i++)).isOnePhase());
    assertEquals(Status.STATUS_COMMITTED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(DATASOURCE2_NAME, ((ConnectionQueuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());

    assertEquals(Status.STATUS_ACTIVE, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());

    assertEquals(DATASOURCE1_NAME, ((ConnectionQueuedEvent) orderedEvents.get(i++)).getPooledConnectionImpl().getPoolingDataSource().getUniqueName());

    assertEquals(Status.STATUS_PREPARING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_PREPARED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_COMMITTING, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
    assertEquals(Status.STATUS_COMMITTED, ((JournalLogEvent) orderedEvents.get(i++)).getStatus());
}
 
开发者ID:bitronix,项目名称:btm,代码行数:68,代码来源:NewJdbcStrangeUsageMockTest.java


注:本文中的bitronix.tm.BitronixTransactionManager.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。