Interface ConcurrentTestCommand

All Known Implementing Classes:
ConcurrentTestCommandGenerator.AbstractCommand, ConcurrentTestCommandGenerator.AutoSynchronizationCommand, ConcurrentTestCommandGenerator.CloseCommand, ConcurrentTestCommandGenerator.CommandWithTimeout, ConcurrentTestCommandGenerator.CommitCommand, ConcurrentTestCommandGenerator.DdlCommand, ConcurrentTestCommandGenerator.ExplainCommand, ConcurrentTestCommandGenerator.FetchAndCompareCommand, ConcurrentTestCommandGenerator.InsertCommand, ConcurrentTestCommandGenerator.PrepareCommand, ConcurrentTestCommandGenerator.RollbackCommand, ConcurrentTestCommandGenerator.SleepCommand, ConcurrentTestCommandGenerator.SynchronizationCommand, ConcurrentTestCommandScript.CommandWithTimeout, ConcurrentTestCommandScript.CommandWithTimeoutAndRowLimit, ConcurrentTestCommandScript.EchoCommand, ConcurrentTestCommandScript.FetchAndPrintCommand, ConcurrentTestCommandScript.PrepareCommand, ConcurrentTestCommandScript.PrintCommand, ConcurrentTestCommandScript.SelectCommand, ConcurrentTestCommandScript.ShellCommand, ConcurrentTestCommandScript.SqlCommand

public interface ConcurrentTestCommand

ConcurrentTestCommand represents a command, sequentially executed by ConcurrentTestCommandExecutor, during a concurrency test

ConcurrentTestCommand instances are normally instantiated by the ConcurrentTestCommandGenerator class.

$Id: //open/dev/farrago/src/org/eigenbase/test/concurrent/ $
Stephan Zuercher

Nested Class Summary
static class ConcurrentTestCommand.ShouldHaveFailedException
          Indicates that a command should have failed, but instead succeeded, which is a test error
Method Summary
 void execute(ConcurrentTestCommandExecutor exec)
          Executes this command.
 boolean isFailureExpected()
          Returns true if the command should fail.
 ConcurrentTestCommand markToFail()
          Set this command to expect a patternless failure.
 ConcurrentTestCommand markToFail(String comment, String pattern)
          Marks a command to show that it is expected to fail, and indicates how.

Method Detail


void execute(ConcurrentTestCommandExecutor exec)
             throws Exception
Executes this command. The ConcurrentTestCommandExecutor provides access to a JDBC connection and previously prepared statements.

exec - the ConcurrentTestCommandExecutor firing this command.
ConcurrentTestCommand.ShouldHaveFailedException - to indicate a test failure
See Also:
ConcurrentTestCommandExecutor.getStatement(), ConcurrentTestCommandExecutor.setStatement(java.sql.Statement)


ConcurrentTestCommand markToFail(String comment,
                                 String pattern)
Marks a command to show that it is expected to fail, and indicates how. Used for negative tests. Normally when a command fails the embracing test fails. But when a marked command fails, the error is caught and inspected: if it matches the expected error, the test continues. However if it does not match, if another kind of exception is thrown, or if no exception is caught, then the test fails. Assumes the error is indicated by a java.sql.SQLException. Optionally checks for the expected error condition by matching the error message against a regular expression. (Scans the list of chained SQLExceptions).

comment - a brief description of the expected error
pattern - null, or a regular expression that matches the expected error message.


boolean isFailureExpected()
Returns true if the command should fail. This allows special error handling for expected failures that don't have patterns.

true if command is expected to fail


ConcurrentTestCommand markToFail()
Set this command to expect a patternless failure.