ERC721PresetMinterPauserAutoId tokenURL error - smartcontracts

I am working on writing ERC721 smart contracts by using the PresetMinterPauserAutoId script.
ERC721PresetMinterPauserAutoId("Simple", "SPL", "http://127.0.0.1:8080/ipfs/QmU2JdyAmcSMy9A44nUCbYCFkKKR65b37HCqZLsQPNJABw/")
{}
However, for the third parameter in the constructor (supposing it's the base url), I am not sure what to put. I tried "ipfs://{CID}" , "http://ipfs/{local site}/{CID}" and "ipfs.io/{CID}" but they all failed. I wonder how am I supposed tyo get my json data read and if there's any way to test what the input actualy is (in order to debug). Thanks.

Related

SOAP UI - Set a node value in all test step's requests of all test cases in a test suites

I'm trying to set a node value in all test step's requests xml of all test cases in a test suite.
The groovy script is in the first test case and I get an error (XmlException: Unexpected Element: CDATA) as soon as the script try to edit the same tag in the second test case.
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def AlltestCases = testRunner.testCase.testSuite.project.testSuites[testRunner.testCase.testSuite.name]
0.upto(AlltestCases.getTestCaseCount()) {
AlltestCases.getTestCaseList().each{
it.getTestStepList().each{ if(it.getClass()==com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep){
if(it.getName().toLowerCase().contains("verify")){
step = groovyUtils.getXmlHolder("${it.getName()}"+"#Request")
step.setNodeValue("//*:Name/text()", "\$"+"{#TestSuite#NAME_ID}")
step.updateProperty()
}
}
}
}
}
If I understand your question correctly, you want to "inject" a value in a number of requests?
I would advise against that. I would rather set some project property, and then let each of the requests simply use that particular variable.
The most important reason for me to prefer this approach, is to make it more tranparent what is happening in your testcase, should someone else at some point - like if you get a different job - would need to take over your SoapUI projects. Currently you have requests, which hold values that appear to come out of nowhere. I would advise to make it clear that the request contains some sort of variable, and where that variable comes from.
Besides you will then also get more flexibility. If a few reqeusts at some point changes the path or name of the entity you want to change, you will need to make your code above handle that kind of situation. Not so, if you are merely using a variable in each of your requests.

How to pass the background response value of the to another feature json in function value using Karate

I have got the response in the background to one of the request and passing to the function for polling purpose and need to run until specific condition met. In that function, I need to pass the values to the calling feature JSON file
while (true) {
var result = karate.call('extractProgress.feature') packageid; -- package id
is response of another request
I followed the similar way as mentioned but in that not passing any parameter.
https://github.com/intuit/karate/blob/933d3803987a736cc1a38893e7039c4b5e5132fc/karate-demo/src/test/java/demo/polling/polling.feature
But i am getting the below error
feature(com.intuit.karate.testng.KarateTestngTest):
java.lang.RuntimeException: javascript evaluation failed: packageid,
ReferenceError: "packageid" is not defined in at line number 1
Input for call inside js should be given as
karate.call("<featureFile>",yourInputVaraible);
refer this on doc
https://github.com/intuit/karate#the-karate-object
It sounds wrong to me, maybe you have a typo.
Also please read the docs carefully. Only JSON is supported as a call argument.
The best way for you to get support is to follow this process, else no one can help you with the limited info you seem to be providing in your questions.
https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Call Worklight Javascript SQL Adapter form REST Client

I am using IBM Worklight 7.1 and I am trying to call a Javascript SQL adapter form REST client like HttpRequester. I can call adapter but cannot figure out how to pass parameters to procedure.
For Adapter named MyAdapter and procedure named myProc, I can call adapter using baseUrl/MyAdapter/myProc, using both GET and POST method form REST Client, but all the parameters in procedure are undefined.
function myProc(a,c) {
return {
result : "OK"
};
}
I have tried passing parameter in following ways.
As query string ?a=b&c=d
As JSON String {"a":"b","c":"d"}
Passing parameter in array as parameters=['b','c']
Why Do This
Reason behind doing this is to make Data Setting, Procedure call, Output check and data erase process automatic by writing script to make testing easy and automatic. So, feel free to suggest if any other better process already exist to do above steps automatically.
When calling a JavaScript adapter (this answer is not applicable to Java adapters), the REST call should look like:
/{project-context}/adapters/{adapter-name}/{procedure-name}/?params=[a,b,c,d]
In other words, a JavaScript procedure receives only ONE parameter called params which needs to be an array of ordered, unnamed values.

Mule ESB: How to call a flow inside Datamapper( script)

I have datamapper, ( source: pojo and target:CSV), I need to call the other flow ( or groovy) inside datamapper. I stuck in passing the parameter to the flow. For example, I don't want entire payload has to go to flow for validation. I need to pass only two values. I used
flowRef(String,Object)
output.Item = flowRef("sampletestFlow",input.Model);
It works fine for single payload. But i have to pass one more parameter ( called input.Policy). I know we have to use
flowRef(String,Object,Map).
But it don't know the format for two input parameter.
Could you please anyone help me on this.
I have handled the scenario by the below way. Have create java class and called the java via damapper script. Below is the code inside datamapper script to call the java code.
stringUtil = new com.test.util.StringUtil();
output.style = stringUtil.formatValue(input.RuleStyle);
Hope this helps.

Retrieve response from a "Run Test Step", using SoapUI/ Groovy?

In SoapUI, I have a host Test Case, which executes another external Test Case (with several test steps) using the "Run Test Case" test step. I need to access a response from the external TC from within my host TC, since I need to assert on some values.
I cannot transfer the properties since they are in XML. Could I get some pointers as to how I could leverage Groovy/SoapUI for this.
For Response you can use the below code.
testRunner.testCase.getTestStepByName("test step").testRequest.response.responseContent
In you external TC create another property and at the end of the TC use Transfer Property step to transfer your XML node to it. In your host TC, just read that property as you would any other.
I also had a look around to see if this can be done from Groovy. SoapUI documentation says that you need to refer to the external name of the testsuite / testcase:
def tc = testRunner.testCase.testSuite.project.testSuites["external TestSuite"].testCases["external TestCase"]
def ts = tc.testSteps["test step"]
But I could not find how to get at the Response after that.
In addition to Guest and SiKing answers, I share a solution to a problem that I've met:
If your step is not of type 'request' but 'calltestcase' you cannot use Guest answer.
I have a lot of requests contained each in a testCase and my other testCases call these testCases each time I need to launch a request.
I configured my request testCases in order to return the response as a custom property that I call "testResponse" so I can easily access it from my other testCases.
I met a problem in the following configuration :
I have a "calltestcase" step that gives me a request result.
Further in the test I have a groovy script that needs to call this step and get the response value
If I use this solution :
testRunner.runTestStepByName("test step")
followed by testRunner.testCase.getTestStepByName("test step").testRequest.response.responseContent
I'm stuck as there is no testRequest property for the class.
The solution that works is :
testRunner.runTestStepByName("test step")
def response_value = context.expand( '${test step#testResponse#$[\'value\']}' )
another solution is :
testRunner.runTestStepByName("test step")
tStep = testRunner.testCase.getTestStepByName("test step")
response = tStep.getPropertyValue("testResponse")
Then I extract the relevant value from 'response' (in my case, it is a json that I have to parse).
Of course it works only because I the request response as a custom property of my request test case.
I hope I was clear enough