Package org.springframework.transaction.support

Examples of org.springframework.transaction.support.SimpleTransactionStatus


  private TransactionStatus status;


  public Object execute(TransactionDefinition definition, TransactionCallback callback) throws TransactionException {
    this.definition = definition;
    this.status = new SimpleTransactionStatus();
    return callback.doInTransaction(this.status);
  }
View Full Code Here



  @Override
  public <T> T execute(TransactionDefinition definition, TransactionCallback<T> callback) throws TransactionException {
    this.definition = definition;
    this.status = new SimpleTransactionStatus();
    return callback.doInTransaction(this.status);
  }
View Full Code Here

    @Test
    public void testSnapshotCreated_NewlyCreatedTransactionCommitted() throws Exception {
        testSubject.setTransactionManager(mockTransactionManager);
        testSubject.afterPropertiesSet();
        SimpleTransactionStatus newlyCreatedTransaction = new SimpleTransactionStatus(true);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(newlyCreatedTransaction);

        testSubject.scheduleSnapshot("stub", aggregateIdentifier);
View Full Code Here

    @Test
    public void testSnapshotCreated_ExistingTransactionNotCommitted() throws Exception {
        testSubject.setTransactionManager(mockTransactionManager);
        testSubject.afterPropertiesSet();
        SimpleTransactionStatus existingTransaction = new SimpleTransactionStatus(false);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(existingTransaction);

        testSubject.scheduleSnapshot("stub", aggregateIdentifier);
View Full Code Here

    @Test
    public void testSnapshotCreated_ExistingTransactionNotRolledBack() throws Exception {
        testSubject.setTransactionManager(mockTransactionManager);
        testSubject.afterPropertiesSet();
        SimpleTransactionStatus existingTransaction = new SimpleTransactionStatus(false);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(existingTransaction);
        doThrow(new RuntimeException("Stub"))
                .when(mockEventStore).appendSnapshotEvent(isA(String.class), isA(DomainEventMessage.class));
View Full Code Here

    @Test
    public void testSnapshotCreated_NewTransactionRolledBack() throws Exception {
        testSubject.setTransactionManager(mockTransactionManager);
        testSubject.afterPropertiesSet();
        SimpleTransactionStatus existingTransaction = new SimpleTransactionStatus(true);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(existingTransaction);
        doThrow(new RuntimeException("Stub"))
                .when(mockEventStore).appendSnapshotEvent(isA(String.class), isA(DomainEventMessage.class));
View Full Code Here

    BDDMockito.<Class<?>> given(testContext.getTestClass()).willReturn(clazz);
    Invocable instance = clazz.newInstance();
    given(testContext.getTestInstance()).willReturn(instance);
    given(testContext.getTestMethod()).willReturn(clazz.getDeclaredMethod("transactionalTest"));

    given(tm.getTransaction(BDDMockito.any(TransactionDefinition.class))).willReturn(new SimpleTransactionStatus());

    assertFalse(instance.invoked);
    TransactionContextHolder.removeCurrentTransactionContext();
    listener.beforeTestMethod(testContext);
    listener.afterTestMethod(testContext);
View Full Code Here

        return committed;
    }

    public TransactionStatus getTransaction(TransactionDefinition transactionDefinition) throws TransactionException {
        committed = false;
        return new SimpleTransactionStatus(true);
    }
View Full Code Here

    @Before
    public void beforeClass() {
        reset(mockTransactionManager);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(new SimpleTransactionStatus(true));
    }
View Full Code Here

    @Before
    public void beforeClass() {
        reset(mockTransactionManager);
        when(mockTransactionManager.getTransaction(isA(TransactionDefinition.class)))
                .thenReturn(new SimpleTransactionStatus(true));
    }
View Full Code Here

TOP

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

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.