You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/05/22 20:35:53 UTC

[1/2] incubator-tinkerpop git commit: Add tests for ScriptEngineCache.

Repository: incubator-tinkerpop
Updated Branches:
  refs/heads/master bdb51fe46 -> 63cccb9be


Add tests for ScriptEngineCache.


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

Branch: refs/heads/master
Commit: bf5bd38a2b5343bc9d8a435775fdebf50d058fbf
Parents: 06e411e
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri May 22 14:35:20 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri May 22 14:35:20 2015 -0400

----------------------------------------------------------------------
 .../gremlin/util/ScriptEngineCache.java         |  2 +
 .../gremlin/util/ScriptEngineCacheTest.java     | 46 ++++++++++++++++++++
 .../util/iterator/IteratorUtilsTest.java        | 15 +++----
 3 files changed, 54 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bf5bd38a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
index 8092992..13bb2d1 100644
--- a/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
+++ b/gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCache.java
@@ -28,6 +28,8 @@ import java.util.concurrent.ConcurrentHashMap;
  */
 public final class ScriptEngineCache {
 
+    private ScriptEngineCache() {}
+
     public final static String DEFAULT_SCRIPT_ENGINE = "gremlin-groovy";
 
     private final static ScriptEngineManager SCRIPT_ENGINE_MANAGER = new ScriptEngineManager();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bf5bd38a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCacheTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCacheTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCacheTest.java
new file mode 100644
index 0000000..d8306c8
--- /dev/null
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/ScriptEngineCacheTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.tinkerpop.gremlin.util;
+
+import org.apache.tinkerpop.gremlin.TestHelper;
+import org.junit.Test;
+
+import static org.junit.Assert.assertSame;
+
+/**
+ * @author Stephen Mallette (http://stephen.genoprime.com)
+ */
+public class ScriptEngineCacheTest {
+
+    @Test
+    public void shouldBeUtilityClass() throws Exception {
+        TestHelper.assertIsUtilityClass(ScriptEngineCache.class);
+    }
+
+    @Test
+    public void shouldGetEngineFromCache() {
+        assertSame(ScriptEngineCache.get("nashorn"), ScriptEngineCache.get("nashorn"));
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void shouldThrowWhenScripEngineDoesNotExist() {
+        ScriptEngineCache.get("junk-that-no-one-would-ever-call-a-script-engine-83939473298432");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/bf5bd38a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java
----------------------------------------------------------------------
diff --git a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java
index 31ae0b2..b5e7948 100644
--- a/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java
+++ b/gremlin-core/src/test/java/org/apache/tinkerpop/gremlin/util/iterator/IteratorUtilsTest.java
@@ -22,9 +22,6 @@ import org.apache.tinkerpop.gremlin.TestHelper;
 import org.apache.tinkerpop.gremlin.process.traversal.util.FastNoSuchElementException;
 import org.junit.Test;
 
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -33,7 +30,6 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.stream.Stream;
 
 import static org.hamcrest.CoreMatchers.hasItems;
 import static org.hamcrest.CoreMatchers.is;
@@ -46,6 +42,12 @@ import static org.junit.Assert.assertFalse;
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
 public class IteratorUtilsTest {
+
+    @Test
+    public void shouldBeUtilityClass() throws Exception {
+        TestHelper.assertIsUtilityClass(IteratorUtils.class);
+    }
+
     @Test
     public void shouldIterateSingleObject() {
         assertIterator(IteratorUtils.of("test1"), 1);
@@ -57,11 +59,6 @@ public class IteratorUtilsTest {
     }
 
     @Test
-    public void shouldBeUtilityClass() throws Exception {
-        TestHelper.assertIsUtilityClass(IteratorUtils.class);
-    }
-
-    @Test
     public void shouldIterateToEnd() {
         final Iterator itty = Arrays.asList(1, 2, 3).iterator();
         IteratorUtils.iterate(itty);


[2/2] incubator-tinkerpop git commit: Merge remote-tracking branch 'origin/master'

Posted by sp...@apache.org.
Merge remote-tracking branch 'origin/master'


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/63cccb9b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/63cccb9b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/63cccb9b

Branch: refs/heads/master
Commit: 63cccb9be1f6bc020d918d922e06270cbe196823
Parents: bf5bd38 bdb51fe
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri May 22 14:35:42 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Fri May 22 14:35:42 2015 -0400

----------------------------------------------------------------------
 .../process/computer/TinkerMessenger.java          | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------