Package org.jmock.lib.concurrent

Examples of org.jmock.lib.concurrent.DeterministicScheduler$CallableRunnableAdapter


        }});

        manager.enqueue( action );

        // this is a jmock helper class that implements the ExecutorService interface
        DeterministicScheduler pool = new DeterministicScheduler();
        // set the pool
        manager.setPool( pool );

        // executes all pending actions using current thread
        pool.runUntilIdle();

        // check expectations
        context.assertIsSatisfied();
    }
View Full Code Here


    public void testFireCorrectly() throws InterruptedException {
        // creates a mock action
        final PartitionTaskManager.Action action = context.mock( PartitionTaskManager.Action.class );
       
        // this is a jmock helper class that implements the ExecutorService interface
        DeterministicScheduler pool = new DeterministicScheduler();
        // set the pool
        manager.setPool( pool );
       
        // set expectations for the scenario
        context.checking( new Expectations() {{
            oneOf( action ).execute( workingMemory );
        }});
       
        // fire scenario
        manager.enqueue( action );
       
        // executes all pending actions using current thread
        pool.runUntilIdle();
       
        // check expectations
        context.assertIsSatisfied();
    }
View Full Code Here

    public void testActionCallbacks() throws InterruptedException {
        // creates a mock action
        final PartitionTaskManager.Action action = context.mock( PartitionTaskManager.Action.class );
        // this is a jmock helper class that implements the ExecutorService interface
        DeterministicScheduler pool = new DeterministicScheduler();
       
        // set expectations for the scenario
        context.checking( new Expectations() {{
            exactly(5).of( action ).execute( workingMemory );
        }});
       
        // enqueue before pool
        manager.enqueue( action );
        manager.enqueue( action );

        // set the pool
        manager.setPool( pool );
       
        // enqueue after setting the pool
        manager.enqueue( action );
        manager.enqueue( action );
        manager.enqueue( action );
       
        // executes all pending actions using current thread
        pool.runUntilIdle();
       
        // check expectations
        context.assertIsSatisfied();
    }
View Full Code Here

TOP

Related Classes of org.jmock.lib.concurrent.DeterministicScheduler$CallableRunnableAdapter

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.