Package com.arjuna.mw.wst11

Examples of com.arjuna.mw.wst11.BusinessActivityManager


     * @throws Exception if something goes wrong
     */
    @Test
    public void testCancel() throws Exception {
        log.info("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value = "1";

            log.info("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA will be included in this activity)");
            uba.begin();

            log.info("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value);

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value));

            log.info("[CLIENT] Cancelling Business Activity (This will cause the work to be compensated)");
            uba.cancel();

            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value));

        } finally {
            cancelIfActive(uba);
View Full Code Here


     * @throws Exception if something goes wrong.
     */
    @Test
    public void testSuccess() throws Exception {
        log.info("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value1 = "1";
            String value2 = "2";

            log.info("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA wil be included in this activity)");
            uba.begin();

            log.info("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value1);
            log.info("[CLIENT] invoking addValueToSet(2) on WS");
            client.addValueToSet(value2);

            log.info("[CLIENT] Closing Business Activity (This will cause the BA to complete successfully)");
            uba.close();

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value1));
            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value2));

        } finally {
View Full Code Here

     * @throws Exception if something goes wrong
     */
    @Test
    public void testCancel() throws Exception {
        log.info("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value1 = "1";
            String value2 = "2";

            log.info("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA will be included in this activity)");
            uba.begin();

            log.info("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value1);
            log.info("[CLIENT] invoking addValueToSet(2) on WS");
            client.addValueToSet(value2);

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value1));
            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value2));

            log.info("[CLIENT] Cancelling Business Activity (This will cause the work to be compensated)");
            uba.cancel();

            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value1));
            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value2));

        } finally {
View Full Code Here

    @Test
    public void testActiveTransaction() throws Exception {
        final String deploymentUrl = getDeploymentUrl();
        final CompensatableService compensatableService = CompensatableClient.newInstance(deploymentUrl);

        final UserBusinessActivity userBusinessActivity = UserBusinessActivity.getUserBusinessActivity();

        userBusinessActivity.begin();
        final boolean isTransactionActive = compensatableService.isTransactionActive();
        userBusinessActivity.close();

        Assert.assertEquals(true, isTransactionActive);
    }
View Full Code Here

    @Test
    public void testSuccess() throws Exception {
        System.out
                .println("\n\nStarting 'testSuccess'. This test invokes a WS within a BA. The BA is later closed, which causes the WS call to complete successfully.");
        System.out.println("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value = "1";

            System.out
                    .println("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA wil be included in this activity)");
            uba.begin();

            System.out.println("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value);

            System.out.println("[CLIENT] Closing Business Activity (This will cause the BA to complete successfully)");
            uba.close();

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value));
        } finally {
            cancelIfActive(uba);
            client.clear();
View Full Code Here

    @Test
    public void testCancel() throws Exception {
        System.out
                .println("\n\nStarting 'testCancel'. This test invokes a WS within a BA. The BA is later cancelled, which causes these WS call to be compensated.");
        System.out.println("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value = "1";

            System.out
                    .println("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA will be included in this activity)");
            uba.begin();

            System.out.println("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value);

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value));

            System.out.println("[CLIENT] Cancelling Business Activity (This will cause the work to be compensated)");
            uba.cancel();

            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value));

        } finally {
            cancelIfActive(uba);
View Full Code Here

    public void testSuccess() throws Exception {

        System.out
                .println("\n\nStarting 'testSuccess'. This test invokes a WS twice within a BA. The BA is later closes, which causes these WS calls to complete successfully.");
        System.out.println("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value1 = "1";
            String value2 = "2";

            System.out
                    .println("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA wil be included in this activity)");
            uba.begin();

            System.out.println("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value1);
            System.out.println("[CLIENT] invoking addValueToSet(2) on WS");
            client.addValueToSet(value2);

            System.out.println("[CLIENT] Closing Business Activity (This will cause the BA to complete successfully)");
            uba.close();

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value1));
            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value2));

        } finally {
View Full Code Here

    public void testCancel() throws Exception {

        System.out
                .println("\n\nStarting 'testCancel'. This test invokes a WS twice within a BA. The BA is later cancelled, which causes these WS calls to be compensated.");
        System.out.println("[CLIENT] Creating a new Business Activity");
        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();
        try {
            String value1 = "1";
            String value2 = "2";

            System.out
                    .println("[CLIENT] Beginning Business Activity (All calls to Web services that support WS-BA will be included in this activity)");
            uba.begin();

            System.out.println("[CLIENT] invoking addValueToSet(1) on WS");
            client.addValueToSet(value1);
            System.out.println("[CLIENT] invoking addValueToSet(2) on WS");
            client.addValueToSet(value2);

            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value1));
            Assert.assertTrue("Expected value to be in the set, but it wasn't", client.isInSet(value2));

            System.out.println("[CLIENT] Cancelling Business Activity (This will cause the work to be compensated)");
            uba.cancel();

            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value1));
            Assert.assertTrue("Expected value to not be in the set, but it was", !client.isInSet(value2));

        } finally {
View Full Code Here

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

        UserBusinessActivity uba = UserBusinessActivityFactory.userBusinessActivity();

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

        uba.begin();

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

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

        boolean isOK = false ;
        try
        {
            if (restaurantBA.bookSeats(restaurantSeats) && theatreBA.bookSeats(theatreSeats, theatreArea))
            {
                isOK = !bookTaxi || taxiBA.bookTaxi() ;
            }
        }
        catch (final Throwable th)
        {
            System.out.println("CLIENT: caught exception processing bookings, cancelling (" + th.getMessage() + ")") ;
        }

        if (isOK)
        {
            System.out.println("CLIENT: all OK");
            System.out.println("CLIENT: calling close on the transaction...");
            uba.close();
        }
        else
        {
            System.out.println("CLIENT: one or more services failed, calling cancel.");
            uba.cancel();
        }

        System.out.println("CLIENT: done.");
        System.out.flush();

View Full Code Here

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

        addDefaultBinding("service1", serviceURL1);

        UserBusinessActivity ba = UserBusinessActivityFactory.userBusinessActivity();

        // start the transaction

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

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

        List<String> resultsList;
        String participantId;

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

        commands.add("block");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistCoordinatorCompletion");
        commands.add("complete");
        commands.add("close");
        commands.add("next");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistCoordinatorCompletion");
        commands.add("complete");
        commands.add("close");
        commands.add("next");
        commands.add("serve");
        commands.add("{service1}");
        commands.add("enlistCoordinatorCompletion");
        commands.add("complete");
        commands.add("close");
        commands.add("endblock");

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

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

        // now close the activity

        try {
            ba.close();
        } catch (TransactionRolledBackException e) {
            exception = e;
        } catch (UnknownTransactionException e) {
            exception = e;
        } catch (SystemException e) {
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.