org.mule.modules.tests
Class ConnectorTestCase

java.lang.Object
  extended by org.mule.tck.junit4.AbstractMuleTestCase
      extended by org.mule.tck.junit4.AbstractMuleContextTestCase
          extended by org.mule.tck.junit4.FunctionalTestCase
              extended by org.mule.modules.tests.ConnectorTestCase

public abstract class ConnectorTestCase
extends org.mule.tck.junit4.FunctionalTestCase

Connector Tests Framework Parent Class

Author:
Mulesoft, Inc

Field Summary
protected static String DEFAULT_SPRING_CONFIG_FILE
           
protected static List<String> SPRING_CONFIG_FILES
           
 
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, logger, name, TEST_TIMEOUT_SYSTEM_PROPERTY
 
Constructor Summary
ConnectorTestCase()
           
 
Method Summary
protected static void addConfigSpringFile(String fileLocation)
          Add a file to be loaded on the spring context.
static void beforeClass()
           
<T> T
getBeanFromContext(String beanId)
           
protected  String getConfigResources()
           
protected static String[] getConfigSpringFiles()
           
protected  String getConfigXmlFile()
           
 Set<String> getTestRunMessageKeySet()
           
<T> T
getTestRunMessagePayload()
           
<T> T
getTestRunMessageValue(String key)
           
 void initializeTestRunMessage(Object data)
           
protected  void initializeTestRunMessage(String beanId)
          If beanId belongs to a POJO it is set as payloadContent.
 void initializeTestRunMessage(String key, Object value)
           
 boolean keyContainedInTestRunMessage(Object key)
           
 void loadTestRunMessage(Map<String,Object> data)
          Deprecated. 
protected  void loadTestRunMessage(String beanId)
          Deprecated. 
protected  org.mule.construct.Flow lookupFlowConstruct(String name)
           
 void removeFromTestRunMessage(String key)
           
protected
<T> T
runFlowAndGetInvocationProperty(String flowName, String invocationProperty)
           
protected  org.mule.api.MuleMessage runFlowAndGetMessage(String flowName)
          TestRunMessage is already loaded with values for the operation
protected  org.mule.api.MuleMessage runFlowAndGetMessage(String flowName, String beanId)
          Returns the MuleMessage containing the payload of the operation.
protected
<T> T
runFlowAndGetPayload(String flowName)
          TestRunMessage is already loaded with values for the operation
protected
<T> T
runFlowAndGetPayload(String flowName, String beanId)
          Returns the Payload of the flowName operation.
protected static void setConfigSpringFiles(List<String> configFilesLocation)
          Replace the list of spring beans to be loaded into the context.
 void upsertBeanFromContextOnTestRunMessage(String beanId)
           
 void upsertBeanFromContextOnTestRunMessage(String key, String beanId)
           
 void upsertOnTestRunMessage(Map<String,Object> data)
           
 void upsertOnTestRunMessage(String key, Object value)
           
 void upsertPayloadContentOnTestRunMessage(Object payloadContent)
           
 
Methods inherited from class org.mule.tck.junit4.FunctionalTestCase
clearFlowAssertions, getBuilder, getComponent, getComponent, getConfigFile, getConfigFiles, getFlowConstruct, getFunctionalTestComponent, loadResource, loadResourceAsString, runFlow, runFlow, runFlowAndExpect, runFlowAndExpectProperty, runFlowWithPayloadAndExpect, stopFlowConstruct, testFlow, testFlow
 
Methods inherited from class org.mule.tck.junit4.AbstractMuleContextTestCase
addBuilders, configureMuleContext, createMuleContext, createObject, createObject, disposeContext, disposeContextPerTest, doSetUp, doSetUpBeforeMuleContextCreation, doTearDown, doTearDownAfterMuleContextDispose, getConfigurationResources, getSensingNullMessageProcessor, getStartUpProperties, getTestConnector, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEvent, getTestEventContext, getTestEventContext, getTestEventUsingFlow, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestInboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestOutboundEndpoint, getTestService, getTestService, getTestService, getTestSession, getTestTransactedInboundEndpoint, getTestTransformer, getTriggerableMessageSource, getTriggerableMessageSource, initialiseObject, isDisposeContextPerClass, isGracefulShutdown, isStartContext, setDisposeContextPerClass, setStartContext, 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
 

Field Detail

DEFAULT_SPRING_CONFIG_FILE

protected static final String DEFAULT_SPRING_CONFIG_FILE
See Also:
Constant Field Values

SPRING_CONFIG_FILES

protected static List<String> SPRING_CONFIG_FILES
Constructor Detail

ConnectorTestCase

public ConnectorTestCase()
Method Detail

beforeClass

public static void beforeClass()

getConfigSpringFiles

protected static String[] getConfigSpringFiles()

addConfigSpringFile

protected static void addConfigSpringFile(String fileLocation)
Add a file to be loaded on the spring context.

Note:This method must be called from a static initializer static \{...\}

Parameters:
fileLocation - The location of the file containing the spring beans definitions

setConfigSpringFiles

protected static void setConfigSpringFiles(List<String> configFilesLocation)
Replace the list of spring beans to be loaded into the context.

Note:This method must be called from a static initializer static \{...\}

Parameters:
configFilesLocation - The list with the files location containing the spring beans definitions

getConfigResources

protected String getConfigResources()
Overrides:
getConfigResources in class org.mule.tck.junit4.FunctionalTestCase

getConfigXmlFile

protected String getConfigXmlFile()

lookupFlowConstruct

protected org.mule.construct.Flow lookupFlowConstruct(String name)
Overrides:
lookupFlowConstruct in class org.mule.tck.junit4.FunctionalTestCase

loadTestRunMessage

@Deprecated
protected void loadTestRunMessage(String beanId)
Deprecated. 

Use initializeTestRunMessage instead

Parameters:
data -

loadTestRunMessage

@Deprecated
public void loadTestRunMessage(Map<String,Object> data)
Deprecated. 

Use initializeTestRunMessage instead

Parameters:
data -

initializeTestRunMessage

protected void initializeTestRunMessage(String beanId)
If beanId belongs to a POJO it is set as payloadContent. What if Map needs to be set as payload, needs to be analysed.


initializeTestRunMessage

public void initializeTestRunMessage(String key,
                                     Object value)

initializeTestRunMessage

public void initializeTestRunMessage(Object data)

getBeanFromContext

public <T> T getBeanFromContext(String beanId)
                     throws org.springframework.beans.BeansException
Throws:
org.springframework.beans.BeansException

upsertBeanFromContextOnTestRunMessage

public void upsertBeanFromContextOnTestRunMessage(String beanId)

upsertBeanFromContextOnTestRunMessage

public void upsertBeanFromContextOnTestRunMessage(String key,
                                                  String beanId)

upsertOnTestRunMessage

public void upsertOnTestRunMessage(String key,
                                   Object value)

upsertOnTestRunMessage

public void upsertOnTestRunMessage(Map<String,Object> data)

upsertPayloadContentOnTestRunMessage

public void upsertPayloadContentOnTestRunMessage(Object payloadContent)

getTestRunMessagePayload

public <T> T getTestRunMessagePayload()

getTestRunMessageValue

public <T> T getTestRunMessageValue(String key)

removeFromTestRunMessage

public void removeFromTestRunMessage(String key)

keyContainedInTestRunMessage

public boolean keyContainedInTestRunMessage(Object key)

getTestRunMessageKeySet

public Set<String> getTestRunMessageKeySet()

runFlowAndGetPayload

protected <T> T runFlowAndGetPayload(String flowName)
                          throws Exception
TestRunMessage is already loaded with values for the operation

Parameters:
flowName -
Returns:
Throws:
Exception

runFlowAndGetMessage

protected org.mule.api.MuleMessage runFlowAndGetMessage(String flowName)
                                                 throws Exception
TestRunMessage is already loaded with values for the operation

Parameters:
flowName -
Returns:
Throws:
Exception

runFlowAndGetInvocationProperty

protected <T> T runFlowAndGetInvocationProperty(String flowName,
                                                String invocationProperty)
                                     throws Exception
Parameters:
flowName -
invocationProperty -
Returns:
Throws:
Exception

runFlowAndGetMessage

protected org.mule.api.MuleMessage runFlowAndGetMessage(String flowName,
                                                        String beanId)
                                                 throws Exception
Returns the MuleMessage containing the payload of the operation. TestRunMessage is not the source of data for this method. Meant for retrieving auxiliary information or when test involves a single call to the operation under test.

Parameters:
flowName -
beanId - is the id of a map Spring bean declared in the AutomationSpringBeans
Returns:
Throws:
Exception

runFlowAndGetPayload

protected <T> T runFlowAndGetPayload(String flowName,
                                     String beanId)
                          throws Exception
Returns the Payload of the flowName operation. TestRunMessage is not the source of data for this method. Meant for retrieving auxiliary information or when test involves a single call to the operation under test.

Parameters:
flowName -
beanId - is the id of a map Spring bean declared in the AutomationSpringBeans
Returns:
Throws:
Exception


Copyright © 2014. All rights reserved.