From commits-return-32816-archive-asf-public=cust-asf.ponee.io@tinkerpop.apache.org Fri Oct 5 16:30:52 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id BC0EE1807AC for ; Fri, 5 Oct 2018 16:30:50 +0200 (CEST) Received: (qmail 3260 invoked by uid 500); 5 Oct 2018 14:30:41 -0000 Mailing-List: contact commits-help@tinkerpop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tinkerpop.apache.org Delivered-To: mailing list commits@tinkerpop.apache.org Received: (qmail 2884 invoked by uid 99); 5 Oct 2018 14:30:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Oct 2018 14:30:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4AAB5E1143; Fri, 5 Oct 2018 14:30:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: spmallette@apache.org To: commits@tinkerpop.apache.org Date: Fri, 05 Oct 2018 14:31:21 -0000 Message-Id: In-Reply-To: <39005547865946be85609238d206d31e@git.apache.org> References: <39005547865946be85609238d206d31e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [42/50] [abbrv] tinkerpop git commit: Merge branch 'tp32' into tp33 Merge branch 'tp32' into tp33 Conflicts: gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/d9ccefce Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/d9ccefce Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/d9ccefce Branch: refs/heads/TINKERPOP-2053 Commit: d9ccefcea9274f00e7339b840624286e198d7832 Parents: 86b1be5 4bdb006 Author: Stephen Mallette Authored: Fri Oct 5 06:57:09 2018 -0400 Committer: Stephen Mallette Committed: Fri Oct 5 06:57:09 2018 -0400 ---------------------------------------------------------------------- .../groovy/jsr223/GremlinGroovyScriptEngineTest.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/d9ccefce/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java ---------------------------------------------------------------------- diff --cc gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java index 3e1d153,2803c24..83ac13d --- a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java +++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineTest.java @@@ -22,13 -22,16 +22,9 @@@ import groovy.lang.Closure import groovy.lang.MissingPropertyException; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider; -import org.apache.tinkerpop.gremlin.groovy.NoImportCustomizerProvider; -import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.InterpreterModeCustomizerProvider; --import org.apache.tinkerpop.gremlin.structure.Vertex; import org.apache.tinkerpop.gremlin.util.function.Lambda; --import org.apache.tinkerpop.gremlin.util.iterator.IteratorUtils; import org.javatuples.Pair; import org.junit.Test; --import org.slf4j.Logger; --import org.slf4j.LoggerFactory; import javax.script.Bindings; import javax.script.ScriptContext; @@@ -61,8 -73,8 +57,6 @@@ import static org.junit.Assert.fail * @author Stephen Mallette (http://stephen.genoprime.com) */ public class GremlinGroovyScriptEngineTest { -- private static final Logger logger = LoggerFactory.getLogger(GremlinGroovyScriptEngineTest.class); -- private static final Object[] EMPTY_ARGS = new Object[0]; @Test @@@ -162,8 -220,78 +156,7 @@@ engine.eval("assert 1==0"); } - @Test - public void shouldLoadImportsViaDependencyManagerInterface() throws Exception { - final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE); - try { - engine.eval("Vertex.class.getName()"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - engine.addImports(new HashSet<>(Arrays.asList("import org.apache.tinkerpop.gremlin.structure.Vertex"))); - assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()")); - } - - @Test - public void shouldLoadImportsViaDependencyManagerInterfaceAdditively() throws Exception { - final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE); - try { - engine.eval("Vertex.class.getName()"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - try { - engine.eval("StreamFactory.class.getName()"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - engine.addImports(new HashSet<>(Arrays.asList("import " + Vertex.class.getCanonicalName()))); - assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()")); - - try { - engine.eval("IteratorUtils.class.getName()"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - engine.addImports(new HashSet<>(Arrays.asList("import " + IteratorUtils.class.getCanonicalName()))); - assertEquals(Vertex.class.getName(), engine.eval("Vertex.class.getName()")); - assertEquals(IteratorUtils.class.getName(), engine.eval("IteratorUtils.class.getName()")); - } - - @Test - public void shouldAllowsMultipleImports() throws Exception { - final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine((CompilerCustomizerProvider) NoImportCustomizerProvider.INSTANCE); - try { - engine.eval("Color.RED"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - try { - engine.eval("SystemColor.ACTIVE_CAPTION"); - fail("Should have thrown an exception because no imports were supplied"); - } catch (Exception se) { - assertTrue(se instanceof ScriptException); - } - - engine.addImports(new HashSet<>(Arrays.asList("import java.awt.Color"))); - assertEquals(Color.RED, engine.eval("Color.RED")); - - engine.addImports(new HashSet<>(Arrays.asList("import java.awt.SystemColor"))); - assertEquals(Color.RED, engine.eval("Color.RED")); - assertEquals(SystemColor.ACTIVE_CAPTION, engine.eval("SystemColor.ACTIVE_CAPTION")); - } - - @Test public void shouldClearEngineScopeOnReset() throws Exception { final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(); engine.eval("x = { y -> y + 1}"); @@@ -177,7 -305,7 +170,7 @@@ engine.eval("x(1)"); fail("Bindings should have been cleared."); } catch (Exception ex) { -- ++ // do nothing = expected } b = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE); @@@ -198,6 -382,6 +191,7 @@@ scriptEngine.eval("addOne(1)"); fail("Should have tossed ScriptException since addOne is not yet defined."); } catch (ScriptException se) { ++ // do nothing = expected } // validate that the addOne function works @@@ -211,6 -395,6 +205,7 @@@ scriptEngine.eval("addOne(1)"); fail("Should have tossed ScriptException since addOne is no longer defined after reset."); } catch (ScriptException se) { ++ // do nothing = expected } }