woolfel 2003/10/18 13:36:21
Modified: src/protocol/http/org/apache/jmeter/protocol/http/control/gui
AccessLogSamplerGui.java
Log:
the access log sampler now only checks the classes when the
user first enters it. If a user simply loads a test plan and
runs, it is possible the sampler will fail silently.
should consider adding logging to the sampler.
Revision Changes Path
1.6 +41 -5
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AccessLogSamplerGui.java 18 Oct 2003 04:46:16 -0000 1.5
+++ AccessLogSamplerGui.java 18 Oct 2003 20:36:21 -0000 1.6
@@ -63,6 +63,7 @@
import javax.swing.border.EmptyBorder;
import javax.swing.event.ChangeListener;
import javax.swing.event.ChangeEvent;
+import javax.swing.JOptionPane;
import org.apache.jmeter.protocol.http.sampler.AccessLogSampler;
import org.apache.jmeter.samplers.gui.AbstractSamplerGui;
@@ -163,13 +164,13 @@
{
if (SAMPLER == null){
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;
}
@@ -199,7 +200,6 @@
public void modifyTestElement(TestElement s)
{
SAMPLER = (AccessLogSampler) s;
- SAMPLER.setSamplerGUI(this);
this.configureTestElement(SAMPLER);
SAMPLER.setParserClassName(parserClassName.getText());
SAMPLER.setGeneratorClassName(generatorClassName.getText());
@@ -286,6 +286,7 @@
HOSTNAME.setText(SAMPLER.getDomain());
PORT.setText(String.valueOf(SAMPLER.getPort()));
getImages.setSelected(SAMPLER.isImageParser());
+
}
/**
@@ -298,14 +299,16 @@
{
if (event.getSource() == parserClassName)
{
- SAMPLER.instantiateParser();
+ SAMPLER.setParserClassName(parserClassName.getText());
+ handleParserEvent();
}
if (event.getSource() == logFile)
{
//this.setUpGenerator();
}
if (event.getSource() == generatorClassName){
- SAMPLER.instantiateGenerator();
+ SAMPLER.setGeneratorClassName(generatorClassName.getText());
+ handleGeneratorEvent();
}
if (event.getSource() == HOSTNAME){
}
@@ -313,4 +316,37 @@
}
}
+ /**
+ * handleParserEvent is used to check the
+ * parser class. If it is not valid, it
+ * should pop up an error message.
+ */
+ public void handleParserEvent(){
+ if(!SAMPLER.checkParser()){
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ this,
+ JMeterUtils.getResString("log_parser_cnf_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+
+ /**
+ * handleGeneratorEvent is used to check the
+ * generator class. If it is not valid, it
+ * should pop up an error message.
+ */
+ public void handleGeneratorEvent(){
+ if(!SAMPLER.checkGenerator()){
+ // we should pop up a dialog
+ JOptionPane.showConfirmDialog(
+ this,
+ JMeterUtils.getResString("generator_cnf_msg"),
+ "Warning",
+ JOptionPane.OK_CANCEL_OPTION,
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]