Author: pete
Date: Thu Dec  2 00:53:51 2010
New Revision: 1041238

URL: http://svn.apache.org/viewvc?rev=1041238&view=rev
Log:
make multipart form submits working again with FormTester

Modified:
    
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java

Modified: 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java
URL: 
http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java?rev=1041238&r1=1041237&r2=1041238&view=diff
==============================================================================
--- 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java 
(original)
+++ 
wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java 
Thu Dec  2 00:53:51 2010
@@ -17,7 +17,6 @@
 package org.apache.wicket.util.tester;
 
 
-import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.ArrayList;
@@ -80,7 +79,7 @@ public class FormTester
                        }
 
                        /**
-                        * @see 
org.apache.wicket.IVisitor#component(org.apache.wicket.Component)
+                        * @see 
org.apache.wicket.util.visit.IVisitor#component(Object, 
org.apache.wicket.util.visit.IVisit)
                         */
                        public void component(final Component component, final 
IVisit<Component> visit)
                        {
@@ -303,8 +302,7 @@ public class FormTester
                        }
                        else
                        {
-                               fail("Selecting on the component:'" + 
formComponent.getPath() +
-                                       "' is not supported.");
+                               fail("Selecting on the component:'" + 
formComponent.getPath() + "' is not supported.");
                                return null;
                        }
                }
@@ -687,8 +685,8 @@ public class FormTester
                try
                {
                        
tester.getLastRenderedPage().getSession().cleanupFeedbackMessages();
+                       
tester.getRequest().setUseMultiPartContentType(workingForm.isMultiPart());
                        tester.submitForm(path);
-// servletRequest.setUseMultiPartContentType(isMultiPart());
                }
                finally
                {
@@ -696,28 +694,6 @@ public class FormTester
                }
        }
 
-       private boolean isMultiPart()
-       {
-               try
-               {
-                       Field multiPart = 
Form.class.getDeclaredField("multiPart");
-                       multiPart.setAccessible(true);
-                       return multiPart.getShort(workingForm) != 0;
-               }
-               catch (SecurityException e)
-               {
-                       throw new RuntimeException(e);
-               }
-               catch (NoSuchFieldException e)
-               {
-                       throw new RuntimeException(e);
-               }
-               catch (IllegalAccessException e)
-               {
-                       throw new RuntimeException(e);
-               }
-       }
-
        /**
         * A convenience method for submitting the <code>Form</code> with an 
alternate button.
         * <p>


Reply via email to