You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by da...@apache.org on 2015/05/07 11:35:58 UTC
wicket git commit: Added additional test case for WICKET-5898
Repository: wicket
Updated Branches:
refs/heads/master 433190904 -> cab6795aa
Added additional test case for WICKET-5898
Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/cab6795a
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/cab6795a
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/cab6795a
Branch: refs/heads/master
Commit: cab6795aa64fe2280a938f69bb304255f2fc9bbe
Parents: 4331909
Author: Martijn Dashorst <ma...@gmail.com>
Authored: Thu May 7 11:35:44 2015 +0200
Committer: Martijn Dashorst <ma...@gmail.com>
Committed: Thu May 7 11:35:44 2015 +0200
----------------------------------------------------------------------
...inerWithSiblingTransparentContainerPage.html | 11 +++
...inerWithSiblingTransparentContainerPage.java | 70 ++++++++++++++++++++
.../html/TransparentWebMarkupContainerTest.java | 27 +++++++-
3 files changed, 105 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/wicket/blob/cab6795a/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.html
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.html b/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.html
new file mode 100644
index 0000000..2c52839
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html xmlns:wicket="http://wicket.apache.org">
+<body>
+ <div wicket:id="twmc">
+ <span wicket:id="label"></span>
+ <span wicket:id="group"></span>
+ <span wicket:id="wmc"><span wicket:id="sibling-twmc"></span></span>
+ </div>
+ <a href="#" wicket:id="link"></a>
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/wicket/blob/cab6795a/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.java
new file mode 100644
index 0000000..b5334a9
--- /dev/null
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.wicket.markup.html;
+
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
+import org.apache.wicket.markup.html.TransparentWebMarkupContainer;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+/**
+ * A test page for triggering a StackOverflowError when updating a component inside a
+ * {@link TransparentWebMarkupContainer}, while having a sibling Transparent container using AJAX.
+ */
+public class DoubleNestedTransparentContainerWithSiblingTransparentContainerPage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Constructor.
+ */
+ public DoubleNestedTransparentContainerWithSiblingTransparentContainerPage()
+ {
+ final Label label = new Label("label", "Label");
+ label.setOutputMarkupId(true);
+ add(label);
+
+ // Adding a TransparentWebMarkupContainer to the outer TransparentWebMarkupContainer causes
+ // a StackOverflowException
+ add(new TransparentWebMarkupContainer("group"));
+
+ // Adding a web markup container to the outer TWMC, and having a TWMC inside the web markup
+ // container causes a StackOverflowError as well.
+ WebMarkupContainer wmc = new WebMarkupContainer("wmc");
+ add(wmc);
+ wmc.add(new TransparentWebMarkupContainer("sibling-twmc"));
+
+ // if you add this TransparentWebMarkupContainer as first component in
+ // the page (i.e. move line 48 to line 38), the test passes
+ add(new TransparentWebMarkupContainer("twmc"));
+
+ // a non-AJAX click on this link passes the test case, an AJAX request
+ // fails with a StackOverflowError
+ add(new AjaxFallbackLink<Void>("link")
+ {
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ public void onClick(AjaxRequestTarget target)
+ {
+ if (target != null)
+ target.add(label);
+ }
+ });
+ }
+}
http://git-wip-us.apache.org/repos/asf/wicket/blob/cab6795a/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
----------------------------------------------------------------------
diff --git a/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java b/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
index 0350126..572c6c5 100644
--- a/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
+++ b/wicket-core/src/test/java/org/apache/wicket/markup/html/TransparentWebMarkupContainerTest.java
@@ -31,6 +31,7 @@ import org.apache.wicket.page.IPageManagerContext;
import org.apache.wicket.util.resource.IResourceStream;
import org.apache.wicket.util.resource.StringResourceStream;
import org.apache.wicket.util.tester.WicketTester;
+import org.junit.Ignore;
import org.junit.Test;
/**
@@ -129,8 +130,8 @@ public class TransparentWebMarkupContainerTest extends WicketTestCase
wicketTester.clickLink("link", true);
wicketTester.destroy();
}
-
-
+
+
/**
* Tests the WICKET-5898 issue of triggering a StackOverflowError when a component inside nested
* TransparentWebMarkupContainers is updated. This particular test case is caused by Wicket's
@@ -168,7 +169,27 @@ public class TransparentWebMarkupContainerTest extends WicketTestCase
tester.clickLink("link", true);
tester.assertComponentOnAjaxResponse("label");
}
-
+
+ /**
+ * Tests the WICKET-5898 issue of triggering a StackOverflowError when a component inside nested
+ * TransparentWebMarkupContainers is updated. This particular test case is caused by having two
+ * TransparentWebMarkupContainers nested, and where a TWMC exist inside a sibling web markup
+ * container and trying to update a label that was added to the outer TWMC.
+ */
+ @Test
+ @Ignore("Fails with WICKET-5898")
+ public void ajaxRequestForComponentInTransparentWebMarkupContainerShouldntCauseStackOverflow3()
+ {
+ tester.startPage(DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.class);
+
+ // the page renders normally using normal web requests
+ tester.assertRenderedPage(DoubleNestedTransparentContainerWithSiblingTransparentContainerPage.class);
+
+ // without WICKET-5898 fixed the statement below causes a StackOverflowError
+ tester.clickLink("link", true);
+ tester.assertComponentOnAjaxResponse("label");
+ }
+
/** */
public static class TestPage extends WebPage implements IMarkupResourceStreamProvider
{