You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2016/04/22 20:29:21 UTC
jena git commit: JENA-1168: Test case
Repository: jena
Updated Branches:
refs/heads/master 0b506715c -> 5f625be1c
JENA-1168: Test case
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/5f625be1
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/5f625be1
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/5f625be1
Branch: refs/heads/master
Commit: 5f625be1c125b07bb8e80fc8fd500805d11ceb95
Parents: 0b50671
Author: Andy Seaborne <an...@apache.org>
Authored: Fri Apr 22 19:29:13 2016 +0100
Committer: Andy Seaborne <an...@apache.org>
Committed: Fri Apr 22 19:29:13 2016 +0100
----------------------------------------------------------------------
.../apache/jena/riot/writer/TS_RiotWriter.java | 1 +
.../jena/riot/writer/TestWriteRDFXML.java | 59 ++++++++++++++++++++
2 files changed, 60 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/5f625be1/jena-arq/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java b/jena-arq/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
index b5db4f0..f8a81f7 100644
--- a/jena-arq/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
+++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TS_RiotWriter.java
@@ -32,6 +32,7 @@ import org.junit.runners.Suite.SuiteClasses ;
, TestRDFJSON.class
, TestTurtleWriter.class
, TestTriXWriter.class
+ , TestWriteRDFXML.class
})
public class TS_RiotWriter
http://git-wip-us.apache.org/repos/asf/jena/blob/5f625be1/jena-arq/src/test/java/org/apache/jena/riot/writer/TestWriteRDFXML.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/riot/writer/TestWriteRDFXML.java b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestWriteRDFXML.java
new file mode 100644
index 0000000..9c26b8b
--- /dev/null
+++ b/jena-arq/src/test/java/org/apache/jena/riot/writer/TestWriteRDFXML.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.jena.riot.writer;
+
+import java.io.StringReader ;
+import java.io.StringWriter ;
+
+import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.rdf.model.ModelFactory ;
+import org.apache.jena.rdf.model.RDFWriter ;
+import org.apache.jena.riot.Lang ;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.junit.Assert ;
+import org.junit.Test ;
+
+/** Tests of the RDF/XML writers used via RIOT */
+public class TestWriteRDFXML {
+
+ static Model model = ModelFactory.createDefaultModel() ;
+ static {
+ RDFDataMgr.read(model, new StringReader("<http://example/s> <http://example/p> <http://example/o> ."), null, Lang.NT) ;
+ }
+
+ @Test public void propertiesAbbrev() {
+ String name = "RDF/XML-ABBREV" ;
+ // Write without setting properties
+ StringWriter w = new StringWriter() ;
+ model.getWriter(name).write(model, w, null);
+ String x0 = w.toString() ;
+
+ // Write with setting properties
+ RDFWriter rdfWriter = model.getWriter(name);
+ rdfWriter.setProperty("showXmlDeclaration", "true");
+ rdfWriter.setProperty("showDoctypeDeclaration", "true");
+ StringWriter w2 = new StringWriter() ;
+ rdfWriter.write(model, w2, null);
+ String x2 = w2.toString() ;
+
+ // Did it have an effect?
+ Assert.assertNotEquals(x0, x2) ;
+ }
+
+}