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 se...@apache.org on 2005/11/27 02:01:59 UTC
svn commit: r349162 [2/3] - in /jakarta/jmeter/branches/rel-2-1:
src/components/org/apache/jmeter/assertions/
src/components/org/apache/jmeter/assertions/gui/
src/components/org/apache/jmeter/extractor/
src/components/org/apache/jmeter/extractor/gui/ s...
Modified: jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java Sat Nov 26 17:01:05 2005
@@ -1,57 +1,57 @@
-//$Header$
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jorphan.gui;
-
-import javax.swing.table.TableModel;
-
-/**
- * @author Peter Lin
- *
- * This is a basic interface for TreeTableModel that extends TableModel.
- * It's pretty minimal and isn't as full featured at other implementations.
- */
-public interface TreeTableModel extends TableModel {
-
- /**
- * The method is similar to getValueAt(int,int). Instead of int,
- * the row is an object.
- * @param node
- * @param col
- * @return
- */
- public Object getValueAt(Object node, int col);
-
- /**
- * the method is similar to isCellEditable(int,int). Instead of int,
- * the row is an object.
- * @param node
- * @param col
- * @return
- */
- public boolean isCellEditable(Object node, int col);
-
- /**
- * the method is similar to isCellEditable(int,int). Instead of int,
- * the row is an object.
- * @param val
- * @param node
- * @param column
- */
- public void setValueAt(Object val, Object node, int column);
-}
+//$Header$
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jorphan.gui;
+
+import javax.swing.table.TableModel;
+
+/**
+ * @author Peter Lin
+ *
+ * This is a basic interface for TreeTableModel that extends TableModel.
+ * It's pretty minimal and isn't as full featured at other implementations.
+ */
+public interface TreeTableModel extends TableModel {
+
+ /**
+ * The method is similar to getValueAt(int,int). Instead of int,
+ * the row is an object.
+ * @param node
+ * @param col
+ * @return
+ */
+ public Object getValueAt(Object node, int col);
+
+ /**
+ * the method is similar to isCellEditable(int,int). Instead of int,
+ * the row is an object.
+ * @param node
+ * @param col
+ * @return
+ */
+ public boolean isCellEditable(Object node, int col);
+
+ /**
+ * the method is similar to isCellEditable(int,int). Instead of int,
+ * the row is an object.
+ * @param val
+ * @param node
+ * @param column
+ */
+ public void setValueAt(Object val, Object node, int column);
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/jorphan/org/apache/jorphan/gui/TreeTableModel.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerFactory.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/OrderPreservingLogParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jmeter/branches/rel-2-1/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/SharedTCLogParser.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java Sat Nov 26 17:01:05 2005
@@ -1,71 +1,71 @@
-// $Header $
-/*
- * Copyright 2001-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.gui.util;
-
-import java.io.File;
-
-import javax.swing.JFileChooser;
-
-import org.apache.jmeter.gui.ReportGuiPackage;
-import org.apache.jmeter.util.JMeterUtils;
-
-/**
- * @author Peter Lin
- * @version $Revision: 325542 $
- */
-public final class DirectoryDialoger {
- /**
- * The last directory visited by the user while choosing Files.
- */
- private static String lastJFCDirectory = null;
-
- private static JFileChooser jfc = new JFileChooser();
-
- /**
- * Prevent instantiation of utility class.
- */
- private DirectoryDialoger() {
- }
-
- /**
- *
- * @return
- */
- public static JFileChooser promptToOpenFile() {
-
- if (lastJFCDirectory == null) {
- String start = JMeterUtils.getPropDefault("user.dir", "");
-
- if (!start.equals("")) {
- jfc.setCurrentDirectory(new File(start));
- }
- }
- jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
- int retVal = jfc.showDialog(ReportGuiPackage.getInstance().getMainFrame(),
- JMeterUtils.getResString("report_select"));
- lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
-
- if (retVal == JFileChooser.APPROVE_OPTION) {
- return jfc;
- } else {
- return null;
- }
- }
-
-}
+// $Header $
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.gui.util;
+
+import java.io.File;
+
+import javax.swing.JFileChooser;
+
+import org.apache.jmeter.gui.ReportGuiPackage;
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * @author Peter Lin
+ * @version $Revision$
+ */
+public final class DirectoryDialoger {
+ /**
+ * The last directory visited by the user while choosing Files.
+ */
+ private static String lastJFCDirectory = null;
+
+ private static JFileChooser jfc = new JFileChooser();
+
+ /**
+ * Prevent instantiation of utility class.
+ */
+ private DirectoryDialoger() {
+ }
+
+ /**
+ *
+ * @return
+ */
+ public static JFileChooser promptToOpenFile() {
+
+ if (lastJFCDirectory == null) {
+ String start = JMeterUtils.getPropDefault("user.dir", "");
+
+ if (!start.equals("")) {
+ jfc.setCurrentDirectory(new File(start));
+ }
+ }
+ jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
+ int retVal = jfc.showDialog(ReportGuiPackage.getInstance().getMainFrame(),
+ JMeterUtils.getResString("report_select"));
+ lastJFCDirectory = jfc.getCurrentDirectory().getAbsolutePath();
+
+ if (retVal == JFileChooser.APPROVE_OPTION) {
+ return jfc;
+ } else {
+ return null;
+ }
+ }
+
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryDialoger.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java Sat Nov 26 17:01:05 2005
@@ -1,151 +1,151 @@
-// $Header $
-/*
- * Copyright 2002-2004 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.gui.util;
-
-import java.awt.Color;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.swing.BorderFactory;
-import javax.swing.Box;
-import javax.swing.JButton;
-import javax.swing.JFileChooser;
-import javax.swing.JTextField;
-import javax.swing.event.ChangeEvent;
-import javax.swing.event.ChangeListener;
-
-import org.apache.jmeter.util.JMeterUtils;
-
-/**
- * @author Michael Stover Created April 18, 2002
- * @version $Revision: 325542 $ Last updated: $Date: 2005-07-12 16:51:09 -0400 (Tue, 12 Jul 2005) $
- */
-public class DirectoryPanel extends HorizontalPanel implements ActionListener {
- protected JTextField filename = new JTextField(20);
-
- protected JButton browse = new JButton(JMeterUtils.getResString("browse"));
-
- List listeners = new LinkedList();
-
- String title;
-
- String filetype;
-
- Color background;
-
- /**
- * Constructor for the FilePanel object.
- */
- public DirectoryPanel() {
- title = "";
- init();
- }
-
- public DirectoryPanel(String title) {
- this.title = title;
- init();
- }
-
- public DirectoryPanel(String title, String filetype, Color bk) {
- this(title,filetype);
- this.background = bk;
- init();
- }
-
- public DirectoryPanel(String title, String filetype) {
- this(title);
- this.filetype = filetype;
- }
-
- /**
- * Constructor for the FilePanel object.
- */
- public DirectoryPanel(ChangeListener l, String title) {
- this.title = title;
- init();
- listeners.add(l);
- }
-
- public void addChangeListener(ChangeListener l) {
- listeners.add(l);
- }
-
- private void init() {
- setBackground(this.background);
- setBorder(BorderFactory.createTitledBorder(title));
- add(Box.createHorizontalStrut(5));
- add(filename);
- add(Box.createHorizontalStrut(5));
- filename.addActionListener(this);
- add(browse);
- browse.setActionCommand("browse");
- browse.addActionListener(this);
- }
-
- /**
- * If the gui needs to enable/disable the FilePanel, call the method.
- *
- * @param enable
- */
- public void enableFile(boolean enable) {
- browse.setEnabled(enable);
- filename.setEnabled(enable);
- }
-
- /**
- * 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);
- }
-
- private void fireFileChanged() {
- Iterator iter = listeners.iterator();
- while (iter.hasNext()) {
- ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this));
- }
- }
-
- public void actionPerformed(ActionEvent e) {
- if (e.getActionCommand().equals("browse")) {
- JFileChooser chooser = DirectoryDialoger.promptToOpenFile();
- if (chooser.getSelectedFile() != null) {
- filename.setText(chooser.getSelectedFile().getPath());
- fireFileChanged();
- }
- } else {
- fireFileChanged();
- }
- }
-}
+// $Header $
+/*
+ * Copyright 2002-2004 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.gui.util;
+
+import java.awt.Color;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.JButton;
+import javax.swing.JFileChooser;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.apache.jmeter.util.JMeterUtils;
+
+/**
+ * @author Michael Stover Created April 18, 2002
+ * @version $Revision$ Last updated: $Date$
+ */
+public class DirectoryPanel extends HorizontalPanel implements ActionListener {
+ protected JTextField filename = new JTextField(20);
+
+ protected JButton browse = new JButton(JMeterUtils.getResString("browse"));
+
+ List listeners = new LinkedList();
+
+ String title;
+
+ String filetype;
+
+ Color background;
+
+ /**
+ * Constructor for the FilePanel object.
+ */
+ public DirectoryPanel() {
+ title = "";
+ init();
+ }
+
+ public DirectoryPanel(String title) {
+ this.title = title;
+ init();
+ }
+
+ public DirectoryPanel(String title, String filetype, Color bk) {
+ this(title,filetype);
+ this.background = bk;
+ init();
+ }
+
+ public DirectoryPanel(String title, String filetype) {
+ this(title);
+ this.filetype = filetype;
+ }
+
+ /**
+ * Constructor for the FilePanel object.
+ */
+ public DirectoryPanel(ChangeListener l, String title) {
+ this.title = title;
+ init();
+ listeners.add(l);
+ }
+
+ public void addChangeListener(ChangeListener l) {
+ listeners.add(l);
+ }
+
+ private void init() {
+ setBackground(this.background);
+ setBorder(BorderFactory.createTitledBorder(title));
+ add(Box.createHorizontalStrut(5));
+ add(filename);
+ add(Box.createHorizontalStrut(5));
+ filename.addActionListener(this);
+ add(browse);
+ browse.setActionCommand("browse");
+ browse.addActionListener(this);
+ }
+
+ /**
+ * If the gui needs to enable/disable the FilePanel, call the method.
+ *
+ * @param enable
+ */
+ public void enableFile(boolean enable) {
+ browse.setEnabled(enable);
+ filename.setEnabled(enable);
+ }
+
+ /**
+ * 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);
+ }
+
+ private void fireFileChanged() {
+ Iterator iter = listeners.iterator();
+ while (iter.hasNext()) {
+ ((ChangeListener) iter.next()).stateChanged(new ChangeEvent(this));
+ }
+ }
+
+ public void actionPerformed(ActionEvent e) {
+ if (e.getActionCommand().equals("browse")) {
+ JFileChooser chooser = DirectoryDialoger.promptToOpenFile();
+ if (chooser.getSelectedFile() != null) {
+ filename.setText(chooser.getSelectedFile().getPath());
+ fireFileChanged();
+ }
+ } else {
+ fireFileChanged();
+ }
+ }
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/gui/util/DirectoryPanel.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java Sat Nov 26 17:01:05 2005
@@ -1,124 +1,124 @@
-//$Header$
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.jmeter.visualizers.SamplingStatCalculator;
-import org.apache.jmeter.visualizers.Visualizer;
-
-/**
- * @author Peter Lin
- *
- * DataSet extends Visualizer so that it can be used with ResultCollector.
- * Classes implementing the interface should create a new instance of
- * ResultCollector and call setListener(Visualizer) passing itself.
- * When the ResultCollector.loadExistingFile is called, it will pass
- * the SampleResults.
- */
-public interface DataSet extends Visualizer {
-
- /**
- * Depending on the implementation, the datasouce could be a file
- * or a RDBMS. It's up to the implementing class to decide.
- * @param datasource
- */
- public void setDataSource(String datasource);
- /**
- * Return the datasource. For files, it should be the absolute path.
- * For databases, it should be the datasource name created in jmeter.
- * @return
- */
- public String getDataSource();
- /**
- * In some cases, we may want to return a string that isn't the full
- * datasource string or something different. For example, we may
- * want to return just the filename and not the absolutePath of
- * a JTL file.
- * @return
- */
- public String getDataSourceName();
- /**
- * Set the timestamp using the first result from the datasource
- * @param stamp
- */
- public void setStartTimestamp(long stamp);
- /**
- * return the timestamp in millisecond format.
- * @return
- */
- public long getStartTimestamp();
- /**
- * Set the timestamp using the last result from the datasource
- * @param stamp
- */
- public void setEndTimestamp(long stamp);
- /**
- * return the timestamp in millisecond format.
- * @return
- */
- public long getEndTimestamp();
- /**
- * Return the Date object using the start timestamp
- * @return
- */
- public Date getDate();
- /**
- * convienance method for getting the date in mmdd format
- * @return
- */
- public String getMonthDayDate();
- /**
- * convienant method for getting the date in yyyymmdd format
- * @return
- */
- public String getMonthDayYearDate();
- /**
- * Classes implementing the method should return the URL's in the
- * DataSet. It is up to the class to return Strings or URL.
- * @return
- */
- public Set getURLs();
- /**
- * Classes implementing the method should return instance of
- * SamplingStatCalculator.
- * @return
- */
- public Set getStats();
- /**
- * Return the SamplingStatCalculate for a specific URL.
- * @param url
- * @return
- */
- public SamplingStatCalculator getStatistics(String url);
- /**
- * Convienance method for getting all the SamplingStatCalculator for
- * a given URL.
- * @param urls
- * @return
- */
- public List getStats(List urls);
- /**
- * Classes implementing the method should load the data from
- * the target location. It doesn't necessarily have to be a
- * file. It could be from a database.
- */
- public void loadData();
-}
+//$Header$
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.jmeter.visualizers.SamplingStatCalculator;
+import org.apache.jmeter.visualizers.Visualizer;
+
+/**
+ * @author Peter Lin
+ *
+ * DataSet extends Visualizer so that it can be used with ResultCollector.
+ * Classes implementing the interface should create a new instance of
+ * ResultCollector and call setListener(Visualizer) passing itself.
+ * When the ResultCollector.loadExistingFile is called, it will pass
+ * the SampleResults.
+ */
+public interface DataSet extends Visualizer {
+
+ /**
+ * Depending on the implementation, the datasouce could be a file
+ * or a RDBMS. It's up to the implementing class to decide.
+ * @param datasource
+ */
+ public void setDataSource(String datasource);
+ /**
+ * Return the datasource. For files, it should be the absolute path.
+ * For databases, it should be the datasource name created in jmeter.
+ * @return
+ */
+ public String getDataSource();
+ /**
+ * In some cases, we may want to return a string that isn't the full
+ * datasource string or something different. For example, we may
+ * want to return just the filename and not the absolutePath of
+ * a JTL file.
+ * @return
+ */
+ public String getDataSourceName();
+ /**
+ * Set the timestamp using the first result from the datasource
+ * @param stamp
+ */
+ public void setStartTimestamp(long stamp);
+ /**
+ * return the timestamp in millisecond format.
+ * @return
+ */
+ public long getStartTimestamp();
+ /**
+ * Set the timestamp using the last result from the datasource
+ * @param stamp
+ */
+ public void setEndTimestamp(long stamp);
+ /**
+ * return the timestamp in millisecond format.
+ * @return
+ */
+ public long getEndTimestamp();
+ /**
+ * Return the Date object using the start timestamp
+ * @return
+ */
+ public Date getDate();
+ /**
+ * convienance method for getting the date in mmdd format
+ * @return
+ */
+ public String getMonthDayDate();
+ /**
+ * convienant method for getting the date in yyyymmdd format
+ * @return
+ */
+ public String getMonthDayYearDate();
+ /**
+ * Classes implementing the method should return the URL's in the
+ * DataSet. It is up to the class to return Strings or URL.
+ * @return
+ */
+ public Set getURLs();
+ /**
+ * Classes implementing the method should return instance of
+ * SamplingStatCalculator.
+ * @return
+ */
+ public Set getStats();
+ /**
+ * Return the SamplingStatCalculate for a specific URL.
+ * @param url
+ * @return
+ */
+ public SamplingStatCalculator getStatistics(String url);
+ /**
+ * Convienance method for getting all the SamplingStatCalculator for
+ * a given URL.
+ * @param urls
+ * @return
+ */
+ public List getStats(List urls);
+ /**
+ * Classes implementing the method should load the data from
+ * the target location. It doesn't necessarily have to be a
+ * file. It could be from a database.
+ */
+ public void loadData();
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/DataSet.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java Sat Nov 26 17:01:05 2005
@@ -1,32 +1,32 @@
-//$Header$
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report;
-
-import java.util.List;
-import javax.swing.JComponent;
-
-
-public interface ReportChart {
- /**
- * The method takes a list of the DataSet items. It is up to the chart
- * class to extract the data and use it to render a graphic.
- * @param list of DataSet
- * @return
- */
- JComponent renderChart(List data);
-}
+//$Header$
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report;
+
+import java.util.List;
+import javax.swing.JComponent;
+
+
+public interface ReportChart {
+ /**
+ * The method takes a list of the DataSet items. It is up to the chart
+ * class to extract the data and use it to render a graphic.
+ * @param list of DataSet
+ * @return
+ */
+ JComponent renderChart(List data);
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportChart.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java Sat Nov 26 17:01:05 2005
@@ -1,28 +1,28 @@
-//$Header$
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report;
-
-import java.util.List;
-
-/**
- * @author Peter Lin
- *
- */
-public interface ReportTable {
- String[][] getTableData(List data);
-}
+//$Header$
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report;
+
+import java.util.List;
+
+/**
+ * @author Peter Lin
+ *
+ */
+public interface ReportTable {
+ String[][] getTableData(List data);
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/report/ReportTable.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java (original)
+++ jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java Sat Nov 26 17:01:05 2005
@@ -1,227 +1,227 @@
-//$Header$
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.testelement;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.jmeter.report.DataSet;
-import org.apache.jmeter.reporters.ResultCollector;
-import org.apache.jmeter.samplers.SampleResult;
-import org.apache.jmeter.visualizers.SamplingStatCalculator;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
-
-/**
- * @author Peter Lin
- *
- * The purpose of TableData is to contain the results of a single .jtl file.
- * It is equivalent to what the AggregateListener table. A HashMap is used
- * to store the data. The URL is the key and the value is SamplingStatCalculator
- */
-public class JTLData implements Serializable, DataSet {
-
- private static final Logger log = LoggingManager.getLoggerForClass();
-
- protected HashMap data = new HashMap();
- protected String jtl_file = null;
- protected long startTimestamp = 0;
- protected long endTimestamp = 0;
- protected File inputFile = null;
-
- /**
- *
- */
- public JTLData() {
- super();
- }
-
- /**
- * Return a Set of the URL's
- * @return
- */
- public Set getURLs() {
- return this.data.keySet();
- }
-
- /**
- * Return a Set of the values
- * @return
- */
- public Set getStats() {
- return this.data.entrySet();
- }
-
- /**
- * The purpose of the method is to make it convienant to pass a list
- * of the URL's and return a list of the SamplingStatCalculators. If
- * no URL's match, the list is empty.
- * The SamplingStatCalculators will be returned in the same sequence
- * as the url list.
- * @param urls
- * @return
- */
- public List getStats(List urls) {
- ArrayList items = new ArrayList();
- Iterator itr = urls.iterator();
- if (itr.hasNext()) {
- SamplingStatCalculator row = (SamplingStatCalculator)itr.next();
- if (row != null) {
- items.add(row);
- }
- }
- return items;
- }
-
- public void setDataSource(String absolutePath) {
- this.jtl_file = absolutePath;
- }
-
- public String getDataSource() {
- return this.jtl_file;
- }
-
- public String getDataSourceName() {
- if (inputFile == null) {
- inputFile = new File(getDataSource());
- }
- return inputFile.getName().substring(0,inputFile.getName().length() - 4);
- }
-
- public void setStartTimestamp(long stamp) {
- this.startTimestamp = stamp;
- }
-
- public long getStartTimestamp() {
- return this.startTimestamp;
- }
-
- public void setEndTimestamp(long stamp) {
- this.endTimestamp = stamp;
- }
-
- public long getEndTimestamp() {
- return this.endTimestamp;
- }
-
- /**
- * The date we use for the result is the start timestamp. The
- * reasoning is that a test may run for a long time, but it
- * is most likely scheduled to run using CRON on unix or
- * scheduled task in windows.
- * @return
- */
- public Date getDate() {
- return new Date(this.startTimestamp);
- }
-
- public String getMonthDayDate() {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(this.startTimestamp);
- return String.valueOf(cal.get(Calendar.MONTH)) + " - " +
- String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
- }
-
- public String getMonthDayYearDate() {
- Calendar cal = Calendar.getInstance();
- cal.setTimeInMillis(this.startTimestamp);
- return String.valueOf(cal.get(Calendar.MONTH)) + " - " +
- String.valueOf(cal.get(Calendar.DAY_OF_MONTH)) + " - " +
- String.valueOf(cal.get(Calendar.YEAR));
- }
-
- /**
- * The method will SamplingStatCalculator for the given URL. If the URL
- * doesn't exist, the method returns null.
- * @param url
- * @return
- */
- public SamplingStatCalculator getStatistics(String url) {
- if (this.data.containsKey(url)) {
- return (SamplingStatCalculator)this.data.get(url);
- } else {
- return null;
- }
- }
-
- /**
- * The implementation loads a single .jtl file and cleans up the
- * ResultCollector.
- */
- public void loadData() {
- if (this.getDataSource() != null) {
- ResultCollector rc = new ResultCollector();
- rc.setFilename(this.getDataSource());
- rc.setListener(this);
- try {
- rc.loadExistingFile();
- } catch (IOException e) {
- log.warn(e.getMessage());
- // e.printStackTrace();
- } finally {
- // we clean up the ResultCollector to make sure there's
- // no slow leaks
- rc.clear();
- rc.setListener(null);
- rc = null;
- }
- }
- }
-
- /**
- * the implementation will set the start timestamp if the HashMap
- * is empty. otherwise it will set the end timestamp using the
- * end time
- */
- public void add(SampleResult sample) {
- if (data.size() == 0) {
- this.startTimestamp = sample.getTimeStamp();
- } else {
- this.endTimestamp = sample.getTimeStamp() + sample.getTime();
- }
- // now add the samples to the HashMap
- String url = sample.getSampleLabel();
- if (url == null) {
- url = sample.getURL().toString();
- }
- SamplingStatCalculator row = (SamplingStatCalculator)data.get(url);
- if (row == null) {
- row = new SamplingStatCalculator();
- // just like the aggregate listener, we use the sample label to represent
- // a row. in this case, we use it as a key.
- this.data.put(url,row);
- }
- row.addSample(sample);
- }
-
- /**
- * By default, the method always returns true. Subclasses can over
- * ride the implementation.
- */
- public boolean isStats() {
- return true;
- }
-}
+//$Header$
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.testelement;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.jmeter.report.DataSet;
+import org.apache.jmeter.reporters.ResultCollector;
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.visualizers.SamplingStatCalculator;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * @author Peter Lin
+ *
+ * The purpose of TableData is to contain the results of a single .jtl file.
+ * It is equivalent to what the AggregateListener table. A HashMap is used
+ * to store the data. The URL is the key and the value is SamplingStatCalculator
+ */
+public class JTLData implements Serializable, DataSet {
+
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ protected HashMap data = new HashMap();
+ protected String jtl_file = null;
+ protected long startTimestamp = 0;
+ protected long endTimestamp = 0;
+ protected File inputFile = null;
+
+ /**
+ *
+ */
+ public JTLData() {
+ super();
+ }
+
+ /**
+ * Return a Set of the URL's
+ * @return
+ */
+ public Set getURLs() {
+ return this.data.keySet();
+ }
+
+ /**
+ * Return a Set of the values
+ * @return
+ */
+ public Set getStats() {
+ return this.data.entrySet();
+ }
+
+ /**
+ * The purpose of the method is to make it convienant to pass a list
+ * of the URL's and return a list of the SamplingStatCalculators. If
+ * no URL's match, the list is empty.
+ * The SamplingStatCalculators will be returned in the same sequence
+ * as the url list.
+ * @param urls
+ * @return
+ */
+ public List getStats(List urls) {
+ ArrayList items = new ArrayList();
+ Iterator itr = urls.iterator();
+ if (itr.hasNext()) {
+ SamplingStatCalculator row = (SamplingStatCalculator)itr.next();
+ if (row != null) {
+ items.add(row);
+ }
+ }
+ return items;
+ }
+
+ public void setDataSource(String absolutePath) {
+ this.jtl_file = absolutePath;
+ }
+
+ public String getDataSource() {
+ return this.jtl_file;
+ }
+
+ public String getDataSourceName() {
+ if (inputFile == null) {
+ inputFile = new File(getDataSource());
+ }
+ return inputFile.getName().substring(0,inputFile.getName().length() - 4);
+ }
+
+ public void setStartTimestamp(long stamp) {
+ this.startTimestamp = stamp;
+ }
+
+ public long getStartTimestamp() {
+ return this.startTimestamp;
+ }
+
+ public void setEndTimestamp(long stamp) {
+ this.endTimestamp = stamp;
+ }
+
+ public long getEndTimestamp() {
+ return this.endTimestamp;
+ }
+
+ /**
+ * The date we use for the result is the start timestamp. The
+ * reasoning is that a test may run for a long time, but it
+ * is most likely scheduled to run using CRON on unix or
+ * scheduled task in windows.
+ * @return
+ */
+ public Date getDate() {
+ return new Date(this.startTimestamp);
+ }
+
+ public String getMonthDayDate() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeInMillis(this.startTimestamp);
+ return String.valueOf(cal.get(Calendar.MONTH)) + " - " +
+ String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
+ }
+
+ public String getMonthDayYearDate() {
+ Calendar cal = Calendar.getInstance();
+ cal.setTimeInMillis(this.startTimestamp);
+ return String.valueOf(cal.get(Calendar.MONTH)) + " - " +
+ String.valueOf(cal.get(Calendar.DAY_OF_MONTH)) + " - " +
+ String.valueOf(cal.get(Calendar.YEAR));
+ }
+
+ /**
+ * The method will SamplingStatCalculator for the given URL. If the URL
+ * doesn't exist, the method returns null.
+ * @param url
+ * @return
+ */
+ public SamplingStatCalculator getStatistics(String url) {
+ if (this.data.containsKey(url)) {
+ return (SamplingStatCalculator)this.data.get(url);
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * The implementation loads a single .jtl file and cleans up the
+ * ResultCollector.
+ */
+ public void loadData() {
+ if (this.getDataSource() != null) {
+ ResultCollector rc = new ResultCollector();
+ rc.setFilename(this.getDataSource());
+ rc.setListener(this);
+ try {
+ rc.loadExistingFile();
+ } catch (IOException e) {
+ log.warn(e.getMessage());
+ // e.printStackTrace();
+ } finally {
+ // we clean up the ResultCollector to make sure there's
+ // no slow leaks
+ rc.clear();
+ rc.setListener(null);
+ rc = null;
+ }
+ }
+ }
+
+ /**
+ * the implementation will set the start timestamp if the HashMap
+ * is empty. otherwise it will set the end timestamp using the
+ * end time
+ */
+ public void add(SampleResult sample) {
+ if (data.size() == 0) {
+ this.startTimestamp = sample.getTimeStamp();
+ } else {
+ this.endTimestamp = sample.getTimeStamp() + sample.getTime();
+ }
+ // now add the samples to the HashMap
+ String url = sample.getSampleLabel();
+ if (url == null) {
+ url = sample.getURL().toString();
+ }
+ SamplingStatCalculator row = (SamplingStatCalculator)data.get(url);
+ if (row == null) {
+ row = new SamplingStatCalculator();
+ // just like the aggregate listener, we use the sample label to represent
+ // a row. in this case, we use it as a key.
+ this.data.put(url,row);
+ }
+ row.addSample(sample);
+ }
+
+ /**
+ * By default, the method always returns true. Subclasses can over
+ * ride the implementation.
+ */
+ public boolean isStats() {
+ return true;
+ }
+}
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/src/reports/org/apache/jmeter/testelement/JTLData.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java (original)
+++ jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java Sat Nov 26 17:01:05 2005
@@ -1,258 +1,258 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.assertions;
-
-import org.apache.jmeter.samplers.SampleResult;
-import org.apache.jmeter.threads.JMeterContext;
-import org.apache.jmeter.threads.JMeterContextService;
-import org.apache.jmeter.threads.JMeterVariables;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
-
-import junit.framework.TestCase;
-import junit.textui.TestRunner;
-public class PackageTest extends TestCase {
-
- public PackageTest() {
- super();
- }
-
- public PackageTest(String arg0) {
- super(arg0);
- }
- public void testHex() throws Exception {
- assertEquals("00010203", MD5HexAssertion.baToHex(new byte[] { 0, 1, 2, 3 }));
- assertEquals("03020100", MD5HexAssertion.baToHex(new byte[] { 3, 2, 1, 0 }));
- assertEquals("0f807fff", MD5HexAssertion.baToHex(new byte[] { 0xF, -128, 127, -1 }));
- }
-
- public void testMD5() throws Exception {
- assertEquals("D41D8CD98F00B204E9800998ECF8427E", MD5HexAssertion.baMD5Hex(new byte[] {}).toUpperCase());
- }
-
- int threadsRunning;
-
- int failed;
-
- public void testThreadSafety() throws Exception {
- Thread[] threads = new Thread[100];
- for (int i = 0; i < threads.length; i++) {
- threads[i] = new TestThread();
- }
- failed = 0;
- for (int i = 0; i < threads.length; i++) {
- threads[i].start();
- threadsRunning++;
- }
- synchronized (this) {
- while (threadsRunning > 0) {
- wait();
- }
- }
- assertEquals(failed, 0);
- }
-
- class TestThread extends Thread {
- static final String TEST_STRING = "DAbale arroz a la zorra el abad.";
-
- // Used to be 'dábale', but caused trouble on Gump. Reasons
- // unknown.
- static final String TEST_PATTERN = ".*A.*\\.";
-
- public void run() {
- ResponseAssertion assertion = new ResponseAssertion(
- ResponseAssertion.RESPONSE_DATA, ResponseAssertion.CONTAINS, TEST_PATTERN);
- SampleResult response = new SampleResult();
- response.setResponseData(TEST_STRING.getBytes());
- for (int i = 0; i < 100; i++) {
- AssertionResult result;
- result = assertion.evaluateResponse(response);
- if (result.isFailure() || result.isError()) {
- failed++;
- }
- }
- synchronized (PackageTest.this) {
- threadsRunning--;
- PackageTest.this.notifyAll();
- }
- }
- }
- public static class XPathAssertionTest extends TestCase {
- private static final Logger log = LoggingManager.getLoggerForClass();
-
- XPathAssertion assertion;
-
- SampleResult result;
-
- JMeterVariables vars;
-
- JMeterContext jmctx;
-
- public XPathAssertionTest() {
- super();
- }
-
- public XPathAssertionTest(String name) {
- super(name);
- }
-
- public void setUp() {
- jmctx = JMeterContextService.getContext();
- assertion = new XPathAssertion();
- assertion.setThreadContext(jmctx);// This would be done by the run
- // command
- // assertion.setRefName("regVal");
-
- result = new SampleResult();
- String data = "<company-xmlext-query-ret>" + "<row>" + "<value field=\"RetCode\">LIS_OK</value>"
- + "<value field=\"RetCodeExtension\"></value>" + "<value field=\"alias\"></value>"
- + "<value field=\"positioncount\"></value>" + "<value field=\"invalidpincount\">0</value>"
- + "<value field=\"pinposition1\">1</value>" + "<value field=\"pinpositionvalue1\"></value>"
- + "<value field=\"pinposition2\">5</value>" + "<value field=\"pinpositionvalue2\"></value>"
- + "<value field=\"pinposition3\">6</value>" + "<value field=\"pinpositionvalue3\"></value>"
- + "</row>" + "</company-xmlext-query-ret>";
- result.setResponseData(data.getBytes());
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- }
-
- public void testAssertion() throws Exception {
- assertion.setXPathString("//row/value[@field = 'alias']");
- AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
- log.debug(" res " + res.isError());
- log.debug(" failure " + res.getFailureMessage());
- assertFalse(res.isError());
- assertFalse(res.isFailure());
- }
-
- public void testNegateAssertion() throws Exception {
- assertion.setXPathString("//row/value[@field = 'noalias']");
- assertion.setNegated(true);
-
- AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
- log.debug(" res " + res.isError());
- log.debug(" failure " + res.getFailureMessage());
- assertFalse(res.isError());
- assertFalse(res.isFailure());
- }
-
- public void testValidationFailure() throws Exception {
- assertion.setXPathString("//row/value[@field = 'alias']");
- assertion.setNegated(false);
- assertion.setValidating(true);
- AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
- log.debug(res.getFailureMessage() + " error: " + res.isError() + " failure: " + res.isFailure());
- assertTrue(res.isError());
- assertFalse(res.isFailure());
-
- }
-
- public void testValidationSuccess() throws Exception {
- String data = "<?xml version=\"1.0\"?>" + "<!DOCTYPE BOOK [" + "<!ELEMENT p (#PCDATA)>"
- + "<!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION | PART)+)>"
- + "<!ELEMENT OPENER (TITLE_TEXT)*>" + "<!ELEMENT TITLE_TEXT (#PCDATA)>"
- + "<!ELEMENT SUBTITLE (#PCDATA)>" + "<!ELEMENT INTRODUCTION (HEADER, p+)+>"
- + "<!ELEMENT PART (HEADER, CHAPTER+)>" + "<!ELEMENT SECTION (HEADER, p+)>"
- + "<!ELEMENT HEADER (#PCDATA)>" + "<!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)>"
- + "<!ELEMENT CHAPTER_NUMBER (#PCDATA)>" + "<!ELEMENT CHAPTER_TEXT (p)+>" + "]>" + "<BOOK>"
- + "<OPENER>" + "<TITLE_TEXT>All About Me</TITLE_TEXT>" + "</OPENER>" + "<PART>"
- + "<HEADER>Welcome To My Book</HEADER>" + "<CHAPTER>"
- + "<CHAPTER_NUMBER>CHAPTER 1</CHAPTER_NUMBER>" + "<CHAPTER_TEXT>"
- + "<p>Glad you want to hear about me.</p>" + "<p>There's so much to say!</p>"
- + "<p>Where should we start?</p>" + "<p>How about more about me?</p>" + "</CHAPTER_TEXT>"
- + "</CHAPTER>" + "</PART>" + "</BOOK>";
-
- result.setResponseData(data.getBytes());
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- assertion.setXPathString("/");
- assertion.setValidating(true);
- AssertionResult res = assertion.getResult(result);
- assertFalse(res.isError());
- assertFalse(res.isFailure());
- }
-
- public void testValidationFailureWithDTD() throws Exception {
- String data = "<?xml version=\"1.0\"?>" + "<!DOCTYPE BOOK [" + "<!ELEMENT p (#PCDATA)>"
- + "<!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION | PART)+)>"
- + "<!ELEMENT OPENER (TITLE_TEXT)*>" + "<!ELEMENT TITLE_TEXT (#PCDATA)>"
- + "<!ELEMENT SUBTITLE (#PCDATA)>" + "<!ELEMENT INTRODUCTION (HEADER, p+)+>"
- + "<!ELEMENT PART (HEADER, CHAPTER+)>" + "<!ELEMENT SECTION (HEADER, p+)>"
- + "<!ELEMENT HEADER (#PCDATA)>" + "<!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)>"
- + "<!ELEMENT CHAPTER_NUMBER (#PCDATA)>" + "<!ELEMENT CHAPTER_TEXT (p)+>" + "]>" + "<BOOK>"
- + "<OPENER>" + "<TITLE_TEXT>All About Me</TITLE_TEXT>" + "</OPENER>" + "<PART>"
- + "<HEADER>Welcome To My Book</HEADER>" + "<CHAPTER>"
- + "<CHAPTER_NUMBER>CHAPTER 1</CHAPTER_NUMBER>" + "<CHAPTER_TEXT>"
- + "<p>Glad you want to hear about me.</p>" + "<p>There's so much to say!</p>"
- + "<p>Where should we start?</p>" + "<p>How about more about me?</p>" + "</CHAPTER_TEXT>"
- + "</CHAPTER>" + "<illegal>not defined in dtd</illegal>" + "</PART>" + "</BOOK>";
-
- result.setResponseData(data.getBytes());
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- assertion.setXPathString("/");
- assertion.setValidating(true);
- AssertionResult res = assertion.getResult(result);
- log.debug("failureMessage: " + res.getFailureMessage());
- assertTrue(res.isError());
- assertFalse(res.isFailure());
- }
-
- public void testTolerance() throws Exception {
- String data = "<html><head><title>testtitle</title></head>" + "<body>"
- + "<p><i><b>invalid tag nesting</i></b><hr>" + "</body></html>";
-
- result.setResponseData(data.getBytes());
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- assertion.setXPathString("/html/head/title");
- assertion.setValidating(true);
- assertion.setTolerant(true);
- AssertionResult res = assertion.getResult(result);
- log.debug("failureMessage: " + res.getFailureMessage());
- assertFalse(res.isFailure());
- assertFalse(res.isError());
- }
-
- public void testNoTolerance() throws Exception {
- String data = "<html><head><title>testtitle</title></head>" + "<body>"
- + "<p><i><b>invalid tag nesting</i></b><hr>" + "</body></html>";
-
- result.setResponseData(data.getBytes());
- vars = new JMeterVariables();
- jmctx.setVariables(vars);
- jmctx.setPreviousResult(result);
- assertion.setXPathString("/html/head/title");
- assertion.setValidating(false);
- assertion.setTolerant(false);
- AssertionResult res = assertion.getResult(result);
- log.debug("failureMessage: " + res.getFailureMessage());
- assertTrue(res.isError());
- assertFalse(res.isFailure());
- }
-
- public static void main(String[] args) {
- TestRunner.run(XPathAssertionTest.class);
- }
- }
-
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.assertions;
+
+import org.apache.jmeter.samplers.SampleResult;
+import org.apache.jmeter.threads.JMeterContext;
+import org.apache.jmeter.threads.JMeterContextService;
+import org.apache.jmeter.threads.JMeterVariables;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+import junit.framework.TestCase;
+import junit.textui.TestRunner;
+public class PackageTest extends TestCase {
+
+ public PackageTest() {
+ super();
+ }
+
+ public PackageTest(String arg0) {
+ super(arg0);
+ }
+ public void testHex() throws Exception {
+ assertEquals("00010203", MD5HexAssertion.baToHex(new byte[] { 0, 1, 2, 3 }));
+ assertEquals("03020100", MD5HexAssertion.baToHex(new byte[] { 3, 2, 1, 0 }));
+ assertEquals("0f807fff", MD5HexAssertion.baToHex(new byte[] { 0xF, -128, 127, -1 }));
+ }
+
+ public void testMD5() throws Exception {
+ assertEquals("D41D8CD98F00B204E9800998ECF8427E", MD5HexAssertion.baMD5Hex(new byte[] {}).toUpperCase());
+ }
+
+ int threadsRunning;
+
+ int failed;
+
+ public void testThreadSafety() throws Exception {
+ Thread[] threads = new Thread[100];
+ for (int i = 0; i < threads.length; i++) {
+ threads[i] = new TestThread();
+ }
+ failed = 0;
+ for (int i = 0; i < threads.length; i++) {
+ threads[i].start();
+ threadsRunning++;
+ }
+ synchronized (this) {
+ while (threadsRunning > 0) {
+ wait();
+ }
+ }
+ assertEquals(failed, 0);
+ }
+
+ class TestThread extends Thread {
+ static final String TEST_STRING = "DAbale arroz a la zorra el abad.";
+
+ // Used to be 'dábale', but caused trouble on Gump. Reasons
+ // unknown.
+ static final String TEST_PATTERN = ".*A.*\\.";
+
+ public void run() {
+ ResponseAssertion assertion = new ResponseAssertion(
+ ResponseAssertion.RESPONSE_DATA, ResponseAssertion.CONTAINS, TEST_PATTERN);
+ SampleResult response = new SampleResult();
+ response.setResponseData(TEST_STRING.getBytes());
+ for (int i = 0; i < 100; i++) {
+ AssertionResult result;
+ result = assertion.evaluateResponse(response);
+ if (result.isFailure() || result.isError()) {
+ failed++;
+ }
+ }
+ synchronized (PackageTest.this) {
+ threadsRunning--;
+ PackageTest.this.notifyAll();
+ }
+ }
+ }
+ public static class XPathAssertionTest extends TestCase {
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ XPathAssertion assertion;
+
+ SampleResult result;
+
+ JMeterVariables vars;
+
+ JMeterContext jmctx;
+
+ public XPathAssertionTest() {
+ super();
+ }
+
+ public XPathAssertionTest(String name) {
+ super(name);
+ }
+
+ public void setUp() {
+ jmctx = JMeterContextService.getContext();
+ assertion = new XPathAssertion();
+ assertion.setThreadContext(jmctx);// This would be done by the run
+ // command
+ // assertion.setRefName("regVal");
+
+ result = new SampleResult();
+ String data = "<company-xmlext-query-ret>" + "<row>" + "<value field=\"RetCode\">LIS_OK</value>"
+ + "<value field=\"RetCodeExtension\"></value>" + "<value field=\"alias\"></value>"
+ + "<value field=\"positioncount\"></value>" + "<value field=\"invalidpincount\">0</value>"
+ + "<value field=\"pinposition1\">1</value>" + "<value field=\"pinpositionvalue1\"></value>"
+ + "<value field=\"pinposition2\">5</value>" + "<value field=\"pinpositionvalue2\"></value>"
+ + "<value field=\"pinposition3\">6</value>" + "<value field=\"pinpositionvalue3\"></value>"
+ + "</row>" + "</company-xmlext-query-ret>";
+ result.setResponseData(data.getBytes());
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ }
+
+ public void testAssertion() throws Exception {
+ assertion.setXPathString("//row/value[@field = 'alias']");
+ AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
+ log.debug(" res " + res.isError());
+ log.debug(" failure " + res.getFailureMessage());
+ assertFalse(res.isError());
+ assertFalse(res.isFailure());
+ }
+
+ public void testNegateAssertion() throws Exception {
+ assertion.setXPathString("//row/value[@field = 'noalias']");
+ assertion.setNegated(true);
+
+ AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
+ log.debug(" res " + res.isError());
+ log.debug(" failure " + res.getFailureMessage());
+ assertFalse(res.isError());
+ assertFalse(res.isFailure());
+ }
+
+ public void testValidationFailure() throws Exception {
+ assertion.setXPathString("//row/value[@field = 'alias']");
+ assertion.setNegated(false);
+ assertion.setValidating(true);
+ AssertionResult res = assertion.getResult(jmctx.getPreviousResult());
+ log.debug(res.getFailureMessage() + " error: " + res.isError() + " failure: " + res.isFailure());
+ assertTrue(res.isError());
+ assertFalse(res.isFailure());
+
+ }
+
+ public void testValidationSuccess() throws Exception {
+ String data = "<?xml version=\"1.0\"?>" + "<!DOCTYPE BOOK [" + "<!ELEMENT p (#PCDATA)>"
+ + "<!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION | PART)+)>"
+ + "<!ELEMENT OPENER (TITLE_TEXT)*>" + "<!ELEMENT TITLE_TEXT (#PCDATA)>"
+ + "<!ELEMENT SUBTITLE (#PCDATA)>" + "<!ELEMENT INTRODUCTION (HEADER, p+)+>"
+ + "<!ELEMENT PART (HEADER, CHAPTER+)>" + "<!ELEMENT SECTION (HEADER, p+)>"
+ + "<!ELEMENT HEADER (#PCDATA)>" + "<!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)>"
+ + "<!ELEMENT CHAPTER_NUMBER (#PCDATA)>" + "<!ELEMENT CHAPTER_TEXT (p)+>" + "]>" + "<BOOK>"
+ + "<OPENER>" + "<TITLE_TEXT>All About Me</TITLE_TEXT>" + "</OPENER>" + "<PART>"
+ + "<HEADER>Welcome To My Book</HEADER>" + "<CHAPTER>"
+ + "<CHAPTER_NUMBER>CHAPTER 1</CHAPTER_NUMBER>" + "<CHAPTER_TEXT>"
+ + "<p>Glad you want to hear about me.</p>" + "<p>There's so much to say!</p>"
+ + "<p>Where should we start?</p>" + "<p>How about more about me?</p>" + "</CHAPTER_TEXT>"
+ + "</CHAPTER>" + "</PART>" + "</BOOK>";
+
+ result.setResponseData(data.getBytes());
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ assertion.setXPathString("/");
+ assertion.setValidating(true);
+ AssertionResult res = assertion.getResult(result);
+ assertFalse(res.isError());
+ assertFalse(res.isFailure());
+ }
+
+ public void testValidationFailureWithDTD() throws Exception {
+ String data = "<?xml version=\"1.0\"?>" + "<!DOCTYPE BOOK [" + "<!ELEMENT p (#PCDATA)>"
+ + "<!ELEMENT BOOK (OPENER,SUBTITLE?,INTRODUCTION?,(SECTION | PART)+)>"
+ + "<!ELEMENT OPENER (TITLE_TEXT)*>" + "<!ELEMENT TITLE_TEXT (#PCDATA)>"
+ + "<!ELEMENT SUBTITLE (#PCDATA)>" + "<!ELEMENT INTRODUCTION (HEADER, p+)+>"
+ + "<!ELEMENT PART (HEADER, CHAPTER+)>" + "<!ELEMENT SECTION (HEADER, p+)>"
+ + "<!ELEMENT HEADER (#PCDATA)>" + "<!ELEMENT CHAPTER (CHAPTER_NUMBER, CHAPTER_TEXT)>"
+ + "<!ELEMENT CHAPTER_NUMBER (#PCDATA)>" + "<!ELEMENT CHAPTER_TEXT (p)+>" + "]>" + "<BOOK>"
+ + "<OPENER>" + "<TITLE_TEXT>All About Me</TITLE_TEXT>" + "</OPENER>" + "<PART>"
+ + "<HEADER>Welcome To My Book</HEADER>" + "<CHAPTER>"
+ + "<CHAPTER_NUMBER>CHAPTER 1</CHAPTER_NUMBER>" + "<CHAPTER_TEXT>"
+ + "<p>Glad you want to hear about me.</p>" + "<p>There's so much to say!</p>"
+ + "<p>Where should we start?</p>" + "<p>How about more about me?</p>" + "</CHAPTER_TEXT>"
+ + "</CHAPTER>" + "<illegal>not defined in dtd</illegal>" + "</PART>" + "</BOOK>";
+
+ result.setResponseData(data.getBytes());
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ assertion.setXPathString("/");
+ assertion.setValidating(true);
+ AssertionResult res = assertion.getResult(result);
+ log.debug("failureMessage: " + res.getFailureMessage());
+ assertTrue(res.isError());
+ assertFalse(res.isFailure());
+ }
+
+ public void testTolerance() throws Exception {
+ String data = "<html><head><title>testtitle</title></head>" + "<body>"
+ + "<p><i><b>invalid tag nesting</i></b><hr>" + "</body></html>";
+
+ result.setResponseData(data.getBytes());
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ assertion.setXPathString("/html/head/title");
+ assertion.setValidating(true);
+ assertion.setTolerant(true);
+ AssertionResult res = assertion.getResult(result);
+ log.debug("failureMessage: " + res.getFailureMessage());
+ assertFalse(res.isFailure());
+ assertFalse(res.isError());
+ }
+
+ public void testNoTolerance() throws Exception {
+ String data = "<html><head><title>testtitle</title></head>" + "<body>"
+ + "<p><i><b>invalid tag nesting</i></b><hr>" + "</body></html>";
+
+ result.setResponseData(data.getBytes());
+ vars = new JMeterVariables();
+ jmctx.setVariables(vars);
+ jmctx.setPreviousResult(result);
+ assertion.setXPathString("/html/head/title");
+ assertion.setValidating(false);
+ assertion.setTolerant(false);
+ AssertionResult res = assertion.getResult(result);
+ log.debug("failureMessage: " + res.getFailureMessage());
+ assertTrue(res.isError());
+ assertFalse(res.isFailure());
+ }
+
+ public static void main(String[] args) {
+ TestRunner.run(XPathAssertionTest.class);
+ }
+ }
+
+}
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/PackageTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/assertions/XMLSchemaAssertionTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/config/TestCVSDataSet.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java (original)
+++ jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java Sat Nov 26 17:01:05 2005
@@ -1,149 +1,149 @@
-/*
- * Copyright 2004-2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.apache.jmeter.functions;
-
-import java.io.FileNotFoundException;
-
-import org.apache.jmeter.junit.JMeterTestCase;
-
-/**
- * File data container for CSV (and similar delimited) files Data is accessible
- * via row and column number
- *
- * @version $Revision: 325542 $
- */
-public class TestFileRowColContainer {
-
- public static class Test extends JMeterTestCase {
-
- public Test(String a) {
- super(a);
- }
-
- public void testNull() throws Exception {
- try {
- new FileRowColContainer("testfiles/xyzxyz");
- fail("Should not find the file");
- } catch (FileNotFoundException e) {
- }
- }
-
- public void testrowNum() throws Exception {
- FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");
- assertNotNull(f);
- assertEquals("Expected 4 lines", 4, f.getSize());
-
- assertEquals(0, f.nextRow());
- assertEquals(1, f.nextRow());
- assertEquals(2, f.nextRow());
- assertEquals(3, f.nextRow());
- assertEquals(0, f.nextRow());
-
- }
-
- public void testColumns() throws Exception {
- FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");
- assertNotNull(f);
- assertTrue("Not empty", f.getSize() > 0);
-
- int myRow = f.nextRow();
- assertEquals(0, myRow);
- assertEquals("a1", f.getColumn(myRow, 0));
- assertEquals("d1", f.getColumn(myRow, 3));
-
- try {
- f.getColumn(myRow, 4);
- fail("Expected out of bounds");
- } catch (IndexOutOfBoundsException e) {
- }
- myRow = f.nextRow();
- assertEquals(1, myRow);
- assertEquals("b2", f.getColumn(myRow, 1));
- assertEquals("c2", f.getColumn(myRow, 2));
- }
-
- public void testColumnsComma() throws Exception {
- FileRowColContainer f = new FileRowColContainer("testfiles/test.csv", ",");
- assertNotNull(f);
- assertTrue("Not empty", f.getSize() > 0);
-
- int myRow = f.nextRow();
- assertEquals(0, myRow);
- assertEquals("a1", f.getColumn(myRow, 0));
- assertEquals("d1", f.getColumn(myRow, 3));
-
- try {
- f.getColumn(myRow, 4);
- fail("Expected out of bounds");
- } catch (IndexOutOfBoundsException e) {
- }
- myRow = f.nextRow();
- assertEquals(1, myRow);
- assertEquals("b2", f.getColumn(myRow, 1));
- assertEquals("c2", f.getColumn(myRow, 2));
- }
-
- public void testColumnsTab() throws Exception {
- FileRowColContainer f = new FileRowColContainer("testfiles/test.tsv", "\t");
- assertNotNull(f);
- assertTrue("Not empty", f.getSize() > 0);
-
- int myRow = f.nextRow();
- assertEquals(0, myRow);
- assertEquals("a1", f.getColumn(myRow, 0));
- assertEquals("d1", f.getColumn(myRow, 3));
-
- try {
- f.getColumn(myRow, 4);
- fail("Expected out of bounds");
- } catch (IndexOutOfBoundsException e) {
- }
- myRow = f.nextRow();
- assertEquals(1, myRow);
- assertEquals("b2", f.getColumn(myRow, 1));
- assertEquals("c2", f.getColumn(myRow, 2));
- }
-
- public void testEmptyCols() throws Exception {
- FileRowColContainer f = new FileRowColContainer("testfiles/testempty.csv");
- assertNotNull(f);
- assertEquals("Expected 4 lines", 4, f.getSize());
-
- int myRow = f.nextRow();
- assertEquals(0, myRow);
- assertEquals("", f.getColumn(myRow, 0));
- assertEquals("d1", f.getColumn(myRow, 3));
-
- myRow = f.nextRow();
- assertEquals(1, myRow);
- assertEquals("", f.getColumn(myRow, 1));
- assertEquals("c2", f.getColumn(myRow, 2));
-
- myRow = f.nextRow();
- assertEquals(2, myRow);
- assertEquals("b3", f.getColumn(myRow, 1));
- assertEquals("", f.getColumn(myRow, 2));
-
- myRow = f.nextRow();
- assertEquals(3, myRow);
- assertEquals("b4", f.getColumn(myRow, 1));
- assertEquals("c4", f.getColumn(myRow, 2));
- assertEquals("", f.getColumn(myRow, 3));
- }
- }
+/*
+ * Copyright 2004-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.functions;
+
+import java.io.FileNotFoundException;
+
+import org.apache.jmeter.junit.JMeterTestCase;
+
+/**
+ * File data container for CSV (and similar delimited) files Data is accessible
+ * via row and column number
+ *
+ * @version $Revision$
+ */
+public class TestFileRowColContainer {
+
+ public static class Test extends JMeterTestCase {
+
+ public Test(String a) {
+ super(a);
+ }
+
+ public void testNull() throws Exception {
+ try {
+ new FileRowColContainer("testfiles/xyzxyz");
+ fail("Should not find the file");
+ } catch (FileNotFoundException e) {
+ }
+ }
+
+ public void testrowNum() throws Exception {
+ FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");
+ assertNotNull(f);
+ assertEquals("Expected 4 lines", 4, f.getSize());
+
+ assertEquals(0, f.nextRow());
+ assertEquals(1, f.nextRow());
+ assertEquals(2, f.nextRow());
+ assertEquals(3, f.nextRow());
+ assertEquals(0, f.nextRow());
+
+ }
+
+ public void testColumns() throws Exception {
+ FileRowColContainer f = new FileRowColContainer("testfiles/test.csv");
+ assertNotNull(f);
+ assertTrue("Not empty", f.getSize() > 0);
+
+ int myRow = f.nextRow();
+ assertEquals(0, myRow);
+ assertEquals("a1", f.getColumn(myRow, 0));
+ assertEquals("d1", f.getColumn(myRow, 3));
+
+ try {
+ f.getColumn(myRow, 4);
+ fail("Expected out of bounds");
+ } catch (IndexOutOfBoundsException e) {
+ }
+ myRow = f.nextRow();
+ assertEquals(1, myRow);
+ assertEquals("b2", f.getColumn(myRow, 1));
+ assertEquals("c2", f.getColumn(myRow, 2));
+ }
+
+ public void testColumnsComma() throws Exception {
+ FileRowColContainer f = new FileRowColContainer("testfiles/test.csv", ",");
+ assertNotNull(f);
+ assertTrue("Not empty", f.getSize() > 0);
+
+ int myRow = f.nextRow();
+ assertEquals(0, myRow);
+ assertEquals("a1", f.getColumn(myRow, 0));
+ assertEquals("d1", f.getColumn(myRow, 3));
+
+ try {
+ f.getColumn(myRow, 4);
+ fail("Expected out of bounds");
+ } catch (IndexOutOfBoundsException e) {
+ }
+ myRow = f.nextRow();
+ assertEquals(1, myRow);
+ assertEquals("b2", f.getColumn(myRow, 1));
+ assertEquals("c2", f.getColumn(myRow, 2));
+ }
+
+ public void testColumnsTab() throws Exception {
+ FileRowColContainer f = new FileRowColContainer("testfiles/test.tsv", "\t");
+ assertNotNull(f);
+ assertTrue("Not empty", f.getSize() > 0);
+
+ int myRow = f.nextRow();
+ assertEquals(0, myRow);
+ assertEquals("a1", f.getColumn(myRow, 0));
+ assertEquals("d1", f.getColumn(myRow, 3));
+
+ try {
+ f.getColumn(myRow, 4);
+ fail("Expected out of bounds");
+ } catch (IndexOutOfBoundsException e) {
+ }
+ myRow = f.nextRow();
+ assertEquals(1, myRow);
+ assertEquals("b2", f.getColumn(myRow, 1));
+ assertEquals("c2", f.getColumn(myRow, 2));
+ }
+
+ public void testEmptyCols() throws Exception {
+ FileRowColContainer f = new FileRowColContainer("testfiles/testempty.csv");
+ assertNotNull(f);
+ assertEquals("Expected 4 lines", 4, f.getSize());
+
+ int myRow = f.nextRow();
+ assertEquals(0, myRow);
+ assertEquals("", f.getColumn(myRow, 0));
+ assertEquals("d1", f.getColumn(myRow, 3));
+
+ myRow = f.nextRow();
+ assertEquals(1, myRow);
+ assertEquals("", f.getColumn(myRow, 1));
+ assertEquals("c2", f.getColumn(myRow, 2));
+
+ myRow = f.nextRow();
+ assertEquals(2, myRow);
+ assertEquals("b3", f.getColumn(myRow, 1));
+ assertEquals("", f.getColumn(myRow, 2));
+
+ myRow = f.nextRow();
+ assertEquals(3, myRow);
+ assertEquals("b4", f.getColumn(myRow, 1));
+ assertEquals("c4", f.getColumn(myRow, 2));
+ assertEquals("", f.getColumn(myRow, 3));
+ }
+ }
}
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/functions/TestFileRowColContainer.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java
URL: http://svn.apache.org/viewcvs/jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java?rev=349162&r1=349161&r2=349162&view=diff
==============================================================================
--- jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java (original)
+++ jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java Sat Nov 26 17:01:05 2005
@@ -1,83 +1,83 @@
-/*
- * Copyright 2005 The Apache Software Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.testelement;
-
-import javax.swing.JComponent;
-
-import org.apache.jmeter.save.SaveGraphicsService;
-import org.apache.jmeter.junit.JMeterTestCase;
-import org.apache.jmeter.util.JMeterUtils;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
-
-/**
- * @author peter lin
- *
- */
-public class BarChartTest extends JMeterTestCase {
-
- private static final Logger log = LoggingManager.getLoggerForClass();
-
- /**
- * @param arg0
- */
- public BarChartTest(String arg0) {
- super(arg0);
- }
-
- public void testGenerateBarChart() {
- log.info("jtl version=" + JMeterUtils.getProperty("file_format.testlog"));
- // String sampleLog = "C:/eclipse3/workspace/jmeter-21/bin/testfiles/sample_log1.jtl";
- String sampleLog = "testfiles/sample_log1.jtl";
- String sampleLog2 = "testfiles/sample_log1b.jtl";
- String sampleLog3 = "testfiles/sample_log1c.jtl";
- JTLData input = new JTLData();
- JTLData input2 = new JTLData();
- JTLData input3 = new JTLData();
- input.setDataSource(sampleLog);
- input.loadData();
- input2.setDataSource(sampleLog2);
- input2.loadData();
- input3.setDataSource(sampleLog3);
- input3.loadData();
-
- assertTrue((input.getStartTimestamp() > 0));
- assertTrue((input.getEndTimestamp() > input.getStartTimestamp()));
- assertTrue((input.getURLs().size() > 0));
- log.info("URL count=" + input.getURLs().size());
- java.util.ArrayList list = new java.util.ArrayList();
- list.add(input);
- list.add(input2);
- list.add(input3);
-
- BarChart bchart = new BarChart();
- bchart.setTitle("Sample Chart");
- bchart.setCaption("Sample");
- bchart.setName("Sample");
- bchart.setYAxis("milliseconds");
- bchart.setYLabel("Test Runs");
- bchart.setXAxis(AbstractTable.REPORT_TABLE_90_PERCENT);
- bchart.setXLabel(AbstractChart.X_DATA_DATE_LABEL);
- bchart.setURL("jakarta_home");
- JComponent gr = bchart.renderChart(list);
- assertNotNull(gr);
- SaveGraphicsService serv = new SaveGraphicsService();
- String filename = bchart.getTitle();
- filename = filename.replace(' ','_');
- serv.saveJComponent("./testfiles/" + filename,SaveGraphicsService.PNG,gr);
- }
-}
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.testelement;
+
+import javax.swing.JComponent;
+
+import org.apache.jmeter.save.SaveGraphicsService;
+import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jmeter.util.JMeterUtils;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * @author peter lin
+ *
+ */
+public class BarChartTest extends JMeterTestCase {
+
+ private static final Logger log = LoggingManager.getLoggerForClass();
+
+ /**
+ * @param arg0
+ */
+ public BarChartTest(String arg0) {
+ super(arg0);
+ }
+
+ public void testGenerateBarChart() {
+ log.info("jtl version=" + JMeterUtils.getProperty("file_format.testlog"));
+ // String sampleLog = "C:/eclipse3/workspace/jmeter-21/bin/testfiles/sample_log1.jtl";
+ String sampleLog = "testfiles/sample_log1.jtl";
+ String sampleLog2 = "testfiles/sample_log1b.jtl";
+ String sampleLog3 = "testfiles/sample_log1c.jtl";
+ JTLData input = new JTLData();
+ JTLData input2 = new JTLData();
+ JTLData input3 = new JTLData();
+ input.setDataSource(sampleLog);
+ input.loadData();
+ input2.setDataSource(sampleLog2);
+ input2.loadData();
+ input3.setDataSource(sampleLog3);
+ input3.loadData();
+
+ assertTrue((input.getStartTimestamp() > 0));
+ assertTrue((input.getEndTimestamp() > input.getStartTimestamp()));
+ assertTrue((input.getURLs().size() > 0));
+ log.info("URL count=" + input.getURLs().size());
+ java.util.ArrayList list = new java.util.ArrayList();
+ list.add(input);
+ list.add(input2);
+ list.add(input3);
+
+ BarChart bchart = new BarChart();
+ bchart.setTitle("Sample Chart");
+ bchart.setCaption("Sample");
+ bchart.setName("Sample");
+ bchart.setYAxis("milliseconds");
+ bchart.setYLabel("Test Runs");
+ bchart.setXAxis(AbstractTable.REPORT_TABLE_90_PERCENT);
+ bchart.setXLabel(AbstractChart.X_DATA_DATE_LABEL);
+ bchart.setURL("jakarta_home");
+ JComponent gr = bchart.renderChart(list);
+ assertNotNull(gr);
+ SaveGraphicsService serv = new SaveGraphicsService();
+ String filename = bchart.getTitle();
+ filename = filename.replace(' ','_');
+ serv.saveJComponent("./testfiles/" + filename,SaveGraphicsService.PNG,gr);
+ }
+}
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jakarta/jmeter/branches/rel-2-1/test/src/org/apache/jmeter/testelement/BarChartTest.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org