woolfel 2003/10/17 08:10:13
Modified: src/protocol/http/org/apache/jmeter/protocol/http/control/gui
AccessLogSamplerGui.java
src/protocol/http/org/apache/jmeter/protocol/http/sampler
AccessLogSampler.java
Log:
stripped the extra line break windows inserts
Revision Changes Path
1.2 +315 -315
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/AccessLogSamplerGui.java
Index: AccessLogSamplerGui.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/AccessLogSamplerGui.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AccessLogSamplerGui.java 17 Oct 2003 13:35:35 -0000 1.1
+++ AccessLogSamplerGui.java 17 Oct 2003 15:10:13 -0000 1.2
@@ -1,315 +1,315 @@
-/*
- * ====================================================================
- * 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 [EMAIL PROTECTED]
- *
- * 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.protocol.http.control.gui;
-
-import java.awt.Font;
-
-import javax.swing.JLabel;
-import javax.swing.JPanel;
-import javax.swing.JCheckBox;
-import javax.swing.border.Border;
-import javax.swing.border.EmptyBorder;
-import javax.swing.event.ChangeListener;
-import javax.swing.event.ChangeEvent;
-
-import org.apache.jmeter.protocol.http.sampler.AccessLogSampler;
-import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
-import org.apache.jmeter.testelement.TestElement;
-import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jmeter.gui.util.FilePanel;
-import org.apache.jorphan.gui.JLabeledTextField;
-import org.apache.jorphan.gui.layout.VerticalLayout;
-
-/**
- * Title: JMeter Access Log utilities<br>
- * Copyright: Apache.org<br>
- * Company: nobody<br>
- * License:<br>
- * <br>
- * Look at the apache license at the top.<br>
- * <br>
- * Description:<br>
- * So what is this log Sampler GUI? It is a sampler that
- * can take Tomcat access logs and use them directly. I
- * wrote a tomcat access log parser to convert each line
- * to a normal HttpSampler. This way, you can stress
- * test your servers using real production traffic. This
- * is useful for a couple of reasons. Some bugs are
- * really hard to track down, which only appear under
- * production traffic. Therefore it is desirable to use
- * the actual queries to simulate the same exact condition
- * to facilitate diagnosis.<p>
- * If you're working on a project to replace an existing
- * site, it is a good way to simulate the same exact
- * use pattern and compare the results. The goal here is
- * to get as close to apples to apples comparison as
- * possible. Running a select subset of queries against
- * a webserver normally catches a lot, but it won't give
- * an accurate picture of how a system will perform
- * under real requests.
- * <br>
- * Created on: Jun 26, 2003
- *
- * @author Peter Lin
- * @version $Id$
- */
-public class AccessLogSamplerGui
- extends AbstractSamplerGui
- implements ChangeListener
-{
-
- private static final String label = JMeterUtils.getResString("log_sampler");
- JLabeledTextField parserClassName =
- new JLabeledTextField(JMeterUtils.getResString("log_parser"));
- JLabeledTextField generatorClassName =
- new JLabeledTextField(JMeterUtils.getResString("generator"));
- JLabeledTextField HOSTNAME =
- new JLabeledTextField(JMeterUtils.getResString("servername"));
- JLabeledTextField PORT =
- new JLabeledTextField(JMeterUtils.getResString("port"));
- FilePanel logFile =
- new FilePanel(JMeterUtils.getResString("log_file"), ".txt");
- private JCheckBox getImages;
-
- protected int PORTNUMBER = 80;
-
- public String DEFAULT_GENERATOR =
- "org.apache.jmeter.protocol.http.util.accesslog.StandardGenerator";
- public String DEFAULT_PARSER =
- "org.apache.jmeter.protocol.http.util.accesslog.TCLogParser";
- private AccessLogSampler SAMPLER = null;
-
- /**
- * This is the font for the note.
- */
- Font plainText = new Font("plain", Font.PLAIN, 10);
-
- JLabel noteMessage =
- new JLabel(JMeterUtils.getResString("als_message"));
- JLabel noteMessage2 =
- new JLabel(JMeterUtils.getResString("als_message2"));
- JLabel noteMessage3 =
- new JLabel(JMeterUtils.getResString("als_message3"));
-
- public AccessLogSamplerGui()
- {
- init();
- }
-
- /**
- * @see JMeterGUIComponent#getStaticLabel()
- */
- public String getStaticLabel()
- {
- return label;
- }
-
- /**
- * @see JMeterGUIComponent#createTestElement()
- */
- public TestElement createTestElement()
- {
- if (SAMPLER == null){
- System.out.println("the sampler was null, therefore we create a new
one");
- SAMPLER = new AccessLogSampler();
- SAMPLER.setSamplerGUI(this);
- this.configureTestElement(SAMPLER);
- SAMPLER.setParserClassName(parserClassName.getText());
- SAMPLER.setGeneratorClassName(generatorClassName.getText());
- SAMPLER.setLogFile(logFile.getFilename());
- SAMPLER.setDomain(HOSTNAME.getText());
- SAMPLER.setPort(getPortNumber());
- }
- return SAMPLER;
- }
-
- /**
- * Utility method to parse the string and get a int port
- * number. If it couldn't parse the string to an integer,
- * it will return the default port 80.
- * @return
- */
- public int getPortNumber(){
- try {
- int port = Integer.parseInt(PORT.getText());
- return port;
- } catch (NumberFormatException exception){
- exception.printStackTrace();
- return 80;
- }
- }
-
- /**
- * Modifies a given TestElement to mirror the data in the gui components.
- * @see JMeterGUIComponent#modifyTestElement(TestElement)
- */
- public void modifyTestElement(TestElement s)
- {
- SAMPLER = (AccessLogSampler) s;
- SAMPLER.setSamplerGUI(this);
- this.configureTestElement(SAMPLER);
- SAMPLER.setParserClassName(parserClassName.getText());
- SAMPLER.setGeneratorClassName(generatorClassName.getText());
- SAMPLER.setLogFile(logFile.getFilename());
- SAMPLER.setDomain(HOSTNAME.getText());
- SAMPLER.setPort(getPortNumber());
- if (getImages.isSelected()){
- SAMPLER.setImageParser(true);
- } else {
- SAMPLER.setImageParser(false);
- }
- }
-
- /**
- * init() adds soapAction to the mainPanel. The class
- * reuses logic from SOAPSampler, since it is common.
- */
- private void init()
- {
- this.setLayout(
- new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
-
- // MAIN PANEL
- JPanel mainPanel = new JPanel();
- Border margin = new EmptyBorder(10, 10, 5, 10);
- mainPanel.setBorder(margin);
- mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
-
- // TITLE
- JLabel panelTitleLabel = new JLabel(label);
- Font curFont = panelTitleLabel.getFont();
- int curFontSize = curFont.getSize();
- curFontSize += 4;
- panelTitleLabel.setFont(
- new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
- mainPanel.add(panelTitleLabel);
- // NAME
- mainPanel.add(getNamePanel());
- mainPanel.add(HOSTNAME);
- mainPanel.add(PORT);
-
- mainPanel.add(parserClassName);
- mainPanel.add(generatorClassName);
- mainPanel.add(logFile);
- HOSTNAME.addChangeListener(this);
- PORT.addChangeListener(this);
- logFile.addChangeListener(this);
- parserClassName.addChangeListener(this);
- generatorClassName.addChangeListener(this);
-
- // RETRIEVE IMAGES
- JPanel retrieveImagesPanel = new JPanel();
- getImages =
- new JCheckBox(
-
JMeterUtils.getResString("web_testing_retrieve_images"));
- retrieveImagesPanel.add(getImages);
- mainPanel.add(retrieveImagesPanel);
- mainPanel.add(noteMessage);
- mainPanel.add(noteMessage2);
- mainPanel.add(noteMessage3);
-
- this.add(mainPanel);
- }
-
- /**
- * the implementation loads the URL and the soap
- * action for the request.
- */
- public void configure(TestElement el)
- {
- super.configure(el);
- SAMPLER = (AccessLogSampler) el;
- if (SAMPLER.getParserClassName().length() > 0){
- parserClassName.setText(SAMPLER.getParserClassName());
- } else {
- parserClassName.setText(this.DEFAULT_PARSER);
- }
- if (SAMPLER.getGeneratorClassName().length() > 0){
- generatorClassName.setText(SAMPLER.getGeneratorClassName());
- } else {
- generatorClassName.setText(this.DEFAULT_GENERATOR);
- }
- logFile.setFilename(SAMPLER.getLogFile());
- HOSTNAME.setText(SAMPLER.getDomain());
- PORT.setText(String.valueOf(SAMPLER.getPort()));
- getImages.setSelected(SAMPLER.isImageParser());
- }
-
- /**
- * stateChanged implements logic for the text field
- * and file chooser. When the value in the widget
- * changes, it will call the corresponding method to
- * create the parser and initialize the generator.
- */
- public void stateChanged(ChangeEvent event)
- {
- if (event.getSource() == parserClassName)
- {
- SAMPLER.instantiateParser();
- }
- if (event.getSource() == logFile)
- {
- //this.setUpGenerator();
- }
- if (event.getSource() == generatorClassName){
- SAMPLER.instantiateGenerator();
- }
- if (event.getSource() == HOSTNAME){
- }
- if (event.getSource() == PORT){
- }
- }
-
-}
+/*
+ * ====================================================================
+ * 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 [EMAIL PROTECTED]
+ *
+ * 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.protocol.http.control.gui;
+
+import java.awt.Font;
+
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JCheckBox;
+import javax.swing.border.Border;
+import javax.swing.border.EmptyBorder;
+import javax.swing.event.ChangeListener;
+import javax.swing.event.ChangeEvent;
+
+import org.apache.jmeter.protocol.http.sampler.AccessLogSampler;
+import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
+import org.apache.jmeter.testelement.TestElement;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jmeter.gui.util.FilePanel;
+import org.apache.jorphan.gui.JLabeledTextField;
+import org.apache.jorphan.gui.layout.VerticalLayout;
+
+/**
+ * Title: JMeter Access Log utilities<br>
+ * Copyright: Apache.org<br>
+ * Company: nobody<br>
+ * License:<br>
+ * <br>
+ * Look at the apache license at the top.<br>
+ * <br>
+ * Description:<br>
+ * So what is this log Sampler GUI? It is a sampler that
+ * can take Tomcat access logs and use them directly. I
+ * wrote a tomcat access log parser to convert each line
+ * to a normal HttpSampler. This way, you can stress
+ * test your servers using real production traffic. This
+ * is useful for a couple of reasons. Some bugs are
+ * really hard to track down, which only appear under
+ * production traffic. Therefore it is desirable to use
+ * the actual queries to simulate the same exact condition
+ * to facilitate diagnosis.<p>
+ * If you're working on a project to replace an existing
+ * site, it is a good way to simulate the same exact
+ * use pattern and compare the results. The goal here is
+ * to get as close to apples to apples comparison as
+ * possible. Running a select subset of queries against
+ * a webserver normally catches a lot, but it won't give
+ * an accurate picture of how a system will perform
+ * under real requests.
+ * <br>
+ * Created on: Jun 26, 2003
+ *
+ * @author Peter Lin
+ * @version $Id$
+ */
+public class AccessLogSamplerGui
+ extends AbstractSamplerGui
+ implements ChangeListener
+{
+
+ private static final String label = JMeterUtils.getResString("log_sampler");
+ JLabeledTextField parserClassName =
+ new JLabeledTextField(JMeterUtils.getResString("log_parser"));
+ JLabeledTextField generatorClassName =
+ new JLabeledTextField(JMeterUtils.getResString("generator"));
+ JLabeledTextField HOSTNAME =
+ new JLabeledTextField(JMeterUtils.getResString("servername"));
+ JLabeledTextField PORT =
+ new JLabeledTextField(JMeterUtils.getResString("port"));
+ FilePanel logFile =
+ new FilePanel(JMeterUtils.getResString("log_file"), ".txt");
+ private JCheckBox getImages;
+
+ protected int PORTNUMBER = 80;
+
+ public String DEFAULT_GENERATOR =
+ "org.apache.jmeter.protocol.http.util.accesslog.StandardGenerator";
+ public String DEFAULT_PARSER =
+ "org.apache.jmeter.protocol.http.util.accesslog.TCLogParser";
+ private AccessLogSampler SAMPLER = null;
+
+ /**
+ * This is the font for the note.
+ */
+ Font plainText = new Font("plain", Font.PLAIN, 10);
+
+ JLabel noteMessage =
+ new JLabel(JMeterUtils.getResString("als_message"));
+ JLabel noteMessage2 =
+ new JLabel(JMeterUtils.getResString("als_message2"));
+ JLabel noteMessage3 =
+ new JLabel(JMeterUtils.getResString("als_message3"));
+
+ public AccessLogSamplerGui()
+ {
+ init();
+ }
+
+ /**
+ * @see JMeterGUIComponent#getStaticLabel()
+ */
+ public String getStaticLabel()
+ {
+ return label;
+ }
+
+ /**
+ * @see JMeterGUIComponent#createTestElement()
+ */
+ public TestElement createTestElement()
+ {
+ if (SAMPLER == null){
+ System.out.println("the sampler was null, therefore we create a new
one");
+ SAMPLER = new AccessLogSampler();
+ SAMPLER.setSamplerGUI(this);
+ this.configureTestElement(SAMPLER);
+ SAMPLER.setParserClassName(parserClassName.getText());
+ SAMPLER.setGeneratorClassName(generatorClassName.getText());
+ SAMPLER.setLogFile(logFile.getFilename());
+ SAMPLER.setDomain(HOSTNAME.getText());
+ SAMPLER.setPort(getPortNumber());
+ }
+ return SAMPLER;
+ }
+
+ /**
+ * Utility method to parse the string and get a int port
+ * number. If it couldn't parse the string to an integer,
+ * it will return the default port 80.
+ * @return
+ */
+ public int getPortNumber(){
+ try {
+ int port = Integer.parseInt(PORT.getText());
+ return port;
+ } catch (NumberFormatException exception){
+ exception.printStackTrace();
+ return 80;
+ }
+ }
+
+ /**
+ * Modifies a given TestElement to mirror the data in the gui components.
+ * @see JMeterGUIComponent#modifyTestElement(TestElement)
+ */
+ public void modifyTestElement(TestElement s)
+ {
+ SAMPLER = (AccessLogSampler) s;
+ SAMPLER.setSamplerGUI(this);
+ this.configureTestElement(SAMPLER);
+ SAMPLER.setParserClassName(parserClassName.getText());
+ SAMPLER.setGeneratorClassName(generatorClassName.getText());
+ SAMPLER.setLogFile(logFile.getFilename());
+ SAMPLER.setDomain(HOSTNAME.getText());
+ SAMPLER.setPort(getPortNumber());
+ if (getImages.isSelected()){
+ SAMPLER.setImageParser(true);
+ } else {
+ SAMPLER.setImageParser(false);
+ }
+ }
+
+ /**
+ * init() adds soapAction to the mainPanel. The class
+ * reuses logic from SOAPSampler, since it is common.
+ */
+ private void init()
+ {
+ this.setLayout(
+ new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
+
+ // MAIN PANEL
+ JPanel mainPanel = new JPanel();
+ Border margin = new EmptyBorder(10, 10, 5, 10);
+ mainPanel.setBorder(margin);
+ mainPanel.setLayout(new VerticalLayout(5, VerticalLayout.LEFT));
+
+ // TITLE
+ JLabel panelTitleLabel = new JLabel(label);
+ Font curFont = panelTitleLabel.getFont();
+ int curFontSize = curFont.getSize();
+ curFontSize += 4;
+ panelTitleLabel.setFont(
+ new Font(curFont.getFontName(), curFont.getStyle(), curFontSize));
+ mainPanel.add(panelTitleLabel);
+ // NAME
+ mainPanel.add(getNamePanel());
+ mainPanel.add(HOSTNAME);
+ mainPanel.add(PORT);
+
+ mainPanel.add(parserClassName);
+ mainPanel.add(generatorClassName);
+ mainPanel.add(logFile);
+ HOSTNAME.addChangeListener(this);
+ PORT.addChangeListener(this);
+ logFile.addChangeListener(this);
+ parserClassName.addChangeListener(this);
+ generatorClassName.addChangeListener(this);
+
+ // RETRIEVE IMAGES
+ JPanel retrieveImagesPanel = new JPanel();
+ getImages =
+ new JCheckBox(
+
JMeterUtils.getResString("web_testing_retrieve_images"));
+ retrieveImagesPanel.add(getImages);
+ mainPanel.add(retrieveImagesPanel);
+ mainPanel.add(noteMessage);
+ mainPanel.add(noteMessage2);
+ mainPanel.add(noteMessage3);
+
+ this.add(mainPanel);
+ }
+
+ /**
+ * the implementation loads the URL and the soap
+ * action for the request.
+ */
+ public void configure(TestElement el)
+ {
+ super.configure(el);
+ SAMPLER = (AccessLogSampler) el;
+ if (SAMPLER.getParserClassName().length() > 0){
+ parserClassName.setText(SAMPLER.getParserClassName());
+ } else {
+ parserClassName.setText(this.DEFAULT_PARSER);
+ }
+ if (SAMPLER.getGeneratorClassName().length() > 0){
+ generatorClassName.setText(SAMPLER.getGeneratorClassName());
+ } else {
+ generatorClassName.setText(this.DEFAULT_GENERATOR);
+ }
+ logFile.setFilename(SAMPLER.getLogFile());
+ HOSTNAME.setText(SAMPLER.getDomain());
+ PORT.setText(String.valueOf(SAMPLER.getPort()));
+ getImages.setSelected(SAMPLER.isImageParser());
+ }
+
+ /**
+ * stateChanged implements logic for the text field
+ * and file chooser. When the value in the widget
+ * changes, it will call the corresponding method to
+ * create the parser and initialize the generator.
+ */
+ public void stateChanged(ChangeEvent event)
+ {
+ if (event.getSource() == parserClassName)
+ {
+ SAMPLER.instantiateParser();
+ }
+ if (event.getSource() == logFile)
+ {
+ //this.setUpGenerator();
+ }
+ if (event.getSource() == generatorClassName){
+ SAMPLER.instantiateGenerator();
+ }
+ if (event.getSource() == HOSTNAME){
+ }
+ if (event.getSource() == PORT){
+ }
+ }
+
+}
1.2 +432 -432
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
Index: AccessLogSampler.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AccessLogSampler.java 17 Oct 2003 13:54:38 -0000 1.1
+++ AccessLogSampler.java 17 Oct 2003 15:10:13 -0000 1.2
@@ -1,432 +1,432 @@
-/*
- * ====================================================================
- * 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 [EMAIL PROTECTED]
- *
- * 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.protocol.http.sampler;
-
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import javax.swing.JOptionPane;
-import org.apache.jmeter.samplers.Entry;
-import org.apache.jmeter.protocol.http.util.accesslog.LogParser;
-import org.apache.jmeter.protocol.http.util.accesslog.Generator;
-import org.apache.jmeter.protocol.http.util.accesslog.LogFilter;
-import org.apache.jmeter.protocol.http.control.gui.AccessLogSamplerGui;
-import org.apache.jmeter.samplers.SampleResult;
-import org.apache.jmeter.util.JMeterUtils;
-
-/**
- * Title: Apache Jakarta JMeter<br>
- * Copyright: Copyright (c) Apache<br>
- * Company: Apache<br>
- * License:<br>
- * <br>
- * The license is at the top!<br>
- * <br>
- * Description:<br>
- * <br>
- * AccessLogSampler is responsible for a couple of things:<p>
- * <ul>
- * <li> creating instances of Generator
- * <li> creating instances of Parser
- * <li> triggering popup windows
- * <li> calling Generator.generateRequest()
- * <li> checking to make sure the classes are valid
- * <li> making sure a class can be instantiated
- * </ul>
- * The intent of this sampler is it uses the generator and
- * parser to create a HTTPSampler when it is needed. It
- * does not contain logic about how to parse the logs. It
- * also doesn't care how Generator is implemented, as long
- * as it implements the interface. This means a person
- * could simply implement a dummy parser to generate
- * random parameters and the generator consumes the results.
- * This wasn't the original intent of the sampler. I
- * originaly wanted to write this sampler, so that I can
- * take production logs to simulate production traffic in
- * a test environment. Doing so is desirable to study odd
- * or unusual behavior. It's also good to compare a new
- * system against an existing system to get near apples-
- * to-apples comparison. I've been asked if benchmarks
- * are really fair comparisons just about every single
- * time, so this helps me accomplish that task.<p>
- * Some bugs only appear under production traffic, so it
- * is useful to generate traffic using production logs.
- * This way, JMeter can record when problems occur and
- * provide a way to match the server logs.
- * <p>
- * Created on: Jun 26, 2003
- *
- * @author Peter Lin
- * @version $Id$
- */
-public class AccessLogSampler extends HTTPSampler
-{
- public static final String DEFAULT_CLASS =
- "org.apache.jmeter.protocol.http.util.accesslog.TCLogParser";
-
- public static final String LOG_FILE =
- "AccessLogSampler.log_file";
- public static final String PARSER_CLASS_NAME =
"AccessLogSampler.parser_class_name";
- public static final String GENERATOR_CLASS_NAME =
"AccessLogSampler.generator_class_name";
-
- /** private members used by class **/
- private Generator GENERATOR = null;
- private LogParser PARSER = null;
- private LogFilter FILTER = null;
- private AccessLogSamplerGui GUI = null;
- private Class GENERATORCLASS = null;
- private Class PARSERCLASS = null;
-
- /**
- * I haven't decided on exactly how I want things, but for now
- * I'll call back to the gui to instantiate the objects.
- * @param gui
- */
- public void setSamplerGUI(AccessLogSamplerGui gui){
- GUI = gui;
- }
-
- /**
- * Set the path where XML messages are stored for random selection.
- */
- public void setLogFile(String path)
- {
- setProperty(LOG_FILE, path);
- }
-
- /**
- * Get the path where XML messages are stored. this is the directory where
- * JMeter will randomly select a file.
- */
- public String getLogFile()
- {
- return getPropertyAsString(LOG_FILE);
- }
-
- /**
- * it's kinda obvious, but we state it anyways. Set the xml file with a
- * string path.
- * @param String filename
- */
- public void setParserClassName(String classname)
- {
- setProperty(PARSER_CLASS_NAME, classname);
- }
-
- /**
- * Get the file location of the xml file.
- * @return String file path.
- */
- public String getParserClassName()
- {
- return getPropertyAsString(PARSER_CLASS_NAME);
- }
-
- /**
- * We give the user the choice of entering their own generator
- * instead of the default generator. This also has the positive
- * side effect that users can provide their own generators
- * without providing a parser. Things like creating a test plan
- * that randomly generates requests can be support in a simple
- * way for programmers. Non programmers should use existing
- * features to accomplish similar task.
- * @param classname
- */
- public void setGeneratorClassName(String classname){
- setProperty(GENERATOR_CLASS_NAME, classname);
- }
-
- /**
- * Return the name of the generator class to use.
- * @return
- */
- public String getGeneratorClassName(){
- return getPropertyAsString(GENERATOR_CLASS_NAME);
- }
-
- /**
- * Set the generator for the Sampler to use
- * @param gen
- */
- public void setGenerator(Generator gen){
- if (gen == null){
- } else {
- GENERATOR = gen;
- }
- }
-
- /**
- * Return the generator
- * @return
- */
- public Generator getGenerator(){
- return GENERATOR;
- }
-
- /**
- * Set the parser for the sampler to use
- * @param parser
- */
- public void setParser(LogParser parser){
- PARSER = parser;
- }
-
- /**
- * Return the parser
- * @return
- */
- public LogParser getParser(){
- return PARSER;
- }
-
- /**
- * sample gets a new HTTPSampler from the generator and
- * calls it's sample() method.
- */
- public SampleResult sampleWithGenerator()
- {
- this.instantiateParser();
- this.instantiateGenerator();
- HTTPSampler samp = null;
- SampleResult res = null;
- try
- {
- samp = (HTTPSampler) GENERATOR.generateRequest();
- samp.setDomain(this.getDomain());
- samp.setPort(this.getPort());
- samp.setImageParser(this.isImageParser());
- // we call parse with 1 to get only one.
- // this also means if we change the implementation
- // to use 2, it would use every other entry and
- // so on. Not that it is really useful, but a
- // person could use it that way if they have a
- // huge gigabyte log file and they only want to
- // use a quarter of the entries.
- PARSER.parse(1);
- res = samp.sample();
- res.setSampleLabel(samp.toString());
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return res;
- }
-
- /**
- * sample(Entry e) simply calls sample().
- * @param Entry e
- */
- public SampleResult sample(Entry e)
- {
- return sampleWithGenerator();
- }
-
- /**
- * Method will instantiate the generator. This is done to
- * make it easier for users to extend and plugin their
- * own generators.
- */
- public void instantiateGenerator(){
- if (this.getGeneratorClassName() != null
- && this.getGeneratorClassName().length() > 0)
- {
- try
- {
- if (GENERATORCLASS == null)
- {
- GENERATORCLASS =
-
Class.forName(this.getGeneratorClassName());
- }
- GENERATOR = (Generator) GENERATORCLASS.newInstance();
- if (GENERATOR != null)
- {
- if (this.getDomain() != null)
- {
- GENERATOR.setHost(this.getDomain());
- }
- if (this.getPort() > 0)
- {
- GENERATOR.setPort(this.getPort());
- }
- }
- if (PARSER != null && GENERATOR != null)
- {
- PARSER.setGenerator(GENERATOR);
- }
- }
- catch (ClassNotFoundException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
- JMeterUtils.getResString("generator_cnf_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- catch (InstantiationException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
-
JMeterUtils.getResString("generator_instantiate_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- catch (IllegalAccessException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
-
JMeterUtils.getResString("generator_illegal_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-
- /**
- * Method will instantiate the log parser based on
- * the class in the text field. This was done to
- * make it easier for people to plugin their own log parser
- * and use different log parser.
- * @return
- */
- public void instantiateParser()
- {
- if (this.getParserClassName() != null &&
this.getParserClassName().length() > 0)
- {
- try
- {
- if (PARSERCLASS == null)
- {
- PARSERCLASS =
Class.forName(this.getParserClassName());
- }
- if (PARSER == null)
- {
- if (this.getLogFile() != null
- && this.getLogFile().length() > 0)
- {
- PARSER = (LogParser)
PARSERCLASS.newInstance();
-
PARSER.setSourceFile(this.getLogFile());
- }
- }
- }
- catch (ClassNotFoundException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
- JMeterUtils.getResString("log_parser_cnf_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- catch (InstantiationException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
-
JMeterUtils.getResString("log_parser_instantiate_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- catch (IllegalAccessException e)
- {
- // we should pop up a dialog
- JOptionPane.showConfirmDialog(
- GUI,
-
JMeterUtils.getResString("log_parser_illegal_msg"),
- "Warning",
- JOptionPane.OK_CANCEL_OPTION,
- JOptionPane.ERROR_MESSAGE);
- }
- }
- }
-
- /**
- * We override this to prevent the wrong encoding and provide no
- * implementation. We want to reuse the other parts of HTTPSampler, but not
- * the connection. The connection is handled by the Apache SOAP driver.
- */
- public void addEncodedArgument(String name, String value, String metaData)
- {
- }
-
- /**
- * We override this to prevent the wrong encoding and provide no
- * implementation. We want to reuse the other parts of HTTPSampler, but not
- * the connection. The connection is handled by the Apache SOAP driver.
- */
- protected HttpURLConnection setupConnection(URL u, String method)
- throws IOException
- {
- return null;
- }
-
- /**
- * We override this to prevent the wrong encoding and provide no
- * implementation. We want to reuse the other parts of HTTPSampler, but not
- * the connection. The connection is handled by the Apache SOAP driver.
- */
- protected long connect() throws IOException
- {
- return -1;
- }
-}
+/*
+ * ====================================================================
+ * 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 [EMAIL PROTECTED]
+ *
+ * 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.protocol.http.sampler;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import javax.swing.JOptionPane;
+import org.apache.jmeter.samplers.Entry;
+import org.apache.jmeter.protocol.http.util.accesslog.LogParser;
+import org.apache.jmeter.protocol.http.util.accesslog.Generator;
+import org.apache.jmeter.protocol.http.util.accesslog.LogFilter;
+import org.apache.jmeter.protocol.http.control.gui.AccessLogSamplerGui;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * Title: Apache Jakarta JMeter<br>
+ * Copyright: Copyright (c) Apache<br>
+ * Company: Apache<br>
+ * License:<br>
+ * <br>
+ * The license is at the top!<br>
+ * <br>
+ * Description:<br>
+ * <br>
+ * AccessLogSampler is responsible for a couple of things:<p>
+ * <ul>
+ * <li> creating instances of Generator
+ * <li> creating instances of Parser
+ * <li> triggering popup windows
+ * <li> calling Generator.generateRequest()
+ * <li> checking to make sure the classes are valid
+ * <li> making sure a class can be instantiated
+ * </ul>
+ * The intent of this sampler is it uses the generator and
+ * parser to create a HTTPSampler when it is needed. It
+ * does not contain logic about how to parse the logs. It
+ * also doesn't care how Generator is implemented, as long
+ * as it implements the interface. This means a person
+ * could simply implement a dummy parser to generate
+ * random parameters and the generator consumes the results.
+ * This wasn't the original intent of the sampler. I
+ * originaly wanted to write this sampler, so that I can
+ * take production logs to simulate production traffic in
+ * a test environment. Doing so is desirable to study odd
+ * or unusual behavior. It's also good to compare a new
+ * system against an existing system to get near apples-
+ * to-apples comparison. I've been asked if benchmarks
+ * are really fair comparisons just about every single
+ * time, so this helps me accomplish that task.<p>
+ * Some bugs only appear under production traffic, so it
+ * is useful to generate traffic using production logs.
+ * This way, JMeter can record when problems occur and
+ * provide a way to match the server logs.
+ * <p>
+ * Created on: Jun 26, 2003
+ *
+ * @author Peter Lin
+ * @version $Id$
+ */
+public class AccessLogSampler extends HTTPSampler
+{
+ public static final String DEFAULT_CLASS =
+ "org.apache.jmeter.protocol.http.util.accesslog.TCLogParser";
+
+ public static final String LOG_FILE =
+ "AccessLogSampler.log_file";
+ public static final String PARSER_CLASS_NAME =
"AccessLogSampler.parser_class_name";
+ public static final String GENERATOR_CLASS_NAME =
"AccessLogSampler.generator_class_name";
+
+ /** private members used by class **/
+ private Generator GENERATOR = null;
+ private LogParser PARSER = null;
+ private LogFilter FILTER = null;
+ private AccessLogSamplerGui GUI = null;
+ private Class GENERATORCLASS = null;
+ private Class PARSERCLASS = null;
+
+ /**
+ * I haven't decided on exactly how I want things, but for now
+ * I'll call back to the gui to instantiate the objects.
+ * @param gui
+ */
+ public void setSamplerGUI(AccessLogSamplerGui gui){
+ GUI = gui;
+ }
+
+ /**
+ * Set the path where XML messages are stored for random selection.
+ */
+ public void setLogFile(String path)
+ {
+ setProperty(LOG_FILE, path);
+ }
+
+ /**
+ * Get the path where XML messages are stored. this is the directory where
+ * JMeter will randomly select a file.
+ */
+ public String getLogFile()
+ {
+ return getPropertyAsString(LOG_FILE);
+ }
+
+ /**
+ * it's kinda obvious, but we state it anyways. Set the xml file with a
+ * string path.
+ * @param String filename
+ */
+ public void setParserClassName(String classname)
+ {
+ setProperty(PARSER_CLASS_NAME, classname);
+ }
+
+ /**
+ * Get the file location of the xml file.
+ * @return String file path.
+ */
+ public String getParserClassName()
+ {
+ return getPropertyAsString(PARSER_CLASS_NAME);
+ }
+
+ /**
+ * We give the user the choice of entering their own generator
+ * instead of the default generator. This also has the positive
+ * side effect that users can provide their own generators
+ * without providing a parser. Things like creating a test plan
+ * that randomly generates requests can be support in a simple
+ * way for programmers. Non programmers should use existing
+ * features to accomplish similar task.
+ * @param classname
+ */
+ public void setGeneratorClassName(String classname){
+ setProperty(GENERATOR_CLASS_NAME, classname);
+ }
+
+ /**
+ * Return the name of the generator class to use.
+ * @return
+ */
+ public String getGeneratorClassName(){
+ return getPropertyAsString(GENERATOR_CLASS_NAME);
+ }
+
+ /**
+ * Set the generator for the Sampler to use
+ * @param gen
+ */
+ public void setGenerator(Generator gen){
+ if (gen == null){
+ } else {
+ GENERATOR = gen;
+ }
+ }
+
+ /**
+ * Return the generator
+ * @return
+ */
+ public Generator getGenerator(){
+ return GENERATOR;
+ }
+
+ /**
+ * Set the parser for the sampler to use
+ * @param parser
+ */
+ public void setParser(LogParser parser){
+ PARSER = parser;
+ }
+
+ /**
+ * Return the parser
+ * @return
+ */
+ public LogParser getParser(){
+ return PARSER;
+ }
+
+ /**
+ * sample gets a new HTTPSampler from the generator and
+ * calls it's sample() method.
+ */
+ public SampleResult sampleWithGenerator()
+ {
+ this.instantiateParser();
+ this.instantiateGenerator();
+ HTTPSampler samp = null;
+ SampleResult res = null;
+ try
+ {
+ samp = (HTTPSampler) GENERATOR.generateRequest();
+ samp.setDomain(this.getDomain());
+ samp.setPort(this.getPort());
+ samp.setImageParser(this.isImageParser());
+ // we call parse with 1 to get only one.
+ // this also means if we change the implementation
+ // to use 2, it would use every other entry and
+ // so on. Not that it is really useful, but a
+ // person could use it that way if they have a
+ // huge gigabyte log file and they only want to
+ // use a quarter of the entries.
+ PARSER.parse(1);
+ res = samp.sample();
+ res.setSampleLabel(samp.toString());
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return res;
+ }
+
+ /**
+ * sample(Entry e) simply calls sample().
+ * @param Entry e
+ */
+ public SampleResult sample(Entry e)
+ {
+ return sampleWithGenerator();
+ }
+
+ /**
+ * Method will instantiate the generator. This is done to
+ * make it easier for users to extend and plugin their
+ * own generators.
+ */
+ public void instantiateGenerator(){
+ if (this.getGeneratorClassName() != null
+ && this.getGeneratorClassName().length() > 0)
+ {
+ try
+ {
+ if (GENERATORCLASS == null)
+ {
+ GENERATORCLASS =
+
Class.forName(this.getGeneratorClassName());
+ }
+ GENERATOR = (Generator) GENERATORCLASS.newInstance();
+ if (GENERATOR != null)
+ {
+ if (this.getDomain() != null)
+ {
+ GENERATOR.setHost(this.getDomain());
+ }
+ if (this.getPort() > 0)
+ {
+ GENERATOR.setPort(this.getPort());
+ }
+ }
+ if (PARSER != null && GENERATOR != null)
+ {
+ PARSER.setGenerator(GENERATOR);
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+ JMeterUtils.getResString("generator_cnf_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ catch (InstantiationException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+
JMeterUtils.getResString("generator_instantiate_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ catch (IllegalAccessException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+
JMeterUtils.getResString("generator_illegal_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ /**
+ * Method will instantiate the log parser based on
+ * the class in the text field. This was done to
+ * make it easier for people to plugin their own log parser
+ * and use different log parser.
+ * @return
+ */
+ public void instantiateParser()
+ {
+ if (this.getParserClassName() != null &&
this.getParserClassName().length() > 0)
+ {
+ try
+ {
+ if (PARSERCLASS == null)
+ {
+ PARSERCLASS =
Class.forName(this.getParserClassName());
+ }
+ if (PARSER == null)
+ {
+ if (this.getLogFile() != null
+ && this.getLogFile().length() > 0)
+ {
+ PARSER = (LogParser)
PARSERCLASS.newInstance();
+
PARSER.setSourceFile(this.getLogFile());
+ }
+ }
+ }
+ catch (ClassNotFoundException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+ JMeterUtils.getResString("log_parser_cnf_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ catch (InstantiationException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+
JMeterUtils.getResString("log_parser_instantiate_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ catch (IllegalAccessException e)
+ {
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ GUI,
+
JMeterUtils.getResString("log_parser_illegal_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+ }
+
+ /**
+ * We override this to prevent the wrong encoding and provide no
+ * implementation. We want to reuse the other parts of HTTPSampler, but not
+ * the connection. The connection is handled by the Apache SOAP driver.
+ */
+ public void addEncodedArgument(String name, String value, String metaData)
+ {
+ }
+
+ /**
+ * We override this to prevent the wrong encoding and provide no
+ * implementation. We want to reuse the other parts of HTTPSampler, but not
+ * the connection. The connection is handled by the Apache SOAP driver.
+ */
+ protected HttpURLConnection setupConnection(URL u, String method)
+ throws IOException
+ {
+ return null;
+ }
+
+ /**
+ * We override this to prevent the wrong encoding and provide no
+ * implementation. We want to reuse the other parts of HTTPSampler, but not
+ * the connection. The connection is handled by the Apache SOAP driver.
+ */
+ protected long connect() throws IOException
+ {
+ return -1;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]