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 2007/08/18 15:41:54 UTC
svn commit: r567270 - in
/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model:
InheritedModelTest.java InheritedTestPage.html InheritedTestPage.java
Author: dashorst
Date: Sat Aug 18 06:41:54 2007
New Revision: 567270
URL: http://svn.apache.org/viewvc?view=rev&rev=567270
Log:
Added testcase for inherited models
Added:
wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java (with props)
wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html (with props)
wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java (with props)
Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java?view=auto&rev=567270
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java Sat Aug 18 06:41:54 2007
@@ -0,0 +1,78 @@
+/*
+ * 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.model;
+
+import org.apache.wicket.WicketTestCase;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.basic.Label;
+import org.apache.wicket.util.value.ValueMap;
+
+/**
+ * Tests the inheritance of models.
+ */
+public class InheritedModelTest extends WicketTestCase
+{
+ /**
+ * Tests the CPM inheritance by setting a different root model using a
+ * rendered scenario.
+ */
+ public void testCompoundPropertyModelRendered()
+ {
+ ValueMap data1 = new ValueMap();
+ data1.put("label", "foo");
+
+ ValueMap data2 = new ValueMap();
+ data2.put("label", "bar");
+
+ InheritedTestPage page = new InheritedTestPage();
+
+ tester.setupRequestAndResponse();
+ page.setModel(new CompoundPropertyModel(data1));
+ tester.startPage(page);
+ tester.assertLabel("label", "foo");
+
+ tester.setupRequestAndResponse();
+ page.setModel(new CompoundPropertyModel(data2));
+ tester.startPage(page);
+ tester.assertLabel("label", "bar");
+ }
+
+ /**
+ * Tests the CPM by setting a different root model using a direct scenario.
+ */
+ public void testCompoundPropertyModelDirect()
+ {
+ ValueMap data1 = new ValueMap();
+ data1.put("label", "foo");
+
+ ValueMap data2 = new ValueMap();
+ data2.put("label", "bar");
+
+ WebMarkupContainer parent = new WebMarkupContainer("foo");
+ Label label = new Label("label");
+ parent.add(label);
+
+ parent.setModel(new CompoundPropertyModel(data1));
+ assertEquals("foo", label.getModelObject());
+
+ parent.setModel(new CompoundPropertyModel(data2));
+ assertEquals("bar", label.getModelObject());
+
+ data2.put("label", "foo");
+ assertEquals("foo", label.getModelObject());
+ }
+}
Propchange: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedModelTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html?view=auto&rev=567270
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html Sat Aug 18 06:41:54 2007
@@ -0,0 +1,9 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+<body>
+ <h1 wicket:id="label"></h1>
+</body>
+</html>
+
Propchange: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.html
------------------------------------------------------------------------------
svn:eol-style = native
Added: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java
URL: http://svn.apache.org/viewvc/wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java?view=auto&rev=567270
==============================================================================
--- wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java (added)
+++ wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java Sat Aug 18 06:41:54 2007
@@ -0,0 +1,26 @@
+package org.apache.wicket.model;
+
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.basic.Label;
+
+/**
+ * Testpage for inherited models. TestCases should set the model on the page.
+ */
+public class InheritedTestPage extends WebPage
+{
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * public for querying in test case. Is the only component on this page,
+ * rendered in a h1 tag.
+ */
+ public final Label label = new Label("label");
+
+ /**
+ * Construct.
+ */
+ public InheritedTestPage()
+ {
+ add(label);
+ }
+}
Propchange: wicket/trunk/jdk-1.4/wicket/src/test/java/org/apache/wicket/model/InheritedTestPage.java
------------------------------------------------------------------------------
svn:eol-style = native