org.mule.tck.junit4
Class AbstractMuleContextTestCase
java.lang.Object
org.mule.tck.junit4.AbstractMuleTestCase
org.mule.tck.junit4.AbstractMuleContextTestCase
- Direct Known Subclasses:
- AbstractAnnotatedEntrypointResolverTestCase, AbstractAttachmentsTestCase, AbstractComponentTestCase, AbstractConnectorTestCase, AbstractELTestCase, AbstractEncryptionStrategyTestCase, AbstractFlowConstuctTestCase, AbstractIBeansTestCase, AbstractJdbcFunctionalTestCase, AbstractMessageProcessorTestCase, AbstractMessageReceiverTestCase, AbstractMuleClientTestCase, AbstractMuleJmxTestCase, AbstractMuleMessageFactoryTestCase, AbstractObjectFactoryTestCase, AbstractObjectStoreContractTestCase, AbstractPoolingTestCase, AbstractServiceTestCase, AbstractSplitterTestCase, AbstractThreadSafeAccessTestCase, AbstractTransactionQueueManagerTestCase, AbstractTransformerTestCase, AbstractTxThreadAssociationTestCase, AbstractWireFormatTestCase, AggregatorTestCase, AnnotatedEntryPointResolverTestCase, AnnotatedTransformerTestCase, ArrayEntryPointResolverTestCase, AsyncDelegateMessageProcessorTestCase, AsyncInterceptingMessageProcessorTestCase, AsyncRequestReplyRequesterTestCase, AttachmentsPropagationTestCase, AutoConfigurationBuilderTestCase, AutoDeleteOnFileDispatcherReceiverTestCase, AxisEndpointMule2164TestCase, AxisEndpointTestCase, AxisMessageDispatcherTestCase, BadAnnotatedTransformerTestCase, BasicTypeAutoTransformationTestCase, BridgeBuilderTestCase, CachedServletRequestTestCase, CallableEntryPointDiscoveryTestCase, CatchAllStrategiesTestCase, ChainingRouterTestCase, ChoiceRouterTestCase, CollectionMessageSplitterTestCase, CombineCollectionsTransformerTestCase, ComplexExpressionParsingTestCase, ComponentMessageNotificationNoXMLTestCase, ConnectableTestCase, ConnectorFactoryTestCase, ConnectorFactoryTestCase, ConnectorLifecycleTestCase, CorrelationPropertiesExpressionEvaluatorTestCase, CustomExpressionEvaluatorTestCase, CxfInboundMessageProcessorTestCase, CxfOutboundMessageProcessorPayloadTestCase, CxfOutboundMessageProcessorTestCase, CxfSoapEndpointTestCase, CxfWsdlTestCase, DefaultExceptionStrategyTestCase, DefaultJmxSupportAgentTestCase, DefaultLocalMuleClientTestCase, DefaultMuleContextTestCase, DefaultMuleMessageSerializationTestCase, DefaultMuleMessageTestCase, DefaultOutboundRouterCollectionTestCase, DefaultRouterResultsHandlerTestCase, DefaultThreadingProfileTestCase, DefaultThreadPoolFactoryTestCase, DeploymentServiceTestCase, DispatcherPoolTestCase, DispatcherThreadingProfileTestCase, DuplicateRegistrationTestCase, DynamicEndpointParsingTestCase, EjbEndpointTestCase, EndpointFactoryTestCase, EndpointSelectorTestCase, EndpointTransformerTestCase, EndpointURIEndpointBuilderTestCase, EndpointURITestCase, EventGroupTestCase, ExceptionBasedRouterTestCase, ExceptionRollbackTestCase, ExplicitMethodEntryPointResolverTestCase, ExpressionConfigTestCase, ExpressionFilenameParserTestCase, ExpressionFilterTestCase, ExpressionManagerTestCase, ExpressionParsingTestCase, ExpressionTransformerTestCase, FileEndpointTestCase, FileMessageRequesterTestCase, FilterExpressionParserTestCase, FilteringOutboundRouterTestCase, FilterListMessageSplitterRouterTestCase, FirstSuccessfulTestCase, FlickrSearchTestCase, FlickrTestCase, ForeachTestCase, FormTransformerTestCase, FtpEndpointTestCase, FunctionalTestCase, FunctionExpressionEvaluatorTestCase, FutureMessageResultTestCase, GenericConnectorTestCase, GroovyExpressionEvaluatorTestCase, GuiceLifecyceTestCase, HttpBasicAuthenticationFilterTestCase, HttpEndpointTestCase, HttpProxyBuilderTestCase, HttpResponseToStringTestCase, HttpsHandshakeTimingTestCase, IdempotentMessageFilterMule6079TestCase, IdempotentMessageFilterTestCase, IdempotentSecureHashMessageFilterTestCase, IntegrationBeanAnnotationTestCase, InterceptorTestCase, InvocationPropertiesTestCase, InvokerMessageProcessorTestCase, IsJsonFilterTestCase, JarResourceServletTestCase, JaxbAutoTransformerTestCase, JaxbTransformerTestCase, JdbcEndpointTestCase, JdbcMessageDispatcherTestCase, JettyEndpointTestCase, Jms11SupportTestCase, JmsConnectorTestCase, JmsEndpointTestCase, JmsTransformerTestCase, JmxAgentTestCase, JnpEndpointTestCase, JsonAutoTransformerTestCase, JsonAutoTransformerWithMixinsTestCase, JsonCustomTransformerTestCase, JsonCustomTransformerWithMixinsTestCase, JsonExpressionEvaluatorTestCase, JsonPathAnnotatedEntryPointResolverTestCase, JsonSchemaValidationTestCase, JsonStringTestCase, JsonXsltTestCase, JSR250ObjectLifcycleTestCase, JXPathExpressionEvaluatorTestCase, JXPathExtractorTestCase, JXPathFilterTestCase, LegacyEntryPointResolverTestCase, LifecycleNotificationTestCase, ListMessageSplitterTestCase, LogicFiltersTestCase, LookupInjectionTestCase, ManagedStoresTestCase, MapSplitterTestCase, MessageChunkAggregatorTestCase, MessageEnricherTestCase, MessageExpressionEvaluatorTestCase, MessageFilterTestCase, MessageHeaderExpressionEvaluatorTestCase, MessageHeadersExpressionEvaluatorTestCase, MessageHeadersListExpressionEvaluatorTestCase, MessageProcessorExpressionEvaluatorTestCase, MessageProcessorPollingMessageReceiverTestCase, MessagePropertiesContextTestCase, MessagePropertiesTransformerScopesTestCase, MessagePropertyFilterTestCase, MessageSplitterRouterTestCase, MethodHeaderEntryPointResolverTestCase, MimeTypeAwareTransformerTestCase, MuleAgentsTestCase, MuleClientWSDLExternalTestCase, MuleContextExpressionEvaluatorTestCase, MuleCopiedEndpointURITestCase, MuleEndpointURITestCase, MuleEventTestCase, MuleEventWorkTestCase, MuleExpressionEvaluatorTestCase, MuleMessageFactoryUsagePatternsTestCase, MuleObjectCreationTestCase, MuleRegistryHelperTestCase, MuleResourceAdapterTestCase, MuleTransactionConfigTestCase, MuleWorkManagerTestCase, MulticastingRouterTestCase, MVELExpressionLanguageTestCase, NoArgsEntryPointResolverTestCase, ObjectNameHelperTestCase, ObjectToHttpClientMethodRequestTestCase, ObjectToInputStreamTestCase, OutboundMessageRouterTestCase, OutboundRouterTestCase, ParallelXQueryTransformerTestCase, ParallelXsltTransformerTestCase, PayloadExpressionEvaluatorTestCase, PayloadTypeFilterTestCase, ReflectionEntryPointResolverTestCase, RegisteredObjectLifecycleTestCase, RegistryBrokerTestCase, RemoteDispatcherSerializationTestCase, ResequencerTestCase, ResponseMessageProcessorAdapterTestCase, RmiEndpointTestCase, RoundRobinTestCase, RoundRobinXmlSplitterTestCase, SchemaDefaultsTestCase, SequenceRouterTestCase, ServerNotificationsTestCase, ServiceTestCase, SessionPropertiesTestCase, SftpConnectorFactoryTestCase, SimpleClientMessageProcessorBuilderTestCase, SimpleCollectionAggregatorTestCase, SimpleServiceBuilderTestCase, SoapActionTemplateTestCase, SplashScreenTestCase, SpringTransactionFactoryTestCase, SpringTransactionFactoryTestCase, SslEndpointTestCase, SslHandshakeTimingTestCase, StartableCompositeMessageSourceTestCase, StaticRecipientListRouterTestCase, StringExpressionEvaluatorTestCase, TcpEndpointTestCase, TemplateParserTestCase, TextFileStoreTestCase, TransactionNotificationsTestCase, TransformDiscoveryTestCase, TransformerCachingTestCase, TransformerDiscoveryTestCase, TransientRegistryTestCase, UntilSuccessfulTestCase, ValidatorBuilderTestCase, VariableEnricherEvaluatorTestCase, VMEndpointTestCase, WebServiceMessageProcessorBuilderTestCase, WireTapTestCase, WSProxyBuilderTestCase, WsProxyConfigurationIssuesTestCase, XAResourceManagerTestCase, XmlMessageSplitterTestCase, XmlMuleMessageTransformersTestCase, XmppEndpointTestCase, XPathAnnotatedEntryPointResolverTestCase, XPathExtractorTestCase
public abstract class AbstractMuleContextTestCase
- extends AbstractMuleTestCase
Extends AbstractMuleTestCase
providing access to a MuleContext
instance and tools for manage it.
Method Summary |
protected void |
addBuilders(List<ConfigurationBuilder> builders)
|
protected void |
configureMuleContext(MuleContextBuilder contextBuilder)
Override this method to set properties of the MuleContextBuilder before it is
used to create the MuleContext. |
protected MuleContext |
createMuleContext()
|
protected
|
createObject(Class<T> clazz)
Create an object of instance clazz . |
protected
|
createObject(Class<T> clazz,
Object... args)
Create an object of instance clazz . |
static void |
disposeContext()
|
void |
disposeContextPerTest()
|
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 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 disposeContextPerTest() . |
protected ConfigurationBuilder |
getBuilder()
|
protected String |
getConfigurationResources()
|
SensingNullMessageProcessor |
getSensingNullMessageProcessor()
|
protected Properties |
getStartUpProperties()
|
static TestConnector |
getTestConnector()
|
static MuleEvent |
getTestEvent(Object data)
|
static MuleEvent |
getTestEvent(Object data,
FlowConstruct service)
|
static MuleEvent |
getTestEvent(Object data,
FlowConstruct service,
MessageExchangePattern mep)
|
static MuleEvent |
getTestEvent(Object data,
InboundEndpoint endpoint)
|
static MuleEvent |
getTestEvent(Object data,
MessageExchangePattern mep)
|
static MuleEvent |
getTestEvent(Object data,
MuleSession session)
|
static MuleEvent |
getTestEvent(Object data,
Service service,
InboundEndpoint endpoint)
|
static MuleEventContext |
getTestEventContext(Object data)
|
static MuleEventContext |
getTestEventContext(Object data,
MessageExchangePattern mep)
|
static MuleEvent |
getTestEventUsingFlow(Object data)
|
static InboundEndpoint |
getTestInboundEndpoint(MessageExchangePattern mep)
|
static InboundEndpoint |
getTestInboundEndpoint(String name)
|
static InboundEndpoint |
getTestInboundEndpoint(String name,
List<Transformer> transformers)
|
static InboundEndpoint |
getTestInboundEndpoint(String name,
String uri)
|
static InboundEndpoint |
getTestInboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties,
Connector connector)
|
static OutboundEndpoint |
getTestOutboundEndpoint(String name)
|
static OutboundEndpoint |
getTestOutboundEndpoint(String name,
List<Transformer> transformers)
|
static OutboundEndpoint |
getTestOutboundEndpoint(String name,
String uri)
|
static OutboundEndpoint |
getTestOutboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties)
|
static OutboundEndpoint |
getTestOutboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties,
Connector connector)
|
static Service |
getTestService()
|
static Service |
getTestService(String name,
Class<?> clazz)
|
static Service |
getTestService(String name,
Class<?> clazz,
Map<?,?> props)
|
static MuleSession |
getTestSession(Service service,
MuleContext context)
|
static InboundEndpoint |
getTestTransactedInboundEndpoint(MessageExchangePattern mep)
|
static Transformer |
getTestTransformer()
|
TriggerableMessageSource |
getTriggerableMessageSource()
|
TriggerableMessageSource |
getTriggerableMessageSource(MessageProcessor listener)
|
protected void |
initialiseObject(Object o)
A convenience method that will register an object in the registry using its hashcode as the key. |
protected boolean |
isDisposeContextPerClass()
|
protected boolean |
isGracefulShutdown()
Determines if the test case should perform graceful shutdown or not. |
protected boolean |
isStartContext()
|
protected void |
setDisposeContextPerClass(boolean val)
|
protected void |
setStartContext(boolean startContext)
|
void |
setUpMuleContext()
|
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 |
IGNORED_DOT_MULE_DIRS
public static final String[] IGNORED_DOT_MULE_DIRS
- Top-level directories under
.mule
which are not deleted on each
test case recycle. This is required, e.g. to play nice with transaction manager
recovery service object store.
CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
public static final String CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
- If the annotations module is on the classpath, also enable annotations config builder
- See Also:
- Constant Field Values
muleContext
protected static MuleContext muleContext
- The context used to run this test. Context will be created per class
or per method depending on
disposeContextPerClass
.
The context will be started only when startContext
is true.
TEST_MESSAGE
public static final String TEST_MESSAGE
- Convenient test message for unit testing.
- See Also:
- Constant Field Values
LOCK_TIMEOUT
public static final long LOCK_TIMEOUT
- Default timeout for multithreaded tests (using CountDownLatch, WaitableBoolean, etc.),
in milliseconds. The higher this value, the more reliable the test will be, so it
should be set high for Continuous Integration. However, this can waste time during
day-to-day development cycles, so you may want to temporarily lower it while debugging.
- See Also:
- Constant Field Values
RECEIVE_TIMEOUT
public static final int RECEIVE_TIMEOUT
- Default timeout for waiting for responses
- See Also:
- Constant Field Values
callbackCalled
protected Latch callbackCalled
- Use this as a semaphore to the unit test to indicate when a callback has successfully been called.
AbstractMuleContextTestCase
public AbstractMuleContextTestCase()
isDisposeContextPerClass
protected boolean isDisposeContextPerClass()
setDisposeContextPerClass
protected void setDisposeContextPerClass(boolean val)
setUpMuleContext
public final void setUpMuleContext()
throws Exception
- Throws:
Exception
doSetUp
protected void doSetUp()
throws Exception
- Enables the adding of extra behavior on the set up stage of a test right
after the creation of the mule context in
setUpMuleContext()
.
Under normal circumstances this method could be replaced by a
@Before
annotated method.
- Throws:
Exception
- if something fails that should halt the test case
createMuleContext
protected MuleContext createMuleContext()
throws Exception
- Throws:
Exception
addBuilders
protected void addBuilders(List<ConfigurationBuilder> builders)
configureMuleContext
protected void configureMuleContext(MuleContextBuilder contextBuilder)
- Override this method to set properties of the MuleContextBuilder before it is
used to create the MuleContext.
getBuilder
protected ConfigurationBuilder getBuilder()
throws Exception
- Throws:
Exception
getConfigurationResources
protected String getConfigurationResources()
getStartUpProperties
protected Properties getStartUpProperties()
disposeContextPerTest
public final void disposeContextPerTest()
throws Exception
- Throws:
Exception
disposeContext
public static void disposeContext()
doTearDown
protected void doTearDown()
throws Exception
- Enables the adding of extra behavior on the tear down stage of a test
before the mule context is disposed in
disposeContextPerTest()
.
Under normal circumstances this method could be replace with a
@After
annotated method.
- Throws:
Exception
- if something fails that should halt the testcase
getTestInboundEndpoint
public static InboundEndpoint getTestInboundEndpoint(String name)
throws Exception
- Throws:
Exception
getTestOutboundEndpoint
public static OutboundEndpoint getTestOutboundEndpoint(String name)
throws Exception
- Throws:
Exception
getTestInboundEndpoint
public static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep)
throws Exception
- Throws:
Exception
getTestTransactedInboundEndpoint
public static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep)
throws Exception
- Throws:
Exception
getTestInboundEndpoint
public static InboundEndpoint getTestInboundEndpoint(String name,
String uri)
throws Exception
- Throws:
Exception
getTestOutboundEndpoint
public static OutboundEndpoint getTestOutboundEndpoint(String name,
String uri)
throws Exception
- Throws:
Exception
getTestInboundEndpoint
public static InboundEndpoint getTestInboundEndpoint(String name,
List<Transformer> transformers)
throws Exception
- Throws:
Exception
getTestOutboundEndpoint
public static OutboundEndpoint getTestOutboundEndpoint(String name,
List<Transformer> transformers)
throws Exception
- Throws:
Exception
getTestInboundEndpoint
public static InboundEndpoint getTestInboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties,
Connector connector)
throws Exception
- Throws:
Exception
getTestOutboundEndpoint
public static OutboundEndpoint getTestOutboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties)
throws Exception
- Throws:
Exception
getTestOutboundEndpoint
public static OutboundEndpoint getTestOutboundEndpoint(String name,
String uri,
List<Transformer> transformers,
Filter filter,
Map<Object,Object> properties,
Connector connector)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
FlowConstruct service)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
FlowConstruct service,
MessageExchangePattern mep)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data)
throws Exception
- Throws:
Exception
getTestEventUsingFlow
public static MuleEvent getTestEventUsingFlow(Object data)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
MessageExchangePattern mep)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
MuleSession session)
throws Exception
- Throws:
Exception
getTestEventContext
public static MuleEventContext getTestEventContext(Object data)
throws Exception
- Throws:
Exception
getTestEventContext
public static MuleEventContext getTestEventContext(Object data,
MessageExchangePattern mep)
throws Exception
- Throws:
Exception
getTestTransformer
public static Transformer getTestTransformer()
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
InboundEndpoint endpoint)
throws Exception
- Throws:
Exception
getTestEvent
public static MuleEvent getTestEvent(Object data,
Service service,
InboundEndpoint endpoint)
throws Exception
- Throws:
Exception
getTestSession
public static MuleSession getTestSession(Service service,
MuleContext context)
getTestConnector
public static TestConnector getTestConnector()
throws Exception
- Throws:
Exception
getTestService
public static Service getTestService()
throws Exception
- Throws:
Exception
getTestService
public static Service getTestService(String name,
Class<?> clazz)
throws Exception
- Throws:
Exception
getTestService
public static Service getTestService(String name,
Class<?> clazz,
Map<?,?> props)
throws Exception
- Throws:
Exception
isStartContext
protected boolean isStartContext()
setStartContext
protected void setStartContext(boolean startContext)
isGracefulShutdown
protected boolean isGracefulShutdown()
- Determines if the test case should perform graceful shutdown or not.
Default is false so that tests run more quickly.
createObject
protected <T> T createObject(Class<T> clazz)
throws Exception
- Create an object of instance
clazz
. It will then register the object with the registry so that any
dependencies are injected and then the object will be initialised.
Note that if the object needs to be configured with additional state that cannot be passed into the constructor you should
create an instance first set any additional data on the object then call initialiseObject(Object)
.
- Type Parameters:
T
- Object of this type will be returned- Parameters:
clazz
- the class to create an instance of.
- Returns:
- an initialised instance of
class
- Throws:
Exception
- if there is a problem creating or initializing the object
createObject
protected <T> T createObject(Class<T> clazz,
Object... args)
throws Exception
- Create an object of instance
clazz
. It will then register the object with the registry so that any
dependencies are injected and then the object will be initialised.
Note that if the object needs to be configured with additional state that cannot be passed into the constructor you should
create an instance first set any additional data on the object then call initialiseObject(Object)
.
- Type Parameters:
T
- Object of this type will be returned- Parameters:
clazz
- the class to create an instance of.args
- constructor parameters
- Returns:
- an initialised instance of
class
- Throws:
Exception
- if there is a problem creating or initializing the object
initialiseObject
protected void initialiseObject(Object o)
throws RegistrationException
- A convenience method that will register an object in the registry using its hashcode as the key. This will cause the object
to have any objects injected and lifecycle methods called. Note that the object lifecycle will be called to the same current
lifecycle as the MuleContext
- Parameters:
o
- the object to register and initialise it
- Throws:
RegistrationException
getSensingNullMessageProcessor
public SensingNullMessageProcessor getSensingNullMessageProcessor()
getTriggerableMessageSource
public TriggerableMessageSource getTriggerableMessageSource(MessageProcessor listener)
getTriggerableMessageSource
public TriggerableMessageSource getTriggerableMessageSource()
Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.