% out.print(""); %>
<%@ page import="
javax.servlet.http.HttpServletRequest,
javax.servlet.jsp.JspWriter,
java.io.ByteArrayOutputStream,
java.io.PrintStream
"%>
<%@ page import="org.apache.openejb.test.TestRunner" %>
OpenEJB/Tomcat
<%!
String tab = " ";
static String invLock = "lock";
static int invCount;
HttpSession session;
HttpServletRequest request;
JspWriter out;
/**
* The main method of this JSP
*/
public void main(HttpServletRequest request, HttpSession session, JspWriter out) throws Exception {
this.request = request;
this.session = session;
this.out = out;
String doInvoke = request.getParameter("invoke");
if (doInvoke != null) {
invoke();
} else {
out.print("");
}
}
String pepperImg = "";
public void invoke() throws Exception {
try {
System.setProperty("openejb.test.server", "org.apache.openejb.test.IvmTestServer");
System.setProperty("openejb.test.database", "org.apache.openejb.test.InstantDbTestDatabase");
//test.server.class=org.apache.openejb.test.IvmTestServer
//out.print("B");
//Object runner = this.getClass().forName("org.apache.openejb.test.TestRunner").newInstance();
//out.print("C");
//Method main = runner.getClass().getMethod("main",new Class[]{new String[]{}.getClass()});
String[] args = new String[]{"org.apache.openejb.test.ClientTestSuite"};
ByteArrayOutputStream baos = new ByteArrayOutputStream();
org.apache.openejb.test.ResultPrinter printer = new org.apache.openejb.test.ResultPrinter(new PrintStream(baos));
TestRunner runner = new TestRunner(printer);
runner.start(args);
byte[] bytes = baos.toByteArray();
StringBuffer sb = new StringBuffer(bytes.length);
for (int i = 0; i < bytes.length; i++) {
char c = (char) bytes[i];
switch (c) {
case' ':
sb.append(" ");
break;
case'\n':
sb.append("
");
break;
case'\r':
break;
default:
sb.append(c);
}
}
out.print(sb.toString());
//main.invoke(runner, args);
} catch (Throwable e) {
out.print("
Bad Exception:
");
out.print(formatThrowable(e));
}
}
public String formatThrowable(Throwable err) throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
err.printStackTrace(new PrintStream(baos));
byte[] bytes = baos.toByteArray();
StringBuffer sb = new StringBuffer(bytes.length);
for (int i = 0; i < bytes.length; i++) {
char c = (char) bytes[i];
switch (c) {
case' ':
sb.append(" ");
break;
case'\n':
sb.append("
");
break;
case'\r':
break;
default:
sb.append(c);
}
}
return sb.toString();
}
%>