Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* JBoss, Home of Professional Open Source
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags.
* See the copyright.txt in the distribution for a full listing
* of individual contributors.
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU Lesser General Public License, v. 2.1.
* This program is distributed in the hope that it will be useful, but WITHOUT A
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public License,
* v.2.1 along with this distribution; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
* (C) 2005-2006,
* @author JBoss Inc.
*/
/*
* Copyright (c) 2002, 2003, Arjuna Technologies Limited.
*
* TestRunnerServlet.java
*/
package com.arjuna.qa.junit;
import junit.framework.AssertionFailedError;
import junit.framework.TestResult;
import org.junit.runner.Description;
import org.junit.runner.JUnitCore;
import org.junit.runner.Result;
import org.junit.runner.notification.Failure;
import org.junit.runner.notification.RunListener;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.CharArrayWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
public class TestRunnerServlet extends HttpServlet
{
public void init(ServletConfig config) throws ServletException
{
super.init(config);
_testSuiteClassName = config.getInitParameter("TestSuiteClassName");
}
protected String getContentType()
{
return "text/html";
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
try
{
PrintWriter writer = response.getWriter();
response.setContentType(getContentType());
response.setHeader("Cache-Control", "no-cache");
if (request.getParameter("failednumber") != null)
doStatusFailed(writer, request, response);
else if (request.getParameter("errornumber") != null)
doStatusError(writer, request, response);
else
doStatus(writer, request, response);
}
catch (Exception exception)
{
log("Test Runner: doGet failed", exception);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, exception.toString());
}
catch (Error error)
{
log("Test Runner: doGet failed", error);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.toString());
}
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
try
{
PrintWriter writer = response.getWriter();
response.setContentType(getContentType());
response.setHeader("Cache-Control", "no-cache");
if ((_runnerThread == null) || (! _runnerThread.isAlive()))
{
_runnerThread = new RunnerThread();
_runnerThread.start();
}
if (request.getParameter("failednumber") != null)
doStatusFailed(writer, request, response);
else if (request.getParameter("errornumber") != null)
doStatusError(writer, request, response);
else
doStatus(writer, request, response);
}
catch (Exception exception)
{
log("Test Runner: doPost failed", exception);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, exception.toString());
}
catch (Error error)
{
log("Test Runner: doPost failed", error);
response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, error.toString());
}
}
public void doStatus(PrintWriter writer, HttpServletRequest request, HttpServletResponse response)
throws ServletException
{
writer.println("");
writer.println("");
writer.println("Test Runner");
writer.println("");
writer.println("");
writer.println("
Test Runner: Status
");
writer.println("
");
writer.println("
Status
");
writer.println("
");
writer.println("
Test suite class:
");
writer.println("
" + _testSuiteClassName + "
");
writer.println("
");
if ((_runnerThread == null) || (! _runnerThread.isAlive()))
{
writer.println("