dion 2002/07/14 05:39:13
Modified: latka/src/jelly latka.jelly
Log:
Rework of test file for new taglib definitions
Revision Changes Path
1.18 +41 -42 jakarta-commons/latka/src/jelly/latka.jelly
Index: latka.jelly
===================================================================
RCS file: /home/cvs/jakarta-commons/latka/src/jelly/latka.jelly,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- latka.jelly 14 Jul 2002 11:55:13 -0000 1.17
+++ latka.jelly 14 Jul 2002 12:39:13 -0000 1.18
@@ -1,54 +1,54 @@
<?xml version="1.0"?>
<j:jelly
xmlns:j="jelly:core"
- xmlns="jelly:org.apache.commons.latka.jelly.LatkaTagLibrary"
+ xmlns:log="jelly:log"
+ xmlns:v="jelly:org.apache.commons.latka.jelly.validators.HttpValidatorTagLibrary"
+ xmlns="jelly:org.apache.commons.latka.jelly.HttpTagLibrary"
trim="false">
- <!-- a latka suite - not really sure if we need this anymore -->
- <suite>
<!-- a session holds shared http state info
<session> -->
<session>
Tests for Get tag
-----------------
- <get id="mtc" uri="http://www.multitask.com.au/"/>
+ <get var="mtc" uri="http://www.multitask.com.au/"/>
<j:if test='${mtc.statusCode == 200}'>
request ok
</j:if>
- Results for mtc url are:
- http return code = ${mtc.statusCode}
- http status text = '${mtc.statusText}'
- size of result = ${mtc.responseBodyAsString.length()}
- response time = ${mtc.responseTime}
- <statustext requestId="mtc" value="Fond">Bad status text 1</statustext>
- <statustext requestId="mtc" value="Found">Bad status text 2</statustext>
+ Results for mtc url are:
+ http return code = ${mtc.statusCode}
+ http status text = '${mtc.statusText}'
+ size of result = ${mtc.responseBodyAsString.length()}
+ response time = ${mtc.responseTime}
+ <v:statustext var="mtc" value="Fond">Bad status text 1</v:statustext>
+ <v:statustext var="mtc" value="Found">Bad status text 2</v:statustext>
<!-- test response time <= 5s -->
- <maxresponsetime limit="5000" requestId="mtc">over 5s</maxresponsetime>
+ <v:maxresponsetime limit="5000" var="mtc">over 5s</v:maxresponsetime>
<!-- bytelength validation on the request/response -->
- <bytelength requestId="mtc" max="2400">MTC URL too big</bytelength>
+ <v:bytelength var="mtc" max="2400">MTC URL too big</v:bytelength>
<!-- response header validation -->
<!-- this is expected to fail, as Host is a request header -->
- <responseheader requestId="mtc" name="Host">
+ <v:responseheader var="mtc" name="Host">
Bad host for mtc 1
- </responseheader>
- <responseheader requestId="mtc" name="Host" value="www.multitask.com.au">
+ </v:responseheader>
+ <v:responseheader var="mtc" name="Host" value="www.multitask.com.au">
Bad host for mtc 2
- </responseheader>
+ </v:responseheader>
<!-- expected to work -->
- <responseheader requestId="mtc" name="Server">
+ <v:responseheader var="mtc" name="Server">
Bad server for mtc 1
- </responseheader>
- <responseheader requestId="mtc" name="Server"
+ </v:responseheader>
+ <v:responseheader var="mtc" name="Server"
value="Lotus-Domino/5.0.8">
Bad server for mtc 2
- </responseheader>
+ </v:responseheader>
<j:forEach items="${mtc.responseHeaders}" var="header" indexVar="i">
header[${i}] = ${header}
</j:forEach>
<!-- test parameters and headers -->
- <get id="mtc2" uri="http://www.multitask.com.au/default.html">
+ <get var="mtc2" uri="http://www.multitask.com.au/default.html">
<parameter name="page" value="mt @News"/>
<parameter name="page2" value="junk"/>
<header name="Content-Type" value="text/plain"/>
@@ -59,14 +59,14 @@
reqHeader[${i}] = ${rHeader}
</j:forEach>
<!-- test a 404 -->
- <get id="badurl" uri="http://www.multitask.com.au/snafu.html"/>
+ <get var="badurl" uri="http://www.multitask.com.au/snafu.html"/>
http return code = ${badurl.statusCode}
- <statuscode requestId="badurl">not ok badurl</statuscode>
- <statuscode requestId="badurl" value="404">whoops, expecting a 404</statuscode>
+ <v:statuscode var="badurl">not ok badurl</v:statuscode>
+ <v:statuscode var="badurl" value="404">whoops, expecting a 404</v:statuscode>
bad response time = ${badurl.responseTime} in msec
Tests for Post tag
------------------
- <post id="jdc" uri="http://developer.java.sun.com/servlet/SessionServlet">
+ <post var="jdc" uri="http://developer.java.sun.com/servlet/SessionServlet">
<parameter name="action" value="login" />
<parameter name="url" value="/developer/index.jshtml" />
<parameter name="UserId" value="XXXX" />
@@ -74,21 +74,21 @@
</post>
jdc login result = ${jdc.statusCode}
good login = ${jdc.responseBodyAsString.indexOf("Sorry!") == "-1"}
- <regexp pattern="Sox.y!" requestId="jdc">
- <request-failed id="jdc">
+ <v:regexp pattern="Sox.y!" var="jdc">
+ <request-failed var="jdc">
bad pattern 1
</request-failed>
- </regexp>
- <regexp pattern="Sox.y!" requestId="jdc" ignoreCase="true">
- <request-failed id="jdc">
+ </v:regexp>
+ <v:regexp pattern="Sox.y!" var="jdc" ignoreCase="true">
+ <request-failed var="jdc">
bad pattern 2
</request-failed>
- </regexp>
- <regexp pattern="so..y!" requestId="jdc" ignoreCase="true">
- <request-failed id="jdc">
+ </v:regexp>
+ <v:regexp pattern="so..y!" var="jdc" ignoreCase="true">
+ <request-failed var="jdc">
bad pattern 3
</request-failed>
- </regexp>
+ </v:regexp>
jdc response time = ${jdc.responseTime} in msec
<j:forEach items="${jdc.responseHeaders}" var="header" indexVar="i">
@@ -96,20 +96,20 @@
</j:forEach>
Tests for Head tag
------------------
- <head id="jakarta" uri="http://jakarta.apache.org/"/>
+ <head var="jakarta" uri="http://jakarta.apache.org/"/>
<j:forEach items="${jakarta.responseHeaders}" var="header" indexVar="i">
header[${i}] = ${header}
</j:forEach>
Tests for Options tag
---------------------
- <options id="ms" uri="http://www.microsoft.com/"/>
+ <options var="ms" uri="http://www.microsoft.com/"/>
<j:forEach items="${ms.responseHeaders}" var="header" indexVar="i">
header[${i}] = ${header}
</j:forEach>
Tests for Body tag
------------------
<j:set var="googleKey" value="00000000000000000000000000000000" />
- <post id="google" uri="http://api.google.com/search/beta2">
+ <post var="google" uri="http://api.google.com/search/beta2">
<header name="Content-Type" value="text/xml"/>
<body>
<env:Envelope
@@ -144,7 +144,7 @@
<session>
Tests for Cookie tag
---------------------
- <post id="ph" uri="http://www.pizzahut.com.au/logon.do">
+ <post var="ph" uri="http://www.pizzahut.com.au/logon.do">
<parameter name="username" value="xxx"/>
<parameter name="password" value="xxx"/>
<parameter name="actionToDo" value="continue"/>
@@ -152,7 +152,7 @@
</post>
SC: ${ph.getResponseHeader("Set-Cookie")}
<!-- make sure a uid cookie comes back -->
- <cookie requestId="ph" name="Apache">no apache cookie</cookie>
+ <v:cookie var="ph" name="Apache">no apache cookie</v:cookie>
<!-- show how to dump cookie name/value pairse -->
<j:forEach items='${ph.getResponseHeader("Set-Cookie").values}'
var="element" indexVar="i">
@@ -160,6 +160,5 @@
</j:forEach>
</session>
- </suite>
-
+
</j:jelly>
--
To unsubscribe, e-mail: <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>
|