12 years ago
Updating XML of Message Content Assetion of JDBC Request
Hi All,
We are working on a implementation of dynamical results from a database which needs to be checked in succesion of a SOA request.
For this we are updating the Message Content Assetion in a JDBC Request.
I have created a TestRunListener.beforeStep groovy which updates the Assertion Configuration. But is false.
Can someone help me to get this done proper?
Scriptlog:
Wed Nov 27 13:54:05 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep : DataSource
Wed Nov 27 13:54:05 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.WsdlDelayTestStep : Delay
Wed Nov 27 13:54:06 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep : JDBC Request
Wed Nov 27 13:54:06 CET 2013:INFO:=== Assertions:
Wed Nov 27 13:54:06 CET 2013:INFO:2
Wed Nov 27 13:54:06 CET 2013:INFO:<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config">
<con:originalMessage><![CDATA[<Results>
<ResultSet fetchSize="2">
<Row rowNumber="1">
<CONTROLEBESLISSINGBB.ID>1</CONTROLEBESLISSINGBB.ID>
<CONTROLEBESLISSINGBB.TESTCASE>RESOLVED GE001-001 1</CONTROLEBESLISSINGBB.TESTCASE>
<CONTROLEBESLISSINGBB.CASENUM>1</CONTROLEBESLISSINGBB.CASENUM>
<CONTROLEBESLISSINGBB.VAN>2013-06</CONTROLEBESLISSINGBB.VAN>
<CONTROLEBESLISSINGBB.TOT>2013-07</CONTROLEBESLISSINGBB.TOT>
<CONTROLEBESLISSINGBB.WAARDE>{"value":{"resultaat":"TOEGEWEZEN","hoogte":97.85,"vorm":"Prestatiebeurs"}}</CONTROLEBESLISSINGBB.WAARDE>
</Row>
<Row rowNumber="2">
<CONTROLEBESLISSINGBB.ID>2</CONTROLEBESLISSINGBB.ID>
<CONTROLEBESLISSINGBB.TESTCASE>RESOLVED GE001-001 1</CONTROLEBESLISSINGBB.TESTCASE>
<CONTROLEBESLISSINGBB.CASENUM>1</CONTROLEBESLISSINGBB.CASENUM>
<CONTROLEBESLISSINGBB.VAN>2013-07</CONTROLEBESLISSINGBB.VAN>
<CONTROLEBESLISSINGBB.TOT>2013-08</CONTROLEBESLISSINGBB.TOT>
<CONTROLEBESLISSINGBB.WAARDE>{"value":{"resultaat":"TOEGEWEZEN","hoogte":100.00,"vorm":"Prestatiebeurs"}}</CONTROLEBESLISSINGBB.WAARDE>
</Row>
{{SNIP}}
</ResultSet>
</Results>]]></con:originalMessage>
</xml-fragment>
Wed Nov 27 13:54:06 CET 2013:INFO:<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> {{snip}}Wed Nov 27 13:54:06 CET 2013:INFO:--- setConfiguration:
error log
Wed Nov 27 13:54:06 CET 2013:ERROR:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> {{snip}} <con:numberType>false</con:numberType> </con:elements> </xml-fragment> ]
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script6.run(Script6.groovy:33)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(SourceFile:47)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(SourceFile:29)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:73)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:49)
at com.eviware.soapui.eventhandlers.impl.EventHandlersTestRunListener.beforeStep(SourceFile:64)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:233)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
SoapUI Log:
Wed Nov 27 13:54:06 CET 2013:ERROR:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> <con:type xsi:nil="true"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-06</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.TOT[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.TOT</con:element> {{snip}}
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()
Wed Nov 27 13:54:06 CET 2013:ERROR:An error occurred [No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/
{{snip}}
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()], see error log for details
Wed Nov 27 13:54:06 CET 2013:INFO:Select *
From ControleBeslissingBB
Where ControleBeslissingBB.TestCase = 'RESOLVED GE001-001 1'
Wed Nov 27 13:54:06 CET 2013:INFO:Got response for [JDBC Request] in 0ms (4078 bytes)
Full logs attached
We are working on a implementation of dynamical results from a database which needs to be checked in succesion of a SOA request.
For this we are updating the Message Content Assetion in a JDBC Request.
I have created a TestRunListener.beforeStep groovy which updates the Assertion Configuration. But is false.
Can someone help me to get this done proper?
def XMLAssertSet = "<xml-fragment xsi:type=\"con:MessageContentAssertion\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:con=\"http://eviware.com/soapui/config\"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-06</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.TOT[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.TOT</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-07</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.WAARDE[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.WAARDE</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>{\"value\":{\"resultaat\":\"TOEGEWEZEN\",\"hoogte\":97.85,\"vorm\":\"Prestatiebeurs\"}}</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[2]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-07</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[2]/CONTROLEBESLISSINGBB.TOT[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.TOT</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-08</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[2]/CONTROLEBESLISSINGBB.WAARDE[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.WAARDE</con:element> <con:type xsi:nil=\"true\"/> <con:operator>=</con:operator> <con:enabled>false</con:enabled> <con:expectedValue>{\"value\":{\"resultaat\":\"TOEGEWEZEN\",\"hoogte\":111.00,\"vorm\":\"Prestatiebeurs\"}}</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> </xml-fragment> "
log.info "=== Assertions:"
log.info testStep.getAssertionList().size()
def XMLAssertVal = testStep.getAssertionAt(1).getConfiguration()
log.info XMLAssertVal
log.info XMLAssertSet
log.info "--- setConfiguration:"
testStep.getAssertionAt(1).setConfiguration(XMLAssertSet)
Scriptlog:
Wed Nov 27 13:54:05 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.WsdlDataSourceTestStep : DataSource
Wed Nov 27 13:54:05 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.WsdlDelayTestStep : Delay
Wed Nov 27 13:54:06 CET 2013:INFO:class com.eviware.soapui.impl.wsdl.teststeps.ProJdbcRequestTestStep : JDBC Request
Wed Nov 27 13:54:06 CET 2013:INFO:=== Assertions:
Wed Nov 27 13:54:06 CET 2013:INFO:2
Wed Nov 27 13:54:06 CET 2013:INFO:<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config">
<con:originalMessage><![CDATA[<Results>
<ResultSet fetchSize="2">
<Row rowNumber="1">
<CONTROLEBESLISSINGBB.ID>1</CONTROLEBESLISSINGBB.ID>
<CONTROLEBESLISSINGBB.TESTCASE>RESOLVED GE001-001 1</CONTROLEBESLISSINGBB.TESTCASE>
<CONTROLEBESLISSINGBB.CASENUM>1</CONTROLEBESLISSINGBB.CASENUM>
<CONTROLEBESLISSINGBB.VAN>2013-06</CONTROLEBESLISSINGBB.VAN>
<CONTROLEBESLISSINGBB.TOT>2013-07</CONTROLEBESLISSINGBB.TOT>
<CONTROLEBESLISSINGBB.WAARDE>{"value":{"resultaat":"TOEGEWEZEN","hoogte":97.85,"vorm":"Prestatiebeurs"}}</CONTROLEBESLISSINGBB.WAARDE>
</Row>
<Row rowNumber="2">
<CONTROLEBESLISSINGBB.ID>2</CONTROLEBESLISSINGBB.ID>
<CONTROLEBESLISSINGBB.TESTCASE>RESOLVED GE001-001 1</CONTROLEBESLISSINGBB.TESTCASE>
<CONTROLEBESLISSINGBB.CASENUM>1</CONTROLEBESLISSINGBB.CASENUM>
<CONTROLEBESLISSINGBB.VAN>2013-07</CONTROLEBESLISSINGBB.VAN>
<CONTROLEBESLISSINGBB.TOT>2013-08</CONTROLEBESLISSINGBB.TOT>
<CONTROLEBESLISSINGBB.WAARDE>{"value":{"resultaat":"TOEGEWEZEN","hoogte":100.00,"vorm":"Prestatiebeurs"}}</CONTROLEBESLISSINGBB.WAARDE>
</Row>
{{SNIP}}
</ResultSet>
</Results>]]></con:originalMessage>
</xml-fragment>
Wed Nov 27 13:54:06 CET 2013:INFO:<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> {{snip}}Wed Nov 27 13:54:06 CET 2013:INFO:--- setConfiguration:
error log
Wed Nov 27 13:54:06 CET 2013:ERROR:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> {{snip}} <con:numberType>false</con:numberType> </con:elements> </xml-fragment> ]
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:55)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at Script6.run(Script6.groovy:33)
at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:96)
at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SourceFile:89)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIScript.invoke(SourceFile:47)
at com.eviware.soapui.eventhandlers.support.DefaultSoapUIEventHandler.invoke(SourceFile:29)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:73)
at com.eviware.soapui.eventhandlers.support.AbstractEventHandlerMetaData.invokeHandlers(SourceFile:49)
at com.eviware.soapui.eventhandlers.impl.EventHandlersTestRunListener.beforeStep(SourceFile:64)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:233)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
SoapUI Log:
Wed Nov 27 13:54:06 CET 2013:ERROR:groovy.lang.MissingMethodException: No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.VAN[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.VAN</con:element> <con:type xsi:nil="true"/> <con:operator>=</con:operator> <con:enabled>true</con:enabled> <con:expectedValue>2013-06</con:expectedValue> <con:numberType>false</con:numberType> </con:elements> <con:elements> <con:xpath>//Results[1]/ResultSet[1]/Row[1]/CONTROLEBESLISSINGBB.TOT[1]</con:xpath> <con:element>CONTROLEBESLISSINGBB.TOT</con:element> {{snip}}
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()
Wed Nov 27 13:54:06 CET 2013:ERROR:An error occurred [No signature of method: com.eviware.soapui.impl.wsdl.teststeps.assertions.MessageContentAssertion.setConfiguration() is applicable for argument types: (java.lang.String) values: [<xml-fragment xsi:type="con:MessageContentAssertion" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:con="http://eviware.com/soapui/config"> <con:elements> <con:xpath>//Results[1]/
{{snip}}
Possible solutions: setConfiguration(org.apache.xmlbeans.XmlObject), getConfiguration()], see error log for details
Wed Nov 27 13:54:06 CET 2013:INFO:Select *
From ControleBeslissingBB
Where ControleBeslissingBB.TestCase = 'RESOLVED GE001-001 1'
Wed Nov 27 13:54:06 CET 2013:INFO:Got response for [JDBC Request] in 0ms (4078 bytes)
Full logs attached