portals-pluto-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asfgr...@apache.org
Subject [18/22] portals-pluto git commit: PLUTO-733 Add URL and Parameters Demo Portlet Tests
Date Thu, 25 Oct 2018 20:19:50 GMT
PLUTO-733 Add URL and Parameters Demo Portlet Tests


Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/5e5ff904
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/5e5ff904
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/5e5ff904

Branch: refs/heads/master
Commit: 5e5ff90444addd039110b1111cba7fac03a0e1a0
Parents: 37a671a
Author: Kyle Stiemann <stiemannkj1@gmail.com>
Authored: Thu Oct 18 12:55:26 2018 -0400
Committer: Neil Griffin <neil.griffin.scm@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400

----------------------------------------------------------------------
 .../test/ParameterDemoPortletIT.java            |  33 ++
 .../test/ParameterPortletsDemoBase.java         | 318 +++++++++++++++++++
 .../test/URLActionParameterDemoPortletIT.java   |  70 ++++
 .../demo/integration/test/URLDemoPortletIT.java | 160 ++++++++++
 .../test/URLMethodsPortletsDemoBase.java        | 114 +++++++
 .../test/URLRenderParameterDemoPortletIT.java   |  37 +++
 6 files changed, 732 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterDemoPortletIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterDemoPortletIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterDemoPortletIT.java
new file mode 100644
index 0000000..0ac030c
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterDemoPortletIT.java
@@ -0,0 +1,33 @@
+/*  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.portals.pluto.demo.integration.test;
+
+import org.junit.Test;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class ParameterDemoPortletIT extends ParameterPortletsDemoBase {
+
+   @Test
+   public void testParameterDemoPortlet() {
+      navigateToPage("V3.0 Parameter Tests");
+      testCustomParameters(1);
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterPortletsDemoBase.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterPortletsDemoBase.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterPortletsDemoBase.java
new file mode 100644
index 0000000..57d2a5a
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ParameterPortletsDemoBase.java
@@ -0,0 +1,318 @@
+/*  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.portals.pluto.demo.integration.test;
+
+import java.util.List;
+import org.openqa.selenium.By;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class ParameterPortletsDemoBase extends DemoTestDriver {
+   protected static final String SEND_BUTTON_XPATH = "//input[@value='send'][@type='submit']";
+
+   private static final List<String> ACTION_PARAMETERS_TABLE_TITLES =
+         Util.unmodifiableList("Action parameters for the last ActionRequest:");
+   private static final String REMOVE_PARAMETER_CHECKBOX_XPATH =
+         "//input[@name='remType'][@value='remPRP'][@type='checkbox']";
+   private static final List<String> RENDER_PARAMETERS_TABLE_TITLES =
+         Util.unmodifiableList("Currently set render parameters:", "Render parameters for
the ResourceRequest:");
+   private static final List<String> RESOURCE_PARAMETERS_TABLE_TITLES =
+         Util.unmodifiableList("Resource parameters for the ResourceRequest:");
+   private static final String SINGLE_VALUE_RADIO_BUTTON_XPATH =
+         "//input[@name='setType'][@value='setVal'][@type='radio']";
+   private static final String VALUE_ARRAYS_RADIO_BUTTON_XPATH =
+         "//input[@name='setType'][@value='setVals'][@type='radio']";
+
+   protected final void testCustomParameters() {
+      testCustomParameters(1);
+   }
+
+   protected final void testCustomParameters(int portletNumber) {
+
+      assertNoRenderParametersSet(portletNumber);
+      clickElement(driver, waitingAsserter,
+            getXpath(SEND_BUTTON_XPATH, portletNumber));
+      assertNoRenderParametersSet(portletNumber);
+      clickElement(driver, waitingAsserter,
+            getXpath(SINGLE_VALUE_RADIO_BUTTON_XPATH, portletNumber));
+      testParameter(portletNumber, "test1", "v1");
+      testParameter(portletNumber, "test1", "v2", "v3", "v4");
+      clickElement(driver, waitingAsserter, getXpath(REMOVE_PARAMETER_CHECKBOX_XPATH, portletNumber));
+      testParameter(portletNumber, "test1", "v1");
+      clickElement(driver, waitingAsserter, getXpath(REMOVE_PARAMETER_CHECKBOX_XPATH, portletNumber));
+      testParameter(portletNumber, "test1", "v1");
+      clickElement(driver, waitingAsserter,
+            getXpath(VALUE_ARRAYS_RADIO_BUTTON_XPATH, portletNumber));
+      testParameter(portletNumber, "test1", "v2", "v3", "v4");
+      testParameter(portletNumber, "test2", "null");
+      testParameter(portletNumber, "test3", "empty");
+      testParameter(portletNumber, "Bild", "Bild1");
+   }
+
+   protected final void testParameters(int portletNumber, Parameter... parameters) {
+
+      for (Parameter parameter : parameters) {
+
+         sendKeysToElement(driver, waitingAsserter, getXpath("//input[@name='pName'][@type='text']",
portletNumber),
+               parameter.name);
+         sendKeysToElement(driver, waitingAsserter,
+               getXpath("//input[@name='pValues'][@type='text']", portletNumber), parameter.values.toString());
+         clickElement(driver, waitingAsserter, getXpath(SEND_BUTTON_XPATH, portletNumber));
+         boolean removeParameter =
+               driver.findElement(By.xpath(getXpath(REMOVE_PARAMETER_CHECKBOX_XPATH, portletNumber))).isSelected();
+
+         if (removeParameter) {
+            assertParametersNotSet(portletNumber, parameter);
+         }
+         else {
+            assertParametersSet(portletNumber, parameter);
+         }
+      }
+   }
+
+   protected final void assertNoActionParametersSet(int portletNumber) {
+      assertNoParametersSet(1, ACTION_PARAMETERS_TABLE_TITLES);
+   }
+
+   protected final void assertNoParametersSet(int portletNumber, List<String> parametersTableTitles)
{
+
+      String parametersXpath = getParametersTableXpath(portletNumber, parametersTableTitles)
+ "/td";
+      waitingAsserter.assertTrue(or(not(presenceOfAllElementsLocatedBy(By.xpath(parametersXpath))),

+            invisibilityOfElementLocated(By.xpath(parametersXpath)),
+            visibilityOfElementLocated(By.xpath(getParameterTableRowXpath(portletNumber,
+                  new Parameter("No parameters available!", "No parameters available!"))))));
+   }
+
+   protected final void assertNoRenderParametersSet(int portletNumber) {
+      assertNoParametersSet(1, RENDER_PARAMETERS_TABLE_TITLES);
+   }
+
+   protected final void assertNoResourceParametersSet(int portletNumber) {
+      assertNoParametersSet(1, RESOURCE_PARAMETERS_TABLE_TITLES);
+   }
+
+   protected final void assertParametersNotSet(int portletNumber, Parameter... parameters)
{
+      assertParametersNotSet(portletNumber, null, parameters);
+   }
+
+   protected final void assertParametersNotSet(int portletNumber, List<String> parametersTableTitles,
+         Parameter... parameters) {
+
+      if (parameters.length == 0) {
+         throw new NullPointerException();
+      }
+
+      for (Parameter parameter : parameters) {
+         String renderParameterTableRowXpath = getParameterTableRowXpath(portletNumber, parametersTableTitles,
+               parameter);
+         waitingAsserter.assertTrue(or(not(presenceOfAllElementsLocatedBy(By.xpath(renderParameterTableRowXpath))),
+               invisibilityOfElementLocated(By.xpath(renderParameterTableRowXpath))));
+      }
+   }
+
+   protected final void assertParametersSet(int portletNumber, Parameter... parameters) {
+      assertParametersSet(portletNumber, null, parameters);
+   }
+
+   protected final void assertParametersSet(int portletNumber, List<String> parametersTableTitles,
+         Parameter... parameters) {
+
+      if (parameters.length == 0) {
+         throw new NullPointerException();
+      }
+
+      for (Parameter parameter : parameters) {
+         waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(
+               getParameterTableRowXpath(portletNumber, parametersTableTitles, parameter))));
+      }
+   }
+
+   private void testParameter(int portletNumber, String paramName, String... paramValues)
{
+
+      boolean expectSingleValue = driver.findElement(By.xpath(
+            getXpath(SINGLE_VALUE_RADIO_BUTTON_XPATH, portletNumber))).isSelected();
+      Parameter parameter = new Parameter(expectSingleValue, paramName, paramValues);
+      testParameters(portletNumber, parameter);
+   }
+
+   protected static String getParameterTableRowXpath(int portletNumber, Parameter parameter)
{
+      return getParameterTableRowXpath(portletNumber, null, parameter);
+   }
+
+   protected static String getParameterTableRowXpath(int portletNumber, List<String>
passedParametersTableTitles,
+         Parameter parameter) {
+
+      List<String> parametersTableTitles = passedParametersTableTitles;
+
+      if (passedParametersTableTitles == null) {
+         if (Parameter.Type.RENDER.equals(parameter.type)) {
+            parametersTableTitles = RENDER_PARAMETERS_TABLE_TITLES;
+         }
+         else if (Parameter.Type.ACTION.equals(parameter.type)) {
+            parametersTableTitles = ACTION_PARAMETERS_TABLE_TITLES;
+         }
+         else if (Parameter.Type.RESOURCE.equals(parameter.type)) {
+            parametersTableTitles = RESOURCE_PARAMETERS_TABLE_TITLES;
+         }
+      }
+
+      List<String> expectedValues = parameter.values.getExpectedValues();
+      StringBuilder expectedValuesStringBuilder = new StringBuilder();
+
+      for (String expectedValue : expectedValues) {
+         expectedValuesStringBuilder.append("[contains(text(),'");
+         expectedValuesStringBuilder.append(expectedValue);
+         expectedValuesStringBuilder.append("')]");
+      }
+
+      return getParametersTableXpath(portletNumber, parametersTableTitles) +
+            "//td[contains(text(),'Name:')][contains(text(),'" + parameter.name + "')]" +
+            "/following-sibling::td[contains(text(),'Val:')][contains(text(),'" + parameter.values.first()
+ "')]" +
+            "/following-sibling::td[contains(text(),'Len:')]" +
+                  "[contains(text(),'" + parameter.values.getExpectedLength() + "')]" +
+            "/following-sibling::td[contains(text(),'Values:')]" + expectedValuesStringBuilder;
+   }
+
+   protected static String getParametersTableXpath(int portletNumber, List<String>
parametersTableTitles) {
+
+      StringBuilder stringBuilder = new StringBuilder();
+      stringBuilder.append("//h3[");
+
+      for (int i = 0; i < parametersTableTitles.size(); i++) {
+
+         if (i > 0) {
+            stringBuilder.append(" or ");
+         }
+
+         stringBuilder.append("contains(text(),'")
+               .append(parametersTableTitles.get(i))
+               .append("')");
+      }
+
+      stringBuilder.append("]");
+
+      return getXpath(stringBuilder.toString(), portletNumber) + "/following-sibling::p/table";
+   }
+
+   protected static String getXpath(String xpath, int portletNumber) {
+      return "(" + xpath + ")[" + portletNumber + "]";
+   }
+
+   protected static final class Parameter {
+
+      protected static enum Type {
+         ACTION,
+         RENDER,
+         RESOURCE
+      }
+
+      protected final String name;
+      protected final Type type;
+
+      private final Values values;
+
+      protected Parameter(String name, String... values) {
+         this(name, Type.RENDER, values);
+      }
+
+      protected Parameter(String name, Type type, String... values) {
+         this.name = name;
+         this.values = new Values(false, values);
+         this.type = type;
+      }
+
+      private Parameter(boolean expectSingleValue, String name, String... values) {
+         this.name = name;
+         this.values = new Values(expectSingleValue, values);
+         this.type = Type.RENDER;
+      }
+
+      protected String firstValue() {
+         return values.first();
+      }
+   }
+
+   private static final class Values {
+
+      private final boolean expectSingleValue;
+      private final String[] values;
+
+      private Values(boolean expectSingleValue, String... values) {
+         this.expectSingleValue = expectSingleValue;
+         this.values = values;
+      }
+
+      private String first() {
+
+         if ("empty".equals(values[0])) {
+            return "null";
+         }
+         else {
+            return values[0];
+         }
+      }
+
+      private int getExpectedLength() {
+
+         if ("empty".equals(values[0])) {
+            return 0;
+         }
+         else if (expectSingleValue) {
+            return 1;
+         }
+         else { 
+            return values.length;
+         }
+      }
+
+      private List<String> getExpectedValues() {
+
+         if ("empty".equals(values[0])) {
+            return Util.unmodifiableList("[]");
+         }
+         else if (expectSingleValue) {
+            return Util.unmodifiableList(first());
+         }
+         else {
+            return Util.unmodifiableList(values);
+         }
+      }
+
+      @Override
+      public String toString() {
+
+         StringBuilder stringBuilder = new StringBuilder();
+
+         for (String value : values) {
+
+            if (stringBuilder.length() > 0) {
+               stringBuilder.append(", ");
+            }
+
+            stringBuilder.append(value);
+         }
+
+         return stringBuilder.toString();
+      }
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLActionParameterDemoPortletIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLActionParameterDemoPortletIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLActionParameterDemoPortletIT.java
new file mode 100644
index 0000000..ddd7930
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLActionParameterDemoPortletIT.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.portals.pluto.demo.integration.test;
+
+import org.junit.Test;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class URLActionParameterDemoPortletIT extends URLMethodsPortletsDemoBase {
+
+   @Test
+   public void testURLActionParameterDemoPortlet() {
+
+      Parameter publicRenderParameter = new Parameter("Bild", "Bild1");
+      testURLMethods(2, "button", publicRenderParameter);
+
+      // Verify that the public render parameter is available to all portlets on the page.
+      assertParametersSet(1, publicRenderParameter);
+
+      // Test no action parameters.
+      navigateToPage("V3.0 Render URL Parameter Tests");
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'5
AP Add thru clone 3')]");
+
+      Parameter addedParam1 = new Parameter("UParm1", "1");
+      Parameter addedParam2 = new Parameter("UParm2", "2");
+      Parameter addedParam3 = new Parameter("UParm3", "3");
+      assertParametersSet(2, addedParam1, addedParam2, addedParam3);
+
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'1
No action parameters')]");
+      assertNoActionParametersSet(2);
+
+      // Test set and clear action parameters.
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'5
AP Add thru clone 3')]");
+      assertParametersSet(2, addedParam1, addedParam2, addedParam3);
+
+      clickElement(driver, waitingAsserter,
+            "//button[@type='submit'][contains(text(),'2 set & clear action params')]");
+      assertNoActionParametersSet(2);
+
+      // Test clear clone all action parameters.
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'5
AP Add thru clone 3')]");
+      assertParametersSet(2, addedParam1, addedParam2, addedParam3);
+
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'3
AP Clear clone all')]");
+      assertNoActionParametersSet(2);
+
+      // Test add thru clone 2 action parameters.
+      clickElement(driver, waitingAsserter, "//button[@type='submit'][contains(text(),'4
AP Add thru clone 2')]");
+      assertParametersSet(2, new Parameter(addedParam1.name, addedParam1.firstValue(), "2"),
addedParam3);
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLDemoPortletIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLDemoPortletIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLDemoPortletIT.java
new file mode 100644
index 0000000..851263b
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLDemoPortletIT.java
@@ -0,0 +1,160 @@
+/*  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.portals.pluto.demo.integration.test;
+
+import org.junit.Test;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class URLDemoPortletIT extends ParameterPortletsDemoBase {
+
+   @Test
+   public void testURLDemoPortlet() {
+      navigateToPage("V3.0 URL Tests");
+
+      // Test copying no params.
+      testCustomParameters(1);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'1 Copy no params, 0 new')]");
+      assertNoRenderParametersSet(1);
+
+      // Test copying only PRPs.
+      Parameter publicRenderParameter = new Parameter("Bild", "Bild1");
+      Parameter renderParameter = new Parameter("test1", "test1");
+      testParameters(1, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'2 Copy public params, 0
new')]");
+      assertParametersSet(1, publicRenderParameter);
+      assertParametersNotSet(1, renderParameter);
+
+      // Clear parameters.
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'1 Copy no params, 0 new')]");
+      assertNoRenderParametersSet(1);
+
+      // Test copying all render parameters.
+      testParameters(1, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'3 Copy all params, 0 new')]");
+      assertParametersSet(1, publicRenderParameter, renderParameter);
+
+      // Test copying no params and adding 2 params.
+      testCustomParameters(1);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'4 Copy no params, 2 new')]");
+      Parameter addedParameter1 = new Parameter("1", "1");
+      Parameter addedParameter2 = new Parameter("2", "2");
+      assertParametersSet(1, addedParameter1, addedParameter2);
+
+      // Clear parameters.
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'1 Copy no params, 0 new')]");
+      assertNoRenderParametersSet(1);
+
+      // Test copying only PRPs and adding 2 params.
+      testParameters(1, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'5 Copy public params, 2
new')]");
+      assertParametersSet(1, publicRenderParameter, addedParameter1, addedParameter2);
+      assertParametersNotSet(1, renderParameter);
+
+      // Clear parameters.
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'1 Copy no params, 0 new')]");
+      assertNoRenderParametersSet(1);
+
+      // Test copying all render parameters and adding 2 params.
+      testParameters(1, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'6 Copy all params, 2 new')]");
+      assertParametersSet(1, publicRenderParameter, renderParameter, addedParameter1, addedParameter2);
+
+      // Test Resource URL cachablility PAGE.
+      testParameters(1, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'0 ca=PAGE, 0 res params')]");
+      assertParametersSet(1, publicRenderParameter, renderParameter);
+      assertNoResourceParametersSet(1);
+
+      // Test Resource URL cachablility PORTLET.
+      driver.navigate().back();
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'1 ca=PORTLET, 0 res params')]");
+      assertParametersSet(1, publicRenderParameter, renderParameter);
+      assertNoResourceParametersSet(1);
+
+      // Test Resource URL cachablility FULL.
+      driver.navigate().back();
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'2 ca=FULL, 0 res params')]");
+      assertNoRenderParametersSet(1);
+      assertNoResourceParametersSet(1);
+
+      // Test Resource URL cachablility PAGE with 2 resource params.
+      driver.navigate().back();
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'3 ca=PAGE, 2 res params')]");
+
+      Parameter addedResourceParameter1 = new Parameter("UrlParm-Resource2", Parameter.Type.RESOURCE,
"2");
+      Parameter addedResourceParameter2 = new Parameter("UrlParm2", Parameter.Type.RESOURCE,
"2");
+      assertParametersSet(1, publicRenderParameter, renderParameter, addedResourceParameter1,
+            addedResourceParameter2);
+
+      // Test Resource URL cachablility PORTLET with 2 resource params.
+      driver.navigate().back();
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'4 ca=PORTLET, 2 res params')]");
+      assertParametersSet(1, publicRenderParameter, renderParameter, addedResourceParameter1,
+            addedResourceParameter2);
+
+      // Test Resource URL cachablility FULL with 2 resource params.
+      driver.navigate().back();
+      clickElement(driver, waitingAsserter, "//a[contains(text(),'5 ca=FULL, 2 res params')]");
+      assertNoRenderParametersSet(1);
+      assertParametersSet(1, addedResourceParameter1, addedResourceParameter2);
+
+      // Test Action URL Parameters copying all Render Parameters.
+      navigateToPage("V3.0 URL Tests");
+      testParameters(1, renderParameter);
+      assertParametersSet(1,
+            new Parameter("acopy", Parameter.Type.ACTION, "acopy_all"),
+            new Parameter("pName", Parameter.Type.ACTION, renderParameter.name),
+            new Parameter("pValues", Parameter.Type.ACTION, renderParameter.firstValue()),
+            new Parameter("setType", Parameter.Type.ACTION, "setVals"));
+      assertParametersNotSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"),
+            renderParameter);
+      clickElement(driver, waitingAsserter, getXpath(SEND_BUTTON_XPATH, 1));
+      assertParametersSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"),
+            renderParameter);
+      assertParametersNotSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"),
+            publicRenderParameter);
+
+      // Test Action URL Parameters copying public Render Parameters.
+      clickElement(driver, waitingAsserter, "//input[@name='acopy'][@value='acopy_public'][@type='radio']");
+      testParameters(1, publicRenderParameter);
+      assertParametersSet(1,
+            new Parameter("acopy", Parameter.Type.ACTION, "acopy_public"),
+            new Parameter("pName", Parameter.Type.ACTION, publicRenderParameter.name),
+            new Parameter("pValues", Parameter.Type.ACTION, publicRenderParameter.firstValue()));
+      clickElement(driver, waitingAsserter, getXpath(SEND_BUTTON_XPATH, 1));
+      assertParametersNotSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"),
+            renderParameter);
+      assertParametersSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"),
+            publicRenderParameter);
+
+      // Test Action URL Parameters not copying Render Parameters.
+      clickElement(driver, waitingAsserter, "//input[@name='acopy'][@value='acopy_none'][@type='radio']");
+      testParameters(1, addedParameter1);
+      assertParametersSet(1,
+            new Parameter("acopy", Parameter.Type.ACTION, "acopy_none"),
+            new Parameter("pName", Parameter.Type.ACTION, addedParameter1.name),
+            new Parameter("pValues", Parameter.Type.ACTION, addedParameter1.firstValue()));
+      clickElement(driver, waitingAsserter, getXpath(SEND_BUTTON_XPATH, 1));
+      assertNoParametersSet(1, Util.unmodifiableList("Render parameters for the last ActionRequest:"));
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLMethodsPortletsDemoBase.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLMethodsPortletsDemoBase.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLMethodsPortletsDemoBase.java
new file mode 100644
index 0000000..164a0eb
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLMethodsPortletsDemoBase.java
@@ -0,0 +1,114 @@
+/*  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.portals.pluto.demo.integration.test;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class URLMethodsPortletsDemoBase extends ParameterPortletsDemoBase {
+
+   protected final void testURLMethods(int portletNumber, String linkButtonTagName, Parameter
publicRenderParameter) {
+
+      // Test copying no params.
+      navigateToPage("V3.0 Render URL Parameter Tests");
+      testCustomParameters(portletNumber);
+
+      // Clear parameters.
+      navigateToPage("V3.0 Render URL Parameter Tests");
+
+      // Test no render parameters.
+      Parameter renderParameter = new Parameter("test1", "test1");
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'1
No render parameters')]");
+      assertNoRenderParametersSet(portletNumber);
+
+      // Test copy render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'2
Copy with req clone')]");
+      assertParametersSet(portletNumber, publicRenderParameter, renderParameter);
+
+      // Test copy render parameters and add 1.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter,
+            "//" + linkButtonTagName + "[contains(text(),'3 Copy with req clone, 1 addl')]");
+
+      Parameter addedParam1 = new Parameter("UParm1", "1");
+      assertParametersSet(portletNumber, publicRenderParameter, renderParameter, addedParam1);
+
+      // Test clear private render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'4
Clear private')]");
+      assertParametersSet(portletNumber, publicRenderParameter);
+      assertParametersNotSet(portletNumber, renderParameter);
+
+      // Test clear public render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'5
Clear public')]");
+      assertParametersNotSet(portletNumber, publicRenderParameter);
+      assertParametersSet(portletNumber, renderParameter);
+
+      // Test clear all render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'6
Clear all')]");
+      assertNoRenderParametersSet(portletNumber);
+
+      // Test clear clone private render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'7
Clear clone private')]");
+      assertParametersSet(portletNumber, publicRenderParameter);
+      assertParametersNotSet(portletNumber, renderParameter);
+
+      // Test clear clone public render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'8
Clear clone public')]");
+      assertParametersNotSet(portletNumber, publicRenderParameter);
+      assertParametersSet(portletNumber, renderParameter);
+
+      // Test clear all clone render parameters.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'9
Clear clone all')]");
+      assertNoRenderParametersSet(portletNumber);
+
+      // Test clone render parameters and add 1.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'A
Add thru clone 1')]");
+      assertParametersSet(portletNumber, publicRenderParameter, renderParameter, addedParam1);
+
+      // Test clone render parameters and add 2.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'B
Add thru clone 2')]");
+
+      Parameter addedParam2 = new Parameter("UParm2", "2");
+      Parameter addedParam3 = new Parameter("UParm3", "3");
+      assertParametersSet(portletNumber, publicRenderParameter, renderParameter, addedParam1,
addedParam2,
+            addedParam3);
+
+      // Test clone render render parameters and add 3.
+      testParameters(portletNumber, publicRenderParameter, renderParameter);
+      clickElement(driver, waitingAsserter, "//" + linkButtonTagName + "[contains(text(),'C
Add thru clone 3')]");
+
+      Parameter addedParam4 = new Parameter("UParm4", "4");
+      Parameter addedParam5 = new Parameter("UParm5", "5");
+      Parameter addedParam6 = new Parameter("UParm6", "6");
+      assertParametersSet(portletNumber, publicRenderParameter, renderParameter, addedParam1,
addedParam2,
+            addedParam3, addedParam4, addedParam5, addedParam6);
+   }
+}

http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5e5ff904/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLRenderParameterDemoPortletIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLRenderParameterDemoPortletIT.java
b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLRenderParameterDemoPortletIT.java
new file mode 100644
index 0000000..472812b
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/URLRenderParameterDemoPortletIT.java
@@ -0,0 +1,37 @@
+/*  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.portals.pluto.demo.integration.test;
+
+import org.junit.Test;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class URLRenderParameterDemoPortletIT extends URLMethodsPortletsDemoBase {
+
+   @Test
+   public void testURLRenderParameterDemoPortlet() {
+
+      Parameter publicRenderParameter = new Parameter("Bild", "Bild1");
+      testURLMethods(1, "a", publicRenderParameter);
+
+      // Verify that the public render parameter is available to all portlets on the page.
+      assertParametersSet(2, publicRenderParameter);
+   }
+}


Mime
View raw message