jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rve...@apache.org
Subject [12/50] [abbrv] jena git commit: JENA-879: JenaOSGITest modified to use PaxExam
Date Tue, 17 Feb 2015 12:42:21 GMT
JENA-879: JenaOSGITest modified to use PaxExam

https://ops4j1.jira.com/wiki/display/PAXEXAM4/Getting+Started+with+OSGi+Tests

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/46e1f24c
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/46e1f24c
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/46e1f24c

Branch: refs/heads/eliminate-assignments
Commit: 46e1f24c21b25557d4b6e77ad312d53510ce3ad6
Parents: 8535469
Author: Stian Soiland-Reyes <stain@apache.org>
Authored: Mon Feb 2 23:54:49 2015 +0000
Committer: Stian Soiland-Reyes <stain@apache.org>
Committed: Mon Feb 9 10:02:07 2015 +0000

----------------------------------------------------------------------
 .../org/apache/jena/osgi/test/JenaOSGITest.java | 34 ++++++++++++++++----
 1 file changed, 28 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/46e1f24c/apache-jena-osgi/jena-osgi-test/src/main/java/org/apache/jena/osgi/test/JenaOSGITest.java
----------------------------------------------------------------------
diff --git a/apache-jena-osgi/jena-osgi-test/src/main/java/org/apache/jena/osgi/test/JenaOSGITest.java
b/apache-jena-osgi/jena-osgi-test/src/main/java/org/apache/jena/osgi/test/JenaOSGITest.java
index fd179eb..3d93bf1 100644
--- a/apache-jena-osgi/jena-osgi-test/src/main/java/org/apache/jena/osgi/test/JenaOSGITest.java
+++ b/apache-jena-osgi/jena-osgi-test/src/main/java/org/apache/jena/osgi/test/JenaOSGITest.java
@@ -27,11 +27,20 @@ import java.io.Writer;
 import java.nio.file.Files;
 import java.nio.file.Path;
 
+import javax.inject.Inject;
+
 import org.apache.jena.iri.IRI;
 import org.apache.jena.iri.IRIFactory;
 import org.apache.jena.riot.Lang;
 import org.apache.jena.riot.RDFDataMgr;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.ops4j.pax.exam.Configuration;
+import org.ops4j.pax.exam.Option;
+import org.ops4j.pax.exam.junit.PaxExam;
+import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy;
+import org.ops4j.pax.exam.spi.reactors.PerMethod;
+import org.osgi.framework.BundleContext;
 
 import com.hp.hpl.jena.ontology.Individual;
 import com.hp.hpl.jena.ontology.ObjectProperty;
@@ -51,13 +60,26 @@ import com.hp.hpl.jena.rdf.model.ModelFactory;
 import com.hp.hpl.jena.rdf.model.Property;
 import com.hp.hpl.jena.rdf.model.Resource;
 import com.hp.hpl.jena.tdb.TDBFactory;
+import static org.ops4j.pax.exam.CoreOptions.*;
 
 /**
  * Brief tests of the Jena modules covered by jena-osgi
- *  
+ * 
  */
+@RunWith(PaxExam.class)
+@ExamReactorStrategy(PerMethod.class)
 public class JenaOSGITest {
 
+	@Inject
+	private BundleContext bc;
+
+	@Configuration
+	public Option[] config() {
+		return options(
+				mavenBundle("org.apache.jena", "jena-osgi"),
+				junitBundles());
+	}
+
 	private static final String EXAMPLE_COM_GRAPH = "http://example.com/graph";
 	private Resource alice;
 	private Property knows;
@@ -129,8 +151,8 @@ public class JenaOSGITest {
 				+ "SELECT ?bob WHERE { "
 				+ "  GRAPH <http://example.com/graph> { "
 				+ "      ?alice foaf:knows ?bob . " + "  }" + "}");
-		try (QueryExecution qexec = QueryExecutionFactory.create(query,
-				dataset)) {
+		try (QueryExecution qexec = QueryExecutionFactory
+				.create(query, dataset)) {
 			ResultSet results = qexec.execSelect();
 			assertTrue(results.hasNext());
 			QuerySolution r = results.next();
@@ -149,12 +171,12 @@ public class JenaOSGITest {
 	public void testJenaTdb() throws Exception {
 		Path tdbDir = Files.createTempDirectory("jena-tdb-test");
 		Dataset dataset = TDBFactory.createDataset(tdbDir.toString());
-		
-		dataset.begin(ReadWrite.WRITE) ;
+
+		dataset.begin(ReadWrite.WRITE);
 		dataset.addNamedModel(EXAMPLE_COM_GRAPH, makeModel());
 		dataset.commit();
 		dataset.end();
-		
+
 		dataset.begin(ReadWrite.READ);
 		runQuery(dataset);
 		dataset.end();


Mime
View raw message