Examples of ModuleScriptProvider


Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

  @Override
  public void dispose() {
  }

  private ModuleScriptProvider getModuleScriptProvider(final Class<?> clazz) {
    return new ModuleScriptProvider() {
      @Override
      public ModuleScript getModuleScript(final Context cx,
          final String moduleId, final URI moduleUri, final URI baseUri,
          final Scriptable paths) throws IOException, URISyntaxException {
        return JavaScriptExecutorRhino.this
View Full Code Here

Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

        final File treeJavascriptFile = new File(base, "tree.js");
        FileUtils.write(treeJavascriptFile, "hello");

        final Queue asyncCallback = mock(Queue.class);
        final ScriptableObject globalScope = new NodeJsGlobal();
        final ModuleScriptProvider moduleScriptProvider = mock(ModuleScriptProvider.class);
        ModuleScript moduleScript = mock(ModuleScript.class);
        when(moduleScript.getUri()).thenReturn(treeJavascriptFile.toURI());
        when(moduleScript.getBase()).thenReturn(treeJavascriptFile.toURI());
        when(moduleScript.getScript()).thenReturn(new Script() {
            @Override
            public Object exec(Context cx, Scriptable scope) {
                return null;
            }
        });
        when(moduleScriptProvider.getModuleScript(any(Context.class), eq(treeJavascriptFile.getAbsolutePath()),
                any(URI.class), any(URI.class), any(Scriptable.class))).thenReturn(moduleScript);
        final Script pre = mock(Script.class);
        final Script post = mock(Script.class);
        final ExitCallbackExecutor exitCallbackExecutor =
                mock(ExitCallbackExecutor.class);
View Full Code Here

Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

        final File tree = folder.newFolder("tree");

        final Queue asyncCallback = mock(Queue.class);
        final ScriptableObject globalScope = new NodeJsGlobal();
        final NodeJsUrlModuleSourceProvider moduleSourceProvider = mock(NodeJsUrlModuleSourceProvider.class);
        final ModuleScriptProvider moduleScriptProvider = mock(ModuleScriptProvider.class);
        final Script pre = mock(Script.class);
        final Script post = mock(Script.class);
        final ExitCallbackExecutor exitCallbackExecutor =
                mock(ExitCallbackExecutor.class);
View Full Code Here

Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

        contextFactory.call(new ContextAction() {
            @Override
            public Object run(Context cx) {
                final Queue asyncCallback = mock(Queue.class);
                final ScriptableObject globalScope = new NodeJsGlobal(cx);
                final ModuleScriptProvider moduleScriptProvider = mock(ModuleScriptProvider.class);
                final Script pre = mock(Script.class);
                final Script post = mock(Script.class);
                final ExitCallbackExecutor exitCallbackExecutor =
                        mock(ExitCallbackExecutor.class);
View Full Code Here

Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

                final Queue asyncCallback = mock(Queue.class);
                final ScriptableObject globalScope = new NodeJsGlobal();
                cx.initStandardObjects(globalScope);

                final NodeJsUrlModuleSourceProvider moduleSourceProvider = mock(NodeJsUrlModuleSourceProvider.class);
                final ModuleScriptProvider moduleScriptProvider = mock(ModuleScriptProvider.class);
                final Script pre = mock(Script.class);
                final Script post = mock(Script.class);

                NodeRequire nodeRequire = new NodeRequire(asyncCallback, cx.newObject(globalScope), cx, globalScope,
                        moduleScriptProvider, pre, post, false, exitCallbackExecutor);
View Full Code Here

Examples of org.mozilla.javascript.commonjs.module.ModuleScriptProvider

                final Queue asyncCallback = mock(Queue.class);
                final ScriptableObject globalScope = new NodeJsGlobal();
                cx.initStandardObjects(globalScope);

                final ModuleScriptProvider moduleScriptProvider = mock(ModuleScriptProvider.class);
                final Script pre = mock(Script.class);
                final Script post = mock(Script.class);

                NodeRequire nodeRequire = new NodeRequire(asyncCallback, cx.newObject(globalScope), cx, globalScope,
                        moduleScriptProvider, pre, post, false, exitCallbackExecutor);
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.