xmlBlaster 1.6.2 API

org.xmlBlaster.test.client
Class TestFailSafe

java.lang.Object
  extended byjunit.framework.Assert
      extended byjunit.framework.TestCase
          extended byorg.xmlBlaster.test.client.TestFailSafe
All Implemented Interfaces:
I_ConnectionStateListener, junit.framework.Test

public class TestFailSafe
extends junit.framework.TestCase
implements I_ConnectionStateListener

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
 

See Also:
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
           
 
Fields inherited from class junit.framework.TestCase
 
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 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

ME

private static java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

serverPort

private int serverPort

serverThread

private EmbeddedXmlBlaster serverThread

updateInterceptor

private MsgInterceptor updateInterceptor

con

private I_XmlBlasterAccess con

senderName

private java.lang.String senderName

numPublish

private int numPublish

numStop

private int numStop

numStart

private int numStart

contentMime

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

reconnectDelay

private final long reconnectDelay
See Also:
Constant Field Values
Constructor Detail

TestFailSafe

public TestFailSafe(java.lang.String testName)

TestFailSafe

public TestFailSafe(Global glob,
                    java.lang.String testName)
Method Detail

setUp

protected void setUp()
Sets up the fixture.

Connect to xmlBlaster and login


tearDown

protected void tearDown()
Tears down the fixture.

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


doSubscribe

public void doSubscribe()
TEST: Subscribe to messages with XPATH.


doPublish

public void doPublish(int counter)
               throws XmlBlasterException
TEST: Construct a message and publish it.

Throws:
XmlBlasterException

testFailSafe

public void testFailSafe()
TEST:


reachedAlive

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

This method is enforced through interface I_ConnectionStateListener

Specified by:
reachedAlive in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

reachedPolling

public void reachedPolling(ConnectionStateEnum oldState,
                           I_XmlBlasterAccess connection)
Description copied from interface: I_ConnectionStateListener
This is the callback method invoked from XmlBlasterAccess informing the client that the connection state has changed to POLLING.

Specified by:
reachedPolling in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

reachedDead

public void reachedDead(ConnectionStateEnum oldState,
                        I_XmlBlasterAccess connection)
Description copied from interface: I_ConnectionStateListener
This is the callback method invoked from XmlBlasterAccess informing the client that the connection was lost (i.e. when the state of the connection has gone to DEAD).

Specified by:
reachedDead in interface I_ConnectionStateListener
Parameters:
oldState - The previous state of the connection.

main

public 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

Invoke: java org.xmlBlaster.test.client.TestFailSafe


xmlBlaster 1.6.2 API

Copyright © 1999-2007 The xmlBlaster.org contributers.