Package org.jacorb.notification.queue

Examples of org.jacorb.notification.queue.BoundedPriorityEventQueue


        return new TestSuite(BoundedPriorityEventQueueTest.class);
    }

    public void testPriorityOrder_ascendingInsert() throws Exception
    {
        BoundedPriorityEventQueue _queue = new BoundedPriorityEventQueue(20,
                EventQueueOverflowStrategy.FIFO);

        for (int x = 0; x < 10; ++x)
        {
            Message mockMessage = newMessage(x);
            _queue.put(mockMessage);
        }

        for (int x = 9; x >= 0; --x)
        {
            Message _event = _queue.getMessage(false);
            assertEquals(x, _event.getPriority());
        }
    }
View Full Code Here


        }
    }

    public void testPriorityOrder_descendingInsert() throws Exception
    {
        MessageQueue _queue = new BoundedPriorityEventQueue(20, EventQueueOverflowStrategy.FIFO);
       
        for (int x = 0; x < 10; ++x)
        {
            int prio = 10 - x;

            Message mockMessage = newMessage(prio);
            _queue.put(mockMessage);
        }

        for (int x = 0; x < 10; ++x)
        {
            Message _event = _queue.getMessage(false);
            assertEquals(10 - x, _event.getPriority());
        }
    }
View Full Code Here

        assertTrue(strategy.getRemovedElements().contains(e2));
    }
   
    public void testGetAllClearsQueue() throws Exception
    {
        BoundedPriorityEventQueue queue = new BoundedPriorityEventQueue(10, EventQueueOverflowStrategy.LEAST_PRIORITY);
       
        Message m = newMessage();
       
        assertEquals(0, queue.getAllMessages(false).length);
       
        queue.put(m);
       
        Message[] mesgs = queue.getAllMessages(false);
       
        assertEquals(1, mesgs.length);
        assertEquals(m, mesgs[0]);
       
        queue.getAllMessages(false);
       
        assertEquals(0, queue.getAllMessages(false).length);
    }
View Full Code Here

        assertEquals(0, queue.getAllMessages(false).length);
    }

    private void addEventsToEventQueue(EventQueueOverflowStrategy strategy, List events)
    {
        AbstractBoundedEventQueue queue = new BoundedPriorityEventQueue(4, strategy);

        Iterator i = events.iterator();

        while (i.hasNext())
        {
            queue.put((Message) i.next());
        }
    }
View Full Code Here

public class BoundedPriorityEventQueueTest
{
    @Test
    public void testPriorityOrder_ascendingInsert() throws Exception
    {
        BoundedPriorityEventQueue _queue = new BoundedPriorityEventQueue(20,
                EventQueueOverflowStrategy.FIFO);

        for (int x = 0; x < 10; ++x)
        {
            Message mockMessage = newMessage(x);
            _queue.put(mockMessage);
        }

        for (int x = 9; x >= 0; --x)
        {
            Message _event = _queue.getMessage(false);
            assertEquals(x, _event.getPriority());
        }
    }
View Full Code Here

    }

    @Test
    public void testPriorityOrder_descendingInsert() throws Exception
    {
        MessageQueue _queue = new BoundedPriorityEventQueue(20, EventQueueOverflowStrategy.FIFO);

        for (int x = 0; x < 10; ++x)
        {
            int prio = 10 - x;

            Message mockMessage = newMessage(prio);
            _queue.put(mockMessage);
        }

        for (int x = 0; x < 10; ++x)
        {
            Message _event = _queue.getMessage(false);
            assertEquals(10 - x, _event.getPriority());
        }
    }
View Full Code Here

    }

    @Test
    public void testGetAllClearsQueue() throws Exception
    {
        BoundedPriorityEventQueue queue = new BoundedPriorityEventQueue(10, EventQueueOverflowStrategy.LEAST_PRIORITY);

        Message m = newMessage();

        assertEquals(0, queue.getAllMessages(false).length);

        queue.put(m);

        Message[] mesgs = queue.getAllMessages(false);

        assertEquals(1, mesgs.length);
        assertEquals(m, mesgs[0]);

        queue.getAllMessages(false);

        assertEquals(0, queue.getAllMessages(false).length);
    }
View Full Code Here

        assertEquals(0, queue.getAllMessages(false).length);
    }

    private void addEventsToEventQueue(EventQueueOverflowStrategy strategy, List events)
    {
        AbstractBoundedEventQueue queue = new BoundedPriorityEventQueue(4, strategy);

        Iterator i = events.iterator();

        while (i.hasNext())
        {
            queue.put((Message) i.next());
        }
    }
View Full Code Here

TOP

Related Classes of org.jacorb.notification.queue.BoundedPriorityEventQueue

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.