|
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.TestFailSafe
public class TestFailSafe
Tests the fail safe behavior of the I_XmlBlasterAccess client helper class (does not test server side fail safe).
For a description of what this fail save mode can do for you, please
read the API documentation of I_XmlBlasterAccess.
This is an interesting example, since it creates a XmlBlaster server instance in the same JVM , but in a separate thread, talking over CORBA with it.
Invoke examples:
java junit.textui.TestRunner -noloading org.xmlBlaster.test.client.TestFailSafe java junit.swingui.TestRunner -noloading org.xmlBlaster.test.client.TestFailSafe
I_XmlBlasterAccess
Field Summary | |
---|---|
private I_XmlBlasterAccess |
con
|
private java.lang.String |
contentMime
|
private Global |
glob
|
private static java.util.logging.Logger |
log
|
private static java.lang.String |
ME
|
private int |
numPublish
|
private int |
numStart
|
private int |
numStop
|
private long |
reconnectDelay
|
private java.lang.String |
senderName
|
private int |
serverPort
|
private EmbeddedXmlBlaster |
serverThread
|
private MsgInterceptor |
updateInterceptor
|
Constructor Summary | |
---|---|
TestFailSafe(Global glob,
java.lang.String testName)
|
|
TestFailSafe(java.lang.String testName)
|
Method Summary | |
---|---|
void |
doPublish(int counter)
TEST: Construct a message and publish it. |
void |
doSubscribe()
TEST: Subscribe to messages with XPATH. |
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.TestFailSafe |
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)
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode if the connection was established. |
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. |
protected void |
tearDown()
Tears down the fixture. |
void |
testFailSafe()
TEST: |
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 numPublish
private int numStop
private int numStart
private final java.lang.String contentMime
private final long reconnectDelay
Constructor Detail |
---|
public TestFailSafe(java.lang.String testName)
public TestFailSafe(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 doSubscribe()
public void doPublish(int counter) throws XmlBlasterException
XmlBlasterException
public void testFailSafe()
public void reachedAliveSync(ConnectionStateEnum oldState, I_XmlBlasterAccess connection)
reachedAliveSync
in interface I_ConnectionStateListener
oldState
- is always ALIVE.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 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 void main(java.lang.String[] args)
java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.client.TestFailSafe
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |