From de753ea8f708ca74a005c262beda0e8eed1a2abf Mon Sep 17 00:00:00 2001 From: cjmamo <823038+cjmamo@users.noreply.github.com> Date: Sun, 20 Oct 2024 21:05:24 +0200 Subject: [PATCH] chore: prepare release (#157) --- README.adoc | 67 +++++++++++-------- pom.xml | 8 +-- .../basic/FragmentSerializerNSConfigTest.java | 19 +++--- .../routing/basic/FragmentSerializerTest.java | 20 +++--- .../file/FileOutputStreamResourceTest.java | 2 +- .../routing/file/FlightSplitTest.java | 3 +- .../routing/jms/activemq/ActiveMQTest.java | 2 +- 7 files changed, 67 insertions(+), 54 deletions(-) diff --git a/README.adoc b/README.adoc index 5e1c8ae..ad8e99f 100644 --- a/README.adoc +++ b/README.adoc @@ -62,11 +62,11 @@ Then the Smooks code for executing this: [source,java] ---- Smooks smooks = new Smooks(configStream); -JavaResult javaResult = new JavaResult(); +JavaSink javaSink = new JavaSink(); -smooks.filterSource(new StreamSource(soapMessageStream), javaResult); +smooks.filterSource(new StreamSource(soapMessageStream), javaSink); -String bodyContent = javaResult.getBean("soapBody").toString().trim(); +String bodyContent = javaSink.getBean("soapBody").toString().trim(); ---- And of course, you can do all of this programmatically too (i.e., no need for the XML config): @@ -77,10 +77,10 @@ Smooks smooks = new Smooks(); smooks.addVisitor(new FragmentSerializer().setBindTo("soapBody"), "Envelope/Body"); -JavaResult javaResult = new JavaResult(); -smooks.filterSource(new StreamSource(soapMessageStream), javaResult); +JavaSink javaSink = new JavaSink(); +smooks.filterSource(new StreamSource(soapMessageStream), javaSink); -String bodyContent = javaResult.getBean("soapBody").toString().trim(); +String bodyContent = javaSink.getBean("soapBody").toString().trim(); ---- The code snippets above only show how to create the split messages and bind them into the bean context, from where they can be accessed. How about routing these split messages to another endpoint for processing?Well it's easy, just use one of the routing components as outlined in the following sections. @@ -159,15 +159,21 @@ To achieve this with Smooks, we assemble the following Smooks configuration: -(4) - target/classes/orderitem-split.ftl - + output stream configured below. + --> +(4) + - - - + + + + + + target/classes/orderitem-split.ftl + + + + ---- @@ -220,18 +226,25 @@ The following is an example `++` configuration that routes an `+orde -(3) - - /orderitem-split.ftl - - - - - + (3) + + + + + + + + + + /orderitem-split.ftl + + + + ---- @@ -247,7 +260,7 @@ In this case, we route the result of a FreeMarker templating operation to the JM org.smooks.cartridges smooks-routing-cartridge - 2.0.0-RC4 + 2.0.0 ---- diff --git a/pom.xml b/pom.xml index d1e4c78..c754fce 100644 --- a/pom.xml +++ b/pom.xml @@ -7,7 +7,7 @@ org.smooks.cartridges smooks-routing-cartridge - 2.0.0-RC4 + 2.0.0 Smooks Routing Cartridge https://www.smooks.org @@ -41,7 +41,7 @@ UTF-8 true - 2.0.0-RC4 + 2.0.0 @@ -250,7 +250,7 @@ org.smooks.cartridges smooks-templating-cartridge - 2.0.0-RC4 + 2.0.0 test @@ -262,7 +262,7 @@ org.smooks.cartridges smooks-javabean-cartridge - 2.0.0-RC4 + 2.0.0 test diff --git a/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerNSConfigTest.java b/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerNSConfigTest.java index ae2f86b..0a7ad22 100644 --- a/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerNSConfigTest.java +++ b/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerNSConfigTest.java @@ -46,11 +46,12 @@ import org.custommonkey.xmlunit.XMLUnit; import org.junit.Test; import org.smooks.Smooks; -import org.smooks.io.payload.JavaResult; +import org.smooks.io.sink.JavaSink; +import org.smooks.io.source.StreamSource; import org.xml.sax.SAXException; -import javax.xml.transform.stream.StreamSource; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.io.StringReader; @@ -62,24 +63,24 @@ public class FragmentSerializerNSConfigTest { @Test public void test_children_only() throws IOException, SAXException { Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-01-ext.xml")); - StreamSource source = new StreamSource(getClass().getResourceAsStream("input-message-01.xml")); - JavaResult result = new JavaResult(); + StreamSource source = new StreamSource<>(getClass().getResourceAsStream("input-message-01.xml")); + JavaSink sink = new JavaSink(); - smooks.filterSource(source, result); + smooks.filterSource(source, sink); XMLUnit.setIgnoreWhitespace( true ); - XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("children-only.xml")), new StringReader(result.getBean("soapBody").toString().trim())); + XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("children-only.xml")), new StringReader(sink.getBean("soapBody").toString().trim())); } @Test public void test_all() throws IOException, SAXException { Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-02-ext.xml")); StreamSource source = new StreamSource(getClass().getResourceAsStream("input-message-01.xml")); - JavaResult result = new JavaResult(); + JavaSink sink = new JavaSink(); - smooks.filterSource(source, result); + smooks.filterSource(source, sink); XMLUnit.setIgnoreWhitespace( true ); - XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("all.xml")), new StringReader(result.getBean("soapBody").toString().trim())); + XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("all.xml")), new StringReader(sink.getBean("soapBody").toString().trim())); } } diff --git a/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerTest.java b/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerTest.java index de2d2ec..40c5837 100644 --- a/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerTest.java +++ b/src/test/java/org/smooks/cartridges/routing/basic/FragmentSerializerTest.java @@ -49,11 +49,11 @@ import org.smooks.api.ExecutionContext; import org.smooks.api.SmooksException; import org.smooks.api.resource.visitor.sax.ng.AfterVisitor; -import org.smooks.io.payload.JavaResult; +import org.smooks.io.sink.JavaSink; +import org.smooks.io.source.StreamSource; import org.w3c.dom.Element; import org.xml.sax.SAXException; -import javax.xml.transform.stream.StreamSource; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -71,27 +71,27 @@ public class FragmentSerializerTest { @Test public void test_children_only() throws IOException, SAXException { Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-01.xml")); - StreamSource source = new StreamSource(getClass().getResourceAsStream("input-message-01.xml")); - JavaResult result = new JavaResult(); + StreamSource source = new StreamSource<>(getClass().getResourceAsStream("input-message-01.xml")); + JavaSink sink = new JavaSink(); - smooks.filterSource(source, result); + smooks.filterSource(source, sink); XMLUnit.setIgnoreWhitespace( true ); InputStream stream = getClass().getResourceAsStream("children-only.xml"); - Object bean = result.getBean("soapBody"); + Object bean = sink.getBean("soapBody"); XMLAssert.assertXMLEqual(new InputStreamReader(stream), new StringReader(bean.toString().trim())); } @Test public void test_all() throws IOException, SAXException { Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-02.xml")); - StreamSource source = new StreamSource(getClass().getResourceAsStream("input-message-01.xml")); - JavaResult result = new JavaResult(); + StreamSource source = new StreamSource(getClass().getResourceAsStream("input-message-01.xml")); + JavaSink sink = new JavaSink(); - smooks.filterSource(source, result); + smooks.filterSource(source, sink); XMLUnit.setIgnoreWhitespace( true ); - XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("all.xml")), new StringReader(result.getBean("soapBody").toString().trim())); + XMLAssert.assertXMLEqual(new InputStreamReader(getClass().getResourceAsStream("all.xml")), new StringReader(sink.getBean("soapBody").toString().trim())); } @Test diff --git a/src/test/java/org/smooks/cartridges/routing/file/FileOutputStreamResourceTest.java b/src/test/java/org/smooks/cartridges/routing/file/FileOutputStreamResourceTest.java index 8f823c9..72b0f95 100644 --- a/src/test/java/org/smooks/cartridges/routing/file/FileOutputStreamResourceTest.java +++ b/src/test/java/org/smooks/cartridges/routing/file/FileOutputStreamResourceTest.java @@ -59,7 +59,7 @@ import org.smooks.engine.resource.config.DefaultResourceConfig; import org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor; import org.smooks.io.ResourceOutputStream; -import org.smooks.io.payload.StringSource; +import org.smooks.io.source.StringSource; import org.smooks.support.FileUtils; import org.smooks.testkit.MockApplicationContext; import org.smooks.testkit.MockExecutionContext; diff --git a/src/test/java/org/smooks/cartridges/routing/file/FlightSplitTest.java b/src/test/java/org/smooks/cartridges/routing/file/FlightSplitTest.java index b91af84..ed9645f 100644 --- a/src/test/java/org/smooks/cartridges/routing/file/FlightSplitTest.java +++ b/src/test/java/org/smooks/cartridges/routing/file/FlightSplitTest.java @@ -46,10 +46,9 @@ import org.junit.Before; import org.junit.Test; import org.smooks.Smooks; -import org.smooks.support.StreamUtils; +import org.smooks.io.source.StreamSource; import org.xml.sax.SAXException; -import javax.xml.transform.stream.StreamSource; import java.io.File; import java.io.FileReader; import java.io.IOException; diff --git a/src/test/java/org/smooks/cartridges/routing/jms/activemq/ActiveMQTest.java b/src/test/java/org/smooks/cartridges/routing/jms/activemq/ActiveMQTest.java index 13a9d01..69d9d52 100644 --- a/src/test/java/org/smooks/cartridges/routing/jms/activemq/ActiveMQTest.java +++ b/src/test/java/org/smooks/cartridges/routing/jms/activemq/ActiveMQTest.java @@ -53,7 +53,7 @@ import org.smooks.cartridges.templating.freemarker.FreeMarkerTemplateProcessor; import org.smooks.engine.DefaultApplicationContextBuilder; import org.smooks.engine.resource.visitor.smooks.NestedSmooksVisitor; -import org.smooks.io.payload.StringSource; +import org.smooks.io.source.StringSource; import org.xml.sax.SAXException; import javax.jms.JMSException;