You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by ms...@apache.org on 2002/04/26 02:03:58 UTC
cvs commit: jakarta-jmeter/src_1/org/apache/jmeter/visualizers/gui AbstractVisualizer.java
mstover1 02/04/25 17:03:58
Modified: src_1/org/apache/jmeter/assertions Assertion.java
AssertionResult.java
src_1/org/apache/jmeter/assertions/gui AssertionGui.java
src_1/org/apache/jmeter/gui NamePanel.java
src_1/org/apache/jmeter/gui/action Clear.java Remove.java
src_1/org/apache/jmeter/junit/protocol/http/parser
HtmlParserTester.java
src_1/org/apache/jmeter/protocol/ftp/sampler FTPSampler.java
src_1/org/apache/jmeter/protocol/http/config UrlConfig.java
src_1/org/apache/jmeter/protocol/http/config/gui
MultipartUrlConfigGui.java UrlConfigGui.java
src_1/org/apache/jmeter/protocol/http/control/gui
HttpTestSampleGui.java
src_1/org/apache/jmeter/protocol/http/modifier
AnchorModifier.java
src_1/org/apache/jmeter/protocol/http/parser HtmlParser.java
src_1/org/apache/jmeter/protocol/http/proxy
HttpRequestHdr.java Proxy.java
src_1/org/apache/jmeter/protocol/http/sampler
HTTPSampler.java HTTPSamplerFull.java
MultipartFormSamplerFull.java
src_1/org/apache/jmeter/protocol/jdbc/sampler
JDBCSampler.java
src_1/org/apache/jmeter/protocol/jdbc/util Data.java
src_1/org/apache/jmeter/reporters MailerResultCollector.java
ResultCollector.java
src_1/org/apache/jmeter/resources messages.properties
src_1/org/apache/jmeter/samplers SampleResult.java
src_1/org/apache/jmeter/save SaveService.java
src_1/org/apache/jmeter/threads JMeterThread.java
src_1/org/apache/jmeter/visualizers AssertionVisualizer.java
GraphAccum.java GraphAccumModel.java
MailerVisualizer.java StatVisualizerModel.java
TableDataModel.java TreeVisualizer.java
ViewResultsFullVisualizer.java
ViewResultsVisualizer.java
src_1/org/apache/jmeter/visualizers/gui
AbstractVisualizer.java
Added: src_1/org/apache/jmeter/gui/util FilePanel.java
Removed: src_1/org/apache/jmeter/reporters Filer.java
ResultCollectorIndGraph.java
src_1/org/apache/jmeter/samplers HttpSampleResult.java
src_1/org/apache/jmeter/visualizers FileVisualizer.java
IndGraphTreeVisualizer.java
Log:
Making SampleResult an Avalon Configuration object
Revision Changes Path
1.2 +13 -11 jakarta-jmeter/src_1/org/apache/jmeter/assertions/Assertion.java
Index: Assertion.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/assertions/Assertion.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Assertion.java 19 Apr 2002 02:31:46 -0000 1.1
+++ Assertion.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -68,7 +68,7 @@
* Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:31:46 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***********************************************************/
@@ -78,6 +78,8 @@
public final static String TEST_FIELD = "Assertion.test_field";
public final static String TEST_TYPE = "Assertion.test_type";
public final static String TEST_STRINGS = "Asserion.test_strings";
+ public final static String SAMPLE_LABEL = "Assertion.sample_label";
+ public final static String RESPONSE_DATA = "Assertion.response_data";
private String notMessage = "";
@@ -176,11 +178,11 @@
public AssertionResult getResult(SampleResult response)
{
AssertionResult result;
- if (!response.isSuccessfull())
+ if (!response.isSuccessful())
{
result = new AssertionResult();
result.setError(true);
- result.setFailureMessage(new String((byte[])response.getValue(SampleResult.TEXT_RESPONSE)));
+ result.setFailureMessage(new String((byte[])response.getResponseData()));
return result;
}
result = evaluateResponse(response);
@@ -280,17 +282,17 @@
String pattern = (String)iter.next();
if ((CONTAINS & getTestType()) > 0)
{
- pass = pass && (not ? !matcher.contains(new String((byte[])response.getValue(
- SampleResult.TEXT_RESPONSE)), compiler.compile(pattern)) :
- matcher.contains(new String((byte[])response.getValue(
- SampleResult.TEXT_RESPONSE)), compiler.compile(pattern)));
+ pass = pass && (not ? !matcher.contains(new String(response.getResponseData()),
+ compiler.compile(pattern)) :
+ matcher.contains(new String(response.getResponseData()),
+ compiler.compile(pattern)));
}
else
{
- pass = pass && (not ? !matcher.matches(new String((byte[])response.getValue(
- SampleResult.TEXT_RESPONSE)), compiler.compile(pattern)) :
- matcher.matches(new String((byte[])response.getValue(
- SampleResult.TEXT_RESPONSE)), compiler.compile(pattern)));
+ pass = pass && (not ? !matcher.matches(new String(response.getResponseData()),
+ compiler.compile(pattern)) :
+ matcher.matches(new String(response.getResponseData()),
+ compiler.compile(pattern)));
}
if (!pass)
{
1.2 +5 -1 jakarta-jmeter/src_1/org/apache/jmeter/assertions/AssertionResult.java
Index: AssertionResult.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/assertions/AssertionResult.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AssertionResult.java 19 Apr 2002 02:31:46 -0000 1.1
+++ AssertionResult.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -57,6 +57,8 @@
import java.io.*;
+import org.apache.avalon.framework.configuration.*;
+
/**
* Title: Jakarta-JMeter
* Description:
@@ -66,14 +68,16 @@
* @version 1.0
*/
-public class AssertionResult implements Serializable {
+public class AssertionResult extends DefaultConfiguration implements Serializable {
+ public final static String TAG_NAME = "assertionResult";
private boolean failure;
private boolean error;
private String failureMessage;
public AssertionResult()
{
+ super(TAG_NAME,"org.apache.jmeter.assertion.AssertionResult");
}
public boolean isFailure()
1.2 +16 -16 jakarta-jmeter/src_1/org/apache/jmeter/assertions/gui/AssertionGui.java
Index: AssertionGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/assertions/gui/AssertionGui.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AssertionGui.java 19 Apr 2002 02:31:47 -0000 1.1
+++ AssertionGui.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -73,7 +73,7 @@
* Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:31:47 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***************************************/
@@ -104,11 +104,11 @@
configureTestElement(el);
if(labelButton.isSelected())
{
- el.setTestField(SampleResult.SAMPLE_LABEL);
+ el.setTestField(Assertion.SAMPLE_LABEL);
}
else
{
- el.setTestField(SampleResult.TEXT_RESPONSE);
+ el.setTestField(Assertion.RESPONSE_DATA);
}
if(containsBox.isSelected())
{
@@ -157,7 +157,7 @@
notBox.setSelected(false);
}
- if(SampleResult.TEXT_RESPONSE.equals(model.getTestField()))
+ if(Assertion.RESPONSE_DATA.equals(model.getTestField()))
{
responseStringButton.setSelected(true);
labelButton.setSelected(false);
@@ -254,8 +254,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:31:47 $
- *@version $Revision: 1.1 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.2 $
***************************************/
private class ClearPatternsListener implements ActionListener
{
@@ -274,8 +274,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:31:47 $
- *@version $Revision: 1.1 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.2 $
***************************************/
private class AddPatternListener implements ActionListener
{
@@ -296,8 +296,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:31:47 $
- *@version $Revision: 1.1 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.2 $
***************************************/
private class PatternRenderer extends DefaultListCellRenderer
{
@@ -352,8 +352,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:31:47 $
- *@version $Revision: 1.1 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.2 $
***************************************/
private class PatternListModel extends AbstractListModel
{
1.2 +2 -31 jakarta-jmeter/src_1/org/apache/jmeter/gui/NamePanel.java
Index: NamePanel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/gui/NamePanel.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- NamePanel.java 19 Apr 2002 02:28:18 -0000 1.1
+++ NamePanel.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -63,7 +63,7 @@
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:28:18 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***************************************/
@@ -71,7 +71,7 @@
{
private JTextField nameField = new JTextField(30);
- private JMeterComponentModel model;
+
/****************************************
* !ToDo (Constructor description)
@@ -83,16 +83,6 @@
}
/****************************************
- * !ToDo (Constructor description)
- *
- *@param model !ToDo (Parameter description)
- ***************************************/
- public NamePanel(Object model)
- {
- setModel(model);
- }
-
- /****************************************
* !ToDo (Method description)
*
*@param name !ToDo (Parameter description)
@@ -165,25 +155,6 @@
public String getName()
{
return nameField.getText();
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@param model !ToDo (Parameter description)
- ***************************************/
- public void setModel(Object model)
- {
- this.model = (JMeterComponentModel)model;
- init();
- }
-
- /****************************************
- * !ToDo (Method description)
- ***************************************/
- public void updateGui()
- {
- nameField.setText(model.getName());
}
private void init()
1.2 +2 -2 jakarta-jmeter/src_1/org/apache/jmeter/gui/action/Clear.java
Index: Clear.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/gui/action/Clear.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Clear.java 19 Apr 2002 02:28:18 -0000 1.1
+++ Clear.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -66,7 +66,7 @@
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:28:18 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***********************************************************/
@@ -105,7 +105,7 @@
GuiPackage guiPackage = GuiPackage.getInstance();
if (e.getActionCommand().equals(CLEAR))
{
- JMeterComponentModel model = (JMeterComponentModel)guiPackage.getTreeListener().getCurrentNode().getUserObject();
+ JMeterGUIComponent model = (JMeterGUIComponent)guiPackage.getTreeListener().getCurrentNode().getUserObject();
try
{
((Clearable)model).clear();
1.2 +118 -112 jakarta-jmeter/src_1/org/apache/jmeter/gui/action/Remove.java
Index: Remove.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/gui/action/Remove.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Remove.java 19 Apr 2002 02:28:18 -0000 1.1
+++ Remove.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -1,112 +1,118 @@
-/*
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache JMeter" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache JMeter", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.jmeter.gui.action;
-import java.awt.event.ActionEvent;
-import java.util.*;
-import org.apache.jmeter.gui.*;
-import org.apache.jmeter.gui.tree.*;
-import org.apache.jmeter.util.JMeterUtils;
-
-/****************************************
- * Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
- *
- *@author Michael Stover
- *@created October 5, 2001
- *@version 1.0
- ***************************************/
-
-public class Remove implements Command
-{
-
- private static Set commands = new HashSet();
- static
- {
- commands.add(JMeterUtils.getResString("remove"));
- }
-
- /****************************************
- * Constructor for the Remove object
- ***************************************/
- public Remove() { }
-
- /****************************************
- * Gets the ActionNames attribute of the Remove object
- *
- *@return The ActionNames value
- ***************************************/
- public Set getActionNames()
- {
- return commands;
- }
-
- /****************************************
- * Description of the Method
- *
- *@param e Description of Parameter
- ***************************************/
- public void doAction(ActionEvent e)
- {
- GuiPackage guiPackage = GuiPackage.getInstance();
- JMeterTreeNode[] nodes = guiPackage.getTreeListener().getSelectedNodes();
- guiPackage.getTreeListener().removedSelectedNode();
- for(int i = nodes.length - 1; i >= 0; i--)
- {
- guiPackage.getTreeModel().removeNodeFromParent(nodes[i]);
- }
- ActionRouter.getInstance().actionPerformed(new ActionEvent(e.getSource(),
- e.getID(), JMeterUtils.getResString("edit")));
-
- }
-}
+/*
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache JMeter" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache JMeter", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.jmeter.gui.action;
+
+import java.awt.event.ActionEvent;
+import java.util.*;
+
+import org.apache.jmeter.gui.tree.*;
+import org.apache.jmeter.gui.*;
+import org.apache.jmeter.testelement.WorkBench;
+import org.apache.jmeter.testelement.TestPlan;
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
+ *
+ *@author Michael Stover
+ *@created October 5, 2001
+ *@version 1.0
+ */
+
+public class Remove implements Command
+{
+
+ private static Set commands = new HashSet();
+
+ /**
+ * Constructor for the Remove object
+ */
+ public Remove()
+ {
+ }
+
+ /**
+ * Gets the ActionNames attribute of the Remove object
+ *
+ *@return The ActionNames value
+ */
+ public Set getActionNames()
+ {
+ return commands;
+ }
+
+ /**
+ * Description of the Method
+ *
+ *@param e Description of Parameter
+ */
+ public void doAction(ActionEvent e)
+ {
+ GuiPackage guiPackage = GuiPackage.getInstance();
+ JMeterTreeNode[] nodes = guiPackage.getTreeListener().getSelectedNodes();
+ guiPackage.getTreeListener().removedSelectedNode();
+ for (int i = nodes.length - 1; i >= 0; i--)
+ {
+ guiPackage.getTreeModel().removeNodeFromParent(nodes[i]);
+ }
+ ActionRouter.getInstance().actionPerformed(new ActionEvent(e.getSource(),
+ e.getID(), JMeterUtils.getResString("edit")));
+
+ }
+ static
+ {
+ commands.add(JMeterUtils.getResString("remove"));
+ }
+}
1.1 jakarta-jmeter/src_1/org/apache/jmeter/gui/util/FilePanel.java
Index: FilePanel.java
===================================================================
package org.apache.jmeter.gui.util;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import org.apache.jmeter.util.JMeterUtils;
/**
* Title: Jakarta JMeter Description: Copyright: Copyright (c) 2002 Company:
* Apache Software Foundation
*
*@author Michael Stover
*@created April 18, 2002
*@version 1.0
*/
public class FilePanel extends JPanel implements ActionListener
{
JTextField filename = new JTextField(30);
JLabel label = new JLabel(JMeterUtils.getResString("file_visualizer_filename"));
JButton browse = new JButton(JMeterUtils.getResString("browse"));
/**
* Constructor for the FilePanel object
*/
public FilePanel()
{
init();
}
/**
* Description of the Method
*/
private void init()
{
add(label);
add(filename);
add(browse);
browse.addActionListener(this);
}
/**
* Gets the filename attribute of the FilePanel object
*
*@return The filename value
*/
public String getFilename()
{
return filename.getText();
}
/**
* Sets the filename attribute of the FilePanel object
*
*@param f The new filename value
*/
public void setFilename(String f)
{
filename.setText(f);
}
/**
* Description of the Method
*
*@param e Description of the Parameter
*/
public void actionPerformed(ActionEvent e)
{
JFileChooser chooser = FileDialoger.promptToOpenFile();
if(chooser != null)
{
filename.setText(chooser.getSelectedFile().getPath());
}
}
}
1.3 +20 -21 jakarta-jmeter/src_1/org/apache/jmeter/junit/protocol/http/parser/HtmlParserTester.java
Index: HtmlParserTester.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/junit/protocol/http/parser/HtmlParserTester.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HtmlParserTester.java 24 Apr 2002 16:44:23 -0000 1.2
+++ HtmlParserTester.java 26 Apr 2002 00:03:55 -0000 1.3
@@ -1,13 +1,12 @@
package org.apache.jmeter.junit.protocol.http.parser;
-import java.net.*;
-
-import junit.framework.TestCase;
-import org.apache.jmeter.protocol.http.config.UrlConfig;
+import java.net.URL;
import org.apache.jmeter.protocol.http.modifier.AnchorModifier;
import org.apache.jmeter.protocol.http.sampler.HTTPSampler;
-import org.apache.jmeter.samplers.*;
+import org.apache.jmeter.samplers.SampleResult;
+
+import junit.framework.TestCase;
/************************************************************
* Title: Description: Copyright: Copyright (c) 2001 Company:
@@ -44,8 +43,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<a href=\"index.html\">Goto index page</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
assertEquals("http://www.apache.org:80/subdir/index.html",
config.getUrl().toString());
@@ -59,8 +58,8 @@
"<a href=\"/index.html\">Goto index page</a>hfdfjiudfjdfjkjfkdjf"+
"<b>bold text</b><a href=lowerdir/index.html>lower</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
assertTrue("http://www.apache.org:80/index.html".equals(newUrl)
@@ -76,8 +75,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org:80/home/index.html?param1=value1",newUrl);
@@ -90,8 +89,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<A HREF=\"index.html\">Goto index page</A></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org:80/subdir/index.html",newUrl);
@@ -104,8 +103,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<a href=\"../index.html\">Goto index page</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
assertEquals("http://www.apache.org:80/subdir/index.html",newUrl);
@@ -118,8 +117,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
assertEquals(config.getUrl().toString(),newUrl);
@@ -132,8 +131,8 @@
String responseText = "<html><head><title>Test page</title></head><body>" +
"<a href=\"/home/index.html?param1=value1\">Goto index page</a></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
String newUrl = config.getUrl().toString();
this.assertTrue(!"http://www.apache.org:80/home/index.html?param1=value1".equals(newUrl));
@@ -155,8 +154,8 @@
"<form action=\"index.html\" method=\"POST\"><input type=\"checkbox\" name=\"test\""+
" value=\"goto\">Goto index page</form></body></html>";
SampleResult result = new SampleResult();
- result.putValue(SampleResult.TEXT_RESPONSE,responseText.getBytes());
- result.putValue(HTTPSampler.URL,context);
+ result.setResponseData(responseText.getBytes());
+ result.setSampleLabel(context.toString());
parser.modifyEntry(config, result);
assertEquals("http://www.apache.org:80/subdir/index.html",
config.getUrl().toString());
1.2 +7 -7 jakarta-jmeter/src_1/org/apache/jmeter/protocol/ftp/sampler/FTPSampler.java
Index: FTPSampler.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/ftp/sampler/FTPSampler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FTPSampler.java 19 Apr 2002 02:18:11 -0000 1.1
+++ FTPSampler.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -68,8 +68,8 @@
* A sampler which understands FTP file requests
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:18:11 $
- *@version $Revision: 1.1 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.2 $
***********************************************************/
public class FTPSampler extends AbstractSampler
@@ -102,7 +102,7 @@
Statement stmt = null;
boolean isSuccessful = false;
FtpConfig ftpConfig = (FtpConfig)e.getConfigElement(FtpConfig.class);
- res.putValue(SampleResult.SAMPLE_LABEL,ftpConfig.getLabel());
+ res.setSampleLabel(ftpConfig.getLabel());
LoginConfig loginConfig = (LoginConfig)e.getConfigElement(LoginConfig.class);
long start = System.currentTimeMillis();
try
@@ -116,7 +116,7 @@
loginConfig.getPassword());
ftp.setPassive(true); // this should probably come from the setup dialog
String s = ftp.get(ftpConfig.getFilename());
- res.putValue(SampleResult.TEXT_RESPONSE,s.getBytes());
+ res.setResponseData(s.getBytes());
// set the response code here somewhere
ftp.disconnect();
isSuccessful = true;
@@ -127,11 +127,11 @@
// java.net.ConnectException -- 502 error code?
// in the future, possibly define and place error codes into the
// result so we know exactly what happened.
- res.putValue(SampleResult.TEXT_RESPONSE, cex.toString().getBytes());
+ res.setResponseData(cex.toString().getBytes());
}
catch (Exception ex) {
// general exception
- res.putValue(SampleResult.TEXT_RESPONSE, ex.toString().getBytes());
+ res.setResponseData(ex.toString().getBytes());
}
// Calculate response time
@@ -139,7 +139,7 @@
res.setTime(end - start);
// Set if we were successful or not
- res.putValue(SampleResult.SUCCESS, new Boolean(isSuccessful));
+ res.setSuccessful(isSuccessful);
return res;
}
1.3 +0 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/UrlConfig.java
Index: UrlConfig.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/UrlConfig.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- UrlConfig.java 24 Apr 2002 16:11:13 -0000 1.2
+++ UrlConfig.java 26 Apr 2002 00:03:55 -0000 1.3
@@ -72,8 +72,8 @@
* the value you specify here.
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:11:13 $
- *@version $Revision: 1.2 $
+ *@created $Date: 2002/04/26 00:03:55 $
+ *@version $Revision: 1.3 $
*/
public class UrlConfig extends AbstractTestElement implements Serializable
1.2 +0 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java
Index: MultipartUrlConfigGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- MultipartUrlConfigGui.java 24 Apr 2002 16:11:13 -0000 1.1
+++ MultipartUrlConfigGui.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -73,7 +73,7 @@
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:11:13 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***************************************/
1.2 +0 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java
Index: UrlConfigGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UrlConfigGui.java 24 Apr 2002 16:11:13 -0000 1.1
+++ UrlConfigGui.java 26 Apr 2002 00:03:55 -0000 1.2
@@ -73,7 +73,7 @@
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:11:13 $
+ *@created $Date: 2002/04/26 00:03:55 $
*@version 1.0
***************************************/
1.4 +0 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java
Index: HttpTestSampleGui.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpTestSampleGui.java 24 Apr 2002 16:11:13 -0000 1.3
+++ HttpTestSampleGui.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -72,7 +72,7 @@
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:11:13 $
+ *@created $Date: 2002/04/26 00:03:56 $
*@version 1.0
***************************************/
1.4 +3 -3 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java
Index: AnchorModifier.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/modifier/AnchorModifier.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- AnchorModifier.java 24 Apr 2002 16:44:23 -0000 1.3
+++ AnchorModifier.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -80,7 +80,7 @@
* Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:44:23 $
+ *@created $Date: 2002/04/26 00:03:56 $
*@version 1.0
***********************************************************/
@@ -116,7 +116,7 @@
sampler = (HTTPSampler)sam;
}
List potentialLinks = new ArrayList();
- String responseText = new String((byte[])result.getValue(SampleResult.TEXT_RESPONSE));
+ String responseText = new String(result.getResponseData());
Document html;
try
{
@@ -198,7 +198,7 @@
for(int x = 0;x < rootList.getLength();x++)
{
urls.addAll(HtmlParser.createURLFromForm(rootList.item(x),
- (URL)result.getValue(HTTPSampler.URL)));
+ (HTTPSampler)result.getSamplerData()));
}
Iterator iter = urls.iterator();
while (iter.hasNext())
@@ -234,7 +234,7 @@
String hrefStr = namedItem.getNodeValue();
try
{
- UrlConfig newUrl = HtmlParser.createUrlFromAnchor(hrefStr, (URL)result.getValue(HTTPSampler.URL));
+ UrlConfig newUrl = HtmlParser.createUrlFromAnchor(hrefStr, (HTTPSampler)result.getSamplerData());
newUrl.setMethod(HTTPSampler.GET);
if (HtmlParser.isAnchorMatched(newUrl, config))
{
1.3 +8 -8 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/parser/HtmlParser.java
Index: HtmlParser.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/parser/HtmlParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HtmlParser.java 19 Apr 2002 02:08:49 -0000 1.2
+++ HtmlParser.java 26 Apr 2002 00:03:56 -0000 1.3
@@ -278,10 +278,10 @@
*@return !ToDo (Return description)
*@exception MalformedURLException !ToDo (Exception description)
***************************************/
- public static UrlConfig createUrlFromAnchor(String parsedUrlString, URL context) throws MalformedURLException
+ public static UrlConfig createUrlFromAnchor(String parsedUrlString, HTTPSampler context) throws MalformedURLException
{
UrlConfig url = new UrlConfig();
- url.setDomain(context.getHost());
+ url.setDomain(context.getDomain());
url.setProtocol(context.getProtocol());
url.setPort(context.getPort());
@@ -289,7 +289,7 @@
// the file to obtain the path. In the source for JDK1.3.1, they determine the path to
// be from the start of the file up to the LAST question mark (if any).
String contextPath = null;
- String contextFile = context.getFile();
+ String contextFile = context.getPath();
int indexContextQuery = contextFile.lastIndexOf('?');
if(indexContextQuery != -1)
contextPath = contextFile.substring(0, indexContextQuery);
@@ -348,7 +348,7 @@
*@return !ToDo (Return description)
***************************************/
- public static List createURLFromForm(Node doc, URL context)
+ public static List createURLFromForm(Node doc, HTTPSampler context)
{
String selectName = null;
LinkedList urlConfigs = new LinkedList();
@@ -366,7 +366,7 @@
return urlConfigs;
}
- private static boolean recurseForm(Node tempNode, LinkedList urlConfigs, URL context,
+ private static boolean recurseForm(Node tempNode, LinkedList urlConfigs, HTTPSampler context,
String selectName, boolean inForm)
{
NamedNodeMap nodeAtts = tempNode.getAttributes();
@@ -478,8 +478,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:08:49 $
- *@version $Revision: 1.2 $
+ *@created $Date: 2002/04/26 00:03:56 $
+ *@version $Revision: 1.3 $
***************************************/
public static class Test extends TestCase
{
@@ -523,7 +523,7 @@
}
}
- private static UrlConfig createFormUrlConfig(Node tempNode, URL context) throws
+ private static UrlConfig createFormUrlConfig(Node tempNode, HTTPSampler context) throws
MalformedURLException
{
NamedNodeMap atts = tempNode.getAttributes();
1.4 +0 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java
Index: HttpRequestHdr.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HttpRequestHdr.java 24 Apr 2002 16:11:13 -0000 1.3
+++ HttpRequestHdr.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -22,8 +22,8 @@
* !ToDo (Class description)
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/24 16:11:13 $
- *@version $Revision: 1.3 $
+ *@created $Date: 2002/04/26 00:03:56 $
+ *@version $Revision: 1.4 $
***************************************/
public class HttpRequestHdr
{
1.4 +1 -1 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/Proxy.java
Index: Proxy.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/proxy/Proxy.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Proxy.java 24 Apr 2002 16:11:13 -0000 1.3
+++ Proxy.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -207,7 +207,7 @@
InstantiationException
{
SampleResult result = sampler.sample();
- return (byte[])result.getValue(SampleResult.TEXT_RESPONSE);
+ return result.getResponseData();
}
1.4 +26 -21 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java
Index: HTTPSampler.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/HTTPSampler.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HTTPSampler.java 24 Apr 2002 16:44:23 -0000 1.3
+++ HTTPSampler.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -71,23 +71,25 @@
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.samplers.AbstractSampler;
import org.apache.jmeter.samplers.Entry;
-import org.apache.jmeter.samplers.HttpSampleResult;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.samplers.Sampler;
import org.apache.jmeter.util.SSLManager;
import org.apache.log4j.Category;
import org.apache.jmeter.testelement.TestElement;
+import org.apache.avalon.framework.configuration.*;
/****************************************
* A sampler which understands all the parts necessary to read statistics about
* HTTP requests, including cookies and authentication.
*
*@author Michael Stover
- *@created $Date: 2002/04/24 16:44:23 $
- *@version $Revision: 1.3 $
+ *@created $Date: 2002/04/26 00:03:56 $
+ *@version $Revision: 1.4 $
***************************************/
public class HTTPSampler extends AbstractSampler
{
+ public final static String HEADERS = "headers";
+ public final static String HEADER = "header";
public final static String ARGUMENTS = "HTTPsampler.Arguments";
public final static String AUTH_MANAGER = "HTTPSampler.auth_manager";
@@ -447,12 +449,17 @@
***************************************/
protected void getResponseHeaders(HttpURLConnection conn, SampleResult res)
{
- HashMap hValues = new HashMap(20);
+ DefaultConfiguration headers = new DefaultConfiguration(HTTPSampler.HEADERS,
+ "org.apache.jmeter.protocol.http.samplers.HTTPSampler");
for(int i = 1; conn.getHeaderFieldKey(i) != null; i++)
{
- hValues.put(conn.getHeaderFieldKey(i), conn.getHeaderField(i));
+ DefaultConfiguration header = new DefaultConfiguration(HTTPSampler.HEADER,
+ "org.apache.jmeter.protocol.http.samplers.HTTPSampler");
+ header.setAttribute("name",conn.getHeaderFieldKey(i));
+ header.setValue(conn.getHeaderField(i));
}
- res.putValue(Sampler.HEADER, hValues);
+
+ res.addChild(headers);
}
/*
@@ -553,20 +560,20 @@
responseCode = ((HttpURLConnection)conn).getResponseCode();
errorLevel = responseCode / 100;
message = ((HttpURLConnection)conn).getResponseMessage();
- res.putValue(this.RESPONSE_CODE,
+ res.setAttribute(this.RESPONSE_CODE,
String.valueOf(responseCode));
- res.putValue(this.RESPONSE_MESSAGE,
+ res.setAttribute(this.RESPONSE_MESSAGE,
message);
}
catch(Exception e2)
{
- res.putValue(SampleResult.TEXT_RESPONSE, e2.toString().getBytes());
- res.putValue(this.RESPONSE_CODE,
+ res.setResponseData(e2.toString().getBytes());
+ res.setAttribute(this.RESPONSE_CODE,
NON_HTTP_RESPONSE_CODE);
- res.putValue(this.RESPONSE_MESSAGE,
+ res.setAttribute(this.RESPONSE_MESSAGE,
NON_HTTP_RESPONSE_MESSAGE);
res.setTime(System.currentTimeMillis() - time);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setSuccessful(false);
}
if(catClass.isDebugEnabled())
{
@@ -625,7 +632,7 @@
{
catClass.debug("Start : sample2");
long time;
- SampleResult res = new HttpSampleResult();
+ SampleResult res = new SampleResult();
if(redirected)
{
url.removeArguments();
@@ -634,11 +641,9 @@
try
{
u = url.getUrl();
- res.putValue(SampleResult.SAMPLE_LABEL, u.toString());
- res.putValue(SampleResult.DISPLAY_NAME, u.toString());
- res.putValue(HTTPSampler.URL, u);
+ res.setSampleLabel(u.toString());
// specify the data to the result.
- res.putValue(HttpSampleResult.DATA, url);
+ res.setSamplerData(this);
/****************************************
* Whenever someone gets around to going through and removing all these
@@ -676,8 +681,8 @@
{
byte[] ret = readResponse(conn);
time = System.currentTimeMillis() - time;
- res.putValue(SampleResult.TEXT_RESPONSE, ret);
- res.putValue(SampleResult.SUCCESS, new Boolean(true));
+ res.setResponseData(ret);
+ res.setSuccessful(true);
getResponseHeaders(conn, res);
}
else if(errorLevel == 3)
@@ -702,12 +707,12 @@
{
ex.printStackTrace();
res.setTime((long)0);
- res.putValue(this.RESPONSE_CODE,
+ res.setAttribute(this.RESPONSE_CODE,
NON_HTTP_RESPONSE_CODE);
- res.putValue(this.RESPONSE_MESSAGE,
+ res.setAttribute(this.RESPONSE_MESSAGE,
NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.TEXT_RESPONSE, ex.toString().getBytes());
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(ex.toString().getBytes());
+ res.setSuccessful(false);
}
catClass.debug("End : sample2");
return res;
1.4 +43 -50 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java
Index: HTTPSamplerFull.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFull.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- HTTPSamplerFull.java 24 Apr 2002 16:44:23 -0000 1.3
+++ HTTPSamplerFull.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -82,7 +82,7 @@
*
* @author Khor Soon Hin
* @version 1.0
- * @created $Date: 2002/04/24 16:44:23 $
+ * @created $Date: 2002/04/26 00:03:56 $
*/
public class HTTPSamplerFull extends HTTPSampler
{
@@ -134,8 +134,7 @@
catClass.debug("Start : sample2");
long totalTime = (long)0;
SampleResult res = super.sample(e);
- String displayName = (String)res.getValue(SampleResult.SAMPLE_LABEL);
- res.putValue(SampleResult.DISPLAY_NAME, displayName);
+ String displayName = res.getSampleLabel();
List loadBinaryList = new ArrayList();
if(catClass.isDebugEnabled())
{
@@ -145,31 +144,31 @@
Document html = null;
try
{
- baseUrl = new URL((String)res.getValue(SampleResult.SAMPLE_LABEL));
+ baseUrl = new URL(displayName);
if(catClass.isDebugEnabled())
{
catClass.debug("sample2 : baseUrl - " + baseUrl.toString());
}
// now use parser to look for image tags
- html = (Document)getDOM(new String((byte[])res.getValue(SampleResult.TEXT_RESPONSE)));
+ html = (Document)getDOM(new String(res.getResponseData()));
}
catch(SAXException exception)
{
catClass.error("sample2 : Error parsing document - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(exception.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
catch(MalformedURLException exception)
{
catClass.error("sample2 : Error creating URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(exception.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
// sample result to store image from <img...> tags
SampleResult imgRes = null;
@@ -191,7 +190,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values will be
// visible to the user to aid correction
- imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
+ imgRes.setSampleLabel(baseUrl + "," + imgUrlStr);
// download those images
URL imgUrl = new URL(baseUrl, imgUrlStr);
if(catClass.isDebugEnabled())
@@ -199,23 +198,20 @@
catClass.debug("sample2 : Image url without baseUrl - " + imgUrlStr);
catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
}
- imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
+ imgRes.setSampleLabel(imgUrl.toString());
loadBinary(imgUrl, imgRes);
- ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
- imgRes.putValue(IMAGE, image);
totalTime += imgRes.getTime();
- imgRes.remove(SampleResult.TEXT_RESPONSE);
}
catch(IOException exception)
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ imgRes.setResponseData(exception.toString().getBytes());
+ imgRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ imgRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ imgRes.setSuccessful(false);
}
- loadBinaryList.add(imgRes);
+ res.addSubResult(imgRes);
}
SampleResult appRes = null;
// use parser to look for applet tags
@@ -237,7 +233,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values will be
// visible to the user to aid correction
- appRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + appletUrlStr);
+ appRes.setSampleLabel(baseUrl + "," + appletUrlStr);
// download those applet
URL appletUrl = new URL(baseUrl, appletUrlStr);
if(catClass.isDebugEnabled())
@@ -245,20 +241,20 @@
catClass.debug("sample2 : Applet url without baseUrl - " + appletUrlStr);
catClass.debug("sample2 : Applet url with baseUrl - " + appletUrl);
}
- appRes.putValue(SampleResult.DISPLAY_NAME, appletUrl.toString());
- appRes.putValue(SampleResult.TEXT_RESPONSE, loadBinary(appletUrl, appRes));
+ appRes.setSampleLabel(appletUrl.toString());
+ loadBinary(appletUrl, appRes);
totalTime += appRes.getTime();
}
catch(IOException exception)
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- appRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- appRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- appRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- appRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ appRes.setResponseData(exception.toString().getBytes());
+ appRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ appRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ appRes.setSuccessful(false);
}
- loadBinaryList.add(appRes);
+ res.addSubResult(appRes);
}
// use parser to look for input tags with image types as well
nodeList = html.getElementsByTagName("input");
@@ -289,7 +285,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values will be
// visible to the user to aid correction
- imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," +
+ imgRes.setSampleLabel(baseUrl + "," +
imgUrlStr);
// download those images
URL imgUrl = new URL(baseUrl, imgUrlStr);
@@ -301,11 +297,8 @@
imgUrl);
}
loadBinary(imgUrl, imgRes);
- ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
- imgRes.putValue(IMAGE, image);
- imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
+ imgRes.setSampleLabel(imgUrl.toString());
totalTime += imgRes.getTime();
- imgRes.remove(SampleResult.TEXT_RESPONSE);
}
}
}
@@ -313,19 +306,17 @@
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ imgRes.setResponseData(exception.toString().getBytes());
+ imgRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ imgRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ imgRes.setSuccessful(false);
}
- loadBinaryList.add(imgRes);
+ res.addSubResult(imgRes);
}
- res.putValue(SampleResult.RESULT_LIST, loadBinaryList);
if(catClass.isDebugEnabled())
{
catClass.debug("sample2 : total time - " + totalTime);
}
- res.putValue(SampleResult.TOTAL_TIME, new Long(totalTime));
res.setTime(totalTime);
catClass.debug("End : sample2");
return res;
@@ -374,7 +365,7 @@
if (errorLevel == 2)
{
ret = readResponse(conn);
- res.putValue(SampleResult.SUCCESS, new Boolean(true));
+ res.setSuccessful(true);
long endTime = System.currentTimeMillis();
if(catClass.isDebugEnabled())
{
@@ -384,7 +375,7 @@
}
else
{
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setSuccessful(false);
int responseCode = ((HttpURLConnection)conn).getResponseCode();
String responseMessage = ((HttpURLConnection)conn).getResponseMessage();
catClass.error("loadBinary1 : failed response code - " +
@@ -398,6 +389,8 @@
catClass.debug("loadBinary1 : loadTime - " + res.getTime());
}
catClass.debug("End : loadBinary1");
+ res.setResponseData(ret);
+ res.setDataType(SampleResult.BINARY);
return ret;
}
@@ -418,8 +411,8 @@
int responseCode = ((HttpURLConnection) conn).getResponseCode();
String responseMessage = ((HttpURLConnection) conn).getResponseMessage();
errorLevel = responseCode/100;
- res.putValue(RESPONSE_CODE, String.valueOf(responseCode));
- res.putValue(RESPONSE_MESSAGE, responseMessage);
+ res.setAttribute(RESPONSE_CODE, String.valueOf(responseCode));
+ res.setAttribute(RESPONSE_MESSAGE, responseMessage);
if(catClass.isDebugEnabled())
{
catClass.debug("getErrorLevel1 : responseCode - " + responseCode);
@@ -435,10 +428,10 @@
"Error getting response code for HttpUrlConnection - " + e2);
catClass.error("getErrorLevel1 : " +
"Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, e2.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(e2.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
catClass.debug("End : getErrorLevel1");
return errorLevel;
1.4 +44 -56 jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/MultipartFormSamplerFull.java
Index: MultipartFormSamplerFull.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/http/sampler/MultipartFormSamplerFull.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MultipartFormSamplerFull.java 24 Apr 2002 16:44:23 -0000 1.3
+++ MultipartFormSamplerFull.java 26 Apr 2002 00:03:56 -0000 1.4
@@ -114,9 +114,7 @@
catClass.debug("Start : sample2");
long totalTime = (long)0;
SampleResult res = super.sample(e);
- String displayName = (String)res.getValue(SampleResult.SAMPLE_LABEL);
- res.putValue(SampleResult.DISPLAY_NAME, displayName);
- List loadBinaryList = new ArrayList();
+ String displayName = (String)res.getSampleLabel();
if (catClass.isDebugEnabled())
{
catClass.debug("sample2 : main page loading time - " + res.getTime());
@@ -125,32 +123,32 @@
Document html = null;
try
{
- baseUrl = new URL((String)res.getValue(SampleResult.SAMPLE_LABEL));
+ baseUrl = new URL(displayName);
if (catClass.isDebugEnabled())
{
catClass.debug("sample2 : baseUrl - " + baseUrl.toString());
}
// now use parser to look for image tags
- html = (Document)getDOM(new String((byte[])res.getValue(SampleResult.TEXT_RESPONSE)));
+ html = (Document)getDOM(new String(res.getResponseData()));
}
catch(SAXException exception)
{
catClass.error("sample2 : Error parsing document - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(exception.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
catch(MalformedURLException exception)
{
catClass.error("sample2 : Error creating URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(exception.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
// sample result to store image from <img...> tags
@@ -175,7 +173,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values will be
// visible to the user to aid correction
- imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + imgUrlStr);
+ imgRes.setSampleLabel(baseUrl + "," + imgUrlStr);
// download those images
URL imgUrl = new URL(baseUrl, imgUrlStr);
@@ -185,24 +183,20 @@
catClass.debug("sample2 : Image url with baseUrl - " + imgUrl);
}
- imgRes.putValue(SampleResult.DISPLAY_NAME, imgUrl.toString());
+ imgRes.setSampleLabel(imgUrl.toString());
loadBinary(imgUrl, imgRes);
- ImageIcon image = new ImageIcon(imgUrl, imgUrl.toString());
- imgRes.putValue(IMAGE, image);
totalTime += imgRes.getTime();
- imgRes.remove(SampleResult.TEXT_RESPONSE);
}
catch(IOException exception)
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ imgRes.setResponseData(exception.toString().getBytes());
+ imgRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ imgRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ imgRes.setSuccessful(false);
}
-
- loadBinaryList.add(imgRes);
+ res.addSubResult(imgRes);
}
SampleResult appRes = null;
@@ -228,7 +222,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values will be
// visible to the user to aid correction
- appRes.putValue(SampleResult.DISPLAY_NAME, baseUrl + "," + appletUrlStr);
+ appRes.setSampleLabel(baseUrl + "," + appletUrlStr);
// download those applet
URL appletUrl = new URL(baseUrl, appletUrlStr);
@@ -239,21 +233,21 @@
catClass.debug("sample2 : Applet url with baseUrl - " + appletUrl);
}
- appRes.putValue(SampleResult.DISPLAY_NAME, appletUrl.toString());
- appRes.putValue(SampleResult.TEXT_RESPONSE, loadBinary(appletUrl, appRes));
+ appRes.setSampleLabel(appletUrl.toString());
+ loadBinary(appletUrl, appRes);
totalTime += appRes.getTime();
}
catch(IOException exception)
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- appRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- appRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- appRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- appRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ appRes.setResponseData(exception.toString().getBytes());
+ appRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ appRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ appRes.setSuccessful(false);
}
- loadBinaryList.add(appRes);
+ res.addSubResult(appRes);
}
// use parser to look for input tags with image types as well
@@ -290,8 +284,7 @@
// set the baseUrl and imgUrl so that if error occurs
// due to MalformedException then at least the values
// will be visible to the user to aid correction
- imgRes.putValue(SampleResult.DISPLAY_NAME, baseUrl
- + "," + imgUrlStr);
+ imgRes.setSampleLabel(baseUrl + "," + imgUrlStr);
// download those images
URL imgUrl = new URL(baseUrl, imgUrlStr);
@@ -303,13 +296,8 @@
}
loadBinary(imgUrl, imgRes);
- ImageIcon image = new ImageIcon(imgUrl,
- imgUrl.toString());
- imgRes.putValue(IMAGE, image);
- imgRes.putValue(SampleResult.DISPLAY_NAME,
- imgUrl.toString());
+ imgRes.setSampleLabel(imgUrl.toString());
totalTime += imgRes.getTime();
- imgRes.remove(SampleResult.TEXT_RESPONSE);
}
}
}
@@ -317,23 +305,22 @@
{
catClass.error("sample2 : Error reading from URL - " + exception);
catClass.error("sample2 : Setting SampleResult SUCCESS value to false");
- imgRes.putValue(SampleResult.TEXT_RESPONSE, exception.toString().getBytes());
- imgRes.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- imgRes.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- imgRes.putValue(SampleResult.SUCCESS, new Boolean(false));
+ imgRes.setResponseData(exception.toString().getBytes());
+ imgRes.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ imgRes.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ imgRes.setSuccessful(false);
}
- loadBinaryList.add(imgRes);
+ res.addSubResult(imgRes);
}
- res.putValue(SampleResult.RESULT_LIST, loadBinaryList);
if(catClass.isDebugEnabled())
{
catClass.debug("sample2 : total time - " + totalTime);
}
- res.putValue(SampleResult.TOTAL_TIME, new Long(totalTime));
+ res.setTime(totalTime);
catClass.debug("End : sample2");
return res;
@@ -387,7 +374,7 @@
if (errorLevel == 2)
{
ret = readResponse(conn);
- res.putValue(SampleResult.SUCCESS, new Boolean(true));
+ res.setSuccessful(true);
long endTime = System.currentTimeMillis();
if(catClass.isDebugEnabled())
{
@@ -398,7 +385,7 @@
}
else
{
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setSuccessful(false);
int responseCode = ((HttpURLConnection)conn).getResponseCode();
String responseMessage = ((HttpURLConnection)conn).getResponseMessage();
catClass.error("loadBinary1 : failed response code - " + responseCode);
@@ -413,7 +400,8 @@
}
catClass.debug("End : loadBinary1");
-
+ res.setResponseData(ret);
+ res.setDataType(SampleResult.BINARY);
return ret;
}
@@ -435,8 +423,8 @@
int responseCode = ((HttpURLConnection) conn).getResponseCode();
String responseMessage = ((HttpURLConnection) conn).getResponseMessage();
errorLevel = responseCode/100;
- res.putValue(RESPONSE_CODE, String.valueOf(responseCode));
- res.putValue(RESPONSE_MESSAGE, responseMessage);
+ res.setAttribute(RESPONSE_CODE, String.valueOf(responseCode));
+ res.setAttribute(RESPONSE_MESSAGE, responseMessage);
if(catClass.isDebugEnabled())
{
@@ -453,10 +441,10 @@
"Error getting response code for HttpUrlConnection - " + e2);
catClass.error("getErrorLevel1 : " +
"Setting SampleResult SUCCESS value to false");
- res.putValue(SampleResult.TEXT_RESPONSE, e2.toString().getBytes());
- res.putValue(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
- res.putValue(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
- res.putValue(SampleResult.SUCCESS, new Boolean(false));
+ res.setResponseData(e2.toString().getBytes());
+ res.setAttribute(RESPONSE_CODE, NON_HTTP_RESPONSE_CODE);
+ res.setAttribute(RESPONSE_MESSAGE, NON_HTTP_RESPONSE_MESSAGE);
+ res.setSuccessful(false);
}
catClass.debug("End : getErrorLevel1");
1.3 +4 -4 jakarta-jmeter/src_1/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
Index: JDBCSampler.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JDBCSampler.java 19 Apr 2002 02:08:50 -0000 1.2
+++ JDBCSampler.java 26 Apr 2002 00:03:56 -0000 1.3
@@ -70,8 +70,8 @@
* A sampler which understands JDBC database requests
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:08:50 $
- *@version $Revision: 1.2 $
+ *@created $Date: 2002/04/26 00:03:56 $
+ *@version $Revision: 1.3 $
***********************************************************/
public class JDBCSampler extends AbstractSampler
@@ -120,7 +120,7 @@
ResultSet rs = null;
Statement stmt = null;
Data data = new Data();
- res.putValue(SampleResult.SAMPLE_LABEL, sql.getQuery());
+ res.setSampleLabel(sql.getQuery());
start = System.currentTimeMillis();
try
{
@@ -182,7 +182,7 @@
end = System.currentTimeMillis();
time += end - start;
res.setTime(time);
- res.putValue(SampleResult.TEXT_RESPONSE, data.toString().getBytes());
+ res.setResponseData(data.toString().getBytes());
return res;
}
1.3 +1 -0 jakarta-jmeter/src_1/org/apache/jmeter/protocol/jdbc/util/Data.java
Index: Data.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/protocol/jdbc/util/Data.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Data.java 19 Apr 2002 02:08:50 -0000 1.2
+++ Data.java 26 Apr 2002 00:03:56 -0000 1.3
@@ -81,6 +81,7 @@
*****************************************************************/
public Data()
{
+ header = new ArrayList();
data=new HashMap();
currentPos=-1;
size = currentPos+1;
1.3 +3 -4 jakarta-jmeter/src_1/org/apache/jmeter/reporters/MailerResultCollector.java
Index: MailerResultCollector.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/reporters/MailerResultCollector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MailerResultCollector.java 19 Apr 2002 02:08:50 -0000 1.2
+++ MailerResultCollector.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -186,8 +186,7 @@
// -1 is the code for a failed sample.
//
- if (sample.getValue(SampleResult.SUCCESS) == null ||
- !((Boolean)sample.getValue(SampleResult.SUCCESS)).booleanValue())
+ if (!sample.isSuccessful())
{
failureCount++;
}
@@ -202,7 +201,7 @@
// Send the mail ...
Vector addressVector = newAddressVector(address);
sendMail(from, addressVector, failSubject, "URL Failed: " +
- sample.getValue(SampleResult.SAMPLE_LABEL), smtpHost);
+ sample.getSampleLabel(), smtpHost);
siteDown = true;
failureMsgSent = true;
successCount = 0;
@@ -215,7 +214,7 @@
{
Vector addressVector = newAddressVector(address);
sendMail(from, addressVector, successSubject, "URL Restarted: " +
- sample.getValue(SampleResult.SAMPLE_LABEL), smtpHost);
+ sample.getSampleLabel(), smtpHost);
siteDown = false;
successMsgSent = true;
}
1.3 +355 -219 jakarta-jmeter/src_1/org/apache/jmeter/reporters/ResultCollector.java
Index: ResultCollector.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/reporters/ResultCollector.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ResultCollector.java 19 Apr 2002 02:08:50 -0000 1.2
+++ ResultCollector.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -1,219 +1,355 @@
-/*
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache JMeter" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache JMeter", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.jmeter.reporters;
-import java.io.*;
-import java.lang.ref.*;
-import java.util.*;
-import org.apache.jmeter.gui.*;
-import org.apache.jmeter.samplers.*;
-import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jmeter.visualizers.ViewResultsVisualizer;
-
-/****************************************
- * Title: Description: Copyright: Copyright (c) 2001 Company:
- *
- *@author Michael Stover
- *@created $Date: 2002/04/19 02:08:50 $
- *@version 1.0
- ***************************************/
-
-public class ResultCollector extends AbstractListenerElement implements SampleListener, Clearable,
- Serializable
-{
-
- /****************************************
- * !ToDo (Field description)
- ***************************************/
- protected List results = Collections.synchronizedList(new ArrayList());
- private int current;
-
- /****************************************
- * !ToDo (Constructor description)
- ***************************************/
- public ResultCollector()
- {
- current = -1;
- }
-
- /****************************************
- * !ToDo (Method description)
- ***************************************/
- public void clear()
- {
- results.clear();
- current = -1;
- if(getVisualizer() != null && getVisualizer() instanceof Clearable)
- {
- ((Clearable)getVisualizer()).clear();
- }
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@param l !ToDo (Parameter description)
- ***************************************/
- public void setListener(Object l) { }
-
- /****************************************
- * !ToDoo (Method description)
- *
- *@return !ToDo (Return description)
- ***************************************/
- public String getSampleLabel()
- {
- try
- {
- return (String)getCurrentSample().getValue(SampleResult.SAMPLE_LABEL);
- }
- catch(NullPointerException e)
- {
- return "";
- }
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- *@return !ToDo (Return description)
- ***************************************/
- public SampleResult getCurrentSample()
- {
- if(current < results.size() && current >= 0)
- {
- SampleResult res = (SampleResult)results.get(current);
- return res;
- }
- else if(results.size() > 0)
- {
- return (SampleResult)results.get(results.size() - 1);
- }
- else
- {
- return null;
- }
- }
-
- /****************************************
- * !ToDoo (Method description)
- *
- *@return !ToDo (Return description)
- ***************************************/
- public String getTextResponse()
- {
- try
- {
- return new String((byte[])getCurrentSample().getValue(SampleResult.TEXT_RESPONSE));
- }
- catch(NullPointerException e)
- {
- return "";
- }
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@return !ToDo (Return description)
- ***************************************/
- public boolean next()
- {
- if(current < results.size() - 1)
- {
- current++;
- return true;
- }
- else
- {
- return false;
- }
- }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@param e !ToDo (Parameter description)
- ***************************************/
- public void sampleStarted(SampleEvent e) { }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@param e !ToDo (Parameter description)
- ***************************************/
- public void sampleStopped(SampleEvent e) { }
-
- /****************************************
- * !ToDo (Method description)
- *
- *@param e !ToDo (Parameter description)
- ***************************************/
- public void sampleOccurred(SampleEvent e)
- {
- results.add(e.getResult());
- if(results.size() > 100)
- {
- results.remove(0);
- if(current > 0)
- {
- current--;
- }
- }
- if(getVisualizer() != null)
- {
- getVisualizer().add(e.getResult());
- }
- }
-}
+/*
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache JMeter" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache JMeter", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.jmeter.reporters;
+import java.io.*;
+import java.lang.ref.*;
+import java.util.*;
+import org.apache.jmeter.gui.*;
+import org.apache.jmeter.samplers.*;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jmeter.visualizers.ViewResultsVisualizer;
+import org.apache.avalon.framework.configuration.*;
+import org.xml.sax.SAXException;
+
+/**
+ * Title: Description: Copyright: Copyright (c) 2001 Company:
+ *
+ *@author Michael Stover
+ *@created $Date: 2002/04/26 00:03:57 $
+ *@version 1.0
+ */
+
+public class ResultCollector extends AbstractListenerElement implements SampleListener, Clearable,
+ Serializable
+{
+
+ /**
+ * !ToDo (Field description)
+ */
+ protected List results = Collections.synchronizedList(new ArrayList());
+ private int current;
+ private String filename;
+ private PrintWriter out;
+ private DefaultConfigurationSerializer serializer = new DefaultConfigurationSerializer();
+
+ /**
+ * !ToDo (Constructor description)
+ */
+ public ResultCollector()
+ {
+ current = -1;
+ }
+
+ /**
+ * Sets the filename attribute of the ResultCollector object
+ *
+ *@param f The new filename value
+ */
+ public void setFilename(String f) throws IOException
+ {
+ try
+ {
+ filename = f;
+ finalizeFileOutput();
+ Configuration savedSamples = getConfiguration(filename);
+ readSamples(savedSamples);
+ }
+ catch(SAXException e)
+ {
+ throw new IOException("File "+f+" was improperly formatted");
+ }
+ catch(ConfigurationException e)
+ {
+ throw new IOException("File "+f+" was improperly formatted");
+ }
+ }
+
+ /**
+ * Description of the Method
+ */
+ private void writeFileStart()
+ {
+ out.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
+ out.print("<testResults>\n");
+ }
+
+ /**
+ * Description of the Method
+ */
+ private void writeFileEnd()
+ {
+ out.print("</testResults>");
+ }
+
+ /**
+ * Gets the serializedSampleResult attribute of the ResultCollector object
+ *
+ *@param result Description of the Parameter
+ *@return The serializedSampleResult value
+ */
+ private String getSerializedSampleResult(SampleResult result) throws SAXException,
+ IOException,ConfigurationException
+ {
+ ByteArrayOutputStream tempOut = new ByteArrayOutputStream();
+ serializer.serialize(tempOut, result);
+ String serVer = tempOut.toString();
+ return serVer.substring(serVer.indexOf(System.getProperty("line.separator")));
+ }
+
+ /**
+ * Description of the Method
+ *
+ *@param testResults Description of the Parameter
+ */
+ private void readSamples(Configuration testResults)
+ {
+ Configuration[] samples = testResults.getChildren();
+ for(int i = 0; i < samples.length; i++)
+ {
+ SampleResult result = new SampleResult();
+ result.configure(samples[i]);
+ sampleOccurred(new SampleEvent(result, null));
+ }
+ }
+
+ /**
+ * Gets the configuration attribute of the ResultCollector object
+ *
+ *@param filename Description of the Parameter
+ *@return The configuration value
+ */
+ private Configuration getConfiguration(String filename) throws SAXException,
+ IOException,ConfigurationException
+ {
+ DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
+ return builder.buildFromFile(filename);
+ }
+
+ /**
+ * !ToDo (Method description)
+ */
+ public void clear()
+ {
+ results.clear();
+ current = -1;
+ if(getVisualizer() != null && getVisualizer() instanceof Clearable)
+ {
+ ((Clearable)getVisualizer()).clear();
+ }
+ finalizeFileOutput();
+ }
+
+ /**
+ * !ToDo (Method description)
+ *
+ *@param l !ToDo (Parameter description)
+ */
+ public void setListener(Object l) { }
+
+ /**
+ * !ToDoo (Method description)
+ *
+ *@return !ToDo (Return description)
+ */
+ public String getSampleLabel()
+ {
+ try
+ {
+ return (String)getCurrentSample().getSampleLabel();
+ }
+ catch(NullPointerException e)
+ {
+ return "";
+ }
+ }
+
+ /**
+ * !ToDoo (Method description)
+ *
+ *@return !ToDo (Return description)
+ */
+ public SampleResult getCurrentSample()
+ {
+ if(current < results.size() && current >= 0)
+ {
+ SampleResult res = (SampleResult)results.get(current);
+ return res;
+ }
+ else if(results.size() > 0)
+ {
+ return (SampleResult)results.get(results.size() - 1);
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * !ToDoo (Method description)
+ *
+ *@return !ToDo (Return description)
+ */
+ public String getTextResponse()
+ {
+ try
+ {
+ return new String((byte[])getCurrentSample().getResponseData());
+ }
+ catch(NullPointerException e)
+ {
+ return "";
+ }
+ }
+
+ /**
+ * !ToDo (Method description)
+ *
+ *@return !ToDo (Return description)
+ */
+ public boolean next()
+ {
+ if(current < results.size() - 1)
+ {
+ current++;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ /**
+ * !ToDo (Method description)
+ *
+ *@param e !ToDo (Parameter description)
+ */
+ public void sampleStarted(SampleEvent e) { }
+
+ /**
+ * !ToDo (Method description)
+ *
+ *@param e !ToDo (Parameter description)
+ */
+ public void sampleStopped(SampleEvent e) { }
+
+ /**
+ * !ToDo (Method description)
+ *
+ *@param e !ToDo (Parameter description)
+ */
+ public void sampleOccurred(SampleEvent e)
+ {
+ results.add(e.getResult());
+ if(results.size() > 100)
+ {
+ results.remove(0);
+ if(current > 0)
+ {
+ current--;
+ }
+ }
+ if(getVisualizer() != null)
+ {
+ getVisualizer().add(e.getResult());
+ }
+ try
+ {
+ recordResult(e.getResult());
+ }
+ catch(Exception err)
+ {
+ err.printStackTrace(); //should throw exception back to caller
+ }
+ }
+
+ /**
+ * Description of the Method
+ *
+ *@param result Description of the Parameter
+ */
+ private void recordResult(SampleResult result) throws SAXException,IOException,
+ ConfigurationException
+ {
+ initializeFileOutput();
+ if(out != null)
+ {
+ out.print(getSerializedSampleResult(result));
+ }
+ }
+
+ private void initializeFileOutput() throws IOException
+ {
+ if(out == null && filename != null)
+ {
+ out = new PrintWriter(new BufferedOutputStream(new FileOutputStream(filename)));
+ writeFileStart();
+ }
+ }
+
+ /**
+ * Description of the Method
+ */
+ private void finalizeFileOutput()
+ {
+ if(out != null)
+ {
+ writeFileEnd();
+ out.close();
+ out = null;
+ }
+ }
+}
1.3 +1 -1 jakarta-jmeter/src_1/org/apache/jmeter/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/resources/messages.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- messages.properties 19 Apr 2002 02:08:50 -0000 1.2
+++ messages.properties 26 Apr 2002 00:03:57 -0000 1.3
@@ -63,7 +63,7 @@
upload=File Upload
field_name=Field name
looping_control=Looping Control
-browse=Browse
+browse=Browse...
constant_timer_memo=Add a constant delay between sampling
gaussian_timer_memo=Adds a random delay with a gaussian distribution
uniform_timer_memo=Adds a random delay with a uniform distribution
1.3 +320 -267 jakarta-jmeter/src_1/org/apache/jmeter/samplers/SampleResult.java
Index: SampleResult.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/samplers/SampleResult.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- SampleResult.java 19 Apr 2002 02:08:50 -0000 1.2
+++ SampleResult.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -1,267 +1,320 @@
-/*
- * ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache JMeter" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache JMeter", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-package org.apache.jmeter.samplers;
-
-import java.util.*;
-import java.io.Serializable;
-
-import org.apache.log4j.*;
-
-/************************************************************
- * This is a nice packaging for the various information returned from taking a
- * sample of an entry.
- *
- *@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:08:50 $
- *@version $Revision: 1.2 $
- ***********************************************************/
-public class SampleResult implements Serializable
-{
- //public final static String URL = "sampler.url";
-
- Map map;
- long time;
- public final static String DISPLAY_NAME = "sr.display_name";
- public final static String ASSERTION_RESULTS = "sr.assertion_results";
- public final static String TEXT_RESPONSE = "sampler.RESPONSE";
- public final static String SAMPLE_LABEL = "sampler.LABEL";
- public final static String SUCCESS = "sampler.SUCCESS";
- public final static String RESULT_LIST = "sample.RESULT_LIST";
- public final static String TOTAL_TIME = "sample.TOTAL_TIME";
-
- private transient static Category catClass =
- Category.getInstance(SampleResult.class.getName());
-
-
- /************************************************************
- * !ToDo (Constructor description)
- ***********************************************************/
- public SampleResult()
- {
- map = new HashMap();
- time = 0;
- putValue(DISPLAY_NAME, "Display name of SampleResult not set");
- }
-
- /************************************************************
- * Set the time this sample took to occur.
- *
- *@param t !ToDo (Parameter description)
- ***********************************************************/
- public void setTime(long t)
- {
- time = t;
- }
-
- /************************************************************
- * Get the time it took this sample to occur.
- *
- *@return !ToDo (Return description)
- ***********************************************************/
- public long getTime()
- {
- return time;
- }
-
- /************************************************************
- * !ToDoo (Method description)
- *
- *@return !ToDo (Return description)
- ***********************************************************/
- public boolean isSuccessfull()
- {
- Boolean success = (Boolean)getValue(SUCCESS);
- if (success != null)
- {
- return success.booleanValue();
- }
- else
- {
- return false;
- }
- }
-
- /************************************************************
- * All keys in this interface must be Strings.
- *
- *@param key !ToDo (Parameter description)
- *@return !ToDo (Return description)
- ***********************************************************/
- public Object getValue(String key)
- {
- Object value = map.get(key);
- if(catClass.isDebugEnabled())
- {
- catClass.debug("getValue1 : key - " + key + " ; value - " + value);
- }
- return value;
- }
-
- /************************************************************
- * Get an array of all the names
- *
- *@return !ToDo (Return description)
- ***********************************************************/
- public String[] getNames()
- {
- return (String[])map.keySet().toArray(new String[0]);
- }
-
- /************************************************************
- * !ToDo (Method description)
- *
- *@param key !ToDo (Parameter description)
- *@param value !ToDo (Parameter description)
- ***********************************************************/
- public void putValue(String key, Object value)
- {
- map.put(key, value);
- }
-
- /************************************************************
- * Get a ready made iterator to go through the names
- *
- *@return !ToDo (Return description)
- ***********************************************************/
- public java.util.Iterator nameIterator()
- {
- return map.keySet().iterator();
- }
-
- /************************************************************
- * Remove a key-value pair.
- *
- *@param key !ToDo (Parameter description)
- ***********************************************************/
- public void remove(String key)
- {
- map.remove(key);
- }
-
- /************************************************************
- * Generates an iterator for all the values stored under one key.
- *
- *@param key !ToDo (Parameter description)
- *@return !ToDo (Return description)
- ***********************************************************/
- public java.util.Iterator valueIterator(String key)
- {
- Object value = null;
- Object[] values = null;
- try
- {
- values = (Object[])map.get(key);
- }
- catch (Exception e)
- {
- value = map.get(key);
- }
- if (value == null)
- {
- if (values == null)
- {
- List list = new LinkedList();
- return list.iterator();
- }
- else
- {
- List list = new LinkedList();
- for (int x = 0; x < values.length; list.add(values[x++]))
- {
- ;
- }
- return list.iterator();
- }
- }
- else if (value instanceof Collection)
- {
- Collection col = (Collection)value;
- return col.iterator();
- }
- else
- {
- List list = new LinkedList();
- list.add(value);
- return list.iterator();
- }
- }
-
- /************************************************************
- * Get the value for the key as a String object
- *
- *@param key !ToDo (Parameter description)
- *@return !ToDo (Return description)
- ***********************************************************/
- public String toString(String key)
- {
- Object value = map.get(key);
- if (value == null)
- {
- value = new String("");
- }
- return value.toString();
- }
-
- /**
- * Returns the display name
- *
- * @return display name of this sample result
- */
- public String toString()
- {
- String toString = (String)getValue(DISPLAY_NAME);
- return toString;
- }
-}
+/*
+ * ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache JMeter" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache JMeter", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+package org.apache.jmeter.samplers;
+import java.util.*;
+import java.io.*;
+import org.apache.avalon.framework.configuration.*;
+import org.apache.log4j.*;
+
+import org.apache.jmeter.assertions.AssertionResult;
+import org.apache.jmeter.save.SaveService;
+import org.apache.jmeter.testelement.TestElement;
+
+/**
+ * This is a nice packaging for the various information returned from taking a
+ * sample of an entry.
+ *
+ *@author $Author: mstover1 $
+ *@created $Date: 2002/04/26 00:03:57 $
+ *@version $Revision: 1.3 $
+ */
+public class SampleResult extends DefaultConfiguration implements Serializable
+{
+ //public final static String URL = "sampler.url";
+
+ public final static String TAG_NAME = "sampleResult";
+ public final static String TEXT = "text";
+ public final static String BINARY = "bin";
+
+ Map map;
+ long time;
+ /**
+ * Description of the Field
+ */
+ private final static String SAMPLE_LABEL = "displayName";
+ private final static String SAMPLER_CONFIG = "samplerConfig";
+ private final static String DATA_TYPE = "dataType";
+ /**
+ * Description of the Field
+ */
+ private final static String ASSERTION_RESULTS = "assertionResults";
+ /**
+ * Description of the Field
+ */
+ private final static String RESPONSE_DATA = "responseData";
+ /**
+ * Description of the Field
+ */
+ private final static String SUCCESS = "success";
+
+ /**
+ * Description of the Field
+ */
+ private final static String TOTAL_TIME = "totalTime";
+
+ private static transient Category catClass =
+ Category.getInstance(SampleResult.class.getName());
+
+
+ /**
+ * !ToDo (Constructor description)
+ */
+ public SampleResult()
+ {
+ super(TAG_NAME,"org.apache.jmeter.samplers.SampleResult");
+ map = new HashMap();
+ time = 0;
+ }
+
+ public String getSampleLabel()
+ {
+ return getAttribute(SAMPLE_LABEL,"Display name of SampleResult not set");
+ }
+
+ public void setSampleLabel(String label)
+ {
+ setAttribute(SAMPLE_LABEL,label);
+ }
+
+ public void addAssertionResult(AssertionResult assertResult)
+ {
+ addChild(assertResult);
+ }
+
+ public AssertionResult[] getAssertionResults()
+ {
+ return (AssertionResult[])getChildren(AssertionResult.TAG_NAME);
+ }
+
+ public void addSubResult(SampleResult subResult)
+ {
+ addChild(subResult);
+ }
+
+ public SampleResult[] getSubResults()
+ {
+ Configuration[] subs = getChildren(SampleResult.TAG_NAME);
+ SampleResult[] subResults = new SampleResult[subs.length];
+ for(int i = 0;i < subs.length;i++)
+ {
+ subResults[i] = (SampleResult)subs[i];
+ }
+ return subResults;
+ }
+
+ /**
+ * Description of the Method
+ *
+ *@param info Description of the Parameter
+ */
+ public void configure(Configuration info)
+ {
+ setTime(info.getAttributeAsLong(TOTAL_TIME,0L));
+ }
+
+ /**
+ * Set the time this sample took to occur.
+ *
+ *@param t !ToDo (Parameter description)
+ */
+ public void setTime(long t)
+ {
+ setAttribute(TOTAL_TIME, "" + t);
+ }
+
+ /**
+ * Sets the responseData attribute of the SampleResult object
+ *
+ *@param response The new responseData value
+ */
+ public void setResponseData(byte[] response)
+ {
+ DefaultConfiguration responseChild = new DefaultConfiguration(RESPONSE_DATA, "");
+ responseChild.setValue(getHexString(response));
+ addChild(responseChild);
+ }
+
+ /**
+ * Gets the hexString attribute of the SampleResult object
+ *
+ *@param bytes Description of the Parameter
+ *@return The hexString value
+ */
+ private String getHexString(byte[] bytes)
+ {
+ StringBuffer hex = new StringBuffer();
+ for(int i = 0; i < bytes.length; i++)
+ {
+ String hexString = Integer.toHexString((int)bytes[i]);
+ if(hexString.length() == 1)
+ {
+ hex.append("0");
+ hex.append(hexString);
+ }
+ else
+ {
+ hex.append(hexString);
+ }
+ }
+ return hex.toString();
+ }
+
+
+ /**
+ * Gets the responseData attribute of the SampleResult object
+ *
+ *@return The responseData value
+ */
+ public byte[] getResponseData()
+ {
+ Configuration responseChild = getChild(RESPONSE_DATA);
+ ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+ String res = responseChild.getValue("");
+ for (int i = 0; i < res.length(); i+=2)
+ {
+ bytes.write(Integer.parseInt(res.substring(i,i+2),16));
+ }
+ return bytes.toByteArray();
+ }
+
+ public void setSamplerData(Sampler s)
+ {
+ this.addChild(SaveService.getConfigForTestElement((String)s.getProperty(TestElement.NAME),
+ s));
+ }
+
+ public Sampler getSamplerData()
+ {
+ try
+ {
+ return (Sampler)SaveService.createTestElement(getChild("testelement"));
+ }
+ catch(Exception e)
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Get the time it took this sample to occur.
+ *
+ *@return !ToDo (Return description)
+ */
+ public long getTime()
+ {
+ return getAttributeAsLong(TOTAL_TIME,0L);
+ }
+
+ /**
+ * !ToDoo (Method description)
+ *
+ *@return !ToDo (Return description)
+ */
+ public boolean isSuccessful()
+ {
+ return getAttributeAsBoolean(SUCCESS,true);
+ }
+
+ public void setDataType(String dataType)
+ {
+ setAttribute(DATA_TYPE,dataType);
+ }
+
+ public String getDataType()
+ {
+ return getAttribute(DATA_TYPE,TEXT);
+ }
+
+ /**
+ * Sets the successful attribute of the SampleResult object
+ *
+ *@param success The new successful value
+ */
+ public void setSuccessful(boolean success)
+ {
+ setAttribute(SUCCESS, "" + success);
+ }
+
+ /**
+ * Get an array of all the names
+ *
+ *@return !ToDo (Return description)
+ */
+ public String[] getNames()
+ {
+ return (String[])map.keySet().toArray(new String[0]);
+ }
+
+ /**
+ * Remove a key-value pair.
+ *
+ *@param key !ToDo (Parameter description)
+ */
+ public void remove(String key)
+ {
+ map.remove(key);
+ }
+
+ /**
+ * Returns the display name
+ *
+ *@return display name of this sample result
+ */
+ public String toString()
+ {
+ String toString = (String)getValue(SAMPLE_LABEL);
+ return toString;
+ }
+}
1.2 +2 -2 jakarta-jmeter/src_1/org/apache/jmeter/save/SaveService.java
Index: SaveService.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/save/SaveService.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SaveService.java 29 Mar 2002 14:06:12 -0000 1.1
+++ SaveService.java 26 Apr 2002 00:03:57 -0000 1.2
@@ -62,7 +62,7 @@
return configs;
}
- private static Configuration getConfigForTestElement(String named,TestElement item)
+ public static Configuration getConfigForTestElement(String named,TestElement item)
{
DefaultConfiguration config = new DefaultConfiguration("testelement","testelement");
if(named != null)
@@ -163,7 +163,7 @@
}
}
- private static TestElement createTestElement(Configuration config) throws ConfigurationException,
+ public static TestElement createTestElement(Configuration config) throws ConfigurationException,
ClassNotFoundException, IllegalAccessException,InstantiationException
{
TestElement element = (TestElement)Class.forName((String)config.getAttribute("class")).newInstance();
1.3 +3 -5 jakarta-jmeter/src_1/org/apache/jmeter/threads/JMeterThread.java
Index: JMeterThread.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/threads/JMeterThread.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- JMeterThread.java 19 Apr 2002 02:08:51 -0000 1.2
+++ JMeterThread.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -71,8 +71,8 @@
* timing, add listeners for sampling events and to stop the sampling process.
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:08:51 $
- *@version $Revision: 1.2 $
+ *@created $Date: 2002/04/26 00:03:57 $
+ *@version $Revision: 1.3 $
***************************************/
public class JMeterThread implements Runnable, java.io.Serializable
{
@@ -134,12 +134,10 @@
private void checkAssertions(List assertions, SampleResult result)
{
Iterator iter = assertions.iterator();
- List resultList = new LinkedList();
while(iter.hasNext())
{
- resultList.add(((Assertion)iter.next()).getResult(result));
+ result.addAssertionResult(((Assertion)iter.next()).getResult(result));
}
- result.putValue(SampleResult.ASSERTION_RESULTS, resultList);
}
private void delay(List timers)
1.3 +3 -3 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/AssertionVisualizer.java
Index: AssertionVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/AssertionVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AssertionVisualizer.java 19 Apr 2002 02:08:52 -0000 1.2
+++ AssertionVisualizer.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -72,7 +72,7 @@
* Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:08:52 $
+ *@created $Date: 2002/04/26 00:03:57 $
*@version 1.0
***************************************/
@@ -119,7 +119,7 @@
***************************************/
public void add(SampleResult sample)
{
- textArea.append((String)sample.getValue(SampleResult.SAMPLE_LABEL));
+ textArea.append((String)sample.getSampleLabel());
textArea.append(getAssertionResult(sample));
textArea.append("\n");
}
@@ -138,7 +138,7 @@
if(res != null)
{
StringBuffer display = new StringBuffer();
- List assertionResults = (List)res.getValue(res.ASSERTION_RESULTS);
+ List assertionResults = Arrays.asList(res.getAssertionResults());
if(assertionResults != null)
{
Iterator iter = assertionResults.iterator();
1.3 +6 -13 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/GraphAccum.java
Index: GraphAccum.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/GraphAccum.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GraphAccum.java 19 Apr 2002 02:08:52 -0000 1.2
+++ GraphAccum.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -354,15 +354,14 @@
int compCount = 0;
// number of components
- ArrayList resultList =
- (ArrayList) oneSample.getValue(SampleResult.RESULT_LIST);
+ SampleResult[] resultList = oneSample.getSubResults();
// allocate previousPts only the first time
int resultListCount = 0;
if (!previousPtsAlloc)
{
if (resultList != null)
{
- resultListCount += resultList.size();
+ resultListCount += resultList.length;
}
previousPts = new Point[resultListCount + 2];
}
@@ -379,11 +378,6 @@
long totalTime = oneSample.getTime();
// if the page has other components then set the total time to be that including
// all its components' load time
- Long dataLong = (Long) oneSample.getValue(SampleResult.TOTAL_TIME);
- if (dataLong != null)
- {
- totalTime = dataLong.longValue();
- }
if (catClass.isDebugEnabled())
{
catClass.debug("drawSample1 : total time - " + totalTime);
@@ -453,14 +447,13 @@
int currPreviousPts = 2;
if (resultList != null)
{
- Iterator iter = resultList.iterator();
- while (iter.hasNext())
+ for(int i = 0;i < resultList.length;i++)
{
- SampleResult componentRes = (SampleResult) iter.next();
+ SampleResult componentRes = (SampleResult) resultList[i];
if (catClass.isDebugEnabled())
{
catClass.debug("drawSample1 : componentRes - " +
- componentRes.toString() + " loading time - " +
+ componentRes.getSampleLabel() + " loading time - " +
componentRes.getTime());
}
data = (int) (componentRes.getTime()
@@ -487,7 +480,7 @@
gbc.anchor = GridBagConstraints.WEST;
gbc.weightx = 1.0;
gbc.insets = new Insets(0, 10, 0, 0);
- JLabel compTimeLabel = new JLabel(componentRes.toString());
+ JLabel compTimeLabel = new JLabel(componentRes.getSampleLabel());
compTimeLabel.setForeground(currColor);
gridBag.setConstraints(compTimeLabel, gbc);
legendPanel.add(compTimeLabel);
1.3 +1 -7 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/GraphAccumModel.java
Index: GraphAccumModel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/GraphAccumModel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- GraphAccumModel.java 19 Apr 2002 02:08:52 -0000 1.2
+++ GraphAccumModel.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -219,13 +219,7 @@
catClass.debug("Start : addNewSample1");
// set time to time taken to load this url without components (e.g. images etc)
long totalTime = res.getTime();
- // however if there is a total time value then the url has other components
- // thus set the total time to be that value
- Long totalTimeLong = (Long) res.getValue(SampleResult.TOTAL_TIME);
- if (totalTimeLong != null)
- {
- totalTime = totalTimeLong.longValue();
- }
+
if (catClass.isDebugEnabled())
{
catClass.debug("addNewSample1 : time - " + totalTime);
1.3 +5 -6 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/MailerVisualizer.java
Index: MailerVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/MailerVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- MailerVisualizer.java 19 Apr 2002 02:08:52 -0000 1.2
+++ MailerVisualizer.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -84,8 +84,8 @@
* occurs.
*
*@author <a href="mailto:stuart@personalmd.com">Stuart Schmukler</a>
- *@created $Date: 2002/04/19 02:08:52 $
- *@version $Revision: 1.2 $ $Date: 2002/04/19 02:08:52 $
+ *@created $Date: 2002/04/26 00:03:57 $
+ *@version $Revision: 1.3 $ $Date: 2002/04/26 00:03:57 $
***********************************************************/
public class MailerVisualizer extends JPanel implements Visualizer, ActionListener
{
@@ -378,8 +378,7 @@
// -1 is the code for a failed sample.
//
- if (sample.getValue(SampleResult.SUCCESS) == null ||
- !((Boolean)sample.getValue(SampleResult.SUCCESS)).booleanValue())
+ if (!sample.isSuccessful())
{
failureCount++;
}
@@ -397,7 +396,7 @@
// Send the mail ...
Vector addressVector = newAddressVector(addressie);
sendMail(from, addressVector, failsubject, "URL Failed: " +
- sample.getValue(SampleResult.SAMPLE_LABEL), smtpHost);
+ sample.getSampleLabel(), smtpHost);
siteDown = true;
failureMsgSent = true;
successCount = 0;
@@ -414,7 +413,7 @@
{
Vector addressVector = newAddressVector(addressie);
sendMail(from, addressVector, successsubject, "URL Restarted: " +
- sample.getValue(SampleResult.SAMPLE_LABEL), smtpHost);
+ sample.getSampleLabel(), smtpHost);
siteDown = false;
successMsgSent = true;
}
1.3 +1 -5 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/StatVisualizerModel.java
Index: StatVisualizerModel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/StatVisualizerModel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- StatVisualizerModel.java 19 Apr 2002 02:08:52 -0000 1.2
+++ StatVisualizerModel.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -230,11 +230,7 @@
***************************************/
public void addNewSample(SampleResult res)
{
- boolean wasSuccessful = false;
- if(res.getValue("sampler.SUCCESS") != null)
- {
- wasSuccessful = ((Boolean)res.getValue("sampler.SUCCESS")).booleanValue();
- }
+ boolean wasSuccessful = res.isSuccessful();
addNewSample(res.getTime(), (String)res.getValue("sampler.LABEL"), wasSuccessful,
(String)res.getValue("sampler.RESPONSE_CODE"));
this.fireDataChanged();
1.3 +2 -2 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/TableDataModel.java
Index: TableDataModel.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/TableDataModel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TableDataModel.java 19 Apr 2002 02:08:52 -0000 1.2
+++ TableDataModel.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -114,8 +114,8 @@
public Sample addSample(SampleResult e)
{
- Sample s = addNewSample(e.getTime(),e.isSuccessfull(),
- (String)e.getValue(SampleResult.SAMPLE_LABEL));
+ Sample s = addNewSample(e.getTime(),e.isSuccessful(),
+ (String)e.getSampleLabel());
fireDataChanged();
return s;
}
1.3 +1 -1 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/TreeVisualizer.java
Index: TreeVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/TreeVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TreeVisualizer.java 19 Apr 2002 02:08:52 -0000 1.2
+++ TreeVisualizer.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -210,7 +210,7 @@
{
catClass.debug("Start : init1");
SampleResult rootSampleResult = new SampleResult();
- rootSampleResult.putValue(SampleResult.DISPLAY_NAME, "Root");
+ rootSampleResult.setSampleLabel("Root");
root = new DefaultMutableTreeNode(rootSampleResult);
treeModel = new DefaultTreeModel(root);
jTree = new JTree(treeModel);
1.3 +13 -10 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java
Index: ViewResultsFullVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/ViewResultsFullVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ViewResultsFullVisualizer.java 19 Apr 2002 02:08:52 -0000 1.2
+++ ViewResultsFullVisualizer.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -78,7 +78,7 @@
*
*@author Khor Soon Hin
*@created 2001/07/25
- *@version $Revision: 1.2 $ $Date: 2002/04/19 02:08:52 $
+ *@version $Revision: 1.3 $ $Date: 2002/04/26 00:03:57 $
***************************************/
public class ViewResultsFullVisualizer extends ViewResultsVisualizer implements
TreeSelectionListener
@@ -186,14 +186,13 @@
DefaultMutableTreeNode currNode = new DefaultMutableTreeNode(res);
treeModel.insertNodeInto(currNode, root, childIndex++);
- ArrayList arrayList = (ArrayList)res.getValue(SampleResult.RESULT_LIST);
- if(arrayList != null)
+ SampleResult[] subResults= res.getSubResults();
+ if(subResults != null)
{
- Iterator iter = arrayList.iterator();
int leafIndex = 0;
- while(iter.hasNext())
+ for(int i = 0;i < subResults.length;i++)
{
- SampleResult child = (SampleResult)iter.next();
+ SampleResult child = subResults[i];
if(catClass.isDebugEnabled())
catClass.debug("updateGui1 : child sample result - " + child);
@@ -321,13 +320,17 @@
// get the text response and image icon
// to determine which is NOT null
- byte[] responseBytes = (byte[])res.getValue(SampleResult.TEXT_RESPONSE);
+ byte[] responseBytes = (byte[])res.getResponseData();
String response = null;
- if(responseBytes != null)
+ ImageIcon icon = null;
+ if(res.getDataType().equals(SampleResult.TEXT))
{
response = new String(responseBytes);
}
- ImageIcon icon = (ImageIcon)res.getValue(HTTPSamplerFull.IMAGE);
+ else
+ {
+ icon = new ImageIcon(responseBytes);
+ }
if(catClass.isDebugEnabled())
{
if(response != null)
@@ -374,7 +377,7 @@
this.setLayout(new GridLayout(1, 1));
catClass.debug("Start : init1");
SampleResult rootSampleResult = new SampleResult();
- rootSampleResult.putValue(SampleResult.DISPLAY_NAME, "Root");
+ rootSampleResult.setSampleLabel("Root");
root = new DefaultMutableTreeNode(rootSampleResult);
treeModel = new DefaultTreeModel(root);
jTree = new JTree(treeModel);
1.3 +4 -4 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/ViewResultsVisualizer.java
Index: ViewResultsVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/ViewResultsVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ViewResultsVisualizer.java 19 Apr 2002 02:08:52 -0000 1.2
+++ ViewResultsVisualizer.java 26 Apr 2002 00:03:57 -0000 1.3
@@ -73,8 +73,8 @@
* "Continue" button.
*
*@author $Author: mstover1 $
- *@created $Date: 2002/04/19 02:08:52 $
- *@version $Revision: 1.2 $ $Date: 2002/04/19 02:08:52 $
+ *@created $Date: 2002/04/26 00:03:57 $
+ *@version $Revision: 1.3 $ $Date: 2002/04/26 00:03:57 $
***************************************/
public class ViewResultsVisualizer extends AbstractVisualizer implements ActionListener, Clearable
{
@@ -176,7 +176,7 @@
mainPanel.add(panelTitleLabel);
// NAME
- mainPanel.add(new NamePanel(model));
+ mainPanel.add(getNamePanel());
// INNER PANEL
JPanel innerPanel = new JPanel();
1.3 +36 -2 jakarta-jmeter/src_1/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java
Index: AbstractVisualizer.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src_1/org/apache/jmeter/visualizers/gui/AbstractVisualizer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractVisualizer.java 19 Apr 2002 02:08:53 -0000 1.2
+++ AbstractVisualizer.java 26 Apr 2002 00:03:58 -0000 1.3
@@ -1,5 +1,6 @@
package org.apache.jmeter.visualizers.gui;
import java.util.*;
+import java.io.*;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import org.apache.jmeter.gui.JMeterGUIComponent;
@@ -10,12 +11,13 @@
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.visualizers.Visualizer;
import org.apache.jmeter.reporters.ResultCollector;
+import org.apache.jmeter.gui.util.FilePanel;
/****************************************
* Title: JMeter Description: Copyright: Copyright (c) 2000 Company: Apache
*
*@author Michael Stover
- *@created $Date: 2002/04/19 02:08:53 $
+ *@created $Date: 2002/04/26 00:03:58 $
*@version 1.0
***************************************/
@@ -27,6 +29,8 @@
* !ToDo (Field description)
***************************************/
private NamePanel namePanel;
+ private FilePanel filePanel;
+ ResultCollector collector;
/****************************************
* !ToDo (Constructor description)
@@ -34,6 +38,7 @@
public AbstractVisualizer()
{
namePanel = new NamePanel();
+ filePanel = new FilePanel();
setName(getStaticLabel());
}
@@ -42,6 +47,11 @@
return namePanel;
}
+ protected FilePanel getFilePanel()
+ {
+ return filePanel;
+ }
+
/****************************************
* !ToDo (Method description)
*
@@ -63,6 +73,15 @@
return namePanel.getName();
}
+ public void setFile(String filename)
+ {
+ filePanel.setFilename(filename);
+ }
+
+ public String getFile()
+ {
+ return filePanel.getFilename();
+ }
/****************************************
* !ToDo (Method description)
@@ -74,6 +93,11 @@
return MenuFactory.getDefaultVisualizerMenu();
}
+ public void loadFile()
+ {
+ collector = (ResultCollector)createTestElement();
+ }
+
/****************************************
* !ToDo (Method description)
*
@@ -96,8 +120,18 @@
public TestElement createTestElement()
{
- ResultCollector collector = new ResultCollector();
+ if(collector == null)
+ {
+ collector = new ResultCollector();
+ }
configureTestElement(collector);
+ try
+ {
+ collector.setFilename(getFile());
+ }
+ catch(IOException e)
+ {
+ }
return collector;
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>