Package com.sun.jini.test.share

Examples of com.sun.jini.test.share.TestParticipant.behave()


        cr = TransactionFactory.create(mgr, Lease.FOREVER);
        str = (ServerTransaction) cr.transaction;
        state = str.mgr.getState(str.id);
        part.setBehavior(OP_JOIN);
        part.setBehavior(OP_VOTE_PREPARED);
        part.behave(cr.transaction);

        if (state != ACTIVE) {
            cr.transaction.commit();
            throw new TestException( "couldn't read ACTIVE state");
        }
View Full Code Here


            str = (ServerTransaction) cr.transaction;
            state = str.mgr.getState(str.id);
            part.setBehavior(OP_JOIN);
            part.setBehavior(OP_VOTE_PREPARED);
            part.setBehavior(OP_TIMEOUT_PREPARE);
            part.behave(cr.transaction);
            Thread commiter = new CommitThread(cr.transaction);
            commiter.start();

            /*
             * By looping on the first ocurrance of
View Full Code Here

            str = (ServerTransaction) cr.transaction;
            part.clearBehavior(OP_TIMEOUT_PREPARE);
            part.setBehavior(OP_JOIN);
            part.setBehavior(OP_VOTE_PREPARED);
            part.setBehavior(OP_TIMEOUT_ABORT);
            part.behave(cr.transaction);
            Thread aborter = new AbortThread(cr.transaction);
            aborter.start();

            /*
             * By looping on the first ocurrance of
View Full Code Here

            }
            cr = TransactionFactory.create(mgr, FORTY_SECONDS);
            str = (ServerTransaction) cr.transaction;
            part.setBehavior(OP_JOIN);
            part.setBehavior(OP_VOTE_PREPARED);
            part.behave(cr.transaction);

            try {
                Thread.sleep(FORTY_SECONDS + SLOP);
            } catch (InterruptedException ie) {}
View Full Code Here

        part.setBehavior(OP_EXCEPTION_ON_PREPARECOMMIT);
        logger.log(Level.INFO, "Configured participant to throw an exception");               
        part.setBehavior(EXCEPTION_TRANSACTION);
        logger.log(Level.INFO, "Configured participant to throw UTE");                               
        logger.log(Level.INFO, "Configuring participant to behave");
        part.behave(cr.transaction);

        logger.log(Level.INFO, "Committing transaction");
        try {
            cr.transaction.commit();
            throw new TestException("CannotCommitException not thrown");
View Full Code Here

        part.setBehavior(OP_EXCEPTION_ON_PREPARECOMMIT);
        logger.log(Level.INFO, "Configured participant to throw an exception");               
        part.setBehavior(EXCEPTION_TRANSACTION);
        logger.log(Level.INFO, "Configured participant to throw UTE");                               
        logger.log(Level.INFO, "Configuring participant to behave");
        part.behave(cr.transaction);

        logger.log(Level.INFO, "Committing transaction");
        try {
            cr.transaction.commit(1000);
            throw new TestException("CannotCommitException not thrown");
View Full Code Here

        part.setBehavior(EXCEPTION_REMOTE);       
        logger.log(Level.INFO, "Configured participant to throw RE 1st");               
        part.setBehavior(EXCEPTION_TRANSACTION);
        logger.log(Level.INFO, "Configured participant to throw UTE 2nd");                               
        logger.log(Level.INFO, "Configuring participant to behave");
        part.behave(cr.transaction);
        Clearer clearer = new Clearer(part);
        Thread t = new Thread(clearer);
        logger.log(Level.INFO, "Running clearer thread");                       
        t.start();
        logger.log(Level.INFO, "Committing transaction");                       
View Full Code Here

            logger.log(Level.INFO, "TwoPhaseTest: run: mgr = " + mgr);
        }
        cr = TransactionFactory.create(mgr, Lease.FOREVER);
        part.setBehavior(OP_JOIN);
        part.setBehavior(OP_VOTE_NOTCHANGED);
        part.behave(cr.transaction);
        cr.transaction.commit();
        part.clearBehavior(OP_VOTE_NOTCHANGED);

        mgr = manager();
View Full Code Here

            logger.log(Level.INFO, "TwoPhaseTest: run: mgr = " + mgr);
        }
        cr = TransactionFactory.create(mgr, Lease.FOREVER);
        part.setBehavior(OP_JOIN);
        part.setBehavior(OP_VOTE_PREPARED);
        part.behave(cr.transaction);
        cr.transaction.commit();
        part.clearBehavior(OP_VOTE_PREPARED);

        try {
            mgr = manager();
View Full Code Here

                logger.log(Level.INFO, "TwoPhaseTest: run: mgr = " + mgr);
            }
            cr = TransactionFactory.create(mgr, Lease.FOREVER);
            part.setBehavior(OP_JOIN);
            part.setBehavior(OP_VOTE_ABORTED);
            part.behave(cr.transaction);
            cr.transaction.commit();
      throw new TestException("CannotCommitException is not raised");
        } catch (CannotCommitException cce) {

            // Expected exception. Test passed.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.