Search in sources :

Example 1 with XaTransactionTable

use of org.infinispan.transaction.xa.XaTransactionTable in project infinispan by infinispan.

the class ForgetTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    ConfigurationBuilder configuration = defaultRecoveryConfig();
    createCluster(configuration, 2);
    waitForClusterToForm();
    XaTransactionTable txTable = tt(0);
    PostCommitRecoveryStateTest.RecoveryManagerDelegate recoveryManager = new PostCommitRecoveryStateTest.RecoveryManagerDelegate(TestingUtil.extractComponent(cache(0), RecoveryManager.class));
    TestingUtil.replaceField(recoveryManager, "recoveryManager", txTable, XaTransactionTable.class);
}
Also used : RecoveryManager(org.infinispan.transaction.xa.recovery.RecoveryManager) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) PostCommitRecoveryStateTest(org.infinispan.tx.recovery.PostCommitRecoveryStateTest) XaTransactionTable(org.infinispan.transaction.xa.XaTransactionTable)

Example 2 with XaTransactionTable

use of org.infinispan.transaction.xa.XaTransactionTable in project infinispan by infinispan.

the class TransactionXaAdapterTmIntegrationTest method setUp.

@BeforeMethod
public void setUp() throws XAException {
    Configuration configuration = new ConfigurationBuilder().build();
    XaTransactionTable txTable = new XaTransactionTable();
    txCoordinator = new TransactionCoordinator();
    TestingUtil.inject(txTable, configuration, txCoordinator, TransactionOriginatorChecker.LOCAL);
    txTable.start();
    txTable.startXidMapping();
    TransactionFactory gtf = new TransactionFactory();
    gtf.init(false, false, true, false);
    GlobalTransaction globalTransaction = gtf.newGlobalTransaction(null, false);
    EmbeddedBaseTransactionManager tm = new EmbeddedBaseTransactionManager();
    localTx = new LocalXaTransaction(new EmbeddedTransaction(tm), globalTransaction, false, 1, 0);
    xid = EmbeddedTransaction.createXid(uuid);
    InvocationContextFactory icf = new TransactionalInvocationContextFactory();
    CommandsFactory commandsFactory = mock(CommandsFactory.class);
    AsyncInterceptorChain invoker = mock(AsyncInterceptorChain.class);
    when(invoker.invokeAsync(any(), any())).thenReturn(CompletableFutures.completedNull());
    TestingUtil.inject(txCoordinator, commandsFactory, icf, invoker, txTable, configuration);
    xaAdapter = new TransactionXaAdapter(localTx, txTable);
    xaAdapter.start(xid, 0);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) EmbeddedTransaction(org.infinispan.transaction.tm.EmbeddedTransaction) XaTransactionTable(org.infinispan.transaction.xa.XaTransactionTable) CommandsFactory(org.infinispan.commands.CommandsFactory) Configuration(org.infinispan.configuration.cache.Configuration) AsyncInterceptorChain(org.infinispan.interceptors.AsyncInterceptorChain) TransactionCoordinator(org.infinispan.transaction.impl.TransactionCoordinator) EmbeddedBaseTransactionManager(org.infinispan.transaction.tm.EmbeddedBaseTransactionManager) GlobalTransaction(org.infinispan.transaction.xa.GlobalTransaction) TransactionalInvocationContextFactory(org.infinispan.context.impl.TransactionalInvocationContextFactory) TransactionXaAdapter(org.infinispan.transaction.xa.TransactionXaAdapter) TransactionFactory(org.infinispan.transaction.xa.TransactionFactory) LocalXaTransaction(org.infinispan.transaction.xa.LocalXaTransaction) InvocationContextFactory(org.infinispan.context.InvocationContextFactory) TransactionalInvocationContextFactory(org.infinispan.context.impl.TransactionalInvocationContextFactory) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 3 with XaTransactionTable

use of org.infinispan.transaction.xa.XaTransactionTable in project infinispan by infinispan.

the class PostCommitRecoveryStateTest method createCacheManagers.

@Override
protected void createCacheManagers() throws Throwable {
    ConfigurationBuilder configuration = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC, true);
    configuration.locking().useLockStriping(false).transaction().transactionManagerLookup(new EmbeddedTransactionManagerLookup()).useSynchronization(false).recovery().enable().clustering().stateTransfer().fetchInMemoryState(false);
    createCluster(configuration, 2);
    waitForClusterToForm();
    ComponentRegistry componentRegistry = this.cache(0).getAdvancedCache().getComponentRegistry();
    XaTransactionTable txTable = (XaTransactionTable) componentRegistry.getComponent(TransactionTable.class);
    TestingUtil.replaceField(new RecoveryManagerDelegate(TestingUtil.extractComponent(cache(0), RecoveryManager.class)), "recoveryManager", txTable, XaTransactionTable.class);
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) XaTransactionTable(org.infinispan.transaction.xa.XaTransactionTable) ComponentRegistry(org.infinispan.factories.ComponentRegistry) XaTransactionTable(org.infinispan.transaction.xa.XaTransactionTable) TransactionTable(org.infinispan.transaction.impl.TransactionTable) EmbeddedTransactionManagerLookup(org.infinispan.transaction.lookup.EmbeddedTransactionManagerLookup)

Aggregations

ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)3 XaTransactionTable (org.infinispan.transaction.xa.XaTransactionTable)3 CommandsFactory (org.infinispan.commands.CommandsFactory)1 Configuration (org.infinispan.configuration.cache.Configuration)1 InvocationContextFactory (org.infinispan.context.InvocationContextFactory)1 TransactionalInvocationContextFactory (org.infinispan.context.impl.TransactionalInvocationContextFactory)1 ComponentRegistry (org.infinispan.factories.ComponentRegistry)1 AsyncInterceptorChain (org.infinispan.interceptors.AsyncInterceptorChain)1 TransactionCoordinator (org.infinispan.transaction.impl.TransactionCoordinator)1 TransactionTable (org.infinispan.transaction.impl.TransactionTable)1 EmbeddedTransactionManagerLookup (org.infinispan.transaction.lookup.EmbeddedTransactionManagerLookup)1 EmbeddedBaseTransactionManager (org.infinispan.transaction.tm.EmbeddedBaseTransactionManager)1 EmbeddedTransaction (org.infinispan.transaction.tm.EmbeddedTransaction)1 GlobalTransaction (org.infinispan.transaction.xa.GlobalTransaction)1 LocalXaTransaction (org.infinispan.transaction.xa.LocalXaTransaction)1 TransactionFactory (org.infinispan.transaction.xa.TransactionFactory)1 TransactionXaAdapter (org.infinispan.transaction.xa.TransactionXaAdapter)1 RecoveryManager (org.infinispan.transaction.xa.recovery.RecoveryManager)1 PostCommitRecoveryStateTest (org.infinispan.tx.recovery.PostCommitRecoveryStateTest)1 BeforeMethod (org.testng.annotations.BeforeMethod)1