org.exolab.jmscts.test.producer.ttl
Class QueueSenderTest
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.producer.ttl.TimeToLiveTestCase
|
+--org.exolab.jmscts.test.producer.ttl.QueueSenderTest
- All Implemented Interfaces:
- ConnectionFactoryTestCase, ConnectionTestCase, JMSTest, MessageTestCase, SendReceiveTestCase, SessionTestCase, junit.framework.Test
- public class QueueSenderTest
- extends org.exolab.jmscts.test.producer.ttl.TimeToLiveTestCase
This class tests the behaviour of the time-to-live methods and their
affect on the JMSExpiration, for QueueSender
s
- Version:
- $Revision: 1.3 $
- Author:
- Tim Anderson
Constructor Summary |
QueueSenderTest(java.lang.String name)
Construct a new QueueSenderTest |
Method Summary |
protected void |
checkExpiration(javax.jms.Message message,
long start,
long end,
long timeToLive)
Verifies that a message's JMSExpiration property falls in an expected
range |
protected void |
checkSameExpiration(javax.jms.Message message,
MessageReceiver receiver)
Verifies that a message received via the supplied MessageReceiver
has the same JMSExpiration as that of a message. |
java.lang.String[] |
getDestinations()
Returns the list of destination names used by this test case. |
static junit.framework.Test |
suite()
Sets up the test suite |
void |
testDefaultTTL()
Verifies that the default time-to-live for a sender equals
0 , and that the JMSExpiration property is set to
0 on send and receive when the default time-to-live is
used. |
void |
testDefaultTTLForAnonQueue()
Verifies that the default time-to-live for a sender constructed
with no destination equals 0 , and that the JMSExpiration
property is set to 0 on send and receive when the default
time-to-live is used. |
void |
testSendWithTTL()
Verifies that the time-to-live set at send is used when a
message is sent, and that the JMSExpiration property on the received
message equals that sent |
void |
testSendWithTTLAndAnonQueue()
Verifies that the time-to-live set at send is used when a message is
sent, using a QueueSender created with no default queue, and that the
JMSExpiration property on the received message equals that sent |
void |
testSetTTL()
Verifies that the time-to-live can be set on a sender, that the value is
used when no time-to-live is provided when a message is sent,
and that the JMSExpiration message property is set correctly on send and
receive |
void |
testSetTTLWithAnonQueue()
Verifies that the time-to-live can be set on a sender created
with no default queue, that the value is used when no time-to-live
is provided when a message is sent, and that the JMSExpiration property
on the received message equals that sent |
protected void |
verifySend(javax.jms.QueueSender sender,
javax.jms.Message message,
long timeToLive)
Sendes a message using the QueueSender.send(Message) method
and verifies that the JMSExpiration property is set correctly on
send, and is the same on receipt |
protected void |
verifySendWithQueue(javax.jms.QueueSender sender,
javax.jms.Queue queue,
javax.jms.Message message,
long timeToLive)
Sendes a message using the QueueSender.send(Queue, Message)
method and verifies that the JMSExpiration property is set correctly |
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 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 junit.framework.Test |
countTestCases, run |
QueueSenderTest
public QueueSenderTest(java.lang.String name)
- Construct a new
QueueSenderTest
- Parameters:
name
- the name of test case
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
testDefaultTTL
public void testDefaultTTL()
throws java.lang.Exception
- Verifies that the default time-to-live for a sender equals
0
, and that the JMSExpiration property is set to
0
on send and receive when the default time-to-live is
used.
- Throws:
java.lang.Exception
- for any error
testDefaultTTLForAnonQueue
public void testDefaultTTLForAnonQueue()
throws java.lang.Exception
- Verifies that the default time-to-live for a sender constructed
with no destination equals
0
, and that the JMSExpiration
property is set to 0
on send and receive when the default
time-to-live is used.
- Throws:
java.lang.Exception
- for any error
testSetTTL
public void testSetTTL()
throws java.lang.Exception
- Verifies that the time-to-live can be set on a sender, that the value is
used when no time-to-live is provided when a message is sent,
and that the JMSExpiration message property is set correctly on send and
receive
- Throws:
java.lang.Exception
- for any error
testSetTTLWithAnonQueue
public void testSetTTLWithAnonQueue()
throws java.lang.Exception
- Verifies that the time-to-live can be set on a sender created
with no default queue, that the value is used when no time-to-live
is provided when a message is sent, and that the JMSExpiration property
on the received message equals that sent
- Throws:
java.lang.Exception
- for any error
testSendWithTTL
public void testSendWithTTL()
throws java.lang.Exception
- Verifies that the time-to-live set at send is used when a
message is sent, and that the JMSExpiration property on the received
message equals that sent
- Throws:
java.lang.Exception
- for any error
testSendWithTTLAndAnonQueue
public void testSendWithTTLAndAnonQueue()
throws java.lang.Exception
- Verifies that the time-to-live set at send is used when a message is
sent, using a QueueSender created with no default queue, and that the
JMSExpiration property on the received message equals that sent
- Throws:
java.lang.Exception
- for any error
verifySend
protected void verifySend(javax.jms.QueueSender sender,
javax.jms.Message message,
long timeToLive)
throws java.lang.Exception
- Sendes a message using the QueueSender.send(Message) method
and verifies that the JMSExpiration property is set correctly on
send, and is the same on receipt
- Parameters:
sender
- the sendermessage
- the message to sendtimeToLive
- the expected time-to-live- Throws:
java.lang.Exception
- for any error
verifySendWithQueue
protected void verifySendWithQueue(javax.jms.QueueSender sender,
javax.jms.Queue queue,
javax.jms.Message message,
long timeToLive)
throws java.lang.Exception
- Sendes a message using the QueueSender.send(Queue, Message)
method and verifies that the JMSExpiration property is set correctly
- Parameters:
sender
- the senderqueue
- the queue to send tomessage
- the message to sendtimeToLive
- the expected time-to-live- Throws:
java.lang.Exception
- for any error
checkExpiration
protected void checkExpiration(javax.jms.Message message,
long start,
long end,
long timeToLive)
throws java.lang.Exception
- Verifies that a message's JMSExpiration property falls in an expected
range
- Parameters:
message
- the message to checkstart
- the time just prior to the message being sentend
- the time just after to the message being senttimeToLive
- the time-to-live used to publish the message- Throws:
java.lang.Exception
- for any error
checkSameExpiration
protected void checkSameExpiration(javax.jms.Message message,
MessageReceiver receiver)
throws java.lang.Exception
- Verifies that a message received via the supplied MessageReceiver
has the same JMSExpiration as that of a message.
If the session is transacted, it will be committed prior to proceeding
- Parameters:
message
- the sent message to compare withreceiver
- the receiver used to receive a message- Throws:
java.lang.Exception
- for any error
Copyright © 2001-2004 JMS CTS Team. All Rights Reserved.