Package org.springframework.transaction.jta

Examples of org.springframework.transaction.jta.JtaTransactionManager


  protected JtaTransactionManager newJtaTransactionManager(TransactionManager tm) {
    return new JtaTransactionManager(tm);
  }

  protected JtaTransactionManager newJtaTransactionManager(UserTransaction ut, TransactionManager tm) {
    return new JtaTransactionManager(ut, tm);
  }
View Full Code Here


    synchControl.setVoidCallable(1);
    synch.afterCompletion(TransactionSynchronization.STATUS_COMMITTED);
    synchControl.setVoidCallable(1);
    synchControl.replay();

    JtaTransactionManager ptm = newJtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    tt.setName("txName");

    assertEquals(JtaTransactionManager.SYNCHRONIZATION_ALWAYS, ptm.getTransactionSynchronization());
    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    assertNull(TransactionSynchronizationManager.getCurrentTransactionName());
    assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
View Full Code Here

    synchControl.setVoidCallable(1);
    synch.afterCompletion(TransactionSynchronization.STATUS_COMMITTED);
    synchControl.setVoidCallable(1);
    synchControl.replay();

    JtaTransactionManager ptm = newJtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    ptm.setTransactionSynchronization(JtaTransactionManager.SYNCHRONIZATION_ON_ACTUAL_TRANSACTION);
    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        // something transactional
        assertTrue(TransactionSynchronizationManager.isSynchronizationActive());
View Full Code Here

    utControl.setVoidCallable(1);
    ut.commit();
    utControl.setVoidCallable(1);
    utControl.replay();

    JtaTransactionManager ptm = newJtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    ptm.setTransactionSynchronization(JtaTransactionManager.SYNCHRONIZATION_NEVER);
    ptm.afterPropertiesSet();

    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    tt.execute(new TransactionCallbackWithoutResult() {
      protected void doInTransactionWithoutResult(TransactionStatus status) {
        assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
View Full Code Here

    pm.close();
    pmControl.setVoidCallable(1);
    pmfControl.replay();
    pmControl.replay();

    JtaTransactionManager ptm = new JtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    final List l = new ArrayList();
    l.add("test");
    assertTrue("Hasn't thread pm", !TransactionSynchronizationManager.hasResource(pmf));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
View Full Code Here

    pm.close();
    pmControl.setVoidCallable(1);
    pmfControl.replay();
    pmControl.replay();

    JtaTransactionManager ptm = new JtaTransactionManager(ut, tm);
    final TransactionTemplate tt = new TransactionTemplate(ptm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);
    final List l = new ArrayList();
    l.add("test");
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
View Full Code Here

    utControl.replay();
    tmControl.replay();
    session1Control.replay();
    session2Control.replay();

    JtaTransactionManager ptm = new JtaTransactionManager();
    ptm.setUserTransaction(ut);
    ptm.setTransactionManager(tm);
    final TransactionTemplate tt = new TransactionTemplate(ptm);
    tt.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW);

    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
    tt.execute(new TransactionCallback() {
View Full Code Here

    final Session session = (Session) sessionControl.getMock();
    final SessionFactory sf = new SingleSessionFactory(session);

    sessionControl.replay();

    JtaTransactionManager ptm = new JtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    final List l = new ArrayList();
    l.add("test");
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

    utControl.replay();
    tmControl.replay();
    sessionControl.replay();

    JtaTransactionManager ptm = new JtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    final List l = new ArrayList();
    l.add("test");
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
    assertTrue("Hasn't thread session", !TransactionSynchronizationManager.hasResource(sf));
View Full Code Here

    con.close();
    conControl.setVoidCallable(1);
    conControl.replay();
    dsControl.replay();

    JtaTransactionManager ptm = new JtaTransactionManager(ut);
    TransactionTemplate tt = new TransactionTemplate(ptm);
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());

    tt.execute(new TransactionCallbackWithoutResult() {
View Full Code Here

TOP

Related Classes of org.springframework.transaction.jta.JtaTransactionManager

Copyright © 2018 www.massapicom. 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.