org.exolab.jmscts.test.session.clientack
Class ClientAcknowledgeTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--junit.framework.TestCase
              |
              +--org.exolab.jmscts.core.JMSTestCase
                    |
                    +--org.exolab.jmscts.core.AbstractConnectionFactoryTestCase
                          |
                          +--org.exolab.jmscts.core.AbstractConnectionTestCase
                                |
                                +--org.exolab.jmscts.core.AbstractSessionTestCase
                                      |
                                      +--org.exolab.jmscts.core.AbstractMessageTestCase
                                            |
                                            +--org.exolab.jmscts.core.AbstractSendReceiveTestCase
                                                  |
                                                  +--org.exolab.jmscts.test.session.clientack.ClientAcknowledgeTestCase
                                                        |
                                                        +--org.exolab.jmscts.test.session.clientack.ClientAcknowledgeTest
All Implemented Interfaces:
ConnectionFactoryTestCase, ConnectionTestCase, JMSTest, MessageTestCase, SendReceiveTestCase, SessionTestCase, junit.framework.Test

public class ClientAcknowledgeTest
extends org.exolab.jmscts.test.session.clientack.ClientAcknowledgeTestCase

This class tests the behaviour of sessions created with the Session.CLIENT_ACKNOWLEDGE message acknowledgment mode.

Version:
$Revision: 1.10 $
Author:
Tim Anderson

Constructor Summary
ClientAcknowledgeTest(java.lang.String name)
          Construct a new ClientAcknowledgeTest
 
Method Summary
protected  void checkProperties(java.util.List messages, java.lang.String group, int sequence, boolean redelivered)
          Verifies that the JMSXGroupID and JMXSGroupSeq properties are set and that the messages are in sequence
 java.lang.String[] getDestinations()
          Returns the list of destination names used by this test case.
protected  javax.jms.Message receive(MessageReceiver[] receivers, int count, int sequence, boolean redelivered)
          Helper to receive messages from a list of receivers and verify they are in the correct sequence.
protected  javax.jms.Message receive(TestContext context, MessageReceiver[] receivers, int count, int sequence, boolean redelivered)
          Helper to receive messages from a list of receivers and verify they are in the correct sequence.
protected  void send(int count)
          Helper to send messages to each destination, setting the JMSXGroupID and JMSXGroupSeq properties for each message
protected  void send(TestContext context, int count)
          Helper to send messages to each destination, setting the JMSXGroupID and JMSXGroupSeq properties for each message
static junit.framework.Test suite()
          Sets up the test suite.
 void testClientAcknowledge()
          Verifies client acknowledgement functionality.
 void testPartialClientAcknowledge()
          Verifies client acknowledgement functionality.
 void testRecover()
          Verifies session recovery behaviour.
 
Methods inherited from class org.exolab.jmscts.core.AbstractSendReceiveTestCase
close, close, close, close, createReceiver, createReceiver, createReceivers, createReceivers, createSender, createSender, createSenders, createSenders, getDeliveryTypes, getDestination, getDurableOnly, receive, receive, receive, receive, receive, receive, recreate, send, send, send, send, send, send, send, send, sendReceive, sendReceive, setDestinations
 
Methods inherited from class org.exolab.jmscts.core.AbstractMessageTestCase
getMessagePopulator, getMessageTypes, shouldCreateMessage, startConnection
 
Methods inherited from class org.exolab.jmscts.core.AbstractSessionTestCase
getAckTypes
 
Methods inherited from class org.exolab.jmscts.core.AbstractConnectionTestCase
setClientID
 
Methods inherited from class org.exolab.jmscts.core.AbstractConnectionFactoryTestCase
getConnectionFactoryTypes
 
Methods inherited from class org.exolab.jmscts.core.JMSTestCase
getContext, getRequirements, setContext, share
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, setUp, tearDown, 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
 
Methods inherited from interface org.exolab.jmscts.core.MessageTestCase
getMessagePopulator, getMessageTypes, shouldCreateMessage, startConnection
 
Methods inherited from interface org.exolab.jmscts.core.SessionTestCase
getAckTypes
 
Methods inherited from interface org.exolab.jmscts.core.ConnectionTestCase
setClientID
 
Methods inherited from interface org.exolab.jmscts.core.ConnectionFactoryTestCase
getConnectionFactoryTypes
 
Methods inherited from interface org.exolab.jmscts.core.JMSTest
getContext, setContext, share
 
Methods inherited from interface junit.framework.Test
countTestCases, run
 

Constructor Detail

ClientAcknowledgeTest

public ClientAcknowledgeTest(java.lang.String name)
Construct a new ClientAcknowledgeTest
Parameters:
name - the name of test case
Method Detail

suite

public static junit.framework.Test suite()
Sets up the test suite.
Returns:
an instance of this class that may be run by JMSTestRunner

getDestinations

public java.lang.String[] getDestinations()
Returns the list of destination names used by this test case. These are used to pre-administer destinations prior to running the test case.
Overrides:
getDestinations in class AbstractSendReceiveTestCase
Returns:
the list of destinations used by this test case

testClientAcknowledge

public void testClientAcknowledge()
                           throws java.lang.Exception
Verifies client acknowledgement functionality. For each destination, send n messages, and then receive them. Acknowledge the last message received, recover the session, and verify that no other messages are received.
Throws:
java.lang.Exception - for any error

testPartialClientAcknowledge

public void testPartialClientAcknowledge()
                                  throws java.lang.Exception
Verifies client acknowledgement functionality. For each destination, send n messages, and then receive them. Acknowledge the middle message received for each destination, recover the session, and verify that the messages can be received again. The messages received after recovery should have their JMSRedelivered flag set to true.
Throws:
java.lang.Exception - for any error

testRecover

public void testRecover()
                 throws java.lang.Exception
Verifies session recovery behaviour. For each destination, send n messages, and then receive them. Recover the session, and verify that the messages can be received again. The messages received after recovery should have their JMSRedelivered flag set to true.
Throws:
java.lang.Exception - for any error

send

protected void send(int count)
             throws java.lang.Exception
Helper to send messages to each destination, setting the JMSXGroupID and JMSXGroupSeq properties for each message
Parameters:
count - the number of messages to send
Throws:
java.lang.Exception - for any error

send

protected void send(TestContext context,
                    int count)
             throws java.lang.Exception
Helper to send messages to each destination, setting the JMSXGroupID and JMSXGroupSeq properties for each message
Parameters:
context - the test context to use
count - the number of messages to send
Throws:
java.lang.Exception - for any error

receive

protected javax.jms.Message receive(MessageReceiver[] receivers,
                                    int count,
                                    int sequence,
                                    boolean redelivered)
                             throws java.lang.Exception
Helper to receive messages from a list of receivers and verify they are in the correct sequence.
Parameters:
receivers - the list of receivers to receive messages with.
count - the number of expected messages to receive
sequence - the starting sequence
redelivered - the expected value of JMSRedelivered
Returns:
the last message returned by the session
Throws:
java.lang.Exception - for any error

receive

protected javax.jms.Message receive(TestContext context,
                                    MessageReceiver[] receivers,
                                    int count,
                                    int sequence,
                                    boolean redelivered)
                             throws java.lang.Exception
Helper to receive messages from a list of receivers and verify they are in the correct sequence.
Parameters:
context - the test context to use
receivers - the list of receivers to receive messages with.
count - the number of expected messages to receive
sequence - the starting sequence
redelivered - the expected value of JMSRedelivered
Returns:
the last message returned by the session
Throws:
java.lang.Exception - for any error

checkProperties

protected void checkProperties(java.util.List messages,
                               java.lang.String group,
                               int sequence,
                               boolean redelivered)
                        throws java.lang.Exception
Verifies that the JMSXGroupID and JMXSGroupSeq properties are set and that the messages are in sequence
Parameters:
messages - the list of messages to verify
group - the expected value of JMSXGroupID
sequence - the starting sequence number
redelivered - the expected value of JMSRedelivered
Throws:
java.lang.Exception - for any error


Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.