|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mockrunner.connector.GenericFailureInteraction
public class GenericFailureInteraction
This interaction implementor can be used to simulate failures. By default
it simply accepts every request and throws a ResourceException
for all execute calls. It can be disabled and it can be configured
to return false for execute(InteractionSpec, Record, Record)
and null for execute(InteractionSpec, Record) instead of
throwing an exception.
| Constructor Summary | |
|---|---|
GenericFailureInteraction()
Sets the default values, i.e. throwing a ResourceException. |
|
GenericFailureInteraction(boolean throwException)
Sets if failure values should be returned instead of throwing a ResourceException. |
|
GenericFailureInteraction(boolean throwException,
javax.resource.ResourceException exception)
Sets if failure values should be returned instead of throwing a ResourceException and allows to set the exception
that will be thrown if exceptions are enabled. |
|
| Method Summary | |
|---|---|
boolean |
canHandle(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest,
javax.resource.cci.Record actualResponse)
Returns true if this implementor is enabled and
false otherwise. |
void |
disable()
Disables this implementor. |
void |
enable()
Enables this implementor. |
javax.resource.cci.Record |
execute(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest)
Throws a ResourceException or returns null. |
boolean |
execute(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest,
javax.resource.cci.Record actualResponse)
Throws a ResourceException or returns false. |
void |
setException(javax.resource.ResourceException exception)
Sets the exception that will be thrown if exceptions are enabled. |
void |
setThrowException(boolean throwException)
Sets if failure values should be returned instead of throwing a ResourceException. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public GenericFailureInteraction()
ResourceException.
public GenericFailureInteraction(boolean throwException)
ResourceException.
throwException - true thrown an exception,
false return failure values for execute
public GenericFailureInteraction(boolean throwException,
javax.resource.ResourceException exception)
ResourceException and allows to set the exception
that will be thrown if exceptions are enabled.
throwException - true thrown an exception,
false return failure values for executeexception - the exception to be thrown| Method Detail |
|---|
public void enable()
canHandle(InteractionSpec, Record, Record)
returns true, if this implementor is enabled.
public void disable()
canHandle(InteractionSpec, Record, Record)
returns false, if this implementor is disabled.
public void setThrowException(boolean throwException)
ResourceException.
throwException - true thrown an exception,
false return failure values for executepublic void setException(javax.resource.ResourceException exception)
exception - the exception to be thrown
public boolean canHandle(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest,
javax.resource.cci.Record actualResponse)
true if this implementor is enabled and
false otherwise.
canHandle in interface InteractionImplementorinteractionSpec - the InteractionSpec for the actual callactualRequest - the request for the actual callactualResponse - the response for the actual call, may be null
true if this implementor will handle the request and
will return the specified response, false otherwise
public boolean execute(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest,
javax.resource.cci.Record actualResponse)
throws javax.resource.ResourceException
ResourceException or returns false.
You can use setThrowException(boolean) to configure this
behaviour.
execute in interface InteractionImplementorinteractionSpec - the interaction specactualRequest - the actual requestactualResponse - the actual response
true under normal conditions
javax.resource.ResourceException
public javax.resource.cci.Record execute(javax.resource.cci.InteractionSpec interactionSpec,
javax.resource.cci.Record actualRequest)
throws javax.resource.ResourceException
ResourceException or returns null.
You can use setThrowException(boolean) to configure this
behaviour.
execute in interface InteractionImplementorinteractionSpec - the interaction specactualRequest - the actual request
javax.resource.ResourceException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||