Package com.sun.sgs.test.util

Examples of com.sun.sgs.test.util.DummyTransactionProxy


    }

    /** Prints the test case and sets the service field to a new instance. */
    @Before
    public void setUp() {
  txnProxy = new DummyTransactionProxy();
  dataService = new DummyDataService();
  txnProxy.setComponent(DataService.class, dataService);
  collectionsFactory = new BindingKeyedCollectionsImpl(txnProxy);
    }
View Full Code Here


    /**
     * Test that a failure in isPrepared during commit doesn't cause the commit
     * to fail to clear the thread context.
     */
    public void testIsPreparedFailsDuringCommit() throws Exception {
  DummyTransactionProxy txnProxy = new DummyTransactionProxy();
  TransactionContextFactory<TransactionContext> contextFactory =
      new TransactionContextFactory<TransactionContext>(txnProxy,
                                          "TestTransactionContextFactory")
            {
          protected TransactionContext createContext(Transaction txn) {
        return new TransactionContext(txn) {
      public boolean isPrepared() {
          if (isPrepared) {
        throw new RuntimeException(
            "isPrepared fails during commit");
          } else {
        return false;
          }
      }
      public void abort(boolean retryable) { }
      public void commit() { }
        };
    }
      };
  DummyTransaction txn = new DummyTransaction(
      DummyTransaction.UsePrepareAndCommit.NO);
  txnProxy.setCurrentTransaction(txn);
  contextFactory.joinTransaction();
  txn.commit();
  txn = new DummyTransaction();
  txnProxy.setCurrentTransaction(txn);
  contextFactory.joinTransaction();
  txn.commit();
    }
View Full Code Here

    }

    /** Prints the test case and sets the service field to a new instance. */
    @Before
    public void setUp() {
  txnProxy = new DummyTransactionProxy();
  dataService = new DummyDataService();
  txnProxy.setComponent(DataService.class, dataService);
  collectionsFactory = new BindingKeyedCollectionsImpl(txnProxy);
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.test.util.DummyTransactionProxy

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.