xmlBlaster 2.2.0 API

org.xmlBlaster.test.classtest.queue
Class QueueThreadingTest

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

public class QueueThreadingTest
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= org.xmlBlaster.test.classtest.queue.QueueThreadingTest

Configuration example:

 JdbcDriver.drivers=org.postgresql.Driver
 JdbcDriver.postgresql.mapping=string=text,longint=bigint,int=integer,boolean=boolean
 queue.callback.url=jdbc:postgresql://localhost/test
 queue.callback.user=postgres
 queue.callback.password=
 

Test database with PostgreSQL:

 initdb /tmp/postgres
 cp /var/lib/pgsql/data/pg_hba.conf /tmp/postgres    (edit host access)
 createdb test
 postmaster -i -D /tmp/postgres
 

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

Field Summary
 int count
           
protected  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String ME
           
private  int numOfMsg
           
private  int numOfQueues
           
static java.lang.String[] PLUGIN_TYPES
           
 java.util.ArrayList queueList
           
private  I_Queue[] queues
           
private  int sizeOfMsg
           
private  StopWatch stopWatch
           
 
Constructor Summary
QueueThreadingTest(Global glob, java.lang.String name, int currImpl)
          Constructor for junit public QueueThreadingTest(String name) { this(new Global(), name); }
 
Method Summary
static void main(java.lang.String[] args)
           java org.xmlBlaster.test.classtest.queue.QueueThreadingTest
 void performancePutMultiThread(int numOfQueues, int numOfMsg, int sizeOfMsg)
           
protected  void setUp()
           
static junit.framework.Test suite()
          Method is used by TestRunner to load these tests
 void tearDown()
           
 void testPerfomancePutMultiThread()
           
 
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

stopWatch

private StopWatch stopWatch

numOfQueues

private int numOfQueues

numOfMsg

private int numOfMsg

sizeOfMsg

private int sizeOfMsg

queues

private I_Queue[] queues

queueList

public java.util.ArrayList queueList

PLUGIN_TYPES

public static java.lang.String[] PLUGIN_TYPES

count

public int count
Constructor Detail

QueueThreadingTest

public QueueThreadingTest(Global glob,
                          java.lang.String name,
                          int currImpl)
Constructor for junit public QueueThreadingTest(String name) { this(new Global(), name); }

Method Detail

setUp

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

tearDown

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

testPerfomancePutMultiThread

public void testPerfomancePutMultiThread()

performancePutMultiThread

public void performancePutMultiThread(int numOfQueues,
                                      int numOfMsg,
                                      int sizeOfMsg)
                               throws XmlBlasterException
Throws:
XmlBlasterException

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.QueueThreadingTest
 


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.