Package org.springframework.transaction.support

Examples of org.springframework.transaction.support.DefaultTransactionDefinition


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

    JtaTransactionManager ptm = newJtaTransactionManager(ut);
    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    TransactionStatus status = ptm.getTransaction(new DefaultTransactionDefinition());
    assertTrue(TransactionSynchronizationManager.isSynchronizationActive());
    // first: rollback
    ptm.rollback(status);
    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    try {
View Full Code Here


      tm.setFailEarlyOnGlobalRollbackOnly(true);
    }
    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

    TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
    TestTransactionSynchronization synch =
        new TestTransactionSynchronization(ds, TransactionSynchronization.STATUS_ROLLED_BACK);
    TransactionSynchronizationManager.registerSynchronization(synch);

    boolean outerTransactionBoundaryReached = false;
View Full Code Here

    // tm has no synch enabled (used at outer level), tm2 has synch enabled (inner level)

    assertTrue("Hasn't thread connection", !TransactionSynchronizationManager.hasResource(ds));
    assertTrue("Synchronization not active", !TransactionSynchronizationManager.isSynchronizationActive());

    TransactionStatus ts = tm.getTransaction(new DefaultTransactionDefinition());
    final TestTransactionSynchronization synch =
        new TestTransactionSynchronization(ds, TransactionSynchronization.STATUS_UNKNOWN);

    try {
      assertTrue("Is new transaction", ts.isNewTransaction());
View Full Code Here

        new ExpectedLookupTemplate(WebSphereUowTransactionManager.DEFAULT_UOW_MANAGER_NAME, manager);
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager();
    ptm.setJndiTemplate(jndiTemplate);
    ptm.afterPropertiesSet();

    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    assertEquals("result", ptm.execute(definition, new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        return "result";
      }
    }));
View Full Code Here

    jndiTemplate.addObject(WebSphereUowTransactionManager.DEFAULT_UOW_MANAGER_NAME, manager);
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager();
    ptm.setJndiTemplate(jndiTemplate);
    ptm.afterPropertiesSet();

    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    TransactionStatus ts = ptm.getTransaction(definition);
    ptm.commit(ts);
    assertEquals("result", ptm.execute(definition, new TransactionCallback() {
      public Object doInTransaction(TransactionStatus status) {
        return "result";
View Full Code Here

  }

  public void testPropagationMandatoryFailsInCaseOfNoExistingTransaction() {
    MockUOWManager manager = new MockUOWManager();
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager(manager);
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    definition.setPropagationBehavior(TransactionDefinition.PROPAGATION_MANDATORY);

    try {
      ptm.execute(definition, new TransactionCallback() {
        public Object doInTransaction(TransactionStatus status) {
          return "result";
View Full Code Here

  private void doTestNewTransactionSynchronization(int propagationBehavior, final int synchMode) {
    MockUOWManager manager = new MockUOWManager();
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager(manager);
    ptm.setTransactionSynchronization(synchMode);
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    definition.setPropagationBehavior(propagationBehavior);
    definition.setReadOnly(true);

    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    assertFalse(TransactionSynchronizationManager.isActualTransactionActive());
    assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
View Full Code Here

  private void doTestNewTransactionWithCommit(int propagationBehavior, final int synchMode) {
    MockUOWManager manager = new MockUOWManager();
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager(manager);
    ptm.setTransactionSynchronization(synchMode);
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    definition.setPropagationBehavior(propagationBehavior);
    definition.setReadOnly(true);

    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    assertFalse(TransactionSynchronizationManager.isActualTransactionActive());
    assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
View Full Code Here

  }

  public void testNewTransactionWithCommitAndTimeout() {
    MockUOWManager manager = new MockUOWManager();
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager(manager);
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();
    definition.setTimeout(10);
    definition.setReadOnly(true);

    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    assertFalse(TransactionSynchronizationManager.isActualTransactionActive());
    assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
View Full Code Here

      public void runUnderUOW(int type, boolean join, UOWAction action) throws UOWException {
        throw new UOWException(rex);
      }
    };
    WebSphereUowTransactionManager ptm = new WebSphereUowTransactionManager(manager);
    DefaultTransactionDefinition definition = new DefaultTransactionDefinition();

    assertFalse(TransactionSynchronizationManager.isSynchronizationActive());
    assertFalse(TransactionSynchronizationManager.isActualTransactionActive());
    assertFalse(TransactionSynchronizationManager.isCurrentTransactionReadOnly());
View Full Code Here

TOP

Related Classes of org.springframework.transaction.support.DefaultTransactionDefinition

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.