|
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.client.TestFailSafeAsync
public class TestFailSafeAsync
Tests the fail save behavior of the I_XmlBlasterAccess client helper class, especially the asynchronous playback of messages.
When the connection to xmlBlaster is lost, and you continue to publish messages they are stored locally with the invocation recorder on harddisk.java junit.textui.TestRunner -noloading org.xmlBlaster.test.client.TestFailSafeAsync java junit.swingui.TestRunner -noloading org.xmlBlaster.test.client.TestFailSafeAsync
Field Summary | |
---|---|
private I_XmlBlasterAccess |
con
|
private java.lang.String |
contentMime
|
private int |
failMsg
|
private Global |
glob
|
private static java.util.logging.Logger |
log
|
private int |
maxEntries
TEST: Sendin 0-19 directly, sending 20-39 to recorder (no connection), sending 40-100 directly |
private static java.lang.String |
ME
|
private int |
numNormalPublishReceived
|
private int |
numReceived
|
private int |
numTailbackReceived
|
(package private) PublishKey |
publishKeyWrapper
|
(package private) PublishQos |
publishQosWrapper
|
private long |
publishRate
publish rate msg/sec |
private long |
pullbackRate
publish rate of tailback msg/sec |
private boolean |
reconnected
|
private int |
reconnectMsg
|
private java.lang.String |
senderName
|
private int |
serverPort
|
private EmbeddedXmlBlaster |
serverThread
|
private MsgInterceptor |
updateInterceptor
|
Constructor Summary | |
---|---|
TestFailSafeAsync(Global glob,
java.lang.String testName)
|
|
TestFailSafeAsync(java.lang.String testName)
|
Method Summary | |
---|---|
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.client.TestFailSafeAsync |
void |
publish(int counter)
Construct a message and publish it. |
void |
reachedAlive(ConnectionStateEnum oldState,
I_XmlBlasterAccess connection)
This is the callback method invoked from XmlBlasterAccess notifying the client that a connection has been established and that its status is now ALIVE. |
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. |
void |
subscribe()
TEST: Subscribe to messages with XPATH. |
protected void |
tearDown()
Tears down the fixture. |
void |
testFailSafe()
TEST: Sendin 0-19 directly, sending 20-39 to recorder (no connection), sending 40-100 directly |
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 |
---|
private static java.lang.String ME
private Global glob
private static java.util.logging.Logger log
private int serverPort
private EmbeddedXmlBlaster serverThread
private MsgInterceptor updateInterceptor
private I_XmlBlasterAccess con
private java.lang.String senderName
private int numReceived
private int numTailbackReceived
private int numNormalPublishReceived
private final java.lang.String contentMime
private boolean reconnected
private final int maxEntries
private final int failMsg
private final int reconnectMsg
private final long publishRate
private final long pullbackRate
PublishKey publishKeyWrapper
PublishQos publishQosWrapper
Constructor Detail |
---|
public TestFailSafeAsync(java.lang.String testName)
public TestFailSafeAsync(Global glob, java.lang.String testName)
Method Detail |
---|
protected void setUp()
setUp
in class junit.framework.TestCase
protected void tearDown()
tearDown
in class junit.framework.TestCase
public void subscribe()
public void publish(int counter)
public void testFailSafe()
public void reachedAlive(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
I_ConnectionStateListener
Note that this method is invoked also when the connection has been established the first time. In this case the connection is fully operational but your connect() call has not yet returned. You can access the returned connect QoS in this case with connect.getConnectReturnQos().
You can erase all entries of the queue manually or add others before you return and in this way control the behavior. During you have control in reachedAlive() the client side queue is blocked and does not accept publish or request messages from other threads. So you can do peacefully your work (your thread is allowed to modify the queue exclusively).
If you send messages during this method invocation they are queued only and are sent as soon as this method returns.
This method is invoked by the login polling thread from I_XmlBlasterAccess in which case it is a physical Alive, and by the connect method on successful login in which case it is a logical Alive.
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 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos)
update
in interface I_Callback
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 namecontent
- The arrived message content. This is your payload.I_Callback.update(String, UpdateKey, byte[], UpdateQos)
public static void main(java.lang.String[] args)
java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.client.TestFailSafeAsync
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |