Author: ivaynberg
Date: Sun Feb 28 08:12:08 2010
New Revision: 917141

URL: http://svn.apache.org/viewvc?rev=917141&view=rev
Log:
test fixes

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_10.java
    
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/pages/StatelessFormTest.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
 (original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java
 Sun Feb 28 08:12:08 2010
@@ -348,10 +348,21 @@
                return processRequest(request, forcedRequestHandler, false);
        }
 
+       public boolean processRequest(IRequestHandler forcedRequestHandler)
+       {
+               return processRequest(null, forcedRequestHandler, false);
+       }
+
+
        private boolean processRequest(MockWebRequest forcedRequest,
                IRequestHandler forcedRequestHandler, boolean redirect)
        {
 
+               if (!redirect)
+               {
+                       lastRenderedPage = null;
+               }
+
                if (forcedRequest != null)
                {
                        request = forcedRequest;

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/RestartWithMountedPageTest.java
 Sun Feb 28 08:12:08 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.wicket;
 
-import org.apache.wicket.util.lang.PackageName;
 
 /**
  * @author jcompagner
@@ -25,36 +24,6 @@
 {
 
        /**
-        * Construct.
-        */
-       public RestartWithMountedPageTest()
-       {
-               super();
-       }
-
-       /**
-        * Construct.
-        * 
-        * @param name
-        */
-       public RestartWithMountedPageTest(String name)
-       {
-               super(name);
-       }
-
-
-       /**
-        * Tests that a protected page can redirect to a login page from a 
mounted package.
-        */
-       public void testWithMountedPackage()
-       {
-               tester.getApplication().mount("/test",
-                       
PackageName.forPackage(ProtectedPage.class.getPackage()));
-               tester.startPage(ProtectedPage.class);
-               tester.assertRenderedPage(LoginPage.class);
-       }
-
-       /**
         * Tests that a protected page can redirect to a login page from 
mounted pages.
         */
        public void testWithMountedLoginPage()

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageExpectedResult_16.html
 Sun Feb 28 08:12:08 2010
@@ -3,7 +3,7 @@
   <test wicket:id="test1">test</test>
   <test wicket:id="test2"/>
   <!-- note that span tag are allows changed to open-body-close. See 
OpenCloseTagExpander -->
-  <test wicket:id="test3"></test>
+  <test wicket:id="test3"/>
   <test wicket:id="test4"></test>
 </body>
 </html>

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePageTest.java
 Sun Feb 28 08:12:08 2010
@@ -308,12 +308,9 @@
         */
        public void testRenderHomePage_10() throws Exception
        {
-               executeTest(SimplePage_10.class, 
"SimplePageExpectedResult_10.html");
+               executeTest(new SimplePage_10(false), 
"SimplePageExpectedResult_10.html");
+               tester.startPage(new SimplePage_10(true));
                String document = tester.getLastResponseAsString();
-               Panel panel = 
(Panel)tester.getLastRenderedPage().get("myPanel");
-               assertNotNull(panel);
-
-               panel.setVisible(true);
                assertTrue(document.contains("<wicket:panel>Inside the 
panel<span wicket:id=\"label\">mein Label</span></wicket:panel>"));
        }
 

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_10.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_10.java?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_10.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/basic/SimplePage_10.java
 Sun Feb 28 08:12:08 2010
@@ -31,8 +31,8 @@
        /**
         * Construct.
         */
-       public SimplePage_10()
+       public SimplePage_10(boolean visible)
        {
-               add(new SimplePanel("myPanel").setVisible(false));
+               add(new SimplePanel("myPanel").setVisible(visible));
        }
 }

Modified: 
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/pages/StatelessFormTest.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/pages/StatelessFormTest.java?rev=917141&r1=917140&r2=917141&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/pages/StatelessFormTest.java
 (original)
+++ 
wicket/trunk/wicket/src/test/java/org/apache/wicket/stateless/pages/StatelessFormTest.java
 Sun Feb 28 08:12:08 2010
@@ -18,7 +18,8 @@
 
 import org.apache.wicket.Page;
 import org.apache.wicket.WicketTestCase;
-import org.apache.wicket.protocol.http.WebApplication;
+import org.apache.wicket.ng.mock.MockApplication;
+import org.apache.wicket.ng.request.Url;
 import org.apache.wicket.util.tester.WicketTester;
 
 /**
@@ -30,7 +31,7 @@
        @Override
        protected void setUp() throws Exception
        {
-               tester = new WicketTester(new WebApplication()
+               tester = new WicketTester(new MockApplication()
                {
                        @Override
                        protected void init()
@@ -46,33 +47,24 @@
                                return Page1.class;
                        }
 
-                       @Override
-                       protected void outputDevelopmentModeWarning()
-                       {
-                               // Do nothing.
-                       }
                });
        }
 
        public void testBug()
        {
                {
-                       final WebRequestCycle cycle = 
tester.setupRequestAndResponse(false);
-                       tester.getServletRequest().setURL("page2");
-                       tester.processRequestCycle(cycle);
+                       tester.getRequest().setUrl(Url.parse("page2"));
+                       tester.processRequest();
                        tester.assertRenderedPage(Page2.class);
                }
                {
-                       final WebRequestCycle cycle = 
tester.setupRequestAndResponse(false);
-                       tester.getServletRequest().setURL("page1");
-                       tester.processRequestCycle(cycle);
+                       tester.getRequest().setUrl(Url.parse("page1"));
+                       tester.processRequest();
                        tester.assertRenderedPage(Page1.class);
                }
                {
-                       final WebRequestCycle cycle = 
tester.setupRequestAndResponse(false);
-                       tester.getServletRequest().setURL(
-                               
"page1/wicket:interface/:0:form::IFormSubmitListener::");
-                       tester.processRequestCycle(cycle);
+                       
tester.getRequest().setUrl(Url.parse("page1?1-1.IFormSubmitListener-form"));
+                       tester.processRequest();
                        tester.assertRenderedPage(Page1.class);
                }
        }


Reply via email to