You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by jd...@apache.org on 2006/11/06 14:33:26 UTC
svn commit: r471726 [1/4] - in /incubator/wicket/trunk/wicket/src:
main/java/wicket/protocol/http/ main/java/wicket/util/diff/
main/java/wicket/util/tester/ test/java/wicket/ test/java/wicket/ajax/
test/java/wicket/ajax/markup/html/ajaxLink/ test/java/...
Author: jdonnerstag
Date: Mon Nov 6 05:33:20 2006
New Revision: 471726
URL: http://svn.apache.org/viewvc?view=rev&rev=471726
Log:
MockWebApplication and WicketTester are no longer derived from WebApplication which allows to use
"MyApplication" for testing as well instead of copy & paste the MyApps code.
Added:
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_5/MyApplication.java
- copied, changed from r471520, incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_5/AppTester.java
Removed:
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_5/AppTester.java
Modified:
incubator/wicket/trunk/wicket/src/main/java/wicket/protocol/http/MockWebApplication.java
incubator/wicket/trunk/wicket/src/main/java/wicket/util/diff/DiffUtil.java
incubator/wicket/trunk/wicket/src/main/java/wicket/util/tester/WicketTester.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ApplicationSettingsTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/AttributeModifierComponentTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/AuthorizationTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/FormDispatchEventTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/HomePageRedirectTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/LocalizerTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/SharedResourceUrlTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/WicketMessageAttributeTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/WicketTestCase.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/AjaxRequestTargetTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/MockComponent3-expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitButtonTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitLinkTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/ComponentCreateTagTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_12.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_5.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_7.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupParserTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/WicketNamespaceTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/PackageResourceTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/ScopedComponentResolverTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/autolink/MyPageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/autolink/PageAExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/basic/HomePageRedirectTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/basic/SimplePageExpectedResult_12.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/basic/SimplePageTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/basic/SimpleResponsePageClassTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/border/BoxBorderTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_3.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_7-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/border/BoxBorderTestPage_ExpectedResult_7.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/ButtonTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupDisabledTestPage_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupTestPage1_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupTestPage2_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupTestPage3_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/CheckGroupTestPage4_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/RadioGroupDisabledTestPage_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/RadioGroupTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/RadioGroupTestPage1_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/RadioGroupTestPage3_expected.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/ValidatorPropertiesTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/login/InterceptTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/persistence/CookieValuePersisterTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/form/upload/FileUploadFieldTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/header/inheritance/InheritanceHeadTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/header/testing3/HeaderTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/header/testing3/TestPage_ExpectedResult-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/header/testing3/TestPage_ExpectedResult-2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/internal/EnclosureTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/internal/HtmlHeaderContainerTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/AutolinkPageExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/AutolinkPageExpectedResult_2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/AutolinkPageExpectedResult_3.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/AutolinkPageExpectedResult_4.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/AutolinkTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/BookmarkableHomePageLinksPage_result.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/ContextPathLinkTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/ContextPathPageDefaultContextResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/ContextPathPageEmptyContextResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/ContextPathPageRootContextResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/HrefTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/link/IndexedParamUrlCodingTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/IncrementalTableNavigationPage_ExpectedResult_1-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/IncrementalTableNavigationPage_ExpectedResult_1-2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/IncrementalTableNavigationPage_ExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/IncrementalTableNavigationTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/ListViewTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_3.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_4.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_5.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_6.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_7.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorExpectedResult_8.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_3.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_4.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_5.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_6.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderExpectedResult_7.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithLabelProviderTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_3.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_4.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_5.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_6.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginExpectedResult_7.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableNavigatorWithMarginTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTablePageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/PagedTableTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/list/SimpleTableTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/panel/InlinePanelPageExpectedResult_6.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/panel/PanelTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/tags/InputTagNotVisibleWebPageResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/html/tags/InputTagVisibleWebPageResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/PageExpectedResult_1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/PrependContextPathHandlerTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/DoubleHeaderPartPageExpectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_12.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_14.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_9.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/HeaderSectionPageExpectedResult_9a.html
incubator/wicket/trunk/wicket/src/test/java/wicket/markup/parser/filter/HeaderSectionTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/model/StringResourceModelTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/performance/MarkupParserPerformanceTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/properties/MyApplication.java
incubator/wicket/trunk/wicket/src/test/java/wicket/properties/MyTesterApplication.java
incubator/wicket/trunk/wicket/src/test/java/wicket/properties/PropertiesTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/MockPage_expectedResult.html
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/MockPage_expectedResult2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/MockWebApplicationTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/WebRequestTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/WicketTagPanelTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/portlet/MockPortletApplication.java
incubator/wicket/trunk/wicket/src/test/java/wicket/protocol/http/portlet/MockPortletApplicationTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/resource/ApplicationStringResourceLoaderTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/resource/ComponentStringResourceLoaderTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/resource/DummyApplication.java
incubator/wicket/trunk/wicket/src/test/java/wicket/resource/StringResourceLoaderTestBase.java
incubator/wicket/trunk/wicket/src/test/java/wicket/session/DefaultPageFactoryTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/stateless/StatelessComponentPage_result.html
incubator/wicket/trunk/wicket/src/test/java/wicket/util/parse/metapattern/parsers/IndexedParamTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/parse/metapattern/parsers/IndexedParamTest_ExpectedResult-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/FormTesterTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_2/Test.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_3/FormTesterTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_4/FormTesterTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_5/ListTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_6/AjaxLinkClickTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_6/AjaxSubmitLinkClickTest.java
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_7/ExpectedResult-1.html
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_7/ExpectedResult-2.html
incubator/wicket/trunk/wicket/src/test/java/wicket/util/tester/apps_7/FormTesterTest.java
Modified: incubator/wicket/trunk/wicket/src/main/java/wicket/protocol/http/MockWebApplication.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/protocol/http/MockWebApplication.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/main/java/wicket/protocol/http/MockWebApplication.java (original)
+++ incubator/wicket/trunk/wicket/src/main/java/wicket/protocol/http/MockWebApplication.java Mon Nov 6 05:33:20 2006
@@ -37,15 +37,15 @@
import wicket.Session;
import wicket.markup.html.pages.ExceptionErrorPage;
import wicket.protocol.http.servlet.ServletWebRequest;
+import wicket.request.target.component.BookmarkablePageRequestTarget;
import wicket.request.target.component.IBookmarkablePageRequestTarget;
import wicket.request.target.component.IPageRequestTarget;
import wicket.session.DefaultPageFactory;
-import wicket.session.ISessionStore;
import wicket.settings.IRequestCycleSettings.RenderStrategy;
import wicket.util.file.WebApplicationPath;
/**
- * This class provides a mock implementation of a Wicket HTTP based application
+ * This class provides a mock implementation of a Wicket HTTP based tester
* that can be used for testing. It emulates all of the functionality of an
* HttpServlet in a controlled, single-threaded environment. It is supported
* with mock objects for WebSession, HttpServletRequest, HttpServletResponse and
@@ -56,9 +56,9 @@
* for testing. To use certain features such as localization you must also call
* setupRequestAndResponse().
* <p>
- * The application takes an optional path attribute that defines a directory on
+ * The tester takes an optional path attribute that defines a directory on
* the disk which will correspond to the root of the WAR bundle. This can then
- * be used for locating non-application resources.
+ * be used for locating non-tester resources.
* <p>
* To actually test the processing of a particular page or component you can
* also call processRequestCycle() to do all the normal work of a Wicket
@@ -77,12 +77,12 @@
* <ul>
* <li>This harness is SINGLE THREADED - there is only one global session. For
* multi-threaded testing you must do integration testing with a full
- * application server.
+ * tester server.
* </ul>
*
* @author Chris Turner
*/
-public class MockWebApplication extends WebApplication
+public class MockWebApplication
{
/** Logging */
@SuppressWarnings("unused")
@@ -102,7 +102,7 @@
/** Mock http servlet session. */
private MockHttpSession servletSession;
-
+
/** Request. */
private WebRequest wicketRequest;
@@ -118,17 +118,24 @@
/** The homepage */
private Class<? extends Page> homePage;
+ /** The tester object */
+ private final WebApplication application;
+
/**
- * Create the mock http application that can be used for testing.
+ * Create the mock http tester that can be used for testing.
*
+ * @param application
+ * The wicket application object
* @param path
- * The absolute path on disk to the web application contents
+ * The absolute path on disk to the web tester contents
* (e.g. war root) - may be null
* @see wicket.protocol.http.MockServletContext
*/
- public MockWebApplication(final String path)
+ public MockWebApplication(final WebApplication application, final String path)
{
- final MockServletContext context = new MockServletContext(this, null);
+ this.application = application;
+
+ final MockServletContext context = new MockServletContext(this.application, null);
WicketFilter filter = new WicketFilter()
{
@Override
@@ -138,11 +145,12 @@
{
public WebApplication createApplication(WicketFilter filter)
{
- return MockWebApplication.this;
+ return application;
};
};
}
};
+
try
{
filter.init(new FilterConfig()
@@ -160,9 +168,9 @@
public String getInitParameter(String name)
{
- if(name.equals(WicketFilter.FILTER_PATH_PARAM))
+ if (name.equals(WicketFilter.FILTER_PATH_PARAM))
{
- return getName();
+ return application.getName();
}
return null;
}
@@ -177,33 +185,59 @@
{
throw new RuntimeException(e);
}
- Application.set(this);
- }
-
- @Override
- protected void init()
- {
- ServletContext context = getServletContext();
- servletSession = new MockHttpSession(context);
- servletRequest = new MockHttpServletRequest(this, servletSession, context);
- servletResponse = new MockHttpServletResponse();
- wicketRequest = newWebRequest(servletRequest);
- wicketSession = getSession(wicketRequest);
+
+ Application.set(this.application);
+
+ this.servletSession = new MockHttpSession(context);
+ this.servletRequest = new MockHttpServletRequest(this.application, servletSession, context);
+ this.servletResponse = new MockHttpServletResponse();
+ this.wicketRequest = this.application.newWebRequest(servletRequest);
+ this.wicketSession = this.application.getSession(wicketRequest);
+
+ // -----------------------------------
+ // Copied from WicketFilter
+
+ // Call internal init method of web application for default
+ // initialisation
+ this.application.internalInit();
+
+ // Call init method of web application
+ this.application.init();
+
+ // We initialize components here rather than in the constructor or
+ // in the internal init, because in the init method class aliases
+ // can be added, that would be used in installing resources in the
+ // component.
+ this.application.initializeComponents();
+
+ // Give the application the option to log that it is started
+ this.application.logStarted();
+ // -----------------------------------
// set the default context path
- getApplicationSettings().setContextPath(context.getServletContextName());
+ this.application.getApplicationSettings().setContextPath(context.getServletContextName());
- getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);
- getResourceSettings().setResourceFinder(new WebApplicationPath(context));
- getPageSettings().setAutomaticMultiWindowSupport(false);
- getResourceSettings().setResourcePollFrequency(null);
+ this.application.getRequestCycleSettings().setRenderStrategy(RenderStrategy.ONE_PASS_RENDER);
+ this.application.getResourceSettings().setResourceFinder(new WebApplicationPath(context));
+ this.application.getPageSettings().setAutomaticMultiWindowSupport(false);
+ this.application.getResourceSettings().setResourcePollFrequency(null);
+
+ this.application.getDebugSettings().setSerializeSessionAttributes(false);
- getDebugSettings().setSerializeSessionAttributes(false);
-
createRequestCycle();
}
/**
+ * Gets the application object.
+ *
+ * @return Wicket application
+ */
+ public final WebApplication getApplication()
+ {
+ return this.application;
+ }
+
+ /**
* Get the page that was just rendered by the last request cycle processing.
*
* @return The last rendered page
@@ -296,12 +330,25 @@
if (component instanceof Page)
{
- this.lastRenderedPage = (Page) component;
+ this.lastRenderedPage = (Page)component;
}
postProcessRequestCycle(cycle);
}
/**
+ * Initialize a new WebRequestCycle and all its dependent objects
+ *
+ * @param pageClass
+ */
+ public void processRequestCycle(final Class<? extends Page> pageClass)
+ {
+ setupRequestAndResponse();
+ WebRequestCycle cycle = new WebRequestCycle(wicketSession, wicketRequest, wicketResponse);
+ cycle.request(new BookmarkablePageRequestTarget(pageClass));
+ postProcessRequestCycle(cycle);
+ }
+
+ /**
* Create and process the request cycle using the current request and
* response information.
*/
@@ -321,7 +368,11 @@
cycle.request();
postProcessRequestCycle(cycle);
}
-
+
+ /**
+ *
+ * @param cycle
+ */
private void postProcessRequestCycle(WebRequestCycle cycle)
{
previousRenderedPage = lastRenderedPage;
@@ -335,11 +386,11 @@
{
this.lastRenderedPage = generateLastRenderedPage(cycle);
- MockHttpServletRequest newHttpRequest = new MockHttpServletRequest(this,
- servletSession, getServletContext());
+ MockHttpServletRequest newHttpRequest = new MockHttpServletRequest(this.application,
+ servletSession, this.application.getServletContext());
newHttpRequest.setRequestToRedirectString(httpResponse.getRedirectLocation());
- wicketRequest = newWebRequest(newHttpRequest);
- wicketSession = getSession(wicketRequest);
+ wicketRequest = this.application.newWebRequest(newHttpRequest);
+ wicketSession = this.application.getSession(wicketRequest);
cycle = new WebRequestCycle(wicketSession, wicketRequest, wicketResponse);
cycle.request();
@@ -354,6 +405,11 @@
}
}
+ /**
+ *
+ * @param cycle
+ * @return Last page
+ */
private Page generateLastRenderedPage(WebRequestCycle cycle)
{
Page lastRenderedPage = cycle.getResponsePage();
@@ -386,12 +442,12 @@
}
}
}
-
+
if (lastRenderedPage == null)
{
lastRenderedPage = this.lastRenderedPage;
}
-
+
return lastRenderedPage;
}
@@ -418,8 +474,8 @@
servletRequest.setParameters(parametersForNextRequest);
parametersForNextRequest.clear();
wicketRequest = new ServletWebRequest(servletRequest);
- wicketSession = getSession(wicketRequest);
- getSessionStore().bind(wicketRequest, wicketSession);
+ wicketSession = this.application.getSession(wicketRequest);
+ this.application.getSessionStore().bind(wicketRequest, wicketSession);
wicketResponse = new WebResponse(servletResponse);
wicketResponse.setAjax(wicketRequest.isAjax());
}
@@ -443,33 +499,5 @@
public void setParametersForNextRequest(Map<String, Object> parametersForNextRequest)
{
this.parametersForNextRequest = parametersForNextRequest;
- }
-
- /**
- * @see wicket.Application#getHomePage()
- */
- @Override
- public Class<? extends Page> getHomePage()
- {
- return homePage;
- }
-
- /**
- * Sets the home page for this mock application
- *
- * @param clazz
- */
- public void setHomePage(Class<? extends Page> clazz)
- {
- homePage = clazz;
- }
-
- /**
- * @see wicket.protocol.http.WebApplication#newSessionStore()
- */
- @Override
- protected ISessionStore newSessionStore()
- {
- return new HttpSessionStore();
}
}
Modified: incubator/wicket/trunk/wicket/src/main/java/wicket/util/diff/DiffUtil.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/util/diff/DiffUtil.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/main/java/wicket/util/diff/DiffUtil.java (original)
+++ incubator/wicket/trunk/wicket/src/main/java/wicket/util/diff/DiffUtil.java Mon Nov 6 05:33:20 2006
@@ -122,11 +122,6 @@
throw new RuntimeException(e);
}
- //Diff diff = new Diff(test1, test2);
- //Diff.change script = diff.diff_2(false);
- //DiffPrint.Base p = new DiffPrint.UnifiedPrint(test1, test2);
- //p.setOutput(new PrintWriter(System.err));
- //p.print_script(script);
System.out.println(r.toString());
}
@@ -153,7 +148,7 @@
final URL url = clazz.getClassLoader().getResource(filename);
filename = url.getFile();
- filename = filename.replaceAll("/target/test-classes/", "/src/test/");
+ filename = filename.replaceAll("/target/test-classes/", "/src/test/java/");
PrintWriter out = new PrintWriter(new FileOutputStream(filename));
out.print(document);
out.close();
Modified: incubator/wicket/trunk/wicket/src/main/java/wicket/util/tester/WicketTester.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/main/java/wicket/util/tester/WicketTester.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/main/java/wicket/util/tester/WicketTester.java (original)
+++ incubator/wicket/trunk/wicket/src/main/java/wicket/util/tester/WicketTester.java Mon Nov 6 05:33:20 2006
@@ -61,6 +61,8 @@
import wicket.markup.html.list.ListView;
import wicket.markup.html.panel.Panel;
import wicket.protocol.http.MockWebApplication;
+import wicket.protocol.http.WebApplication;
+import wicket.resource.DummyApplication;
import wicket.util.lang.Classes;
import wicket.util.string.Strings;
import wicket.util.tester.WicketTesterHelper.ComponentData;
@@ -184,32 +186,64 @@
private static final Log log = LogFactory.getLog(WicketTester.class);
/**
- * create WicketTester with null path
- *
- * @see #WicketTester(String)
+ * Create WicketTester and automatically create a WebApplication, but the
+ * tester will have no home page.
*/
public WicketTester()
{
- this(null);
+ this(new DummyApplication(), null);
+ }
+
+ /**
+ * Create WicketTester and automatically create a WebApplication.
+ *
+ * @param homePage
+ */
+ public WicketTester(final Class<? extends Page> homePage)
+ {
+ this(new WebApplication()
+ {
+ /**
+ * @see wicket.Application#getHomePage()
+ */
+ @Override
+ public Class<? extends Page> getHomePage()
+ {
+ return homePage;
+ }
+ }, null);
}
/**
- * create a WicketTester to help unit testing.
+ * Create WicketTester
*
+ * @param application
+ * The wicket tester object
+ */
+ public WicketTester(final WebApplication application)
+ {
+ this(application, null);
+ }
+
+ /**
+ * Create WicketTester to help unit testing
+ *
+ * @param application
+ * The wicket tester object
* @param path
- * The absolute path on disk to the web application contents
- * (e.g. war root) - may be null
+ * The absolute path on disk to the web tester contents (e.g. war
+ * root) - may be null
*
* @see wicket.protocol.http.MockWebApplication#MockWebApplication(String)
*/
- public WicketTester(final String path)
+ public WicketTester(final WebApplication application, final String path)
{
- super(path);
+ super(application, path);
}
/**
- * Render a page defined in <code>TestPageSource</code>. This usually
- * used when a page does not have default consturctor. For example, a
+ * Render a page defined in <code>TestPageSource</code>. This is usually
+ * used when a page does not have default constructor. For example, a
* <code>ViewBook</code> page requires a <code>Book</code> instance:
*
* <pre>
@@ -227,11 +261,9 @@
* a page factory that creating test page instance
* @return Page rendered page
*/
- public final Page startPage(ITestPageSource testPageSource)
+ public final Page startPage(final ITestPageSource testPageSource)
{
- setHomePage(DummyHomePage.class);
- setupRequestAndResponse();
- processRequestCycle();
+ startPage(DummyHomePage.class);
DummyHomePage page = (DummyHomePage)getLastRenderedPage();
page.setTestPageSource(testPageSource);
@@ -247,7 +279,6 @@
{
setupRequestAndResponse();
getServletRequest().setRequestToComponent(component);
- // getServletRequest().getSession().getPageMap(null);
processRequestCycle();
}
@@ -259,17 +290,16 @@
*/
public final Page startPage(final Page page)
{
- setHomePage(DummyHomePage.class);
processRequestCycle(page);
Page last = getLastRenderedPage();
-
- createRequestCycle();
- getWicketSession().touch(page);
- if (page != last)
- {
- getWicketSession().touch(last);
- }
+ //
+ // createRequestCycle();
+ // getWicketSession().touch(page);
+ // if (page != last)
+ // {
+ // getWicketSession().touch(last);
+ // }
return last;
}
@@ -282,9 +312,8 @@
*/
public final Page startPage(Class<? extends Page> pageClass)
{
- setHomePage(pageClass);
setupRequestAndResponse();
- processRequestCycle();
+ processRequestCycle(pageClass);
return getLastRenderedPage();
}
@@ -586,8 +615,8 @@
* and {@link AjaxSubmitLink}.
* <p>
* On AjaxLinks and AjaxFallbackLinks the onClick method is invoked with a
- * valid AjaxRequestTarget. In that way you can test the flow of your
- * application when using AJAX.
+ * valid AjaxRequestTarget. In that way you can test the flow of your tester
+ * when using AJAX.
* <p>
* When clicking an AjaxSubmitLink the form, which the AjaxSubmitLink is
* attached to is first submitted, and then the onSubmit method on
@@ -1024,24 +1053,24 @@
* component by using:
*
* <pre>
- * ...
- * component.add(new AjaxEventBehavior(ClientEvent.DBLCLICK) {
- * public void onEvent(AjaxRequestTarget) {
- * // Do something.
- * }
- * });
- * ...
+ * ...
+ * component.add(new AjaxEventBehavior(ClientEvent.DBLCLICK) {
+ * public void onEvent(AjaxRequestTarget) {
+ * // Do something.
+ * }
+ * });
+ * ...
* </pre>
*
* You can then test that the code inside onEvent actually does what it's
* supposed to, using the WicketTester:
*
* <pre>
- * ...
- * tester.executeAjaxEvent(component, ClientEvent.DBLCLICK);
- *
- * // Test that the code inside onEvent is correct.
- * ...
+ * ...
+ * tester.executeAjaxEvent(component, ClientEvent.DBLCLICK);
+ *
+ * // Test that the code inside onEvent is correct.
+ * ...
* </pre>
*
* PLEASE NOTE! This method doesn't actually insert the component in the
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ApplicationSettingsTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ApplicationSettingsTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ApplicationSettingsTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ApplicationSettingsTest.java Mon Nov 6 05:33:20 2006
@@ -28,6 +28,7 @@
import wicket.resource.loader.ComponentStringResourceLoader;
import wicket.resource.loader.IStringResourceLoader;
import wicket.settings.Settings;
+import wicket.util.tester.WicketTester;
/**
* Test cases for the <code>ApplicationSettings</code> class.
@@ -106,7 +107,7 @@
Assert.assertEquals("There should be 2 default loaders", 2, loaders.size());
Assert.assertTrue("First loader one should be the component one",
loaders.get(0) instanceof ComponentStringResourceLoader);
- Assert.assertTrue("Second loader should be the application one",
+ Assert.assertTrue("Second loader should be the tester one",
loaders.get(1) instanceof ClassStringResourceLoader);
}
@@ -116,6 +117,7 @@
public void testOverrideStringResourceLoaderSetup()
{
Application dummy = new DummyApplication();
+ dummy.init();
Settings settings = new Settings(dummy);
settings.addStringResourceLoader(new BundleStringResourceLoader(
"wicket.resource.DummyResources"));
@@ -133,8 +135,8 @@
*/
public void testLocalizer()
{
- Application dummy = new DummyApplication();
- Assert.assertNotNull("Localizer should be available", dummy.getResourceSettings()
- .getLocalizer());
+ WicketTester tester = new WicketTester();
+ Assert.assertNotNull("Localizer should be available", tester.getApplication()
+ .getResourceSettings().getLocalizer());
}
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/AttributeModifierComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/AttributeModifierComponentTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/AttributeModifierComponentTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/AttributeModifierComponentTest.java Mon Nov 6 05:33:20 2006
@@ -24,17 +24,17 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import wicket.protocol.http.MockWebApplication;
import wicket.protocol.http.documentvalidation.HtmlDocumentValidator;
import wicket.protocol.http.documentvalidation.Tag;
import wicket.protocol.http.documentvalidation.TextContent;
+import wicket.util.tester.WicketTester;
/**
- * This set of tests builds a sample application for testing the dynamic
- * modicication of attributes in both component tags and also in raw markup. The
- * tests contained here represent testing on one specific area of functionality
- * of the Component class. It is expected that separate test cases will be added
- * to test other facets of Components.
+ * This set of tests builds a sample tester for testing the dynamic modicication
+ * of attributes in both component tags and also in raw markup. The tests
+ * contained here represent testing on one specific area of functionality of the
+ * Component class. It is expected that separate test cases will be added to
+ * test other facets of Components.
*
* @author Chris Turner
*/
@@ -42,7 +42,7 @@
{
private static final Log log = LogFactory.getLog(AttributeModifierComponentTest.class);
- private MockWebApplication application;
+ private WicketTester tester;
/**
* Create a test case instance.
@@ -59,14 +59,7 @@
protected void setUp() throws Exception
{
super.setUp();
- application = new MockWebApplication(null)
- {
- @Override
- public Class<? extends Page> getHomePage()
- {
- return AttributeModifierComponentPage.class;
- }
- };
+ tester = new WicketTester(AttributeModifierComponentPage.class);
}
/**
@@ -75,11 +68,11 @@
public void testComponentTagAttributeModification() throws Exception
{
// Do the processing
- application.setupRequestAndResponse();
- application.processRequestCycle();
+ tester.setupRequestAndResponse();
+ tester.processRequestCycle();
// Validate the document
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
log.info(document);
Assert.assertTrue(validateDocument(document));
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/AuthorizationTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/AuthorizationTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/AuthorizationTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/AuthorizationTest.java Mon Nov 6 05:33:20 2006
@@ -89,7 +89,7 @@
public void testCreateDisallowedComponent() throws Exception
{
WicketTester app = new WicketTester();
- app.getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
+ app.getApplication().getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
{
@Override
public boolean isInstantiationAuthorized(Class c)
@@ -117,7 +117,7 @@
public void testRenderAllowedComponent() throws Exception
{
WicketTester app = new WicketTester();
- app.getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy());
+ app.getApplication().getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy());
app.startPage(AuthTestPage1.class);
app.assertRenderedPage(AuthTestPage1.class);
@@ -132,7 +132,7 @@
public void testRenderDisallowedComponent() throws Exception
{
WicketTester app = new WicketTester();
- app.getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
+ app.getApplication().getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
{
/**
* @see wicket.authorization.IAuthorizationStrategy#isActionAuthorized(wicket.Component,
@@ -161,7 +161,7 @@
public void testEnabledAllowedComponent() throws Exception
{
WicketTester app = new WicketTester();
- app.getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy());
+ app.getApplication().getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy());
app.startPage(AuthTestPage1.class);
app.assertRenderedPage(AuthTestPage1.class);
@@ -183,7 +183,7 @@
public void testEnabledDisallowedComponent() throws Exception
{
WicketTester app = new WicketTester();
- app.getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
+ app.getApplication().getSecuritySettings().setAuthorizationStrategy(new DummyAuthorizationStrategy()
{
/**
* @see wicket.authorization.IAuthorizationStrategy#isActionAuthorized(wicket.Component,
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentPage1a_result.html Mon Nov 6 05:33:20 2006
@@ -1,5 +1,5 @@
<html xmlns:wicket>
<body>
-<a href="/WicketTester/WicketTester?wicket:interface=:0:link::ILinkListener" wicket:id="link">test</a>
+<a href="/DummyApplication/DummyApplication?wicket:interface=:0:link::ILinkListener" wicket:id="link">test</a>
</body>
</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/DisabledComponentTest.java Mon Nov 6 05:33:20 2006
@@ -58,7 +58,7 @@
public void testEnabled() throws Exception
{
executeTest(DisabledComponentPage1.class, "DisabledComponentPage1a_result.html");
- Link link = ((DisabledComponentPage1)application.getLastRenderedPage()).link;
+ Link link = ((DisabledComponentPage1)tester.getLastRenderedPage()).link;
executedListener(DisabledComponentPage2.class, link, "DisabledComponentPage2_result.html");
}
@@ -68,7 +68,7 @@
public void testDisabled() throws Exception
{
executeTest(DisabledComponentPage1.class, "DisabledComponentPage1a_result.html");
- Link link = ((DisabledComponentPage1)application.getLastRenderedPage()).link;
+ Link link = ((DisabledComponentPage1)tester.getLastRenderedPage()).link;
link.setEnabled(false);
executedListener(DisabledComponentPage1.class, link, "DisabledComponentPage1b_result.html");
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/FormDispatchEventTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/FormDispatchEventTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/FormDispatchEventTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/FormDispatchEventTest.java Mon Nov 6 05:33:20 2006
@@ -95,8 +95,8 @@
};
- application.setupRequestAndResponse();
- RequestCycle cycle = application.createRequestCycle();
+ tester.setupRequestAndResponse();
+ RequestCycle cycle = tester.createRequestCycle();
page.urlFor(IRedirectListener.INTERFACE);
cycle.getSession().touch(page);
@@ -105,7 +105,7 @@
form.onFormSubmitted();
assertTrue("form should should set value ", submit);
- application.getServletRequest().setParameter(
+ tester.getServletRequest().setParameter(
form.getHiddenField(Form.HIDDEN_FIELD_FAKE_SUBMIT),
dropDown.urlFor(IOnChangeListener.INTERFACE).toString());
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/HomePageRedirectTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/HomePageRedirectTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/HomePageRedirectTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/HomePageRedirectTest.java Mon Nov 6 05:33:20 2006
@@ -42,13 +42,11 @@
*/
public void testPage() throws Exception
{
- WicketTester app = new WicketTester();
+ WicketTester tester = new WicketTester(Page1.class);
+ tester.getApplication().mountBookmarkablePage("/page1", Page1.class);
- app.setHomePage(Page1.class);
- app.mountBookmarkablePage("/page1", Page1.class);
-
- app.setupRequestAndResponse();
- app.processRequestCycle();
+ tester.setupRequestAndResponse();
+ tester.processRequestCycle();
}
/**
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/LocalizerTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/LocalizerTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/LocalizerTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/LocalizerTest.java Mon Nov 6 05:33:20 2006
@@ -24,7 +24,6 @@
import junit.framework.Assert;
import wicket.markup.html.basic.Label;
import wicket.model.Model;
-import wicket.resource.DummyApplication;
import wicket.resource.loader.ComponentStringResourceLoader;
import wicket.settings.IResourceSettings;
import wicket.util.value.ValueMap;
@@ -58,9 +57,9 @@
@Override
protected void setUp() throws Exception
{
- application = new DummyApplication();
- settings = application.getResourceSettings();
- localizer = application.getResourceSettings().getLocalizer();
+ super.setUp();
+ settings = tester.getApplication().getResourceSettings();
+ localizer = tester.getApplication().getResourceSettings().getLocalizer();
}
/**
@@ -189,5 +188,4 @@
}
}
-
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/SharedResourceUrlTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/SharedResourceUrlTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/SharedResourceUrlTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/SharedResourceUrlTest.java Mon Nov 6 05:33:20 2006
@@ -41,16 +41,16 @@
*/
public void testResourceReferenceUrl() throws Exception
{
- application.setupRequestAndResponse();
- WebRequestCycle cycle = application.createRequestCycle();
+ tester.setupRequestAndResponse();
+ WebRequestCycle cycle = tester.createRequestCycle();
ResourceReference rr = new ResourceReference("test");
CharSequence url = cycle.urlFor(rr);
- assertEquals("/WicketTester/WicketTester/resources/wicket.Application/test", url);
+ assertEquals("/DummyApplication/DummyApplication/resources/wicket.Application/test", url);
rr = new ResourceReference(SharedResourceUrlTest.class,"test");
url = cycle.urlFor(rr);
- assertEquals("/WicketTester/WicketTester/resources/wicket.SharedResourceUrlTest/test", url);
+ assertEquals("/DummyApplication/DummyApplication/resources/wicket.SharedResourceUrlTest/test", url);
}
/**
@@ -58,16 +58,16 @@
*/
public void testResourceReferenceWithParamsUrl() throws Exception
{
- application.setupRequestAndResponse();
- WebRequestCycle cycle = application.createRequestCycle();
+ tester.setupRequestAndResponse();
+ WebRequestCycle cycle = tester.createRequestCycle();
ResourceReference rr = new ResourceReference("test");
CharSequence url = cycle.urlFor(rr,new ValueMap("param=value",""));
- assertEquals("/WicketTester/WicketTester/resources/wicket.Application/test?param=value", url);
+ assertEquals("/DummyApplication/DummyApplication/resources/wicket.Application/test?param=value", url);
rr = new ResourceReference(SharedResourceUrlTest.class,"test");
url = cycle.urlFor(rr,new ValueMap("param=value",""));
- assertEquals("/WicketTester/WicketTester/resources/wicket.SharedResourceUrlTest/test?param=value", url);
+ assertEquals("/DummyApplication/DummyApplication/resources/wicket.SharedResourceUrlTest/test?param=value", url);
}
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/WicketMessageAttributeTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/WicketMessageAttributeTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/WicketMessageAttributeTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/WicketMessageAttributeTest.java Mon Nov 6 05:33:20 2006
@@ -38,12 +38,11 @@
*/
public class WicketMessageAttributeTest extends WicketTestCase
{
-
@Override
protected void setUp() throws Exception
{
super.setUp();
- application.getResourceSettings().setPropertiesFactory(PropertiesFactory.INSTANCE);
+ tester.getApplication().getResourceSettings().setPropertiesFactory(PropertiesFactory.INSTANCE);
}
/**
@@ -67,10 +66,10 @@
new Label(page, "label", "i am label");
- application.startPage(page);
- TagTester tester = application.getTagByWicketId("label");
- assertTrue("title-value".equals(tester.getAttribute("title")));
- assertTrue("style-value".equals(tester.getAttribute("style")));
+ tester.startPage(page);
+ TagTester tagTester = tester.getTagByWicketId("label");
+ assertTrue("title-value".equals(tagTester.getAttribute("title")));
+ assertTrue("style-value".equals(tagTester.getAttribute("style")));
}
/**
@@ -93,9 +92,9 @@
};
new Label(page, "label", "i am label");
- application.startPage(page);
- TagTester tester = application.getTagByWicketId("label");
- assertTrue("100%".equals(tester.getAttribute("width")));
+ tester.startPage(page);
+ TagTester tagTester = tester.getTagByWicketId("label");
+ assertTrue("100%".equals(tagTester.getAttribute("width")));
}
/**
@@ -116,8 +115,8 @@
}
};
- application.startPage(page);
- String response = application.getServletResponse().getDocument();
+ tester.startPage(page);
+ String response = tester.getServletResponse().getDocument();
assertTrue(response.contains("title=\"title-value\""));
assertTrue(response.contains("style=\"style-value\""));
}
@@ -142,8 +141,8 @@
};
new Label(page, "label", "[[SUCCESS]]");
- application.startPage(page);
- String response = application.getServletResponse().getDocument();
+ tester.startPage(page);
+ String response = tester.getServletResponse().getDocument();
assertTrue(response.contains("title=\"title-value\""));
assertTrue(response.contains("style=\"style-value\""));
assertTrue(response.contains("[[SUCCESS]]"));
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/WicketTestCase.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/WicketTestCase.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/WicketTestCase.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/WicketTestCase.java Mon Nov 6 05:33:20 2006
@@ -35,14 +35,13 @@
public abstract class WicketTestCase extends TestCase
{
/** */
- public WicketTester application;
+ public WicketTester tester;
/**
* Constructor
*/
public WicketTestCase()
{
-
}
/**
@@ -59,7 +58,7 @@
@Override
protected void setUp() throws Exception
{
- application = new WicketTester(null);
+ tester = new WicketTester();
}
/**
@@ -74,10 +73,7 @@
throws Exception
{
System.out.println("=== " + pageClass.getName() + " ===");
-
String document = accessPage(pageClass).getDocument();
-
- // Validate the document
assertTrue(DiffUtil.validatePage(document, this.getClass(), filename));
}
@@ -91,14 +87,9 @@
protected MockHttpServletResponse accessPage(final Class<? extends Page> pageClass)
throws Exception
{
- application.setHomePage(pageClass);
-
- // Do the processing
- application.setupRequestAndResponse();
- application.processRequestCycle();
-
- assertEquals(pageClass, application.getLastRenderedPage().getClass());
- return application.getServletResponse();
+ tester.startPage(pageClass);
+ assertEquals(pageClass, tester.getLastRenderedPage().getClass());
+ return tester.getServletResponse();
}
/**
@@ -116,12 +107,12 @@
System.out.println("=== " + pageClass.getName() + " : " + component.getPageRelativePath()
+ " ===");
- application.setupRequestAndResponse();
- WebRequestCycle cycle = application.createRequestCycle();
- application.getServletRequest().setRequestToComponent(component);
- application.processRequestCycle(cycle);
+ tester.setupRequestAndResponse();
+ WebRequestCycle cycle = tester.createRequestCycle();
+ tester.getServletRequest().setRequestToComponent(component);
+ tester.processRequestCycle(cycle);
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, pageClass, filename));
}
@@ -139,13 +130,13 @@
System.out.println("=== " + pageClass.getName() + " : " + behavior.toString() + " ===");
- application.setupRequestAndResponse();
- WebRequestCycle cycle = application.createRequestCycle();
- application.getServletRequest().setRequestToRedirectString(
+ tester.setupRequestAndResponse();
+ WebRequestCycle cycle = tester.createRequestCycle();
+ tester.getServletRequest().setRequestToRedirectString(
behavior.getCallbackUrl(false).toString());
- application.processRequestCycle(cycle);
+ tester.processRequestCycle(cycle);
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, pageClass, filename));
}
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/AjaxRequestTargetTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/AjaxRequestTargetTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/AjaxRequestTargetTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/AjaxRequestTargetTest.java Mon Nov 6 05:33:20 2006
@@ -121,7 +121,7 @@
}
};
- application.startPage(new ITestPageSource()
+ tester.startPage(new ITestPageSource()
{
private static final long serialVersionUID = 1L;
@@ -131,9 +131,9 @@
}
});
- application.clickLink(MockPageWithLinkAndComponent.LINK_ID);
+ tester.clickLink(MockPageWithLinkAndComponent.LINK_ID);
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue("Error while execution ajax request", Pattern.compile("</ajax-response>").matcher(document).find());
Pattern pat = Pattern.compile(".*<header-contribution>(.*?)</header-contribution>.*",
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/MockComponent3-expected.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/MockComponent3-expected.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/MockComponent3-expected.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/MockComponent3-expected.html Mon Nov 6 05:33:20 2006
@@ -1,3 +1,3 @@
-<![CDATA[<head xmlns:wicket="http://wicket.sourceforge.net">
-<link href="/WicketTester/WicketTester/resources/wicket.ajax.MockComponent3/mockStyleSheet3.css" rel="stylesheet" type="text/css" wicket:id="stylesheet"/>
+<![CDATA[<head xmlns:wicket="http://wicket.sourceforge.net">
+<link href="/DummyApplication/DummyApplication/resources/wicket.ajax.MockComponent3/mockStyleSheet3.css" rel="stylesheet" type="text/css" wicket:id="stylesheet"/>
</head>]]>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkPageExpectedResult.html Mon Nov 6 05:33:20 2006
@@ -1,13 +1,13 @@
<html>
-<head><script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
+<head><script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
wicketAjaxDebugEnable=true;
/*-->]]>*/</script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
</head><body>
<span id="ajaxLabel" wicket:id="ajaxLabel">UpdateMe</span>
- <a onclick="var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="ajaxLink" wicket:id="ajaxLink">Update</a>
+ <a onclick="var wcall=wicketAjaxGet('/DummyApplication/DummyApplication?wicket:interface=:0:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="ajaxLink" wicket:id="ajaxLink">Update</a>
</body>
</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkTest.java Mon Nov 6 05:33:20 2006
@@ -56,7 +56,7 @@
{
executeTest(AjaxLinkWithBorderPage.class, "AjaxLinkWithBorderPageExpectedResult.html");
- Page page = application.getLastRenderedPage();
+ Page page = tester.getLastRenderedPage();
Component ajaxLink = page.get("border:borderBody:ajaxLink");
AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0);
@@ -71,7 +71,7 @@
{
executeTest(AjaxPage2.class, "AjaxPage2_ExpectedResult.html");
- Page page = application.getLastRenderedPage();
+ Page page = tester.getLastRenderedPage();
Component ajaxLink = page.get("pageLayout:pageLayoutBody:ajaxLink");
AbstractAjaxBehavior behavior = (AbstractAjaxBehavior)ajaxLink.getBehaviors().get(0);
@@ -85,9 +85,9 @@
*/
public void testJavascriptEndsWithReturn()
{
- application.startPage(AjaxLinkPage.class);
+ tester.startPage(AjaxLinkPage.class);
- TagTester ajaxLink = application.getTagByWicketId("ajaxLink");
+ TagTester ajaxLink = tester.getTagByWicketId("ajaxLink");
assertTrue(ajaxLink.getAttributeEndsWith("onclick", "return !wcall;"));
}
@@ -98,9 +98,9 @@
*/
public void testAnchorGetsHrefReplaced()
{
- application.startPage(AjaxLinkPage.class);
+ tester.startPage(AjaxLinkPage.class);
- TagTester ajaxLink = application.getTagByWicketId("ajaxLink");
+ TagTester ajaxLink = tester.getTagByWicketId("ajaxLink");
// It was a link to google in the markup, but should be replaced to "#"
assertTrue(ajaxLink.getAttributeIs("href", "#"));
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxLinkWithBorderPageExpectedResult.html Mon Nov 6 05:33:20 2006
@@ -1,17 +1,17 @@
<html>
-<head><script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
+<head><script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
wicketAjaxDebugEnable=true;
/*-->]]>*/</script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
</head><body>
<span wicket:id="border"><wicket:border>
Border
<wicket:body>
<span id="border_borderBody_ajaxLabel" wicket:id="ajaxLabel">UpdateMe</span>
- <a onclick="var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:border:borderBody:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="border_borderBody_ajaxLink" wicket:id="ajaxLink">Update</a>
+ <a onclick="var wcall=wicketAjaxGet('/DummyApplication/DummyApplication?wicket:interface=:0:border:borderBody:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="border_borderBody_ajaxLink" wicket:id="ajaxLink">Update</a>
</wicket:body>
Border
</wicket:border></span>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/ajaxLink/AjaxPage2_ExpectedResult.html Mon Nov 6 05:33:20 2006
@@ -1,29 +1,29 @@
-<html>
-<head><script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
-<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
-wicketAjaxDebugEnable=true;
-/*-->]]>*/</script>
-
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
-</head><body>
- <span wicket:id="pageLayout"><wicket:border>
- <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black">
- <tr>
- <td width = "100%" valign = "top">
- <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white">
- <tr>
- <td width = "100%">
- <wicket:body>
- <span id="pageLayout_pageLayoutBody_ajaxLabel" wicket:id="ajaxLabel">AAAAAAA</span>
- <a onclick="var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:pageLayout:pageLayoutBody:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="pageLayout_pageLayoutBody_ajaxLink" wicket:id="ajaxLink">Update</a>
- </wicket:body>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </wicket:border></span>
-</body>
-</html>
+<html>
+<head><script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
+<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
+wicketAjaxDebugEnable=true;
+/*-->]]>*/</script>
+
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
+</head><body>
+ <span wicket:id="pageLayout"><wicket:border>
+ <table width = "0%" border = "0" cellspacing = "0" cellpadding = "1" bgcolor = "black">
+ <tr>
+ <td width = "100%" valign = "top">
+ <table width = "100%" border = "0" cellspacing = "0" cellpadding = "4" bgcolor = "white">
+ <tr>
+ <td width = "100%">
+ <wicket:body>
+ <span id="pageLayout_pageLayoutBody_ajaxLabel" wicket:id="ajaxLabel">AAAAAAA</span>
+ <a onclick="var wcall=wicketAjaxGet('/DummyApplication/DummyApplication?wicket:interface=:0:pageLayout:pageLayoutBody:ajaxLink::IBehaviorListener&wicket:behaviorId=0', function() { }, function() { });return !wcall;" href="#" id="pageLayout_pageLayoutBody_ajaxLink" wicket:id="ajaxLink">Update</a>
+ </wicket:body>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </wicket:border></span>
+</body>
+</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult-1.html Mon Nov 6 05:33:20 2006
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="testPanel_baseSpan_linja1" ><![CDATA[<span id="testPanel_baseSpan_linja1" wicket:id="linja1">1</span>]]></component><evaluate><![CDATA[setTimeout(function() { var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);]]></evaluate></ajax-response>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><ajax-response><component id="testPanel_baseSpan_linja1" ><![CDATA[<span id="testPanel_baseSpan_linja1" wicket:id="linja1">1</span>]]></component><evaluate><![CDATA[setTimeout(function() { var wcall=wicketAjaxGet('/DummyApplication/DummyApplication?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);]]></evaluate></ajax-response>
\ No newline at end of file
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPageExpectedResult.html Mon Nov 6 05:33:20 2006
@@ -1,15 +1,15 @@
<html>
<head>
<title>ajax-test</title>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax.js"></script>
<script type="text/javascript" id="wicket-ajax-debug-enable"><!--/*--><![CDATA[/*><!--*/
wicketAjaxDebugEnable=true;
/*-->]]>*/</script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
-<script type="text/javascript" src="/WicketTester/WicketTester/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug-drag.js"></script>
+<script type="text/javascript" src="/DummyApplication/DummyApplication/resources/wicket.ajax.AbstractDefaultAjaxBehavior/wicket-ajax-debug.js"></script>
</head>
-<body onload="setTimeout(function() { var wcall=wicketAjaxGet('/WicketTester/WicketTester?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);">
+<body onload="setTimeout(function() { var wcall=wicketAjaxGet('/DummyApplication/DummyApplication?wicket:interface=:0:testPanel:baseSpan:linja1:-1:IUnversionedBehaviorListener&wicket:behaviorId=0', function() { }, function() { }); }, 2000);">
<span wicket:id="testPanel"><wicket:panel>
<span wicket:id="baseSpan">
<wicket:child><wicket:extend>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/componentMap/SimpleTestPanelTest.java Mon Nov 6 05:33:20 2006
@@ -47,19 +47,19 @@
{
executeTest(SimpleTestPage.class, "SimpleTestPageExpectedResult.html");
- application.setupRequestAndResponse();
- application.getDebugSettings().setAjaxDebugModeEnabled(false);
- WebRequestCycle cycle = application.createRequestCycle();
+ tester.setupRequestAndResponse();
+ tester.getApplication().getDebugSettings().setAjaxDebugModeEnabled(false);
+ WebRequestCycle cycle = tester.createRequestCycle();
- Page page = application.getLastRenderedPage();
+ Page page = tester.getLastRenderedPage();
String url = ((SimpleTestPanel)page.get("testPanel")).getTimeBehavior().getCallbackUrl()
.toString();
- application.getServletRequest().setRequestToRedirectString(url);
+ tester.getServletRequest().setRequestToRedirectString(url);
- application.processRequestCycle(cycle);
+ tester.processRequestCycle(cycle);
// Validate the document
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, SimpleTestPage.class,
"SimpleTestPageExpectedResult-1.html"));
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitButtonTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitButtonTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitButtonTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitButtonTest.java Mon Nov 6 05:33:20 2006
@@ -45,7 +45,7 @@
*/
public void testRender()
{
- application.startPage(new ITestPageSource() {
+ tester.startPage(new ITestPageSource() {
private static final long serialVersionUID = 1L;
public Page getTestPage()
@@ -66,10 +66,10 @@
}
});
- application.assertComponent("form:ajaxSubmitButton", AjaxSubmitButton.class);
+ tester.assertComponent("form:ajaxSubmitButton", AjaxSubmitButton.class);
// Get the tag which has wicket:id "ajaxSubmitButton"
- TagTester ajaxSubmitButton = application.getTagByWicketId("ajaxSubmitButton");
+ TagTester ajaxSubmitButton = tester.getTagByWicketId("ajaxSubmitButton");
// The tag should be an "input"
assertEquals("input", ajaxSubmitButton.getName());
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitLinkTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitLinkTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitLinkTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/ajax/markup/html/form/AjaxSubmitLinkTest.java Mon Nov 6 05:33:20 2006
@@ -46,7 +46,7 @@
*/
public void testRender()
{
- application.startPage(new ITestPageSource() {
+ tester.startPage(new ITestPageSource() {
private static final long serialVersionUID = 1L;
public Page getTestPage()
@@ -67,9 +67,9 @@
}
});
- application.assertComponent(FormWithLinkPage.SUBMIT_ID, AjaxSubmitLink.class);
+ tester.assertComponent(FormWithLinkPage.SUBMIT_ID, AjaxSubmitLink.class);
- TagTester ajaxSubmitLink = application.getTagByWicketId(FormWithLinkPage.SUBMIT_ID);
+ TagTester ajaxSubmitLink = tester.getTagByWicketId(FormWithLinkPage.SUBMIT_ID);
assertEquals("a", ajaxSubmitLink.getName());
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/ComponentCreateTagTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/ComponentCreateTagTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/ComponentCreateTagTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/ComponentCreateTagTest.java Mon Nov 6 05:33:20 2006
@@ -23,7 +23,7 @@
import wicket.WicketTestCase;
/**
- * Simple application that demonstrates the mock http application code (and
+ * Simple tester that demonstrates the mock http tester code (and
* checks that it is working)
*
* @author Chris Turner
@@ -48,7 +48,7 @@
*/
public void testRenderHomePage_1() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
executeTest(ComponentCreateTag_1.class, "ComponentCreateTagExpectedResult_1.html");
}
@@ -59,7 +59,7 @@
*/
public void testRenderHomePage_2() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
executeTest(ComponentCreateTag_2.class, "ComponentCreateTagExpectedResult_2.html");
}
@@ -70,7 +70,7 @@
*/
public void testRenderHomePage_3() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
executeTest(ComponentCreateTag_3.class, "ComponentCreateTagExpectedResult_3.html");
}
@@ -81,7 +81,7 @@
*/
public void testRenderHomePage_4() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
executeTest(ComponentCreateTag_4.class, "ComponentCreateTagExpectedResult_4.html");
}
@@ -92,8 +92,8 @@
*/
public void testRenderHomePage_6() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
- application.getWicketSession().setLocale(Locale.ENGLISH);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
+ tester.getWicketSession().setLocale(Locale.ENGLISH);
executeTest(ComponentCreateTag_6.class, "ComponentCreateTagExpectedResult_6.html");
}
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_12.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_12.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_12.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_12.html Mon Nov 6 05:33:20 2006
@@ -9,6 +9,6 @@
<wicket:child><wicket:extend>
888<span wicket:id="label3">extension label</span>999
</wicket:extend></wicket:child>
- 333<a href="/WicketTester/WicketTester?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
+ 333<a href="/DummyApplication/DummyApplication?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
</body>
</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_5.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_5.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_5.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_5.html Mon Nov 6 05:33:20 2006
@@ -7,6 +7,6 @@
<wicket:child><wicket:extend>
888<span wicket:id="label3">extension label</span>999
</wicket:extend></wicket:child>
- 333<a href="/WicketTester/WicketTester?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
+ 333<a href="/DummyApplication/DummyApplication?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
</body>
</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_7.html
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_7.html?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_7.html (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceExpectedResult_7.html Mon Nov 6 05:33:20 2006
@@ -9,6 +9,6 @@
<wicket:child><wicket:extend>
888<span wicket:id="label3">extension label</span>999
</wicket:extend></wicket:child>
- 333<a href="/WicketTester/WicketTester?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
+ 333<a href="/DummyApplication/DummyApplication?wicket:interface=:0:link::ILinkListener" wicket:id="link">increment</a>444
</body>
</html>
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupInheritanceTest.java Mon Nov 6 05:33:20 2006
@@ -68,31 +68,27 @@
{
System.out.println("=== " + MarkupInheritanceExtension_4.class.getName() + " ===");
- application.setHomePage(MarkupInheritanceExtension_4.class);
-
- // Do the processing
- application.setupRequestAndResponse();
- application.processRequestCycle();
+ tester.startPage(MarkupInheritanceExtension_4.class);
// Validate the document
- assertEquals(MarkupInheritanceExtension_4.class, application.getLastRenderedPage()
+ assertEquals(MarkupInheritanceExtension_4.class, tester.getLastRenderedPage()
.getClass());
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, this.getClass(),
"MarkupInheritanceExpectedResult_4.html"));
- MarkupInheritanceExtension_4 page = (MarkupInheritanceExtension_4)application
+ MarkupInheritanceExtension_4 page = (MarkupInheritanceExtension_4)tester
.getLastRenderedPage();
Link link = (Link)page.get("link");
- application.setupRequestAndResponse();
- application.getServletRequest().setRequestToComponent(link);
- application.processRequestCycle();
+ tester.setupRequestAndResponse();
+ tester.getServletRequest().setRequestToComponent(link);
+ tester.processRequestCycle();
- assertEquals(MarkupInheritanceExtension_4.class, application.getLastRenderedPage()
+ assertEquals(MarkupInheritanceExtension_4.class, tester.getLastRenderedPage()
.getClass());
- document = application.getServletResponse().getDocument();
+ document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, this.getClass(),
"MarkupInheritanceExpectedResult_4-1.html"));
}
@@ -126,7 +122,7 @@
*/
public void testRenderHomePage_8() throws Exception
{
- application.getMarkupSettings().setStripWicketTags(true);
+ tester.getApplication().getMarkupSettings().setStripWicketTags(true);
executeTest(MarkupInheritanceExtension_8.class, "MarkupInheritanceExpectedResult_8.html");
}
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupParserTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupParserTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupParserTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/MarkupParserTest.java Mon Nov 6 05:33:20 2006
@@ -73,7 +73,7 @@
{
MarkupResourceStream stream = new MarkupResourceStream(new StringResourceStream(markup),
null, null);
- final MarkupParser parser = new MarkupParserFactory(this.application)
+ final MarkupParser parser = new MarkupParserFactory(this.tester.getApplication())
.newMarkupParser(stream);
parser.setWicketNamespace(namespace);
return parser.readAndParse();
@@ -87,11 +87,12 @@
* @throws IOException
* @throws ResourceStreamNotFoundException
*/
- private MarkupFragment parse(final String markup) throws IOException, ResourceStreamNotFoundException
+ private MarkupFragment parse(final String markup) throws IOException,
+ ResourceStreamNotFoundException
{
MarkupResourceStream stream = new MarkupResourceStream(new StringResourceStream(markup),
null, null);
- final MarkupParser parser = new MarkupParserFactory(this.application)
+ final MarkupParser parser = new MarkupParserFactory(this.tester.getApplication())
.newMarkupParser(stream);
return parser.readAndParse();
}
@@ -127,7 +128,7 @@
private MarkupFragment parse(final MarkupResourceStream resource) throws IOException,
ResourceStreamNotFoundException
{
- final MarkupParser parser = new MarkupParserFactory(this.application)
+ final MarkupParser parser = new MarkupParserFactory(this.tester.getApplication())
.newMarkupParser(resource);
return parser.readAndParse();
}
@@ -374,7 +375,8 @@
// Assert.assertEquals(docText, tokens.get(0).toString());
resource = newMarkupResourceStream(locator, this.getClass(), "9", null, "html");
- MarkupParser parser = new MarkupParserFactory(this.application).newMarkupParser(resource);
+ MarkupParser parser = new MarkupParserFactory(this.tester.getApplication())
+ .newMarkupParser(resource);
parser.setStripComments(true);
parser.readAndParse();
log.info("tok(0)=" + tokens.get(0));
@@ -514,7 +516,7 @@
{
// Note: <img> is one of these none-balanced HTML tags
MarkupFragment markup = parse("<span wicket:id=\"span\"><img wicket:id=\"img\"><span wicket:id=\"span2\"></span></span>");
-
+
ComponentTag t = markup.getTag();
assertEquals(t.getId(), "span");
assertNotNull(markup.getChildFragment("span", false));
Modified: incubator/wicket/trunk/wicket/src/test/java/wicket/markup/WicketNamespaceTest.java
URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/wicket/src/test/java/wicket/markup/WicketNamespaceTest.java?view=diff&rev=471726&r1=471725&r2=471726
==============================================================================
--- incubator/wicket/trunk/wicket/src/test/java/wicket/markup/WicketNamespaceTest.java (original)
+++ incubator/wicket/trunk/wicket/src/test/java/wicket/markup/WicketNamespaceTest.java Mon Nov 6 05:33:20 2006
@@ -20,16 +20,17 @@
import junit.framework.TestCase;
import wicket.Page;
-import wicket.protocol.http.MockWebApplication;
import wicket.util.diff.DiffUtil;
+import wicket.util.tester.WicketTester;
/**
+ *
*/
public class WicketNamespaceTest extends TestCase
{
// private static final Log log = LogFactory.getLog(WicketNamespaceTest.class);
- private MockWebApplication application;
+ private WicketTester tester;
/**
* Create the test.
@@ -99,15 +100,14 @@
{
System.out.println("=== " + pageClass.getName() + " ===");
- application = new MockWebApplication(null);
- application.setHomePage(pageClass);
+ tester = new WicketTester(pageClass);
// Do the processing
- application.setupRequestAndResponse();
- application.processRequestCycle();
+ tester.setupRequestAndResponse();
+ tester.processRequestCycle();
// Validate the document
- String document = application.getServletResponse().getDocument();
+ String document = tester.getServletResponse().getDocument();
assertTrue(DiffUtil.validatePage(document, this.getClass(), filename));
}
}