Package com.arjuna.mw.wst11

Examples of com.arjuna.mw.wst11.BusinessActivityManager


    public void testRollback() throws Exception {

        System.out
                .println("\n\nStarting 'testRollback'. This test invokes a WS within an AT. The AT is later rolled back, which causes the back-end resource(s) to be rolled back.");
        System.out.println("[CLIENT] Creating a new WS-AT User Transaction");
        UserTransaction ut = UserTransactionFactory.userTransaction();
        try {
            System.out
                    .println("[CLIENT] Beginning Atomic Transaction (All calls to Web services that support WS-AT wil be included in this transaction)");
            ut.begin();
            System.out.println("[CLIENT] invoking makeBooking() on WS");
            client.makeBooking();
            System.out
                    .println("[CLIENT] rolling back Atomic Transaction (This will cause the AT and thus the enlisted back-end resources to rollback)");
            ut.rollback();

            // Check the booking is visible after the transaction has committed.
            Assert.assertEquals(0, client.getBookingCount());

        } finally {
View Full Code Here


     */
    private void testAtomicTransaction(int restaurantSeats, int theatreSeats, int theatreArea, boolean bookTaxi) throws Exception
    {
        System.out.println("CLIENT: obtaining userTransaction...");

        UserTransaction ut = UserTransactionFactory.userTransaction();

        System.out.println("CLIENT: starting the transaction...");

        ut.begin();

        System.out.println("CLIENT: transaction ID= " + ut.toString());

        System.out.println("CLIENT: calling business Web Services...");

        restaurantAT.bookSeats(restaurantSeats);
        theatreAT.bookSeats(theatreSeats, theatreArea);
        if (bookTaxi)
        {
            taxiAT.bookTaxi();
        }

        System.out.println("CLIENT: calling commit on the transaction...");

        ut.commit();

        System.out.println("done.");
        System.out.flush();
    }
View Full Code Here

        addDefaultBinding("service1", serviceURL1);
        addDefaultBinding("service2", serviceURL2);
        addDefaultBinding("service3", serviceURL3);

        UserTransaction tx = UserTransactionFactory.userTransaction();


        // start the transaction

        try {
            tx.begin();
        } catch (WrongStateException e) {
            exception = e;
        } catch (SystemException e) {
            exception = e;
        }

        if (exception != null) {
            error("txbegin failure " + exception);
            return;
        }

        // invoke the service and tell it to prepare and  commit
        List<String> commands = new ArrayList<String>();
        List<String> results = new ArrayList<String>();

        commands.add("block");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{service2}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{service3}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("endblock");

        try {
            processCommands(commands, results);
        } catch (Exception e) {
            exception = e;
        }

        if (exception != null) {
            error("test failure " + exception);
            return;
        }

        // now commit the transaction

        try {
            tx.commit();
        } catch (TransactionRolledBackException e) {
            exception = e;
        } catch (UnknownTransactionException e) {
            exception = e;
        } catch (SystemException e) {
View Full Code Here

            serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
        }

        addDefaultBinding("service1", serviceURL1);

        UserTransaction tx = UserTransactionFactory.userTransaction();


        // start the transaction

        try {
            tx.begin();
        } catch (WrongStateException e) {
            exception = e;
        } catch (SystemException e) {
            exception = e;
        }

        if (exception != null) {
            error("txbegin failure " + exception);
            return;
        }

        List<String> commands = new ArrayList<String>();
        List<String> results = new ArrayList<String>();

        commands.add("block");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("endblock");

        try {
            processCommands(commands, results);
        } catch (Exception e) {
            exception = e;
        }

        if (exception != null) {
            error("test failure " + exception);
            return;
        }

        // now commit the transaction

        try {
            tx.commit();
        } catch (TransactionRolledBackException e) {
            exception = e;
        } catch (UnknownTransactionException e) {
            exception = e;
        } catch (SystemException e) {
View Full Code Here

            serviceURL1 = "http://localhost:8080/xtstest/xtsservicetest1";
        }

        addDefaultBinding("service1", serviceURL1);

        UserTransaction tx = UserTransactionFactory.userTransaction();

        // start the transaction

        try {
            tx.begin();
        } catch (WrongStateException e) {
            exception = e;
        } catch (SystemException e) {
            exception = e;
        }

        if (exception != null) {
            error("txbegin failure " + exception);
            return;
        }

        List<String> commands = new ArrayList<String>();
        List<String> results = new ArrayList<String>();

        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");

        try {
            processCommands(commands, results);
        } catch (Exception e) {
            exception = e;
        }

        if (exception != null) {
            error("test failure " + exception);
            return;
        }

        // now commit the transaction

        try {
            tx.commit();
        } catch (TransactionRolledBackException e) {
            exception = e;
        } catch (UnknownTransactionException e) {
            exception = e;
        } catch (SystemException e) {
View Full Code Here

        }

        addDefaultBinding("service1", serviceURL1);
        addDefaultBinding("subservice1", subserviceURL1);

        UserTransaction tx = UserTransactionFactory.userTransaction();

        // start the transaction

        try {
            tx.begin();
        } catch (WrongStateException e) {
            exception = e;
        } catch (SystemException e) {
            exception = e;
        }

        if (exception != null) {
            error("txbegin failure " + exception);
            return;
        }

        List<String> commands = new ArrayList<String>();
        List<String> results = new ArrayList<String>();

        commands.add("block");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{subservice1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("next");
        commands.add("serve");
        commands.add("{subservice1}");
        commands.add("enlistDurable");
        commands.add("prepare");
        commands.add("commit");
        commands.add("endblock");

        try {
            processCommands(commands, results);
        } catch (Exception e) {
            exception = e;
        }

        if (exception != null) {
            error("test failure " + exception);
            return;
        }

        // now commit the transaction which should also commit the subtransaction

        try {
            tx.commit();
        } catch (TransactionRolledBackException e) {
            exception = e;
        } catch (UnknownTransactionException e) {
            exception = e;
        } catch (SystemException e) {
View Full Code Here

{

    public static void testSingleParticipant()
            throws Exception
    {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();
      DemoDurableParticipant p = new DemoDurableParticipant();

      ut.begin();
      try {
      tm.enlistForDurableTwoPhase(p, p.identifier());
        catch (Exception eouter) {
            try {
                ut.rollback();
            } catch(Exception einner) {
            }
            throw eouter;
        }

      ut.commit();
    }
View Full Code Here

{

    public static void testSuspendTransaction()
            throws Exception
    {
      UserTransaction ut = UserTransaction.getUserTransaction();
      TransactionManager tm = TransactionManager.getTransactionManager();

      ut.begin();

      TxContext ctx = tm.suspend();

      System.out.println("Suspended: "+ctx);
    }
View Full Code Here

public class CommitExceptionInPrepare extends TestCase
{
    public static void testCommitExceptionInPrepare()
            throws Exception
    {
        UserTransaction ut = UserTransaction.getUserTransaction();
  try
  {
      TransactionManager tm = TransactionManager.getTransactionManager();
      FailureParticipant p1 = new FailureParticipant(FailureParticipant.FAIL_IN_PREPARE, FailureParticipant.WRONG_STATE);
      DemoDurableParticipant p2 = new DemoDurableParticipant();

      ut.begin();

      tm.enlistForDurableTwoPhase(p1, "failure");
      tm.enlistForDurableTwoPhase(p2, p2.identifier());
    } catch (Exception eouter) {
        try {
            ut.rollback();
        } catch(Exception einner) {
        }
        throw eouter;
    }
  try {
      ut.commit();

      fail("expected SystemException");
  }
  catch (com.arjuna.wst.SystemException ex)
  {
View Full Code Here

{

    public static void testPrintTransaction()
            throws Exception
    {
      UserTransaction ut = UserTransaction.getUserTransaction();

      ut.begin();

      System.out.println("Started: "+ut);

      ut.commit();

      System.out.println("\nCurrent: "+ut);
  }
View Full Code Here

TOP

Related Classes of com.arjuna.mw.wst11.BusinessActivityManager

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.