|
||||||||||
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.mule.tck.AbstractMuleTestCase
org.mule.tck.FunctionalTestCase
org.mule.transport.jms.integration.AbstractJmsFunctionalTestCase
public abstract class AbstractJmsFunctionalTestCase
This is the base class for all integration tests that are part of the JMS integration test suite. This is
a suite that can be run on multiple JMS providers since all configuration for the provider is abstracted into
a single class which implements JmsVendorConfiguration
. The implementation
of this class is loaded by looking for the classname in a properties file called 'jms-vendor-configs.txt'in the root
classpath.
AbstractJmsFunctionalTestCase.Scenario
. Scenarios can be combined to create
a test. The default scenarios are usually sufficient to create a test. These are:
AbstractJmsFunctionalTestCase.ScenarioReceive
AbstractJmsFunctionalTestCase.ScenarioNotReceive
AbstractJmsFunctionalTestCase.ScenarioCommit
AbstractJmsFunctionalTestCase.ScenarioRollback
AbstractJmsFunctionalTestCase.NonTransactedScenario
This object will also add properties to the registry that can be accessed within XML config files using placeholders.
The following properties are made available -
JmsVendorConfiguration
implementation)
integration/<provider_name>/connector-<event_flow_config_name>
The 'provider_name' is obtained from the {@link org.mule.transport.jms.integration.JmsVendorConfiguration} implementation.
In order to know what objects to define in the 'connector-' files you must copy the connector files from the ActiveMQ (default)
test suite and configure the objects to match the configuration in the ActiveMQ tests. Note that the object names must
be consistently the same for things to work.
Nested Class Summary | |
---|---|
protected class |
AbstractJmsFunctionalTestCase.AbstractScenario
|
protected class |
AbstractJmsFunctionalTestCase.NonTransactedScenario
|
protected static interface |
AbstractJmsFunctionalTestCase.Scenario
|
protected class |
AbstractJmsFunctionalTestCase.ScenarioCommit
|
protected class |
AbstractJmsFunctionalTestCase.ScenarioNotReceive
|
protected class |
AbstractJmsFunctionalTestCase.ScenarioReceive
|
protected class |
AbstractJmsFunctionalTestCase.ScenarioRollback
|
Nested classes/interfaces inherited from class org.mule.tck.AbstractMuleTestCase |
---|
AbstractMuleTestCase.TestInfo |
Field Summary | |
---|---|
static java.lang.String |
BROADCAST_TOPIC_ENDPOINT_KEY
|
static java.lang.String |
DEFAULT_INPUT_MESSAGE
|
static java.lang.String |
DEFAULT_OUTPUT_MESSAGE
|
static java.lang.String |
INBOUND_ENDPOINT_KEY
|
protected JmsVendorConfiguration |
jmsConfig
|
protected static Log |
logger
|
static java.lang.String |
MIDDLE_ENDPOINT_KEY
|
static java.lang.String |
MIDDLE2_ENDPOINT_KEY
|
static java.lang.String |
MIDDLE3_ENDPOINT_KEY
|
static java.lang.String |
OUTBOUND_ENDPOINT_KEY
|
protected AbstractJmsFunctionalTestCase.Scenario |
scenarioCommit
|
protected AbstractJmsFunctionalTestCase.Scenario |
scenarioNotReceive
|
protected AbstractJmsFunctionalTestCase.Scenario |
scenarioNoTx
|
protected AbstractJmsFunctionalTestCase.Scenario |
scenarioReceive
|
protected AbstractJmsFunctionalTestCase.Scenario |
scenarioRollback
|
Fields inherited from class org.mule.tck.AbstractMuleTestCase |
---|
callbackCalled, CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, DEFAULT_MULE_TEST_TIMEOUT_SECS, IGNORED_DOT_MULE_DIRS, LOCK_TIMEOUT, muleContext, numPorts, ports, PROPERTY_MULE_TEST_TIMEOUT, RECEIVE_TIMEOUT, TEST_MESSAGE, testTimeoutSecs |
Constructor Summary | |
---|---|
AbstractJmsFunctionalTestCase()
|
|
AbstractJmsFunctionalTestCase(JmsVendorConfiguration config)
|
Method Summary | |
---|---|
void |
after()
Since we are using JUnit 4, but the Mule Test Framework assumes JUnit 3, we need to explicitly call the setUp and tearDown methods |
void |
before()
Since we are using JUnit 4, but the Mule Test Framework assumes JUnit 3, we need to explicitly call the setUp and tearDown methods |
protected void |
checkConfig()
Ensures that the JmsVendorConfiguration instance is not null
if it is an IllegalStateException will be thrown |
protected javax.jms.Destination |
createInputDestination(javax.jms.Session session,
AbstractJmsFunctionalTestCase.Scenario scenario)
By default this will create a Queue, override to create a topic |
protected JmsVendorConfiguration |
createJmsConfig()
Overriding classes must override this or inject this object. |
protected javax.jms.Destination |
createOutputDestination(javax.jms.Session session,
AbstractJmsFunctionalTestCase.Scenario scenario)
By default this will create a Queue, override to create a topic |
protected void |
dispatchMessage()
|
protected void |
dispatchMessage(java.lang.Object payload)
|
protected void |
dispatchMessage(java.lang.Object payload,
java.util.Properties props)
|
protected void |
doSetUp()
Exactly the same a AbstractMuleTestCase.setUp() in normal JUnit test cases. |
protected void |
doTearDown()
Exactly the same a AbstractMuleTestCase.tearDown() in normal JUnit test cases. |
protected ConfigurationBuilder |
getBuilder()
This creates a SpringXmlConfigurationBuilder as expected but also figures out
which 'connector' configuration file to load with the event flow configuration (obtained from the overriding \
class which implements FunctionalTestCase.getConfigResources() ). |
protected MuleClient |
getClient()
|
protected javax.jms.Connection |
getConnection(boolean topic,
boolean xa)
Create a connection factory for the Jms profider being tested. |
protected java.lang.String |
getDeadLetterQueueName()
The test dead letter queue name. |
protected java.lang.String |
getInboundEndpoint()
Returns the getInboundQueueName() in the form of an endpoint URI i.e. |
protected java.lang.String |
getInboundQueueName()
The test inbound queue name. |
JmsVendorConfiguration |
getJmsConfig()
Returns the JmsVendorConfiguration implemetation to be used
with this test |
protected java.lang.String |
getOutboundEndpoint()
Returns the getOutboundQueueName() in the form of an endpoint URI i.e. |
protected java.lang.String |
getOutboundQueueName()
The test outbound queue name. |
protected long |
getSmallTimeout()
Timeout in milliseconds used when checking that a message is NOT present. |
protected java.util.Properties |
getStartUpProperties()
Adds the following properties to the registry so that the Xml configuration files can reference them. |
protected long |
getTimeout()
The timeout in milliseconds used when waiting for a message to arrive. |
boolean |
isMultipleProviders()
|
static java.util.Collection |
jmsProviderConfigs()
Finds the JmsVendorConfiguration instances to test with by looking
in a file called "jms-vendor-configs.txt" which contains one or more fuly qualified classnames of
JmsVendorConfiguration instances to load. |
protected void |
purge(java.lang.String destination)
Purge destinations for clean test setup. |
protected void |
purgeTopic(java.lang.String destination,
java.lang.String topic)
Clear the specified topic |
protected void |
purgeTopics()
Purge all of the topics which are created during testing TODO DZ: we should be getting this list dynamically, and only calling them for the topic tests |
javax.jms.Message |
receive(AbstractJmsFunctionalTestCase.Scenario scenario)
|
protected MuleMessage |
receiveMessage()
|
protected MuleMessage |
receiveMessage(byte[] expected)
|
protected MuleMessage |
receiveMessage(java.lang.Object expected)
|
void |
runAsynchronousDispatching()
|
void |
send(AbstractJmsFunctionalTestCase.Scenario scenario)
|
void |
setJmsConfig(JmsVendorConfiguration jmsConfig)
Sets the JmsVendorConfiguration implemetation to be used
with this test |
void |
setMultipleProviders(boolean multipleProviders)
|
protected void |
suitePreSetUp()
Run before any testcase setup. |
Methods inherited from class org.mule.tck.FunctionalTestCase |
---|
getComponent, getComponent, getConfigResources, getFunctionalTestComponent, loadResource, loadResourceAsString |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, runTest, 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, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_INPUT_MESSAGE
public static final java.lang.String DEFAULT_OUTPUT_MESSAGE
public static final java.lang.String INBOUND_ENDPOINT_KEY
public static final java.lang.String OUTBOUND_ENDPOINT_KEY
public static final java.lang.String MIDDLE_ENDPOINT_KEY
public static final java.lang.String MIDDLE2_ENDPOINT_KEY
public static final java.lang.String MIDDLE3_ENDPOINT_KEY
public static final java.lang.String BROADCAST_TOPIC_ENDPOINT_KEY
protected static final Log logger
protected JmsVendorConfiguration jmsConfig
protected AbstractJmsFunctionalTestCase.Scenario scenarioNoTx
protected AbstractJmsFunctionalTestCase.Scenario scenarioCommit
protected AbstractJmsFunctionalTestCase.Scenario scenarioRollback
protected AbstractJmsFunctionalTestCase.Scenario scenarioNotReceive
protected AbstractJmsFunctionalTestCase.Scenario scenarioReceive
Constructor Detail |
---|
public AbstractJmsFunctionalTestCase()
public AbstractJmsFunctionalTestCase(JmsVendorConfiguration config)
Method Detail |
---|
public static java.util.Collection jmsProviderConfigs()
JmsVendorConfiguration
instances to test with by looking
in a file called "jms-vendor-configs.txt" which contains one or more fuly qualified classnames of
JmsVendorConfiguration
instances to load.
JmsVendorConfiguration
instance to test
against.
java.lang.Exception
- if the 'jms-vendor-configs.txt' cannot be loaded or the classes defined within that file
are not on the classpath
TODO this method can return more than one provider, but our test class can only handle one at a time
IMPORTANT: Only set one class in 'jms-vendor-configs.txt'public void before() throws java.lang.Exception
java.lang.Exception
- if, well, anything goes wrongpublic void after() throws java.lang.Exception
java.lang.Exception
- if, well, anything goes wrongprotected void suitePreSetUp() throws java.lang.Exception
AbstractMuleTestCase
suitePreSetUp
in class AbstractMuleTestCase
java.lang.Exception
protected java.util.Properties getStartUpProperties()
JmsVendorConfiguration
implementation)
getStartUpProperties
in class AbstractMuleTestCase
protected ConfigurationBuilder getBuilder() throws java.lang.Exception
SpringXmlConfigurationBuilder
as expected but also figures out
which 'connector' configuration file to load with the event flow configuration (obtained from the overriding \
class which implements FunctionalTestCase.getConfigResources()
).
getBuilder
in class FunctionalTestCase
java.lang.Exception
public final JmsVendorConfiguration getJmsConfig()
JmsVendorConfiguration
implemetation to be used
with this test
public final void setJmsConfig(JmsVendorConfiguration jmsConfig)
JmsVendorConfiguration
implemetation to be used
with this test
jmsConfig
- the settings for this testprotected JmsVendorConfiguration createJmsConfig()
JmsVendorConfiguration
instance to be used by this test.
protected final javax.jms.Connection getConnection(boolean topic, boolean xa) throws java.lang.Exception
JmsVendorConfiguration.getConnection(boolean, boolean)
topic
- whether to use a topic or queue connection factory, for 1.1
implementations this proerty can be ignoredxa
- whether to create an XA connection factory
java.lang.Exception
protected final java.lang.String getInboundEndpoint()
getInboundQueueName()
in the form of an endpoint URI i.e.
jms://in.
This calls through to JmsVendorConfiguration.getInboundEndpoint()
protected final java.lang.String getOutboundEndpoint()
getOutboundQueueName()
in the form of an endpoint URI i.e.
jms://out.
This calls through to JmsVendorConfiguration.getOutboundEndpoint()
protected final java.lang.String getInboundQueueName()
JmsVendorConfiguration.getInboundDestinationName()
protected final java.lang.String getDeadLetterQueueName()
JmsVendorConfiguration.getDeadLetterDestinationName()
protected final java.lang.String getOutboundQueueName()
JmsVendorConfiguration.getOutboundDestinationName()
protected final long getSmallTimeout()
JmsVendorConfiguration.getSmallTimeout()
protected final long getTimeout()
JmsVendorConfiguration.getTimeout()
protected void checkConfig()
JmsVendorConfiguration
instance is not null
if it is an IllegalStateException
will be thrown
protected void dispatchMessage() throws java.lang.Exception
java.lang.Exception
protected void dispatchMessage(java.lang.Object payload) throws java.lang.Exception
java.lang.Exception
protected void dispatchMessage(java.lang.Object payload, java.util.Properties props) throws java.lang.Exception
java.lang.Exception
protected MuleMessage receiveMessage() throws java.lang.Exception
java.lang.Exception
protected MuleMessage receiveMessage(java.lang.Object expected) throws java.lang.Exception
java.lang.Exception
protected MuleMessage receiveMessage(byte[] expected) throws java.lang.Exception
java.lang.Exception
public void runAsynchronousDispatching() throws java.lang.Exception
java.lang.Exception
protected void doSetUp() throws java.lang.Exception
AbstractMuleTestCase
AbstractMuleTestCase.setUp()
in normal JUnit test cases. this is called before a test
method has been called.
doSetUp
in class AbstractMuleTestCase
java.lang.Exception
- if something fails that should halt the testcaseprotected void doTearDown() throws java.lang.Exception
AbstractMuleTestCase
AbstractMuleTestCase.tearDown()
in normal JUnit test cases. this is called after a test
method has been called.
doTearDown
in class AbstractMuleTestCase
java.lang.Exception
- if something fails that should halt the testcaseprotected MuleClient getClient()
public void send(AbstractJmsFunctionalTestCase.Scenario scenario) throws java.lang.Exception
java.lang.Exception
protected javax.jms.Destination createInputDestination(javax.jms.Session session, AbstractJmsFunctionalTestCase.Scenario scenario) throws javax.jms.JMSException
session
- scenario
-
javax.jms.JMSException
protected javax.jms.Destination createOutputDestination(javax.jms.Session session, AbstractJmsFunctionalTestCase.Scenario scenario) throws javax.jms.JMSException
session
- scenario
-
javax.jms.JMSException
public javax.jms.Message receive(AbstractJmsFunctionalTestCase.Scenario scenario) throws java.lang.Exception
java.lang.Exception
protected void purge(java.lang.String destination) throws javax.jms.JMSException
suitePreSetUp()
and AbstractMuleTestCase.suitePostTearDown()
, with proper super calls.
destination
- destination name without any protocol specifics
javax.jms.JMSException
suitePreSetUp()
,
AbstractMuleTestCase.suitePostTearDown()
protected void purgeTopics() throws java.lang.Exception
java.lang.Exception
protected void purgeTopic(java.lang.String destination, java.lang.String topic) throws java.lang.Exception
destination
- topic
-
java.lang.Exception
public boolean isMultipleProviders()
public void setMultipleProviders(boolean multipleProviders)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |