APISonar


org.codehaus.groovy.tools.shell.IO.IO

> org > codehaus > groovy > tools > shell > IO > IO
org APIs codehaus APIs groovy APIs tools APIs shell APIs IO APIs IO APIs

Example 1
public void shouldConstructRemoteAcceptorWhenInConsoleEnvironment() throws Exception {
        final DriverGremlinPlugin plugin = new DriverGremlinPlugin();
        final Map<String, Object> env = new HashMap<>();
        env.put("ConsolePluginAcceptor.io", new IO());
        env.put("ConsolePluginAcceptor.shell", new Groovysh());
        final SpyPluginAcceptor spy = new SpyPluginAcceptor(() -> env);
        plugin.pluginTo(spy);

        assertThat(plugin.remoteAcceptor().isPresent(), is(true));
    }
Example 2
public void shouldPluginUtilities() throws Exception {
        final UtilitiesGremlinPlugin plugin = new UtilitiesGremlinPlugin();

        final Groovysh groovysh = new Groovysh();
        groovysh.getInterp().getContext().setProperty("g", TinkerFactory.createClassic());

        final Map<String, Object> env = new HashMap<>();
        env.put("ConsolePluginAcceptor.io", new IO());
        env.put("ConsolePluginAcceptor.shell", groovysh);

        final SpyPluginAcceptor spy = new SpyPluginAcceptor(groovysh::execute, () -> env);
        plugin.pluginTo(spy);

        assertThat(groovysh.execute("describeGraph(org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph)").toString(), containsString("IMPLEMENTATION - org.apache.tinkerpop.gremlin.tinkergraph.structure.TinkerGraph"));
    }