|
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 org.xmlBlaster.test.MsgInterceptor
public class MsgInterceptor
Intercepts incoming message in update() and collects them in a Vector for nice handling.
Field Summary | |
---|---|
private I_Update |
contribTestsuite
|
private boolean |
countErased
|
private byte[] |
msgContent
|
private I_StreamingCallback |
streamTestsuite
|
private I_Callback |
testsuite
|
private java.util.Vector<Msg> |
updateVec
|
private int |
verbosity
|
private java.lang.ref.WeakReference |
weakglob
|
private java.lang.ref.WeakReference |
weaklog
|
Constructor Summary | |
---|---|
MsgInterceptor(Global glob,
java.util.logging.Logger log,
I_Callback testsuite)
|
|
MsgInterceptor(Global glob,
java.util.logging.Logger log,
I_Callback testsuite,
I_StreamingCallback streamTestsuite)
|
|
MsgInterceptor(Global glob,
java.util.logging.Logger log,
I_Callback testsuite,
I_Update contribTestsuite)
|
Method Summary | |
---|---|
void |
add(Msg msg)
|
void |
clear()
Clears all arrived messages AND the countErased flag to false |
void |
compareToReceived(MsgUnit[] expectedArr,
java.lang.String secretCbSessionId)
Compares all messages given by parameter 'expectedArr' and compare them with the received ones. |
void |
compareToReceived(PublishReturnQos[] expectedArr)
Compares all messages given by parameter 'expectedArr' and compare them with the received ones. |
int |
count()
|
void |
countErased(boolean countErased)
|
Global |
getGlobal()
|
java.util.logging.Logger |
getLog()
|
Msg |
getMsg(java.lang.String oid,
java.lang.String state)
Access the updated message filtered by the given oid and state. |
Msg[] |
getMsgs()
|
Msg[] |
getMsgs(java.lang.String oid,
java.lang.String state)
Access the updated message filtered by the given oid and state. |
void |
remove(Msg msg)
|
void |
setLogPrefix(java.lang.String prefix)
|
void |
setMsgContent(byte[] msgContent)
|
void |
setVerbosity(int val)
0: no logging 1: simple logging 2: dump messages on arrival |
java.lang.String |
toString()
|
void |
update(java.lang.String topic,
java.io.InputStream is,
java.util.Map attrMap)
This is the callback method (I_StreamingCallback) invoked from xmlBlaster It directly calls the update method from the testsuite (delegation) |
java.lang.String |
update(java.lang.String cbSessionId,
UpdateKey updateKey,
byte[] content,
UpdateQos updateQos)
This is the callback method (I_Callback) invoked from xmlBlaster It directly calls the update method from the testsuite (delegation) |
java.lang.String |
update(java.lang.String cbSessionId,
UpdateKey updateKey,
java.io.InputStream is,
UpdateQos updateQos)
This is the callback method (I_StreamingCallback) invoked from xmlBlaster It directly calls the update method from the testsuite (delegation) |
int |
waitOnUpdate(long timeout)
Sleeps until timeout and returns the arrived messages. |
int |
waitOnUpdate(long timeout,
int countExpected)
|
int |
waitOnUpdate(long timeout,
java.lang.String oid,
java.lang.String state)
Sleeps until timeout and returns the number of arrived messages filtered by oid and state. |
int |
waitOnUpdate(long timeout,
java.lang.String oid,
java.lang.String state,
int countExpected)
Waits until the given number of messages arrived, the messages must match the given oid and state. |
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 final java.lang.ref.WeakReference weakglob
private final java.lang.ref.WeakReference weaklog
private I_Callback testsuite
private int verbosity
private boolean countErased
private I_StreamingCallback streamTestsuite
private I_Update contribTestsuite
private byte[] msgContent
private java.util.Vector<Msg> updateVec
Constructor Detail |
---|
public MsgInterceptor(Global glob, java.util.logging.Logger log, I_Callback testsuite, I_StreamingCallback streamTestsuite)
testsuite
- If != null your update() variant will be called as wellpublic MsgInterceptor(Global glob, java.util.logging.Logger log, I_Callback testsuite, I_Update contribTestsuite)
testsuite
- If != null your update() variant will be called as wellpublic MsgInterceptor(Global glob, java.util.logging.Logger log, I_Callback testsuite)
testsuite
- If != null your update() variant will be called as wellMethod Detail |
---|
public final Global getGlobal()
public final java.util.logging.Logger getLog()
public void setLogPrefix(java.lang.String prefix)
public void setVerbosity(int val)
public void countErased(boolean countErased)
countErased
- Set to true to count the erased notifications as wellpublic java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, byte[] content, UpdateQos updateQos) throws XmlBlasterException
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 java.lang.String update(java.lang.String cbSessionId, UpdateKey updateKey, java.io.InputStream is, UpdateQos updateQos) throws XmlBlasterException
update
in interface I_StreamingCallback
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 name
XmlBlasterException
I_XmlBlasterAccess
public void update(java.lang.String topic, java.io.InputStream is, java.util.Map attrMap) throws java.lang.Exception
update
in interface I_Update
topic
- The topic nameattrMap
- A map with attribute, can be null
java.lang.Exception
public int waitOnUpdate(long timeout, int countExpected)
waitOnUpdate(long, String, String, int)
public int waitOnUpdate(long timeout, java.lang.String oid, java.lang.String state, int countExpected)
ERASE notifies are not returned
This method does not assert() it return the number of messages arrived which you can use to assert yourself.
timeout
- in millisecondsoid
- The expected message oid, if null the oid is not checked (all oids are OK)state
- The expected state, if null the state is not checked (all states are OK)
public int waitOnUpdate(long timeout)
ERASE notifies are not returned
waitOnUpdate(long, String, String)
public int waitOnUpdate(long timeout, java.lang.String oid, java.lang.String state)
ERASE notifies are not returned
timeout
- in millisecondsoid
- The expected message oid, if null the oid is not checked (all oids are OK)state
- The expected state, if null the state is not checked (all states are OK)
public void add(Msg msg)
public void remove(Msg msg)
public void clear()
public Msg[] getMsgs(java.lang.String oid, java.lang.String state)
oid
- if null the oid is not checkedstate
- if null the state is not checkedpublic Msg[] getMsgs()
public Msg getMsg(java.lang.String oid, java.lang.String state) throws XmlBlasterException
If
- more than one message is available
XmlBlasterException
public int count()
public void compareToReceived(MsgUnit[] expectedArr, java.lang.String secretCbSessionId)
The correct sequence and the message data is checked.
expectedArr
- The published messages which we expect here as updatessecretCbSessionId
- If not null it is checked as wellpublic void compareToReceived(PublishReturnQos[] expectedArr)
Especially the sequence and the rcvTimestamp is checked.
expectedArr
- The published messages which we expect here as updatespublic void setMsgContent(byte[] msgContent)
public java.lang.String toString()
toString
in class java.lang.Object
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |