use of org.apache.bsf.BSFEngine in project groovy by apache.
the class BSFSpecTest method testAccess.
@Test
public void testAccess() throws BSFException {
// tag::bsf_access[]
BSFManager manager = new BSFManager();
BSFEngine bsfEngine = manager.loadScriptingEngine("groovy");
manager.declareBean("myvar", "hello", String.class);
Object myvar = manager.lookupBean("myvar");
String result = (String) bsfEngine.call(myvar, "reverse", new Object[0]);
assertEquals("olleh", result);
// end::bsf_access[]
}
use of org.apache.bsf.BSFEngine in project groovy by apache.
the class BSFTest method testCall.
public void testCall() throws Exception {
BSFEngine bsfEngine = manager.loadScriptingEngine("groovy");
manager.declareBean("myvar", "hello", String.class);
Object myvar = manager.lookupBean("myvar");
String result = (String) bsfEngine.call(myvar, "reverse", new Object[] {});
assertEquals("olleh", result);
}
use of org.apache.bsf.BSFEngine in project ant by apache.
the class ScriptRunner method createManager.
private BSFManager createManager() throws BSFException {
if (manager != null) {
return manager;
}
BSFManager m = new BSFManager();
m.setClassLoader(getScriptClassLoader());
if (getKeepEngine()) {
BSFEngine e = manager.loadScriptingEngine(getLanguage());
this.manager = m;
this.engine = e;
}
return m;
}
use of org.apache.bsf.BSFEngine in project groovy-core by groovy.
the class BSFSpecTest method testAccess.
@Test
public void testAccess() throws BSFException {
// tag::bsf_access[]
BSFManager manager = new BSFManager();
BSFEngine bsfEngine = manager.loadScriptingEngine("groovy");
manager.declareBean("myvar", "hello", String.class);
Object myvar = manager.lookupBean("myvar");
String result = (String) bsfEngine.call(myvar, "reverse", new Object[0]);
assertEquals("olleh", result);
// end::bsf_access[]
}
use of org.apache.bsf.BSFEngine in project groovy-core by groovy.
the class CacheBSFTest method testVersion.
public void testVersion() throws Exception {
// System.out.println("BSFManager.getVersion() = " + BSFManager.getVersion());
BSFEngine bsfEngine = manager.loadScriptingEngine("groovy");
assertEquals(CACHING_ENGINE, bsfEngine.getClass());
}
Aggregations