org.openware.loadsim.link
Class LinkData

java.lang.Object
  |
  +--org.openware.loadsim.link.LinkData
All Implemented Interfaces:
java.io.Serializable

public class LinkData
extends java.lang.Object
implements java.io.Serializable

Each Link object is comprised of 2 parts:

  1. The URI of the link (where to go), and
  2. The data to send.
The data is either represented by a query string, in the case of an anchor tag (link) or form data in the case of a form submit. The LinkData stores the information needed to recreate this data during the simulation.

There are 2 ways LinkData objects are created:

  1. In the configuration file for the simulation. This is read in prior to starting the simulation and allows the test person to specify what link data is constant, will come from the downloaded page, or from a dataset (also defined in the configuration file).
  2. As alluded to above, some of the data for a link can come from the just downloaded page (the page downloaded by the previous link). So, the other way that a LinkData object can be created is from a link in the page.
When present, a LinkData object created from the information on the downloaded page is compared to the LinkData object for the next link in the sequence of links that defines the simulation. When a match is found the data from the page is substituted into the data from the link defined in the configuration file. In this way, the simulation will get all of the correct data before sending it to the webserver.

The Link class is configured with the following subsection of the simulation DTD:

     <!ELEMENT data (name, value) >
 

Author:
Vincent Sheffer
See Also:
Link, Serialized Form

Constructor Summary
LinkData(Config config, org.w3c.dom.Node node, java.lang.String sepChar)
           
 
Method Summary
 void advanceDataSets()
          Advance all of the datasets for this link to the next value.
static LinkData createFromQueryString(java.lang.String dataStr, java.lang.String sepChar)
          Create a LinkData object from a query string present in the downloaded page.
static LinkData createFromWebLink(com.meterware.httpunit.WebLink wl)
           
 LinkData deepCopy()
           
 boolean equalsQSData(LinkData otherData)
          Compare this LinkData object to one the data of which comes from a querystring of a link in a downloaded page.
 java.util.Iterator getData()
           
 java.lang.String getPathQSSepartor()
          The path querystring separator is the separator character for LinkDatum for the LinkData.
 java.lang.String getSeparatorChar()
           
 boolean hasPageData()
           
static void main(java.lang.String[] args)
           
 void setDataSets(java.util.HashMap datasets)
          For each DataSetLinkDatum object set the DataSets.
 void setValue(java.lang.String name, java.lang.String value)
          Set the value for a particular link datum (either querystring or form data).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LinkData

public LinkData(Config config,
                org.w3c.dom.Node node,
                java.lang.String sepChar)
         throws ConfigException
Method Detail

createFromWebLink

public static LinkData createFromWebLink(com.meterware.httpunit.WebLink wl)

createFromQueryString

public static LinkData createFromQueryString(java.lang.String dataStr,
                                             java.lang.String sepChar)
Create a LinkData object from a query string present in the downloaded page.
Parameters:
queryStr - The query string. This is just the part of the query string that contains the data that will be contained in the LinkData object.
sepChar - The character that separates the data.
Returns:
The newly created LinkData object.

getSeparatorChar

public java.lang.String getSeparatorChar()

hasPageData

public boolean hasPageData()

setValue

public void setValue(java.lang.String name,
                     java.lang.String value)
Set the value for a particular link datum (either querystring or form data).

setDataSets

public void setDataSets(java.util.HashMap datasets)
For each DataSetLinkDatum object set the DataSets. It takes a HashMap of datasets that are visible to the entire simulation and adds it to the link. In this way the datasets will be advanced correctly.
Parameters:
datasets - The DataSet objects that are available for the entire simulation.

deepCopy

public LinkData deepCopy()

getPathQSSepartor

public java.lang.String getPathQSSepartor()
The path querystring separator is the separator character for LinkDatum for the LinkData.
Parameters:
String - The character that separates the pathroot from the query string.

equalsQSData

public boolean equalsQSData(LinkData otherData)
Compare this LinkData object to one the data of which comes from a querystring of a link in a downloaded page.
Parameters:
otherData - The LinkData created from the query string.
Returns:
true if the 2 are equal.

advanceDataSets

public void advanceDataSets()
Advance all of the datasets for this link to the next value. Doing this once, before the link is accessed, allows for the same dataset to be used by the same link more than once.

getData

public java.util.Iterator getData()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception


Copyright © 2000, 2001 Openware, Spin Software. All Rights Reserved.