Package org.springframework.transaction

Examples of org.springframework.transaction.TransactionDefinition


        PlatformTransactionManager transactionManager = getTransactionManager(
                transactionalTest.getManager());
        transactionManagerInstance.set(transactionManager);

        // create the transaction definition
        TransactionDefinition transactionDefinition = createTransactionDefinition();

        // begins transaction
        TransactionStatus transactionStatus = transactionManager.getTransaction(transactionDefinition);
        transactionStatusInstance.set(transactionStatus);
    }
View Full Code Here


      // ok
    }
  }

  public void testDefaultBeginTransaction() throws Exception {
    TransactionDefinition definition = new DefaultTransactionDefinition();
    MockControl entityControl = MockControl.createControl(EntityManager.class);
    EntityManager entityManager = (EntityManager) entityControl.getMock();

    MockControl txControl = MockControl.createControl(EntityTransaction.class);
    EntityTransaction entityTx = (EntityTransaction) txControl.getMock();
View Full Code Here

      this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
          + "Total disabled tests=" + getDisabledTestCount());
      return;
    }

    TransactionDefinition explicitTransactionDefinition =
        this.transactionAttributeSource.getTransactionAttribute(testMethod, getClass());
    if (explicitTransactionDefinition != null) {
      this.logger.info("Custom transaction definition [" + explicitTransactionDefinition + "] for test method ["
          + getName() + "].");
      setTransactionDefinition(explicitTransactionDefinition);
View Full Code Here

      this.logger.info("**** " + getClass().getName() + "." + getName() + " is disabled in this environment: "
          + "Total disabled tests=" + getDisabledTestCount());
      return;
    }

    TransactionDefinition explicitTransactionDefinition =
        this.transactionAttributeSource.getTransactionAttribute(testMethod, getClass());
    if (explicitTransactionDefinition != null) {
      this.logger.info("Custom transaction definition [" + explicitTransactionDefinition + "] for test method ["
          + getName() + "].");
      setTransactionDefinition(explicitTransactionDefinition);
View Full Code Here

      return;
    }

    TransactionAttribute transactionAttribute = this.attributeSource.getTransactionAttribute(testMethod,
      testContext.getTestClass());
    TransactionDefinition transactionDefinition = null;
    if (transactionAttribute != null) {
      transactionDefinition = new DelegatingTransactionAttribute(transactionAttribute) {

        public String getName() {
          return testMethod.getName();
View Full Code Here

      return;
    }

    TransactionAttribute transactionAttribute =
        this.attributeSource.getTransactionAttribute(testMethod, testContext.getTestClass());
    TransactionDefinition transactionDefinition = null;
    if (transactionAttribute != null) {
      transactionDefinition = new DelegatingTransactionAttribute(transactionAttribute) {
        public String getName() {
          return testMethod.getName();
        }
View Full Code Here

          "Total disabled tests=" + getDisabledTestCount());
      recordDisabled();
      return;
    }

    TransactionDefinition explicitTransactionDefinition =
        this.transactionAttributeSource.getTransactionAttribute(testMethod, getClass());
    if (explicitTransactionDefinition != null) {
      logger.info("Custom transaction definition [" + explicitTransactionDefinition + " for test method " + getName());
      setTransactionDefinition(explicitTransactionDefinition);
    }
View Full Code Here

      this.logger.info("**** " + getClass().getName() + "." + getName() + " disabled in this environment: "
          + "Total disabled tests=" + getDisabledTestCount());
      return;
    }

    TransactionDefinition explicitTransactionDefinition =
        this.transactionAttributeSource.getTransactionAttribute(testMethod, getClass());
    if (explicitTransactionDefinition != null) {
      this.logger.info("Custom transaction definition [" + explicitTransactionDefinition + "] for test method ["
          + getName() + "].");
      setTransactionDefinition(explicitTransactionDefinition);
View Full Code Here

      return;
    }

    TransactionAttribute transactionAttribute =
        this.attributeSource.getTransactionAttribute(testMethod, testContext.getTestClass());
    TransactionDefinition transactionDefinition = null;
    if (transactionAttribute != null) {
      transactionDefinition = new DelegatingTransactionAttribute(transactionAttribute) {
        public String getName() {
          return testMethod.getName();
        }
View Full Code Here

                            Connection.TRANSACTION_NONE,
                            Connection.TRANSACTION_READ_COMMITTED,
                            Connection.TRANSACTION_REPEATABLE_READ,
                            Connection.TRANSACTION_SERIALIZABLE
                    }) {
                        TransactionDefinition txDefinition = new TransactionDefinition() {
                            public boolean isReadOnly() {
                                return readOnly;
                            }

                            public int getTimeout() {
                                return timeout;
                            }

                            public int getPropagationBehavior() {
                                return propagationBehavior;
                            }

                            public String getName() {
                                return opStatus.name()
                                        + ";readOnly=" + readOnly
                                        + ";propagation=" + TransactionOperationFinalizer.propagationNames.get(propagationBehavior)
                                        + ";isolation=" + isolationLevel
                                        + ";timeout=" + timeout
                                        ;
                            }

                            public int getIsolationLevel() {
                                return isolationLevel;
                            }

                            @Override
                            public String toString() {
                                return getName();
                            }
                        };
                        TransactionStatus txStatus = manager.getTransaction(txDefinition);

                        switch (opStatus) {
                            case Committed:
                                manager.commit(txStatus);
                                break;
                            case RolledBack:
                                manager.rollback(txStatus);
                                break;
                            default:
                                fail("Unknown status action: " + opStatus);
                        }

                        assertTransactionOperation(txDefinition.getName(), opStatus, txDefinition);
                        Mockito.reset(spiedOperationCollector); // prepare for next iteration
                    }
                }
            }
        }
View Full Code Here

TOP

Related Classes of org.springframework.transaction.TransactionDefinition

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.