You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/01/08 09:43:52 UTC
[camel] 02/03: Fixed CS for Camel Big XML example
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 43fc243bca31b81f34f8e264ea8a15c4fb4041bf
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Tue Jan 8 10:37:10 2019 +0100
Fixed CS for Camel Big XML example
---
.../camel/example/bigxml/StaxTokenizerTest.java | 8 +++---
.../org/apache/camel/example/bigxml/TestUtils.java | 29 ++++++++++++----------
.../camel/example/bigxml/XmlTokenizerTest.java | 4 +--
3 files changed, 22 insertions(+), 19 deletions(-)
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
index aab4aa6..c81768f 100644
--- a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
+++ b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/StaxTokenizerTest.java
@@ -16,18 +16,18 @@
*/
package org.apache.camel.example.bigxml;
+import java.util.concurrent.TimeUnit;
+
import org.apache.camel.CamelContext;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
-import static org.apache.camel.component.stax.StAXBuilder.stax;
-
-import java.util.concurrent.TimeUnit;
-
import org.junit.BeforeClass;
import org.junit.Test;
+import static org.apache.camel.component.stax.StAXBuilder.stax;
+
public class StaxTokenizerTest extends CamelTestSupport {
@BeforeClass
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
index 37e1d3c..3deecdc 100644
--- a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
+++ b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/TestUtils.java
@@ -25,37 +25,40 @@ import javax.xml.stream.XMLStreamWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class TestUtils {
+public final class TestUtils {
- private static final Logger log = LoggerFactory.getLogger(TestUtils.class);
- private final static String basePath = System.getProperty("user.dir") + "/target/data";
- private final static int numOfRecords = 40000;
- private final static int maxWaitTime = 5000;
+ private static final Logger LOG = LoggerFactory.getLogger(TestUtils.class);
+ private static final String BASEPATH = System.getProperty("user.dir") + "/target/data";
+ private static final int NUM_RECORDS = 40000;
+ private static final int MAX_WAIT_TIME = 5000;
+
+ private TestUtils() {
+ }
public static String getBasePath() {
- return basePath;
+ return BASEPATH;
}
public static int getNumOfRecords() {
- return numOfRecords;
+ return NUM_RECORDS;
}
public static int getMaxWaitTime() {
- return maxWaitTime;
+ return MAX_WAIT_TIME;
}
public static void buildTestXml() throws Exception {
- new File(basePath).mkdir();
- File f = new File(basePath + "/test.xml");
+ new File(BASEPATH).mkdir();
+ File f = new File(BASEPATH + "/test.xml");
if (!f.exists()) {
- log.info("Building test XML file...");
+ LOG.info("Building test XML file...");
XMLOutputFactory xof = XMLOutputFactory.newInstance();
XMLStreamWriter xsw = xof.createXMLStreamWriter(new FileOutputStream(f), "UTF-8");
try {
xsw.writeStartDocument("UTF-8", "1.0");
xsw.writeStartElement("records");
xsw.writeAttribute("xmlns", "http://fvaleri.it/records");
- for (int i = 0; i < numOfRecords; i++) {
+ for (int i = 0; i < NUM_RECORDS; i++) {
xsw.writeStartElement("record");
xsw.writeStartElement("key");
xsw.writeCharacters("" + i);
@@ -68,7 +71,7 @@ public class TestUtils {
xsw.writeEndElement();
xsw.writeEndDocument();
} finally {
- log.info("Test XML file ready (size: {} kB)", f.length() / 1024);
+ LOG.info("Test XML file ready (size: {} kB)", f.length() / 1024);
xsw.flush();
xsw.close();
}
diff --git a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
index 18e4f4f..1dec1a7 100644
--- a/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
+++ b/examples/camel-example-bigxml-split/src/test/java/org/apache/camel/example/bigxml/XmlTokenizerTest.java
@@ -16,13 +16,13 @@
*/
package org.apache.camel.example.bigxml;
+import java.util.concurrent.TimeUnit;
+
import org.apache.camel.CamelContext;
import org.apache.camel.builder.NotifyBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.test.junit4.CamelTestSupport;
-import java.util.concurrent.TimeUnit;
-
import org.junit.BeforeClass;
import org.junit.Test;