Author: jcompagner
Date: Wed Feb 18 12:31:27 2009
New Revision: 745497

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

Modified:
    
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
    
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
    
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html?rev=745497&r1=745496&r2=745497&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
 Wed Feb 18 12:31:27 2009
@@ -5,4 +5,4 @@
 wicketAjaxDebugEnable=true;
 /*-->]^]^>*/</script>
 
-</head>]]></header-contribution><component id="linja11" ><![CDATA[<span 
id="linja11">1</span>]]></component><evaluate><![CDATA[setTimeout("var 
wcall=wicketAjaxGet('?wicket:interface=:0:testPanel:baseSpan:linja1::IActivePageBehaviorListener:0:-1&amp;wicket:ignoreIfNotActive=true',null,null,
 function() {var c = Wicket.$('linja11'); return typeof(c) != 'undefined' && c 
!= null}.bind(this));", 2000);]]></evaluate></ajax-response>
\ No newline at end of file
+</head>]]></header-contribution><component id="linja11" ><![CDATA[<span 
id="linja11">1</span>]]></component><evaluate><![CDATA[setTimeout("var 
wcall=wicketAjaxGet('?wicket:interface=:0:testPanel:baseSpan:linja1::IActivePageBehaviorListener:0:-1&wicket:ignoreIfNotActive=true',null,null,
 function() {var c = Wicket.$('linja11'); return typeof(c) != 'undefined' && c 
!= null}.bind(this));", 2000);]]></evaluate></ajax-response>
\ No newline at end of file

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html?rev=745497&r1=745496&r2=745497&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
 Wed Feb 18 12:31:27 2009
@@ -9,7 +9,7 @@
 /*-->]]>*/</script>
 
 <script type="text/javascript" ><!--/*--><![CDATA[/*><!--*/
-Wicket.Event.add(window, "load", function() { setTimeout("var 
wcall=wicketAjaxGet('?wicket:interface=:0:testPanel:baseSpan:linja1::IActivePageBehaviorListener:0:&amp;wicket:ignoreIfNotActive=true',null,null,
 function() {var c = Wicket.$('linja11'); return typeof(c) != 'undefined' && c 
!= null}.bind(this));", 2000);;});
+Wicket.Event.add(window, "load", function() { setTimeout("var 
wcall=wicketAjaxGet('?wicket:interface=:0:testPanel:baseSpan:linja1::IActivePageBehaviorListener:0:&wicket:ignoreIfNotActive=true',null,null,
 function() {var c = Wicket.$('linja11'); return typeof(c) != 'undefined' && c 
!= null}.bind(this));", 2000);;});
 /*-->]]>*/</script>
 
 </head>

Modified: 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java?rev=745497&r1=745496&r2=745497&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java
 (original)
+++ 
wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/tester/WicketTesterTest.java
 Wed Feb 18 12:31:27 2009
@@ -22,6 +22,7 @@
 import javax.servlet.http.Cookie;
 
 import junit.framework.TestCase;
+
 import org.apache.wicket.Component;
 import org.apache.wicket.MockPageWithLink;
 import org.apache.wicket.MockPageWithOneComponent;
@@ -447,6 +448,8 @@
                        }
                });
 
+               tester.setupRequestAndResponse();
+
                // Execute the event
                tester.executeAjaxEvent(label, "ondblclick");
 
@@ -466,7 +469,8 @@
 
        public void 
testTesterCanBeOverridenToNotReuseExistingRequestCycleInExecuteAjaxEvent()
        {
-               tester = new WicketTester(new MyMockApplication()) {
+               tester = new WicketTester(new MyMockApplication())
+               {
                        protected WebRequestCycle resolveRequestCycle()
                        {
                                return setupRequestAndResponse(true);
@@ -485,26 +489,25 @@
                
tester.startPage(MockPageWithFormAndAjaxFormSubmitBehavior.class);
 
                // Get the page
-               MockPageWithFormAndAjaxFormSubmitBehavior page = 
(MockPageWithFormAndAjaxFormSubmitBehavior)tester
-                               .getLastRenderedPage();
+               MockPageWithFormAndAjaxFormSubmitBehavior page = 
(MockPageWithFormAndAjaxFormSubmitBehavior)tester.getLastRenderedPage();
 
                Pojo pojo = page.getPojo();
 
                assertEquals("Mock name", pojo.getName());
                assertEquals("Mock name", 
((TextField)tester.getComponentFromLastRenderedPage("form" +
-                               Component.PATH_SEPARATOR + "name")).getValue());
+                       Component.PATH_SEPARATOR + "name")).getValue());
 
                assertFalse(page.isExecuted());
 
                // Execute the ajax event
                
tester.executeAjaxEvent(MockPageWithFormAndAjaxFormSubmitBehavior.EVENT_COMPONENT,
-                               "onclick");
+                       "onclick");
 
                assertTrue("AjaxFormSubmitBehavior.onSubmit() has not been 
executed in " +
-                               
MockPageWithFormAndAjaxFormSubmitBehavior.class, page.isExecuted());
+                       MockPageWithFormAndAjaxFormSubmitBehavior.class, 
page.isExecuted());
 
                assertEquals("Mock name", 
((TextField)tester.getComponentFromLastRenderedPage("form" +
-                               Component.PATH_SEPARATOR + "name")).getValue());
+                       Component.PATH_SEPARATOR + "name")).getValue());
 
                // The name of the pojo should still be the same. If the
                // executeAjaxEvent weren't submitting the form the name would 
have been
@@ -545,7 +548,7 @@
                {
                        tester.startPage(BlockedResourceLinkPage.class);
                        fail("Accessing " + BlockedResourceLinkPage.class + " 
should have raised a " +
-                                       PackageResourceBlockedException.class);
+                               PackageResourceBlockedException.class);
                }
                catch (PackageResourceBlockedException e)
                {
@@ -560,9 +563,11 @@
        IRequestTargetUrlCodingStrategy getRequestCodingStrategy()
        {
                String relativePath = 
tester.getApplication().getWicketFilter().getRelativePath(
-                               tester.getServletRequest());
-               return 
tester.getApplication().getRequestCycleProcessor().getRequestCodingStrategy()
-                               .urlCodingStrategyForPath(relativePath);
+                       tester.getServletRequest());
+               return tester.getApplication()
+                       .getRequestCycleProcessor()
+                       .getRequestCodingStrategy()
+                       .urlCodingStrategyForPath(relativePath);
        }
 
        /**
@@ -612,7 +617,7 @@
        {
                tester.getServletResponse().addCookie(new Cookie("name", 
"value"));
                Collection cookies = tester.getServletResponse().getCookies();
-               assertEquals(((Cookie) cookies.iterator().next()).getValue(), 
"value");
+               assertEquals(((Cookie)cookies.iterator().next()).getValue(), 
"value");
        }
 
        public void testCookieIsFoundOnNextRequestWhenAddedToWicketResponse()


Reply via email to