mstover1 2004/05/20 11:08:54
Modified: src/protocol/http/org/apache/jmeter/protocol/http/sampler
Tag: rel-2_0 AccessLogSampler.java
src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog
Tag: rel-2_0 TCLogParser.java
Log:
Access Log Sampler can do urls without parameters, can use header manager and other
config elements.
Revision Changes Path
No revision
No revision
1.8.2.1 +8 -6
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java
Index: AccessLogSampler.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/sampler/AccessLogSampler.java,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -u -r1.8 -r1.8.2.1
--- AccessLogSampler.java 19 Feb 2004 00:25:56 -0000 1.8
+++ AccessLogSampler.java 20 May 2004 18:08:54 -0000 1.8.2.1
@@ -190,9 +190,10 @@
try
{
samp = (HTTPSampler) GENERATOR.generateRequest();
- samp.setDomain(this.getDomain());
+
+ /*samp.setDomain(this.getDomain());
samp.setPort(this.getPort());
- samp.setImageParser(this.isImageParser());
+ samp.setImageParser(this.isImageParser());*/
// we call parse with 1 to get only one.
// this also means if we change the implementation
// to use 2, it would use every other entry and
@@ -201,8 +202,9 @@
// huge gigabyte log file and they only want to
// use a quarter of the entries.
PARSER.parse(1);
- res = samp.sample();
- res.setSampleLabel(samp.toString());
+ this.addTestElement(samp);
+ res = sample();
+ res.setSampleLabel(toString());
}
catch (Exception e)
{
No revision
No revision
1.10.2.1 +35 -15
jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java
Index: TCLogParser.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/util/accesslog/TCLogParser.java,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- TCLogParser.java 13 Mar 2004 20:05:42 -0000 1.10
+++ TCLogParser.java 20 May 2004 18:08:54 -0000 1.10.2.1
@@ -26,6 +26,8 @@
import java.util.Vector;
import org.apache.jmeter.junit.JMeterTestCase;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
/**
* Description:<br>
@@ -76,6 +78,7 @@
public class TCLogParser implements LogParser
{
+ static Logger log = LoggingManager.getLoggerForClass();
public static final String GET = "GET";
public static final String POST = "POST";
@@ -292,12 +295,7 @@
line = FILTER.filter(line);
if (line != null)
{
- String paramString = null;
- // check the URL for "?" symbol
- paramString = this.stripFile(line);
- this.checkParamFormat(line);
- // now that we have stripped the file, we can parse the
parameters
- this.convertStringToJMRequest(paramString);
+ createUrl(line);
}
}
}
@@ -307,16 +305,27 @@
COUNT++;
// in the case when the filter is not set, we
// parse all the lines
- String paramString = null;
- // check the URL for "?" symbol
- paramString = this.stripFile(line);
- this.checkParamFormat(line);
- // now that we have stripped the file, we can parse the parameters
- this.convertStringToJMRequest(paramString);
+ createUrl(line);
}
}
/**
+ * @param line
+ */
+ private void createUrl(String line)
+ {
+ String paramString = null;
+ // check the URL for "?" symbol
+ paramString = this.stripFile(line);
+ if(paramString != null)
+ {
+ this.checkParamFormat(line);
+ // now that we have stripped the file, we can parse the parameters
+ this.convertStringToJMRequest(paramString);
+ }
+ }
+
+ /**
* The method cleans the URL using the following
* algorithm.
* <ol>
@@ -360,6 +369,14 @@
while (token2.hasMoreTokens())
{
String t = (String) token2.nextElement();
+ if(t.equalsIgnoreCase(GET))
+ {
+ RMETHOD = GET;
+ }
+ else if(t.equalsIgnoreCase(POST))
+ {
+ RMETHOD = POST;
+ }
// there should only be one token
// that starts with slash character
if (t.startsWith("/"))
@@ -424,7 +441,7 @@
else
{
this.GEN.setPath(url);
- return url;
+ return null;
}
}
@@ -600,8 +617,11 @@
public void testcleanURL() throws Exception
{
+ tclp.GEN = new StandardGenerator();
+ tclp.GEN.generateRequest();
String res = tclp.cleanURL(URL1);
assertEquals("/addrbook/",res);
+ assertNull(tclp.stripFile(res));
}
public void testcheckURL() throws Exception
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]