Package barsuift.simLife.message

Examples of barsuift.simLife.message.PublisherTestHelper.nbUpdated()


    public void testPublisher() throws Exception {
        PublisherTestHelper publisherHelper = new PublisherTestHelper();
        publisherHelper.addSubscriberTo(synchro);

        synchro.start();
        assertEquals(1, publisherHelper.nbUpdated());
        assertNull(publisherHelper.getUpdateObjects().get(0));

        publisherHelper.reset();
        Thread.sleep(2 * Synchronizer.CYCLE_LENGTH_CORE_MS / synchro.getSpeed().getSpeed() + 50);
        synchro.stop();
View Full Code Here


        publisherHelper.reset();
        Thread.sleep(2 * Synchronizer.CYCLE_LENGTH_CORE_MS / synchro.getSpeed().getSpeed() + 50);
        synchro.stop();
        Thread.sleep(2 * Synchronizer.CYCLE_LENGTH_CORE_MS / synchro.getSpeed().getSpeed() + 50);
        assertEquals(1, publisherHelper.nbUpdated());
        assertNull(publisherHelper.getUpdateObjects().get(0));

        publisherHelper.reset();
        synchro.oneStep();
        Thread.sleep(2 * Synchronizer.CYCLE_LENGTH_CORE_MS / synchro.getSpeed().getSpeed() + 50);
View Full Code Here

        assertNull(publisherHelper.getUpdateObjects().get(0));

        publisherHelper.reset();
        synchro.oneStep();
        Thread.sleep(2 * Synchronizer.CYCLE_LENGTH_CORE_MS / synchro.getSpeed().getSpeed() + 50);
        assertEquals(2, publisherHelper.nbUpdated());
        assertNull(publisherHelper.getUpdateObjects().get(0));
    }


    public void testIllegalStateException() throws InterruptedException {
View Full Code Here

    public void testPublisher() throws Exception {
        PublisherTestHelper publisherHelper = new PublisherTestHelper();
        publisherHelper.addSubscriberTo(synchro);

        synchro.start();
        assertEquals(1, publisherHelper.nbUpdated());
        assertNull(publisherHelper.getUpdateObjects().get(0));

        publisherHelper.reset();
        Thread.sleep(Synchronizer.CYCLE_LENGTH_3D_MS + 100);
        synchro.stop();
View Full Code Here

        publisherHelper.reset();
        Thread.sleep(Synchronizer.CYCLE_LENGTH_3D_MS + 100);
        synchro.stop();
        barrierReleaser.run();
        Thread.sleep(Synchronizer.CYCLE_LENGTH_3D_MS + 100);
        assertEquals(1, publisherHelper.nbUpdated());
        assertNull(publisherHelper.getUpdateObjects().get(0));
    }


    public void testIllegalStateException() throws InterruptedException {
View Full Code Here

        assertEquals(MobileEvent.FALLEN, publisher4.getUpdateObjects().get(0));
        assertEquals(1, publisher5.nbUpdated());
        assertEquals(MobileEvent.FALLEN, publisher5.getUpdateObjects().get(0));
        assertEquals(1, publisher6.nbUpdated());
        assertEquals(MobileEvent.FALLEN, publisher6.getUpdateObjects().get(0));
        assertEquals(1, publisher7.nbUpdated());
        assertEquals(MobileEvent.FALLEN, publisher7.getUpdateObjects().get(0));

        // only mobile1 and mobile2 should still be in the list of mobile
        assertTrue(gravity.getMobiles().contains(mobile1));
        assertTrue(gravity.getMobiles().contains(mobile2));
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.