|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.mule.tck.junit4.AbstractMuleTestCase org.mule.tck.junit4.AbstractMuleContextTestCase org.mule.tck.junit4.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)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)integration/<provider_name>/connector-<event_flow_config_name>
The 'provider_name' is obtained from the 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
|
Field Summary | |
---|---|
static String |
BROADCAST_TOPIC_ENDPOINT_KEY
|
static String |
DEFAULT_INPUT_MESSAGE
|
static String |
DEFAULT_OUTPUT_MESSAGE
|
static String |
INBOUND_ENDPOINT_KEY
|
protected JmsVendorConfiguration |
jmsConfig
|
protected static Log |
logger
|
static String |
MIDDLE_ENDPOINT_KEY
|
static String |
MIDDLE2_ENDPOINT_KEY
|
static String |
MIDDLE3_ENDPOINT_KEY
|
static String |
OUTBOUND_ENDPOINT_KEY
|
protected boolean |
purgeQueuesOnPreSetUp
|
protected boolean |
purgeQueuesOnTearDown
|
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.junit4.AbstractMuleContextTestCase |
---|
callbackCalled, CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, IGNORED_DOT_MULE_DIRS, LOCK_TIMEOUT, muleContext, RECEIVE_TIMEOUT, TEST_MESSAGE |
Fields inherited from class org.mule.tck.junit4.AbstractMuleTestCase |
---|
DEFAULT_TEST_TIMEOUT_SECS, globalTimeout, name, TEST_TIMEOUT_SYSTEM_PROPERTY |
Constructor Summary | |
---|---|
AbstractJmsFunctionalTestCase()
|
|
AbstractJmsFunctionalTestCase(JmsVendorConfiguration config)
|
Method Summary | |
---|---|
protected void |
checkConfig()
Ensures that the JmsVendorConfiguration instance is not null
if it is an IllegalStateException will be thrown |
protected Destination |
createInputDestination(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 Destination |
createOutputDestination(Session session,
AbstractJmsFunctionalTestCase.Scenario scenario)
By default this will create a Queue, override to create a topic |
protected void |
dispatchMessage()
|
protected void |
dispatchMessage(Object payload)
|
protected void |
dispatchMessage(Object payload,
Properties props)
|
protected void |
doSetUp()
Enables the adding of extra behavior on the set up stage of a test right after the creation of the mule context in AbstractMuleContextTestCase.setUpMuleContext() . |
protected void |
doTearDown()
Enables the adding of extra behavior on the tear down stage of a test before the mule context is disposed in AbstractMuleContextTestCase.disposeContextPerTest() . |
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 Connection |
getConnection(boolean topic,
boolean xa)
Create a connection factory for the Jms profider being tested. |
protected String |
getDeadLetterQueueName()
The test dead letter queue name. |
protected String |
getInboundEndpoint()
Returns the getInboundQueueName() in the form of an endpoint URI i.e. |
protected String |
getInboundQueueName()
The test inbound queue name. |
JmsVendorConfiguration |
getJmsConfig()
Returns the JmsVendorConfiguration implemetation to be used
with this test |
protected String |
getOutboundEndpoint()
Returns the getOutboundQueueName() in the form of an endpoint URI i.e. |
protected String |
getOutboundQueueName()
The test outbound queue name. |
protected long |
getSmallTimeout()
Timeout in milliseconds used when checking that a message is NOT present. |
protected 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 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(String destination)
Purge destinations for clean test setup. |
protected void |
purgeTopic(String destination,
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 |
Message |
receive(AbstractJmsFunctionalTestCase.Scenario scenario)
|
protected MuleMessage |
receiveMessage()
|
protected MuleMessage |
receiveMessage(byte[] expected)
|
protected MuleMessage |
receiveMessage(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)
|
Methods inherited from class org.mule.tck.junit4.FunctionalTestCase |
---|
clearFlowAssertions, getComponent, getComponent, getConfigResources, getFlowConstruct, getFunctionalTestComponent, loadResource, loadResourceAsString, stopFlowConstruct, testFlow, testFlow |
Methods inherited from class org.mule.tck.junit4.AbstractMuleTestCase |
---|
clearExcludedFlag, clearRequestContext, createTestTimeoutRule, getTestHeader, getTestTimeoutSecs, getTimeoutSystemProperty, initializeMuleTest, isDisabledInThisEnvironment, isDisabledInThisEnvironment, isExcluded, isFailOnTimeout, isOffline, isTestIncludedInExclusionFile |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_INPUT_MESSAGE
public static final String DEFAULT_OUTPUT_MESSAGE
public static final String INBOUND_ENDPOINT_KEY
public static final String OUTBOUND_ENDPOINT_KEY
public static final String MIDDLE_ENDPOINT_KEY
public static final String MIDDLE2_ENDPOINT_KEY
public static final String MIDDLE3_ENDPOINT_KEY
public static final 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
protected boolean purgeQueuesOnPreSetUp
protected boolean purgeQueuesOnTearDown
Constructor Detail |
---|
public AbstractJmsFunctionalTestCase()
public AbstractJmsFunctionalTestCase(JmsVendorConfiguration config)
Method Detail |
---|
public static 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.
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'protected Properties getStartUpProperties()
JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)JmsVendorConfiguration
implementation)
getStartUpProperties
in class AbstractMuleContextTestCase
protected ConfigurationBuilder getBuilder() throws 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
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 Connection getConnection(boolean topic, boolean xa) throws 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
Exception
protected final String getInboundEndpoint()
getInboundQueueName()
in the form of an endpoint URI i.e.
jms://in.
This calls through to JmsVendorConfiguration.getInboundEndpoint()
protected final String getOutboundEndpoint()
getOutboundQueueName()
in the form of an endpoint URI i.e.
jms://out.
This calls through to JmsVendorConfiguration.getOutboundEndpoint()
protected final String getInboundQueueName()
JmsVendorConfiguration.getInboundDestinationName()
protected final String getDeadLetterQueueName()
JmsVendorConfiguration.getDeadLetterDestinationName()
protected final 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 Exception
Exception
protected void dispatchMessage(Object payload) throws Exception
Exception
protected void dispatchMessage(Object payload, Properties props) throws Exception
Exception
protected MuleMessage receiveMessage() throws Exception
Exception
protected MuleMessage receiveMessage(Object expected) throws Exception
Exception
protected MuleMessage receiveMessage(byte[] expected) throws Exception
Exception
public void runAsynchronousDispatching() throws Exception
Exception
protected void doSetUp() throws Exception
AbstractMuleContextTestCase
AbstractMuleContextTestCase.setUpMuleContext()
.
Under normal circumstances this method could be replaced by a
@Before
annotated method.
doSetUp
in class AbstractMuleContextTestCase
Exception
- if something fails that should halt the test caseprotected void doTearDown() throws Exception
AbstractMuleContextTestCase
AbstractMuleContextTestCase.disposeContextPerTest()
.
Under normal circumstances this method could be replace with a
@After
annotated method.
doTearDown
in class AbstractMuleContextTestCase
Exception
- if something fails that should halt the testcaseprotected MuleClient getClient()
public void send(AbstractJmsFunctionalTestCase.Scenario scenario) throws Exception
Exception
protected Destination createInputDestination(Session session, AbstractJmsFunctionalTestCase.Scenario scenario) throws JMSException
JMSException
protected Destination createOutputDestination(Session session, AbstractJmsFunctionalTestCase.Scenario scenario) throws JMSException
JMSException
public Message receive(AbstractJmsFunctionalTestCase.Scenario scenario) throws Exception
Exception
protected void purge(String destination) throws JMSException
destination
- destination name without any protocol specifics
JMSException
protected void purgeTopics() throws Exception
Exception
protected void purgeTopic(String destination, String topic) throws Exception
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 |