http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java deleted file mode 100644 index e3a713d..0000000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/jsr223/dsl/credential/CredentialGraphTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.groovy.jsr223.dsl.credential; - -import org.apache.tinkerpop.gremlin.AbstractGremlinTest; -import org.apache.tinkerpop.gremlin.FeatureRequirement; -import org.apache.tinkerpop.gremlin.FeatureRequirementSet; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.hamcrest.MatcherAssert; -import org.junit.Test; - -import static org.apache.tinkerpop.gremlin.groovy.jsr223.dsl.credential.CredentialGraph.credentials; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class CredentialGraphTest extends AbstractGremlinTest { - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldCreateUser() { - final Vertex v = credentials(graph).createUser("stephen", "secret"); - assertEquals("stephen", v.value("username")); - assertEquals("user", v.label()); - assertNotEquals("secret", v.value("password")); // hashed to something - assertThat(v.value("password").toString().length(), greaterThan(0)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES) - public void shouldRemoveUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(1, credentials(graph).removeUser("stephen")); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldNotRemoveUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(0, credentials(graph).removeUser("stephanie")); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldFindUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - final Vertex stephen = credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(stephen, credentials(graph).findUser("stephen")); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldNotFindUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertNull(credentials(graph).findUser("stephanie")); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldCountUsers() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(3, credentials(graph).countUsers()); - } - - @Test(expected = IllegalStateException.class) - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldThrowIfFindingMultipleUsers() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertNull(credentials(graph).findUser("stephen")); - } -}
http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java deleted file mode 100644 index 7cdf329..0000000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/plugin/dsl/credential/CredentialGraphTest.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.groovy.plugin.dsl.credential; - -import org.apache.tinkerpop.gremlin.AbstractGremlinTest; -import org.apache.tinkerpop.gremlin.FeatureRequirement; -import org.apache.tinkerpop.gremlin.FeatureRequirementSet; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.Vertex; -import org.hamcrest.MatcherAssert; -import org.junit.Test; - -import static org.apache.tinkerpop.gremlin.groovy.plugin.dsl.credential.CredentialGraph.credentials; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.greaterThan; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNull; - -/** - * @author Stephen Mallette (http://stephen.genoprime.com) - */ -public class CredentialGraphTest extends AbstractGremlinTest { - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldCreateUser() { - final Vertex v = credentials(graph).createUser("stephen", "secret"); - assertEquals("stephen", v.value("username")); - assertEquals("user", v.label()); - assertNotEquals("secret", v.value("password")); // hashed to something - assertThat(v.value("password").toString().length(), greaterThan(0)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - @FeatureRequirement(featureClass = Graph.Features.VertexFeatures.class, feature = Graph.Features.VertexFeatures.FEATURE_REMOVE_VERTICES) - public void shouldRemoveUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(1, credentials(graph).removeUser("stephen")); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldNotRemoveUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(0, credentials(graph).removeUser("stephanie")); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldFindUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - final Vertex stephen = credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(stephen, credentials(graph).findUser("stephen")); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldNotFindUser() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertNull(credentials(graph).findUser("stephanie")); - } - - @Test - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldCountUsers() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("marko", "secret"); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("daniel", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertEquals(3, credentials(graph).countUsers()); - } - - @Test(expected = IllegalStateException.class) - @FeatureRequirementSet(FeatureRequirementSet.Package.VERTICES_ONLY) - public void shouldThrowIfFindingMultipleUsers() { - MatcherAssert.assertThat(graph.vertices().hasNext(), is(false)); - credentials(graph).createUser("stephen", "secret"); - credentials(graph).createUser("stephen", "secret"); - MatcherAssert.assertThat(graph.vertices().hasNext(), is(true)); - - assertNull(credentials(graph).findUser("stephen")); - } -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/TestableConsolePluginAcceptor.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/TestableConsolePluginAcceptor.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/TestableConsolePluginAcceptor.java deleted file mode 100644 index 89bccaf..0000000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/groovy/util/TestableConsolePluginAcceptor.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.groovy.util; - -import org.apache.tinkerpop.gremlin.groovy.plugin.GremlinPlugin; -import org.apache.tinkerpop.gremlin.groovy.plugin.PluginAcceptor; -import org.codehaus.groovy.tools.shell.Groovysh; -import org.codehaus.groovy.tools.shell.IO; - -import javax.script.ScriptException; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - -/** - * @author Marko A. Rodriguez (http://markorodriguez.com) - */ -public class TestableConsolePluginAcceptor implements PluginAcceptor { - - public static final String ENVIRONMENT_NAME = "console"; - public static final String ENVIRONMENT_SHELL = "ConsolePluginAcceptor.shell"; - public static final String ENVIRONMENT_IO = "ConsolePluginAcceptor.io"; - - private Groovysh shell = new Groovysh(new IO(System.in, new OutputStream() { - @Override - public void write(int b) throws IOException { - - } - }, System.err)); - - @Override - public void addImports(final Set<String> importStatements) { - importStatements.forEach(this.shell::execute); - } - - @Override - public void addBinding(final String key, final Object val) { - this.shell.getInterp().getContext().setVariable(key, val); - } - - @Override - public Map<String, Object> getBindings() { - return Collections.unmodifiableMap(this.shell.getInterp().getContext().getVariables()); - } - - @Override - public Object eval(final String script) throws ScriptException { - return this.shell.execute(script); - } - - @Override - public Map<String, Object> environment() { - final Map<String, Object> env = new HashMap<>(); - env.put(GremlinPlugin.ENVIRONMENT, ENVIRONMENT_NAME); - env.put(ENVIRONMENT_IO, this.shell.getIo()); - env.put(ENVIRONMENT_SHELL, this.shell); - return env; - } - -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java deleted file mode 100644 index d408da6..0000000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessComputerSuite.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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.process; - -import org.apache.tinkerpop.gremlin.AbstractGremlinTest; -import org.apache.tinkerpop.gremlin.GraphManager; -import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader; -import org.apache.tinkerpop.gremlin.groovy.util.SugarTestHelper; -import org.apache.tinkerpop.gremlin.process.computer.GraphComputer; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyBranchTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyChooseTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyOptionalTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyLocalTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyRepeatTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyUnionTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyAndTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyCoinTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyCyclicPathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyDedupTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyFilterTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyHasTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyIsTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyOrTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyRangeTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySampleTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySimplePathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyTailTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyWhereTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyAddEdgeTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCoalesceTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyConstantTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCountTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFlatMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFoldTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyGraphTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyLoopsTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapKeysTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapValuesTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMatchTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMaxTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMeanTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMinTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyOrderTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPageRankTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPeerPressureTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyProfileTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyProgramTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyProjectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPropertiesTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySelectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySumTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyUnfoldTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyValueMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyVertexTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyAggregateTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyExplainTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupCountTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTestV3d0; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyInjectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySackTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySideEffectCapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySideEffectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyStoreTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySubgraphTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyTreeTest; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.RunnerBuilder; - -/** - * The {@code GroovyProcessComputerSuite} is a JUnit test runner that executes the Gremlin Test Suite over a - * {@link Graph} implementation. This test suite covers traversal operations around {@link GraphComputer} and should - * be implemented by providers to validate that their implementations are compliant with the Groovy flavor of the - * Gremlin language. Implementations that use this test suite should return {@code true} for - * {@link Graph.Features.GraphFeatures#supportsComputer()}. - * <p/> - * For more information on the usage of this suite, please see {@link StructureStandardSuite}. - * - * @author Stephen Mallette (http://stephen.genoprime.com) - * @deprecated As of release 3.2.4, not replaced as a test suite that Graph Providers need to implement. - */ -@Deprecated -public class GroovyProcessComputerSuite extends ProcessComputerSuite { - - /** - * This list of tests in the suite that will be executed. Gremlin developers should add to this list - * as needed to enforce tests upon implementations. - */ - private static final Class<?>[] allTests = new Class<?>[]{ - - //branch - GroovyBranchTest.Traversals.class, - GroovyChooseTest.Traversals.class, - GroovyOptionalTest.Traversals.class, - GroovyLocalTest.Traversals.class, - GroovyRepeatTest.Traversals.class, - GroovyUnionTest.Traversals.class, - - // filter - GroovyAndTest.Traversals.class, - GroovyCoinTest.Traversals.class, - GroovyCyclicPathTest.Traversals.class, - GroovyDedupTest.Traversals.class, - GroovyFilterTest.Traversals.class, - GroovyHasTest.Traversals.class, - GroovyIsTest.Traversals.class, - GroovyOrTest.Traversals.class, - GroovyRangeTest.Traversals.class, - GroovySampleTest.Traversals.class, - GroovySimplePathTest.Traversals.class, - GroovyTailTest.Traversals.class, - GroovyWhereTest.Traversals.class, - - // map - GroovyCoalesceTest.Traversals.class, - GroovyConstantTest.Traversals.class, - GroovyCountTest.Traversals.class, - GroovyFlatMapTest.Traversals.class, - GroovyFoldTest.Traversals.class, - GroovyGraphTest.Traversals.class, - GroovyLoopsTest.Traversals.class, - GroovyMapTest.Traversals.class, - GroovyMapKeysTest.Traversals.class, - GroovyMapValuesTest.Traversals.class, - GroovyMatchTest.CountMatchTraversals.class, - GroovyMatchTest.GreedyMatchTraversals.class, - GroovyMaxTest.Traversals.class, - GroovyMeanTest.Traversals.class, - GroovyMinTest.Traversals.class, - GroovyOrderTest.Traversals.class, - GroovyPageRankTest.Traversals.class, - GroovyPathTest.Traversals.class, - GroovyPeerPressureTest.Traversals.class, - GroovyProfileTest.Traversals.class, - GroovyProjectTest.Traversals.class, - GroovyProgramTest.Traversals.class, - GroovyPropertiesTest.Traversals.class, - GroovySelectTest.Traversals.class, - GroovySumTest.Traversals.class, - GroovyUnfoldTest.Traversals.class, - GroovyValueMapTest.Traversals.class, - GroovyVertexTest.Traversals.class, - - // sideEffect - GroovyAddEdgeTest.Traversals.class, - GroovyAggregateTest.Traversals.class, - GroovyExplainTest.Traversals.class, - GroovyGroupTest.Traversals.class, - GroovyGroupTestV3d0.Traversals.class, - GroovyGroupCountTest.Traversals.class, - GroovyInjectTest.Traversals.class, - GroovyProfileTest.Traversals.class, - GroovySackTest.Traversals.class, - GroovySideEffectCapTest.Traversals.class, - GroovySideEffectTest.Traversals.class, - GroovyStoreTest.Traversals.class, - GroovySubgraphTest.Traversals.class, - GroovyTreeTest.Traversals.class, - }; - - public GroovyProcessComputerSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError { - super(klass, builder, allTests); - } - - @Override - public boolean beforeTestExecution(final Class<? extends AbstractGremlinTest> testClass) { - unloadSugar(); - SugarLoader.load(); - return true; - } - - @Override - public void afterTestExecution(final Class<? extends AbstractGremlinTest> testClass) { - unloadSugar(); - } - - private void unloadSugar() { - try { - SugarTestHelper.clearRegistry(GraphManager.getGraphProvider()); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java b/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java deleted file mode 100644 index 45aea91..0000000 --- a/gremlin-groovy-test/src/main/java/org/apache/tinkerpop/gremlin/process/GroovyProcessStandardSuite.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * 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.process; - -import org.apache.tinkerpop.gremlin.AbstractGremlinTest; -import org.apache.tinkerpop.gremlin.GraphManager; -import org.apache.tinkerpop.gremlin.groovy.loaders.SugarLoader; -import org.apache.tinkerpop.gremlin.groovy.util.SugarTestHelper; -import org.apache.tinkerpop.gremlin.process.traversal.CoreTraversalTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyBranchTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyChooseTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyOptionalTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyLocalTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyRepeatTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.branch.GroovyUnionTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyAndTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyCoinTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyCyclicPathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyDedupTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyDropTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyFilterTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyHasTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyIsTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyOrTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyRangeTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySampleTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovySimplePathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyTailTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.filter.GroovyWhereTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyAddEdgeTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyAddVertexTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCoalesceTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyConstantTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyCountTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFlatMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyFoldTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyGraphTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyLoopsTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapKeysTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMapValuesTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMatchTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMaxTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMeanTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyMinTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyOrderTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPathTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyProfileTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyProjectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyPropertiesTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySelectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovySumTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyUnfoldTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyValueMapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.map.GroovyVertexTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyAggregateTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyExplainTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupCountTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyGroupTestV3d0; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyInjectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySackTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySideEffectCapTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySideEffectTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyStoreTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovySubgraphTest; -import org.apache.tinkerpop.gremlin.process.traversal.step.sideEffect.GroovyTreeTest; -import org.apache.tinkerpop.gremlin.structure.Graph; -import org.apache.tinkerpop.gremlin.structure.StructureStandardSuite; -import org.junit.runners.model.InitializationError; -import org.junit.runners.model.RunnerBuilder; - -/** - * The {@code GroovyProcessStandardSuite} is a JUnit test runner that executes the Gremlin Test Suite over a - * {@link Graph} implementation. This test suite covers traversal operations and should be implemented by providers - * to validate that their implementations are compliant with the Groovy flavor of the Gremlin language. - * <p/> - * For more information on the usage of this suite, please see {@link StructureStandardSuite}. - * - * @author Stephen Mallette (http://stephen.genoprime.com) - * @deprecated As of release 3.2.4, not replaced as a test suite that Graph Providers need to implement. - */ -@Deprecated -public class GroovyProcessStandardSuite extends ProcessStandardSuite { - - /** - * This list of tests in the suite that will be executed. Gremlin developers should add to this list - * as needed to enforce tests upon implementations. - */ - private static final Class<?>[] allTests = new Class<?>[]{ - // branch - GroovyBranchTest.Traversals.class, - GroovyChooseTest.Traversals.class, - GroovyOptionalTest.Traversals.class, - GroovyLocalTest.Traversals.class, - GroovyRepeatTest.Traversals.class, - GroovyUnionTest.Traversals.class, - // filter - GroovyAndTest.Traversals.class, - GroovyCoinTest.Traversals.class, - GroovyCyclicPathTest.Traversals.class, - GroovyDedupTest.Traversals.class, - GroovyDropTest.Traversals.class, - GroovyFilterTest.Traversals.class, - GroovyHasTest.Traversals.class, - GroovyIsTest.Traversals.class, - GroovyOrTest.Traversals.class, - GroovyRangeTest.Traversals.class, - GroovySampleTest.Traversals.class, - GroovySimplePathTest.Traversals.class, - GroovyTailTest.Traversals.class, - GroovyWhereTest.Traversals.class, - // map - GroovyAddEdgeTest.Traversals.class, - GroovyAddVertexTest.Traversals.class, - GroovyCoalesceTest.Traversals.class, - GroovyConstantTest.Traversals.class, - GroovyCountTest.Traversals.class, - GroovyFoldTest.Traversals.class, - GroovyFlatMapTest.Traversals.class, - GroovyGraphTest.Traversals.class, - GroovyLoopsTest.Traversals.class, - GroovyMapTest.Traversals.class, - GroovyMapKeysTest.Traversals.class, - GroovyMapValuesTest.Traversals.class, - GroovyMatchTest.CountMatchTraversals.class, - GroovyMatchTest.GreedyMatchTraversals.class, - GroovyMaxTest.Traversals.class, - GroovyMeanTest.Traversals.class, - GroovyMinTest.Traversals.class, - GroovyOrderTest.Traversals.class, - GroovyProfileTest.Traversals.class, - GroovyProjectTest.Traversals.class, - GroovyPathTest.Traversals.class, - GroovyPropertiesTest.Traversals.class, - GroovySelectTest.Traversals.class, - GroovySumTest.Traversals.class, - GroovyUnfoldTest.Traversals.class, - GroovyValueMapTest.Traversals.class, - GroovyVertexTest.Traversals.class, - // sideEffect - GroovyAggregateTest.Traversals.class, - GroovyExplainTest.Traversals.class, - GroovyGroupTest.Traversals.class, - GroovyGroupTestV3d0.Traversals.class, - GroovyGroupCountTest.Traversals.class, - GroovyInjectTest.Traversals.class, - GroovySackTest.Traversals.class, - GroovySideEffectCapTest.Traversals.class, - GroovySideEffectTest.Traversals.class, - GroovyStoreTest.Traversals.class, - GroovySubgraphTest.Traversals.class, - GroovyTreeTest.Traversals.class, - - // compliance - CoreTraversalTest.class, - }; - - public GroovyProcessStandardSuite(final Class<?> klass, final RunnerBuilder builder) throws InitializationError { - super(klass, builder, allTests); - } - - @Override - public boolean beforeTestExecution(final Class<? extends AbstractGremlinTest> testClass) { - unloadSugar(); - SugarLoader.load(); - return true; - } - - @Override - public void afterTestExecution(final Class<? extends AbstractGremlinTest> testClass) { - unloadSugar(); - } - - private void unloadSugar() { - try { - SugarTestHelper.clearRegistry(GraphManager.getGraphProvider()); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } -} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory b/gremlin-groovy-test/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory deleted file mode 100644 index 24c8a75..0000000 --- a/gremlin-groovy-test/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory +++ /dev/null @@ -1 +0,0 @@ -org.apache.tinkerpop.gremlin.groovy.jsr223.GremlinGroovyScriptEngineFactory http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy b/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy deleted file mode 100644 index c320195..0000000 --- a/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorInit.groovy +++ /dev/null @@ -1,19 +0,0 @@ -/* - * 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. - */ -def add(x, y) { x + y } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/jsr223/sandbox.yaml ---------------------------------------------------------------------- diff --git a/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/jsr223/sandbox.yaml b/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/jsr223/sandbox.yaml deleted file mode 100644 index b2b7f67..0000000 --- a/gremlin-groovy-test/src/main/resources/org/apache/tinkerpop/gremlin/groovy/jsr223/sandbox.yaml +++ /dev/null @@ -1,58 +0,0 @@ -# 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. - -# This is an example configuration for the FileSandboxExtension. - -autoTypeUnknown: true -methodWhiteList: - - java\.lang\.Boolean.* - - java\.lang\.Byte.* - - java\.lang\.Character.* - - java\.lang\.Double.* - - java\.lang\.Enum.* - - java\.lang\.Float.* - - java\.lang\.Integer.* - - java\.lang\.Long.* - - java\.lang\.Math.* - - java\.lang\.Number.* - - java\.lang\.Object.* - - java\.lang\.Short.* - - java\.lang\.String.* - - java\.lang\.StringBuffer.* - - java\.lang\.System#currentTimeMillis\(\) - - java\.lang\.System#nanoTime\(\) - - java\.lang\.Throwable.* - - java\.lang\.Void.* - - java\.util\..* - - org\.codehaus\.groovy\.runtime\.DefaultGroovyMethods.* - - org\.codehaus\.groovy\.runtime\.InvokerHelper#runScript\(java\.lang\.Class,java\.lang\.String\[\]\) - - org\.codehaus\.groovy\.runtime\.StringGroovyMethods.* - - groovy\.lang\.Script#<init>\(groovy.lang.Binding\) - - org\.apache\.tinkerpop\.gremlin\.structure\..* - - org\.apache\.tinkerpop\.gremlin\.process\..* - - org\.apache\.tinkerpop\.gremlin\.process\.computer\..* - - org\.apache\.tinkerpop\.gremlin\.process\.computer\.bulkloading\..* - - org\.apache\.tinkerpop\.gremlin\.process\.computer\.clustering\.peerpressure\.* - - org\.apache\.tinkerpop\.gremlin\.process\.computer\.ranking\.pagerank\.* - - org\.apache\.tinkerpop\.gremlin\.process\.computer\.traversal\..* - - org\.apache\.tinkerpop\.gremlin\.process\.traversal\..* - - org\.apache\.tinkerpop\.gremlin\.process\.traversal\.dsl\.graph\..* - - org\.apache\.tinkerpop\.gremlin\.process\.traversal\.engine\..* - - org\.apache\.tinkerpop\.gremlin\.server\.util\.LifeCycleHook.* -staticVariableTypes: - graph: org.apache.tinkerpop.gremlin.structure.Graph - g: org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/pom.xml ---------------------------------------------------------------------- diff --git a/gremlin-groovy/pom.xml b/gremlin-groovy/pom.xml index dfda50a..6b8f477 100644 --- a/gremlin-groovy/pom.xml +++ b/gremlin-groovy/pom.xml @@ -72,6 +72,12 @@ limitations under the License. </dependency> <!-- TEST --> <dependency> + <groupId>org.apache.tinkerpop</groupId> + <artifactId>tinkergraph-gremlin</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <scope>test</scope> http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy b/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy new file mode 100644 index 0000000..dd0e5f1 --- /dev/null +++ b/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/loaders/SugarLoaderTest.groovy @@ -0,0 +1,140 @@ +/* + * 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.groovy.loaders + +import org.apache.tinkerpop.gremlin.groovy.util.SugarTestHelper +import org.apache.tinkerpop.gremlin.process.traversal.Traversal +import org.apache.tinkerpop.gremlin.structure.* +import org.apache.tinkerpop.gremlin.structure.util.StringFactory +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory +import org.junit.Before +import org.junit.Test + +import static org.apache.tinkerpop.gremlin.process.traversal.P.eq +import static org.junit.Assert.* + +/** + * @author Marko A. Rodriguez (http://markorodriguez.com) + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +class SugarLoaderTest { + + @Before + public void setup() throws Exception { + SugarTestHelper.clearRegistry() + } + + @Test + public void shouldNotAllowSugar() { + def graph = TinkerFactory.createModern() + def g = graph.traversal() + SugarTestHelper.clearRegistry() + try { + g.V + fail("Without sugar loaded, the traversal should fail"); + } catch (MissingPropertyException e) { + + } catch (Exception e) { + fail("Should fail with a MissingPropertyException: " + e) + } + + try { + g.V().out + fail("Without sugar loaded, the traversal should fail"); + } catch (MissingPropertyException e) { + + } catch (Exception e) { + fail("Should fail with a MissingPropertyException:" + e) + } + + try { + g.V().out().name + fail("Without sugar loaded, the traversal should fail"); + } catch (MissingPropertyException e) { + + } catch (Exception e) { + fail("Should fail with a MissingPropertyException: " + e) + } + } + + @Test + public void shouldAllowSugar() { + def graph = TinkerFactory.createModern() + def g = graph.traversal() + SugarLoader.load() + assertEquals(6, g.V.count.next()) + assertEquals(6, g.V.out.count.next()) + assertEquals(6, g.V.out.name.count.next()) + assertEquals(2, g.V(convertToVertexId(graph, "marko")).out.out.name.count.next()); + final Object markoId = convertToVertexId(graph, "marko"); + g.V(markoId).next().name = 'okram' + assertEquals('okram', g.V(markoId).next().name); + assertEquals(29, g.V.age.is(eq(29)).next()) + if (graph.features().vertex().supportsMultiProperties()) { + g.V(markoId).next()['name'] = 'marko a. rodriguez' + assertEquals(["okram", "marko a. rodriguez"] as Set, g.V(markoId).values('name').toSet()); + } + } + + @Test + public void shouldUseTraverserCategoryCorrectly() { + def graph = TinkerFactory.createModern() + def g = graph.traversal() + SugarLoader.load() + final Traversal t = g.V.as('a').out.as('x').name.as('b').select('x').has('age').map { + [it.path().a, it.path().b, it.age] + }; + assertTrue(t.hasNext()) + t.forEachRemaining { + assertTrue(it[0] instanceof Vertex) + assertTrue(it[1] instanceof String) + assertTrue(it[2] instanceof Integer) + }; + } + + @Test + public void shouldHaveProperToStringOfMixins() { + def graph = TinkerFactory.createModern() + def g = graph.traversal() + SugarLoader.load(); + final Vertex vertex = graph.vertices().next(); + final Edge edge = graph.edges().next(); + final VertexProperty vertexProperty = vertex.property('name'); + final Property property = edge.property('weight'); + + assertEquals(StringFactory.vertexString(vertex), vertex.toString()); + assertEquals(StringFactory.edgeString(edge), edge.toString()); + assertEquals(StringFactory.propertyString(vertexProperty), vertexProperty.toString()); + assertEquals(StringFactory.propertyString(property), property.toString()); + assertEquals(StringFactory.traversalSourceString(g), g.toString()); + //assertEquals(StringFactory.traversalSourceString(g.withPath()), g.withPath().toString()); + assertEquals(StringFactory.traversalString(g.V().out().asAdmin()), g.V().out().toString()); + assertEquals(StringFactory.traversalString(g.V.out), g.V.out.toString()); + assertEquals(convertToVertex(graph, "marko").toString(), g.V(convertToVertexId(graph, "marko")).next().toString()) + } + + private Object convertToVertexId(final Graph graph, final String vertexName) { + return convertToVertex(graph, vertexName).id(); + } + + private Vertex convertToVertex(final Graph graph, final String vertexName) { + // all test graphs have "name" as a unique id which makes it easy to hardcode this...works for now + return graph.traversal().V().has("name", vertexName).next(); + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/util/SugarTestHelper.groovy ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/util/SugarTestHelper.groovy b/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/util/SugarTestHelper.groovy new file mode 100644 index 0000000..cf2db11 --- /dev/null +++ b/gremlin-groovy/src/test/groovy/org/apache/tinkerpop/gremlin/groovy/util/SugarTestHelper.groovy @@ -0,0 +1,74 @@ +/* + * 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.groovy.util + +import org.apache.tinkerpop.gremlin.GraphProvider +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.DefaultGraphTraversal +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.__ +import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_LP_O_P_S_SE_SL_Traverser +import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_LP_O_S_SE_SL_Traverser +import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_S_SE_SL_Traverser +import org.apache.tinkerpop.gremlin.process.traversal.traverser.B_O_Traverser +import org.apache.tinkerpop.gremlin.process.traversal.traverser.O_Traverser +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerEdge +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerElement +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraphVariables +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerProperty +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertex +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerVertexProperty + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +final class SugarTestHelper { + + public static final Set<Class> CORE_IMPLEMENTATIONS = new HashSet<Class>() {{ + add(__.class); + add(DefaultGraphTraversal.class); + add(GraphTraversalSource.class); + add(B_O_S_SE_SL_Traverser.class); + add(B_LP_O_P_S_SE_SL_Traverser.class); + add(B_LP_O_S_SE_SL_Traverser.class); + add(B_O_Traverser.class); + add(O_Traverser.class); + }}; + + + private static final Set<Class> IMPLEMENTATION = new HashSet<Class>() {{ + add(TinkerEdge.class); + add(TinkerElement.class); + add(TinkerGraph.class); + add(TinkerGraphVariables.class); + add(TinkerProperty.class); + add(TinkerVertex.class); + add(TinkerVertexProperty.class); + }}; + + /** + * Clear the metaclass registry to "turn-off" sugar. + */ + public static void clearRegistry() { + final Set<Class> implementationsToClear = new HashSet<>(CORE_IMPLEMENTATIONS) + implementationsToClear.addAll(IMPLEMENTATION); + + MetaRegistryUtil.clearRegistry(implementationsToClear) + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorOverGraphTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorOverGraphTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorOverGraphTest.java new file mode 100644 index 0000000..295ca74 --- /dev/null +++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/engine/GremlinExecutorOverGraphTest.java @@ -0,0 +1,113 @@ +/* + * 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.groovy.engine; + +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.apache.tinkerpop.gremlin.LoadGraphWith; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.junit.Test; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.junit.Assert.assertEquals; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class GremlinExecutorOverGraphTest { + private final BasicThreadFactory testingThreadFactory = new BasicThreadFactory.Builder().namingPattern("test-gremlin-executor-%d").build(); + + @Test + public void shouldAllowTraversalToIterateInDifferentThreadThanOriginallyEvaluatedWithAutoCommit() throws Exception { + final TinkerGraph graph = TinkerFactory.createModern(); + final GraphTraversalSource g = graph.traversal(); + + // this test sort of simulates Gremlin Server interaction where a Traversal is eval'd in one Thread, but + // then iterated in another. note that Gremlin Server configures the script engine to auto-commit + // after evaluation. this basically tests the state of the Gremlin Server GremlinExecutor when + // being used in sessionless mode + final ExecutorService evalExecutor = Executors.newSingleThreadExecutor(testingThreadFactory); + final GremlinExecutor gremlinExecutor = GremlinExecutor.build() + .afterSuccess(b -> { + final GraphTraversalSource ig = (GraphTraversalSource) b.get("g"); + if (ig.getGraph().features().graph().supportsTransactions()) + ig.tx().commit(); + }) + .executorService(evalExecutor).create(); + + final Map<String,Object> bindings = new HashMap<>(); + bindings.put("g", g); + + final AtomicInteger vertexCount = new AtomicInteger(0); + + final ExecutorService iterationExecutor = Executors.newSingleThreadExecutor(testingThreadFactory); + gremlinExecutor.eval("g.V().out()", bindings).thenAcceptAsync(o -> { + final Iterator itty = (Iterator) o; + itty.forEachRemaining(v -> vertexCount.incrementAndGet()); + }, iterationExecutor).join(); + + assertEquals(6, vertexCount.get()); + + gremlinExecutor.close(); + evalExecutor.shutdown(); + evalExecutor.awaitTermination(30000, TimeUnit.MILLISECONDS); + iterationExecutor.shutdown(); + iterationExecutor.awaitTermination(30000, TimeUnit.MILLISECONDS); + } + + @Test + @LoadGraphWith(LoadGraphWith.GraphData.MODERN) + public void shouldAllowTraversalToIterateInDifferentThreadThanOriginallyEvaluatedWithoutAutoCommit() throws Exception { + final TinkerGraph graph = TinkerFactory.createModern(); + final GraphTraversalSource g = graph.traversal(); + + // this test sort of simulates Gremlin Server interaction where a Traversal is eval'd in one Thread, but + // then iterated in another. this basically tests the state of the Gremlin Server GremlinExecutor when + // being used in session mode + final ExecutorService evalExecutor = Executors.newSingleThreadExecutor(testingThreadFactory); + final GremlinExecutor gremlinExecutor = GremlinExecutor.build().executorService(evalExecutor).create(); + + final Map<String,Object> bindings = new HashMap<>(); + bindings.put("g", g); + + final AtomicInteger vertexCount = new AtomicInteger(0); + + final ExecutorService iterationExecutor = Executors.newSingleThreadExecutor(testingThreadFactory); + gremlinExecutor.eval("g.V().out()", bindings).thenAcceptAsync(o -> { + final Iterator itty = (Iterator) o; + itty.forEachRemaining(v -> vertexCount.incrementAndGet()); + }, iterationExecutor).join(); + + assertEquals(6, vertexCount.get()); + + gremlinExecutor.close(); + evalExecutor.shutdown(); + evalExecutor.awaitTermination(30000, TimeUnit.MILLISECONDS); + iterationExecutor.shutdown(); + iterationExecutor.awaitTermination(30000, TimeUnit.MILLISECONDS); + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java new file mode 100644 index 0000000..6018a48 --- /dev/null +++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineFileSandboxTest.java @@ -0,0 +1,136 @@ +/* + * 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.groovy.jsr223; + +import org.apache.tinkerpop.gremlin.LoadGraphWith; +import org.apache.tinkerpop.gremlin.TestHelper; +import org.apache.tinkerpop.gremlin.groovy.CompilerCustomizerProvider; +import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.CompileStaticCustomizerProvider; +import org.apache.tinkerpop.gremlin.groovy.jsr223.customizer.FileSandboxExtension; +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.structure.Vertex; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph; +import org.codehaus.groovy.control.MultipleCompilationErrorsException; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.Test; + +import javax.script.Bindings; +import java.io.File; +import java.util.Arrays; + +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.containsString; +import static org.hamcrest.Matchers.greaterThan; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; +import static org.junit.Assert.fail; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class GremlinGroovyScriptEngineFileSandboxTest { + + private Graph graph; + private GraphTraversalSource g; + + @Before + public void setup() throws Exception { + graph = TinkerFactory.createModern(); + g = graph.traversal(); + if (System.getProperty(FileSandboxExtension.GREMLIN_SERVER_SANDBOX) == null) { + final File f = TestHelper.generateTempFileFromResource(TinkerGraph.class, GremlinGroovyScriptEngineFileSandboxTest.class, "sandbox.yaml", ".yaml"); + System.setProperty(FileSandboxExtension.GREMLIN_SERVER_SANDBOX, f.getAbsolutePath()); + } + } + + @AfterClass + public static void destroy() { + System.clearProperty(FileSandboxExtension.GREMLIN_SERVER_SANDBOX); + } + + @Test + public void shouldEvalAsTheMethodIsWhiteListed() throws Exception { + final CompilerCustomizerProvider standardSandbox = new CompileStaticCustomizerProvider(FileSandboxExtension.class.getName()); + try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) { + assertEquals(123, engine.eval("java.lang.Math.abs(-123)")); + assertThat(engine.eval("new Boolean(true)"), is(true)); + assertThat(engine.eval("new Boolean(true).toString()"), is("true")); + } + } + + @Test + public void shouldEvalAsGroovyPropertiesWhenWhiteListed() throws Exception { + final CompilerCustomizerProvider standardSandbox = new CompileStaticCustomizerProvider(FileSandboxExtension.class.getName()); + try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) { + assertThat(Arrays.equals("test".getBytes(), (byte[]) engine.eval("'test'.bytes")), is(true)); + } + } + + @Test + public void shouldPreventMaliciousStuffWithSystemButAllowSomeMethodsOnSystem() throws Exception { + final CompilerCustomizerProvider standardSandbox = new CompileStaticCustomizerProvider(FileSandboxExtension.class.getName()); + try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) { + assertThat((long) engine.eval("System.currentTimeMillis()"), greaterThan(0l)); + assertThat((long) engine.eval("System.nanoTime()"), greaterThan(0l)); + + engine.eval("System.exit(0)"); + fail("Should have a compile error because class/method is not white listed"); + } catch (Exception ex) { + assertEquals(MultipleCompilationErrorsException.class, ex.getCause().getClass()); + assertThat(ex.getCause().getMessage(), containsString("Not authorized to call this method")); + } + } + + @Test + public void shouldPreventMaliciousStuffWithFile() throws Exception { + final CompilerCustomizerProvider standardSandbox = new CompileStaticCustomizerProvider(FileSandboxExtension.class.getName()); + try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) { + engine.eval("java.nio.file.FileSystems.getDefault()"); + fail("Should have a compile error because class/method is not white listed"); + } catch (Exception ex) { + assertEquals(MultipleCompilationErrorsException.class, ex.getCause().getClass()); + assertThat(ex.getCause().getMessage(), containsString("Not authorized to call this method")); + } + } + + @Test + @LoadGraphWith(LoadGraphWith.GraphData.MODERN) + public void shouldEvalOnGAsTheMethodIsWhiteListed() throws Exception { + final CompilerCustomizerProvider standardSandbox = new CompileStaticCustomizerProvider(FileSandboxExtension.class.getName()); + try (GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(standardSandbox)) { + final Bindings bindings = engine.createBindings(); + bindings.put("g", g); + bindings.put("marko", convertToVertexId(graph, "marko")); + assertEquals(g.V(convertToVertexId(graph, "marko")).next(), engine.eval("g.V(marko).next()", bindings)); + assertEquals(g.V(convertToVertexId(graph, "marko")).out("created").count().next(), engine.eval("g.V(marko).out(\"created\").count().next()", bindings)); + } + } + + private Object convertToVertexId(final Graph graph, final String vertexName) { + return convertToVertex(graph, vertexName).id(); + } + + private Vertex convertToVertex(final Graph graph, final String vertexName) { + // all test graphs have "name" as a unique id which makes it easy to hardcode this...works for now + return graph.traversal().V().has("name", vertexName).next(); + } +} http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/34bbd6a1/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java ---------------------------------------------------------------------- diff --git a/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java new file mode 100644 index 0000000..273be12 --- /dev/null +++ b/gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineIntegrateTest.java @@ -0,0 +1,88 @@ +/* + * 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.groovy.jsr223; + +import org.apache.tinkerpop.gremlin.process.traversal.dsl.graph.GraphTraversalSource; +import org.apache.tinkerpop.gremlin.structure.Graph; +import org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerFactory; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.script.Bindings; +import javax.script.ScriptException; + +import static org.junit.Assert.fail; + +/** + * @author Stephen Mallette (http://stephen.genoprime.com) + */ +public class GremlinGroovyScriptEngineIntegrateTest { + private static final Logger logger = LoggerFactory.getLogger(GremlinGroovyScriptEngineIntegrateTest.class); + + @Test + public void shouldNotBlowTheHeapParameterized() throws ScriptException { + final Graph graph = TinkerFactory.createModern(); + final GraphTraversalSource g = graph.traversal(); + final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(); + + final String[] gremlins = new String[]{ + "g.V(xxx).out().toList()", + "g.V(xxx).in().toList()", + "g.V(xxx).out().out().out().toList()", + "g.V(xxx).out().groupCount()" + }; + + long parameterizedStartTime = System.currentTimeMillis(); + logger.info("Try to blow the heap with parameterized Gremlin."); + try { + for (int ix = 0; ix < 50001; ix++) { + final Bindings bindings = engine.createBindings(); + bindings.put("g", g); + bindings.put("xxx", (ix % 4) + 1); + engine.eval(gremlins[ix % 4], bindings); + + if (ix > 0 && ix % 5000 == 0) { + logger.info(String.format("%s scripts processed in %s (ms) - rate %s (ms/q).", ix, System.currentTimeMillis() - parameterizedStartTime, Double.valueOf(System.currentTimeMillis() - parameterizedStartTime) / Double.valueOf(ix))); + } + } + } catch (OutOfMemoryError oome) { + fail("Blew the heap - the cache should prevent this from happening."); + } + } + + @Test + public void shouldNotBlowTheHeapUnparameterized() throws ScriptException { + final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(); + long notParameterizedStartTime = System.currentTimeMillis(); + logger.info("Try to blow the heap with non-parameterized Gremlin."); + try { + for (int ix = 0; ix < 15001; ix++) { + final Bindings bindings = engine.createBindings(); + engine.eval(String.format("1+%s", ix), bindings); + if (ix > 0 && ix % 5000 == 0) { + logger.info(String.format("%s scripts processed in %s (ms) - rate %s (ms/q).", ix, System.currentTimeMillis() - notParameterizedStartTime, Double.valueOf(System.currentTimeMillis() - notParameterizedStartTime) / Double.valueOf(ix))); + } + } + } catch (OutOfMemoryError oome) { + fail("Blew the heap - the cache should prevent this from happening."); + } + } + +}