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.PluginCommand
,ConcurrentTestCommandScript.PrepareCommand
,ConcurrentTestCommandScript.PrintCommand
,ConcurrentTestCommandScript.SelectCommand
,ConcurrentTestCommandScript.ShellCommand
,ConcurrentTestCommandScript.SqlCommand
public interface ConcurrentTestCommand
ConcurrentTestCommand represents a command, sequentially executed byConcurrentTestCommandExecutor
, during a concurrency testConcurrentTestCommand instances are normally instantiated by the
ConcurrentTestCommandGenerator
class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ConcurrentTestCommand.ShouldHaveFailedException
Indicates that a command should have failed, but instead succeeded, which is a test error
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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(java.lang.String comment, java.lang.String pattern)
Marks a command to show that it is expected to fail, and indicates how.
-
-
-
Method Detail
-
execute
void execute(ConcurrentTestCommandExecutor exec) throws java.lang.Exception
Executes this command. The ConcurrentTestCommandExecutor provides access to a JDBC connection and previously prepared statements.- Parameters:
exec
- the ConcurrentTestCommandExecutor firing this command.- Throws:
java.lang.Exception
- to indicate a test failure- See Also:
ConcurrentTestCommandExecutor.getStatement()
,ConcurrentTestCommandExecutor.setStatement(java.sql.Statement)
-
markToFail
ConcurrentTestCommand markToFail(java.lang.String comment, java.lang.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).- Parameters:
comment
- a brief description of the expected errorpattern
- null, or a regular expression that matches the expected error message.
-
isFailureExpected
boolean isFailureExpected()
Returns true if the command should fail. This allows special error handling for expected failures that don't have patterns.- Returns:
- true if command is expected to fail
-
markToFail
ConcurrentTestCommand markToFail()
Set this command to expect a patternless failure.
-
-