import java.io.InputStream;
import java.util.List;

import org.nuxeo.common.utils.FileUtils;
import org.nuxeo.runtime.test.NXRuntimeTestCase;
import org.nuxeo.webengine.sites.listeners.SitesWikiListener;
import org.nuxeo.webengine.sites.listeners.SitesWikiListener.WikiProcessingResult;


public class TestWikiProcessing extends NXRuntimeTestCase {

    public void testProcessing() throws Exception {

        InputStream is = TestWikiProcessing.class.getResourceAsStream("test-data/page1.wiki");

        String wikiInput = FileUtils.read(is);

        SitesWikiListener listener = new SitesWikiListener();

        WikiProcessingResult  result = listener.processWikiContent(wikiInput, "/nuxeo/site/sites", "/nuxeo/site/sites/mypage");

        List<String> relations = result.getRelationLinks();

        String content = result.getWikiContent().trim();

        System.out.println(content);

        System.out.println(relations);

        WikiProcessingResult  result2 = listener.processWikiContent(content, "/nuxeo/site/sites", "/nuxeo/site/sites/mypage");

        String content2 = result2.getWikiContent().trim();

        System.out.println(content2);

        assertEquals(content, content2);

    }

}

@@ -45,16 +45,101 @@
 .List;%0A%0A
+import org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0A
 import o
@@ -366,17 +366,16 @@
 esult;%0A%0A
-%0A
 public c
@@ -423,24 +423,94 @@
 TestCase %7B%0A%0A
+    protected Log log = LogFactory.getLog(TestWikiProcessing.class);%0A%0A
     public v
@@ -782,25 +782,24 @@
 ssingResult 
- 
 result = lis
@@ -833,16 +833,32 @@
 kiInput,
+%0A               
  %22/nuxeo
@@ -1028,34 +1028,25 @@
         
-System.out.println
+log.debug
 (content
@@ -1057,34 +1057,25 @@
         
-System.out.println
+log.debug
 (relatio
@@ -1109,17 +1109,16 @@
 gResult 
- 
 result2 
@@ -1155,16 +1155,32 @@
 content,
+%0A               
  %22/nuxeo
@@ -1295,26 +1295,17 @@
     
-System.out.println
+log.debug
 (con

replace syso by log.debug