xmlBlaster 2.2.0 API

org.xmlBlaster.test.admin
Class TestAdminGet

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.xmlBlaster.test.admin.TestAdminGet
All Implemented Interfaces:
junit.framework.Test, I_Callback

public class TestAdminGet
extends junit.framework.TestCase
implements I_Callback

Tests the activation/deactivation of the DispatchManager.
If the DispatchManager is disactivated, asynchronous dispatch should not be possible.

Invoke examples:

   java junit.textui.TestRunner -noloading org.xmlBlaster.test.client.TestAdminGet
   java junit.swingui.TestRunner -noloading org.xmlBlaster.test.client.TestAdminGet
 


Nested Class Summary
 class TestAdminGet.PublisherThread
           
 
Field Summary
private  java.lang.String contentMime
           
private  Global glob
           
private static java.util.logging.Logger log
           
private static java.lang.String ME
           
private  java.lang.String senderName
           
private  java.lang.String sessionName
           
private  MsgInterceptor updateInterceptor
           
 
Constructor Summary
TestAdminGet(Global glob, java.lang.String testName)
           
TestAdminGet(java.lang.String testName)
           
 
Method Summary
private  void adminGet(java.lang.String oid, boolean consumable, long waitingDelay, int maxEntries, int initialEntries, int endEntries, int entriesExpected)
          Testing the getting of queue entries.
private  void doActivateDispatch(boolean doDispatch)
           
 void doPublish(int counter, java.lang.String oid)
          TEST: Construct a message and publish it.
private  void doSubscribe(java.lang.String oid)
          TEST: Subscribe to a specific oid
private  void doUnSubscribe(java.lang.String oid)
           
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.TestAdminGet
protected  void setUp()
          Sets up the fixture.
protected  void tearDown()
          Tears down the fixture.
 void testActivationFlag()
          Tests the activation flag setting and getting, i.e.
 void testGetConsumableDoWaiting()
           
 void testGetConsumableNoWaiting()
           
 void testGetNonConsumableDoWaiting()
           
 void testGetNonConsumableNoWaiting()
           
 void testGetQueueEntries()
          Testing the getting of queue entries without removing them from the queue.
 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

ME

private static java.lang.String ME

glob

private Global glob

log

private static java.util.logging.Logger log

updateInterceptor

private MsgInterceptor updateInterceptor

senderName

private java.lang.String senderName

contentMime

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

sessionName

private java.lang.String sessionName
Constructor Detail

TestAdminGet

public TestAdminGet(java.lang.String testName)

TestAdminGet

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

setUp

protected void setUp()
Sets up the fixture.

Connect to xmlBlaster and login

Overrides:
setUp in class junit.framework.TestCase

tearDown

protected void tearDown()
Tears down the fixture.

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

Overrides:
tearDown in class junit.framework.TestCase

doSubscribe

private void doSubscribe(java.lang.String oid)
TEST: Subscribe to a specific oid


doUnSubscribe

private void doUnSubscribe(java.lang.String oid)

doPublish

public void doPublish(int counter,
                      java.lang.String oid)
               throws XmlBlasterException
TEST: Construct a message and publish it. If the counter is negative, the content of the message will be an empty string.

Throws:
XmlBlasterException

testActivationFlag

public void testActivationFlag()
Tests the activation flag setting and getting, i.e. disactivating/activating of the dispatcher.


update

public java.lang.String update(java.lang.String cbSessionId,
                               UpdateKey updateKey,
                               byte[] content,
                               UpdateQos updateQos)
                        throws XmlBlasterException
Description copied from interface: I_Callback
This is the callback method invoked from I_XmlBlasterAccess informing the client in an asynchronous mode about a new message.

So you should implement in your client code the I_Callback interface - suppling the update() method where you can do with the message whatever you want.

The raw protocol driver specific update() method (e.g. CORBA-BlasterCallback.update()) is unpacked and for each arrived message this update is called.

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.
Throws:
XmlBlasterException
See Also:
I_XmlBlasterAccess

testGetQueueEntries

public void testGetQueueEntries()
Testing the getting of queue entries without removing them from the queue. TEST:


doActivateDispatch

private void doActivateDispatch(boolean doDispatch)
                         throws XmlBlasterException
Throws:
XmlBlasterException

adminGet

private void adminGet(java.lang.String oid,
                      boolean consumable,
                      long waitingDelay,
                      int maxEntries,
                      int initialEntries,
                      int endEntries,
                      int entriesExpected)
Testing the getting of queue entries. Note that before this method is called, the queue must be empty TEST:


testGetNonConsumableNoWaiting

public void testGetNonConsumableNoWaiting()

testGetConsumableNoWaiting

public void testGetConsumableNoWaiting()

testGetNonConsumableDoWaiting

public void testGetNonConsumableDoWaiting()

testGetConsumableDoWaiting

public void testGetConsumableDoWaiting()

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

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


xmlBlaster 2.2.0 API

Copyright © 1999-2014 The xmlBlaster.org contributers.