@Test public void shouldGetGlobalBindings() throws Exception { final Bindings b = new SimpleBindings(); final Object bound = new Object(); b.put("x", bound); final GremlinExecutor gremlinExecutor = GremlinExecutor.build().globalBindings(b).create(); assertEquals(bound, gremlinExecutor.getGlobalBindings().get("x")); gremlinExecutor.close(); }
@Test public void shouldInitializeWithScriptAndMakeGlobalBinding() throws Exception { final GremlinExecutor gremlinExecutor = GremlinExecutor.build() .addEngineSettings( "gremlin-groovy", Collections.emptyList(), Collections.emptyList(), Arrays.asList(PATHS.get("GremlinExecutorInit.groovy")), Collections.emptyMap()) .create(); assertEquals(2, gremlinExecutor.eval("add(1,1)").get()); assertThat(gremlinExecutor.getGlobalBindings().keySet(), not(contains("someSet"))); assertThat(gremlinExecutor.getGlobalBindings().keySet(), contains("name")); assertEquals("stephen", gremlinExecutor.getGlobalBindings().get("name")); gremlinExecutor.close(); }