xmlBlaster 2.2.0 API

org.xmlBlaster.test.topic
Class TestTopicLifeCycle

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.custommonkey.xmlunit.XMLTestCase
              extended by org.xmlBlaster.test.topic.TestTopicLifeCycle
All Implemented Interfaces:
junit.framework.Test, org.custommonkey.xmlunit.XMLConstants, org.custommonkey.xmlunit.XSLTConstants, I_Callback

public class TestTopicLifeCycle
extends org.custommonkey.xmlunit.XMLTestCase
implements I_Callback

Here we test some state transitions of a topic.

We traverse the possible transitions of a topic (TopicHandler.java) as described in requirement engine.message.lifecycle by sending some expiring messages (see state transition brackets in requirement)
Please see individual test for a description

Invoke examples:

    java junit.textui.TestRunner org.xmlBlaster.test.topic.TestTopicLifeCycle

    java junit.swingui.TestRunner -noloading org.xmlBlaster.test.topic.TestTopicLifeCycle
 

See Also:
The engine.message.lifecycle requirement, TopicHandler

Field Summary
private  long blockUpdateTime
           
private  I_XmlBlasterAccess con
           
private  Global glob
           
private static java.util.logging.Logger log
           
private  java.lang.String publishOid
           
private  java.lang.String senderContent
           
private  int serverPort
           
private  EmbeddedXmlBlaster serverThread
           
private  boolean startEmbedded
           
private  SubscribeReturnQos subscribeReturnQos
           
private  MsgInterceptor updateInterceptor
           
private  java.lang.String xpath
           
private  java.lang.String xpathTag
           
 
Fields inherited from interface org.custommonkey.xmlunit.XSLTConstants
XSLT_END, XSLT_IDENTITY_TEMPLATE, XSLT_START, XSLT_STRIP_WHITESPACE, XSLT_XML_OUTPUT_NOINDENT
 
Fields inherited from interface org.custommonkey.xmlunit.XMLConstants
CLOSE_NODE, END_CDATA, END_COMMENT, END_PROCESSING_INSTRUCTION, OPEN_END_NODE, OPEN_START_NODE, START_CDATA, START_COMMENT, START_DOCTYPE, START_PROCESSING_INSTRUCTION, XML_DECLARATION, XMLNS_PREFIX, XPATH_ATTRIBUTE_IDENTIFIER, XPATH_CHARACTER_NODE_IDENTIFIER, XPATH_COMMENT_IDENTIFIER, XPATH_NODE_INDEX_END, XPATH_NODE_INDEX_START, XPATH_PROCESSING_INSTRUCTION_IDENTIFIER, XPATH_SEPARATOR
 
Constructor Summary
TestTopicLifeCycle(Global glob, java.lang.String testName)
          Constructs the TestTopicLifeCycle object.
 
Method Summary
private  java.lang.String getDump()
          Retrieve a dump of xmlBlaster to analyse
static void main(java.lang.String[] args)
          Invoke: java org.xmlBlaster.test.topic.TestTopicLifeCycle -startEmbedded false
 EraseReturnQos[] sendErase(boolean forceDestroy)
           
 void sendExpiringMsg(boolean initializeTopic, long topicDestroyDelay, long msgLifeTime)
          Publish an almost volatile message.
 java.lang.String sendExpiringXPathMsg(long topicDestroyDelay, long msgLifeTime)
          Publish an almost volatile XPATH message.
protected  void setUp()
          Sets up the fixture.
 void subscribeMsg()
          Subscribe a volatile message.
 java.lang.String subscribeXPathMsg()
          Subscribe topics with XPATH.
static junit.framework.Test suite()
          Method is used by TestRunner to load these tests
protected  void tearDown()
          Tears down the fixture.
 void testExpiry()
          THIS IS THE TEST
 void testForcedErased()
          THIS IS THE TEST Transitions [1] -> [4] -> [10]
 void testSoftErased()
          THIS IS THE TEST Transitions [1] -> [4] -> [7] -> [12]
 void testSubscribeVolatile()
          THIS IS THE TEST Transitions [1] -> [4] -> [6] -> [11]
 void testUnconfiguredErased()
          THIS IS THE TEST Transitions [1] -> [9]
 void testUnconfiguredSubscribeSubscribe()
          THIS IS THE TEST Transitions [1] -> [13] -> [9]
 void testUnconfiguredUnSubscribe()
          THIS IS THE TEST Transitions [1] -> [9] (by unSubscribe)
 void testUnreferencedAlive()
          THIS IS THE TEST
 void testVolatile()
          THIS IS THE TEST
 void unSubscribeMsg()
          unSubscribe a message.
 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 org.custommonkey.xmlunit.XMLTestCase
assertNodeTestPasses, assertNodeTestPasses, assertNotXpathExists, assertNotXpathExists, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLEqual, assertXMLIdentical, assertXMLIdentical, assertXMLIdentical, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLNotEqual, assertXMLValid, assertXMLValid, assertXMLValid, assertXMLValid, assertXpathEvaluatesTo, assertXpathEvaluatesTo, assertXpathExists, assertXpathExists, assertXpathNotExists, assertXpathNotExists, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathsNotEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, assertXpathValuesNotEqual, compareXML, compareXML, compareXML, compareXML, compareXML, setControlParser, setIgnoreWhitespace, setTestParser
 
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

glob

private Global glob

log

private static java.util.logging.Logger log

con

private I_XmlBlasterAccess con

senderContent

private java.lang.String senderContent

publishOid

private java.lang.String publishOid

xpathTag

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

xpath

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

subscribeReturnQos

private SubscribeReturnQos subscribeReturnQos

blockUpdateTime

private long blockUpdateTime

serverThread

private EmbeddedXmlBlaster serverThread

serverPort

private int serverPort

startEmbedded

private boolean startEmbedded

updateInterceptor

private MsgInterceptor updateInterceptor
Constructor Detail

TestTopicLifeCycle

public TestTopicLifeCycle(Global glob,
                          java.lang.String testName)
Constructs the TestTopicLifeCycle object.

Parameters:
testName - The name used in the test suite
loginName - The name to login to the xmlBlaster
Method Detail

setUp

protected void setUp()
Sets up the fixture.

Creates a CORBA connection and does a login.
- One connection for the sender client

Overrides:
setUp in class junit.framework.TestCase

tearDown

protected void tearDown()
Tears down the fixture.

cleaning up .... logout

Overrides:
tearDown in class junit.framework.TestCase

sendErase

public EraseReturnQos[] sendErase(boolean forceDestroy)

sendExpiringMsg

public void sendExpiringMsg(boolean initializeTopic,
                            long topicDestroyDelay,
                            long msgLifeTime)
Publish an almost volatile message.


sendExpiringXPathMsg

public java.lang.String sendExpiringXPathMsg(long topicDestroyDelay,
                                             long msgLifeTime)
Publish an almost volatile XPATH message.

Returns:
publishOid

subscribeMsg

public void subscribeMsg()
Subscribe a volatile message.


subscribeXPathMsg

public java.lang.String subscribeXPathMsg()
Subscribe topics with XPATH.

Returns:
The subscription id

unSubscribeMsg

public void unSubscribeMsg()
unSubscribe a message.


getDump

private java.lang.String getDump()
Retrieve a dump of xmlBlaster to analyse


testExpiry

public void testExpiry()
THIS IS THE TEST

We traverse the transitions

 Start -[2]->  ALIVE (3 sec)
       -[6]->  UNREFERENCED (3 sec)
       -[11]-> DEAD
 
 as described in requirement engine.message.lifecycle by sending some expiring messages (see
 state transition brackets in requirement)
 


testUnreferencedAlive

public void testUnreferencedAlive()
                           throws java.lang.Exception
THIS IS THE TEST

We traverse the transitions

 Start -[2]->  ALIVE (3 sec)
       -[6]->  UNREFERENCED (3 sec)
       -[5]->  ALIVE (3 sec)
       -[11]-> DEAD
 
 as described in requirement engine.message.lifecycle by sending some expiring messages (see
 state transition brackets in requirement)
 

Throws:
java.lang.Exception

testVolatile

public void testVolatile()
THIS IS THE TEST

We traverse the transitions

 Start -[2]->  ALIVE (0 sec)
       -[6]->  UNREFERENCED (0 sec)
       -[11]-> DEAD
 
 as described in requirement engine.message.lifecycle by sending some expiring messages (see
 state transition brackets in requirement)
Please see individual test for a description


testSubscribeVolatile

public void testSubscribeVolatile()
THIS IS THE TEST Transitions [1] -> [4] -> [6] -> [11]


testUnconfiguredSubscribeSubscribe

public void testUnconfiguredSubscribeSubscribe()
THIS IS THE TEST Transitions [1] -> [13] -> [9]


testSoftErased

public void testSoftErased()
THIS IS THE TEST Transitions [1] -> [4] -> [7] -> [12]


testForcedErased

public void testForcedErased()
THIS IS THE TEST Transitions [1] -> [4] -> [10]


testUnconfiguredErased

public void testUnconfiguredErased()
THIS IS THE TEST Transitions [1] -> [9]


testUnconfiguredUnSubscribe

public void testUnconfiguredUnSubscribe()
THIS IS THE TEST Transitions [1] -> [9] (by unSubscribe)


update

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

Specified by:
update in interface I_Callback
Parameters:
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
content - The arrived message content. This is your payload.
See Also:
I_Callback.update(String, UpdateKey, byte[], UpdateQos)

suite

public static junit.framework.Test suite()
Method is used by TestRunner to load these tests


main

public static void main(java.lang.String[] args)
Invoke: java org.xmlBlaster.test.topic.TestTopicLifeCycle -startEmbedded false


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.