You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2014/08/27 18:37:18 UTC
git commit: Add tests proving that TAP5-2269 is not valid
Repository: tapestry-5
Updated Branches:
refs/heads/master 000b51e26 -> 71f812324
Add tests proving that TAP5-2269 is not valid
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/71f81232
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/71f81232
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/71f81232
Branch: refs/heads/master
Commit: 71f812324cf4a40b2639d0dacd44651d83ec4bb5
Parents: 000b51e
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Wed Aug 27 09:37:15 2014 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Wed Aug 27 09:37:15 2014 -0700
----------------------------------------------------------------------
.../src/test/app1/ClientPersistenceDemo.tml | 50 ++++++++------------
.../integration/app1/ClientDataWrapper.java | 25 ++++++++++
.../integration/app1/CoreBehaviorsTests.java | 24 +++++++++-
.../app1/pages/ClientPersistenceDemo.java | 9 ++--
4 files changed, 74 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/71f81232/tapestry-core/src/test/app1/ClientPersistenceDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/ClientPersistenceDemo.tml b/tapestry-core/src/test/app1/ClientPersistenceDemo.tml
index f9fb94b..350c78c 100644
--- a/tapestry-core/src/test/app1/ClientPersistenceDemo.tml
+++ b/tapestry-core/src/test/app1/ClientPersistenceDemo.tml
@@ -1,32 +1,24 @@
-<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
-
-<h1>Client Persistence Demo</h1>
-
-
- <p>
- Persisted value: [${persistedValue}]
- </p>
-
- <p>
- Session: [${sessionExists}]
- </p>
-
-
- <p>
- <t:actionlink t:id="nixSession">nix session</t:actionlink>
- </p>
-
- <p>
- <t:actionlink t:id="storeString">store string</t:actionlink>
- </p>
-
- <p>
- <t:actionlink t:id="storeBad">store non-serializable</t:actionlink>
- </p>
-
- <p>
- <t:pagelink page="clientpersistencedemo">refresh</t:pagelink>
- </p>
+<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd">
+
+ <h1>Client Persistence Demo</h1>
+
+
+ <div class="well">
+ <dl>
+ <dt>Persisted value</dt>
+ <dd id="persisted-value">${persistedValue}</dd>
+ <dt>Session</dt>
+ <dd id="session-exists">${sessionExists}</dd>
+ </dl>
+ </div>
+
+ <div class="btn-group">
+ <t:actionlink t:id="nixSession" class="btn btn-default">nix session</t:actionlink>
+ <t:actionlink t:id="storeString" class="btn btn-default">store string</t:actionlink>
+ <t:actionlink t:id="storeComplex" class="btn btn-default">store complex</t:actionlink>
+ <t:actionlink t:id="storeBad" class="btn btn-default">store non-serializable</t:actionlink>
+ <t:pagelink page="clientpersistencedemo" class="btn btn-default">refresh</t:pagelink>
+ </div>
</html>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/71f81232/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ClientDataWrapper.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ClientDataWrapper.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ClientDataWrapper.java
new file mode 100644
index 0000000..eadc54e
--- /dev/null
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/ClientDataWrapper.java
@@ -0,0 +1,25 @@
+package org.apache.tapestry5.integration.app1;
+
+import java.io.Serializable;
+
+public class ClientDataWrapper implements Serializable
+{
+ private String value;
+
+
+ public ClientDataWrapper(String value)
+ {
+ this.value = value;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ @Override
+ public String toString()
+ {
+ return String.format("ClientDataWrapper[%s]", value);
+ }
+}
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/71f81232/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
index 3f2e5df..f7b7ea9 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/CoreBehaviorsTests.java
@@ -591,11 +591,31 @@ public class CoreBehaviorsTests extends App1TestCase
// clear the session here.
clickAndWait("link=nix session");
- assertTextPresent("Persisted value: []", "Session: [false]");
+ assertText("persisted-value", "");
+ assertText("session-exists", "false");
clickAndWait("link=store string");
- assertTextPresent("Persisted value: [A String]", "Session: [false]");
+ assertText("persisted-value", "A String");
+ assertText("session-exists", "false");
+
+ clickAndWait("link=refresh");
+
+ assertText("persisted-value", "A String");
+ assertText("session-exists", "false");
+ }
+
+ @Test
+ public void client_persistence_complex_object() {
+ openLinks("Client Persistence Demo", "nix session", "store complex");
+
+ assertText("persisted-value", "ClientDataWrapper[data inside wrapper]");
+ assertText("session-exists", "false");
+
+ clickAndWait("link=refresh");
+
+ assertText("persisted-value", "ClientDataWrapper[data inside wrapper]");
+ assertText("session-exists", "false");
}
@Test
http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/71f81232/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ClientPersistenceDemo.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ClientPersistenceDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ClientPersistenceDemo.java
index f047851..41b924f 100644
--- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ClientPersistenceDemo.java
+++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/ClientPersistenceDemo.java
@@ -1,5 +1,3 @@
-// Copyright 2007, 2009 The Apache Software Foundation
-//
// Licensed 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
@@ -15,7 +13,7 @@
package org.apache.tapestry5.integration.app1.pages;
import org.apache.tapestry5.annotations.Persist;
-
+import org.apache.tapestry5.integration.app1.ClientDataWrapper;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.services.Request;
import org.apache.tapestry5.services.Session;
@@ -43,6 +41,11 @@ public class ClientPersistenceDemo
persistedValue = "A String";
}
+ void onActionFromStoreComplex()
+ {
+ persistedValue = new ClientDataWrapper("data inside wrapper");
+ }
+
void onActionFromStoreBad()
{
persistedValue = new Runnable()