Examples of TransactionContext


Examples of org.teiid.dqp.service.TransactionContext

    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
   
   
    @Test public void testGlobalOnePhaseCommit_force_prepare() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
     
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
   
    server.commit(THREAD1, XID1, true, false);
   
    // since there are two sources the commit is not single phase
    Mockito.verify(xaTerminator).prepare(tc.getXid());
    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
   
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

   
   
   
    @Test public void testGlobalOnePhase_teiid_multiple() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
     
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
        server.prepare(THREAD1, XID1, false);

   
    server.commit(THREAD1, XID1, true, false);
   
    // since there are two sources the commit is not single phase
    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
    }   
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    Mockito.verify(xaTerminator).commit(tc.getXid(), false);
    }   
   
    @Test public void testGlobalOnePhaseRoolback() throws Exception {
      server.start(THREAD1, XID1, XAResource.TMNOFLAGS, 100,false);
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
     
        server.end(THREAD1, XID1, XAResource.TMSUCCESS, false);
       
        server.prepare(THREAD1, XID1, false);

   
    server.rollback(THREAD1, XID1, false);
   
    // since there are two sources the commit is not single phase
    Mockito.verify(xaTerminator).rollback(tc.getXid());
    }    
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    // since there are two sources the commit is not single phase
    Mockito.verify(xaTerminator).rollback(tc.getXid());
    }    
   
    @Test public void testRequestCommit() throws Exception{
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
      server.begin(tc);
      server.commit(tc);
      Mockito.verify(tm).commit();
    }
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

      server.commit(tc);
      Mockito.verify(tm).commit();
    }
   
    @Test public void testRequestRollback() throws Exception{
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
      server.begin(tc);
     
      server.rollback(tc);
      Mockito.verify(tm).rollback();
    }    
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

       
        Mockito.verify(txn).setRollbackOnly();
   
   
    @Test public void testRequestCancel() throws Exception{
      TransactionContext tc = server.getOrCreateTransactionContext(THREAD1);
      server.begin(tc);
     
      server.cancelTransactions(THREAD1, true);
      Mockito.verify(txn).setRollbackOnly();
    }     
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

        }
    }

    private void createProcessor() throws TeiidComponentException {
       
        TransactionContext tc = transactionService.getOrCreateTransactionContext(workContext.getSessionId());
       
        Assertion.assertTrue(tc.getTransactionType() != TransactionContext.Scope.REQUEST, "Transaction already associated with request."); //$NON-NLS-1$

        // If local or global transaction is not started.
        if (tc.getTransactionType() == Scope.NONE) {
           
            boolean startAutoWrapTxn = false;
           
            if(RequestMessage.TXN_WRAP_ON.equals(requestMsg.getTxnAutoWrapMode())){
                startAutoWrapTxn = true;
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

            transactions.removeTransactionContext(threadId);
        }
    }

    private TransactionContext checkXAState(final String threadId, final XidImpl xid, boolean transactionExpected, boolean threadBound) throws XATransactionException {
        TransactionContext tc = transactions.getTransactionContext(xid);
       
        if (transactionExpected && tc == null) {
            throw new XATransactionException(XAException.XAER_NOTA, QueryPlugin.Util.getString("TransactionServer.no_global_transaction", xid)); //$NON-NLS-1$
        } else if (!transactionExpected) {
            if (tc != null) {
                throw new XATransactionException(XAException.XAER_DUPID, QueryPlugin.Util.getString("TransactionServer.existing_global_transaction", new Object[] {xid})); //$NON-NLS-1$
            }
            if (!threadBound) {
                tc = transactions.getOrCreateTransactionContext(threadId);
                if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
                    throw new XATransactionException(XAException.XAER_PROTO, QueryPlugin.Util.getString("TransactionServer.existing_transaction", new Object[] {xid, threadId})); //$NON-NLS-1$
                }
            }
            return null;
        }
       
        if (threadBound) {
            if (!threadId.equals(tc.getThreadId())) {
                throw new XATransactionException(XAException.XAER_PROTO, QueryPlugin.Util.getString("TransactionServer.wrong_transaction", xid)); //$NON-NLS-1$
            }
        } else if (tc.getThreadId() != null) {
            throw new XATransactionException(XAException.XAER_PROTO, QueryPlugin.Util.getString("TransactionServer.concurrent_transaction", xid)); //$NON-NLS-1$
        }
       
        return tc;
    }
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    }

    private TransactionContext checkLocalTransactionState(String threadId, boolean transactionExpected)
      throws XATransactionException {

        final TransactionContext tc = transactions.getOrCreateTransactionContext(threadId);

        try {
          if (tc.getTransactionType() != TransactionContext.Scope.NONE) {
              if (tc.getTransactionType() != TransactionContext.Scope.LOCAL) {
                  throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
              }
              if (!transactionExpected) {
                throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.existing_transaction")); //$NON-NLS-1$
              }
              transactionManager.resume(tc.getTransaction());
          } else if (transactionExpected) {
            throw new InvalidTransactionException(QueryPlugin.Util.getString("TransactionServer.no_transaction", threadId)); //$NON-NLS-1$
          }
        } catch (InvalidTransactionException e) {
          throw new XATransactionException(e);
View Full Code Here

Examples of org.teiid.dqp.service.TransactionContext

    /**
     * Local Transaction
     */
    public TransactionContext begin(String threadId) throws XATransactionException {
        TransactionContext tc = checkLocalTransactionState(threadId, false);
        beginDirect(tc);
        tc.setTransactionType(TransactionContext.Scope.LOCAL);
        return tc;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.