org.mule.transport.http.issues
Class NoTransformFunctionalTestComponent

java.lang.Object
  extended by org.mule.transport.http.issues.NoTransformFunctionalTestComponent
All Implemented Interfaces:
Callable, EventListener

public class NoTransformFunctionalTestComponent
extends Object
implements Callable

FunctionalTestComponent is a service that can be used by functional tests. This service accepts an EventCallback that can be used to assert the state of the current event.

Also, this service fires FunctionalTestNotification via Mule for every message received. Tests can register with Mule to receive these events by implementing FunctionalTestNotificationListener.

See Also:
EventCallback, FunctionalTestNotification, FunctionalTestNotificationListener

Field Summary
protected  Log logger
           
static int STREAM_BUFFER_SIZE
           
static int STREAM_SAMPLE_SIZE
           
 
Constructor Summary
NoTransformFunctionalTestComponent()
           
 
Method Summary
 EventCallback getEventCallback()
          An event callback is called when a message is received by the service.
 Object getReturnMessage()
          Often you will may want to return a fixed message payload to simulate and external system call.
 boolean isAppendComponentName()
          This will cause the service to append the compoent name to the end of the message returned from this service.
 boolean isThrowException()
          Sometimes you will want the service to always throw an exception, if this is the case you can set the 'throwException' property to true.
 Object onCall(MuleEventContext context)
          
 Object onReceive(Object data)
          Deprecated. Not sure why we have this duplicate method here. Need to investigate...
static String received(String contents)
          Append " Received" to contents.
 void setAppendComponentName(boolean appendComponentName)
          This will cause the service to append the compoent name to the end of the message returned from this service.
 void setEventCallback(EventCallback eventCallback)
          An event callback is called when a message is received by the service.
 void setReturnMessage(Object returnMessage)
          Often you will may want to return a fixed message payload to simulate and external system call.
 void setThrowException(boolean throwException)
          Sometimes you will want the service to always throw an exception, if this is the case you can set the 'throwException' property to true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected transient Log logger

STREAM_SAMPLE_SIZE

public static final int STREAM_SAMPLE_SIZE
See Also:
Constant Field Values

STREAM_BUFFER_SIZE

public static final int STREAM_BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

NoTransformFunctionalTestComponent

public NoTransformFunctionalTestComponent()
Method Detail

onCall

public Object onCall(MuleEventContext context)
              throws Exception

Specified by:
onCall in interface Callable
Throws:
Exception

received

public static String received(String contents)
Append " Received" to contents. Exposed as static method so tests can call to construct string for comparison.

Parameters:
contents -
Returns:
Extended message

onReceive

public Object onReceive(Object data)
                 throws Exception
Deprecated. Not sure why we have this duplicate method here. Need to investigate...

Parameters:
data - the event data received
Returns:
the processed message
Throws:
Exception

getEventCallback

public EventCallback getEventCallback()
An event callback is called when a message is received by the service. An MuleEvent callback isn't strictly required but it is usfal for performing assertions on the current message being received. Note that the FunctionalTestComponent should be made a singleton when using MuleEvent callbacks

Another option is to register a FunctionalTestNotificationListener with Mule and this will deleiver a FunctionalTestNotification for every message received by this service

Returns:
the callback to call when a message is received
See Also:
FunctionalTestNotification, FunctionalTestNotificationListener

setEventCallback

public void setEventCallback(EventCallback eventCallback)
An event callback is called when a message is received by the service. An MuleEvent callback isn't strictly required but it is usfal for performing assertions on the current message being received. Note that the FunctionalTestComponent should be made a singleton when using MuleEvent callbacks

Another option is to register a FunctionalTestNotificationListener with Mule and this will deleiver a FunctionalTestNotification for every message received by this service

Parameters:
eventCallback - the callback to call when a message is received
See Also:
FunctionalTestNotification, FunctionalTestNotificationListener

getReturnMessage

public Object getReturnMessage()
Often you will may want to return a fixed message payload to simulate and external system call. This can be done using the 'returnMessage' property. Note that you can return complex objects by using the element in the Xml configuration.

Returns:
the message payload to always return from this service instance

setReturnMessage

public void setReturnMessage(Object returnMessage)
Often you will may want to return a fixed message payload to simulate and external system call. This can be done using the 'returnMessage' property. Note that you can return complex objects by using the element in the Xml configuration.

Parameters:
returnMessage - the message payload to always return from this service instance

isThrowException

public boolean isThrowException()
Sometimes you will want the service to always throw an exception, if this is the case you can set the 'throwException' property to true.

Returns:
throwException true if an exception should always be thrown from this instance. If the returnMessage property is set and is of type java.lang.Exception, that exception will be thrown.

setThrowException

public void setThrowException(boolean throwException)
Sometimes you will want the service to always throw an exception, if this is the case you can set the 'throwException' property to true.

Parameters:
throwException - true if an exception should always be thrown from this instance. If the returnMessage property is set and is of type java.lang.Exception, that exception will be thrown.

isAppendComponentName

public boolean isAppendComponentName()
This will cause the service to append the compoent name to the end of the message returned from this service. This only works when processing String messages. This feature is useful when processing multiple messages using a pool of FunctionalTestComponents to determine who processed the resulting message

Returns:
true if the service name will be appended to the return message

setAppendComponentName

public void setAppendComponentName(boolean appendComponentName)
This will cause the service to append the compoent name to the end of the message returned from this service. This only works when processing String messages. This feature is useful when processing multiple messages using a pool of FunctionalTestComponents to determine who processed the resulting message

Parameters:
appendComponentName - true if the service name will be appended to the return message


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