xmlBlaster 2.2.0 API

org.xmlBlaster.test.stress
Class MassiveSubTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.xmlBlaster.test.stress.MassiveSubTest
All Implemented Interfaces:
junit.framework.Test, I_Callback
Direct Known Subclasses:
MassiveSubTestOne

public class MassiveSubTest
extends junit.framework.TestCase
implements I_Callback

Test differents scenarios for a massive ammount of subscibers.

Test 5000 subscribers (or numSubscribers) on one connection.

Test 5000 subscribers (or numSubscribers) with maxSubPerCon per connection

Test 5000 subscribers (or numSubscribers) on one connection each.

Do it for IOP, RMI

If withEmbedded is set to false will run without an embedded server.

  java -Xms18M -Xmx256M org.xmlBlaster.test.stress.MassiveSubTest
  java -Xms18M -Xmx256M junit.swingui.TestRunner -noloading org.xmlBlaster.test.stress.MassiveSubTest
 

Author:
Peter Antman

Nested Class Summary
(package private)  class MassiveSubTest.Client
           
 
Field Summary
private  java.lang.String contentMime
           
private  java.lang.String contentMimeExtended
           
private  Global glob
           
private  GlobalUtil globalUtil
           
private static java.util.logging.Logger log
           
private  MassiveSubTest.Client[] manyClients
           
private  I_XmlBlasterAccess[] manyConnections
           
private  int maxSubPerCon
           
private  java.lang.String ME
           
private  boolean messageArrived
           
private  int noToPub
           
private  int numReceived
           
private  int numSubscribers
           
private  int numToRec
           
private  I_XmlBlasterAccess oneConnection
           
private  java.lang.String oneName
           
private  java.lang.String publishOid1
           
private  int serverPort
           
private  EmbeddedXmlBlaster serverThread
           
private  StopWatch stopWatch
           
private  MsgInterceptor updateInterceptor
           
private  boolean useOneConnection
           
private  boolean withEmbedded
           
 
Constructor Summary
MassiveSubTest(Global glob, java.lang.String testName, java.lang.String loginName, boolean useOneConnection)
           
MassiveSubTest(java.lang.String testName)
           
 
Method Summary
(package private)  long getUsedServerMemory()
          Query xmlBlaster for its current memory consumption.
 void init(Global glob, java.lang.String testName, java.lang.String loginName, boolean useOneConnection)
           
static void main(java.lang.String[] args)
           
 void publish()
          TEST: Publish numToPub messages..
private static void setProtoMax(Global glob, java.lang.String proto, java.lang.String max)
           
protected  void setUp()
          Sets up the fixture.
 void subcribeMany()
          helper
static junit.framework.Test suite()
          Method is used by TestRunner to load these tests.
protected  void tearDown()
          Tears down the fixture.
 void testManyClients()
          TEST: Construct a message and publish it, all clients should receive an update.
 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos)
          This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.
 
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

numSubscribers

private int numSubscribers

maxSubPerCon

private int maxSubPerCon

useOneConnection

private boolean useOneConnection

withEmbedded

private boolean withEmbedded

noToPub

private int noToPub

numToRec

private int numToRec

ME

private java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

serverPort

private int serverPort

serverThread

private EmbeddedXmlBlaster serverThread

messageArrived

private boolean messageArrived

updateInterceptor

private MsgInterceptor updateInterceptor

publishOid1

private final java.lang.String publishOid1
See Also:
Constant Field Values

oneConnection

private I_XmlBlasterAccess oneConnection

oneName

private java.lang.String oneName

numReceived

private int numReceived

contentMime

private final java.lang.String contentMime
See Also:
Constant Field Values

contentMimeExtended

private final java.lang.String contentMimeExtended
See Also:
Constant Field Values

globalUtil

private GlobalUtil globalUtil

manyClients

private MassiveSubTest.Client[] manyClients

manyConnections

private I_XmlBlasterAccess[] manyConnections

stopWatch

private StopWatch stopWatch
Constructor Detail

MassiveSubTest

public MassiveSubTest(java.lang.String testName)

MassiveSubTest

public MassiveSubTest(Global glob,
                      java.lang.String testName,
                      java.lang.String loginName,
                      boolean useOneConnection)
Method Detail

init

public void init(Global glob,
                 java.lang.String testName,
                 java.lang.String loginName,
                 boolean useOneConnection)

setUp

protected void setUp()
Sets up the fixture.

Connect to xmlBlaster and login

Overrides:
setUp in class junit.framework.TestCase

tearDown

protected void tearDown()
Tears down the fixture.

cleaning up .... erase() the previous message OID and logout

Overrides:
tearDown in class junit.framework.TestCase

subcribeMany

public void subcribeMany()
helper


getUsedServerMemory

long getUsedServerMemory()
Query xmlBlaster for its current memory consumption.


publish

public void publish()
TEST: Publish numToPub messages..

The returned publishOid1 is checked


update

public java.lang.String update(java.lang.String cbSessionId,
                               UpdateKey updateKey,
                               byte[] content,
                               UpdateQos updateQos)
This is the callback method invoked from xmlBlaster delivering us a new asynchronous message.

Specified by:
update in interface I_Callback
Parameters:
cbSessionId - The session ID specified by the client which registered the callback. You can specify a cbSessionId during connection (with ConnectQos) and this is bounced back here so you can authenticate the message.
updateKey - The arrived key containing the topic name
content - The arrived message content. This is your payload.
See Also:
I_Callback.update(String, UpdateKey, byte[], UpdateQos)

testManyClients

public void testManyClients()
TEST: Construct a message and publish it, all clients should receive an update.


suite

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

Warning! The default uses the embedded server, to give each round a equal chance. But it is MUCH slower than using a server in another VM.


setProtoMax

private static void setProtoMax(Global glob,
                                java.lang.String proto,
                                java.lang.String max)

main

public static void main(java.lang.String[] args)

xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.