TAP5-2070 tests on basic check on activation context with new annotation
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/0ae1d117 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/0ae1d117 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/0ae1d117 Branch: refs/heads/master Commit: 0ae1d1170f93f7570a3340a0d07185c79a300acb Parents: 953f9a3 Author: Massimo Lusetti <[email protected]> Authored: Mon Aug 5 19:40:41 2013 +0200 Committer: Massimo Lusetti <[email protected]> Committed: Mon Aug 5 19:48:15 2013 +0200 ---------------------------------------------------------------------- .../integration/app1/CoreBehaviorsTests.java | 24 ++++++++++++++++++++ .../tapestry5/integration/app1/pages/Index.java | 12 +++++++--- .../pages/UnknownActivationContextDemo.java | 2 +- .../app1/pages/UnknownActivationContextDemo.tml | 7 +++--- 4 files changed, 37 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0ae1d117/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 51c1683..f738e90 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 @@ -1684,4 +1684,28 @@ public class CoreBehaviorsTests extends TapestryCoreTestCase assertTextPresent("Component Event Link Decorated: true"); } + + /** + * TAP5-2070 + */ + @Test + public void unknown_activation_context_demo() + { + openLinks("Unknown Activation Context Demo"); + + assertText("//title", "Error 404 Activation context <EventContext: Unwanted, context>" + + " unrecognized for page class org.apache.tapestry5.integration.app1.pages.UnknownActivationContextDemo"); + } + + /** + * TAP5-2070 + */ + @Test + public void known_activation_context_demo() + { + openLinks("Known Activation Context Demo"); + + assertTextPresent("Page called with correct activation context", + "You should never see me if use an erroneous activation context"); + } } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0ae1d117/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java index a8a9fa2..0735233 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java @@ -1,4 +1,4 @@ -// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012 The Apache Software Foundation +// Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 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. @@ -40,12 +40,14 @@ public class Index public final String pageName; public final String label; public final String description; + public final Object[] context; - public Item(String pageName, String label, String description) + public Item(String pageName, String label, String description, Object... context) { this.pageName = pageName; this.label = label; this.description = description; + this.context = context; } public int compareTo(Item o) @@ -520,7 +522,11 @@ public class Index new Item("FormLinkParameters", "FormLinkParameters Demo", "Form link parameters should be unescaped for a hidden field"), - new Item("UnknownActivationContextDemo", "Unknown Activation Context Demo", "Page refuse to serve if called with an unknown activation context") + new Item("KnownActivationContextDemo", "Known Activation Context Demo", "Page is displayed normally if called without context (TAP5-2070)", + "Exact"), + + new Item("UnknownActivationContextDemo", "Unknown Activation Context Demo", "Page refuse to serve if called with an unknown activation context (TAP5-2070)", + "Unwanted", "context") ); static http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0ae1d117/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java index 368f159..8232ede 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.java @@ -1,4 +1,4 @@ -// Copyright 2008 The Apache Software Foundation +// Copyright 2013 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. http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/0ae1d117/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml index a168227..62e787b 100644 --- a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/app1/pages/UnknownActivationContextDemo.tml @@ -1,10 +1,9 @@ -<html t:type="Border" - xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> +<t:border xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd"> - <h1>Page called with an unknown activation context</h1> + <h1>Page called without activation context</h1> <p> You should never see me if use an activation context </p> -</html> \ No newline at end of file +</t:border> \ No newline at end of file
