How can i test the dynamic json expression in my Logic app - json

I'm setting up a complex json expression to build up a request for an api. I would like to verify this expression somehow in a unittest.
Is there a library available that i can feed a json and the expression and it executes the expression so i can verify the result.
My expression contains various 'if', 'concat', 'json' statements.
Thanks

I am not aware of any external library, but any expression can be easily tested in a Logic App by creating a Compose action, using your expression in its Inputs box, running the Logic App and checking the Outputs.

Related

How to make Simple-JSON variable template query in grafana?

I am trying to create a dynamic variable for a graph using a kdb+ database, which requires the Simple-JSON plug in. However, I am struggling to figure out how to write the query in the Query search bar under Variables on my Dashboard.
I have looked into the documentation found here but there is only a few mentions of the templating feature for variables in grafana, but nothing on how to do it.
https://github.com/grafana/simple-json-datasource/blob/master/README.md
You can write arbitrary text in the timeserie query, it doesn't need to be one of the hardcoded metrics that /search returns.
There is also the simpod json datasource plugin.
https://grafana.com/grafana/plugins/simpod-json-datasource
built on top of the Simple JSON Datasource. It has refactored code, additional features and active development.
One of the "additional features" is an "Additional JSON Data" tab where you can use variables. {"key": $variableValue}
It actually turns out that the adaptor for kdb+/grafana needs it's search function overloaded to be able to accept variables and return a string (or something that grafana can understand).

How do you pass parameters to Azure Logic Apps Liquid Connector for JSON-JSON transformation?

I have a Liquid transformation step in my Azure Logic App, using the "Transform JSON to JSON" version of the Liquid connector. I need to pass some parameters into the transformation - these values will end up in the JSON output from the transformation.
Unfortunately, I can't find any documentation or examples on how you would pass such parameters into the Liquid map.
There's no way to specifically 'pass parameters' to a Liquid template because Liquid does not support that construct.
However, you can easily inject a Parameters object into the source JSON using the Compose Action. Then you access them like any other value.

Dynamic searchParameters in http request of jmeter

IndexFile.csv is like
type,text,code,,,FileOne.csv
req,,,,,FileTwo.csv
And soo on which means dynamic number of params for http request
FileOne.csv is like
44-3ef-k23,string,http://someThing:port/Something|something
string,"string,string",1234
So i need http encoding i.e utf-8 while reading file.
Can someone help me how to do this
One thing is obvious: you should not be using __CSVRead() function inside the JSR223 script.
According to JSR223 Sampler documentation:
JMeter processes function and variable references before passing the script field to the interpreter, so the references will only be resolved once. Variable and function references in script files will be passed verbatim to the interpreter, which is likely to cause a syntax error. In order to use runtime variables, please use the appropriate props methods, e.g.
props.get("START.HMS");
props.put("PROP1","1234");
So I would suggest to use File.readLines() function in order to read your CSV file(s) into memory, once done you should be able to call split() function to split each line by comma and do what you need with the results.
Check out Working with Files chapter of The Groovy Templates Cheat Sheet for JMeter article for more information and examples

StringIndexOutOfBoundsException in JMeter request

Why im getting this exception in POST request?
I'm trying to login with JMeter, but no matter i do it won't work.
I have Cookie Manager HC4CookieHandler/standard, Regular Expression Extractor too jsfViewState/name="javax.faces.ViewState" id="javax.faces.ViewState" value="(.+?)" checked Main and sub-samples/Body.
But still in POST login i'm getting this.
What i'm missing? Is it in regular expression value? javax.facesViewState has value "-2918962836342094824:7411539759421041608", but doesn't range "(.+?)" should catch it?
Looking into your request details it appears that you're sending ${jsfViewstate} instead of the numeric value so your Regular Expression Extractor doesn't seem to be capturing it from the response for some reason. The reasons could be in:
Parent sampler doesn't contain the javax.faces.ViewState input, it comes in sub-samples. In that case you will need to switch Regular Expression Extractor scope to "Main sample and sub-samples"
Response markup assumes that "ViewState" input is broken into 2 lines so your single-line regular expression cannot match it.
Some suggestions:
You can use Debug Sampler and View Results Tree listener combination to see JMeter Variables values
You can use "RegExp Tester" mode of the View Results Tree listener to test your regular expression against live response
See How to Debug your Apache JMeter Script guide for hints on getting to the bottom of JMeter script issues.
You can consider using XPath Extractor as an alternative.
Add XPath Extractor as a child of the first request
Configure it as follows:
Apply to: Main sample and sub-samples
Check Use Tidy
Reference Name: anything meaningful, i.e. jsfViewState
XPath query: //input[#id='javax.faces.ViewState']/#value
Disable (or delete) your Regular Expression Extractor
Refer extracted value as ${jsfViewState} where required
XPath Extractor Configuration:
Demo:

submitting a parameterized hudson build via the REST API

hudson supports submitting a build by doing an HTTP GET to an API. I need to pass some parameters to such a build. Just adding them as additional URL parameters doesn't work for me. Is this supposed to work? Is there some other mechanism?
Is it possible to pass parameters in the Hudson's job that will be triggered remotely?
Check this question.
Instead of /build use /buildWithParameters. I'm currently using it with a simple wget
Based on the HTML source on the web interface for starting a parameterized build, you need to do a POST to http://hudson/job/NAME/build with the parameters.
Update: It's a little more complicated. There's a hidden input with name "name" and value "MyParameter", then the input you actually fill in with name "value" and value "MyInput". (Where MyParameter if your parameter name and MyInput is whatever you need to fill in.) I haven't checked to see how this works with more than one parameter.
the POST works with just the json url parameter that contains a JSON list of the build parameters: json=%7B%22parameter%22%3A+%5B%7B%22name%22%3A+%22Input%22%2C+%22value%22%3A+%22data1%22%7D%2C+%7B%22name%22%3A+%22Input2%22%2C+%22value%22%3A+%22data2%22%7D%5D%2C+%7D