|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.xmlBlaster.test.client.TestPersistentSession
public class TestPersistentSession
Tests the persistent sessions .
For a description of what this persistent sessions and subscriptions are
please read the requirement engine.persistence.session.
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.TestPersistentSession java junit.swingui.TestRunner -noloading org.xmlBlaster.test.client.TestPersistentSession
I_XmlBlasterAccess
Field Summary | |
---|---|
private java.lang.String |
contentMime
|
private boolean |
exactSubscription
|
private boolean |
failsafeCallback
|
private Global |
glob
|
private boolean |
initialUpdates
|
private static java.util.logging.Logger |
log
|
private static java.lang.String |
ME
|
private int |
numPublish
|
private int |
numStart
|
private int |
numStop
|
private int |
numSubscribers
|
private Global |
origGlobal
|
private boolean |
persistent
the session is persistent from the beginning |
private static boolean |
PERSISTENT
|
private long |
reconnectDelay
|
private java.lang.String |
senderName
|
private Global |
serverGlobal
|
private int |
serverPort
|
private EmbeddedXmlBlaster |
serverThread
|
private static boolean |
TRANSIENT
|
private MsgInterceptor[] |
updateInterceptors
|
Constructor Summary | |
---|---|
TestPersistentSession(Global glob,
java.lang.String testName)
|
|
TestPersistentSession(java.lang.String testName)
|
Method Summary | |
---|---|
private Global |
createConnection(Global parentGlobal,
java.lang.String sessionName,
boolean isPersistent,
boolean expectEx)
|
void |
doPublish(int counter)
TEST: Construct a message and publish it. |
private void |
doSubscribe(int num,
boolean isExact,
boolean isPersistent)
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.TestPersistentSession |
void |
persistentSession(boolean doStop)
TEST: |
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. |
private void |
setup(boolean restrictedEntries)
|
protected void |
tearDown()
Tears down the fixture. |
void |
testOverflow()
Tests the requirement: - If the storage for the sessions is overflown, it should throw an exception |
void |
testXPathInitialRunlevelChange()
|
void |
testXPathInitialStop()
|
void |
testXPathNoInitialStop()
|
java.lang.String |
update(java.lang.String cbSessionId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new 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 static final boolean TRANSIENT
private static final boolean PERSISTENT
private Global glob
private Global origGlobal
private Global serverGlobal
private static java.util.logging.Logger log
private int serverPort
private EmbeddedXmlBlaster serverThread
private MsgInterceptor[] updateInterceptors
private java.lang.String senderName
private int numPublish
private int numStop
private int numStart
private final java.lang.String contentMime
private final long reconnectDelay
private boolean failsafeCallback
private boolean persistent
private boolean exactSubscription
private boolean initialUpdates
private int numSubscribers
Constructor Detail |
---|
public TestPersistentSession(java.lang.String testName)
public TestPersistentSession(Global glob, java.lang.String testName)
Method Detail |
---|
protected void setUp()
setUp
in class junit.framework.TestCase
private void setup(boolean restrictedEntries)
protected void tearDown()
tearDown
in class junit.framework.TestCase
private void doSubscribe(int num, boolean isExact, boolean isPersistent)
public void doPublish(int counter) throws XmlBlasterException
XmlBlasterException
public void persistentSession(boolean doStop)
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 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) throws XmlBlasterException
I_Callback
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.
XmlBlasterException
I_XmlBlasterAccess
public void testXPathInitialStop()
public void testXPathNoInitialStop()
public void testXPathInitialRunlevelChange()
private Global createConnection(Global parentGlobal, java.lang.String sessionName, boolean isPersistent, boolean expectEx)
public void testOverflow()
public static void main(java.lang.String[] args)
java -Djava.compiler= junit.textui.TestRunner org.xmlBlaster.test.client.TestPersistentSession
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |