Skip to content

Commit

Permalink
This commit was manufactured by cvs2svn to create tag 'rel-2_1'.
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jakarta/jmeter/tags/rel-2_1@325652 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
No Author committed Aug 19, 2005
1 parent 76159a5 commit e1b8b0d
Show file tree
Hide file tree
Showing 40 changed files with 577 additions and 261 deletions.
17 changes: 17 additions & 0 deletions KEYS.txt
Expand Up @@ -113,3 +113,20 @@ LY8FCQXcYNsACgkQP+DBYbypc6yBbwCeOvnv0jFl9vF0s8xhSAoL//sVh+AAni2E
MqhkiC8tJZdEK9EAd9T0HkeT
=Y6NQ
-----END PGP PUBLIC KEY BLOCK-----

key for: Peter Lin <woolfel@apache.org>

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.2 (MingW32)

mIsEQvwEgAEEALtlIFI5TYGenY7iQhhoU26lca2z7PTIGlCZ3eAPxjQNek/oCEPR
nl39NtNKjEo4V2eJPrZz4nlA2pUxwkzVWGe9yULQT73mB0pkQxr40iH2vIdpkW3y
CV3NymyH77XrvELhQrnLpK1pbzMdPTnpr04Wq4BCysEcGzJJT7mlIDiBAAYptDtQ
ZXRlciBMaW4gKFBldGVyIExpbiBKTWV0ZXIgY29tbWl0dGVyKSA8d29vbGZlbEBh
cGFjaGUub3JnPoi8BBMBAgAmBQJC/ASAAhsDBQkDwmcABgsJCAcDAgQVAggDBBYC
AwECHgECF4AACgkQlell0l24rA970wP/WhOKLRrpF8IrjgpZsJ4X7CpdOhRQRfXd
8u7TxhdxTRom6XFW14LyUH9i7teRB3RC8F809jFwfmR2oa4fhNhv36QkXQI9npmS
gebbL9RMq3mjdXwtpDYbcA4r2pbz+Wf2m+BV38Gz8k+WOm5X8QW3sRbZ1QnxUjTu
NGHyeqz14hs=
=rMW+
-----END PGP PUBLIC KEY BLOCK-----
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -298,7 +298,7 @@
<property name="excalibur-datasource.jar" value="${lib.dir}/excalibur-datasource-1.1.1.jar"/>
<property name="excalibur-pool.jar" value="${lib.dir}/excalibur-pool-1.2.jar"/>
<property name="excalibur-instrument.jar" value="${lib.dir}/excalibur-instrument-1.0.jar"/>
<property name="xstream.jar" value="${lib.dir}/xstream-1.1-2.jar"/>
<property name="xstream.jar" value="${lib.dir}/xstream-1.1.2.jar"/>
<property name="xpp3.jar" value="${lib.dir}/xpp3_min-1.1.3.4.I.jar"/>

<!-- The following 3 jars are probably optional for JDK1.4 -->
Expand Down
2 changes: 1 addition & 1 deletion eclipse.classpath
Expand Up @@ -35,7 +35,7 @@
<classpathentry kind="lib" path="lib/excalibur-datasource-1.1.1.jar"/>
<classpathentry kind="lib" path="lib/excalibur-instrument-1.0.jar"/>
<classpathentry kind="lib" path="lib/excalibur-pool-1.2.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.1.jar"/>
<classpathentry kind="lib" path="lib/xstream-1.1.2.jar"/>
<classpathentry kind="lib" path="lib/xpp3_min-1.1.3.4.I.jar"/>
<classpathentry kind="lib" path="lib/batik-awt-util.jar"/>
<classpathentry kind="output" path=""/>
Expand Down
2 changes: 1 addition & 1 deletion src/components/org/apache/jmeter/config/CSVDataSet.java
Expand Up @@ -62,7 +62,7 @@ public void iterationStart(LoopIterationEvent iterEvent) {
String delim = getDelimiter();
if (delim.equals("\\t"))
delim = "\t";// Make it easier to enter a Tab
String[] lineValues = JOrphanUtils.split(server.readLine(getFilename()), delim);
String[] lineValues = JOrphanUtils.split(server.readLine(getFilename()), delim,false);
for (int a = 0; a < vars.length && a < lineValues.length; a++) {
this.getThreadContext().getVariables().put(vars[a], lineValues[a]);
}
Expand Down
3 changes: 3 additions & 0 deletions src/core/org/apache/jmeter/config/Argument.java
Expand Up @@ -22,6 +22,8 @@

import org.apache.jmeter.testelement.AbstractTestElement;
import org.apache.jmeter.testelement.property.StringProperty;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

// Mark Walsh, 2002-08-03, add metadata attribute
// add constructor Argument(String name, Object value, Object metadata)
Expand All @@ -36,6 +38,7 @@
* @version $Revision$
*/
public class Argument extends AbstractTestElement implements Serializable {
private static Logger log = LoggingManager.getLoggerForClass();
/** Name used to store the argument's name. */
public static final String ARG_NAME = "Argument.name";

Expand Down
3 changes: 3 additions & 0 deletions src/core/org/apache/jmeter/config/Arguments.java
Expand Up @@ -27,6 +27,8 @@
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.PropertyIterator;
import org.apache.jmeter.testelement.property.TestElementProperty;
import org.apache.jorphan.logging.LoggingManager;
import org.apache.log.Logger;

// Mark Walsh, 2002-08-03 add method:
// addArgument(String name, Object value, Object metadata)
Expand All @@ -41,6 +43,7 @@
* @version $Revision$
*/
public class Arguments extends ConfigTestElement implements Serializable {
private static Logger log = LoggingManager.getLoggerForClass();
/** The name of the property used to store the arguments. */
public static final String ARGUMENTS = "Arguments.arguments";

Expand Down
20 changes: 12 additions & 8 deletions src/core/org/apache/jmeter/engine/PreCompiler.java
Expand Up @@ -52,21 +52,25 @@ public PreCompiler() {
* @see HashTreeTraverser#addNode(Object, HashTree)
*/
public void addNode(Object node, HashTree subTree) {
if(node instanceof TestElement)
{
try {
replacer.replaceValues((TestElement) node);
} catch (InvalidVariableException e) {
log.error("invalid variables", e);
}
}
if (node instanceof TestPlan) {
Map args = ((TestPlan) node).getUserDefinedVariables();
((TestPlan)node).prepareForPreCompile(); //A hack to make user-defined variables in the testplan element more dynamic
Map args = ((TestPlan) node).getUserDefinedVariables();
replacer.setUserDefinedVariables(args);
JMeterVariables vars = new JMeterVariables();
vars.putAll(args);
JMeterContextService.getContext().setVariables(vars);
} else if (node instanceof TestElement) {
try {
replacer.replaceValues((TestElement) node);
} catch (InvalidVariableException e) {
log.error("invalid variables", e);
}
}
}

if (node instanceof Arguments) {
((Arguments)node).setRunningVersion(true);
Map args = ((Arguments) node).getArgumentsAsMap();
replacer.addVariables(args);
JMeterContextService.getContext().getVariables().putAll(args);
Expand Down
23 changes: 14 additions & 9 deletions src/core/org/apache/jmeter/engine/StandardJMeterEngine.java
Expand Up @@ -204,6 +204,7 @@ protected void notifyTestListenersOfStart() {
}

protected void notifyTestListenersOfEnd() {
log.info("Notifying test listeners of end of test");
Iterator iter = testListeners.getSearchResults().iterator();
while (iter.hasNext()) {
TestListener tl = (TestListener) iter.next();
Expand Down Expand Up @@ -231,12 +232,16 @@ public void reset() {
}

public synchronized void threadFinished(JMeterThread thread) {
allThreads.remove(thread);
log.info("Ending thread " + thread.getThreadNum());
if (!serialized && allThreads.size() == 0 && !schcdule_run) {
log.info("Stopping test");
stopTest();
}
try {
allThreads.remove(thread);
log.info("Ending thread " + thread.getThreadNum());
if (!serialized && allThreads.size() == 0 && !schcdule_run) {
log.info("Stopping test");
stopTest();
}
} catch (Throwable e) {
log.fatalError("Call to threadFinished should never throw an exception - this can deadlock JMeter",e);
}
}

public synchronized void stopTest() {
Expand Down Expand Up @@ -296,7 +301,7 @@ public void run() {
if (((TestPlan) plan[0]).isSerialized()) {
serialized = true;
}
JMeterContextService.startTest();
JMeterContextService.startTest();
compileTree();
/**
* Notification of test listeners needs to happen after function
Expand Down Expand Up @@ -354,9 +359,9 @@ public void run() {
log.info("Continue on error");
}

ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
threadGroupTree.add(group, testLevelElements);
for (int i = 0; running && i < threads.length; i++) {
ListedHashTree threadGroupTree = (ListedHashTree) searcher.getSubTree(group);
threadGroupTree.add(group, testLevelElements);
threads[i] = new JMeterThread(cloneTree(threadGroupTree), this, notifier);
threads[i].setThreadNum(i);
threads[i].setThreadGroup(group);
Expand Down
6 changes: 6 additions & 0 deletions src/core/org/apache/jmeter/gui/GuiPackage.java
Expand Up @@ -25,6 +25,7 @@
import java.util.HashMap;
import java.util.Map;

import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;

import org.apache.jmeter.engine.util.ValueReplacer;
Expand Down Expand Up @@ -306,6 +307,11 @@ public TestElement createTestElement(String objClass) {
return node;
} catch (NoClassDefFoundError e) {
log.error("Problem retrieving gui for " + objClass, e);
String msg="Cannot find class: "+e.getMessage();
JOptionPane.showMessageDialog(null,
msg,
"Missing jar? See log file." ,
JOptionPane.ERROR_MESSAGE);
throw new RuntimeException(e.toString()); // Probably a missing
// jar
} catch (ClassNotFoundException e) {
Expand Down
15 changes: 7 additions & 8 deletions src/core/org/apache/jmeter/junit/JMeterTest.java
Expand Up @@ -173,11 +173,14 @@ public void createTitleSet() throws Exception {
List components = ((Element) sections.get(i)).getChildren("component");
for (int j = 0; j < components.size(); j++) {
Element comp = (Element) components.get(j);
guiTitles.put(comp.getAttributeValue("name"), Boolean.FALSE);
String nm=comp.getAttributeValue("name");
if (!nm.equals("SSL Manager")){// Not a true GUI component
guiTitles.put(nm.replace(' ','_'), Boolean.FALSE);
}
}
}
// Add titles that don't need to be documented
guiTitles.put("Root", Boolean.FALSE);
//guiTitles.put("Root", Boolean.FALSE);
guiTitles.put("Example Sampler", Boolean.FALSE);
}

Expand Down Expand Up @@ -235,10 +238,6 @@ private int scanprintMap(Map m, String t) {
while (i.hasNext()) {
Object key = i.next();
if (!m.get(key).equals(Boolean.TRUE)) {
if (key.equals("SSL Manager"))// Not a true GUI component
{
continue;
}
if (unseen == 0)// first time
{
System.out.println("\nNames remaining in " + t + " Map:");
Expand Down Expand Up @@ -332,13 +331,13 @@ private static Test suiteBeanComponents() throws Exception {
*/
public void runGUITitle() throws Exception {
if (guiTitles.size() > 0) {
String title = guiItem.getStaticLabel();
String title = guiItem.getDocAnchor();
boolean ct = guiTitles.containsKey(title);
if (ct)
guiTitles.put(title, Boolean.TRUE);// So we can detect extra
// entries
if (// Is this a work in progress or an internal GUI component?
(title.length() > 0) // Will be "" for internal components
(title != null && title.length() > 0) // Will be "" for internal components
&& (title.toUpperCase().indexOf("(ALPHA") == -1) && (title.toUpperCase().indexOf("(BETA") == -1)
&& (!title.equals("Example1")) // Skip the example samplers
// ...
Expand Down
22 changes: 11 additions & 11 deletions src/core/org/apache/jmeter/save/SaveService.java
Expand Up @@ -220,23 +220,23 @@ private static void checkVersion(Class clazz, String expected) {

private static void checkVersions() {
versionsOK = true;
checkVersion(BooleanPropertyConverter.class, "1.4");
checkVersion(HashTreeConverter.class, "1.2");
checkVersion(IntegerPropertyConverter.class, "1.3");
checkVersion(LongPropertyConverter.class, "1.3");
checkVersion(MultiPropertyConverter.class, "1.3");
checkVersion(SampleResultConverter.class, "1.8");
checkVersion(BooleanPropertyConverter.class, "1.5");
checkVersion(HashTreeConverter.class, "1.3");
checkVersion(IntegerPropertyConverter.class, "1.4");
checkVersion(LongPropertyConverter.class, "1.4");
checkVersion(MultiPropertyConverter.class, "1.4");
checkVersion(SampleResultConverter.class, "1.9");
/*
* Should check this, but tricky to do, because not built until later.
*
* checkVersion(HTTPResultConverter.class, "1.6");
*
*/
checkVersion(StringPropertyConverter.class, "1.6");
checkVersion(TestElementConverter.class, "1.3");
checkVersion(TestElementPropertyConverter.class, "1.6");
checkVersion(ScriptWrapperConverter.class, "1.5");
checkVersion(TestResultWrapperConverter.class, "1.4");
checkVersion(StringPropertyConverter.class, "1.7");
checkVersion(TestElementConverter.class, "1.4");
checkVersion(TestElementPropertyConverter.class, "1.7");
checkVersion(ScriptWrapperConverter.class, "1.6");
checkVersion(TestResultWrapperConverter.class, "1.5");
if (!PROPVERSION.equalsIgnoreCase(propertiesVersion)) {
log.warn("Property file - expected " + PROPVERSION + ", found " + propertiesVersion);
}
Expand Down
6 changes: 3 additions & 3 deletions src/core/org/apache/jmeter/services/FileServer.java
Expand Up @@ -72,7 +72,6 @@ public static FileServer getFileServer() {
}

public void setBasedir(String basedir) throws IOException {
log.info("Setting basedir to: " + basedir);
if (filesOpen()) {
throw new IOException("Files are still open, cannot change base directory");
}
Expand All @@ -90,7 +89,6 @@ public String getBaseDir() {
}

public synchronized void reserveFile(String filename) {
log.info("filename = " + filename + " base = " + base);
if (!files.containsKey(filename)) {
Object[] file = new Object[] { new File(base, filename), null };
files.put(filename, file);
Expand Down Expand Up @@ -151,7 +149,7 @@ public void closeFiles() throws IOException {
*/
public synchronized void closeFile(String name) throws IOException {
Object[] file = (Object[]) files.get(name);
if (file[1] != null) {
if (file != null && file.length == 2 && file[1] != null) {
((Reader) file[1]).close();
file[1] = null;
}
Expand All @@ -171,6 +169,8 @@ protected boolean filesOpen() {

/**
* Method will get a random file in a base directory
* TODO hey, not sure this method belongs here. FileServer is for threadsafe
* File access relative to current test's base directory.
*
* @param basedir
* @return
Expand Down
5 changes: 5 additions & 0 deletions src/core/org/apache/jmeter/testelement/TestPlan.java
Expand Up @@ -88,6 +88,11 @@ public TestPlan(String name) {
// setSerialized(false);
setProperty(new CollectionProperty(THREAD_GROUPS, threadGroups));
}

public void prepareForPreCompile()
{
getVariables().setRunningVersion(true);
}

/**
* Fetches the functional mode property
Expand Down
43 changes: 43 additions & 0 deletions src/core/org/apache/jmeter/testelement/ThreadListener.java
@@ -0,0 +1,43 @@
// $Header$
/*
* Copyright 2001-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.testelement;

/**
* Allow threads to perform startup and closedown if necessary
*
* @version $Revision$ on $Date$
*/
public interface ThreadListener {
/**
* Called just before the start of the thread
*
* @see org.apache.jmeter.threads.JMeterThread#threadStarted()
*
*/
public void threadStarted();

/**
* Called once for each thread at the end of a test
*
* @see org.apache.jmeter.threads.JMeterThread#threadFinished()
*
*/
public void threadFinished();

}
Expand Up @@ -70,12 +70,12 @@ public String getStringValue() {
JMeterContext ctx = JMeterContextService.getContext();// Expensive, so
// do
// once
if (!isRunningVersion() || !ctx.isSamplingStarted()) {
if (!isRunningVersion() /*|| !ctx.isSamplingStarted()*/) {
log.debug("Not running version, return raw function string");
return function.getRawParameters();
} else {
log.debug("Running version, executing function");
int iter = ctx.getVariables().getIteration();
int iter = ctx.getVariables() != null ? ctx.getVariables().getIteration() : -1;
if (iter < testIteration) {
testIteration = -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/org/apache/jmeter/util/JMeterVersion.java
Expand Up @@ -41,7 +41,7 @@ public class JMeterVersion {
* JMeterUtils This ensures that JMeterUtils always gets the correct
* version, even if it is not re-compiled during the build.
*/
private static final String VERSION = "2.1.20050630";
private static final String VERSION = "2.1";

static final String COPYRIGHT = "Copyright (c) 1998-2005 The Apache Software Foundation";

Expand Down

0 comments on commit e1b8b0d

Please sign in to comment.