public class CookieManager extends ConfigTestElement implements TestStateListener, TestIterationListener, Serializable
PASSWORD, USERNAME
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS
Constructor and Description |
---|
CookieManager() |
Modifier and Type | Method and Description |
---|---|
void |
add(Cookie c)
Add a cookie.
|
void |
addCookieFromHeader(String cookieHeader,
URL url) |
void |
addFile(String cookieFile)
Add cookie data from a file.
|
void |
clear()
Clear the TestElement of all data.
|
Object |
clone() |
Cookie |
get(int i)
Return the cookie at index i.
|
boolean |
getClearEachIteration() |
boolean |
getControlledByThread() |
int |
getCookieCount() |
String |
getCookieHeaderForURL(URL url)
Find cookies applicable to the given URL and build the Cookie header from
them.
|
CollectionProperty |
getCookies() |
String |
getImplementation() |
String |
getPolicy() |
void |
recoverRunningVersion()
Tells the test element to return to the state it was in when
setRunningVersion(true) was called.
|
void |
remove(int index)
Remove a cookie.
|
void |
save(String authFile)
Save the static cookie data to a file.
|
void |
setClearEachIteration(boolean clear) |
void |
setControlledByThread(boolean control) |
void |
setCookiePolicy(String policy) |
void |
setImplementation(String implementation) |
void |
setRunningVersion(boolean running)
Sets the runningVersion.
|
void |
testEnded()
Called once for all threads after the end of a test.
|
void |
testEnded(String host)
Called once for all threads after the end of a test.
|
void |
testIterationStart(LoopIterationEvent event)
Each time through a Thread Group's test script, an iteration event is
fired for each thread.
|
void |
testStarted()
Called just before the start of the test from the main engine thread.
|
void |
testStarted(String host)
Called just before the start of the test from the main engine thread.
|
addConfigElement, addTestElement, expectsModification
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traverseProperty
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
removed
public Object clone()
clone
in interface ConfigElement
clone
in interface TestElement
clone
in class AbstractTestElement
public String getPolicy()
public void setCookiePolicy(String policy)
public CollectionProperty getCookies()
public int getCookieCount()
public boolean getClearEachIteration()
public void setClearEachIteration(boolean clear)
public boolean getControlledByThread()
public void setControlledByThread(boolean control)
public String getImplementation()
public void setImplementation(String implementation)
public void save(String authFile) throws IOException
Cookies are only taken from the GUI - runtime cookies are not included.
authFile
- name of the file to store the cookies into. If the name is
relative, the system property user.dir
will be
prependedIOException
- when writing to that file failspublic void addFile(String cookieFile) throws IOException
cookieFile
- name of the file to read the cookies from. If the name is
relative, the system property user.dir
will be
prependedIOException
- if reading the file failspublic void recoverRunningVersion()
recoverRunningVersion
in interface TestElement
recoverRunningVersion
in class AbstractTestElement
public void setRunningVersion(boolean running)
setRunningVersion
in interface TestElement
setRunningVersion
in class AbstractTestElement
running
- the runningVersion to setpublic void add(Cookie c)
c
- cookie to be addedpublic void clear()
clear
in interface TestElement
clear
in class AbstractTestElement
public void remove(int index)
index
- index of the cookie to removepublic Cookie get(int i)
i
- index of the cookie to geti
public String getCookieHeaderForURL(URL url)
url
- URL of the request to which the returned header will be added.public void testStarted()
Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
testStarted
in interface TestStateListener
StandardJMeterEngine.run()
public void testEnded()
Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
testEnded
in interface TestStateListener
StandardJMeterEngine.stopTest()
public void testStarted(String host)
Called just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
testStarted
in interface TestStateListener
host
- name of hostStandardJMeterEngine.run()
public void testEnded(String host)
Called once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
testEnded
in interface TestStateListener
host
- name of hostStandardJMeterEngine.stopTest()
public void testIterationStart(LoopIterationEvent event)
testIterationStart
in interface TestIterationListener
event
- the iteration eventCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.