@Test
    public void shouldRegisterLongCompilation() throws Exception {
        final GremlinGroovyScriptEngine engine = new GremlinGroovyScriptEngine(
                CompilationOptionsCustomizer.build().setExpectedCompilationTime(10).create());

        final int numberOfParameters = 3000;
        final Bindings b = new SimpleBindings();

        // generate a script that takes a long time to compile
        String script = "x = 0";
        for (int ix = 0; ix < numberOfParameters; ix++) {
            if (ix > 0 && ix % 100 == 0) {
                script = script + ";" + System.lineSeparator() + "x = x";
            }
            script = script + " + x" + ix;
            b.put("x" + ix, ix);
        }

        assertEquals(0, engine.getClassCacheLongRunCompilationCount());

        engine.eval(script, b);

        assertEquals(1, engine.getClassCacheLongRunCompilationCount());
    }
@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-groovy/src/test/java/org/apache/tinkerpop/gremlin/groovy/jsr223/GremlinGroovyScriptEngineCompilationOptionsTest.java