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 ms...@apache.org on 2003/06/06 15:03:56 UTC
cvs commit: jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config MultipartUrlConfig.java
mstover1 2003/06/06 06:03:56
Modified: src/core/org/apache/jmeter/resources messages.properties
messages_de.properties messages_ja.properties
messages_no.properties
src/core/org/apache/jmeter/util JMeterUtils.java
src/protocol/http/org/apache/jmeter/protocol/http/config
MultipartUrlConfig.java
Added: src/components/org/apache/jmeter/assertions
XMLAssertion.java
src/components/org/apache/jmeter/assertions/gui
XMLAssertionGui.java
Log:
New XML Assertion
Revision Changes Path
1.1 jakarta-jmeter/src/components/org/apache/jmeter/assertions/XMLAssertion.java
Index: XMLAssertion.java
===================================================================
/*
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache JMeter" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache JMeter", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jmeter.assertions;
import java.io.Serializable;
import java.io.StringReader;
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.AbstractTestElement;
import org.jdom.input.SAXBuilder;
/**
* Checks if the result is a well-formed XML content.
*
* Copyright: Copyright (c) 2001
*
* @author <a href="mailto:gottfried@szing.at">Gottfried Szing</a>
* @version $Revision: 1.1 $, $Date: 2003/06/06 13:03:55 $
*/
public class XMLAssertion extends AbstractTestElement implements Serializable, Assertion
{
// one builder for all requests
private static SAXBuilder builder = null;
/**
* Returns the result of the Assertion. Here it checks wether the
* Sample took to long to be considered successful. If so an AssertionResult
* containing a FailureMessage will be returned. Otherwise the returned
* AssertionResult will reflect the success of the Sample.
*/
public AssertionResult getResult(SampleResult response)
{
// no error as default
AssertionResult result = new AssertionResult();
result.setFailure(false);
// the result data
String resultData = new String(getResultBody(response.getResponseData()));
// create parser like (!) a singleton
if (builder == null)
{
try
{
// This builds a document of whatever's in the given resource
builder = new SAXBuilder();
}
catch (Exception e)
{
log.error("Unable to instantiate DOM Builder", e);
result.setFailure(true);
result.setFailureMessage("Unable to instantiate DOM Builder");
// return with an error
return result;
}
}
try
{
builder.build(new StringReader(resultData));
}
catch (Exception e)
{
log.debug("Cannot parse result content", e);
result.setFailure(true);
result.setFailureMessage(e.getMessage());
}
return result;
}
/**
* Return the body of the http return.
*/
private byte[] getResultBody(byte[] resultData)
{
for (int i = 0; i < (resultData.length - 1); i++)
{
if (resultData[i] == '\n' && resultData[i + 1] == '\n')
{
return getByteArraySlice(resultData, (i + 2), resultData.length - 1);
}
}
return resultData;
}
/**
* Return a slice of a byte array
*/
private byte[] getByteArraySlice(byte[] array, int begin, int end)
{
byte[] slice = new byte[(end - begin + 1)];
int count = 0;
for (int i = begin; i <= end; i++)
{
slice[count] = array[i];
count++;
}
return slice;
}
}
1.1 jakarta-jmeter/src/components/org/apache/jmeter/assertions/gui/XMLAssertionGui.java
Index: XMLAssertionGui.java
===================================================================
/*
* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001,2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache JMeter" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Apache JMeter", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.jmeter.assertions.gui;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.assertions.XMLAssertion;
import org.apache.jorphan.gui.layout.VerticalLayout;
/****************************************
* Title: Jakarta-JMeter
* Description:
* Copyright: Copyright (c) 2001
* Company: Apache
*
* @author <a href="mailto:gottfried@szing.at">Gottfried Szing</a>
* @version $Revision: 1.1 $, $Date: 2003/06/06 13:03:55 $
* ***************************************/
public class XMLAssertionGui extends AbstractAssertionGui
{
/****************************************
* the constructor
***************************************/
public XMLAssertionGui()
{
init();
}
/**
* Returns the label to be shown within the JTree-Component.
*/
public String getStaticLabel()
{
return JMeterUtils.getResString("xml_assertion_title");
}
/**
*
* @return
*/
public TestElement createTestElement()
{
XMLAssertion el = new XMLAssertion();
modifyTestElement(el);
return el;
}
/**
* Modifies a given TestElement to mirror the data in the gui components.
*
* @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
*/
public void modifyTestElement(TestElement el)
{
configureTestElement(el);
}
/****************************************
* configures the associated test element
* @param el
*/
public void configure(TestElement el)
{
super.configure(el);
}
/**
* inits the GUI
*/
private void init()
{
setLayout(new VerticalLayout(5, VerticalLayout.LEFT, VerticalLayout.TOP));
setBorder(makeBorder());
add(makeTitlePanel());
}
}
1.44 +2 -1 jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties
Index: messages.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages.properties,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- messages.properties 5 Jun 2003 17:33:37 -0000 1.43
+++ messages.properties 6 Jun 2003 13:03:56 -0000 1.44
@@ -369,4 +369,5 @@
ldap_testing_title= LDAP Request
webservice_sampler_title=WebService (SOAP) Request
soap_action=Soap Action
-get_xml_from_file=File with SOAP XML Data (overrides above text)
\ No newline at end of file
+get_xml_from_file=File with SOAP XML Data (overrides above text)
+xml_assertion_title=XML Assertion
\ No newline at end of file
1.36 +2 -1 jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_de.properties
Index: messages_de.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_de.properties,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- messages_de.properties 5 Jun 2003 17:33:37 -0000 1.35
+++ messages_de.properties 6 Jun 2003 13:03:56 -0000 1.36
@@ -358,4 +358,5 @@
maximum_param=The maximum value allowed for a range of values
webservice_sampler_title=WebService (SOAP) Request
soap_action=Soap Action
-get_xml_from_file=File with SOAP XML Data (overrides above text)
\ No newline at end of file
+get_xml_from_file=File with SOAP XML Data (overrides above text)
+xml_assertion_title=XML Assertion
\ No newline at end of file
1.32 +2 -1 jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_ja.properties
Index: messages_ja.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_ja.properties,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- messages_ja.properties 5 Jun 2003 17:33:37 -0000 1.31
+++ messages_ja.properties 6 Jun 2003 13:03:56 -0000 1.32
@@ -353,4 +353,5 @@
maximum_param=The maximum value allowed for a range of values
webservice_sampler_title=WebService (SOAP) Request
soap_action=Soap Action
-get_xml_from_file=File with SOAP XML Data (overrides above text)
\ No newline at end of file
+get_xml_from_file=File with SOAP XML Data (overrides above text)
+xml_assertion_title=XML Assertion
\ No newline at end of file
1.32 +2 -1 jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_no.properties
Index: messages_no.properties
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/resources/messages_no.properties,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- messages_no.properties 5 Jun 2003 17:33:37 -0000 1.31
+++ messages_no.properties 6 Jun 2003 13:03:56 -0000 1.32
@@ -345,4 +345,5 @@
maximum_param=The maximum value allowed for a range of values
webservice_sampler_title=WebService (SOAP) Request
soap_action=Soap Action
-get_xml_from_file=File with SOAP XML Data (overrides above text)
\ No newline at end of file
+get_xml_from_file=File with SOAP XML Data (overrides above text)
+xml_assertion_title=XML Assertion
\ No newline at end of file
1.25 +3 -2 jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterUtils.java
Index: JMeterUtils.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/util/JMeterUtils.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- JMeterUtils.java 5 Jun 2003 15:02:06 -0000 1.24
+++ JMeterUtils.java 6 Jun 2003 13:03:56 -0000 1.25
@@ -97,7 +97,7 @@
*/
public class JMeterUtils implements UnitTestManager
{
- private static final String VERSION="1.9.RC20030605";
+ private static final String VERSION="1.9.RC20030606";
private static PatternCacheLRU patternCache = new PatternCacheLRU(1000,new Perl5Compiler());
transient private static Logger log =
@@ -977,6 +977,7 @@
return VERSION;
}
}
+
1.7 +1 -1 jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java
Index: MultipartUrlConfig.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/protocol/http/org/apache/jmeter/protocol/http/config/MultipartUrlConfig.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- MultipartUrlConfig.java 15 Apr 2003 21:40:30 -0000 1.6
+++ MultipartUrlConfig.java 6 Jun 2003 13:03:56 -0000 1.7
@@ -154,7 +154,7 @@
{
arg.setAlwaysEncoded(false);
}
- args.addArgument(new HTTPArgument(name,value,true));
+ args.addArgument(arg);
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org