Package org.squirrelframework.foundation.fsm

Examples of org.squirrelframework.foundation.fsm.UntypedStateMachine.fire()


        builder.externalTransition().from("A").to("B").on(FSMEvent.ToB).callMethod("fromAToB");
        builder.onEntry("B").callMethod("ontoB");
       
        // 4. Use State Machine
        UntypedStateMachine fsm = builder.newStateMachine("A");
        fsm.fire(FSMEvent.ToB, 10);
       
        System.out.println("Current state is "+fsm.getCurrentState());
    }
}
View Full Code Here


        fsm.start();
        try {
            TimeUnit.MILLISECONDS.sleep(500);
        } catch (InterruptedException e) {
        }
        fsm.fire("SECOND");
        fsm.terminate();
        assertEquals("AToBOnFIRST.AToBOnFIRST.AToBOnFIRST.AToBOnFIRST.AToBOnFIRST", logger.toString());
    }
   
    @Test
View Full Code Here

       
        // thread 1 start process event "FIRST"
        new Thread(new Runnable() {
            @Override
            public void run() {
                fsm.fire("FIRST");
                eventCondition.countDown();
            }
        }, "Test-Thread-1").start();
       
        // thread 2 read fsm state while processing event "FIRST"
View Full Code Here

                try {
                    actionCondition.await();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                fsm.fire("SECOND");
                eventCondition.countDown();
            }
        }, "Test-Thread-5").start();
       
        // wait for all threads finish processing events then check result
View Full Code Here

        InOrder inOrder = Mockito.inOrder(callSequence.mock);
        // thread 1 fire event "FIRST"
        new Thread(new Runnable() {
            @Override
            public void run() {
                fsm.fire("FIRST");
                eventCondition.countDown();
            }
        }, "Test-Thread-1").start();
       
        // thread 2 add listener and fire event "SECOND" during thread 1 processing event "FIRST"
View Full Code Here

                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                fsm.addDeclarativeListener(l3);
                l1Condition.countDown();
                fsm.fire("SECOND");
                eventCondition.countDown();
            }
        }, "Test-Thread-2").start();
       
        // wait for all threads finish processing events then check result
View Full Code Here

        fsm.addDeclarativeListener(l1);
        fsm.addDeclarativeListener(l2);
        fsm.addDeclarativeListener(l3);
       
        InOrder inOrder = Mockito.inOrder(callSequence.mock);
        fsm.fire("FIRST");
        try {
            lCondition.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
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.