Apache JMeter
2.0.1.20050615

org.apache.jmeter.protocol.http.control
Class AuthManager

java.lang.Object
  extended byorg.apache.jmeter.testelement.AbstractTestElement
      extended byorg.apache.jmeter.config.ConfigTestElement
          extended byorg.apache.jmeter.protocol.http.control.AuthManager
All Implemented Interfaces:
Cloneable, ConfigElement, Serializable, TestElement

public class AuthManager
extends ConfigTestElement
implements ConfigElement, Serializable

This class provides a way to provide Authorization in jmeter requests. The format of the authorization file is: URL user pass where URL is an HTTP URL, user a username to use and pass the appropriate password.

Version:
$Revision: 1.11.2.2 $
Author:
Raphael Luta
See Also:
Serialized Form

Nested Class Summary
static class AuthManager.Test
           
 
Field Summary
 
Fields inherited from class org.apache.jmeter.config.ConfigTestElement
PASSWORD, USERNAME
 
Fields inherited from interface org.apache.jmeter.testelement.TestElement
ENABLED, GUI_CLASS, NAME, TEST_CLASS
 
Constructor Summary
AuthManager()
          Default Constructor.
 
Method Summary
 void addAuth()
           
 void addAuth(Authorization auth)
           
 void addConfigElement(ConfigElement config)
          Add a configuration element to this one.
 void addFile(String authFile)
          Add authentication data from a file.
 void clear()
          Clear the TestElement of all data.
 boolean expectsModification()
          If your config element expects to be modified in the process of a test run, and you want those modifications to carry over from sample to sample (as in a cookie manager - you want to save all cookies that get set throughout the test), then return true for this method.
 Authorization get(int i)
          Return the record at index i
 Collection getAddList()
           
 Authorization getAuthForURL(URL url)
           
 String getAuthHeaderForURL(URL url)
           
 Authorization getAuthObjectAt(int row)
           
 CollectionProperty getAuthObjects()
           
 String getClassLabel()
           
 Class getColumnClass(int column)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 Class getGuiClass()
           
 String getName()
           
 boolean isEditable()
           
 void remove(int index)
          Remove an authentication record.
 void save(String authFile)
          Save the authentication data to a file.
 void set(int index, String url, String user, String pass)
          Update an authentication record.
 void setName(String newName)
           
 int size()
          Return the number of records.
 void uncompile()
           
 
Methods inherited from class org.apache.jmeter.config.ConfigTestElement
addTestElement
 
Methods inherited from class org.apache.jmeter.testelement.AbstractTestElement
addProperty, canRemove, clearTemporary, clone, emptyTemporary, equals, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsLong, getPropertyAsString, getThreadContext, getThreadName, isRunningVersion, isTemporary, logProperties, mergeIn, nextIsNull, propertyIterator, recoverRunningVersion, removeProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, threadFinished, threadStarted, traverse, traverseCollection, traverseMap, traverseProperty
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.jmeter.config.ConfigElement
clone
 

Constructor Detail

AuthManager

public AuthManager()
Default Constructor.

Method Detail

clear

public void clear()
Description copied from interface: TestElement
Clear the TestElement of all data.

Specified by:
clear in interface TestElement
Overrides:
clear in class AbstractTestElement

set

public void set(int index,
                String url,
                String user,
                String pass)
Update an authentication record.


setName

public void setName(String newName)
Overrides:
setName in class AbstractTestElement

getAuthObjects

public CollectionProperty getAuthObjects()

getColumnCount

public int getColumnCount()

getColumnName

public String getColumnName(int column)

getColumnClass

public Class getColumnClass(int column)

getAuthObjectAt

public Authorization getAuthObjectAt(int row)

isEditable

public boolean isEditable()

getClassLabel

public String getClassLabel()

getGuiClass

public Class getGuiClass()

getAddList

public Collection getAddList()

get

public Authorization get(int i)
Return the record at index i


getAuthHeaderForURL

public String getAuthHeaderForURL(URL url)

getAuthForURL

public Authorization getAuthForURL(URL url)

getName

public String getName()
Overrides:
getName in class AbstractTestElement

addConfigElement

public void addConfigElement(ConfigElement config)
Description copied from interface: ConfigElement
Add a configuration element to this one. This allows config elements to combine and give a "layered" effect. For example, HTTPConfigElements have properties for domain, path, method, and parameters. If element A has everything filled in, but null for domain, and element B is added, which has only domain filled in, then after adding B to A, A will have the domain from B. If A already had a domain, then the correct behavior is for A to ignore the addition of element B.

Specified by:
addConfigElement in interface ConfigElement
Parameters:
config - the element to be added to this ConfigElement

addAuth

public void addAuth(Authorization auth)

addAuth

public void addAuth()

expectsModification

public boolean expectsModification()
Description copied from interface: ConfigElement
If your config element expects to be modified in the process of a test run, and you want those modifications to carry over from sample to sample (as in a cookie manager - you want to save all cookies that get set throughout the test), then return true for this method. Your config element will not be cloned for each sample. If your config elements are more static in nature, return false. If in doubt, return false.

Specified by:
expectsModification in interface ConfigElement
Returns:
true if the element expects to be modified over the course of a test run

uncompile

public void uncompile()

save

public void save(String authFile)
          throws IOException
Save the authentication data to a file.

Throws:
IOException

addFile

public void addFile(String authFile)
             throws IOException
Add authentication data from a file.

Throws:
IOException

remove

public void remove(int index)
Remove an authentication record.


size

public int size()
Return the number of records.


Apache JMeter
2.0.1.20050615

Copyright © 1998-2005 Apache Software Foundation. All Rights Reserved.