org.mule.tck
Class AbstractMuleTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.mule.tck.AbstractMuleTestCase
All Implemented Interfaces:
junit.framework.Test, TestCaseWatchdogTimeoutHandler
Direct Known Subclasses:
AbstractAnnotatedEntrypointResolverTestCase, AbstractComponentTestCase, AbstractConnectorTestCase, AbstractEncryptionStrategyTestCase, AbstractFlowConstuctTestCase, AbstractIBeansTestCase, AbstractJdbcFunctionalTestCase, AbstractMessageProcessorTestCase, AbstractMessageReceiverTestCase, AbstractMuleClientTestCase, AbstractMuleJmxTestCase, AbstractMuleMessageFactoryTestCase, AbstractObjectFactoryTestCase, AbstractObjectStoreContractTestCase, AbstractPoolingTestCase, AbstractPreProcessorTestCase, AbstractRegistryTestCase, AbstractSchemaValidationTestCase, AbstractServiceTestCase, AbstractSplitterTestCase, AbstractThreadSafeAccessTestCase, AbstractTransactionQueueManagerTestCase, AbstractTransformerTestCase, AbstractTxThreadAssociationTestCase, AbstractWireFormatTestCase, AggregatorTestCase, AnnotatedEntryPointResolverTestCase, AnnotatedTransformerTestCase, ApplicationContextsTestCase, ArrayEntryPointResolverTestCase, ArrayUtilsTestCase, AsyncInterceptingMessageProcessorTestCase, AsyncRequestReplyRequesterTestCase, AtomEndpointTestCase, AttachmentsExpressionEvaluatorTestCase, AttachmentsPropagationTestCase, AutoConfigurationBuilderTestCase, AutoDeleteOnFileDispatcherReceiverTestCase, AxisEndpointMule2164TestCase, AxisEndpointTestCase, AxisMessageDispatcherTestCase, BadAnnotatedTransformerTestCase, BatchConstraintTestCase, BeanUtilsTestCase, BridgeBuilderTestCase, CallableEntryPointDiscoveryTestCase, CaseInsensitiveHashMapTestCase, CatchAllStrategiesTestCase, ChainingRouterTestCase, ChoiceRouterTestCase, ClasspathScannerTestCase, ClassUtilsTestCase, CollectionTransformerTestCase, CollectionUtilsTestCase, ComplexExpressionParsingTestCase, ComponentDefinitionParserTestCase, ComponentMessageNotificationNoXMLTestCase, CompressionTestCase, ConnectableTestCase, ConnectorFactoryTestCase, ConnectorFactoryTestCase, ConnectorLifecycleTestCase, CookieHelperTestCase, CountersTestCase, CustomExpressionEvaluatorTestCase, CxfInboundMessageProcessorTestCase, CxfOutboundMessageProcessorPayloadTestCase, CxfOutboundMessageProcessorTestCase, CxfSoapEndpointTestCase, CxfWsdlTestCase, DataTypesTestCase, DateUtilsTestCase, DefaultExceptionStrategyTestCase, DefaultJmxSupportAgentTestCase, DefaultLocalMuleClientTestCase, DefaultMuleClassPathConfigTestCase, DefaultMuleContextBuilderTestCase, DefaultMuleContextFactoryTestCase, DefaultMuleContextTestCase, DefaultMuleMessageSerializationTestCase, DefaultMuleMessageTestCase, DefaultOutboundRouterCollectionTestCase, DefaultProtocolTestCase, DefaultThreadingProfileTestCase, DefaultThreadPoolFactoryTestCase, DeploymentServiceTestCase, DescriptorParserTestCase, DispatcherPoolTestCase, DispatcherThreadingProfileTestCase, DuplicateRegistrationTestCase, DynamicEndpointParsingTestCase, EjbEndpointTestCase, EmailEndpointsTestCase, EndpointFactoryTestCase, EndpointSelectorTestCase, EndpointTestCase, EndpointTransformerTestCase, EndpointURIBuilderTestCase, EndpointURIEndpointBuilderTestCase, EndpointURITestCase, EntryPointResolverMethodCacheTestCase, EqualsFilterTestCase, EventGroupTestCase, ExceptionBasedRouterTestCase, ExceptionHelperTestCase, ExceptionListenerTestCase, ExceptionRollbackTestCase, ExceptionsTestCase, ExceptionTypeFilterTestCase, ExceptionUtilsTestCase, ExpiryMonitorTestCase, ExplicitMethodEntryPointResolverTestCase, ExpressionConfigTestCase, ExpressionFilenameParserTestCase, ExpressionFilterTestCase, ExpressionManagerTestCase, ExpressionParsingTestCase, ExpressionTransformerTestCase, FileEndpointTestCase, FileMessageRequesterTestCase, FilenameRegexFilterTestCase, FileUtilsTestCase, FilterExpressionParserTestCase, FilteringOutboundRouterTestCase, FilterListMessageSplitterRouterTestCase, FirewallTestCase, FirstSuccessfulTestCase, FixedHostRmiClienSocketFactoryTestCase, FlickrSearchTestCase, FlickrTestCase, FtpEndpointTestCase, FunctionalTestCase, FunctionExpressionEvaluatorTestCase, FutureMessageResultTestCase, GenericConnectorTestCase, GenericsUtilsTestCase, GroovyExpressionEvaluatorTestCase, GuiceLifecyceTestCase, HeadersExpressionEvaluatorTestCase, HelloSampleTestCase, HttpBasicAuthenticationFilterTestCase, HttpBasicAuthenticationFilterTestCase, HttpEndpointTestCase, HttpResponseToStringTestCase, HttpsHandshakeTimingTestCase, IBeansConnectorFactoryTestCase, IBeansEndpointTestCase, IdempotentMessageFilterTestCase, IdempotentSecureHashMessageFilterTestCase, InMemoryStoreTestCase, IntegrationBeanAnnotationTestCase, InterceptingChainMessageProcessorBuilderTestCase, InterceptorTestCase, InvokeAnnotationTestCase, IOUtilsTestCase, IsJsonFilterTestCase, IsXmlFilterTestCase, JarUtilsTestCase, JaxbAutoTransformerTestCase, JaxbTransformerTestCase, JbpmUnitTestCase, JdbcEndpointTestCase, JdbcMessageDispatcherTestCase, JettyEndpointTestCase, Jms11SupportTestCase, JmsConnectorTestCase, JmsEndpointTestCase, JmsExceptionReaderTestCase, JmsMessageUtilsTestCase, JmsTransformerTestCase, JmxAgentTestCase, JnpEndpointTestCase, JsonAutoTransformerTestCase, JsonAutoTransformerWithMixinsTestCase, JsonCustomTransformerTestCase, JsonCustomTransformerWithMixinsTestCase, JsonDataTestCase, JsonExpressionEvaluatorTestCase, JsonPathAnnotatedEntryPointResolverTestCase, JsonStringTestCase, JSR250ObjectLifcycleTestCase, JXPathExpressionEvaluatorTestCase, JXPathExtractorTestCase, JXPathFilterTestCase, KeyedPoolMessageDispatcherFactoryAdapterTestCase, LegacyEntryPointResolverTestCase, LifecycleNotificationTestCase, LingerExperimentMule2067TestCase, ListMessageSplitterTestCase, LogicFiltersTestCase, LookupInjectionTestCase, MailUtilsTestCase, MapCombinerTestCase, MapPayloadExpressionEvaluatorTestCase, MapUtilsTestCase, MessageChunkAggregatorTestCase, MessageExpressionEvaluatorTestCase, MessageFilterTestCase, MessagePropertiesContextTestCase, MessagePropertiesTransformerScopesTestCase, MessagePropertyFilterTestCase, MessageSplitterRouterTestCase, MessagesTestCase, MethodHeaderEntryPointResolverTestCase, MonitoredObjectStoreTestCase, MuleAgentsTestCase, MuleClientWSDLExternalTestCase, MuleContextExpressionEvaluatorTestCase, MuleCopiedEndpointURITestCase, MuleEndpointURITestCase, MuleEventTestCase, MuleEventWorkTestCase, MuleExpressionEvaluatorTestCase, MuleHostConfigurationTestCase, MuleMessageFactoryUsagePatternsTestCase, MuleObjectCreationTestCase, MuleResourceAdapterTestCase, MuleServerTestCase, MuleSessionHandlerTestCase, MuleTransactionConfigTestCase, MuleWorkManagerTestCase, MulticasterTestCase, MulticastingRouterTestCase, NamedThreadFactoryTestCase, NoArgsEntryPointResolverTestCase, NotificationManagerTestCase, NullPayloadTestCase, NumberUtilsTestCase, ObjectNameHelperTestCase, ObjectToHttpClientMethodRequestTestCase, ObjectToInputStreamTestCase, ObjectUtilsTestCase, OgnlExpressionEvaluatorTestCase, OutboundMessageRouterTestCase, OutboundRouterTestCase, OutputPayloadInterceptorTestCase, ParallelXQueryTransformerTestCase, ParallelXsltTransformerTestCase, PayloadExpressionEvaluatorTestCase, PayloadTypeFilterTestCase, PbeEncryptionStrategyTestCase, PropertiesUtilsTestCase, ProxyServiceConfigurationTestCase, QNamePropertyEditorTestCase, ReflectionEntryPointResolverTestCase, RegExFilterTestCase, RegisteredObjectLifecycleTestCase, RemoteDispatcherSerializationTestCase, RequestContextTestCase, ResequencerTestCase, ResourceLoaderServletTestCase, ReuseExperimentMule2067TestCase, RmiEndpointTestCase, RmiRegistryAgentTestCase, RoundRobinTestCase, RoundRobinXmlSplitterTestCase, RssEndpointTestCase, SchemaDefaultsTestCase, SchemaValidationMule2225TestCase, SchemaValidationTestCase, SecretKeyEncryptionStrategyTestCase, ServerNotificationsTestCase, ServiceTestCase, SimpleCollectionAggregatorTestCase, SimplePasswordJmxAuthenticatorTestCase, SimpleServiceBuilderTestCase, SoapActionTemplateTestCase, SocketTimingExperimentTestCase, SpiUtilsTestCase, SplashScreenTestCase, SpringTransactionFactoryTestCase, SpringTransactionFactoryTestCase, SqlExceptionReaderTestCase, SslEndpointTestCase, SslHandshakeTimingTestCase, StartableCompositeMessageSourceTestCase, StaticRecipientListRouterTestCase, StatusCodeMappingsTestCase, StringExpressionEvaluatorTestCase, StringMessageUtilsTestCase, StringUtilsTestCase, SystemUtilsTestCase, TcpEndpointTestCase, TemplateParserTestCase, TemplateParserTestCase, TextFileStoreTestCase, TimedSocketTestCase, TimerTestCase, TlsConfigurationTestCase, TlsPropertiesSocketTestCase, TransactionConstraintTestCase, TransactionCoordinationTestCase, TransactionNotificationsTestCase, TransformDiscoveryTestCase, TransformerCachingTestCase, TransformerChainingTestCase, TransformerDiscoveryTestCase, TransformerWeightingTestCase, TransientRegistryTestCase, URIBuilderTestCase, URIBuilderTestCase, UUIDTestCase, ValidatorBuilderTestCase, VMEndpointTestCase, VoidResultTestCase, WaitableBooleanTestCase, WaitPolicyTestCase, WildcardFilterTestCase, WireTapTestCase, WSProxyBuilderTestCase, WsProxyConfigurationIssuesTestCase, XAResourceManagerTestCase, XmlMessageProtocolTestCase, XmlMessageSplitterTestCase, XmlMuleMessageTransformersTestCase, XmlUtilsTestCase, XmppEndpointTestCase, XPathAnnotatedEntryPointResolverTestCase, XPathFilterTestCase, XStreamFactoryTestCase, XStreamTransformerConfigurationTestCase

public abstract class AbstractMuleTestCase
extends junit.framework.TestCase
implements TestCaseWatchdogTimeoutHandler

AbstractMuleTestCase is a base class for Mule testcases. This implementation provides services to test code for creating mock and test objects.


Nested Class Summary
static class AbstractMuleTestCase.TestInfo
           
 
Field Summary
protected  Latch callbackCalled
          Use this as a semaphore to the unit test to indicate when a callback has successfully been called.
static java.lang.String CLASSNAME_ANNOTATIONS_CONFIG_BUILDER
          If the annotations module is on the classpath, also enable annotations config builder
static int DEFAULT_MULE_TEST_TIMEOUT_SECS
          Default test watchdog timeout in seconds.
static java.lang.String[] IGNORED_DOT_MULE_DIRS
          Top-level directories under .mule which are not deleted on each test case recycle.
static long LOCK_TIMEOUT
          Default timeout for multithreaded tests (using CountDownLatch, WaitableBoolean, etc.), in milliseconds.
protected  Log logger
           
protected static MuleContext muleContext
           
protected  int numPorts
           
 java.util.List<java.lang.Integer> ports
           
static java.lang.String PROPERTY_MULE_TEST_TIMEOUT
          Name of a property to override the default test watchdog timeout.
static int RECEIVE_TIMEOUT
          Default timeout for waiting for responses
static java.lang.String TEST_MESSAGE
          Convenient test message for unit testing.
protected  int testTimeoutSecs
          Timeout used for the test watchdog
 
Constructor Summary
AbstractMuleTestCase()
           
 
Method Summary
protected  void addBuilders(java.util.List<ConfigurationBuilder> builders)
           
 void checkPorts(boolean failIfTaken, java.lang.String prefix)
          Iterate through the ports and log whether each is available
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
<T> T
createObject(java.lang.Class<T> clazz)
          Create an object of instance clazz.
protected
<T> T
createObject(java.lang.Class<T> clazz, java.lang.Object... args)
          Create an object of instance clazz.
protected  AbstractMuleTestCase.TestInfo createTestInfo()
           
protected  TestCaseWatchdog createWatchdog()
           
protected  void disposeManager()
           
protected  void doSetUp()
          Exactly the same a setUp() in normal JUnit test cases.
protected  void doTearDown()
          Exactly the same a tearDown() in normal JUnit test cases.
 java.util.List<java.lang.Integer> findFreePorts(int numberOfPorts)
          Find a given number of available ports
protected  ConfigurationBuilder getBuilder()
           
protected  java.lang.String getConfigurationResources()
           
 java.util.List<java.lang.Integer> getPorts()
           
 SensingNullMessageProcessor getSensingNullMessageProcessor()
           
protected  java.util.Properties getStartUpProperties()
           
static TestConnector getTestConnector()
           
static MuleEvent getTestEvent(java.lang.Object data)
           
static MuleEvent getTestEvent(java.lang.Object data, ImmutableEndpoint endpoint)
           
static MuleEvent getTestEvent(java.lang.Object data, MessageExchangePattern mep)
           
static MuleEvent getTestEvent(java.lang.Object data, Service service)
           
static MuleEvent getTestEvent(java.lang.Object data, Service service, ImmutableEndpoint endpoint)
           
static MuleEvent getTestEvent(java.lang.Object data, Service service, MessageExchangePattern mep)
           
static MuleEventContext getTestEventContext(java.lang.Object data)
           
static MuleEventContext getTestEventContext(java.lang.Object data, MessageExchangePattern mep)
           
static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep)
           
static InboundEndpoint getTestInboundEndpoint(java.lang.String name)
           
static InboundEndpoint getTestInboundEndpoint(java.lang.String name, java.util.List<Transformer> transformers)
           
static InboundEndpoint getTestInboundEndpoint(java.lang.String name, java.lang.String uri)
           
static InboundEndpoint getTestInboundEndpoint(java.lang.String name, java.lang.String uri, java.util.List<Transformer> transformers, Filter filter, java.util.Map<java.lang.Object,java.lang.Object> properties, Connector connector)
           
static MuleEvent getTestInboundEvent(java.lang.Object data)
           
static MuleEvent getTestInboundEvent(java.lang.Object data, MessageExchangePattern mep)
           
static MuleEvent getTestInboundEvent(java.lang.Object data, MuleSession session)
           
protected  AbstractMuleTestCase.TestInfo getTestInfo()
           
static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name)
           
static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name, java.util.List<Transformer> transformers)
           
static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name, java.lang.String uri)
           
static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name, java.lang.String uri, java.util.List<Transformer> transformers, Filter filter, java.util.Map<java.lang.Object,java.lang.Object> properties)
           
static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name, java.lang.String uri, java.util.List<Transformer> transformers, Filter filter, java.util.Map<java.lang.Object,java.lang.Object> properties, Connector connector)
           
static Service getTestService()
           
static Service getTestService(java.lang.String name, java.lang.Class<?> clazz)
           
static Service getTestService(java.lang.String name, java.lang.Class<?> clazz, java.util.Map<?,?> props)
           
static MuleSession getTestSession(Service service, MuleContext context)
           
 int getTestTimeoutSecs()
           
static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep)
           
static Transformer getTestTransformer()
           
 TriggerableMessageSource getTriggerableMessageSource()
           
 TriggerableMessageSource getTriggerableMessageSource(MessageProcessor listener)
           
protected  void giveTheTestSomeTimeToCleanUpAndThenKillIt(java.lang.String messageIfNeedToKill)
           
 void handleTimeout(long timeout, edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
           
protected  void initialiseObject(java.lang.Object o)
          A convenience method that will register an object in the registry using its hashcode as the key.
protected  void initTestTimeoutSecs()
           
protected  boolean isDisabledInThisEnvironment()
          Subclasses can override this method to skip the execution of the entire test class.
protected  boolean isDisabledInThisEnvironment(java.lang.String testMethodName)
          Should this test run?
protected  boolean isDisposeManagerPerSuite()
           
protected  boolean isExcluded()
          Indicates whether this test has been explicitly disabled through the configuration file loaded by TestInfo.
protected  boolean isGracefulShutdown()
          Determines if the test case should perform graceful shutdown or not.
 boolean isOffline(java.lang.String method)
           
 boolean isPortFree(int port)
          Check and log is a given port is available
protected  boolean isStartContext()
           
protected  void registerTestMethod()
           
 void run(junit.framework.TestResult result)
           
 void runBare()
          Shamelessly copy from Spring's ConditionalTestCase so in MULE-2.0 we can extend this class from ConditionalTestCase.
protected  void setDisposeManagerPerSuite(boolean val)
           
 void setFailOnTimeout(boolean failOnTimeout)
           
 void setName(java.lang.String name)
           
protected  void setStartContext(boolean startContext)
           
protected  void setUp()
          Normal JUnit method
protected  void suitePostTearDown()
          Run after all testcase teardowns.
protected  void suitePreSetUp()
          Run before any testcase setup.
protected  void tearDown()
          Normal JUnit method
 
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

IGNORED_DOT_MULE_DIRS

public static final java.lang.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.


PROPERTY_MULE_TEST_TIMEOUT

public static final java.lang.String PROPERTY_MULE_TEST_TIMEOUT
Name of a property to override the default test watchdog timeout.

See Also:
DEFAULT_MULE_TEST_TIMEOUT_SECS, Constant Field Values

DEFAULT_MULE_TEST_TIMEOUT_SECS

public static final int DEFAULT_MULE_TEST_TIMEOUT_SECS
Default test watchdog timeout in seconds.

See Also:
Constant Field Values

CLASSNAME_ANNOTATIONS_CONFIG_BUILDER

public static final java.lang.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

logger

protected final transient Log logger

numPorts

protected int numPorts

ports

public java.util.List<java.lang.Integer> ports

TEST_MESSAGE

public static final java.lang.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.


testTimeoutSecs

protected int testTimeoutSecs
Timeout used for the test watchdog

Constructor Detail

AbstractMuleTestCase

public AbstractMuleTestCase()
Method Detail

registerTestMethod

protected void registerTestMethod()

initTestTimeoutSecs

protected void initTestTimeoutSecs()

setName

public void setName(java.lang.String name)
Overrides:
setName in class junit.framework.TestCase

createTestInfo

protected AbstractMuleTestCase.TestInfo createTestInfo()

getTestInfo

protected AbstractMuleTestCase.TestInfo getTestInfo()

run

public void run(junit.framework.TestResult result)
Specified by:
run in interface junit.framework.Test
Overrides:
run in class junit.framework.TestCase

runBare

public void runBare()
             throws java.lang.Throwable
Shamelessly copy from Spring's ConditionalTestCase so in MULE-2.0 we can extend this class from ConditionalTestCase.

Subclasses can override isDisabledInThisEnvironment to skip a single test.

Overrides:
runBare in class junit.framework.TestCase
Throws:
java.lang.Throwable

isDisabledInThisEnvironment

protected boolean isDisabledInThisEnvironment()
Subclasses can override this method to skip the execution of the entire test class.

Returns:
true if the test class should not be run.

isExcluded

protected boolean isExcluded()
Indicates whether this test has been explicitly disabled through the configuration file loaded by TestInfo.

Returns:
whether the test has been explicitly disabled

isDisabledInThisEnvironment

protected boolean isDisabledInThisEnvironment(java.lang.String testMethodName)
Should this test run?

Parameters:
testMethodName - name of the test method
Returns:
whether the test should execute in the current envionment

isOffline

public boolean isOffline(java.lang.String method)

isDisposeManagerPerSuite

protected boolean isDisposeManagerPerSuite()

setDisposeManagerPerSuite

protected void setDisposeManagerPerSuite(boolean val)

getTestTimeoutSecs

public int getTestTimeoutSecs()

createWatchdog

protected TestCaseWatchdog createWatchdog()

handleTimeout

public void handleTimeout(long timeout,
                          edu.emory.mathcs.backport.java.util.concurrent.TimeUnit unit)
Specified by:
handleTimeout in interface TestCaseWatchdogTimeoutHandler

giveTheTestSomeTimeToCleanUpAndThenKillIt

protected void giveTheTestSomeTimeToCleanUpAndThenKillIt(java.lang.String messageIfNeedToKill)

setUp

protected final void setUp()
                    throws java.lang.Exception
Normal JUnit method

Overrides:
setUp in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
doSetUp()

createMuleContext

protected MuleContext createMuleContext()
                                 throws java.lang.Exception
Throws:
java.lang.Exception

addBuilders

protected void addBuilders(java.util.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 java.lang.Exception
Throws:
java.lang.Exception

getConfigurationResources

protected java.lang.String getConfigurationResources()

getStartUpProperties

protected java.util.Properties getStartUpProperties()

suitePreSetUp

protected void suitePreSetUp()
                      throws java.lang.Exception
Run before any testcase setup. This is called once only before the test suite runs.

Throws:
java.lang.Exception

suitePostTearDown

protected void suitePostTearDown()
                          throws java.lang.Exception
Run after all testcase teardowns. This is called once only after all the tests in the suite have run.

Throws:
java.lang.Exception

tearDown

protected final void tearDown()
                       throws java.lang.Exception
Normal JUnit method

Overrides:
tearDown in class junit.framework.TestCase
Throws:
java.lang.Exception
See Also:
doTearDown()

disposeManager

protected void disposeManager()

doSetUp

protected void doSetUp()
                throws java.lang.Exception
Exactly the same a setUp() in normal JUnit test cases. this is called before a test method has been called.

Throws:
java.lang.Exception - if something fails that should halt the testcase

doTearDown

protected void doTearDown()
                   throws java.lang.Exception
Exactly the same a tearDown() in normal JUnit test cases. this is called after a test method has been called.

Throws:
java.lang.Exception - if something fails that should halt the testcase

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(java.lang.String name)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(MessageExchangePattern mep)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestTransactedInboundEndpoint

public static InboundEndpoint getTestTransactedInboundEndpoint(MessageExchangePattern mep)
                                                        throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(java.lang.String name,
                                                     java.lang.String uri)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name,
                                                       java.lang.String uri)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(java.lang.String name,
                                                     java.util.List<Transformer> transformers)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name,
                                                       java.util.List<Transformer> transformers)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEndpoint

public static InboundEndpoint getTestInboundEndpoint(java.lang.String name,
                                                     java.lang.String uri,
                                                     java.util.List<Transformer> transformers,
                                                     Filter filter,
                                                     java.util.Map<java.lang.Object,java.lang.Object> properties,
                                                     Connector connector)
                                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name,
                                                       java.lang.String uri,
                                                       java.util.List<Transformer> transformers,
                                                       Filter filter,
                                                       java.util.Map<java.lang.Object,java.lang.Object> properties)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getTestOutboundEndpoint

public static OutboundEndpoint getTestOutboundEndpoint(java.lang.String name,
                                                       java.lang.String uri,
                                                       java.util.List<Transformer> transformers,
                                                       Filter filter,
                                                       java.util.Map<java.lang.Object,java.lang.Object> properties,
                                                       Connector connector)
                                                throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data,
                                     Service service)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data,
                                     Service service,
                                     MessageExchangePattern mep)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data,
                                     MessageExchangePattern mep)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEvent

public static MuleEvent getTestInboundEvent(java.lang.Object data,
                                            MuleSession session)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEvent

public static MuleEvent getTestInboundEvent(java.lang.Object data)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getTestInboundEvent

public static MuleEvent getTestInboundEvent(java.lang.Object data,
                                            MessageExchangePattern mep)
                                     throws java.lang.Exception
Throws:
java.lang.Exception

getTestEventContext

public static MuleEventContext getTestEventContext(java.lang.Object data)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getTestEventContext

public static MuleEventContext getTestEventContext(java.lang.Object data,
                                                   MessageExchangePattern mep)
                                            throws java.lang.Exception
Throws:
java.lang.Exception

getTestTransformer

public static Transformer getTestTransformer()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data,
                                     ImmutableEndpoint endpoint)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestEvent

public static MuleEvent getTestEvent(java.lang.Object data,
                                     Service service,
                                     ImmutableEndpoint endpoint)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestSession

public static MuleSession getTestSession(Service service,
                                         MuleContext context)

getTestConnector

public static TestConnector getTestConnector()
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getTestService

public static Service getTestService()
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestService

public static Service getTestService(java.lang.String name,
                                     java.lang.Class<?> clazz)
                              throws java.lang.Exception
Throws:
java.lang.Exception

getTestService

public static Service getTestService(java.lang.String name,
                                     java.lang.Class<?> clazz,
                                     java.util.Map<?,?> props)
                              throws java.lang.Exception
Throws:
java.lang.Exception

isStartContext

protected boolean isStartContext()

setStartContext

protected void setStartContext(boolean startContext)

setFailOnTimeout

public void setFailOnTimeout(boolean failOnTimeout)

isGracefulShutdown

protected boolean isGracefulShutdown()
Determines if the test case should perform graceful shutdown or not. Default is false so that tests run more quickly.

Returns:

createObject

protected <T> T createObject(java.lang.Class<T> clazz)
                  throws java.lang.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:
java.lang.Exception - if there is a problem creating or initializing the object

createObject

protected <T> T createObject(java.lang.Class<T> clazz,
                             java.lang.Object... args)
                  throws java.lang.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:
java.lang.Exception - if there is a problem creating or initializing the object

initialiseObject

protected void initialiseObject(java.lang.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()

findFreePorts

public java.util.List<java.lang.Integer> findFreePorts(int numberOfPorts)
Find a given number of available ports

Parameters:
numberOfPorts - The number of free ports to find
Returns:
an ArrayList with the number of requested ports

checkPorts

public void checkPorts(boolean failIfTaken,
                       java.lang.String prefix)
Iterate through the ports and log whether each is available

Parameters:
failIfTaken - If true, fails the current test if the port is not available

isPortFree

public boolean isPortFree(int port)
Check and log is a given port is available

Parameters:
port - the port number to check
Returns:
true if the port is available, false otherwise

getPorts

public java.util.List<java.lang.Integer> getPorts()


Copyright © 2003-2010 MuleSoft, Inc.. All Rights Reserved.