public void run() { threadComplete = false; // activeThread = Thread.currentThread(); try { opts.testLogDir.mkdir(); threadOutput = new ByteArrayOutputStream(); out = new PrintStream(threadOutput); execute(); out.close(); } catch (Exception e) { jlogger.log( SEVERE, "", e); } // activeThread = null; threadComplete = true; }
public NodeInfo executeXSLFunction(XPathContext context, FunctionEntry fe, NodeInfo params) throws Exception { String oldFnPath = fnPath; CRC32 crc = new CRC32(); crc.update((fe.getPrefix() + fe.getId()).getBytes()); fnPath += Long.toHexString(crc.getValue()) + "/"; XdmNode n = executeTemplate(fe, S9APIUtils.makeNode(params), context); fnPath = oldFnPath; if (n == null) { return null; } return n.getUnderlyingNode(); }
+ getResultDescription(result)); if (result == WARNING) { warning(); } else if (result == CONTINUE) { throw new IllegalStateException( "Error: 'continue' is not allowed when a test is called using 'call-test' instruction"); } else if (result != PASS) { inheritedFailure(); testPath += "/" + callId; try{ this.verdict = executeTest(test, S9APIUtils.makeNode(params), context); } catch(Exception e){ "Error: 'continue' is not allowed when a test is called using 'call-test' instruction"); updateParentTestResult(test); testStack.pop();
public int execute_test(String testName, List<String> params, XdmNode contextNode) throws Exception { if (LOGR.isLoggable( FINE)) { String logMsg = String.format( "Preparing test %s for execution, using params:%n %s", testName, params); LOGR.fine(logMsg); } TestEntry test = index.getTest(testName); if (test == null) { throw new Exception("Error: Test " + testName + " not found."); } XdmNode paramsNode = engine.getBuilder().build( new StreamSource(new StringReader(getParamsXML(params)))); if (contextNode == null && test.usesContext()) { String contextNodeXML = "<context><value>" + test.getContext() + "</value></context>"; contextNode = engine.getBuilder().build( new StreamSource(new StringReader(contextNodeXML))); } XPathContext context = getXPathContext(test, opts.getSourcesName(), contextNode); return executeTest(test, paramsNode, context); }
Document oldPrevLog = prevLog; if (opts.getMode() == Test.RESUME_MODE) { prevLog = readLog(); } else if (opts.getMode() == Test.REDO_FROM_CACHE_MODE) { prevLog = readLog(); } else { prevLog = null; String assertion = getAssertionValue(test.getAssertion(), params); out.print(" in " + getMode() + " with defaultResult " + defaultResultName + " "); String testName = test.getName() + " type " + test.getType(); if (getMode().contains("Retest")) { if(null!=dirPath){ if (dirPath.isDirectory()) { PrintWriter oldLogger = logger; if (opts.getLogDir() != null) { logger = createLog(); logger.println("<log>"); logger.print("<starttest "); this.verdict = defaultResult; try { executeTemplate(test, params, context); } catch (SaxonApiException e) { jlogger.log( SEVERE, e.getMessage());
reexecute_test(sessionId); } else if (mode == Test.REDO_FROM_CACHE_MODE) { reexecute_test(sessionId); } else if (mode == Test.RETEST_MODE) { for (String testPath : opts.getTestPaths()) { reexecute_test(testPath); if (testName != null) { XdmNode contextNode = opts.getContextNode(); execute_test(testName, params, contextNode); } else { String suiteName = opts.getSuiteName(); List<String> profiles = opts.getProfiles(); if (suiteName != null || profiles.size() == 0) { execute_suite(suiteName, params); execute_profile(profile, params, false); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), for (String profile : profiles) { try { execute_profile(profile, params, true); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), if(supportHtmlReport == true){ Map<String, String> testInputMap = new HashMap<String, String>(); testInputMap = extractTestInputs(userInputs, opts);
XdmNode paramsNode = LogUtils.getParamsFromLog(builder, log); XdmNode contextNode = LogUtils.getContextFromLog(builder, log); XPathContext context = getXPathContext(test, opts.getSourcesName(), contextNode); setTestPath(testPath); executeTest(test, paramsNode, context); if (testPath.equals(opts.getSessionId())) { for (String profile : index.getProfileKeys()) { try { execute_profile(profile, params, false); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), e.getCause()); for (String profile : profiles) { try { // 2011-12-21 PwD execute_profile(profile, params, true); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), e.getCause());
return executeXSLFunction(context, fe, params); instance = getFunctionInstance(fe.hashCode()); if (instance == null) { try { fe.getClassName(), fe.getClassParams(), cl); putFunctionInstance(fe.hashCode(), instance); } catch (Exception e) { throw new XPathException(e);
NodeInfo result = null; try { NodeInfo paramsNode = core.getEngine().getBuilder().build(src) .getUnderlyingNode(); result = core.executeXSLFunction(context, fe, paramsNode); } catch (Exception e) { throw new RuntimeException(e);
URLConnection uc = build_soap_request(request); response = parse(uc, parserInstruction); Date after = new Date(); elapsedTime = after.getTime() - before.getTime();
URLConnection uc = build_request(request); response = parse(uc, parserInstruction); Date after = new Date(); elapsedTime = after.getTime() - before.getTime();
Document oldPrevLog = prevLog; if (opts.getMode() == Test.RESUME_MODE) { prevLog = readLog(); } else if (opts.getMode() == Test.REDO_FROM_CACHE_MODE) { prevLog = readLog(); } else { prevLog = null; String assertion = getAssertionValue(test.getAssertion(), params); out.print(" in " + getMode() + " with defaultResult " + defaultResultName + " "); String testName = test.getName() + " type " + test.getType(); if (getMode().contains("Retest")) { if(null!=dirPath){ if (dirPath.isDirectory()) { PrintWriter oldLogger = logger; if (opts.getLogDir() != null) { logger = createLog(); logger.println("<log>"); logger.print("<starttest "); this.verdict = defaultResult; try { executeTemplate(test, params, context); } catch (SaxonApiException e) { jlogger.log( SEVERE, e.getMessage());
reexecute_test(sessionId); } else if (mode == Test.REDO_FROM_CACHE_MODE) { reexecute_test(sessionId); } else if (mode == Test.RETEST_MODE) { for (String testPath : opts.getTestPaths()) { reexecute_test(testPath); if (testName != null) { XdmNode contextNode = opts.getContextNode(); execute_test(testName, params, contextNode); } else { String suiteName = opts.getSuiteName(); List<String> profiles = opts.getProfiles(); if (suiteName != null || profiles.size() == 0) { execute_suite(suiteName, params); execute_profile(profile, params, false); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), for (String profile : profiles) { try { execute_profile(profile, params, true); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), if(supportHtmlReport == true){ Map<String, String> testInputMap = new HashMap<String, String>(); testInputMap = extractTestInputs(userInputs, opts);
XdmNode paramsNode = LogUtils.getParamsFromLog(builder, log); XdmNode contextNode = LogUtils.getContextFromLog(builder, log); XPathContext context = getXPathContext(test, opts.getSourcesName(), contextNode); setTestPath(testPath); executeTest(test, paramsNode, context); if (testPath.equals(opts.getSessionId())) { for (String profile : index.getProfileKeys()) { try { execute_profile(profile, params, false); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), e.getCause()); for (String profile : profiles) { try { // 2011-12-21 PwD execute_profile(profile, params, true); } catch (Exception e) { jlogger.log(Level.WARNING, e.getMessage(), e.getCause());
public int execute_test(String testName, List<String> params, XdmNode contextNode) throws Exception { if (LOGR.isLoggable( FINE)) { String logMsg = String.format( "Preparing test %s for execution, using params:%n %s", testName, params); LOGR.fine(logMsg); } TestEntry test = index.getTest(testName); if (test == null) { throw new Exception("Error: Test " + testName + " not found."); } XdmNode paramsNode = engine.getBuilder().build( new StreamSource(new StringReader(getParamsXML(params)))); if (contextNode == null && test.usesContext()) { String contextNodeXML = "<context><value>" + test.getContext() + "</value></context>"; contextNode = engine.getBuilder().build( new StreamSource(new StringReader(contextNodeXML))); } XPathContext context = getXPathContext(test, opts.getSourcesName(), contextNode); return executeTest(test, paramsNode, context); }
return executeXSLFunction(context, fe, params); instance = getFunctionInstance(fe.hashCode()); if (instance == null) { try { fe.getClassName(), fe.getClassParams(), cl); putFunctionInstance(fe.hashCode(), instance); } catch (Exception e) { throw new XPathException(e);
NodeInfo result = null; try { NodeInfo paramsNode = core.getEngine().getBuilder().build(src) .getUnderlyingNode(); result = core.executeXSLFunction(context, fe, paramsNode); } catch (Exception e) { throw new RuntimeException(e);
URLConnection uc = build_soap_request(request); response = parse(uc, parserInstruction); Date after = new Date(); elapsedTime = after.getTime() - before.getTime();