Comments (1)
Based on the result, without a JavaBean, it does not work.
It does not work because the FreeMarker template is referencing the JavaBean properties. Currently you have this template:
{
"orderNumber":${order.number},
"orderStatus":"${order.status}",
"creationDate":"${order.creationDate?date?string('yyyy-MM-dd')}"
}
But the above template is referencing JavaBean properties, while in your testJ2JWithoutJb
test, you must use a different template that references the JSON keys like the one below:
{
"orderNumber":${order.order_number},
"orderStatus":"${order.order_status}",
"creationDate":"${order.creation_date}"
}
Additionally, to conserve memory, Smooks doesn't retain the child events of the selected parent event unless explicitly configured to do so. In other words, the test will still fail because the child events (e.g., order_number
) of the selected event (i.e., order
) are discarded. There are couple ways of retaining the child events. Naively, you could retain all the events in memory like this:
@Test
public void testJ2JWithoutJb() throws Exception {
...
smooks.setFilterSettings(FilterSettings.newSaxNgSettings().setMaxNodeDepth(0));
...
This way of retaining events can be very inefficient because setting the max node depth to 0 means that all generated events are kept in memory. The Smook fundamentals and templating sections of the docs can guide you in implementing your solution the right way.
from smooks.
Related Issues (20)
- error in opening zip file in Initialisation HOT 4
- Where is ConfigParam? HOT 1
- EDI message processing failed - expected to contain 2 fields. Actually contains 1 fields HOT 1
- Question: Smooks seems to scan all project dependencies - how do I prevent that? HOT 4
- Memory issue with edi to java parsing | smooks version: 2.0.0-RC1 HOT 2
- Class loader used for loading ContentHandlerFactory is not the same as the one set in ApplicationContext
- CSV Reader not escaping double quotes HOT 2
- How to map json to json HOT 3
- Smooks-all for 2.0 HOT 3
- Upgrade to atleast java 9 to use Jakarta EE 9 namespace HOT 3
- springboot 2.3 conflict HOT 2
- factory.toUNEdifact() BigDecimal Value... HOT 2
- cannot be cast to org.smooks.engine.delivery.sax.ng.org.apache.xerces.util.SecurityManager HOT 1
- CVE-2023-51079 in mvel dependency HOT 1
- Selector matches the node despite the namespace URIs being different
- delegate-reader throws "com.fasterxml.aalto.WFCException: Invalid UTF-8" when writing multi-byte characters
- NoSuchFileException when instantiating Smooks HOT 3
- Regression in v2 when the last step in the selector has a predicate index
- <core:delegate-reader> doesn't properly rewrite the attribute xmlns=""
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smooks.