SQL function like this "SELECT * FROM myFunction('%FILTER%')", where FILTER: and any_param >= 100 and any_param < 1000. When I run geoserver/cite/wms?....&viewparams=FILTER:and any_param >= 100 and any_param < 1000; I get message error "org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog." But, if I maked this param for default param, it is work fine. What is problem? Maybe I need screening any symbols?
FILTER is a OGC protocol keyword, I'm guessing you are hitting some validation checks designed for it (the contents is supposed to be an XML document). Use a different variable name.
Related
I have my HTTP request and have some conditions need to wait get at least 1 results or complete=true from the response.
I also want to add if keep executing to satisfy the below condition I want to stop after some request, my code:
if (vars.get('complete') == true || vars.get('total_result') > 0) {
vars.put('stop', true);
}
My request:
I think you are getting a String when getting vars value and failed to compare to 0.
You can parse value as Integer:
int total_result = vars.get('total_result') == null ? 0 : Integer.parseInt(vars.get('total_result'))
if (vars.get('complete') == true || total_result > 0) {
vars.put('stop', true);
}
You have a significant number of errors in the jmeter.log file:
so first of all you need to analyze what's going on there, it might be the case the variables are not having respective values.
Also since JMeter 3.1 you're supposed to be using Groovy language for scripting so consider migrating from JavaScript, moreover it is not available in later Java versions
Also JMeter Variables are stored as Java Strings so you need to perform the strings comparison or conversion of values to the required types
Suggested clause change (again assumes Groovy language):
vars.get('complete') == 'true' || (vars.get('total_result') as int) > 0
I am trying to use XPath 1.0 to select the maximum double value in an XML document. I understand that XPath 1.0 doesn't support the Max function that would make this extremely easy, but the system I'm using only supports XPath 1.0 functions.
I'm not able to post the entire file due to length, but here is a sample of the document I'm scanning: https://codebeautify.org/xmlviewer/cbc93c7e.
I've tried this XPath Expression:
/site/forecast/datum[not(primary < preceding-sibling::datum/primary) and not (primary < following-sibling::datum/primary)]
But no matter what, it returns the wrong datum. It always returns:
<datum>
<valid timezone="UTC">2019-04-04T06:00:00-00:00</valid>
<primary name="Stage" units="ft">9.80</primary>
<secondary name="Flow" units="cfs">3010.00</secondary>
<pedts>HGIFE</pedts>
</datum>
I expect it to return the element with the maximum "primary stage" value like:
<datum>
<valid timezone="UTC">2019-03-28T18:00:00-00:00</valid>
<primary name="Stage" units="ft">13.10</primary>
<secondary name="Flow" units="cfs">13400.00</secondary>
<pedts>HGIFE</pedts>
</datum>
I understand it will return all those with the 13.10 primary stage, but that's okay. I'll select the first one it returns if I can just get it to that point.
Do note that you might have more than one maximum. Use:
/site/forecast/datum[not(primary < ../datum/primary)][1]
This select the element
<datum>
<valid timezone="UTC">2019-03-28T18:00:00-00:00</valid>
<primary name="Stage" units="ft">13.10</primary>
<secondary name="Flow" units="cfs">13400.00</secondary>
<pedts>HGIFE</pedts>
</datum>
Test it in http://www.xpathtester.com/xpath/4256aac47f4f0efc36e23a2f16183d90
Below is the code which i have been trying to address the below UseCase in JMETER.Quick help is appreciated.
Usecase:
A particular text like "History" in a page response needs to be validated and the if the text counts is more than 50 a random selection of the options within the page needs to be made.And if the text counts is less than 50 1st option needs to be selected.
I am new to Jmeter and trying to solve this usingJSR223 POST processor but somehow stuck at vars.put function where i am unable to see the desired number being populated within the V paramter.
Using a boundary extractor where match no 1 should suffice the 1st selection and 0 should suffice the random selection.
def TotalInstanceAvailable = vars.get("sCount_matchNr").toInteger()
log.info("Total Instance Available = ${TotalInstanceAvailable}");
def boundary_analyzer =50;
def DesiredNumber,V
if (TotalInstanceAvailable < boundary_analyzer)
{
log.info("I am inside the loop")
DesiredNumber = 0;
log.info("DesiredNumber= ${DesiredNumber}");
vars.put("V", DesiredNumber)
log.info("v= ${V}");
}
else{
DesiredNumber=1;
log.info("DesiredNumber=${DesiredNumber}");
vars.put("V", "DesiredNumber")
log.info("v= ${V}");
}
def sCount = vars.get("sCount")
log.info("Text matching number is ${sCount_matchNr}")
You cannot store an integer in JMeter Variables using vars.put() function, you either need to cast it to String first, to wit change this line:
vars.put("V", DesiredNumber)
to this one
vars.put("V", DesiredNumber as String)
alternatively you can use vars.putObject() function which can store literally everything however you will be able to use the value only in JSR223 Elements by calling vars.getObject()
Whenever you face a problem with your JMeter script get used to look at jmeter.log file or toggle Log Viewer window - in absolute majority of cases you will find the root cause of your problem in the log file:
I'm facing a situation where I need to build a request string dynamically before sending it in an HTTP sampler. I'm choosing a random number between 15 and 50, and then for that many times, I append an XML tag with a parameter. So if my random number is 22, the this appended string (I call it ricString) will contain the same xml tag 22 times! And all I want is for it to use 22 different parameter values from the CSV file. But it doesn't do that. It takes the same value 22 times, and then uses the next value in the next iteration. Here is what I have written in my beanshell pre-processor.
counter = ${__Random(15,50)};
i = 0;
String ricString;
while(i<counter)
{
i++;
ricString = ricString + "<req:RCS>${__StringFromFile(...\RIC_3_01_Flag.csv)}</req:RCS>";
}
I have tried using both __StringFromFile as well as __CSVRead(filename, next) functions but no luck. It just does not update the value when inside the while-loop. Anyone know what I'm doing wrong?
Use a CSV DataSet that you nest into your loop (this is very important).
Then just use that variable that your CSV DataSet defines in your XML.
I would like to find the value of an element matched on id attribute for which I only have the ref - the bit with #, the anchor.
I am looking for the value of partyId:
< party id="partyA" >
< partyId >THEID< /partyId >
but to get there I only have the href from the following
< MyData >
< MyReference href="#partyA" />
Strip the # sign does not look good to me.
Any hints?
Because you haven't provided complete XML documents, I have to use // -- a practice I strongly recommend to avoid.
Suppose that
$vDataRef
is defined as
//MyData/MyReference/#href
and its string value is "#partyA", then one possible XPath expression that selects the wanted node is:
//party[#id=substring($vDataRef,2)]
In case the XML document has a DTD in which the id attribute of party is defined to be of type ID, then it is more convenient and efficient to use the standard XPath function id():
id(substring($vDataRef,2))
Assuming you have your ID as a variable already (lets say $myId), then try using:
//party[contains($myId, #id)]
The contains() function will look to see on each matching node whether or not the partyId attibute is in the value that you pass in.
Alternatively (as that could be considered 'ropey'), you can try:
//party[#id=substring($myId, 2, 1 div 0)]
the substring() function should be a little more precise.