|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.apache.qpid.test.utils.QpidTestCase
org.apache.qpid.test.utils.QpidBrokerTestCase
public class QpidBrokerTestCase
Qpid base class for system testing test cases.
Nested Class Summary | |
---|---|
protected static class |
QpidBrokerTestCase.MessageType
Type of message |
Field Summary | |
---|---|
protected String |
_broker
|
protected String |
_brokerLanguage
|
protected static String |
_brokerLogPrefix
|
protected PrintStream |
_brokerOutputStream
|
protected Boolean |
_brokerPersistent
|
protected Map<Integer,Process> |
_brokers
|
protected File |
_configFile
|
protected org.apache.qpid.client.AMQConnectionFactory |
_connectionFactory
|
protected List<Connection> |
_connections
|
protected InitialContext |
_initialContext
|
protected static boolean |
_interleaveBrokerLog
|
protected static org.apache.log4j.Logger |
_logger
|
protected String |
_output
|
protected File |
_outputFile
|
protected String |
_testName
|
protected static String |
BROKER_READY
|
protected static String |
CONTENT
|
protected static String |
CPP
|
static int |
DEFAULT_MANAGEMENT_PORT
|
protected static int |
DEFAULT_MESSAGE_SIZE
Ensure our messages have some sort of size |
static int |
DEFAULT_PORT
|
static int |
DEFAULT_SSL_PORT
|
static int |
DEFAULT_VM_PORT
|
protected static String |
EXTERNAL
|
protected static String |
INDEX
|
protected static String |
JAVA
|
protected static int |
LOGMONITOR_TIMEOUT
|
protected static String |
QPID_HOME
|
protected String |
QpidHome
|
static String |
QUEUE
|
protected long |
RECEIVE_TIMEOUT
|
static String |
TOPIC
|
protected static String |
VM
|
Fields inherited from class org.apache.qpid.test.utils.QpidTestCase |
---|
MEMORY_STORE_CLASS_NAME, MS_CLASS_NAME_KEY |
Constructor Summary | |
---|---|
QpidBrokerTestCase()
|
|
QpidBrokerTestCase(String name)
|
Method Summary | |
---|---|
void |
cleanBroker()
|
Message |
createMessage(Session session,
int messageSize)
|
Message |
createNextMessage(Session session,
int msgCount)
|
protected int |
drainQueue(Queue queue)
Consume all the messages in the specified queue. |
org.apache.qpid.jms.BrokerDetails |
getBroker()
|
protected String |
getBrokerCommand(int port)
|
Connection |
getClientConnection(String username,
String password,
String id)
|
protected String |
getConfigurationStringProperty(String property)
Get a property value from the current configuration file. |
Connection |
getConnection()
|
Connection |
getConnection(org.apache.qpid.jms.ConnectionURL url)
|
Connection |
getConnection(String username,
String password)
Get a connection (remote or in-VM) |
org.apache.qpid.client.AMQConnectionFactory |
getConnectionFactory()
Get the default connection factory for the currently used broker Default factory is "local" |
org.apache.qpid.client.AMQConnectionFactory |
getConnectionFactory(String factoryName)
Get a connection factory for the currently used broker |
org.apache.qpid.jms.ConnectionURL |
getConnectionURL()
|
InitialContext |
getInitialContext()
we assume that the environment is correctly set i.e. |
org.apache.log4j.Logger |
getLogger()
|
protected int |
getManagementPort(int mainPort)
Return the management portin use by the broker on this main port |
protected int |
getMessageSize()
|
protected int |
getPort()
Get the Port that is use by the current broker |
protected int |
getPort(int port)
|
String |
getTestConfigFile()
|
Queue |
getTestQueue()
Return a Queue specific for this test. |
protected String |
getTestQueueName()
Return a uniqueName for this test. |
String |
getTestVirtualhostsFile()
|
boolean |
isBroker010()
|
boolean |
isBroker08()
Check whether the broker is an 0.8 |
protected boolean |
isBrokerStorePersistent()
|
protected boolean |
isCppBroker()
|
protected boolean |
isExternalBroker()
|
protected boolean |
isJavaBroker()
|
protected void |
makeVirtualHostPersistent(String virtualhost)
Attempt to set the Java Broker to use the BDBMessageStore for persistence Falling back to the DerbyMessageStore if |
void |
reloadBrokerSecurityConfig()
Reloads the broker security configuration using the ApplicationRegistry (InVM brokers) or the ConfigurationManagementMBean via the JMX interface (Standalone brokers, management must be enabled before calling the method). |
void |
restartBroker()
|
void |
restartBroker(int port)
|
protected void |
revertLoggingLevels()
Restore the logging levels defined by this test. |
protected void |
revertSystemProperties()
Restore the System property values that were set before this test run. |
void |
runBare()
|
protected void |
saveTestConfiguration()
|
protected void |
saveTestVirtualhosts()
|
List<Message> |
sendMessage(Session session,
Destination destination,
int count)
Send messages to the given destination. |
List<Message> |
sendMessage(Session session,
Destination destination,
int count,
int batchSize)
Send messages to the given destination. |
List<Message> |
sendMessage(Session session,
Destination destination,
int count,
int offset,
int batchSize)
Send messages to the given destination. |
protected void |
setBrokerEnvironment(String property,
String value)
Add an environtmen variable for the external broker environment |
protected void |
setBrokerOnlySystemProperty(String property,
String value)
Set a System property that is to be applied only to the external test broker. |
protected void |
setConfigurationProperty(String property,
String value)
Set a configuration Property for this test run. |
protected void |
setLoggerLevel(org.apache.log4j.Logger logger,
org.apache.log4j.Level level)
Adjust the VMs Log4j Settings just for this test run |
protected void |
setMessageSize(int byteSize)
|
protected void |
setSystemProperty(String property)
Set a System (-D) property for this test run. |
protected void |
setSystemProperty(String property,
String value)
Set a System property for the duration of this test. |
protected void |
setTestClientSystemProperty(String property,
String value)
Set a System (-D) property for the external Broker of this test. |
protected void |
setUp()
|
void |
startBroker()
|
void |
startBroker(int port)
|
void |
stopBroker()
|
void |
stopBroker(int port)
|
protected void |
tearDown()
|
Methods inherited from class org.apache.qpid.test.utils.QpidTestCase |
---|
|
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 |
---|
protected final String QpidHome
protected File _configFile
protected static final org.apache.log4j.Logger _logger
protected static final int LOGMONITOR_TIMEOUT
protected long RECEIVE_TIMEOUT
protected static final String INDEX
protected static final String CONTENT
protected static final String BROKER_READY
protected static final String JAVA
protected static final String CPP
protected static final String VM
protected static final String EXTERNAL
protected static final String QPID_HOME
public static final int DEFAULT_VM_PORT
public static final int DEFAULT_PORT
public static final int DEFAULT_MANAGEMENT_PORT
public static final int DEFAULT_SSL_PORT
protected String _brokerLanguage
protected String _broker
protected String _output
protected Boolean _brokerPersistent
protected static String _brokerLogPrefix
protected static boolean _interleaveBrokerLog
protected File _outputFile
protected PrintStream _brokerOutputStream
protected Map<Integer,Process> _brokers
protected InitialContext _initialContext
protected org.apache.qpid.client.AMQConnectionFactory _connectionFactory
protected String _testName
protected List<Connection> _connections
public static final String QUEUE
public static final String TOPIC
protected static final int DEFAULT_MESSAGE_SIZE
Constructor Detail |
---|
public QpidBrokerTestCase(String name)
public QpidBrokerTestCase()
Method Detail |
---|
public org.apache.log4j.Logger getLogger()
public void runBare() throws Throwable
runBare
in class junit.framework.TestCase
Throwable
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
public void startBroker() throws Exception
Exception
protected int getManagementPort(int mainPort)
mainPort
- the broker's main port.
protected int getPort()
protected int getPort(int port)
protected String getBrokerCommand(int port) throws MalformedURLException
MalformedURLException
public void startBroker(int port) throws Exception
Exception
public String getTestConfigFile()
public String getTestVirtualhostsFile()
protected void saveTestConfiguration() throws ConfigurationException
ConfigurationException
protected void saveTestVirtualhosts() throws ConfigurationException
ConfigurationException
public void cleanBroker()
public void stopBroker() throws Exception
Exception
public void stopBroker(int port) throws Exception
Exception
protected void makeVirtualHostPersistent(String virtualhost) throws ConfigurationException, IOException
virtualhost
- - The virtualhost to modify
ConfigurationException
- - when reading/writing existing configuration
IOException
- - When creating a temporary file.protected String getConfigurationStringProperty(String property) throws ConfigurationException
property
- the property to lookup
ConfigurationException
protected void setConfigurationProperty(String property, String value) throws ConfigurationException, IOException
property
- the configuration property to setvalue
- the new value
ConfigurationException
- when loading the current config file
IOException
- when writing the new config fileprotected void setBrokerOnlySystemProperty(String property, String value)
property
- the property namevalue
- the value to set the property toprotected void setSystemProperty(String property)
property
- the System property to setprotected void setSystemProperty(String property, String value)
property
- the property to setvalue
- the new value to useprotected void setTestClientSystemProperty(String property, String value)
property
- The property to setvalue
- the value to set it to.protected void revertSystemProperties()
protected void setBrokerEnvironment(String property, String value)
property
- the property to setvalue
- the value to set it toprotected void setLoggerLevel(org.apache.log4j.Logger logger, org.apache.log4j.Level level)
logger
- the logger to changelevel
- the level to setprotected void revertLoggingLevels()
public boolean isBroker08()
public boolean isBroker010()
protected boolean isJavaBroker()
protected boolean isCppBroker()
protected boolean isExternalBroker()
protected boolean isBrokerStorePersistent()
public void restartBroker() throws Exception
Exception
public void restartBroker(int port) throws Exception
Exception
public InitialContext getInitialContext() throws NamingException
NamingException
- if there is an error getting the contextpublic org.apache.qpid.client.AMQConnectionFactory getConnectionFactory() throws NamingException
Exception
- if there is an error getting the tactory
NamingException
public org.apache.qpid.client.AMQConnectionFactory getConnectionFactory(String factoryName) throws NamingException
factoryName
- The factory name
Exception
- if there is an error getting the tactory
NamingException
public Connection getConnection() throws JMSException, NamingException
JMSException
NamingException
public Connection getConnection(org.apache.qpid.jms.ConnectionURL url) throws JMSException
JMSException
public Connection getConnection(String username, String password) throws JMSException, NamingException
username
- The user namepassword
- The user password
Exception
- if there is an error getting the connection
JMSException
NamingException
public Connection getClientConnection(String username, String password, String id) throws JMSException, org.apache.qpid.url.URLSyntaxException, org.apache.qpid.AMQException, NamingException
JMSException
org.apache.qpid.url.URLSyntaxException
org.apache.qpid.AMQException
NamingException
protected String getTestQueueName()
public Queue getTestQueue()
protected void tearDown() throws Exception
tearDown
in class junit.framework.TestCase
Exception
protected int drainQueue(Queue queue) throws Exception
queue
- the queue to purge
Exception
- if a problem occurspublic List<Message> sendMessage(Session session, Destination destination, int count) throws Exception
session
- the session to use for sendingdestination
- where to send them tocount
- no. of messages to send
Exception
public List<Message> sendMessage(Session session, Destination destination, int count, int batchSize) throws Exception
session
- the session to use for sendingdestination
- where to send them tocount
- no. of messages to sendbatchSize
- the batchSize in which to commit, 0 means no batching,
but a single commit at the end
Exception
public List<Message> sendMessage(Session session, Destination destination, int count, int offset, int batchSize) throws Exception
session
- the session to use for sendingdestination
- where to send them tocount
- no. of messages to sendoffset
- offset allows the INDEX value of the message to be adjusted.batchSize
- the batchSize in which to commit, 0 means no batching,
but a single commit at the end
Exception
public Message createNextMessage(Session session, int msgCount) throws JMSException
JMSException
public Message createMessage(Session session, int messageSize) throws JMSException
JMSException
protected int getMessageSize()
protected void setMessageSize(int byteSize)
public org.apache.qpid.jms.ConnectionURL getConnectionURL() throws NamingException
NamingException
public org.apache.qpid.jms.BrokerDetails getBroker()
public void reloadBrokerSecurityConfig() throws Exception
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |