KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > openedit > page > finder > InfiniteLoopTest


1 /*
2 Copyright (c) 2003 eInnovation Inc. All rights reserved
3
4 This library is free software; you can redistribute it and/or modify it under the terms
5 of the GNU Lesser General Public License as published by the Free Software Foundation;
6 either version 2.1 of the License, or (at your option) any later version.
7
8 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
9 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 See the GNU Lesser General Public License for more details.
11 */

12
13 /*
14  * Created on May 8, 2003
15  *
16  */

17 package com.openedit.page.finder;
18
19 import com.openedit.BaseTestCase;
20 import com.openedit.OpenEditException;
21 import com.openedit.WebPageRequest;
22
23
24 /**
25  * DOCUMENT ME!
26  *
27  * @author cburkey
28  */

29 public class InfiniteLoopTest extends BaseTestCase
30 {
31
32     /**
33      * Constructor for InfiniteLoopTest.
34      *
35      * @param arg0
36      */

37     public InfiniteLoopTest(String JavaDoc arg0)
38     {
39         super(arg0);
40     }
41
42     /**
43      * DOCUMENT ME!
44      *
45      * @throws Throwable
46      */

47     public void testLoadingATemplate() throws Throwable JavaDoc
48     {
49         String JavaDoc path = "/normal.html";
50
51         loadPage(path);
52     }
53
54     /**
55      * DOCUMENT ME!
56      *
57      * @throws Throwable
58      */

59     public void XXXtestLoop() throws Throwable JavaDoc
60     {
61         String JavaDoc path = "/selfreferingtest1.html";
62         boolean exceptionThrown = false;
63         try
64         {
65             loadPage(path);
66         }
67         catch (OpenEditException e)
68         {
69             exceptionThrown = true;
70         }
71         assertTrue(exceptionThrown);
72     }
73
74     /**
75      * DOCUMENT ME!
76      *
77      * @throws Throwable
78      */

79     public void testNormalTemplatedPage() throws Throwable JavaDoc
80     {
81         String JavaDoc path = "/defaulttemplate.html";
82
83         loadPage(path);
84     }
85
86     protected void loadPage(String JavaDoc path) throws Exception JavaDoc, OpenEditException, Throwable JavaDoc
87     {
88         WebPageRequest context = getFixture().createPageRequest(path);
89         
90         getFixture().getEngine().beginRender(context);
91         String JavaDoc pageContents = context.getWriter().toString();
92         assertTrue(pageContents.length() < 100000); //since its infinite it would be blank or a short error
93
}
94 }
95
Popular Tags