Package io.apigee.trireme.core

Examples of io.apigee.trireme.core.NodeScript.execute()


        sb.setSubprocessPolicy(new NoEchoPolicy());
        localEnv.setSandbox(sb);
        NodeScript script = localEnv.createScript("spawntest.js",
                                             new File("./target/test-classes/tests/spawntest.js"),
                                             new String[] { "fail" });
        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
    }

    @Test
    public void testAddEnvironment()
View Full Code Here


                                                  new File("./target/test-classes/tests/environmenttest.js"),
                                                  new String[] { "foo", "bar" });

        script.addEnvironment("foo", "bar");

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
    }

    @Test
    public void testSetEnvironment()
View Full Code Here

        HashMap<String, String> env = new HashMap<String, String>();
        env.put("foo", "bar");
        env.put("baz", "foo");
        script.setEnvironment(env);

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
    }

    @Test
    public void testGlobalModule()
View Full Code Here

                                             new File("./target/test-classes/tests/globalmoduletest.js"), null);
        HashMap<String, String> env = new HashMap<String, String>();
        env.put("NODE_PATH", "./target/test-classes/global");
        script.setEnvironment(env);

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }

    @Test
View Full Code Here

        HashMap<String, String> env = new HashMap<String, String>();
        env.put("NODE_PATH", "./global");
        script.setEnvironment(env);
        script.setSandbox(sb);

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }

    @Test
View Full Code Here

        HashMap<String, String> env = new HashMap<String, String>();
        env.put("NODE_PATH", "/usr/lib/node_modules");
        script.setEnvironment(env);
        script.setSandbox(sb);

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }

    @Test
View Full Code Here

        // TODO we can't seem to do this for nested paths unless we have every subdirectory there.
        env.put("NODE_PATH", "/node_modules");
        script.setEnvironment(env);
        script.setSandbox(sb);

        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }

    @Test
View Full Code Here

        throws InterruptedException, ExecutionException, NodeException
    {
        NodeScript script = env.createScript("argvtest.js",
                                             new File("target/test-classes/tests/argvtest.js"),
                                             new String[] { "One", "Two", "Three" });
        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
    }

    @Test
View Full Code Here

        Sandbox sb = new Sandbox().setHideOSDetails(true);
        testEnv.setSandbox(sb);
        NodeScript script = testEnv.createScript("hiddenostest.js",
                                             new File("target/test-classes/tests/hiddenostest.js"),
                                             null);
        ScriptStatus status = script.execute().get();
        assertEquals(0, status.getExitCode());
        script.close();
        testEnv.close();
    }
View Full Code Here

        NodeScript script = env.createScript("test.js",
                                             "console.log(\'Hello, World!\');process.exit(0);  ",
                                             null);
        script.setNodeVersion("0.0.0");
        try {
            script.execute().get();
            assertFalse(true);
        } catch (NodeException ok) {
        }
    }
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.