TagUnit initial import.

This commit is contained in:
Erik C. Thauvin 2003-10-18 17:25:44 +00:00
parent 0020932fcb
commit b87a229cc7
28 changed files with 499 additions and 0 deletions

View file

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>google-tagunit</display-name>
<description>This webapp is a starting point for testing the Google Tag Library.</description>
<servlet>
<servlet-name>TagUnitTestController</servlet-name>
<servlet-class>org.tagunit.controller.FrontController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TagUnitTestController</servlet-name>
<url-pattern>/test/servlet/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Set Google Key</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!--
Copyright (c) 2002-2003, Erik C. Thauvin
All rights reserved.
-->
<body bgcolor="#FFFFFF" text="#000000">
<form action="index.jsp" method="post">
<input size="35" name="key" value="">&nbsp;<input type="submit" value="Set Google Key" name="btnG">
</form>
</body>
</html>

View file

@ -0,0 +1,20 @@
<%
// Copyright (c) 2002-2003, Erik C. Thauvin
// All rights reserved.
String key = request.getParameter("key");
if ((key != null)&& (key.trim().length() > 0))
{
pageContext.setAttribute("google_key", key, PageContext.APPLICATION_SCOPE);
%>
<jsp:forward page="test/servlet/RunTests?uri=/test/google/index.jsp"/>
<%
}
else
{
%>
<%@include file="index.html"%>
<%
}
%>

View file

@ -0,0 +1,19 @@
<%@ page isErrorPage="true" %>
<%@ taglib uri="http://www.tagunit.org/tagunit/display" prefix="tagunit" %>
<html>
<head>
<title>TagUnit - Error</title>
<tagunit:base/>
<link rel="stylesheet" href="page.css">
</head>
<body>
<h2>Oops, there has been a problem...</h2>
<pre><%= org.tagunit.util.ExceptionUtils.getStackTraceAsString(exception) %></pre>
</body>
</html>

View file

@ -0,0 +1,5 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertAttribute name="key" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,6 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertAttribute name="name" required="true" rtexprvalue="true"/>
<tagunit:assertAttribute name="target" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="style" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="css" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,7 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:testTagLibrary uri="/test/google">
<tagunit:tagLibraryDescriptor uri="/WEB-INF/google.tld"/>
</tagunit:testTagLibrary>

View file

@ -0,0 +1,7 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertAttribute name="target" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="style" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="css" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,7 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertAttribute name="target" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="style" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="css" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,14 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertAttribute name="key" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="start" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="maxResults" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="filter" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="restrict" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="safeSearch" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="lr" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="cache" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="site" required="false" rtexprvalue="true"/>
<tagunit:assertAttribute name="type" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,5 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="empty"/>
<tagunit:assertAttribute name="type" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,5 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

View file

@ -0,0 +1,5 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertBodyContent name="JSP"/>
<tagunit:assertAttribute name="key" required="false" rtexprvalue="true"/>

View file

@ -0,0 +1,3 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<tagunit:assertNoAttributes/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 B

View file

@ -0,0 +1,17 @@
<%@ taglib uri="http://www.tagunit.org/tagunit/core" prefix="tagunit" %>
<%--
Tests for TagUnit tag libraries
-------------------------------
This page contains the tests required to automatically test the basics of
the tag libraries that are a part of the TagUnit framework
--%>
<tagunit:testTagLibrary uri="/test/tagunit">
<tagunit:tagLibraryDescriptor jar="tagunit.jar" name="tagunit-core.tld"/>
</tagunit:testTagLibrary>
<tagunit:testTagLibrary uri="/test/tagunit">
<tagunit:tagLibraryDescriptor jar="tagunit.jar" name="tagunit-display.tld"/>
</tagunit:testTagLibrary>

View file

@ -0,0 +1,45 @@
<html>
<head>
<title>TagUnit</title>
<link rel="stylesheet" href="page.css">
</head>
<body>
<p>
<h1>TagUnit license information</h1>
</p>
<pre>Copyright (c) 2002, Simon Brown
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
- Neither the name of TagUnit nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.</pre>
</body>
</html>

View file

@ -0,0 +1,50 @@
body, p, table, thead, tbody {
font-family: verdana, arial, helvetica;
font-size: 8pt;
font-style: normal;
font-weight: normal;
text-align: left
}
h1 {
font-size: 18pt;
font-weight: bold;
}
h2 {
font-size: 14pt;
font-weight: bold;
}
a:link, a:visited, a:active {
color: #000000;
}
.pass {
color: 00CC00;
}
.warning {
color: FF9900;
}
.fail {
color: #CC0000;
}
.error {
color: #CC0000;
}
.message {
font-size: 8pt;
}
.banner {
font-size: 8pt;
border-top: solid black 2px;
border-right: solid black 2px;
border-bottom: solid black 2px;
border-left: solid black 2px;
color: white;
}

View file

@ -0,0 +1,206 @@
<!--
normal = 6699CC
red = CC0000
warning = CC6600
pass = 00CC00
-->
<%@ page import="org.tagunit.*" %>
<%@ page errorPage="error.jsp" %>
<%
String color = "#6699CC";
TestContextContainer testContext = (TestContextContainer)session.getAttribute(Constants.TEST_CONTEXT);
if (testContext != null && testContext.getStatus().equals(TestContext.PASS)) {
color = "#00CC00";
} else if (testContext != null && testContext.getStatus().equals(TestContext.WARNING)) {
color = "#CC6600";
} else if (testContext != null && (testContext.getStatus().equals(TestContext.FAIL) || testContext.getStatus().equals(TestContext.ERROR))) {
color = "#CC0000";
}
%>
<%@ taglib uri="http://www.tagunit.org/tagunit/display" prefix="tagunit" %>
<html>
<head>
<title>TagUnit - Test Results</title>
<tagunit:base/>
<link rel="stylesheet" href="page.css">
</head>
<body>
<table width="100%" cellpadding="0" cellspacing="2" class="banner">
<tr>
<td width="200">
<a href="../index.jsp"><img src="images/tagunit.gif" alt="Banner image" border="0" /></a></td>
<td bgcolor="<%= color %>" valign="top" align="right">
Version <tagunit:getProperty name="version"/>&nbsp;
</td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td>
<h2>Test results</h2>
</td>
<td align="right">
<a href="servlet/ViewResults?showPasses=false&showWarnings=true">Hide passes</a>
|
<a href="servlet/ViewResults?showPasses=false&showWarnings=false">Hide warnings</a>
|
<a href="servlet/ViewResults?showPasses=true&showWarnings=true">Show all</a>
<br>
Ignore Warnings -
<a href="servlet/ViewResults?showPasses=true&showWarnings=true&ignoreWarnings=true">Yes</a>
|
<a href="servlet/ViewResults?showPasses=true&showWarnings=true&ignoreWarnings=false">No</a>
</td>
</tr>
</table>
<div align="center">
<br />
<br />
<table>
<tr>
<td>
<table>
<tr height="1">
<td width="64"></td>
<td width="400" bgcolor="#000000"></td>
<td width="32"></td>
</tr>
</table>
<table>
<tr>
<td width="64">
<b>Passes</b>
</td>
<td width="<%= (testContext.getNumberOfPasses()*400)/testContext.getNumberOfTests() %>" bgcolor="#00CC00"></td>
<td width="32">
<jsp:getProperty name="testContext" property="numberOfPasses"/>
</td>
</tr>
</table>
<%
if (!org.tagunit.TagUnitProperties.getInstance().getIgnoreWarnings()) {
%>
<table>
<tr>
<td width="64">
<b>Warnings</b>
</td>
<td width="<%= (testContext.getNumberOfWarnings()*400)/testContext.getNumberOfTests() %>" bgcolor="#CC6600"></td>
<td width="32">
<jsp:getProperty name="testContext" property="numberOfWarnings"/>
</td>
</tr>
</table>
<%
}
%>
<table>
<tr>
<td width="64">
<b>Failures</b>
</td>
<td width="<%= (testContext.getNumberOfFailures()*400)/testContext.getNumberOfTests() %>" bgcolor="#CC0000"></td>
<td width="32">
<jsp:getProperty name="testContext" property="numberOfFailures"/>
</td>
</tr>
</table>
<table>
<tr>
<td width="64">
<b>Errors</b>
</td>
<td width="<%= (testContext.getNumberOfErrors()*400)/testContext.getNumberOfTests() %>" bgcolor="#CC0000"></td>
<td width="32">
<jsp:getProperty name="testContext" property="numberOfErrors"/>
</td>
</tr>
</table>
<table>
<tr height="1">
<td width="64"></td>
<td width="400" bgcolor="#000000"></td>
<td width="32"></td>
</tr>
</table>
</td>
</tr>
</table>
<br />
<br />
</div>
<table width="100%" border="0">
<tagunit:testResults id="result">
<tagunit:showLevel level="1">
<tr><td colspan="2">&nbsp;</td></tr>
</tagunit:showLevel>
<tr>
<td>
<img src="images/spacer.gif" width="<%= level.intValue()*16 %>" height="1">
<tagunit:hasChildren><b></tagunit:hasChildren>
<%
if (result instanceof org.tagunit.TagTestContext) {
org.tagunit.TagTestContext ttc = (org.tagunit.TagTestContext)result;
out.print("<a name=\"" + ttc.getTagInfo().getName() + "\">");
out.print("<a href=\"servlet/ViewResults?&tag=" + ttc.getTagInfo().getName() + "#" + ttc.getTagInfo().getName() + "\">");
}
%>
<jsp:getProperty name="result" property="name"/>
<%
if (result instanceof org.tagunit.TagTestContext) {
out.print("</a>");
}
%>
<tagunit:hasChildren></b></tagunit:hasChildren>
</td>
<td>
<tagunit:hasChildren><b></tagunit:hasChildren>
<tagunit:pass><span class="pass">Pass</span></tagunit:pass>
<tagunit:warning><span class="warning">Warning</span></tagunit:warning>
<tagunit:failure><span class="fail">Fail</span></tagunit:failure>
<tagunit:error><span class="error">Error</span></tagunit:error>
<tagunit:hasChildren></b></tagunit:hasChildren>
</td>
</tr>
<tagunit:hasMessage>
<tagunit:warning>
<tr><td><span class="warning"><img src="images/spacer.gif" width="<%= level.intValue()*24 %>" height="1">Warning : <tagunit:filter><jsp:getProperty name="result" property="message"/></tagunit:filter></span></td><td>&nbsp;</td></tr>
</tagunit:warning>
<tagunit:failure>
<tr><td><span class="fail"><code><img src="images/spacer.gif" width="<%= level.intValue()*24 %>" height="1">Failure : <tagunit:filter><jsp:getProperty name="result" property="message"/></tagunit:filter></code></span></td><td>&nbsp;</td></tr>
</tagunit:failure>
<tagunit:error>
<tr><td><span class="error"><code><img src="images/spacer.gif" width="<%= level.intValue()*24 %>" height="1">Error : <tagunit:filter><jsp:getProperty name="result" property="message"/></tagunit:filter></code></span></td><td>&nbsp;</td></tr>
</tagunit:error>
</tagunit:hasMessage>
</tagunit:testResults>
</table>
<br />
<br />
<div align="center">
<a href="license.html">License</a>
</div>
</body>
</html>

Binary file not shown.

View file

@ -0,0 +1,29 @@
Copyright (c) 2002/2003, Simon Brown
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
- Neither the name of TagUnit nor the names of its contributors may
be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.