|
||||||||||
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
org.apache.qpid.server.security.acl.AbstractACLTestCase
public abstract class AbstractACLTestCase
Abstract test case for ACLs.
This base class contains convenience methods to mange ACL files and implements a mechanism that allows each
test method to run its own setup code before the broker starts.
TODO move the pre broker-startup setup method invocation code to QpidBrokerTestCase
SimpleACLTest
,
ExternalACLTest
,
ExternalACLFileTest
,
ExternalACLJMXTest
,
ExternalAdminACLTest
,
ExhaustiveACLTest
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.qpid.test.utils.QpidBrokerTestCase |
---|
QpidBrokerTestCase.MessageType |
Field Summary | |
---|---|
protected CountDownLatch |
_exceptionReceived
Used to synchronise tearDown() when exceptions are thrown |
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 | |
---|---|
AbstractACLTestCase()
|
Method Summary | |
---|---|
void |
bytesReceived(long count)
|
void |
bytesSent(long count)
|
void |
check403Exception(Throwable t)
Convenience method to validate a JMS exception with a linked AMQConstant.ACCESS_REFUSED 403 error code exception. |
org.apache.qpid.client.AMQConnectionURL |
createConnectionURL(String vhost,
String username,
String password)
Convenience method to build an AMQConnectionURL with the right parameters. |
void |
failoverComplete()
|
String |
getConfig()
Override this to return the name of the configuration XML file. |
Connection |
getConnection(String vhost,
String username,
String password)
Creates a connection to the broker, and sets a connection listener to prevent failover and an exception listener with a CountDownLatch to synchronise in the check403Exception(Throwable) method and allow the
tearDown() method to complete properly. |
List<String> |
getHostList()
Override this to setup external ACL files for virtual hosts. |
boolean |
preFailover(boolean redirect)
|
boolean |
preResubscribe()
|
void |
setUp()
This setup method checks getConfig() and getHostList() to initialise the broker with specific
ACL configurations and then runs an optional per-test setup method, which is simply a method with the same name
as the test, but starting with setUp rather than test . |
void |
setUpACLFile(String virtualHost)
Configures specific ACL files for a virtual host. |
void |
tearDown()
|
void |
writeACLFile(String vhost,
String... rules)
|
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 |
---|
protected CountDownLatch _exceptionReceived
tearDown()
when exceptions are thrown
Constructor Detail |
---|
public AbstractACLTestCase()
Method Detail |
---|
public String getConfig()
public List<String> getHostList()
public void setUp() throws Exception
getConfig()
and getHostList()
to initialise the broker with specific
ACL configurations and then runs an optional per-test setup method, which is simply a method with the same name
as the test, but starting with setUp
rather than test
.
setUp
in class QpidBrokerTestCase
Exception
setUpACLFile(String)
,
QpidBrokerTestCase.setUp()
public void tearDown() throws Exception
tearDown
in class QpidBrokerTestCase
Exception
public void setUpACLFile(String virtualHost) throws IOException, ConfigurationException
setUp
prefix on a method to generate the ACL file. In order, this method looks
for three files:
test
removed and the rest of the text converted to lowercase. For example, the test class and method named
org.apache.qpid.test.AccessExampleTest#testExampleMethod
on the testhost
virtualhost would use
one of the following files:
IOException
ConfigurationException
writeACLFile(String, String...)
public void writeACLFile(String vhost, String... rules) throws ConfigurationException, IOException
ConfigurationException
IOException
public Connection getConnection(String vhost, String username, String password) throws NamingException, JMSException, org.apache.qpid.url.URLSyntaxException
CountDownLatch
to synchronise in the check403Exception(Throwable)
method and allow the
tearDown()
method to complete properly.
NamingException
JMSException
org.apache.qpid.url.URLSyntaxException
public void bytesSent(long count)
bytesSent
in interface org.apache.qpid.jms.ConnectionListener
public void bytesReceived(long count)
bytesReceived
in interface org.apache.qpid.jms.ConnectionListener
public boolean preFailover(boolean redirect)
preFailover
in interface org.apache.qpid.jms.ConnectionListener
public boolean preResubscribe()
preResubscribe
in interface org.apache.qpid.jms.ConnectionListener
public void failoverComplete()
failoverComplete
in interface org.apache.qpid.jms.ConnectionListener
public org.apache.qpid.client.AMQConnectionURL createConnectionURL(String vhost, String username, String password) throws org.apache.qpid.url.URLSyntaxException
AMQConnectionURL
with the right parameters.
org.apache.qpid.url.URLSyntaxException
public void check403Exception(Throwable t) throws Exception
AMQConstant.ACCESS_REFUSED
403 error code exception.
Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |