org.apache.qpid.server.logging
Class SubscriptionLoggingTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.qpid.test.utils.QpidTestCase
              extended by org.apache.qpid.test.utils.QpidBrokerTestCase
                  extended by org.apache.qpid.server.logging.AbstractTestLogging
                      extended by org.apache.qpid.server.logging.SubscriptionLoggingTest
All Implemented Interfaces:
junit.framework.Test

public class SubscriptionLoggingTest
extends AbstractTestLogging

Subscription The Subscription test suite validates that the follow log messages as specified in the Functional Specification. This suite of tests validate that the Subscription messages occur correctly and according to the following format: SUB-1001 : Create : [Durable] [Arguments : ] SUB-1002 : Close SUB-1003 : State :


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
QpidBrokerTestCase.MessageType
 
Field Summary
(package private)  Connection _connection
           
(package private)  Queue _queue
           
(package private)  Session _session
           
(package private)  Topic _topic
           
(package private) static String SUB_PREFIX
           
 
Fields inherited from class org.apache.qpid.server.logging.AbstractTestLogging
_configLoader, _monitor, _serverConfiguration, DEFAULT_LOG_WAIT, TEST_LOG_PREFIX
 
Fields inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
_broker, _brokerLanguage, _brokerLogPrefix, _brokerOutputStream, _brokerPersistent, _brokers, _configFile, _connectionFactory, _connections, _initialContext, _interleaveBrokerLog, _logger, _output, _outputFile, _testName, BROKER_READY, CONTENT, CPP, DEFAULT_MANAGEMENT_PORT, DEFAULT_MESSAGE_SIZE, DEFAULT_PORT, DEFAULT_SSL_PORT, DEFAULT_VM_PORT, EXTERNAL, INDEX, JAVA, LOGMONITOR_TIMEOUT, QPID_HOME, QpidHome, QUEUE, RECEIVE_TIMEOUT, TOPIC, VM
 
Fields inherited from class org.apache.qpid.test.utils.QpidTestCase
MEMORY_STORE_CLASS_NAME, MS_CLASS_NAME_KEY
 
Constructor Summary
SubscriptionLoggingTest()
           
 
Method Summary
 void setUp()
           
 void testSubscriptionClose()
          Description: When a Subscription is closed it will log this so that it can be correlated with the Create.
 void testSubscriptionCreate()
          Description: When a Subscription is created it will be logged.
 void testSubscriptionCreateDurable()
          Description: The creation of a Durable Subscription, such as a JMS DurableTopicSubscriber will result in an extra Durable tag being included in the Create log message Input: 1.
 void testSubscriptionCreateDurableWithArguments()
          Description: The final combination of SUB-1001 Create messages involves the creation of a Durable Subscription that also contains a set of Arguments, such as those provided via a JMS Selector.
 void testSubscriptionCreateQueueBrowser()
          Description: The creation of a QueueBrowser will provides a number arguments and so should form part of the SUB-1001 Create message.
 void testSubscriptionCreateWithArguments()
          Description: The creation of a Subscriber with a JMS Selector will result in the Argument field being populated.
 void testSubscriptionSuspend()
          Description: When a Subscription fills its prefetch it will become suspended.
 
Methods inherited from class org.apache.qpid.server.logging.AbstractTestLogging
assertLoggingNotYetOccured, dumpLogs, dumpLogs, filterResultsByVirtualHost, findMatches, fromActor, fromMessage, fromSubject, getChannelID, getConnectionID, getLog, getLogMessage, getLogMessageFromEnd, getMessageID, getMessageString, setLogMessagePrefix, splitResultsOnConnectionID, tearDown, validateMessageID, waitAndFindMatches, waitAndFindMatches, waitForMessage, waitForMessage
 
Methods inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase
cleanBroker, createMessage, createNextMessage, drainQueue, getBroker, getBrokerCommand, getClientConnection, getConfigurationStringProperty, getConnection, getConnection, getConnection, getConnectionFactory, getConnectionFactory, getConnectionURL, getInitialContext, getLogger, getManagementPort, getMessageSize, getPort, getPort, getTestConfigFile, getTestQueue, getTestQueueName, getTestVirtualhostsFile, isBroker010, isBroker08, isBrokerStorePersistent, isCppBroker, isExternalBroker, isJavaBroker, makeVirtualHostPersistent, reloadBrokerSecurityConfig, restartBroker, restartBroker, revertLoggingLevels, revertSystemProperties, runBare, saveTestConfiguration, saveTestVirtualhosts, sendMessage, sendMessage, sendMessage, setBrokerEnvironment, setBrokerOnlySystemProperty, setConfigurationProperty, setLoggerLevel, setMessageSize, setSystemProperty, setSystemProperty, setTestClientSystemProperty, startBroker, startBroker, stopBroker, stopBroker
 
Methods inherited from class org.apache.qpid.test.utils.QpidTestCase
getTestProfileMessageStoreClassName, run
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, 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, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUB_PREFIX

static final String SUB_PREFIX
See Also:
Constant Field Values

_connection

Connection _connection

_session

Session _session

_queue

Queue _queue

_topic

Topic _topic
Constructor Detail

SubscriptionLoggingTest

public SubscriptionLoggingTest()
Method Detail

setUp

public void setUp()
           throws Exception
Overrides:
setUp in class AbstractTestLogging
Throws:
Exception

testSubscriptionCreate

public void testSubscriptionCreate()
                            throws JMSException,
                                   IOException
Description: When a Subscription is created it will be logged. This test validates that Subscribing to a transient queue is correctly logged. Input: 1. Running Broker 2. Create a new Subscription to a transient queue/topic. Output: 6 SUB-1001 : Create Validation Steps: 3. The SUB ID is correct

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionCreateDurable

public void testSubscriptionCreateDurable()
                                   throws JMSException,
                                          IOException
Description: The creation of a Durable Subscription, such as a JMS DurableTopicSubscriber will result in an extra Durable tag being included in the Create log message Input: 1. Running Broker 2. Creation of a JMS DurableTopicSubiber Output: SUB-1001 : Create : Durable Validation Steps: 3. The SUB ID is correct 4. The Durable tag is present in the message NOTE: A Subscription is not Durable, the queue it consumes from is.

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionCreateQueueBrowser

public void testSubscriptionCreateQueueBrowser()
                                        throws JMSException,
                                               IOException
Description: The creation of a QueueBrowser will provides a number arguments and so should form part of the SUB-1001 Create message. Input: 1. Running Broker 2. Java Client creates a QueueBroweser Output: SUB-1001 : Create : Arguments : Validation Steps: 3. The SUB ID is correct 4. The Arguments are present in the message 5. Arguments keys include AutoClose and Browser.

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionCreateWithArguments

public void testSubscriptionCreateWithArguments()
                                         throws JMSException,
                                                IOException
Description: The creation of a Subscriber with a JMS Selector will result in the Argument field being populated. These argument key/value pairs are then shown in the log message. Input: 1. Running Broker 2. Subscriber created with a JMS Selector. Output: SUB-1001 : Create : Arguments : Validation Steps: 3. The SUB ID is correct 4. Argument tag is present in the message

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionCreateDurableWithArguments

public void testSubscriptionCreateDurableWithArguments()
                                                throws JMSException,
                                                       IOException
Description: The final combination of SUB-1001 Create messages involves the creation of a Durable Subscription that also contains a set of Arguments, such as those provided via a JMS Selector. Input: 1. Running Broker 2. Java Client creates a Durable Subscription with Selector Output: SUB-1001 : Create : Durable Arguments : Validation Steps: 3. The SUB ID is correct 4. The tag Durable is present in the message 5. The Arguments are present in the message

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionClose

public void testSubscriptionClose()
                           throws JMSException,
                                  IOException
Description: When a Subscription is closed it will log this so that it can be correlated with the Create. Input: 1. Running Broker 2. Client with a subscription. 3. The subscription is then closed. Output: SUB-1002 : Close Validation Steps: 1. The SUB ID is correct 2. There must be a SUB-1001 Create message preceding this message 3. This must be the last message from the given Subscription

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer

testSubscriptionSuspend

public void testSubscriptionSuspend()
                             throws Exception,
                                    IOException
Description: When a Subscription fills its prefetch it will become suspended. This will be logged as a SUB-1003 message. Input: 1. Running broker 2. Message Producer to put more data on the queue than the client's prefetch 3. Client that ensures that its prefetch becomes full Output: SUB-1003 : State : Validation Steps: 1. The SUB ID is correct 2. The state is correct

Throws:
IOException - - if there is a problem getting the matches
JMSException - - if there is a problem creating the consumer
Exception


Licensed to the Apache Software Foundation