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/b02feca7
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/b02feca7
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/b02feca7

Branch: refs/heads/ThreadPerGraphDataset
Commit: b02feca7c2b2d53e6fff19cf377a0a408978fc62
Parents: bb215d4
Author: ajs6f <[email protected]>
Authored: Sat Jan 7 16:24:08 2017 -0500
Committer: ajs6f <[email protected]>
Committed: Tue Feb 14 09:39:03 2017 -0500

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


http://git-wip-us.apache.org/repos/asf/jena/blob/b02feca7/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();
         }
     }
-
 }

Reply via email to