jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [03/11] jena git commit: Module jena-integration-tests
Date Thu, 22 Dec 2016 17:55:03 GMT
Module jena-integration-tests


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

Branch: refs/heads/master
Commit: 89b1027f0068bf1396bde82c37467c0a3d0bdf68
Parents: 2e26b78
Author: Andy Seaborne <andy@apache.org>
Authored: Fri Dec 16 15:02:28 2016 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Fri Dec 16 15:02:28 2016 +0000

----------------------------------------------------------------------
 jena-integration-tests/LICENSE                  | 177 +++++++++
 jena-integration-tests/NOTICE                   |   4 +
 jena-integration-tests/README.md                |  11 +
 jena-integration-tests/pom.xml                  | 146 +++++++
 .../AbstractTestRDFConnection.java              | 382 +++++++++++++++++++
 .../test/rdfconnection/TS_RDFConnection2.java   |  36 ++
 .../TestRDFConnectionLocalMRSW.java             |  39 ++
 .../TestRDFConnectionLocalTDB.java              |  38 ++
 .../TestRDFConnectionLocalTxnMem.java           |  39 ++
 .../rdfconnection/TestRDFConnectionRemote.java  |  78 ++++
 .../src/test/resources/log4j.properties         |  40 ++
 .../testing/RDFConnection/data.trig             |  16 +
 .../testing/RDFConnection/data.ttl              |   6 +
 13 files changed, 1012 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/LICENSE
----------------------------------------------------------------------
diff --git a/jena-integration-tests/LICENSE b/jena-integration-tests/LICENSE
new file mode 100644
index 0000000..f433b1a
--- /dev/null
+++ b/jena-integration-tests/LICENSE
@@ -0,0 +1,177 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/NOTICE
----------------------------------------------------------------------
diff --git a/jena-integration-tests/NOTICE b/jena-integration-tests/NOTICE
new file mode 100644
index 0000000..485d658
--- /dev/null
+++ b/jena-integration-tests/NOTICE
@@ -0,0 +1,4 @@
+Apache Jena - Integration Tests
+Copyright 2016 The Apache Software Foundation
+
+This code is licensed under an Apache Software License.

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/README.md
----------------------------------------------------------------------
diff --git a/jena-integration-tests/README.md b/jena-integration-tests/README.md
new file mode 100644
index 0000000..77f4df8
--- /dev/null
+++ b/jena-integration-tests/README.md
@@ -0,0 +1,11 @@
+Jena Intrgration Tests
+======================
+
+This module provides testing of components where testing depends on
+infrastructure not avilable, due to dependency relationships, to the
+module.
+
+For example, tests of RDF Connection for remote access that use embedded
+Fuseki.  RDF Connection code does not itself depend on embedded Fuseki
+and exists earlier in the build order than Fuseki.
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/jena-integration-tests/pom.xml b/jena-integration-tests/pom.xml
new file mode 100644
index 0000000..9dca002
--- /dev/null
+++ b/jena-integration-tests/pom.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+   Licensed 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.
+ 
+   See the NOTICE file distributed with this work for additional
+   information regarding copyright ownership.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" 
+	 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.jena</groupId>
+  <artifactId>jena-integration-tests</artifactId>
+  <packaging>jar</packaging>
+  <name>Apache Jena - Integration Testing</name>
+  <version>3.2.0-SNAPSHOT</version>
+
+  <description>Apache Jena - Integration Testing</description>
+
+  <parent>
+    <groupId>org.apache.jena</groupId>
+    <artifactId>jena-parent</artifactId>
+    <version>18-SNAPSHOT</version>
+    <relativePath>../jena-parent</relativePath>
+  </parent>
+
+  <licenses>
+    <license>
+      <name>Apache 2.0 License</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+    </license>
+  </licenses>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>apache-jena-libs</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <type>pom</type>
+    </dependency>
+
+    <!-- Modules that have tests here -->
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-rdfconnection</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-rdfconnection</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+
+    <!-- The test artifacts to go with apache-jena-libs -->
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-base</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+    
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-core</artifactId>
+      <classifier>tests</classifier>
+      <version>3.2.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>    
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-arq</artifactId>
+      <version>3.2.0-SNAPSHOT</version>
+      <classifier>tests</classifier>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.jena</groupId>
+      <artifactId>jena-fuseki-embedded</artifactId>
+      <version>2.5.0-SNAPSHOT</version>
+      <scope>test</scope>
+    </dependency>   
+    
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-log4j12</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <scope>test</scope>
+    </dependency> 
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <includes>
+            <include>**/TS_*.java</include>
+          </includes>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-resources-plugin</artifactId>
+      </plugin>
+    </plugins>
+
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/AbstractTestRDFConnection.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/AbstractTestRDFConnection.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/AbstractTestRDFConnection.java
new file mode 100644
index 0000000..9b3a65f
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/AbstractTestRDFConnection.java
@@ -0,0 +1,382 @@
+/*
+ * 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.test.rdfconnection;
+
+import java.util.concurrent.atomic.AtomicInteger ;
+
+import org.apache.jena.atlas.iterator.Iter ;
+import org.apache.jena.atlas.junit.BaseTest ;
+import org.apache.jena.atlas.lib.StrUtils ;
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.query.ReadWrite ;
+import org.apache.jena.rdf.model.Model ;
+import org.apache.jena.rdf.model.ModelFactory ;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.riot.RDFDataMgr ;
+import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.sse.SSE ;
+import org.apache.jena.sparql.util.IsoMatcher ;
+import org.apache.jena.system.Txn ;
+import org.junit.Assume ;
+import org.junit.Test ;
+
+public abstract class AbstractTestRDFConnection extends BaseTest {
+    // Testing data.
+    static String DIR = "testing/RDFConnection/" ;
+    
+    protected abstract RDFConnection connection() ;
+    // Not all RDFConenction types support.
+    //  (may acquite RDFConnection.supportTransactionalAbort but ATM that isn't included)
+    protected abstract boolean supportsAbort() ; 
+
+    // ---- Data
+    static String dsgdata = StrUtils.strjoinNL
+        ("(dataset"
+        ,"  (graph (:s :p :o) (:s0 :p0 _:a))"
+        ,"  (graph :g1 (:s :p :o) (:s1 :p1 :o1))"
+        ,"  (graph :g2 (:s :p :o) (:s2 :p2 :o))"
+        ,")"
+        ) ;
+    
+    static String dsgdata2 = StrUtils.strjoinNL
+        ("(dataset"
+        ,"  (graph (:x :y :z))"
+        ,"  (graph :g9 (:s :p :o))"
+        ,")"
+        ) ;
+
+    
+    static String graph1 = StrUtils.strjoinNL
+        ("(graph (:s :p :o) (:s1 :p1 :o))"
+        ) ;
+
+    static String graph2 = StrUtils.strjoinNL
+        ("(graph (:s :p :o) (:s2 :p2 :o))"
+        ) ;
+    
+    static DatasetGraph dsg        = SSE.parseDatasetGraph(dsgdata);
+    static Dataset      dataset    = DatasetFactory.wrap(dsg);
+    static DatasetGraph dsg2       = SSE.parseDatasetGraph(dsgdata2);
+    static Dataset      dataset2   = DatasetFactory.wrap(dsg2);
+
+    static String       graphName  = "http://test/graph";
+    static String       graphName2 = "http://test/graph2";
+    static Model        model1     = ModelFactory.createModelForGraph(SSE.parseGraph(graph1));
+    static Model        model2     = ModelFactory.createModelForGraph(SSE.parseGraph(graph2));
+    // ---- Data
+
+    @Test public void connect_01() {
+        @SuppressWarnings("resource")
+        RDFConnection conn = connection() ;
+        assertFalse(conn.isClosed()) ;
+        conn.close() ;
+        assertTrue(conn.isClosed()) ;
+        // Allow multiple close()
+        conn.close() ;
+    }
+    
+    @Test public void dataset_load_1() {
+        String testDataFile = DIR+"data.trig" ; 
+        try ( RDFConnection conn = connection() ) {
+            conn.loadDataset(testDataFile);
+            Dataset ds0 = RDFDataMgr.loadDataset(testDataFile) ;
+            Dataset ds = conn.fetchDataset() ;
+            assertTrue("Datasets not isomorphic", isomorphic(ds0, ds)) ;
+        }
+    }
+
+    @Test public void dataset_put_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.putDataset(dataset) ; 
+            Dataset ds1 = conn.fetchDataset() ;
+            assertTrue("Datasets not isomorphic", isomorphic(dataset, ds1)) ;
+        }
+    }
+
+    @Test public void dataset_put_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.putDataset(dataset) ; 
+            conn.putDataset(dataset2) ;
+            Dataset ds1 = conn.fetchDataset() ;
+            assertTrue("Datasets not isomorphic", isomorphic(dataset2, ds1)) ;
+        }
+    }
+
+    @Test public void dataset_post_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.loadDataset(dataset);
+            Dataset ds1 = conn.fetchDataset() ;
+            assertTrue("Datasets not isomorphic", isomorphic(dataset, ds1)) ;
+        }
+    }
+    
+    @Test public void dataset_post_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.loadDataset(dataset);
+            conn.loadDataset(dataset2);
+            Dataset ds1 = conn.fetchDataset() ;
+            long x = Iter.count(ds1.listNames()) ;
+            assertEquals("NG count", 3, x) ;
+            assertFalse("Datasets are isomorphic", isomorphic(dataset, ds1)) ;
+            assertFalse("Datasets are isomorphic", isomorphic(dataset2, ds1)) ;
+        }
+    }
+
+    // Default graph
+    
+    @Test public void graph_load_1() {
+        String testDataFile = DIR+"data.ttl" ; 
+        Model m0 = RDFDataMgr.loadModel(testDataFile) ;
+        try ( RDFConnection conn = connection() ) {
+            conn.load(testDataFile);
+            Model m = conn.fetch() ;
+            assertTrue("Models not isomorphic", isomorphic(m0, m)) ;
+        }
+    }
+
+    @Test public void graph_put_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.put(model1); 
+            Dataset ds1 = conn.fetchDataset() ;
+            Model m0 = conn.fetch() ;
+            assertTrue("Models not isomorphic", isomorphic(model1, ds1.getDefaultModel()))
;
+            Model m = conn.fetch() ;
+            assertTrue("Models not isomorphic", isomorphic(model1, m)) ;
+        }
+    }
+
+    @Test public void graph_put_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.put(model1) ; 
+            conn.put(model2) ;
+            Model m = conn.fetch() ;
+            assertTrue("Models not isomorphic", isomorphic(m, model2)) ;
+            assertFalse("Models not isomorphic", isomorphic(m, model1)) ;
+        }
+    }
+
+    @Test public void graph_post_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.load(model1) ;
+            Model m = conn.fetch() ;
+            assertTrue("Models not isomorphic", isomorphic(m, model1)) ;
+        }
+    }
+    
+    @Test public void graph_post_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.load(model1) ;
+            conn.load(model2) ;
+            Model m = conn.fetch() ;
+            Model m0 = ModelFactory.createUnion(model2, model1) ;
+            assertTrue("Models are not isomorphic", isomorphic(m0, m)) ;
+        }
+    }
+
+    // DELETE
+    
+    // Named graphs
+    
+    @Test public void named_graph_load_1() {
+        String testDataFile = DIR+"data.ttl" ; 
+        Model m0 = RDFDataMgr.loadModel(testDataFile) ;
+        try ( RDFConnection conn = connection() ) {
+            conn.load(graphName, testDataFile);
+            Model m = conn.fetch(graphName) ;
+            assertTrue("Models not isomorphic", isomorphic(m0, m)) ;
+            Model mDft = conn.fetch() ;
+            assertTrue(mDft.isEmpty()) ;
+        }
+    }
+
+    @Test public void named_graph_put_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.put(graphName, model1); 
+            Dataset ds1 = conn.fetchDataset() ;
+            Model m0 = conn.fetch(graphName) ;
+            assertTrue("Models not isomorphic", isomorphic(model1, ds1.getNamedModel(graphName)))
;
+            Model m = conn.fetch(graphName) ;
+            assertTrue("Models not isomorphic", isomorphic(model1, m)) ;
+        }
+    }
+
+    @Test public void named_graph_put_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.put(graphName, model1) ; 
+            conn.put(graphName, model2) ;
+            Model m = conn.fetch(graphName) ;
+            assertTrue("Models not isomorphic", isomorphic(m, model2)) ;
+            assertFalse("Models not isomorphic", isomorphic(m, model1)) ;
+        }
+    }
+
+    @Test public void named_graph_put_2_different() {
+        try ( RDFConnection conn = connection() ) {
+            conn.put(graphName, model1) ; 
+            conn.put(graphName2, model2) ;
+            Model m1 = conn.fetch(graphName) ;
+            Model m2 = conn.fetch(graphName2) ;
+            assertTrue("Models not isomorphic", isomorphic(m1, model1)) ;
+            assertTrue("Models not isomorphic", isomorphic(m2, model2)) ;
+        }
+    }
+
+    @Test public void named_graph_post_1() {
+        try ( RDFConnection conn = connection() ) {
+            conn.load(graphName, model1) ;
+            Model m = conn.fetch(graphName) ;
+            assertTrue("Models not isomorphic", isomorphic(m, model1)) ;
+        }
+    }
+    
+    @Test public void named_graph_post_2() {
+        try ( RDFConnection conn = connection() ) {
+            conn.load(graphName, model1) ;
+            conn.load(graphName, model2) ;
+            Model m = conn.fetch(graphName) ;
+            Model m0 = ModelFactory.createUnion(model2, model1) ;
+            assertTrue("Models are not isomorphic", isomorphic(m0, m)) ;
+        }
+    }
+
+    // DELETE
+    
+    // Remote connections don't support transactions fully.  
+    //@Test public void transaction_01() 
+
+    private static boolean isomorphic(Dataset ds1, Dataset ds2) {
+        return IsoMatcher.isomorphic(ds1.asDatasetGraph(), ds2.asDatasetGraph()) ;
+    }
+    
+    private static boolean isomorphic(Model model1, Model model2) {
+        return model1.isIsomorphicWith(model2) ;
+    }
+    
+
+    @Test public void query_ask_01() {
+        try ( RDFConnection conn = connection() ) {
+            Txn.executeRead(conn, ()->{
+                boolean b = conn.queryAsk("ASK{}") ;
+                assertTrue(b) ;
+            }) ;
+        }
+    }
+
+    @Test public void query_ask_02() {
+        try ( RDFConnection conn = connection() ) {
+            boolean b = conn.queryAsk("ASK{}") ;
+            assertTrue(b) ;
+        }
+    }
+
+    @Test public void query_select_01() {
+        AtomicInteger counter = new AtomicInteger(0) ;
+        try ( RDFConnection conn = connection() ) {
+            Txn.executeWrite(conn, ()->conn.loadDataset(DIR+"data.trig"));
+            Txn.executeRead(conn, ()->
+                conn.querySelect("SELECT * { ?s ?p ?o }" , (r)->counter.incrementAndGet()));
+            assertEquals(2, counter.get()) ;
+        }
+    }
+
+    @Test public void query_select_02() {
+        AtomicInteger counter = new AtomicInteger(0) ;
+        try ( RDFConnection conn = connection() ) {
+            conn.loadDataset(DIR+"data.trig");
+            conn.querySelect("SELECT * { ?s ?p ?o}" , (r)->counter.incrementAndGet());
+            assertEquals(2, counter.get()) ;
+        }
+    }
+
+    @Test public void query_construct_01() {
+        try ( RDFConnection conn = connection() ) {
+            Txn.executeWrite(conn, ()->conn.loadDataset(DIR+"data.trig"));
+            Txn.executeRead(conn, ()-> {
+                Model m = conn.queryConstruct("CONSTRUCT WHERE { ?s ?p ?o }") ;
+                assertEquals(2, m.size()) ;
+            }) ;
+        }
+    }
+
+    @Test public void query_construct_02() {
+        try ( RDFConnection conn = connection() ) {
+            conn.loadDataset(DIR+"data.trig");
+            Model m = conn.queryConstruct("CONSTRUCT WHERE { ?s ?p ?o }") ;
+            assertEquals(2, m.size()) ;
+        }
+    }
+    
+    @Test public void update_01() {
+        try ( RDFConnection conn = connection() ) {
+            conn.update("INSERT DATA { <urn:x:s> <urn:x:p> <urn:x:o>}");
+        }
+    }
+
+    @Test public void update_02() {
+        try ( RDFConnection conn = connection() ) {
+            Txn.executeWrite(conn, ()->conn.update("INSERT DATA { <urn:x:s> <urn:x:p>
<urn:x:o>}")) ;
+        }
+    }
+
+    // Not all Transactional support abort.
+    @Test public void transaction_commit_read_01() {
+        String testDataFile = DIR+"data.trig" ; 
+        try ( RDFConnection conn = connection() ) {
+
+            conn.begin(ReadWrite.WRITE) ;
+            conn.loadDataset(dataset);
+            conn.commit() ;
+            conn.end();
+            
+            conn.begin(ReadWrite.READ) ;
+            Model m = conn.fetch() ;
+            assertTrue(isomorphic(m, dataset.getDefaultModel())) ;
+            conn.end() ;
+        }
+    }
+    
+    // Not all RDFConnections support abort.
+    @Test public void transaction_abort_read02() {
+        Assume.assumeTrue(supportsAbort()) ;
+        
+        String testDataFile = DIR+"data.trig" ; 
+        try ( RDFConnection conn = connection() ) {
+            conn.begin(ReadWrite.WRITE) ;
+            conn.loadDataset(testDataFile);
+            conn.abort();
+            conn.end();
+            
+            conn.begin(ReadWrite.READ) ;
+            Model m = conn.fetch() ;
+            assertTrue(m.isEmpty()) ;
+            conn.end() ;
+        }
+    }
+
+    //@Test(expected=JenaTransactionException.class)
+    public void transaction_bad_01() {
+        try ( RDFConnection conn = connection() ) {
+            conn.begin(ReadWrite.WRITE) ;
+            // Should have conn.commit() ;
+            conn.end();
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
new file mode 100644
index 0000000..55a0dff
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TS_RDFConnection2.java
@@ -0,0 +1,36 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.junit.runner.RunWith ;
+import org.junit.runners.Suite ;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses( {
+    // Done in the module
+//    TestRDFConnectionLocalTxnMem.class ,
+//    TestRDFConnectionLocalMRSW.class ,
+    
+    // Addition tests added here.
+    TestRDFConnectionLocalTDB.class ,
+    TestRDFConnectionRemote.class
+})
+
+public class TS_RDFConnection2 {}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalMRSW.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalMRSW.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalMRSW.java
new file mode 100644
index 0000000..8bc82ff
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalMRSW.java
@@ -0,0 +1,39 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.rdfconnection.AbstractTestRDFConnection;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+
+public class TestRDFConnectionLocalMRSW extends AbstractTestRDFConnection {
+
+    @Override
+    protected boolean supportsAbort() { return false ; }
+    
+    @Override
+    protected RDFConnection connection() {
+        // General purpose, mixed storage, MRSW dataset.  
+        Dataset ds = DatasetFactory.create() ;
+        return RDFConnectionFactory.connect(ds) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTDB.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTDB.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTDB.java
new file mode 100644
index 0000000..366d73b
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTDB.java
@@ -0,0 +1,38 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.rdfconnection.AbstractTestRDFConnection;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+import org.apache.jena.tdb.TDBFactory ;
+
+public class TestRDFConnectionLocalTDB extends AbstractTestRDFConnection {
+    
+    @Override
+    protected boolean supportsAbort() { return true ; }
+    
+    @Override
+    protected RDFConnection connection() {
+        Dataset ds = TDBFactory.createDataset() ;
+        return RDFConnectionFactory.connect(ds) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTxnMem.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTxnMem.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTxnMem.java
new file mode 100644
index 0000000..dd50553
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionLocalTxnMem.java
@@ -0,0 +1,39 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.DatasetFactory ;
+import org.apache.jena.rdfconnection.AbstractTestRDFConnection;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+
+public class TestRDFConnectionLocalTxnMem extends AbstractTestRDFConnection {
+
+    @Override
+    protected boolean supportsAbort() { return true ; }
+
+    @Override
+    protected RDFConnection connection() {
+        // Full transactional in-memory dataset.  
+        Dataset ds = DatasetFactory.createTxnMem() ;
+        return RDFConnectionFactory.connect(ds) ;
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
new file mode 100644
index 0000000..5abc77e
--- /dev/null
+++ b/jena-integration-tests/src/test/java/org/apache/jena/test/rdfconnection/TestRDFConnectionRemote.java
@@ -0,0 +1,78 @@
+/*
+ * 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.test.rdfconnection;
+
+import org.apache.jena.atlas.logging.LogCtl ;
+import org.apache.jena.fuseki.Fuseki ;
+import org.apache.jena.fuseki.embedded.FusekiEmbeddedServer ;
+import org.apache.jena.rdfconnection.AbstractTestRDFConnection;
+import org.apache.jena.rdfconnection.RDFConnection;
+import org.apache.jena.rdfconnection.RDFConnectionFactory;
+import org.apache.jena.sparql.core.DatasetGraph ;
+import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.system.Txn ;
+import org.junit.AfterClass ;
+import org.junit.Before ;
+import org.junit.BeforeClass ;
+
+public class TestRDFConnectionRemote extends AbstractTestRDFConnection {
+    private static FusekiEmbeddedServer server ;
+    private static DatasetGraph serverdsg = DatasetGraphFactory.createTxnMem() ;
+    
+    @BeforeClass
+    public static void beforeClass() {
+        DatasetGraph dsg = DatasetGraphFactory.createTxnMem() ;
+        server = FusekiEmbeddedServer.create()
+            .setPort(2244)
+            .add("/ds", serverdsg)
+            .build() ;
+        LogCtl.setLevel(Fuseki.serverLogName,  "WARN");
+        LogCtl.setLevel(Fuseki.actionLogName,  "WARN");
+        LogCtl.setLevel(Fuseki.requestLogName, "WARN");
+        LogCtl.setLevel(Fuseki.adminLogName,   "WARN");
+        LogCtl.setLevel(Fuseki.adminLogName,   "WARN");
+        LogCtl.setLevel("org.eclipse.jetty",   "WARN");
+        server.start() ;
+    }
+
+    @AfterClass
+    public static void afterClass() {
+        server.stop(); 
+    }
+    
+    @Before
+    public void beforeTest() {
+        // Clear server
+        Txn.executeWrite(serverdsg, ()->serverdsg.clear()) ;
+    }
+    
+//    @After
+//    public void afterTest() {}
+//    }
+
+    @Override
+    protected boolean supportsAbort() { return false ; }
+
+    @Override
+    protected RDFConnection connection() {
+        return RDFConnectionFactory.connect("http://localhost:2244/ds") ;
+    }
+
+}
+

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/jena-integration-tests/src/test/resources/log4j.properties b/jena-integration-tests/src/test/resources/log4j.properties
new file mode 100644
index 0000000..e84e60e
--- /dev/null
+++ b/jena-integration-tests/src/test/resources/log4j.properties
@@ -0,0 +1,40 @@
+# Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+# Plain output to stdout
+log4j.appender.jena.plainstdout=org.apache.log4j.ConsoleAppender
+log4j.appender.jena.plainstdout.target=System.out
+log4j.appender.jena.plainstdout.layout=org.apache.log4j.PatternLayout
+log4j.appender.jena.plainstdout.layout.ConversionPattern=[%d{yyyy-MM-dd HH:mm:ss}] %-10c{1}
%-5p %m%n
+## %d{ISO8601} -- includes "ss,sss"
+## log4j.appender.jena.plainstdout.layout.ConversionPattern=[%d{ISO8601}] %-10c{1} %-5p %m%n
+
+# Unadorned, for the NCSA requests log.
+log4j.appender.fuseki.plain=org.apache.log4j.ConsoleAppender
+log4j.appender.fuseki.plain.target=System.out
+log4j.appender.fuseki.plain.layout=org.apache.log4j.PatternLayout
+log4j.appender.fuseki.plain.layout.ConversionPattern=%m%n
+
+log4j.rootLogger=INFO, jena.plainstdout
+log4j.logger.org.apache.jena=WARN
+log4j.logger.org.apache.jena.fuseki=INFO
+
+# Others
+log4j.logger.org.eclipse.jetty=WARN
+log4j.logger.org.apache.shiro=WARN
+
+# Fuseki System logs.
+log4j.logger.org.apache.jena.fuseki.Server=INFO
+log4j.logger.org.apache.jena.fuseki.Fuseki=INFO
+log4j.logger.org.apache.jena.fuseki.Admin=INFO
+log4j.logger.org.apache.jena.fuseki.Validate=INFO
+log4j.logger.org.apache.jena.fuseki.Config=INFO
+
+# NCSA Request log.
+log4j.additivity.org.apache.jena.fuseki.Request=false
+log4j.logger.org.apache.jena.fuseki.Request=OFF, fuseki.plain
+
+# TDB
+log4j.logger.org.apache.jena.tdb.loader=INFO
+## Parser output
+log4j.additivity.org.apache.jena.riot=false
+log4j.logger.org.apache.jena.riot=INFO, jena.plainstdout

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/testing/RDFConnection/data.trig
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/RDFConnection/data.trig b/jena-integration-tests/testing/RDFConnection/data.trig
new file mode 100644
index 0000000..e8a6f04
--- /dev/null
+++ b/jena-integration-tests/testing/RDFConnection/data.trig
@@ -0,0 +1,16 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+prefix : <http://example/>
+
+:s :p :o .
+:s0 :p0 :o .
+
+:g1 {
+   :s :p :o .
+   :s1 :p1 :o1 .
+   }
+
+:g2 {
+  :s :p :o .
+  :s2 :p2 :o .
+  }

http://git-wip-us.apache.org/repos/asf/jena/blob/89b1027f/jena-integration-tests/testing/RDFConnection/data.ttl
----------------------------------------------------------------------
diff --git a/jena-integration-tests/testing/RDFConnection/data.ttl b/jena-integration-tests/testing/RDFConnection/data.ttl
new file mode 100644
index 0000000..aa1b76c
--- /dev/null
+++ b/jena-integration-tests/testing/RDFConnection/data.ttl
@@ -0,0 +1,6 @@
+## Licensed under the terms of http://www.apache.org/licenses/LICENSE-2.0
+
+prefix : <http://example/>
+
+:s :p :o .
+:s0 :p0 123 .


Mime
View raw message