xmlBlaster 2.2.0 API

org.xmlBlaster.test.classtest.queue
Class I_QueueTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.xmlBlaster.test.classtest.queue.I_QueueTest
All Implemented Interfaces:
junit.framework.Test

public class I_QueueTest
extends junit.framework.TestCase

Test RamQueuePlugin.

The sorting order is priority,timestamp:

   ->    5,100 - 5,98 - 5,50 - 9,3000 - 9,2500   ->
 

As 9 is highest priority it is the first to be taken out.
As we need to maintain the timely sequence and id is a timestamp in (more or less) nano seconds elapsed since 1970) the id 2500 (it is older) has precedence to the id 3000

Invoke: java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.classtest.queue.I_QueueTest

See Also:
MsgQueueEntry.compare(I_QueueEntry), I_Queue, RamQueuePlugin, org.xmlBlaster.util.queue.jdbc.JdbcQueuePlugin

Nested Class Summary
 class I_QueueTest.QueuePutter
           
(package private)  class I_QueueTest.QueueSizeListener
           
 
Field Summary
protected  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
(package private) static java.lang.String[] PLUGIN_TYPES
           
private  I_Queue queue
           
private  I_QueueTest.QueueSizeListener queueSizeListener
           
 
Constructor Summary
I_QueueTest(java.lang.String name, int currImpl, Global glob)
           
 
Method Summary
private  int assertCheckForTakeLowest(I_Queue queue, int numEntries, long numBytes, I_QueueEntry refEntry, boolean leaveOne, I_QueueEntry[] origEntries, int entriesLeft, int currentEntries, long size)
          returns the number of entries left in the queue after this processing operation
private  void bigEntries(I_Queue queue)
          Test bigEngtries(I_Queue) It tests the insertion and removal of entries which contain a large blob (2.1MB)
private  void checkSizeAndEntries(java.lang.String txt, I_QueueEntry[] queueEntries, I_Queue queue)
          Helper method to do a generic size check (size and number of entries)
private  void checkSizeAndEntries(java.lang.String txt, java.util.List<I_Entry> queueEntries, I_Queue queue)
           
private  void config(I_Queue queue)
          Tests initialize(), getProperties(), setProperties() and capacity()
static void main(java.lang.String[] args)
           java org.xmlBlaster.test.classtest.queue.I_QueueTest
private  void overflow(I_Queue queue)
          Test overflow(I_Queue) It tests if the overflow mechanism works OK
private  void peekMsg(I_Queue queue)
          Tests peek() and peek(int num) and remove() For a discussion of the sorting order see Javadoc of this class
private  void peekWithLimitEntry(I_Queue queue)
          Test testPeekWithLimitEntry(I_Queue)
private  void publishMsgBigEntry(I_Queue queue)
          Test bigEngtries(I_Queue) It tests the insertion and removal of entries which contain a large blob (2.1MB)
private  void putEntriesTwice(I_Queue queue)
          Test wrongOrder(I_Queue)
private  void putMsg(I_Queue queue)
          Tests put(MsgQueueEntry[]) and put(MsgQueueEntry) and clear()
private  void removeRandom(I_Queue queue)
          Test removeRandom(long[])
private  void removeWithPriority(I_Queue queue)
          Test removeWithPriority(long[])
protected  void setUp()
           
private  void size1(I_Queue queue)
          Tests put(MsgQueueEntry[]) and put(MsgQueueEntry) and clear()
private  void sizesCheck(I_Queue queue)
          Test sizesCheck(I_Queue)
static junit.framework.Test suite()
          Method is used by TestRunner to load these tests
private  void takeLowest(I_Queue queue)
          Test takeLowest(I_Queue)
 void tearDown()
           
 void testBigEntries()
           
 void testConfig()
          Tests QueuePropertyBase() and getStorageId()
 void testOverflow()
           
 void testPeekMsg()
           
 void testPeekMsgBlocking()
           
 void testPeekWithLimitEntry()
           
 void testPutEntriesTwice()
           
 void testPutMsg()
           
 void testRemoveRandom()
           
 void testRemoveWithPriority()
           
 void testSize1()
           
 void testSizesCheck()
           
 void testTakeLowest()
           
 void testWrongOrder()
           
private  void wrongOrder(I_Queue queue)
          Test wrongOrder(I_Queue)
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ME

private java.lang.String ME

glob

protected Global glob

log

private static java.util.logging.Logger log

queue

private I_Queue queue

queueSizeListener

private I_QueueTest.QueueSizeListener queueSizeListener

PLUGIN_TYPES

static java.lang.String[] PLUGIN_TYPES
Constructor Detail

I_QueueTest

public I_QueueTest(java.lang.String name,
                   int currImpl,
                   Global glob)
Method Detail

setUp

protected void setUp()
Overrides:
setUp in class junit.framework.TestCase

testConfig

public void testConfig()
Tests QueuePropertyBase() and getStorageId()

Parameters:
queueTypeList - A space separated list of names for the implementations to be tested. Valid names are: RamQueuePlugin JdbcQueuePlugin

config

private void config(I_Queue queue)
Tests initialize(), getProperties(), setProperties() and capacity()

Parameters:
queue - !!!Is not initialized in this case!!!!

testSize1

public void testSize1()

size1

private void size1(I_Queue queue)
Tests put(MsgQueueEntry[]) and put(MsgQueueEntry) and clear()


testPutMsg

public void testPutMsg()

checkSizeAndEntries

private void checkSizeAndEntries(java.lang.String txt,
                                 java.util.List<I_Entry> queueEntries,
                                 I_Queue queue)
See Also:
checkSizeAndEntries(String, I_QueueEntry[], I_Queue)

checkSizeAndEntries

private void checkSizeAndEntries(java.lang.String txt,
                                 I_QueueEntry[] queueEntries,
                                 I_Queue queue)
Helper method to do a generic size check (size and number of entries)


putMsg

private void putMsg(I_Queue queue)
Tests put(MsgQueueEntry[]) and put(MsgQueueEntry) and clear()


testPeekMsg

public void testPeekMsg()

testPeekMsgBlocking

public void testPeekMsgBlocking()

peekMsg

private void peekMsg(I_Queue queue)
Tests peek() and peek(int num) and remove() For a discussion of the sorting order see Javadoc of this class


testRemoveWithPriority

public void testRemoveWithPriority()

removeWithPriority

private void removeWithPriority(I_Queue queue)
Test removeWithPriority(long[])


testRemoveRandom

public void testRemoveRandom()

removeRandom

private void removeRandom(I_Queue queue)
Test removeRandom(long[])


testTakeLowest

public void testTakeLowest()

assertCheckForTakeLowest

private final int assertCheckForTakeLowest(I_Queue queue,
                                           int numEntries,
                                           long numBytes,
                                           I_QueueEntry refEntry,
                                           boolean leaveOne,
                                           I_QueueEntry[] origEntries,
                                           int entriesLeft,
                                           int currentEntries,
                                           long size)
                                    throws XmlBlasterException
returns the number of entries left in the queue after this processing operation

Parameters:
queue - the queue to use for this test
numEntries - the number of entries to pass to the takeLowest operation
numBytes - the num of bytes to pass to the takeLowest operation
leaveOne - the flag to pass to the takeLowest operation
origEntries - the array of the original entries put into the queue
entriesLeft - number of entries left in the queue before this operation
currentEntries - the number of entries which should have been processed by this operation
Throws:
XmlBlasterException

takeLowest

private void takeLowest(I_Queue queue)
Test takeLowest(I_Queue)


testWrongOrder

public void testWrongOrder()

wrongOrder

private void wrongOrder(I_Queue queue)
Test wrongOrder(I_Queue)


testPutEntriesTwice

public void testPutEntriesTwice()

putEntriesTwice

private void putEntriesTwice(I_Queue queue)
Test wrongOrder(I_Queue)


testPeekWithLimitEntry

public void testPeekWithLimitEntry()

peekWithLimitEntry

private void peekWithLimitEntry(I_Queue queue)
Test testPeekWithLimitEntry(I_Queue)


testSizesCheck

public void testSizesCheck()

sizesCheck

private void sizesCheck(I_Queue queue)
Test sizesCheck(I_Queue)


testBigEntries

public void testBigEntries()

publishMsgBigEntry

private void publishMsgBigEntry(I_Queue queue)
Test bigEngtries(I_Queue) It tests the insertion and removal of entries which contain a large blob (2.1MB)


bigEntries

private void bigEntries(I_Queue queue)
Test bigEngtries(I_Queue) It tests the insertion and removal of entries which contain a large blob (2.1MB)


testOverflow

public void testOverflow()

overflow

private void overflow(I_Queue queue)
Test overflow(I_Queue) It tests if the overflow mechanism works OK


tearDown

public void tearDown()
Overrides:
tearDown in class junit.framework.TestCase

suite

public static junit.framework.Test suite()
Method is used by TestRunner to load these tests


main

public static void main(java.lang.String[] args)
  java org.xmlBlaster.test.classtest.queue.I_QueueTest
 


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.