|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase org.xmlBlaster.test.topic.TestReferenceCountSwap
public class TestReferenceCountSwap
Tests the correct reference counting for persistent messages after recovery.
1. Start xmlBlaster server, configure cache size to 2 2. Publish two messages 3. Subscribe to message in fail save mode and block in callback 4. Kill client subscriber 5. Publish two more message to swap the first two 6. Start same subscriber without initial update - it will receive the messages from 3. 7. Start another subscriber with history = 10: we expect 4 updates If the reference counter is not properly swapped and resored test 6. will fail.Invoke examples:
java junit.textui.TestRunner org.xmlBlaster.test.topic.TestReferenceCountSwap java junit.swingui.TestRunner -noloading org.xmlBlaster.test.topic.TestReferenceCountSwap
Nested Class Summary | |
---|---|
(package private) class |
TestReferenceCountSwap.Client
|
Field Summary | |
---|---|
private Global |
glob
|
private static java.util.logging.Logger |
log
|
private static java.lang.String |
ME
|
private java.lang.String |
oid
|
private int |
serverPort
|
private EmbeddedXmlBlaster |
serverThread
|
Constructor Summary | |
---|---|
TestReferenceCountSwap(Global glob,
java.lang.String testName)
Constructs the TestReferenceCountSwap object. |
|
TestReferenceCountSwap(java.lang.String testName)
|
Method Summary | |
---|---|
private TestReferenceCountSwap.Client |
doConnect(java.lang.String loginName,
I_Callback cb)
Create a new connection |
private void |
doErase(I_XmlBlasterAccess con)
Erase the message. |
private void |
doPublish(I_XmlBlasterAccess con)
Construct a message and publish it persistent. |
private void |
doSubscribe(I_XmlBlasterAccess con)
Subscribe to message. |
static void |
main(java.lang.String[] args)
Deprecated. Use the TestRunner from the testsuite to run it: java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.topic.TestReferenceCountSwap |
void |
reachedAlive(ConnectionStateEnum oldState,
I_XmlBlasterAccess connection)
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was established. |
void |
reachedAliveSync(ConnectionStateEnum oldState,
I_XmlBlasterAccess connection)
Invoked when the dispatcher goes to synch again after having delivered entries which where in the queue when the state changed to ALIVE. |
void |
reachedDead(ConnectionStateEnum oldState,
I_XmlBlasterAccess connection)
This is the callback method invoked from XmlBlasterAccess informing the client that the connection was lost (i.e. |
void |
reachedPolling(ConnectionStateEnum oldState,
I_XmlBlasterAccess connection)
This is the callback method invoked from XmlBlasterAccess informing the client that the connection state has changed to POLLING. |
protected void |
setUp()
Sets up the fixture. |
static junit.framework.Test |
suite()
Method is used by TestRunner to load these tests |
protected void |
tearDown()
Tears down the fixture. |
void |
testReferenceCount()
Test as described in class javadoc. |
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 |
---|
private static java.lang.String ME
private Global glob
private static java.util.logging.Logger log
private int serverPort
private EmbeddedXmlBlaster serverThread
private java.lang.String oid
Constructor Detail |
---|
public TestReferenceCountSwap(java.lang.String testName)
public TestReferenceCountSwap(Global glob, java.lang.String testName)
testName
- The name used in the test suiteMethod Detail |
---|
protected void setUp()
setUp
in class junit.framework.TestCase
protected void tearDown()
tearDown
in class junit.framework.TestCase
private TestReferenceCountSwap.Client doConnect(java.lang.String loginName, I_Callback cb)
loginName
- The login namecb
- The callback handle or nullprivate void doSubscribe(I_XmlBlasterAccess con)
private void doPublish(I_XmlBlasterAccess con)
private void doErase(I_XmlBlasterAccess con)
public void testReferenceCount()
public void reachedAlive(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
reachedAlive
in interface I_ConnectionStateListener
oldState
- The previous state of the connection.public void reachedAliveSync(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
I_ConnectionStateListener
reachedAliveSync
in interface I_ConnectionStateListener
oldState
- is always ALIVE.public void reachedPolling(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
I_ConnectionStateListener
reachedPolling
in interface I_ConnectionStateListener
oldState
- The previous state of the connection.public void reachedDead(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
I_ConnectionStateListener
reachedDead
in interface I_ConnectionStateListener
oldState
- The previous state of the connection.public static junit.framework.Test suite()
public static void main(java.lang.String[] args)
java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.topic.TestReferenceCountSwap
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |