commonsrdf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject [5/6] incubator-commonsrdf git commit: Test B.ttl from src/test/resources
Date Mon, 04 Jul 2016 15:56:22 GMT
Test B.ttl from src/test/resources


Project: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/commit/a5277214
Tree: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/tree/a5277214
Diff: http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/diff/a5277214

Branch: refs/heads/jena
Commit: a52772146eb66ad59e8505971b8266918a0bea85
Parents: 8ea8bb0
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Jul 4 16:55:37 2016 +0100
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Jul 4 16:55:37 2016 +0100

----------------------------------------------------------------------
 .../commons/rdf/jena/TestBlankNodeJena.java     |  2 ++
 .../apache/commons/rdf/jena/TestGraphJena.java  |  1 -
 .../jena/TestJenaGraphToCommonsRDFGraph.java    | 27 +++++++++++++++---
 .../commons/rdf/jena/TestRDFParserBuilder.java  | 30 ++++++++++++++++----
 .../rdf/jena/TestRDFTermFactoryJena.java        |  3 +-
 5 files changed, 51 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a5277214/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
index cd5d264..764ee70 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestBlankNodeJena.java
@@ -23,6 +23,8 @@ import org.apache.commons.rdf.api.BlankNode ;
 import org.apache.commons.rdf.jena.impl.JenaFactory;
 
 public class TestBlankNodeJena extends AbstractBlankNodeTest {
+
+	
     @Override
     protected BlankNode getBlankNode() {
         return JenaFactory.createBlankNode() ;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a5277214/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
index 3535952..973b7b1 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestGraphJena.java
@@ -20,7 +20,6 @@ package org.apache.commons.rdf.jena;
 
 import org.apache.commons.rdf.api.AbstractGraphTest ;
 import org.apache.commons.rdf.api.RDFTermFactory ;
-import org.apache.commons.rdf.jena.RDFTermFactoryJena;
 
 public class TestGraphJena extends AbstractGraphTest {
 

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a5277214/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
b/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
index fcc2f51..cfe5642 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestJenaGraphToCommonsRDFGraph.java
@@ -18,23 +18,42 @@
 
 package org.apache.commons.rdf.jena;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
+
 import org.apache.commons.rdf.api.Graph ;
 import org.apache.commons.rdf.api.RDFTermFactory ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.sparql.graph.GraphFactory ;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 /** Adapt a Jena Graph after parsing data into it */
 public class TestJenaGraphToCommonsRDFGraph {
-    static { 
-    	//LogCtl.setCmdLogging(); 
+    private Path turtleFile;
+
+    
+    @Before
+    public void preparePath() throws IOException {    	
+    	turtleFile = Files.createTempFile("commonsrdf", "test.ttl");    	
+    	Files.copy(getClass().getResourceAsStream("/D.ttl"), turtleFile, StandardCopyOption.REPLACE_EXISTING);
+    }
+    
+    @After
+    public void deletePath() throws IOException {
+    	if (turtleFile != null) { 
+    		Files.deleteIfExists(turtleFile);
+    	}
     }
     
     @Test
 	public void jenaToCommonsRDF() throws Exception {
-        org.apache.jena.graph.Graph jGraph = GraphFactory.createGraphMem() ;
-        RDFDataMgr.read(jGraph, "D.ttl") ;
+        org.apache.jena.graph.Graph jGraph = GraphFactory.createGraphMem() ;        
+        RDFDataMgr.read(jGraph, turtleFile.toUri().toString()) ;
         
         // "graph" is a CommonsRDF graph 
         Graph graph = JenaCommonsRDF.fromJena(jGraph) ;

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a5277214/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
index f8e9616..f230bdd 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFParserBuilder.java
@@ -18,24 +18,44 @@
 
 package org.apache.commons.rdf.jena;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
+import java.io.IOException;
+import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
 import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.commons.rdf.api.Graph;
 import org.apache.commons.rdf.api.RDFParserBuilder.ParseResult;
 import org.apache.commons.rdf.api.RDFSyntax;
+import org.junit.After;
+import org.junit.Before;
 import org.junit.Test;
 
 public class TestRDFParserBuilder {
+	
+	private Path turtleFile;
+
+	@Before
+	public void preparePath() throws IOException {
+		turtleFile = Files.createTempFile("commonsrdf", "test.ttl");
+		Files.copy(getClass().getResourceAsStream("/D.ttl"), turtleFile, StandardCopyOption.REPLACE_EXISTING);
+	}
+
+	@After
+	public void deletePath() throws IOException {
+		if (turtleFile != null) {
+			Files.deleteIfExists(turtleFile);
+		}
+	}
+
 	@Test
 	public void parseTurtle() throws Exception {
-		Path d = Paths.get("D.ttl");
-		Graph g = new RDFTermFactoryJena().createGraph();		
-		Future<ParseResult> gFuture = new JenaRDFParserBuilder().contentType(RDFSyntax.TURTLE).source(d).target(g).parse();
+		Graph g = new RDFTermFactoryJena().createGraph();
+		Future<ParseResult> gFuture = new JenaRDFParserBuilder().contentType(RDFSyntax.TURTLE).source(turtleFile)
+				.target(g).parse();
 		gFuture.get(5, TimeUnit.SECONDS);
 		assertEquals(3, g.size());
 	}

http://git-wip-us.apache.org/repos/asf/incubator-commonsrdf/blob/a5277214/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
----------------------------------------------------------------------
diff --git a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
index 464908f..6aa153f 100644
--- a/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
+++ b/jena/src/test/java/org/apache/commons/rdf/jena/TestRDFTermFactoryJena.java
@@ -20,10 +20,9 @@ package org.apache.commons.rdf.jena;
 
 import org.apache.commons.rdf.api.AbstractRDFTermFactoryTest ;
 import org.apache.commons.rdf.api.RDFTermFactory ;
-import org.apache.commons.rdf.jena.RDFTermFactoryJena;
 
 public class TestRDFTermFactoryJena extends AbstractRDFTermFactoryTest {
-
+	
     @Override
     public RDFTermFactory createFactory() {
         return new RDFTermFactoryJena() ;


Mime
View raw message