Subreport Data Source Expression for XML document - xpath

I'm trying to get a subreport working for a report using an XML document as a data source.
When I'm sorting main report data, subreport won't have to requery the XML document. Its expecting a JRSortableDataSource, not a JRXmlDataSource.
What am I doing wrong?
I used following datasource expression:
$P{REPORT_DATA_SOURCE}).subDataSource("/person/phone")
The stack trace:
Error filling print... Error evaluating expression : Source text : $P{REPORT_DATA_SOURCE}.subDataSource("/person/phone")
net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression :
Source text : $P{REPORT_DATA_SOURCE}.subDataSource("/person/phone")
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:203)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:591)
at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:559)
at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:966)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:384)
at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:286)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:259)
at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:459)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2044)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:778)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:288)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:151)
at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:909)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:126)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:464)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:300)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:757)
at com.jaspersoft.ireport.designer.compiler.IReportCompiler.run(IReportCompiler.java:1003)
at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997) Caused by: groovy.lang.MissingMethodException:
No signature of method: net.sf.jasperreports.engine.fill.SortedDataSource.subDataSource()
is applicable for argument types: (java.lang.String) values: [/person/phone]
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:54)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:46)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:124)
at TestParam_1362739351228_895383.evaluate(calculator_TestParam_1362739351228_895383:223)
at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:190)

Your datasource expression $P{REPORT_DATA_SOURCE}).subDataSource("/B/C")
Has a syntax error
You missed unmatched character at first (
Then
If its expecting a JRSortableDataSource
Use this expression
((net.sf.jasperreports.engine.data.JRSortableDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("DefineThat")
If its expecting a JRXmlDataSource
Use this expression
((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{REPORT_DATA_SOURCE}).subDataSource("DefineThat")

$P{REPORT_DATA_SOURCE}).subDataSource("Xpath")
when somebody uses the above expression to connect to create sub report in Jasper using XML Datasource we need to set the Report Language as groovy instead of Java .I think subdatasource is not a method defined in Java but in groovy .I'm trying to find a method which is equivalent to above in Java

Had the same issue, found this solution at the jaspersoft-community:
Capturing the original data source in a parameter:
<parameter name="MyDataSource" class="net.sf.jasperreports.engine.JRDataSource" isForPrompting="false">
<defaultValueExpression><![CDATA[$P{REPORT_DATA_SOURCE}]]></defaultValueExpression>
</parameter>
same in iReport-GUI:
create new paramater at the main report
Name: "MyDataSource"
Parameter Class: "net.sf.jasperreports.engine.JRDataSource"
Use as a prompt: No
Default value Expression: "$P{REPORT_DATA_SOURCE}"
Now using the MyDataSource Parameter at the subreport-datasource:
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JRXmlDataSource)$P{MyDataSource}).dataSource("/Subreport/path")]]></dataSourceExpression>

Related

I want to generate the gatling html file by using simulation.log file [duplicate]

One question as just starting to use karate-gatling: is it possible to aggregate the reports generated? So after multiple runs to get one single report? It would be nice to be able to compare somehow the performance - to get automatically the information if there is a performance degradation or not. What I did try but did not work, was to copy the simulation logs and afterwards only generate the reports ("gatling.bat -ro simulations") but this did not work. The error that I got was:
gatling.bat -ro simulations/catskaratesimulation-1544015145031
GATLING_HOME is set to "D:\AutomationTeam\gatling-charts-highcharts-bundle-3.0.1.1"
JAVA = ""C:\Program Files\Java\jdk1.8.0_131\bin\java.exe""
Parsing log file(s)...
Exception in thread "main" java.lang.NumberFormatException: For input string: "catskaratesimulation"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Long.parseLong(Long.java:589)
at java.lang.Long.parseLong(Long.java:631)
at scala.collection.immutable.StringLike.toLong(StringLike.scala:305)
at scala.collection.immutable.StringLike.toLong$(StringLike.scala:305)
at scala.collection.immutable.StringOps.toLong(StringOps.scala:29)
at io.gatling.charts.stats.LogFileReader.$anonfun$firstPass$1(LogFileReader.scala:102)
at scala.collection.Iterator.foreach(Iterator.scala:937)
at scala.collection.Iterator.foreach$(Iterator.scala:937)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
at io.gatling.charts.stats.LogFileReader.firstPass(LogFileReader.scala:86)
at io.gatling.charts.stats.LogFileReader.$anonfun$x$4$1(LogFileReader.scala:125)
at io.gatling.charts.stats.LogFileReader.parseInputFiles(LogFileReader.scala:63)
at io.gatling.charts.stats.LogFileReader.(LogFileReader.scala:125)
at io.gatling.app.RunResultProcessor.initLogFileReader(RunResultProcessor.scala:67)
at io.gatling.app.RunResultProcessor.processRunResult(RunResultProcessor.scala:49)
at io.gatling.app.Gatling$.start(Gatling.scala:81)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
at io.gatling.app.Gatling$.main(Gatling.scala:38)
at io.gatling.app.Gatling.main(Gatling.scala)
Is there another way to do it? Should I somehow reconfigure gatling? Thanks!
It worked when using the same version (2.2.4) via gatling.bat -ro folder_with_simulations.

Error while running yaml from cloudformation

Getting error when I run following code:
Parameters:
Counter:
Type : Number
Default : 5
Description : Maximum number of times to check query execution
Error:
An error occurred (ValidationError) when calling the CreateChangeSet operation: Invalid input for parameter key Counter. Cannot specify usePreviousValue as true for a parameter key not in the previous template
I am writing code in yaml and running via AWS cloudformation.
Are you creating a ChangeSet or updating the stack using the option usePreviousValue? The error mentions you are using the usePreviousValue with a parameter that doesn't exist in the template. You can only use the previous value if this parameter is part of the latest version of the template.

How do I resolve oracle jdbc proxy class error in Evosuite generated tests?

I've written a JDBC driver and I'm trying to use Evosuite to generate the tests for it.
I'm using the following command line:
mvn -Dcores=5 -DmemoryInMB=5000 -Dmock_if_no_generator=false -DextraArgs=' -Dmock_if_no_generator=false -Dskip_covered=true Duse_separate_classloader=false -Dmax_recursion=50 -Dlocal_search_restore_coverage=true -Duse_existing_coverage=true -Dsandbox=false -Dsort_calls=true 'evosuite:generate
The code that is generated is below:
oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy oracle_1jdbc_1replay_1driver_1NonTxnReplayableBase_2java_1sql_1DatabaseMetaData___Proxy0 = new oracle.1jdbc.1replay.1driver.1NonTxnReplayableBase.2java.1sql.1DatabaseMetaData...Proxy((DatabaseMetaData) null, "k-{`1N&KKC", proxyFactory0, hashtable0);
and I'm getting the following error on the first line:
:[4618,7] not a statement
:[4618,13] ';' expected
(getting this error three times on the same line)
I was hoping to turn off the mocking but it didn't work it seems.
I'll try to see if I can provide more details later, but any initial thoughts from anyone?
Thanks!

A non-read-only mapping must be defined for the sequence number field

I am getting the following error from Toplink when I start my application. I am trying to add two new tables to our application.
EXCEPTION [TOPLINK-41] (TopLink - 9.0.3.7 (Build 440)): oracle.toplink.exceptions.DescriptorException
EXCEPTION DESCRIPTION: A non-read-only mapping must be defined for the sequence number field.
DESCRIPTOR: Descriptor(icis.cr.common.db.entities.ClerkReviewTask --> [DatabaseTable(CREV_TASK)])
I have compared the mappings to one that works and haven't noticed anything. I compared the new Class in TopLink workbench and don't see any missing mapping. It appears my sequence is mapped correctly. Does anyone have any suggestions with this?
The descriptor has the following for the TASK_ID field:
<primaryKeyFieldHandles>
<FieldHandle>
<table>CREV_TASK</table>
<fieldName>TASK_ID</fieldName>
</FieldHandle>
</primaryKeyFieldHandles>
<sequenceNumberName>SEQ_CREV_TASK_ID</sequenceNumberName>
<sequenceNumberFieldHandle>
<FieldHandle>
<table>CREV_TASK</table>
<fieldName>TASK_ID</fieldName>
</FieldHandle>
</sequenceNumberFieldHandle>
<Mapping>
<descriptor>icis.cr.common.db.entities.ClerkReviewTask.ClassDescriptor</descriptor>
<usesMethodAccessing>false</usesMethodAccessing>
<inherited>false</inherited>
<readOnly>false</readOnly>
<getMethodHandle>
<MethodHandle emptyAggregate="true">
</MethodHandle>
</getMethodHandle>
<setMethodHandle>
<MethodHandle emptyAggregate="true">
</MethodHandle>
</setMethodHandle>
<instanceVariableName>id</instanceVariableName>
<defaultFieldNames>
<defaultFieldName>direct field=</defaultFieldName>
</defaultFieldNames>
<fieldHandle>
<FieldHandle>
<table>CREV_TASK</table>
<fieldName>TASK_ID</fieldName>
</FieldHandle>
</fieldHandle>
<classIndicator>BldrDirectToFieldMapping</classIndicator>
</Mapping>
I was able to fix this by right-clicking my project in TopLink Mapping Workbench and selecting Export Project to Java Source. My file was out of date and caused this error and the following:
EXCEPTION [TOPLINK-110] (TopLink - 9.0.3.7 (Build 440)): oracle.toplink.exceptions.DescriptorException
EXCEPTION DESCRIPTION: Descriptor is missing for class [icis.cr.common.db.entities.ClerkReviewCaseTask].
MAPPING: oracle.toplink.mappings.OneToManyMapping[caseTasks]
DESCRIPTOR: Descriptor(icis.cr.common.db.entities.ClerkReviewTask --> [DatabaseTable(CREV_TASK)])

Reading a external XML file using __XPath(${__P(fileName)}

I have a situation where in I am trying to read a node value of an external XML. I am using BeanShell sampler to read the fileName (passed via command line) and using setProperty method setting the value of the parsed node:
${__setProperty(variable_name,${__XPath(${__P(fileName)},/Allocations/item/#name)})}
Though the above method retrieves the value of the node I intended to receive, there is a error thrown:
2013/03/19 19:32:59 ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: `` D:\myProject\Jmeter Tests\allocate.xml ;'' Token Parsing Error: Lexical error at line 2, column 3. Encountered: "\" (92), after : ""
My xml file looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<Allocations>
<item name="CAR" />
</Allocations>
Kindly advice if I am doing some error while reading.
Very strange because looks you are doing everything correct.
I've reproduced your scenario step-by-step but works fine for me.
Try to use e.g. Debug Sampler / Debug PostProcessor to monitor your jmeter properties and ensure that fileName normally set from command-line and doesn't contain any extra symbols.

Resources