You are viewing a plain text version of this content. The canonical link for it is here.
Posted to watchdog-dev@jakarta.apache.org by sa...@locus.apache.org on 2000/10/04 02:17:58 UTC
cvs commit: jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc initializer.jsp negativeClearIOExpr.jsp negativeClearUnbuffered.jsp negativeClose.jsp negativeFlush.jsp positiveClear.jsp positiveClose.jsp positiveFlush.jsp positiveGetBufferSize.jsp positiveGetBufferSizeUnBuffered.jsp positiveGetRemaining.jsp positiveGetRemainingBufferUnset.jsp positiveIsAutoFlush.jsp positiveNewLine.jsp
santosh 00/10/03 17:17:58
Added: src/server/jsp-tests/jsp/engine/JspWriter/misc
initializer.jsp negativeClearIOExpr.jsp
negativeClearUnbuffered.jsp negativeClose.jsp
negativeFlush.jsp positiveClear.jsp
positiveClose.jsp positiveFlush.jsp
positiveGetBufferSize.jsp
positiveGetBufferSizeUnBuffered.jsp
positiveGetRemaining.jsp
positiveGetRemainingBufferUnset.jsp
positiveIsAutoFlush.jsp positiveNewLine.jsp
Log:
watchdog 4.0
Revision Changes Path
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/initializer.jsp
Index: initializer.jsp
===================================================================
<html>
<title>initializer</title>
<body>
<!-- javatest uses this jsp to get the directory where test jsps are kept -->
<%! String where=null; %>
<% String path=request.getPathTranslated(); %>
<% if(path!=null) {
int last=path.lastIndexOf("initializer.jsp");
where= path.substring(0,last);
} else {
path=System.getProperty("user.home")+System.getProperty("file.separator");
where=path;
}
out.println("path="+where); %>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/negativeClearIOExpr.jsp
Index: negativeClearIOExpr.jsp
===================================================================
<html>
<title>negativeClearIOExpr</title>
<body>
<%
/*
Name : negativeClearIOExpr
Description : Before using the clear() method, close the stream. So an IO error
should happen for the current situation.
*/
%>
<!-- This is to test if clear method throws IOException if stream is closed -->
<%@ page import="java.io.*;" %>
<% out.println("hello"); %>
<% out.close(); %>
<!-- To report that 'out' is null, we dont have a stream to client available -->
<!-- We create a file which is seen by javatest -->
<%! String dir; %>
<% String path=request.getPathTranslated(); %>
<% if(path!=null) {
int where=path.lastIndexOf("negativeClearIOErr");
dir=path.substring(0,where);
}else {
dir=System.getProperty("user.home");
}
java.io.File file=new java.io.File(dir+System.getProperty("file.separator")+"negativeClearIOErr.err");
java.io.FileWriter fw=new java.io.FileWriter(file);
%>
<!-- Now lets try to clear the stream -->
<% try { out.clear(); fw.write("no IOException"); fw.flush();fw.close();
}catch(java.io.IOException ioe) { %>
<% fw.write("we got IOException"); fw.flush();fw.close(); }%>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/negativeClearUnbuffered.jsp
Index: negativeClearUnbuffered.jsp
===================================================================
<html>
<title>negativeClearUnbuffered</title>
<body>
<%
/*
Name : negativeClearUnbuffered
Description : Make the JSP page unbuffered, using the directive, buffer="none".
Now try to use the clear() method.
*/
%>
<!-- This is to test if clear() method throws IllegalStateException if buffer is none -->
<%@ page buffer="none" %>
<% out.println("hello"); %>
<% try { out.clear(); }catch(IllegalStateException ise) { %>
<% out.println("we got Illegal state Exception"); }%>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/negativeClose.jsp
Index: negativeClose.jsp
===================================================================
<html>
<title>negativeClose</title>
<body>
<% /**
Name : negativeClose
Description : We closing the stream and trying to write into the stream.
**/ %>
<!-- This is to test if clear method throws IOException if stream is closed -->
<%@ page import="java.io.*;" %>
<% out.println("hello"); %>
<% out.close(); %>
<!-- To report that 'out' is null, we dont have a stream to client available -->
<!-- We create a file in the directory which is seen by javatest -->
<%! String dir; %>
<% String path=request.getPathTranslated(); %>
<% if(path!=null) {
int where=path.lastIndexOf("negativeClose");
dir=path.substring(0,where);
}else {
dir=System.getProperty("user.home");
}
java.io.File file=new java.io.File(dir+System.getProperty("file.separator")+"negativeClose.err");
java.io.FileWriter fw=new java.io.FileWriter(file);
%>
<!-- Now lets try to clear the stream -->
<% try { out.println("oops"); fw.write("no IOException"); fw.flush();fw.close();
}catch(java.io.IOException ioe) { %>
<% fw.write("we got IOException"); fw.flush();fw.close(); }%>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/negativeFlush.jsp
Index: negativeFlush.jsp
===================================================================
<html>
<title>negativeFlush</title>
<body>
<% /**
Name : negativeFlush
Description : We are testing if method flush() flushes the contents of
the buffer.Initially we write something into buffer and
later call the flush method.
**/ %>
<!-- This is to test if flush method throws IOException if stream is closed -->
<%@ page import="java.io.*;" %>
<% out.println("hello"); %>
<% out.close(); %>
<!-- To report this situation, we dont have a stream to client available -->
<!-- we create a file in the directory where jsp is kept which is seen by javatest -->
<%! String dir; %>
<% String path=request.getPathTranslated(); %>
<% if(path!=null) {
int where=path.lastIndexOf("negativeFlush");
dir=path.substring(0,where);
}else{
dir=System.getProperty("user.home");
}
java.io.File file=new java.io.File(dir+System.getProperty("file.separator")+"negativeFlush.err");
java.io.FileWriter fw=new java.io.FileWriter(file);
%>
<!-- Now lets try to flush the stream -->
<% try { out.flush(); fw.write("no IOException"); fw.flush();fw.close();
}catch(java.io.IOException ioe) { %>
<% fw.write("we got IOException"); fw.flush();fw.close(); }%>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveClear.jsp
Index: positiveClear.jsp
===================================================================
<html>
<title>positiveClear</title>
<body>
<%
/*
Name: positiveClear
Description: Initially we write something to the buffer
and later we call the clear() method. If we get a blank page output,
clear works.
*/
%>
<!-- this is to test if clear() method clears the buffer -->
<!-- we are writing into a stream -->
<% out.println("hello"); %>
<!-- clearing the out stream using clear() method -->
<% out.clear(); %>
<!-- expecting blank page -->
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveClose.jsp
Index: positiveClose.jsp
===================================================================
<html>
<title>positiveClose</title>
<body>
<%
/*
Name : positiveClose
Description : Write something to the stream and close the stream. After closing
the stream, try to write something into the stream.
*/
%>
<!-- This is to test if close method works -->
<!-- We should get 'out' object to be null after closing output -->
<%@ page import="java.io.*;" %>
<% out.println("hello"); %>
<% out.close(); %>
<!-- To report that 'out' is null, we dont have a stream to client available -->
<!-- We create a file in the directory where jsp is kept which is seen by javatest -->
<%! String dir; %>
<% String path=request.getPathTranslated(); %>
<% if(path!=null) {
int where=path.lastIndexOf("positiveClose.jsp");
dir=path.substring(0,where);
}else {
dir=System.getProperty("user.home");
}
java.io.File file=new java.io.File(dir+System.getProperty("file.separator")+"positiveClose.err");
java.io.FileWriter fw=new java.io.FileWriter(file);
if(out==null){fw.write("out is null");fw.flush();fw.close(); }
else{fw.write("out is not null");fw.flush();fw.close();} %>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveFlush.jsp
Index: positiveFlush.jsp
===================================================================
<html>
<title>positiveFlush</title>
<body>
<% /**
Name : positiveFlush
Description : Write some thing into the buffer and then call the flush() method.
Expected to flush the buffer to the output stream.
**/ %>
<!-- this is to test if flush() method works -->
<% out.println("hello"); %>
<% out.flush(); %>
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveGetBufferSize.jsp
Index: positiveGetBufferSize.jsp
===================================================================
<html>
<title>positiveGetBufferSize</title>
<body>
<%
/*
Name : positiveGetBufferSize
Description : Set the buffer size,with buffer directive,then use the
getBufferSize() method.
*/
%>
<!-- this is to test if getBufferSize method works -->
<!-- setting buffer size to 5kb using directive -->
<%@ page buffer="5kb" %>
<!-- calling getBufferSize() method -->
<%= out.getBufferSize() %>
<!-- expected to return 5120 as buffer size -->
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveGetBufferSizeUnBuffered.jsp
Index: positiveGetBufferSizeUnBuffered.jsp
===================================================================
<html>
<title>positiveGetBufferSizeUnBuffered</title>
<body>
<%
/*
Name : positiveGetBufferSizeUnBuffered
Description : Set the buffer directive to 'none'.
Then callthe getBufferSize() method.
*/
%>
<!-- this is to test if getBufferSize method works with no buffer-->
<!-- setting buffer size to 'none' using directive -->
<%@ page buffer="none" %>
<% out.println("got="+out.getBufferSize()); %>
<!-- expected to return 0 as buffer is set 'none' -->
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveGetRemaining.jsp
Index: positiveGetRemaining.jsp
===================================================================
<%@ page buffer="5kb" %>
<% int bufferSize = out.getBufferSize();
out.flush();
out.print("hello: ");
int remainingSize = out.getRemaining();
if ( remainingSize == (bufferSize-7) )
out.print("getRemaining test Passed");
else {
out.println("getRemaining Test Failed");
out.println ("Expected Buffer Size = " + bufferSize);
out.println("Remaining Buffer Size = " + remainingSize);
}
%>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveGetRemainingBufferUnset.jsp
Index: positiveGetRemainingBufferUnset.jsp
===================================================================
<html>
<title>positiveGetRemainingBufferUnset</title>
<body>
<%
/*
Name : positiveGetRemainingBufferUnset
Description :Set the buffer directive to 'none' and call
the method getRemaining() in the JSP page.
*/
%>
<!-- this is to test positiveGetRemainingBufferUnset -->
<!-- setting buffer size to none -->
<%@ page buffer="none" %>
<!-- using getRemaining() method to get the buffer size -->
<%= out.getRemaining() %>
<!-- expected to return 1 -->
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveIsAutoFlush.jsp
Index: positiveIsAutoFlush.jsp
===================================================================
<html>
<title>positiveIsAutoFlush</title>
<body>
<%
/*
Name : positiveIsAutoFlush
Description : Set the autoflush directive to 'true' and then
call the isAutoFlush() method .
*/
%>
<!-- this is to test positiveIsAutoFlush -->
<!-- using isAutoFlush() method to get check flush state -->
<%= out.isAutoFlush() %>
<!-- expected to return true -->
</body>
</html>
1.1 jakarta-watchdog-4.0/src/server/jsp-tests/jsp/engine/JspWriter/misc/positiveNewLine.jsp
Index: positiveNewLine.jsp
===================================================================
<html>
<title>positiveNewLine</title>
<body>
<%
/*
Name : positiveNewLine
Description : Call the newLine() method in the JSP page.Check for
number of new lines in the code generated.
*/
%>
<!-- this is to test if newLine() method works -->
<%= System.getProperty("line.separator") %>
<!-- call newLine() method -->
<%
out.newLine();
%>
</body>
</html>