You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by aj...@apache.org on 2017/01/08 14:45:28 UTC

[06/10] jena git commit: Use constants in tests

Use constants in tests


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

Branch: refs/heads/ThreadPerGraphDataset
Commit: c532719ce631abfa4f373a142d5c39a1207defc8
Parents: ecdbd4c
Author: ajs6f <aj...@virginia.edu>
Authored: Sat Jan 7 16:24:08 2017 -0500
Committer: ajs6f <aj...@virginia.edu>
Committed: Sun Jan 8 09:29:52 2017 -0500

----------------------------------------------------------------------
 .../core/pergraph/MultithreadingTest.java       | 36 +++++++++-----------
 1 file changed, 16 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/c532719c/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/MultithreadingTest.java
----------------------------------------------------------------------
diff --git a/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/MultithreadingTest.java b/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/MultithreadingTest.java
index 2959be3..d2b8552 100644
--- a/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/MultithreadingTest.java
+++ b/jena-arq/src/test/java/org/apache/jena/sparql/core/pergraph/MultithreadingTest.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.pergraph;
@@ -36,7 +31,9 @@ import org.slf4j.Logger;
 
 public class MultithreadingTest extends BaseTest {
 
-    private static final Logger log = getLogger(MultithreadingTest.class);
+    private static final Node after = createLiteral("after");
+
+    private static final Node before = createLiteral("before");
 
     private static final Node dummy = createURI("info:test");
 
@@ -57,11 +54,11 @@ public class MultithreadingTest extends BaseTest {
         new Thread(() -> {
             dataset.begin(WRITE);
             try {
-                dataset.add(graph1, dummy, dummy, createLiteral("before"));
+                dataset.add(graph1, dummy, dummy, before);
                 // wait for the baton
                 startMain.set(true);
                 waitAtMost(TEN_SECONDS).untilTrue(baton);
-                dataset.add(graph1, dummy, dummy, createLiteral("after"));
+                dataset.add(graph1, dummy, dummy, after);
                 dataset.commit();
                 finishLine.set(true);
             } finally {
@@ -72,10 +69,10 @@ public class MultithreadingTest extends BaseTest {
         waitAtMost(TEN_SECONDS).untilTrue(startMain);
         dataset.begin(WRITE);
         try {
-            dataset.add(graph2, dummy, dummy, createLiteral("before"));
+            dataset.add(graph2, dummy, dummy, before);
             // pass the baton
             baton.set(true);
-            dataset.add(graph2, dummy, dummy, createLiteral("after"));
+            dataset.add(graph2, dummy, dummy, after);
             dataset.commit();
         } finally {
             dataset.end();
@@ -84,10 +81,9 @@ public class MultithreadingTest extends BaseTest {
         dataset.begin(READ);
         try {
             assertTrue("Failed to find the triple that proves that the first thread finished!",
-                    dataset.contains(graph1, dummy, dummy, createLiteral("after")));
+                    dataset.contains(graph1, dummy, dummy, after));
         } finally {
             dataset.end();
         }
     }
-
 }