Examples of ForkedStepRunner


Examples of abbot.script.ForkedStepRunner

                     step, ForkedStepRunner.decodeStep(script, code));

    }

    public void testFork() throws Throwable {
        ForkedStepRunner fs = new ForkedStepRunner();
        String[] args = {
            getClass().getName(), "fork",
        };
        final StringBuffer sb = new StringBuffer();
        final StringBuffer sbe = new StringBuffer();
        Process p;
        try {
            p = fs.fork(null, args);
        }
        catch(IOException io) {
            throw new AssertionFailedError("VM fork failed");
        }
        try {
View Full Code Here

Examples of abbot.script.ForkedStepRunner

    public void testForkedStepRunner() throws Throwable {
        // Empty script that does nothing
        String src = "<AWTTestScript></AWTTestScript>";
        Script script = loadScript(src);
        final ArrayList events = new ArrayList();
        ForkedStepRunner fs = new ForkedStepRunner();
        fs.addStepListener(new StepListener() {
            public void stateChanged(StepEvent event) {
                events.add(event);
            }
        });
        fs.run(script);
        assertEquals("Wrong number of events", 2, events.size());
        assertEquals("Wrong step source, event 0",
                     script, ((StepEvent)events.get(0)).getStep());
        assertEquals("Wrong step id, event 0",
                     StepEvent.STEP_START,
View Full Code Here

Examples of abbot.script.ForkedStepRunner

     */
    public void testForkedFailure() throws Throwable {
        String src = "<AWTTestScript>"
            + "<assert method=\"assertFrameShowing\" args=\"no such window\"/>"
            + "</AWTTestScript>";
        ForkedStepRunner fs = new ForkedStepRunner();
        Script script = loadScript(src);
        try {
            fs.run(script);
            fail("The failure was not propagated");
        }
        catch(ForkedFailure ff) {
            assertEquals("Error not set in runner",
                         ff, fs.getError(script));
            StringWriter s = new StringWriter();
            ff.printStackTrace(new PrintWriter(s));
            String trace = s.toString();
            assertTrue("No stack trace in failure: " + trace,
                       trace.indexOf("at ") != -1);
        }
        catch(Throwable t) {
            fail("Wrong exception thrown: " + t);
        }
        finally {
            fs.terminate();
        }
    }
View Full Code Here

Examples of abbot.script.ForkedStepRunner

     */
    public void testForkedError() throws Throwable {
        String src = "<AWTTestScript>"
            + "<launch class=\"nonsense class\" method=\"main\" args=\"[]\"/>"
            + "</AWTTestScript>";
        ForkedStepRunner fs = new ForkedStepRunner();
        Script script = loadScript(src);
        try {
            fs.run(script);
            fail("No error propagated");
        }
        catch(ForkedError fe) {
            assertEquals("Error not set in runner",
                         fe, fs.getError(script));
            String expected = "java.lang.ClassNotFoundException";
            assertTrue("Wrong error: " + fe,
                       fe.toString().startsWith(expected));
            StringWriter s = new StringWriter();
            fe.printStackTrace(new PrintWriter(s));
            String trace = s.toString();
            assertTrue("Error is missing stack trace: " + trace,
                       trace.indexOf("at ") != -1);
        }
        catch(Throwable thr) {
            fail("Wrong error: " + thr);
        }
        finally {
            fs.terminate();
        }
    }
View Full Code Here

Examples of abbot.script.ForkedStepRunner

        dir.deleteOnExit();
        File s2 = new File(dir, included);
        s2.deleteOnExit();
        script2.setFile(s2);
        script2.save();
        ForkedStepRunner fs = new ForkedStepRunner();
        Script script = loadScript(src);
        script.setFile(new File(dir, getName()));
        fs.run(script);
        assertEquals("No errors expected", null, fs.getError(script));
    }
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.