Examples of SimpleBindings


Examples of javax.script.SimpleBindings

        try {
            new TestScriptEngine(null);
            fail("Should have thrown NPE");
        } catch (NullPointerException expected) {
        }
        Bindings b = new SimpleBindings();
        new TestScriptEngine(b); // should be OK
    }
View Full Code Here

Examples of javax.script.SimpleBindings

            engine.setBindings(null, ScriptContext.ENGINE_SCOPE);
            fail("Should have generated NPE");
        } catch (NullPointerException e) {
        }
        engine.setBindings(null, ScriptContext.GLOBAL_SCOPE); // should be OK
        Bindings bindings = new SimpleBindings();
        engine.setBindings(bindings , ScriptContext.ENGINE_SCOPE);
        engine.setBindings(bindings , ScriptContext.GLOBAL_SCOPE);
    }
View Full Code Here

Examples of javax.script.SimpleBindings

        }
        assertNotNull(engine.getBindings(ScriptContext.ENGINE_SCOPE));
        assertNull(engine.getBindings(ScriptContext.GLOBAL_SCOPE)); // null is the default
        engine.setBindings(null, ScriptContext.GLOBAL_SCOPE);// null is allowed here
        assertNull(engine.getBindings(ScriptContext.GLOBAL_SCOPE));
        engine.setBindings(new SimpleBindings(), ScriptContext.GLOBAL_SCOPE);
        assertNotNull(engine.getBindings(ScriptContext.GLOBAL_SCOPE));
    }
View Full Code Here

Examples of javax.script.SimpleBindings

        try {
            engine.getScriptContext(null);
            fail("Should have caused NPE");
        } catch (NullPointerException e) {
        }
        final SimpleBindings bindings = new SimpleBindings();
        ScriptContext sc = engine.getScriptContext(bindings);
        assertEquals(bindings, sc.getBindings(ScriptContext.ENGINE_SCOPE));
        assertNull(sc.getBindings(ScriptContext.GLOBAL_SCOPE));
    }
View Full Code Here

Examples of javax.script.SimpleBindings

        try {
            mgr.setBindings(null);
            fail("Expected IllegalArgumentException");
        } catch (IllegalArgumentException e) {
        }
        final SimpleBindings bindings = new SimpleBindings();
        assertNotSame(bindings, mgr.getBindings());
        mgr.setBindings(bindings);
        assertSame(bindings, mgr.getBindings());
    }
View Full Code Here

Examples of javax.script.SimpleBindings

    public ScriptContext getScriptContext(Bindings bindings){
        return super.getScriptContext(bindings);
    }

    public Bindings createBindings() {
        return new SimpleBindings();
    }
View Full Code Here

Examples of javax.script.SimpleBindings

        }
    }
   
    @Override
    public Bindings createBindings() {
        return new SimpleBindings();
    }
View Full Code Here

Examples of javax.script.SimpleBindings

                if (scriptEngine == null) {
                    throw new SerializationException("Script engine for \"" + language + "\" not found.");
                }

                // Don't pollute the engine namespace with the listener functions
                scriptEngine.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);

                try {
                    scriptEngine.eval(script);
                } catch (ScriptException exception) {
                    System.err.println(exception);
View Full Code Here

Examples of javax.script.SimpleBindings

            Object result = null;

            String methodName = method.getName();
            if (methodName.equals(event)) {
                try {
                    SimpleBindings bindings = new SimpleBindings();
                    bindings.put(ARGUMENTS_KEY, args);
                    scriptEngine.setBindings(bindings, ScriptContext.ENGINE_SCOPE);
                    scriptEngine.eval(script);
                } catch (ScriptException exception) {
                    System.err.println(exception);
                    System.err.println(script);
View Full Code Here

Examples of javax.script.SimpleBindings

            protected ScriptEngine createScriptEngine() {
                return engine;
            }
        };

        EasyMock.expect(engine.createBindings()).andReturn(new SimpleBindings());
        engine.setContext((ScriptContext) EasyMock.anyObject());
        EasyMock.expect(engine.eval((Reader) EasyMock.anyObject())).andReturn(null);
        EasyMock.replay(engine);

        scriptedView.setEngineName("test-engine");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.