|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | CONSTR | METHOD | DETAIL: FIELD | PROPERTY | CONSTR | METHOD |
java.lang.Objectbetamax.Recorder
class Recorder extends java.lang.Object
This is the main interface to the Betamax proxy. It allows control of Betamax configuration and inserting and ejecting `Tape` instances. The class can also be used as a _JUnit @Rule_ allowing tests annotated with `@Betamax` to run with the Betamax HTTP proxy in the background.
Field Summary | |
---|---|
static int |
DEFAULT_PROXY_PORT
|
static int |
DEFAULT_PROXY_TIMEOUT
|
static java.lang.String |
DEFAULT_TAPE_ROOT
|
Property Summary | |
---|---|
TapeMode |
defaultMode
The default mode for an inserted tape. |
int |
proxyPort
The port the Betamax proxy will listen on. |
int |
proxyTimeout
The time the proxy will wait before aborting a request in milliseconds. |
java.io.File |
tapeRoot
The base directory where tape files are stored. |
Constructor Summary | |
Recorder()
|
|
Recorder(java.util.Properties properties)
|
Method Summary | |
---|---|
org.junit.runners.model.Statement
|
apply(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method, java.lang.Object target)
|
void
|
ejectTape()
'Ejects' the current _tape_, writing its content to file. |
Tape
|
getTape()
Gets the current active _tape_. |
void
|
insertTape(java.lang.String name, java.util.Map arguments = [:])
Inserts a tape either creating a new one or loading an existing file from `tapeRoot`. |
void
|
overrideProxySettings()
|
void
|
restoreOriginalProxySettings()
|
java.lang.Object
|
withTape(java.lang.String name, groovy.lang.Closure closure)
Runs the supplied closure after starting the Betamax proxy and inserting a _tape_. |
java.lang.Object
|
withTape(java.lang.String tapeName, java.util.Map arguments, groovy.lang.Closure closure)
Runs the supplied closure after starting the Betamax proxy and inserting a _tape_. |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Field Detail |
---|
public static final int DEFAULT_PROXY_PORT
public static final int DEFAULT_PROXY_TIMEOUT
public static final java.lang.String DEFAULT_TAPE_ROOT
Property Detail |
---|
TapeMode defaultMode
int proxyPort
int proxyTimeout
java.io.File tapeRoot
Constructor Detail |
---|
Recorder()
Recorder(java.util.Properties properties)
Method Detail |
---|
org.junit.runners.model.Statement apply(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method, java.lang.Object target)
void ejectTape()
Tape getTape()
void insertTape(java.lang.String name, java.util.Map arguments = [:])
name
- the name of the _tape_.arguments
- customize the behaviour of the tape.
void overrideProxySettings()
void restoreOriginalProxySettings()
java.lang.Object withTape(java.lang.String name, groovy.lang.Closure closure)
name
- the name of the _tape_.closure
- the closure to execute.
java.lang.Object withTape(java.lang.String tapeName, java.util.Map arguments, groovy.lang.Closure closure)
tapeName
- the name of the _tape_.arguments
- arguments that affect the operation of the proxy.closure
- the closure to execute.
Groovy Documentation