From f2b7f4c6d5f764d898061179f3a82a27b31fb4ab Mon Sep 17 00:00:00 2001 From: Willem Date: Mon, 24 Oct 2016 17:54:34 +0200 Subject: [PATCH] removed jettison --- ff-unitxc-converter/pom.xml | 6 -- .../unitxc/UnitXCConverterStepTest.java | 70 ------------------- 2 files changed, 76 deletions(-) diff --git a/ff-unitxc-converter/pom.xml b/ff-unitxc-converter/pom.xml index fb99502..e88cb40 100644 --- a/ff-unitxc-converter/pom.xml +++ b/ff-unitxc-converter/pom.xml @@ -18,11 +18,5 @@ commons-lang3 compile - - org.codehaus.jettison - jettison - 1.3.7 - test - \ No newline at end of file diff --git a/ff-unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java b/ff-unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java index 31dc5aa..3ed13e1 100644 --- a/ff-unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java +++ b/ff-unitxc-converter/src/test/java/net/forwardfire/unitxc/UnitXCConverterStepTest.java @@ -35,9 +35,6 @@ import java.util.Map; import javax.xml.stream.XMLStreamWriter; import org.apache.commons.lang3.StringUtils; -import org.codehaus.jettison.mapped.Configuration; -import org.codehaus.jettison.mapped.MappedNamespaceConvention; -import org.codehaus.jettison.mapped.MappedXMLStreamWriter; import org.junit.Test; import static org.junit.Assert.assertFalse; @@ -105,72 +102,5 @@ public class UnitXCConverterStepTest { para.put("speed_time", new UnitXConverterParameterValue(2, unitManager.getUnitType("minute"))); result = unitManager.getConverter().convertStepped(50, "km/h", "mm",para); System.out.println("CONVERT-RESULT: "+result); - - - Configuration config = new Configuration(); - - MappedNamespaceConvention con = new MappedNamespaceConvention(config); - Writer writer = new OutputStreamWriter(System.out); - - XMLStreamWriter xmlStreamWriter = new MappedXMLStreamWriter(con, new IndentedJSONWriter(writer)); - - //jaxbDriver.getUnitXConverterResult().marshal(result, xmlStreamWriter); - } - - class IndentedJSONWriter extends Writer { - - private final Writer writer; - private int depth = 0; - private boolean firstLine = true; - - public IndentedJSONWriter(Writer writer) { - this.writer = writer; - } - - private void writeLineWrap() throws IOException { - writer.write(StringUtils.LF); - writer.write(StringUtils.repeat(StringUtils.SPACE, depth)); - } - - @Override - public void write(int c) throws IOException { - if (c == '{') { - if (!firstLine) { - writer.write(StringUtils.SPACE); - } - writer.write(c); - depth++; - writeLineWrap(); - } else if (c == '}') { - writer.write(c); - depth--; - writeLineWrap(); - } else if (c == ',') { - writer.write(c); - writeLineWrap(); - } else if (c == '[') { - writer.write(StringUtils.SPACE); - writer.write(c); - writeLineWrap(); - } else { - writer.write(c); - } - firstLine = false; - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - writer.write(cbuf, off, len); - } - - @Override - public void flush() throws IOException { - writer.flush(); - } - - @Override - public void close() throws IOException { - writer.close(); - } } }