camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acosent...@apache.org
Subject [camel] 08/20: Fix marshal test
Date Wed, 21 Aug 2019 07:58:03 GMT
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 7f954bd44c4353327e3d86398368785773b6bad9
Author: Roberto Flores <betoflowv93@gmail.com>
AuthorDate: Tue Jul 2 00:18:32 2019 -0500

    Fix marshal test
---
 .../org/apache/camel/dataformat/any23/Any23DataFormat.java |  1 +
 .../camel/dataformat/any23/Any23DataFormatBasicTest.java   | 14 +++++++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
b/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
index 843a3e4..0d2122c 100644
--- a/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
+++ b/components/camel-any23/src/main/java/org/apache/camel/dataformat/any23/Any23DataFormat.java
@@ -96,6 +96,7 @@ public class Any23DataFormat extends ServiceSupport implements DataFormat,
DataF
         handler = new NTriplesWriter(outputStream);
     }
     any23.extract(source, handler);
+    handler.close();
   }
 
   /**
diff --git a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatBasicTest.java
b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatBasicTest.java
index a2e6353..9f7a465 100644
--- a/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatBasicTest.java
+++ b/components/camel-any23/src/test/java/org/apache/camel/dataformat/any23/Any23DataFormatBasicTest.java
@@ -17,18 +17,23 @@
 package org.apache.camel.dataformat.any23;
 
 import java.io.File;
+import java.io.InputStream;
 import java.util.List;
 import org.apache.camel.Exchange;
 import org.apache.camel.Message;
 import org.apache.camel.builder.RouteBuilder;
 import org.apache.camel.component.mock.MockEndpoint;
 import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.commons.io.IOUtils;
+import org.eclipse.rdf4j.model.Model;
+import org.eclipse.rdf4j.rio.RDFFormat;
+import org.eclipse.rdf4j.rio.Rio;
 import org.junit.Test;
 
 public class Any23DataFormatBasicTest extends CamelTestSupport {
 
   @Test
-  public void testUnMarshalToStringOfXml() throws Exception {
+  public void testMarshalToRDFXMLFromHTML() throws Exception {
     MockEndpoint resultEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
     String contenhtml = Any23TestSupport.loadFileAsString(new File("src/test/resources/org/apache/camel/dataformat/any23/microformat/vcard.html"));
     template.sendBody("direct:start", contenhtml);
@@ -36,10 +41,9 @@ public class Any23DataFormatBasicTest extends CamelTestSupport {
     for (Exchange exchange : list) {
       Message in = exchange.getIn();
       String resultingRDF = in.getBody(String.class);
-      System.out.println(resultingRDF);
-      //InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
-      //Model parse = Rio.parse(toInputStream, "http://mock.foo/bar", RDFFormat.RDFXML);
-      //assertEquals(parse.size(), 10);
+      InputStream toInputStream = IOUtils.toInputStream(resultingRDF);
+      Model parse = Rio.parse(toInputStream, "http://mock.foo/bar", RDFFormat.RDFXML);
+      assertEquals(parse.size(), 28);
     }
   }
 


Mime
View raw message