You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by rd...@apache.org on 2018/10/05 11:38:08 UTC

[46/48] 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-2037
Commit: d9ccefcea9274f00e7339b840624286e198d7832
Parents: 86b1be5 4bdb006
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Fri Oct 5 06:57:09 2018 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
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
          }
      }