Package net.sourceforge.marathon.api

Examples of net.sourceforge.marathon.api.ScriptException


            addToPath(pathSegments, getPathForPython("/libpy/marathon"));
            addToPath(pathSegments, pyHome);
            pythonPath = getPathFromSegments(pathSegments);
        } catch (Exception e) {
            e.printStackTrace();
            throw new ScriptException("unable to intialize marathon runtime."
                    + " Check to make sure that marathon modules are in the python path:\n" + pythonPath);
        }
        return pythonPath;
    }
View Full Code Here


    }

    private PyObject getFixture() {
        PyObject fixture = interpreter.get("fixture");
        if (fixture == null) {
            throw new ScriptException("no fixture found for test " + filename);
        }
        return fixture;
    }
View Full Code Here

    private void readTestExecutor() {
        PyObject marathon = interpreter.get("marathon");
        PyMethod testExecutor = (PyMethod) marathon.__getattr__("execTest");
        if (testExecutor == null) {
            throw new ScriptException("no python test executor, something is wrong with the marathon runtime!");
        }
    }
View Full Code Here

    }

    private void readTestFunction() {
        testFunction = interpreter.get("test");
        if (testFunction == null) {
            throw new ScriptException("there is no function test() defined in " + filename);
        }
    }
View Full Code Here

    private void raisePythonError(PyException e) {
        StringTokenizer toker = new StringTokenizer(e.toString(), "\n");
        Stack<String> tokens = new Stack<String>();
        while (toker.hasMoreTokens())
            tokens.push(toker.nextToken());
        throw new ScriptException(tokens.pop().toString() + tokens.pop());
    }
View Full Code Here

        throw new ScriptException(tokens.pop().toString() + tokens.pop());
    }

    private void raiseSyntaxError(PySyntaxError e) {
        String error = e.toString();
        throw new ScriptException(error.substring(error.lastIndexOf("Syntax")));
    }
View Full Code Here

            try {
                fixture.invoke("test_setup");
            } catch (Throwable t) {
                if (t instanceof PyException)
                    raisePythonError((PyException) t);
                throw new ScriptException("Could not invoke test_setup: " + t.getMessage());
            }
        }
    }
View Full Code Here

                    }
                }
                builtin.__setattr__(key, pyValue);
            } catch (Throwable t) {
                t.printStackTrace();
                throw new ScriptException(t.getMessage());
            }
        }
    }
View Full Code Here

    public void startApplication() {
        try {
            script.runFixtureSetup();
        } catch (Throwable t) {
            throw new ScriptException(t.getMessage());
        }
    }
View Full Code Here

            defineVariable("marathon_test_dir", System.getProperty("marathon.test.dir"));
            interpreter.executeScript(script, filename);
        } catch (RaiseException e) {
            e.printStackTrace();
            // e.getCause().printStackTrace();
            throw new ScriptException(e.getException().toString());
        } catch (Throwable t) {
            t.printStackTrace();
            throw new ScriptException(t.getMessage());
        }
    }
View Full Code Here

TOP

Related Classes of net.sourceforge.marathon.api.ScriptException

Copyright © 2018 www.massapicom. 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.