Author: ivaynberg Date: Sat Feb 13 02:04:42 2010 New Revision: 909694 URL: http://svn.apache.org/viewvc?rev=909694&view=rev Log: more tester and tests wip
Added: wicket/trunk/.gitignore Removed: wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/test/TestPageRender$Page1.html wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/test/TestPageRender.java wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/test/TestWicketTester$Page1.html wicket/trunk/wicket/src/test/java/org/apache/wicket/ng/test/TestWicketTester.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/IndexParamWithStatelessIFrameTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/IndexedHybridUrlCodingStrategyTest$TestPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/IndexedHybridUrlCodingStrategyTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/IndexedSharedResourceCodingStrategyTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/MixedParamUrlCodingStrategyTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/QueryStringUrlCodingStrategyTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Default_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Default_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Hybrid_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Hybrid_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Indexed_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_Indexed_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_QueryString_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatefulPage_QueryString_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Default_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Default_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Hybrid_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Hybrid_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Indexed_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_Indexed_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_QueryString_Result.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessPage_QueryString_SubmitResult.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/StatelessStatefullUrlCodingStrategyTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/TestPage.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/TestPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/TestPageWithIFrame.html wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/TestPageWithIFrame.java wicket/trunk/wicket/src/test/java/org/apache/wicket/request/target/coding/UrlMountingTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/response/BrokenPage.java wicket/trunk/wicket/src/test/java/org/apache/wicket/response/StringResponseTest.java Modified: wicket/trunk/wicket/.settings/org.eclipse.jdt.ui.prefs wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockApplication.java wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockRequestCycle.java wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockWebRequest.java wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/BaseWicketTester.java wicket/trunk/wicket/src/main/java/org/apache/wicket/util/tester/FormTester.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/CheckGroupTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/DropDownChoiceTest.java wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/MockWebApplicationTest.java Added: wicket/trunk/.gitignore URL: http://svn.apache.org/viewvc/wicket/trunk/.gitignore?rev=909694&view=auto ============================================================================== --- wicket/trunk/.gitignore (added) +++ wicket/trunk/.gitignore Sat Feb 13 02:04:42 2010 @@ -0,0 +1,4 @@ +target +.project +.classpath + Modified: wicket/trunk/wicket/.settings/org.eclipse.jdt.ui.prefs URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/.settings/org.eclipse.jdt.ui.prefs?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/.settings/org.eclipse.jdt.ui.prefs (original) +++ wicket/trunk/wicket/.settings/org.eclipse.jdt.ui.prefs Sat Feb 13 02:04:42 2010 @@ -1,64 +1,68 @@ -#Wed Aug 01 11:37:07 CEST 2007 -comment_clear_blank_lines=false -comment_format_comments=true -comment_format_header=true -comment_format_html=true -comment_format_source_code=true -comment_indent_parameter_description=true -comment_indent_root_tags=true -comment_line_length=80 -comment_new_line_for_parameter=true -comment_separate_root_tags=true -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_wicket -formatter_settings_version=11 -instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * Gets ${bare_field_name}.\r\n * @return ${bare_field_name}\r\n */</template><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * Sets ${bare_field_name}.\r\n * @param ${param} ${bare_field_name}\r\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * Construct.\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment"/><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags} \r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements. See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the "License"); you may not use this file except in compliance with\r\n * the License. You may obtain a copy of the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\ n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">throw new RuntimeException(${exception_var});</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="c onstructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.format_source_code=true -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=true -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +#Fri Feb 12 10:21:50 PST 2010 +comment_clear_blank_lines=false +comment_format_comments=true +comment_format_header=true +comment_format_html=true +comment_format_source_code=true +comment_indent_parameter_description=true +comment_indent_root_tags=true +comment_line_length=80 +comment_new_line_for_parameter=true +comment_separate_root_tags=true +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_wicket +formatter_settings_version=11 +instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true +org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * Gets ${bare_field_name}.\r\n * @return ${bare_field_name}\r\n */</template><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * Sets ${bare_field_name}.\r\n * @param ${param} ${bare_field_name}\r\n */</template><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * Construct.\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment"/><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags} \r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/**\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*\r\n * Licensed to the Apache Software Foundation (ASF) under one or more\r\n * contributor license agreements. See the NOTICE file distributed with\r\n * this work for additional information regarding copyright ownership.\r\n * The ASF licenses this file to You under the Apache License, Version 2.0\r\n * (the "License"); you may not use this file except in compliance with\r\n * the License. You may obtain a copy of the License at\r\n *\r\n * http\://www.apache.org/licenses/LICENSE-2.0\r\ n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an "AS IS" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">throw new RuntimeException(${exception_var});</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="c onstructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template></templates> +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=true +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=true +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=true +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=true +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockApplication.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockApplication.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockApplication.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockApplication.java Sat Feb 13 02:04:42 2010 @@ -48,7 +48,7 @@ @Override public String getConfigurationType() { - return DEPLOYMENT; + return DEVELOPMENT; } @Override Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockRequestCycle.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockRequestCycle.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockRequestCycle.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockRequestCycle.java Sat Feb 13 02:04:42 2010 @@ -17,7 +17,6 @@ package org.apache.wicket.ng.mock; import org.apache.wicket.IRequestHandler; -import org.apache.wicket.ng.ThreadContext; import org.apache.wicket.ng.request.cycle.RequestCycle; import org.apache.wicket.ng.request.cycle.RequestCycleContext; @@ -64,11 +63,4 @@ } } - @Override - public void detach() - { - super.detach(); - // keep self in the threadlocal so we can generate urls in the test case - ThreadContext.setRequestCycle(this); - } } Modified: wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockWebRequest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockWebRequest.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockWebRequest.java (original) +++ wicket/trunk/wicket/src/main/java/org/apache/wicket/ng/mock/MockWebRequest.java Sat Feb 13 02:04:42 2010 @@ -35,7 +35,11 @@ */ public class MockWebRequest extends WebRequest { - private final Url url; + private Url url; + private Cookie cookies[]; + private Map<String, List<Object>> headers = new HashMap<String, List<Object>>(); + private MockRequestParameters postRequestParameters = new MockRequestParameters(); + private Locale locale = Locale.getDefault(); /** * Construct. @@ -47,10 +51,26 @@ this.url = url; } + MockWebRequest(Url url, Cookie[] cookies, Map<String, List<Object>> headers, + MockRequestParameters postRequestParameters, Locale locale) + { + this.url = url; + this.cookies = cookies; + this.headers = headers; + this.postRequestParameters = postRequestParameters; + this.locale = locale; + } + + @Override public MockWebRequest requestWithUrl(Url url) { - return new MockWebRequest(url); + return new MockWebRequest(url, cookies, headers, postRequestParameters, locale); + } + + public void setUrl(Url url) + { + this.url = url; } @Override @@ -65,7 +85,6 @@ return "MockWebRequest [url=" + url + "]"; } - private Cookie cookies[]; /** * Sets cookies for current request. @@ -83,7 +102,6 @@ return cookies; } - private final Map<String, List<Object>> headers = new HashMap<String, List<Object>>(); @Override public long getDateHeader(String name) @@ -168,7 +186,6 @@ addHeaderObject(name, value); } - private Locale locale = Locale.getDefault(); /** * Sets request locale. @@ -214,7 +231,6 @@ headers.remove(header); } - private final MockRequestParameters postRequestParameters = new MockRequestParameters(); @Override public MockRequestParameters getPostRequestParameters() 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=909694&r1=909693&r2=909694&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 Sat Feb 13 02:04:42 2010 @@ -70,6 +70,7 @@ import org.apache.wicket.ng.request.handler.IPageProvider; import org.apache.wicket.ng.request.handler.PageAndComponentProvider; import org.apache.wicket.ng.request.handler.PageProvider; +import org.apache.wicket.ng.request.handler.impl.BookmarkablePageRequestHandler; import org.apache.wicket.ng.request.handler.impl.ListenerInterfaceRequestHandler; import org.apache.wicket.ng.request.handler.impl.RenderPageRequestHandler; import org.apache.wicket.protocol.http.WebSession; @@ -138,8 +139,18 @@ private final List<MockWebResponse> previousResponses = new ArrayList<MockWebResponse>(); private final ThreadContext oldThreadContext; + + /** current request */ + private MockWebRequest request; + /** current response */ + private MockWebResponse response; + + /** current session */ private final Session session; + /** current request cycle */ + private MockRequestCycle requestCycle; + /** * Creates <code>WicketTester</code> and automatically create a <code>WebApplication</code>, but * the tester will have no home page. @@ -196,9 +207,31 @@ this.application.set(); this.application.initApplication(); + // prepare session session = new WebSession(new MockWebRequest(Url.parse("/"))); getApplication().getSessionStore().bind(null, session); ThreadContext.setSession(session); + + setupNextRequestCycle(); + } + + private void setupNextRequestCycle() + { + request = new MockWebRequest(Url.parse("/")); + response = new MockWebResponse(); + requestCycle = (MockRequestCycle)application.createRequestCycle(request, response); + ThreadContext.setRequestCycle(requestCycle); + } + + public MockWebRequest getRequest() + { + return request; + } + + public void setRequest(MockWebRequest request) + { + this.request = request; + requestCycle.setRequest(request); } @@ -245,6 +278,12 @@ ThreadContext.detach(); } + + public void processRequest() + { + processRequest(null, null); + } + /** * Processes the request in mocked Wicket environment. * @@ -254,7 +293,7 @@ */ public void processRequest(MockWebRequest request) { - processRequest(request); + processRequest(request, null); } /** @@ -271,29 +310,21 @@ { try { - if (lastRequest != null) - { - previousRequests.add(lastRequest); - } - if (lastResponse != null) + if (request != null) { - previousResponses.add(lastResponse); + setRequest(request); } - lastRequest = request; - lastResponse = new MockWebResponse(); - - MockRequestCycle cycle = (MockRequestCycle)application.createRequestCycle(request, - lastResponse); - - ThreadContext.setRequestCycle(cycle); if (forcedRequestHandler != null) { - cycle.forceRequestHandler(forcedRequestHandler); + requestCycle.forceRequestHandler(forcedRequestHandler); } - cycle.processRequestAndDetach(); + requestCycle.processRequestAndDetach(); + + recordRequestResponse(); + setupNextRequestCycle(); if (followRedirects && lastResponse.isRedirect()) { @@ -310,10 +341,12 @@ } // append redirect URL to current URL (what browser would do) - Url mergedURL = new Url(request.getUrl().getSegments(), newUrl.getQueryParameters()); + Url mergedURL = new Url(lastRequest.getUrl().getSegments(), + newUrl.getQueryParameters()); mergedURL.concatSegments(newUrl.getSegments()); - processRequest(new MockWebRequest(mergedURL), null); + this.request.setUrl(mergedURL); + processRequest(); --redirectCount; } @@ -324,6 +357,15 @@ } } + private void recordRequestResponse() + { + lastRequest = request; + lastResponse = response; + + previousRequests.add(request); + previousResponses.add(response); + } + /** * Renders the page specified by given {...@link IPageProvider}. After render the page instance can * be retreived using {...@link #getLastRenderedPage()} and the rendered document will be available @@ -337,7 +379,7 @@ */ public Page startPage(IPageProvider pageProvider) { - MockWebRequest request = new MockWebRequest(new Url()); + request = new MockWebRequest(new Url()); IRequestHandler handler = new RenderPageRequestHandler(pageProvider); processRequest(request, handler); return getLastRenderedPage(); @@ -356,14 +398,6 @@ } /** - * @return last request or <code>null</code> if no request has happened yet. - */ - public MockWebRequest getLastRequest() - { - return lastRequest; - } - - /** * @return last response or <code>null</code>> if no response has been produced yet. */ public MockWebResponse getLastResponse() @@ -541,9 +575,13 @@ * a test <code>Page</code> class with default constructor * @return the rendered <code>Page</code> */ - public final <C extends Page> Page startPage(Class<C> pageClass) + public final <C extends Page> void startPage(Class<C> pageClass) { - return startPage(new PageProvider(pageClass)); + // + request.setUrl(RequestCycle.get().urlFor( + new BookmarkablePageRequestHandler(new PageProvider(pageClass)))); + processRequest(); +// return startPage(new PageProvider(pageClass)); } /** @@ -924,7 +962,7 @@ SubmitLink submitLink = (SubmitLink)linkComponent; String pageRelativePath = submitLink.getInputName(); - getLastRequest().getPostRequestParameters().setParameterValue(pageRelativePath, "x"); + request.getPostRequestParameters().setParameterValue(pageRelativePath, "x"); submitForm(submitLink.getForm().getPageRelativePath()); } @@ -968,6 +1006,11 @@ } } + public void submitForm(Form form) + { + submitForm(form.getPageRelativePath()); + } + /** * Submits the <code>Form</code> in the last rendered <code>Page</code>. * @@ -978,13 +1021,10 @@ { Form<?> form = (Form<?>)getComponentFromLastRenderedPage(path); Url url = Url.parse(form.urlFor(IFormSubmitListener.INTERFACE).toString()); - processRequest(getLastRequest().requestWithUrl(url)); + request.setUrl(url); + processRequest(); } - public void setParameterForNextRequest(String param, String value) - { - getLastRequest().getPostRequestParameters().setParameterValue(param, value); - } /** * Asserts the last rendered <code>Page</code> class. @@ -1396,7 +1436,7 @@ notNull(failMessage, form); Url url = Url.parse(behavior.getCallbackUrl().toString()); - processRequest(getLastRequest().requestWithUrl(url), null); + processRequest(request.requestWithUrl(url), null); } /** 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=909694&r1=909693&r2=909694&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 Sat Feb 13 02:04:42 2010 @@ -343,7 +343,7 @@ private final String path; /** <code>BaseWicketTester</code> that create <code>FormTester</code> */ - private final BaseWicketTester baseWicketTester; + private final BaseWicketTester tester; /** <code>FormComponent</code> to be tested */ private final Form<?> workingForm; @@ -366,7 +366,7 @@ { this.path = path; this.workingForm = workingForm; - baseWicketTester = wicketTester; + tester = wicketTester; // fill blank String for Text Component. workingForm.visitFormComponents(new FormComponent.AbstractVisitor() @@ -649,8 +649,8 @@ checkClosed(); try { - baseWicketTester.getLastRenderedPage().getSession().cleanupFeedbackMessages(); - baseWicketTester.submitForm(path); + tester.getLastRenderedPage().getSession().cleanupFeedbackMessages(); + tester.submitForm(path); // servletRequest.setUseMultiPartContentType(isMultiPart()); } finally @@ -716,12 +716,12 @@ { if (pageRelative) { - baseWicketTester.clickLink(path, false); + tester.clickLink(path, false); } else { path = this.path + ":" + path; - baseWicketTester.clickLink(path, false); + tester.clickLink(path, false); } } @@ -738,7 +738,7 @@ { if (parameterExist(formComponent)) { - List<StringValue> values = baseWicketTester.getLastRequest() + List<StringValue> values = tester.getRequest() .getPostRequestParameters() .getParameterValues(formComponent.getInputName()); // remove duplicated @@ -755,7 +755,7 @@ { values.add(StringValue.valueOf(val)); } - baseWicketTester.getLastRequest().getPostRequestParameters().setParameterValues( + tester.getRequest().getPostRequestParameters().setParameterValues( formComponent.getInputName(), values); } else @@ -786,7 +786,7 @@ */ private boolean parameterExist(FormComponent<?> formComponent) { - String parameter = baseWicketTester.getLastRequest() + String parameter = tester.getRequest() .getPostRequestParameters() .getParameterValue(formComponent.getInputName()) .toString(); @@ -803,7 +803,7 @@ */ private void setFormComponentValue(FormComponent<?> formComponent, String value) { - baseWicketTester.getLastRequest().getPostRequestParameters().setParameterValue( + tester.getRequest().getPostRequestParameters().setParameterValue( formComponent.getInputName(), value); } @@ -817,7 +817,7 @@ */ private void setFormSubmittingComponentValue(IFormSubmittingComponent component, String value) { - baseWicketTester.getLastRequest().getPostRequestParameters().setParameterValue( + tester.getRequest().getPostRequestParameters().setParameterValue( component.getInputName(), value); } Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/CheckGroupTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/CheckGroupTest.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/CheckGroupTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/CheckGroupTest.java Sat Feb 13 02:04:42 2010 @@ -42,15 +42,6 @@ */ public class CheckGroupTest extends WicketTestCase { - - /** - * @param name - */ - public CheckGroupTest(String name) - { - super(name); - } - /** * mock model object with an embedded property used to test compound property model * @@ -128,8 +119,6 @@ // set up necessary objects to emulate a form submission - tester.createRequestCycle(); - // this could have been any page it seems. see comment at method MockPage page = new MockPage(); @@ -170,13 +159,13 @@ assertTrue("running with nothing selected - model must be empty", modelObject.getProp1() .size() == 0); - tester.getServletRequest().setParameter(group.getInputName(), + tester.getRequest().getPostRequestParameters().setParameterValue(group.getInputName(), String.valueOf(choice1.getValue())); form.onFormSubmitted(); assertTrue("running with choice1 selected - model must only contain value of check1", modelObject.getProp1().size() == 1 && modelObject.getProp1().contains(check1)); - tester.getServletRequest().setParameter(group.getInputName(), + tester.getRequest().getPostRequestParameters().setParameterValue(group.getInputName(), String.valueOf(choice2.getValue())); form.onFormSubmitted(); assertTrue("running with choice2 selected - model must only contain value of check2", @@ -184,18 +173,23 @@ // throw in some nulls into the request param to make sure they are // ignored - tester.getServletRequest().getParameterMap().put( - group.getInputName(), - new String[] { null, String.valueOf(choice1.getValue()), null, - String.valueOf(choice2.getValue()) }); + tester.getRequest() + .getPostRequestParameters() + .addParameterValue(group.getInputName(), null); + tester.getRequest().getPostRequestParameters().addParameterValue(group.getInputName(), + String.valueOf(choice1.getValue())); + tester.getRequest().getPostRequestParameters().addParameterValue(group.getInputName(), + String.valueOf(choice2.getValue())); + form.onFormSubmitted(); + assertTrue( "running with choice1 and choice2 selected - model must only contain values of check1 and check2", modelObject.getProp1().size() == 2 && modelObject.getProp1().contains(check2) && modelObject.getProp1().contains(check1)); - tester.getServletRequest().getParameterMap().put(group.getInputName(), - new String[] { "some weird choice uuid to test error" }); + tester.getRequest().getPostRequestParameters().setParameterValue(group.getInputName(), + "some weird choice uuid to test error"); try { form.onFormSubmitted(); Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/DropDownChoiceTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/DropDownChoiceTest.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/DropDownChoiceTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/markup/html/form/DropDownChoiceTest.java Sat Feb 13 02:04:42 2010 @@ -24,15 +24,6 @@ */ public class DropDownChoiceTest extends WicketTestCase { - /** - * Construct. - * - * @param name - */ - public DropDownChoiceTest(String name) - { - super(name); - } /** * Test Case for jira issue 1979 Modified: wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/MockWebApplicationTest.java URL: http://svn.apache.org/viewvc/wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/MockWebApplicationTest.java?rev=909694&r1=909693&r2=909694&view=diff ============================================================================== --- wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/MockWebApplicationTest.java (original) +++ wicket/trunk/wicket/src/test/java/org/apache/wicket/protocol/http/MockWebApplicationTest.java Sat Feb 13 02:04:42 2010 @@ -87,7 +87,7 @@ public void testRenderHomePage() throws Exception { // Validate the document - String document = application.getServletResponse().getDocument(); + String document = application.getLastResponseAsString(); DiffUtil.validatePage(document, getClass(), "MockPage_expectedResult.html", true); // Inspect the page & model