Repository: jena
Updated Branches:
  refs/heads/ThreadPerGraphDataset 3425c00ef -> f00f0e0c7


Integrate tests into ARQ test suite


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

Branch: refs/heads/ThreadPerGraphDataset
Commit: f00f0e0c7d7e9952a3f3f840fe6a611d4043e5a6
Parents: 3425c00
Author: ajs6f <[email protected]>
Authored: Sat Jan 7 16:18:10 2017 -0500
Committer: ajs6f <[email protected]>
Committed: Sat Jan 7 16:18:10 2017 -0500

----------------------------------------------------------------------
 .../core/DatasetGraphPerGraphLocking.java       | 34 ++++++++++----------
 .../java/org/apache/jena/sparql/TC_General.java |  2 ++
 .../core/TS_DatasetGraphPerGraphLocking.java    | 29 -----------------
 .../TS_DatasetGraphPerGraphLocking.java         | 28 ++++++++++++++++
 4 files changed, 47 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/f00f0e0c/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphPerGraphLocking.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphPerGraphLocking.java
 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphPerGraphLocking.java
index 46b2911..2405918 100644
--- 
a/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphPerGraphLocking.java
+++ 
b/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphPerGraphLocking.java
@@ -1,19 +1,14 @@
 /*
- * 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
+ * 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
+ * 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.
+ * 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.sparql.core;
@@ -124,7 +119,8 @@ public class DatasetGraphPerGraphLocking extends 
DatasetGraphCollection {
     public Graph getGraph(final Node graphName) {
         if (isInTransaction()) {
             // are we using the current graph?
-            if (graphInTransaction()!= null && 
graphName.equals(graphInTransaction().graphName())) return graphInTransaction();
+            if (graphInTransaction() != null && 
graphName.equals(graphInTransaction().graphName()))
+                return graphInTransaction();
             // are we starting work with a graph?
             if (graphInTransaction() == null) {
                 LockableGraph graph = graphs.computeIfAbsent(graphName, 
LockableGraph::new);
@@ -277,9 +273,13 @@ public class DatasetGraphPerGraphLocking extends 
DatasetGraphCollection {
         @Override
         public void begin(ReadWrite readWrite) {
             if (currentTransactionType() != null) throw new 
JenaTransactionException("Cannot nest transactions!");
-            if (WRITE.equals(readWrite)) writeLock.lock();
-            currentTransactionType.set(readWrite);
-            table.begin(readWrite);
+            switch (readWrite) {
+            case WRITE:
+                writeLock.lock();
+            default:
+                currentTransactionType.set(readWrite);
+                table.begin(readWrite);
+            }
         }
 
         public void beginWrite() {

http://git-wip-us.apache.org/repos/asf/jena/blob/f00f0e0c/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java 
b/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
index 68c9192..c9ddab3 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/TC_General.java
@@ -26,6 +26,7 @@ import org.apache.jena.sparql.api.TS_API ;
 import org.apache.jena.sparql.core.TS_Core ;
 import org.apache.jena.sparql.core.assembler.TS_Assembler ;
 import org.apache.jena.sparql.core.mem.TS_DatasetTxnMem ;
+import org.apache.jena.sparql.core.pergraph.TS_DatasetGraphPerGraphLocking;
 import org.apache.jena.sparql.engine.TS_Engine ;
 import org.apache.jena.sparql.engine.join.TS_Join ;
 import org.apache.jena.sparql.expr.E_Function ;
@@ -71,6 +72,7 @@ import org.junit.runners.Suite ;
     , TS_Core.class
     , TS_Assembler.class
     , TS_DatasetTxnMem.class
+    , TS_DatasetGraphPerGraphLocking.class
     , TS_Path.class
     , TS_ParamString.class
     , TS_Update.class

http://git-wip-us.apache.org/repos/asf/jena/blob/f00f0e0c/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_DatasetGraphPerGraphLocking.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_DatasetGraphPerGraphLocking.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_DatasetGraphPerGraphLocking.java
deleted file mode 100644
index 82cb62e..0000000
--- 
a/jena-arq/src/test/java/org/apache/jena/sparql/core/TS_DatasetGraphPerGraphLocking.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.sparql.core;
-
-import org.apache.jena.sparql.core.pergraph.*;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite;
-
-
-@RunWith(Suite.class)
[email protected]({ BasicTest.class, FindPatternsTest.class, FindTest.class, 
LockTest.class, TransactionLifecycleTest.class,
-               ViewTest.class, MultithreadingTest.class })
-public class TS_DatasetGraphPerGraphLocking {}

http://git-wip-us.apache.org/repos/asf/jena/blob/f00f0e0c/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/TS_DatasetGraphPerGraphLocking.java
----------------------------------------------------------------------
diff --git 
a/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/TS_DatasetGraphPerGraphLocking.java
 
b/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/TS_DatasetGraphPerGraphLocking.java
new file mode 100644
index 0000000..4f31459
--- /dev/null
+++ 
b/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/TS_DatasetGraphPerGraphLocking.java
@@ -0,0 +1,28 @@
+/*
+ * 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.sparql.core.pergraph;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+
+@RunWith(Suite.class)
[email protected]({ BasicTest.class, FindPatternsTest.class, FindTest.class, 
LockTest.class, TransactionLifecycleTest.class,
+               ViewTest.class, MultithreadingTest.class })
+public class TS_DatasetGraphPerGraphLocking {}

Reply via email to