diff --git a/pom.xml b/pom.xml
index 1d518924..a76bbcfa 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,6 +37,20 @@
+
+
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+ 2.12
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+ 2.12
+
+
+
org.apache.maven.plugins
diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml
index 1f411082..0387d1f4 100644
--- a/wise-webapp/pom.xml
+++ b/wise-webapp/pom.xml
@@ -418,7 +418,6 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.12
true
@@ -427,8 +426,7 @@
-
-
+
org.mortbay.jetty
jetty-maven-plugin
8.1.0.v20120127
@@ -458,7 +456,7 @@
mindmap.xjb
- com.wisemapping.jaxb.mindmap
+ com.wisemapping.jaxb.wisemap
${project.build.directory}/generated-sources/xjc1
@@ -482,6 +480,10 @@
+
+ org.apache.maven.plugins
+ maven-failsafe-plugin
+
diff --git a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java
index 1a303bd5..dae68cce 100755
--- a/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java
+++ b/wise-webapp/src/main/java/com/wisemapping/exporter/FreemindExporter.java
@@ -24,9 +24,9 @@ import com.wisemapping.model.MindMap;
import com.wisemapping.model.ShapeStyle;
import com.wisemapping.util.JAXBUtils;
import com.wisemapping.jaxb.freemind.*;
-import com.wisemapping.jaxb.mindmap.RelationshipType;
-import com.wisemapping.jaxb.mindmap.TopicType;
-import com.wisemapping.jaxb.mindmap.Icon;
+import com.wisemapping.jaxb.wisemap.RelationshipType;
+import com.wisemapping.jaxb.wisemap.TopicType;
+import com.wisemapping.jaxb.wisemap.Icon;
import org.jetbrains.annotations.NotNull;
import javax.xml.bind.JAXBException;
@@ -52,15 +52,15 @@ public class FreemindExporter
export(map.getXml(), outputStream);
}
- public void export(byte[] xml, OutputStream outputStream) throws ExportException {
+ public void export(byte[] xml, @NotNull OutputStream outputStream) throws ExportException {
objectFactory = new com.wisemapping.jaxb.freemind.ObjectFactory();
nodesMap = new HashMap();
- final com.wisemapping.jaxb.mindmap.Map mindmapMap;
+ final com.wisemapping.jaxb.wisemap.Map mindmapMap;
try {
final ByteArrayInputStream stream = new ByteArrayInputStream(xml);
- mindmapMap = (com.wisemapping.jaxb.mindmap.Map) JAXBUtils.getMapObject(stream, "com.wisemapping.jaxb.mindmap");
+ mindmapMap = (com.wisemapping.jaxb.wisemap.Map) JAXBUtils.getMapObject(stream, "com.wisemapping.jaxb.wisemap");
final com.wisemapping.jaxb.freemind.Map freemindMap = objectFactory.createMap();
freemindMap.setVersion(FREE_MIND_VERSION);
@@ -104,7 +104,7 @@ public class FreemindExporter
cloudOrEdge.add(arrowlink);
}
- JAXBUtils.saveMap(freemindMap, outputStream, "com.wisemapping.jaxb.freemind");
+ JAXBUtils.saveMap(freemindMap, outputStream);
} catch (JAXBException e) {
throw new ExportException(e);
}
@@ -128,7 +128,7 @@ public class FreemindExporter
}
}
- private void setTopicPropertiesToNode(@NotNull com.wisemapping.jaxb.freemind.Node freemindNode, @NotNull com.wisemapping.jaxb.mindmap.TopicType mindmapTopic, boolean isRoot) {
+ private void setTopicPropertiesToNode(@NotNull com.wisemapping.jaxb.freemind.Node freemindNode, @NotNull com.wisemapping.jaxb.wisemap.TopicType mindmapTopic, boolean isRoot) {
freemindNode.setID("ID_" + mindmapTopic.getId());
String text = mindmapTopic.getTextAttr();
@@ -160,7 +160,7 @@ public class FreemindExporter
}
}
- private void addNote(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.mindmap.TopicType mindmapTopic) {
+ private void addNote(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.wisemap.TopicType mindmapTopic) {
if (mindmapTopic.getNote() != null) {
final Hook note = new Hook();
String textNote = mindmapTopic.getNote().getTextAttr();
@@ -174,14 +174,14 @@ public class FreemindExporter
}
}
- private void addLinkNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.mindmap.TopicType mindmapTopic) {
+ private void addLinkNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.wisemap.TopicType mindmapTopic) {
if (mindmapTopic.getLink() != null) {
final String url = mindmapTopic.getLink().getUrl();
freemindNode.setLINK(url);
}
}
- private void addIconNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.mindmap.TopicType mindmapTopic) {
+ private void addIconNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.wisemap.TopicType mindmapTopic) {
if (mindmapTopic.getIcon() != null) {
final List iconsList = mindmapTopic.getIcon();
for (Icon icon : iconsList) {
@@ -197,7 +197,7 @@ public class FreemindExporter
}
}
- private void addEdgeNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.mindmap.TopicType mindmapTopic) {
+ private void addEdgeNode(com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.wisemap.TopicType mindmapTopic) {
if (mindmapTopic.getBrColor() != null) {
final Edge edgeNode = objectFactory.createEdge();
edgeNode.setCOLOR(mindmapTopic.getBrColor());
@@ -210,7 +210,7 @@ public class FreemindExporter
* eg: Verdana;10;#ffffff;bold;italic;
*
*/
- private void addFontNode(@NotNull com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.mindmap.TopicType mindmapTopic) {
+ private void addFontNode(@NotNull com.wisemapping.jaxb.freemind.Node freemindNode, com.wisemapping.jaxb.wisemap.TopicType mindmapTopic) {
final String fontStyle = mindmapTopic.getFontStyle();
if (fontStyle != null && fontStyle.length() != 0) {
final Font font = objectFactory.createFont();
diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/JaxbCDATAMarshaller.java b/wise-webapp/src/main/java/com/wisemapping/importer/JaxbCDATAMarshaller.java
index 122041ba..8482b690 100644
--- a/wise-webapp/src/main/java/com/wisemapping/importer/JaxbCDATAMarshaller.java
+++ b/wise-webapp/src/main/java/com/wisemapping/importer/JaxbCDATAMarshaller.java
@@ -25,6 +25,7 @@ public class JaxbCDATAMarshaller {
// set any other options you'd like
// of.setPreserveSpace(true);
of.setIndenting(true);
+ of.setEncoding("UTF-8");
// create the serializer
XMLSerializer result = new XMLSerializer(of);
diff --git a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java
index f256497f..43fafb87 100755
--- a/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java
+++ b/wise-webapp/src/main/java/com/wisemapping/importer/freemind/FreemindImporter.java
@@ -28,9 +28,9 @@ import com.wisemapping.util.JAXBUtils;
import com.wisemapping.jaxb.freemind.*;
import com.wisemapping.jaxb.freemind.Map;
import com.wisemapping.jaxb.freemind.Node;
-import com.wisemapping.jaxb.mindmap.RelationshipType;
-import com.wisemapping.jaxb.mindmap.TopicType;
-import com.wisemapping.jaxb.mindmap.Link;
+import com.wisemapping.jaxb.wisemap.RelationshipType;
+import com.wisemapping.jaxb.wisemap.TopicType;
+import com.wisemapping.jaxb.wisemap.Link;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.w3c.dom.*;
@@ -51,7 +51,7 @@ public class FreemindImporter
public static final int ROOT_LEVEL_TOPIC_HEIGHT = SECOND_LEVEL_TOPIC_HEIGHT;
public static final int CENTRAL_TO_TOPIC_DISTANCE = 200;
public static final int TOPIC_TO_TOPIC_DISTANCE = 90;
- private com.wisemapping.jaxb.mindmap.ObjectFactory mindmapObjectFactory;
+ private com.wisemapping.jaxb.wisemap.ObjectFactory mindmapObjectFactory;
private static final String POSITION_LEFT = "left";
private static final String BOLD = "bold";
private static final String ITALIC = "italic";
@@ -99,7 +99,7 @@ public class FreemindImporter
final MindMap result = new MindMap();
nodesMap = new HashMap();
relationships = new ArrayList();
- mindmapObjectFactory = new com.wisemapping.jaxb.mindmap.ObjectFactory();
+ mindmapObjectFactory = new com.wisemapping.jaxb.wisemap.ObjectFactory();
try {
String wiseXml;
@@ -116,7 +116,7 @@ public class FreemindImporter
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
- final com.wisemapping.jaxb.mindmap.Map mindmapMap = mindmapObjectFactory.createMap();
+ final com.wisemapping.jaxb.wisemap.Map mindmapMap = mindmapObjectFactory.createMap();
mindmapMap.setVersion(CODE_VERSION);
currentId = 0;
@@ -137,7 +137,7 @@ public class FreemindImporter
convertChildNodes(freeNode, wiseTopic, 1);
addRelationships(mindmapMap);
- JAXBUtils.saveMap(mindmapMap, baos, "com.wisemapping.jaxb.mindmap");
+ JAXBUtils.saveMap(mindmapMap, baos);
wiseXml = new String(baos.toByteArray(), UTF_8_CHARSET);
@@ -155,7 +155,7 @@ public class FreemindImporter
return result;
}
- private void addRelationships(@NotNull com.wisemapping.jaxb.mindmap.Map mindmapMap) {
+ private void addRelationships(@NotNull com.wisemapping.jaxb.wisemap.Map mindmapMap) {
List mapRelationships = mindmapMap.getRelationship();
for (RelationshipType relationship : relationships) {
relationship.setId(String.valueOf(currentId++));
@@ -270,14 +270,14 @@ public class FreemindImporter
String iconId = freemindIcon.getBUILTIN();
final String wiseIconId = FreemindIconConverter.toWiseId(iconId);
if (wiseIconId != null) {
- final com.wisemapping.jaxb.mindmap.Icon mindmapIcon = new com.wisemapping.jaxb.mindmap.Icon();
+ final com.wisemapping.jaxb.wisemap.Icon mindmapIcon = new com.wisemapping.jaxb.wisemap.Icon();
mindmapIcon.setId(wiseIconId);
currentWiseTopic.getIcon().add(mindmapIcon);
}
} else if (element instanceof Hook) {
final Hook hook = (Hook) element;
- final com.wisemapping.jaxb.mindmap.Note mindmapNote = new com.wisemapping.jaxb.mindmap.Note();
+ final com.wisemapping.jaxb.wisemap.Note mindmapNote = new com.wisemapping.jaxb.wisemap.Note();
String textNote = hook.getText();
if (textNote == null) // It is not a note is a BlinkingNodeHook or AutomaticLayout Hook
{
@@ -294,7 +294,7 @@ public class FreemindImporter
currentWiseTopic.setText(text);
} else {
String text = getRichContent(content);
- final com.wisemapping.jaxb.mindmap.Note mindmapNote = new com.wisemapping.jaxb.mindmap.Note();
+ final com.wisemapping.jaxb.wisemap.Note mindmapNote = new com.wisemapping.jaxb.wisemap.Note();
text = text != null ? text : EMPTY_NOTE;
mindmapNote.setText(text);
currentWiseTopic.setNote(mindmapNote);
@@ -536,7 +536,7 @@ public class FreemindImporter
return text.toString();
}
- private void convertNodeProperties(@NotNull com.wisemapping.jaxb.freemind.Node freeNode, @NotNull com.wisemapping.jaxb.mindmap.TopicType wiseTopic) {
+ private void convertNodeProperties(@NotNull com.wisemapping.jaxb.freemind.Node freeNode, @NotNull com.wisemapping.jaxb.wisemap.TopicType wiseTopic) {
final String text = freeNode.getTEXT();
wiseTopic.setText(text);
diff --git a/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java b/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java
index 175cea7f..8f82dbc7 100755
--- a/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java
+++ b/wise-webapp/src/main/java/com/wisemapping/util/JAXBUtils.java
@@ -57,9 +57,9 @@ public class JAXBUtils {
}
- public static void saveMap(@NotNull Object obj, @NotNull OutputStream out, String packag) throws JAXBException {
+ public static void saveMap(@NotNull com.wisemapping.jaxb.wisemap.Map obj, @NotNull OutputStream out) throws JAXBException {
- final JAXBContext context = getInstance(packag);
+ final JAXBContext context = getInstance("com.wisemapping.jaxb.wisemap");
final Marshaller marshaller = context.createMarshaller();
// get an Apache XMLSerializer configured to generate CDATA
@@ -72,4 +72,11 @@ public class JAXBUtils {
throw new IllegalStateException(e);
}
}
+
+ public static void saveMap(@NotNull com.wisemapping.jaxb.freemind.Map map, @NotNull OutputStream out) throws JAXBException {
+
+ final JAXBContext context = getInstance("com.wisemapping.jaxb.freemind");
+ final Marshaller marshaller = context.createMarshaller();
+ marshaller.marshal(map, out);
+ }
}
diff --git a/wise-webapp/src/main/resources/mindmap.xjb b/wise-webapp/src/main/resources/mindmap.xjb
index b864d5d7..deae82bd 100644
--- a/wise-webapp/src/main/resources/mindmap.xjb
+++ b/wise-webapp/src/main/resources/mindmap.xjb
@@ -2,7 +2,7 @@
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-
+
diff --git a/wise-webapp/src/test/data/freemind/basic.mmr b/wise-webapp/src/test/data/freemind/basic.mmr
index ccc84af8..c145329e 100644
--- a/wise-webapp/src/test/data/freemind/basic.mmr
+++ b/wise-webapp/src/test/data/freemind/basic.mmr
@@ -1,15 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/fonts.mmr b/wise-webapp/src/test/data/freemind/fonts.mmr
index 4050a195..2bed53a3 100644
--- a/wise-webapp/src/test/data/freemind/fonts.mmr
+++ b/wise-webapp/src/test/data/freemind/fonts.mmr
@@ -1,40 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/i18n.mmr b/wise-webapp/src/test/data/freemind/i18n.mmr
index 797635d7..fd9bfc71 100644
--- a/wise-webapp/src/test/data/freemind/i18n.mmr
+++ b/wise-webapp/src/test/data/freemind/i18n.mmr
@@ -1,8 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/icons.mmr b/wise-webapp/src/test/data/freemind/icons.mmr
index 063ba53e..1d464f26 100644
--- a/wise-webapp/src/test/data/freemind/icons.mmr
+++ b/wise-webapp/src/test/data/freemind/icons.mmr
@@ -1,198 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/links.mmr b/wise-webapp/src/test/data/freemind/links.mmr
index 16df9afc..050ce1d3 100644
--- a/wise-webapp/src/test/data/freemind/links.mmr
+++ b/wise-webapp/src/test/data/freemind/links.mmr
@@ -1,14 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/longnodes.mmr b/wise-webapp/src/test/data/freemind/longnodes.mmr
index 26e92591..3d0ee368 100644
--- a/wise-webapp/src/test/data/freemind/longnodes.mmr
+++ b/wise-webapp/src/test/data/freemind/longnodes.mmr
@@ -1,6 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/node-styles.mmr b/wise-webapp/src/test/data/freemind/node-styles.mmr
index 39dd8600..41a26b82 100644
--- a/wise-webapp/src/test/data/freemind/node-styles.mmr
+++ b/wise-webapp/src/test/data/freemind/node-styles.mmr
@@ -1,50 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/freemind/process.mmr b/wise-webapp/src/test/data/freemind/process.mmr
index 4db388d1..59b13859 100644
--- a/wise-webapp/src/test/data/freemind/process.mmr
+++ b/wise-webapp/src/test/data/freemind/process.mmr
@@ -1,121 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/wisemaps/bigmap.mmr b/wise-webapp/src/test/data/wisemaps/bigmap.mmr
index 51ff9561..2585b689 100644
--- a/wise-webapp/src/test/data/wisemaps/bigmap.mmr
+++ b/wise-webapp/src/test/data/wisemaps/bigmap.mmr
@@ -1,276 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/wisemaps/simple-maps.mmr b/wise-webapp/src/test/data/wisemaps/simple-maps.mmr
index 41946830..6994311e 100644
--- a/wise-webapp/src/test/data/wisemaps/simple-maps.mmr
+++ b/wise-webapp/src/test/data/wisemaps/simple-maps.mmr
@@ -1,1214 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/data/wisemaps/welcome.mmr b/wise-webapp/src/test/data/wisemaps/welcome.mmr
index e5840e36..e116c567 100644
--- a/wise-webapp/src/test/data/wisemaps/welcome.mmr
+++ b/wise-webapp/src/test/data/wisemaps/welcome.mmr
@@ -1,37 +1 @@
-
-
+
\ No newline at end of file
diff --git a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java
index 49826b79..ae1d50e7 100644
--- a/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java
+++ b/wise-webapp/src/test/java/com/wisemapping/test/export/ExportTest.java
@@ -8,6 +8,7 @@ import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
import org.apache.batik.transcoder.TranscoderException;
+import org.apache.commons.io.FileUtils;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -27,16 +28,7 @@ public class ExportTest {
@Test(dataProvider = "Data-Provider-Function")
public void exportSvgTest(@NotNull final File svgFile, @NotNull final File pngFile) throws ImporterException, IOException, ExportException, TransformerException, XMLStreamException, JAXBException, SAXException, TranscoderException, ParserConfigurationException {
- BufferedReader reader = null;
- StringBuffer buffer = new StringBuffer();
-
- reader = new BufferedReader(new FileReader(svgFile));
- String text;
- while ((text = reader.readLine()) != null) {
- buffer.append(text).append(System.getProperty("line.separator"));
- }
-
- String svgXml = buffer.toString();
+ String svgXml = FileUtils.readFileToString(svgFile, "UTF-8");
final ExportFormat format = ExportFormat.PNG;
final ExportProperties properties = ExportProperties.create(format);
@@ -51,32 +43,7 @@ public class ExportTest {
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
ExporterFactory.export(imageProperties, null, bos, svgXml);
- // Load rec file co
- final FileInputStream fis = new FileInputStream(pngFile);
- final InputStreamReader isr = new InputStreamReader(fis);
- final BufferedReader br = new BufferedReader(isr);
-
- final StringBuilder recContent = new StringBuilder();
- String line = br.readLine();
- while (line != null) {
- recContent.append(line);
- line = br.readLine();
- }
-
- fis.close();
-
- //Since line separator chenges between \r and \n, lets read line by line
- final String exportContent = new String(bos.toByteArray());
- BufferedReader expBuf = new BufferedReader(new StringReader(exportContent));
- final StringBuilder expContent = new StringBuilder();
- String expLine = expBuf.readLine();
- while (expLine != null) {
- expContent.append(expLine);
- expLine = expBuf.readLine();
-
- }
-
- Assert.assertEquals(expContent.toString().trim(), expContent.toString().trim());
+// Assert.assertEquals(expContent.toString().trim(), expContent.toString().trim());
} else {
OutputStream outputStream = new FileOutputStream(pngFile, false);
diff --git a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ExportTest.java
index 646d4f80..936f39bf 100644
--- a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ExportTest.java
+++ b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ExportTest.java
@@ -5,6 +5,7 @@ import com.wisemapping.exporter.FreemindExporter;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.model.MindMap;
+import org.apache.commons.io.FileUtils;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -15,6 +16,7 @@ import java.io.*;
@Test
public class ExportTest {
private static final String DATA_DIR_PATH = "src/test/data/wisemaps/";
+ private static final String UTF_8 = "UTF-8";
@Test(dataProvider = "Data-Provider-Function")
public void exportImportExportTest(@NotNull final File wisemap, @NotNull final File recFile) throws ImporterException, IOException, ExportException {
@@ -25,54 +27,26 @@ public class ExportTest {
final FreemindExporter freemindExporter = new FreemindExporter();
if (recFile.exists()) {
// Compare rec and file ...
-
- // Load rec file co
- final FileInputStream fis = new FileInputStream(recFile);
- final InputStreamReader isr = new InputStreamReader(fis);
- final BufferedReader br = new BufferedReader(isr);
-
- final StringBuilder recContent = new StringBuilder();
- String line = br.readLine();
- while (line != null) {
- recContent.append(line).append("\n");
- line = br.readLine();
-
- }
-
- fis.close();
+ final String recContent = FileUtils.readFileToString(recFile, "UTF-8");
// Export mile content ...
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
freemindExporter.export(mindmap, bos);
- final String exportContent = new String(bos.toByteArray(),"UTF-8");
+ final String exportContent = new String(bos.toByteArray(), UTF_8);
- Assert.assertEquals(recContent.toString(), exportContent);
+ Assert.assertEquals(recContent, exportContent);
} else {
- final FileOutputStream fos = new FileOutputStream(recFile);
+ final OutputStream fos = new FileOutputStream(recFile);
freemindExporter.export(mindmap, fos);
fos.close();
}
-
-
}
private MindMap load(@NotNull File wisemap) throws IOException {
- final FileInputStream fis = new FileInputStream(wisemap);
- final InputStreamReader isr = new InputStreamReader(fis);
- final BufferedReader br = new BufferedReader(isr);
-
- final StringBuilder content = new StringBuilder();
- String line = br.readLine();
- while (line != null) {
- content.append(line).append("\n");
- line = br.readLine();
-
- }
- fis.close();
-
+ final byte[] recContent = FileUtils.readFileToByteArray(wisemap);
final MindMap result = new MindMap();
- result.setXmlStr(content.toString());
+ result.setXml(recContent);
return result;
}
diff --git a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java
index 2f28b7db..26202ffe 100644
--- a/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java
+++ b/wise-webapp/src/test/java/com/wisemapping/test/freemind/ImportExportTest.java
@@ -7,6 +7,7 @@ import com.wisemapping.importer.Importer;
import com.wisemapping.importer.ImporterException;
import com.wisemapping.importer.ImporterFactory;
import com.wisemapping.model.MindMap;
+import org.apache.commons.io.FileUtils;
import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
@@ -38,7 +39,8 @@ public class ImportExportTest {
// Compare mindmap output ...
if (wiseFile.exists()) {
// Compare rec and file ...
- final String recContent = readFile(wiseFile);
+ // Load rec file co
+ final String recContent = FileUtils.readFileToString(wiseFile, UTF_8);
// Export mile content ...
Assert.assertEquals(mindMap.getXmlStr(), recContent);
@@ -52,7 +54,8 @@ public class ImportExportTest {
// Compare freemind output ...
if (freeRecFile.exists()) {
// Compare rec and file ...
- final String recContent = readFile(freeRecFile);
+ // Load rec file co
+ final String recContent = FileUtils.readFileToString(freeRecFile, UTF_8);
// Export content ...
final ByteArrayOutputStream bos = new ByteArrayOutputStream();
@@ -65,25 +68,6 @@ public class ImportExportTest {
exporter.export(mindMap, fos);
fos.close();
}
-
- }
-
- private String readFile(@NotNull File file) throws IOException {
- // Load rec file co
- final FileInputStream fis = new FileInputStream(file);
- final InputStreamReader isr = new InputStreamReader(fis, UTF_8);
- final BufferedReader br = new BufferedReader(isr);
-
- final StringBuilder result = new StringBuilder();
- String line = br.readLine();
- while (line != null) {
- result.append(line).append("\n");
- line = br.readLine();
-
- }
-
- fis.close();
- return result.toString();
}
//This function will provide the parameter data