TAP5-2070 new test integration app for activation context check with inverse behavior (all enabled, some excluded)
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/2d5fb4b7 Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/2d5fb4b7 Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/2d5fb4b7 Branch: refs/heads/master Commit: 2d5fb4b77e7250b5d12ba23fc1a48075b429d034 Parents: 7e05859 Author: Massimo Lusetti <[email protected]> Authored: Mon Aug 5 19:44:27 2013 +0200 Committer: Massimo Lusetti <[email protected]> Committed: Mon Aug 5 19:48:15 2013 +0200 ---------------------------------------------------------------------- .../src/test/activationctx2/WEB-INF/web.xml | 19 ++++++ .../ActivationContextIntegrationTests2.java | 64 ++++++++++++++++++++ .../activationctx2/components/Layout.java | 19 ++++++ .../activationctx2/pages/ContextChecked.java | 19 ++++++ .../activationctx2/pages/ContextUnchecked.java | 22 +++++++ .../integration/activationctx2/pages/Index.java | 32 ++++++++++ .../activationctx2/services/AppModule.java | 35 +++++++++++ .../activationctx2/components/Layout.tml | 21 +++++++ .../activationctx2/pages/ContextChecked.tml | 7 +++ .../activationctx2/pages/ContextUnchecked.tml | 7 +++ .../integration/activationctx2/pages/Index.tml | 26 ++++++++ 11 files changed, 271 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/activationctx2/WEB-INF/web.xml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/activationctx2/WEB-INF/web.xml b/tapestry-core/src/test/activationctx2/WEB-INF/web.xml new file mode 100644 index 0000000..45415d9 --- /dev/null +++ b/tapestry-core/src/test/activationctx2/WEB-INF/web.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE web-app + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + <display-name>Activation Context Test App 2</display-name> + <context-param> + <param-name>tapestry.app-package</param-name> + <param-value>org.apache.tapestry5.integration.activationctx2</param-value> + </context-param> + <filter> + <filter-name>app</filter-name> + <filter-class>org.apache.tapestry5.TapestryFilter</filter-class> + </filter> + <filter-mapping> + <filter-name>app</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> +</web-app> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java new file mode 100644 index 0000000..1939788 --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/ActivationContextIntegrationTests2.java @@ -0,0 +1,64 @@ +// 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. +// 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.tapestry5.integration.activationctx2; + +import org.apache.tapestry5.integration.TapestryCoreTestCase; +import org.testng.annotations.Test; + +/** + * To test TAP5-2070 + */ +public class ActivationContextIntegrationTests2 extends TapestryCoreTestCase +{ + @Test + public void checked_context_correct() + { + openLinks("Context checked correct"); + + assertTextPresent("You are able to see me only without activation context"); + } + + @Test + public void checked_context_error() + { + openLinks("Context checked error"); + + assertTextPresent("HTTP ERROR 404"); + } + + @Test + public void unchecked_context_empty() + { + openLinks("Context unchecked without"); + + assertTextPresent("You are able to see with all context you like..."); + } + + @Test + public void unchecked_context_one() + { + openLinks("Context unchecked with one"); + + assertTextPresent("You are able to see with all context you like..."); + } + + @Test + public void unchecked_context_two() + { + openLinks("Context unchecked with two"); + + assertTextPresent("You are able to see with all context you like..."); + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java new file mode 100644 index 0000000..f4beb15 --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/components/Layout.java @@ -0,0 +1,19 @@ +// 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. +// 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.tapestry5.integration.activationctx2.components; + +public class Layout +{ +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java new file mode 100644 index 0000000..21af37b --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.java @@ -0,0 +1,19 @@ +// 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. +// 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.tapestry5.integration.activationctx2.pages; + +public class ContextChecked +{ +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java new file mode 100644 index 0000000..dab867b --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.java @@ -0,0 +1,22 @@ +// 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. +// 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.tapestry5.integration.activationctx2.pages; + +import org.apache.tapestry5.annotations.UnknownActivationContextCheck; + +@UnknownActivationContextCheck(false) +public class ContextUnchecked +{ +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java new file mode 100644 index 0000000..ca5276a --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/pages/Index.java @@ -0,0 +1,32 @@ +// 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. +// 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.tapestry5.integration.activationctx2.pages; + +import org.apache.tapestry5.annotations.UnknownActivationContextCheck; + +/** + * TAP5-2070 Integration test index page + */ +@UnknownActivationContextCheck(false) +public class Index +{ + public String[] getTwoValues() + { + return new String[] { + "One", + "Two" + }; + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java new file mode 100644 index 0000000..3ff209d --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/activationctx2/services/AppModule.java @@ -0,0 +1,35 @@ +// 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. +// 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.tapestry5.integration.activationctx2.services; + +import org.apache.tapestry5.MetaDataConstants; +import org.apache.tapestry5.SymbolConstants; +import org.apache.tapestry5.ioc.MappedConfiguration; + +/** + * + */ +public class AppModule +{ + public static void contributeApplicationDefaults(MappedConfiguration<String, String> configuration) + { + configuration.add(SymbolConstants.SUPPORTED_LOCALES, "en"); + configuration.add(SymbolConstants.PRODUCTION_MODE, "false"); + configuration.add(SymbolConstants.COMPRESS_WHITESPACE, "false"); + + // Enable by default the check on activation context parameters + configuration.add(MetaDataConstants.UNKNOWN_ACTIVATION_CONTEXT_CHECK, "true"); + } +} http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml new file mode 100644 index 0000000..0084db4 --- /dev/null +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/components/Layout.tml @@ -0,0 +1,21 @@ +<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> + <head> + <title>LinkTrans: ${componentresources.pagename}</title> + </head> + <body> + <h1>${componentresources.pagename}</h1> + + <t:body/> + + <hr/> + + <ul> + <li> + <t:pagelink page="index">back to index</t:pagelink> + </li> + <li> + <t:pagelink page="${componentResources.pageName}">refresh</t:pagelink> + </li> + </ul> + </body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml new file mode 100644 index 0000000..2a8852d --- /dev/null +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextChecked.tml @@ -0,0 +1,7 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> + + <p> + You are able to see me only without activation context + </p> + +</t:layout> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml new file mode 100644 index 0000000..0f20814 --- /dev/null +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/ContextUnchecked.tml @@ -0,0 +1,7 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> + + <p> + You are able to see with all context you like... + </p> + +</t:layout> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/2d5fb4b7/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml new file mode 100644 index 0000000..c80070b --- /dev/null +++ b/tapestry-core/src/test/resources/org/apache/tapestry5/integration/activationctx2/pages/Index.tml @@ -0,0 +1,26 @@ +<t:layout xmlns:t="http://tapestry.apache.org/schema/tapestry_5_3.xsd" xmlns:p="tapestry:parameter"> + + <ul> + <li> + <t:pagelink page="contextchecked">Context checked correct</t:pagelink> + </li> + + <li> + <t:pagelink page="contextchecked" context="literal:error">Context checked error</t:pagelink> + </li> + + + <li> + <t:pagelink page="contextunchecked">Context unchecked without</t:pagelink> + </li> + + <li> + <t:pagelink page="contextunchecked" context="literal:one">Context unchecked with one</t:pagelink> + </li> + + <li> + <t:pagelink page="contextunchecked" context="twoValues">Context unchecked with two</t:pagelink> + </li> + </ul> + +</t:layout> \ No newline at end of file
