jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject svn commit: r1444227 - in /jena/trunk/jena-arq/src: main/java/org/apache/jena/riot/RDFParserRegistry.java test/java/org/apache/jena/riot/TS_ReaderRIOT.java test/java/org/apache/jena/riot/TestParserRegistry.java
Date Fri, 08 Feb 2013 20:43:13 GMT
Author: rvesse
Date: Fri Feb  8 20:43:13 2013
New Revision: 1444227

URL: http://svn.apache.org/r1444227
Log:
Add static block to RDFParserRegistry to ensure it is properly initialized if you access it
without having previously called RIOT.init()

Added:
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TestParserRegistry.java
Modified:
    jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
    jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TS_ReaderRIOT.java

Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java?rev=1444227&r1=1444226&r2=1444227&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/riot/RDFParserRegistry.java Fri Feb
 8 20:43:13 2013
@@ -62,8 +62,9 @@ public class RDFParserRegistry
 
     /** Generic parser factory. */
     private static ReaderRIOTFactory parserFactory = new ReaderRIOTFactoryImpl() ;
-
+    
     private static boolean initialized = false ;
+    static { init() ; }
     public static synchronized void init ()
     {
         if ( initialized ) return ;

Modified: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TS_ReaderRIOT.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TS_ReaderRIOT.java?rev=1444227&r1=1444226&r2=1444227&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TS_ReaderRIOT.java (original)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TS_ReaderRIOT.java Fri Feb  8 20:43:13
2013
@@ -32,6 +32,7 @@ import org.junit.runners.Suite.SuiteClas
     , TestJenaReaderRIOT.class
     , TestReadData.class
     , TestRiotReader.class
+    , TestParserRegistry.class
 })
 
 public class TS_ReaderRIOT

Added: jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TestParserRegistry.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TestParserRegistry.java?rev=1444227&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TestParserRegistry.java (added)
+++ jena/trunk/jena-arq/src/test/java/org/apache/jena/riot/TestParserRegistry.java Fri Feb
 8 20:43:13 2013
@@ -0,0 +1,46 @@
+/**
+ * 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;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+
+/**
+ * Tests for the {@link RDFParserRegistry}
+ *
+ */
+public class TestParserRegistry {
+
+    @Test
+    public void parser_registry_is_triples() {
+        Assert.assertTrue(RDFParserRegistry.isTriples(RDFLanguages.N3));
+        Assert.assertTrue(RDFParserRegistry.isTriples(RDFLanguages.NTRIPLES));
+        Assert.assertTrue(RDFParserRegistry.isTriples(RDFLanguages.TURTLE));
+        Assert.assertTrue(RDFParserRegistry.isTriples(RDFLanguages.RDFXML));
+        Assert.assertTrue(RDFParserRegistry.isTriples(RDFLanguages.RDFJSON));
+    }
+    
+    @Test
+    public void parser_registry_is_quads() {
+        Assert.assertTrue(RDFParserRegistry.isQuads(RDFLanguages.NQUADS));
+        Assert.assertTrue(RDFParserRegistry.isQuads(RDFLanguages.TRIG));
+    }
+
+}



Mime
View raw message