use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptRuntimeTest method testCache.
@Test
public void testCache() {
final ResourceKey script = ResourceKey.from("myapplication:/empty-test.js");
final ScriptExports exports1 = runTestScript(script);
final ScriptExports exports2 = runTestScript(script);
assertNotNull(exports2);
assertSame(exports1.getRawValue(), exports2.getRawValue());
this.scriptRuntime.invalidate(ApplicationKey.from("othermodule"));
final ScriptExports exports3 = runTestScript(script);
assertSame(exports1.getRawValue(), exports3.getRawValue());
this.scriptRuntime.invalidate(script.getApplicationKey());
final ScriptExports exports4 = runTestScript(script);
assertNotSame(exports1.getRawValue(), exports4.getRawValue());
}
use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptRuntimeTest method testRequire.
@Test
public void testRequire() {
final ResourceKey script = ResourceKey.from("myapplication:/site/require/require-test.js");
final ScriptExports exports = runTestScript(script);
assertNotNull(exports);
}
use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptRuntimeTest method testExecuteExported_objectArg.
@Test
public void testExecuteExported_objectArg() {
final ResourceKey script = ResourceKey.from("myapplication:/export-test.js");
final ScriptExports exports = runTestScript(script);
assertNotNull(exports);
assertSame(script, exports.getScript());
assertTrue(exports.hasMethod("helloObject"));
assertEquals("Hello World!", exports.executeMethod("helloObject", (MapSerializable) gen -> gen.value("name", "World")).getValue());
}
use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class NewBeanScriptTest method testEmpty.
@Test
public void testEmpty() {
final ResourceKey script = ResourceKey.from("myapplication:/bean/simple-test.js");
final ScriptExports exports = runTestScript(script);
assertNotNull(exports);
assertSame(script, exports.getScript());
}
use of com.enonic.xp.script.ScriptExports in project xp by enonic.
the class ScriptRuntimeTest method testRequire_3rd.
@Test
public void testRequire_3rd() {
final ResourceKey script = ResourceKey.from("myapplication:/site/require/3rd/require-3rd-test.js");
final ScriptExports exports = runTestScript(script);
assertNotNull(exports);
}
Aggregations