Class CookieManager
- All Implemented Interfaces:
Serializable
,Cloneable
,ConfigElement
,Searchable
,org.apache.jmeter.testelement.TestElement
,TestIterationListener
,TestStateListener
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.jmeter.testelement.TestElement
org.apache.jmeter.testelement.TestElement.Companion
-
Field Summary
Fields inherited from class org.apache.jmeter.config.ConfigTestElement
PASSWORD, USERNAME
Fields inherited from interface org.apache.jmeter.testelement.TestElement
COMMENTS, Companion, ENABLED, GUI_CLASS, NAME, TEST_CLASS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a cookie.void
addCookieFromHeader
(String cookieHeader, URL url) void
Add cookie data from a file.void
clear()
clone()
get
(int i) Return the cookie at index i.boolean
boolean
int
getCookieHeaderForURL
(URL url) Find cookies applicable to the given URL and build the Cookie header from them.void
void
remove
(int index) Remove a cookie.void
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
Called once for all threads after the end of a test.void
Called once for all threads after the end of a test.void
Each time through a Thread Group's test script, an iteration event is fired for each thread.void
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.Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addConfigElement, addTestElement, expectsModification, getProps, getSchema
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getPropertyOrNull, 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
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.jmeter.testelement.TestElement
get, get, get, get, get, get, get, get, get, getOrCreate, getOrCreate, getOrNull, getOrNull, getOrNull, getPropertyOrNull, getString, removed, removeProperty, set, set, set, set, set, set, set, set, set
-
Constructor Details
-
CookieManager
public CookieManager()
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceConfigElement
- Specified by:
clone
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
clone
in classAbstractTestElement
-
getPolicy
-
setCookiePolicy
-
getCookies
-
getCookieCount
public int getCookieCount() -
getClearEachIteration
public boolean getClearEachIteration() -
setClearEachIteration
public void setClearEachIteration(boolean clear) -
getControlledByThread
public boolean getControlledByThread() -
setControlledByThread
public void setControlledByThread(boolean control) -
getImplementation
-
setImplementation
-
save
Save the static cookie data to a file.Cookies are only taken from the GUI - runtime cookies are not included.
- Parameters:
authFile
- name of the file to store the cookies into. If the name is relative, the system propertyuser.dir
will be prepended- Throws:
IOException
- when writing to that file fails
-
addFile
Add cookie data from a file.- Parameters:
cookieFile
- name of the file to read the cookies from. If the name is relative, the system propertyuser.dir
will be prepended- Throws:
IOException
- if reading the file fails
-
recoverRunningVersion
public void recoverRunningVersion()- Specified by:
recoverRunningVersion
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
recoverRunningVersion
in classAbstractTestElement
-
setRunningVersion
public void setRunningVersion(boolean running) Sets the runningVersion.- Specified by:
setRunningVersion
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
setRunningVersion
in classAbstractTestElement
- Parameters:
running
- the runningVersion to set
-
add
Add a cookie.- Parameters:
c
- cookie to be added
-
clear
public void clear()- Specified by:
clear
in interfaceorg.apache.jmeter.testelement.TestElement
- Overrides:
clear
in classAbstractTestElement
-
remove
public void remove(int index) Remove a cookie.- Parameters:
index
- index of the cookie to remove
-
get
Return the cookie at index i.- Parameters:
i
- index of the cookie to get- Returns:
- cookie at index
i
-
getCookieHeaderForURL
Find cookies applicable to the given URL and build the Cookie header from them.- Parameters:
url
- URL of the request to which the returned header will be added.- Returns:
- the value string for the cookie header (goes after "Cookie: ").
-
addCookieFromHeader
-
testStarted
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.
- Specified by:
testStarted
in interfaceTestStateListener
- See Also:
-
testEnded
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.
- Specified by:
testEnded
in interfaceTestStateListener
- See Also:
-
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.
- Specified by:
testStarted
in interfaceTestStateListener
- Parameters:
host
- name of host- See Also:
-
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.
- Specified by:
testEnded
in interfaceTestStateListener
- Parameters:
host
- name of host- See Also:
-
testIterationStart
Each time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.- Specified by:
testIterationStart
in interfaceTestIterationListener
- Parameters:
event
- the iteration event
-