You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-scm@portals.apache.org by as...@apache.org on 2018/10/25 20:19:33 UTC
[01/22] portals-pluto git commit: PLUTO-733 Author Selenium-based
tests for the Pluto V3 demos (create test utilities and add test for the
Portlet Hub Demo)
Repository: portals-pluto
Updated Branches:
refs/heads/master fc7000db5 -> d836731b1
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKTestDriver.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKTestDriver.java b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKTestDriver.java
new file mode 100644
index 0000000..4eece70
--- /dev/null
+++ b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKTestDriver.java
@@ -0,0 +1,450 @@
+/* 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 javax.portlet.tck.driver;
+
+import static org.junit.Assert.*;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeMap;
+import java.util.TreeSet;
+
+import org.apache.portals.pluto.test.utilities.SimpleTestDriver;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+import org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedConditions;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import javax.portlet.tck.constants.Constants;
+
+
+/**
+ * @author nick
+ *
+ */
+@RunWith(value = Parameterized.class)
+public class TCKTestDriver extends SimpleTestDriver {
+
+ protected String page, tcName;
+
+ protected List<String> debugLines = new ArrayList<>();
+
+ /**
+ * Reads the consolidated list of test cases and provides the list to Junit
+ * for parameterized testing.
+ * @return a Collection of test cases to run
+ */
+ @SuppressWarnings("rawtypes")
+ @Parameters (name = "{1}")
+ public static Collection getTestList () {
+ System.out.println("getTestList");
+ testFile = System.getProperty("test.list.file");
+ System.out.println(" TestFile=" + testFile);
+ module = System.getProperty("test.module");
+ System.out.println(" Module =" + module);
+ scroll = Boolean.valueOf(System.getProperty("test.scroll"));
+ System.out.println(" Scroll =" + scroll);
+
+ String ignoreFile = System.getProperty("test.ignore.list.file");
+ System.out.println(" Ignore file =" + ignoreFile);
+ boolean doIgnore = new Boolean(System.getProperty("test.ignore"));
+ System.out.println(" Ignore TCs =" + doIgnore);
+
+ boolean filterTCs = (module != null && module.length() > 0);
+ boolean excTCs = true; // include or exclude TCs
+ String filterStr = module;
+ if (filterTCs) {
+ excTCs = module.startsWith("!");
+ filterStr = module.replaceFirst("^!(.*)$", "$1");
+ System.out.println(" Filtering = " + (excTCs?"Excluding":"Including") +
+ " all " + filterStr + " testcases");
+ }
+
+ Properties tprops = new Properties();
+ try {
+ FileInputStream fis = new FileInputStream(testFile);
+ tprops.loadFromXML(fis);
+ } catch (Exception e) {
+ System.out.println("Could not read test cases file. Attempted to read file " + testFile);
+ e.printStackTrace();
+ return null;
+ }
+
+ Properties ignoredTCs = new Properties();
+ if (doIgnore) {
+ try {
+ FileInputStream fis = new FileInputStream(ignoreFile);
+ ignoredTCs.loadFromXML(fis);
+ } catch (Exception e) {
+ System.out.println("Could not read test cases file. Attempted to read file " + ignoreFile);
+ e.printStackTrace();
+ return null;
+ }
+ }
+ System.out.println(" # ignore TCs =" + ignoredTCs.size());
+
+ // See if performance can be improved by sorting the test cases by
+ // the page to be accessed. The map uses the page as key and has a
+ // set of test cases for that page as value. Filter according to
+ // test.module.
+
+ TreeMap<String, Set<String>> pages = new TreeMap<String, Set<String>>();
+ Set<Object> tcs = tprops.keySet();
+
+ tcloop:
+ for (Object o : tcs) {
+ String tcase = (String) o ;
+ String tpage = tprops.getProperty(tcase);
+ if (filterTCs) {
+ boolean c = tcase.contains(filterStr);
+ if (excTCs && c) continue; // exclude matches
+ if (!excTCs && !c) continue; // exclude non-matches
+ }
+ // handle ignore list
+ if (doIgnore) {
+ for (Object itc : ignoredTCs.keySet()) {
+ if (tcase.equalsIgnoreCase((String)itc)) {
+ System.out.println(" Ignoring :" + tcase);
+ continue tcloop;
+ }
+ }
+ }
+ if (!pages.containsKey(tpage)) {
+ pages.put(tpage, new TreeSet<String>());
+ }
+ pages.get(tpage).add(tcase);
+ }
+
+ // now pass TCs, sorted by page, to the driver
+
+ List<String[]> tests = new ArrayList<String[]>();
+ for (String tpage : pages.keySet()) {
+ for (String tcase: pages.get(tpage)) {
+ String[] parms = {tpage, tcase};
+ tests.add(parms);
+ }
+ }
+
+ int numP = pages.size();
+ int numTC = tests.size();
+ System.out.println("Executing " + numTC + " tests on " + numP + " pages.");
+
+ return tests;
+ }
+
+ public TCKTestDriver(String p, String t) {
+ page = p;
+ tcName = t;
+ System.out.println("Testing: " + tcName);
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @Before
+ public void setUp() throws Exception {
+ debugLines.add(" before test.");
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @After
+ public void tearDown() throws Exception {
+ debugLines.add(" after test.");
+ if (debug) {
+ for (String line : debugLines) {
+ System.out.println(line);
+ }
+ }
+ }
+
+ @Test
+ public void test() {
+ debugLines.add(" execute test.");
+
+ if (dryrun) {
+ return;
+ }
+
+ try {
+
+ // This is optimized for many results being present on the same page.
+ // First look for the test results or links already being present on the page.
+
+ List<WebElement> wels = driver.findElements(By.name(tcName));
+ debugLines.add(" TC elements already on page: " + !wels.isEmpty() + ", tcname===" + tcName + "===");
+ if (wels.isEmpty()) {
+ wels = accessPage();
+ }
+
+ // process links if present
+ wels = processClickable(wels);
+ debugLines.add(" After processing clickable, results found: " + !wels.isEmpty());
+
+ // wait for any async JavaScript tests to complete
+ processAsync();
+
+ checkResults();
+
+ } catch(Exception e) {
+
+ // Some type of unexpected error occurred, so generate text
+ // and mark the TC as failed.
+
+ System.out.println(" Exception occurred: " + e.getMessage());
+ for (String line : debugLines) {
+ System.out.println(line);
+ }
+
+ throw new AssertionError("Test case " + tcName + " failed. " +
+ "\nException: ", e);
+ }
+ }
+
+ /**
+ * Tries to access the page for the test case. Looks for the page link
+ * and clicks it, waiting for the page to load.
+ *
+ * @return a list of elements for the TC (should only be one)
+ */
+ protected List<WebElement> accessPage() throws Exception {
+ List<WebElement> wels = driver.findElements(By.linkText(page));
+ debugLines.add(" Access page, link found: " + !wels.isEmpty() + ", page===" + page + "===");
+
+ if (wels.isEmpty()) {
+ // retry through login page
+ debugLines.add("accessPage: debugLines: logging in ... ");
+ login();
+ wels = driver.findElements(By.linkText(page));
+ if (wels.isEmpty()) {
+ throw new Exception("Page " + page + ": link could not be found.");
+ }
+ }
+
+ WebElement wel = wels.get(0);
+ if (scroll) {
+ JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
+ javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
+ }
+ click(wel);
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+ wdw.until(ExpectedConditions.visibilityOfElementLocated(By.name(tcName)));
+ wels = driver.findElements(By.name(tcName));
+ if (wels.isEmpty()) {
+ throw new Exception("For test case " + tcName + ": no elements found.");
+ }
+ return wels;
+ }
+
+ protected void click(WebElement wel) {
+ wel.click();
+ }
+
+ /**
+ * Analyzes the page based on the test case name and records success or failure.
+ */
+ protected void checkResults() {
+
+ String resultId = tcName + Constants.RESULT_ID;
+ String detailId = tcName + Constants.DETAIL_ID;
+
+ List<WebElement> rels = driver.findElements(By.id(resultId));
+ List<WebElement> dels = driver.findElements(By.id(detailId));
+
+ if (!rels.isEmpty()) {
+
+ String res = "";
+ try {
+ res = rels.get(0).getText();
+ } catch(StaleElementReferenceException e) {
+ System.out.println(e.getClass().getName() + " caught when trying to use WebElements found with " + resultId);
+ rels = driver.findElements(By.id(resultId));
+ res = rels.get(0).getText();
+ }
+
+ String det = "Test case " + tcName + ": ";
+ try {
+ det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
+ } catch(StaleElementReferenceException e) {
+ System.out.println(e.getClass().getName() + " caught when trying to use WebElements found with " + detailId);
+ dels = driver.findElements(By.id(detailId));
+ det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
+ }
+
+ boolean ok = res.contains(Constants.SUCCESS);
+ debugLines.add(" Test OK: " + ok + ", results: " + res + ", details: " + det);
+ assertTrue(det, ok);
+ } else {
+ debugLines.add(" Results not found");
+ assertTrue("Test case " + tcName + " failed. Results could not be found.", false);
+ }
+ }
+
+ /**
+ * Looks for a link or button that can be clicked for the TC and clicks it if found.
+ *
+ * First looks for a test case setup link or button and clicks it if found. Then it
+ * looks for a test case execution link and clicks it if found.
+ *
+ * @return web element list containing the test case results.
+ * @throws Exception
+ */
+ @SuppressWarnings("unused")
+ protected List<WebElement> processClickable(List<WebElement> wels) throws Exception {
+ String setupId = tcName + Constants.SETUP_ID;
+ String actionId = tcName + Constants.CLICK_ID;
+ String resultId = tcName + Constants.RESULT_ID;
+ String detailId = tcName + Constants.DETAIL_ID;
+ String asyncId = tcName + Constants.ASYNC_ID;
+ String notreadyId = tcName + Constants.NOTREADY_ID;
+ List<WebElement> tcels = null;
+
+ for (WebElement wel : wels) {
+ tcels = wel.findElements(By.id(setupId));
+ if (!tcels.isEmpty()) break;
+ }
+ debugLines.add(" Setup link found: " + ((tcels != null) && !tcels.isEmpty()));
+
+ // If were dealing with async, make sure the JavaScript is initialized
+ List<WebElement> acels = driver.findElements(By.id(asyncId));
+ debugLines.add(" Async elements found: " + ((acels != null) && !acels.isEmpty()));
+ if (acels != null && !acels.isEmpty()) {
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+ wdw.until(ExpectedConditions.invisibilityOfElementLocated(By.id(notreadyId)));
+ debugLines.add(" Async elements are now ready.");
+ }
+
+ // Click setup link if found
+ if ((tcels != null) && !tcels.isEmpty()) {
+ WebElement wel = tcels.get(0);
+ if (scroll) {
+ JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
+ javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
+ }
+ try {
+ wel.click();
+ } catch(StaleElementReferenceException e) {
+ System.out.println("setup link: " + e.getClass().getName() + " caught when trying to use WebElements found with " + tcName);
+ wels = driver.findElements(By.name(tcName));
+ for (WebElement welly : wels) {
+ tcels = welly.findElements(By.id(setupId));
+ if (!tcels.isEmpty()) break;
+ }
+ wel = tcels.get(0);
+ wel.click();
+ }
+ debugLines.add(" Clicked setup link.");
+
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+
+ String expr = "//*[@id='" + resultId + "'] | //*[@id='" + actionId + "']";
+ debugLines.add(" xpath string: ===" + expr + "===");
+
+ wdw.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(expr)));
+ wels = driver.findElements(By.name(tcName));
+
+ debugLines.add(" Found elements: " + (!wels.isEmpty()));
+ List<WebElement> xels = driver.findElements(By.xpath(expr));
+ for (WebElement w : xels) {
+ debugLines.add(" Element: " + w.getTagName() + ", id=" + w.getAttribute("id"));
+ }
+ }
+
+ // Now click the action link, if present
+ for (WebElement wel : wels) {
+ tcels = wel.findElements(By.id(actionId));
+ if (!tcels.isEmpty()) break;
+ }
+ debugLines.add(" Clickable link found: " + ((tcels != null) && !tcels.isEmpty()));
+
+ if (tcels != null && !tcels.isEmpty()) {
+ WebElement wel = tcels.get(0);
+ if (scroll) {
+ JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
+ javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
+ }
+ try {
+ wel.click();
+ } catch(StaleElementReferenceException e) {
+ System.out.println("action link: " + e.getClass().getName() + " caught when trying to use WebElements found with " + tcName);
+ wels = driver.findElements(By.name(tcName));
+ for (WebElement welly : wels) {
+ tcels = welly.findElements(By.id(actionId));
+ if (!tcels.isEmpty()) break;
+ }
+ wel = tcels.get(0);
+ wel.click();
+ }
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+ wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
+ wels = driver.findElements(By.name(tcName));
+ if ((wels == null) || wels.isEmpty()) {
+ throw new Exception("Test case " + tcName + " failed. No results after action link click.");
+ }
+ }
+
+
+ return wels;
+ }
+
+ /**
+ * Looks for an async element on the page. The async element will be filed in
+ * with results by the test case JavaScript code, which runs asynchronously.
+ *
+ * If an async element is found, this function waits the timeout period to
+ * let the async test case code update the results.
+ *
+ * @return <code>true</code> if async was handled; <code>false</code> otherwise.
+ * @throws Exception
+ */
+ protected boolean processAsync() throws Exception {
+ String asyncId = tcName + Constants.ASYNC_ID;
+ String resultId = tcName + Constants.RESULT_ID;
+
+ List<WebElement> tcels = null;
+
+ tcels = driver.findElements(By.id(asyncId));
+
+ debugLines.add(" Element with async id=" + asyncId + " found: " + !tcels.isEmpty());
+
+ if (tcels.isEmpty()) {
+ // no async element
+ return false;
+ }
+
+ WebDriverWait wdw = new WebDriverWait(driver, timeout);
+ wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
+
+ return true;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/portlet-tck_3.0/pom.xml
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/pom.xml b/portlet-tck_3.0/pom.xml
index 717be4b..3918bbc 100644
--- a/portlet-tck_3.0/pom.xml
+++ b/portlet-tck_3.0/pom.xml
@@ -209,44 +209,6 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
-
- <!-- For creating and executing tests -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.11</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-api</artifactId>
- <version>3.11.0</version>
- <scope>compile</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- <version>3.11.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>htmlunit-driver</artifactId>
- <version>2.31.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- <version>9.4.10.RC1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.codeborne</groupId>
- <artifactId>phantomjsdriver</artifactId>
- <version>1.3.0</version>
- <scope>test</scope>
- </dependency>
</dependencies>
</dependencyManagement>
@@ -528,7 +490,7 @@
<activeByDefault>true</activeByDefault>
</activation>
<properties>
- <test.tck.driver>**/javax/portlet/tck/driver/TCKSimpleTestDriver.java</test.tck.driver>
+ <test.tck.driver>**/javax/portlet/tck/driver/TCKTestDriver.java</test.tck.driver>
</properties>
<dependencies>
<dependency>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/test-base/pom.xml
----------------------------------------------------------------------
diff --git a/test-base/pom.xml b/test-base/pom.xml
new file mode 100644
index 0000000..fccfb4a
--- /dev/null
+++ b/test-base/pom.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>3.0.2-SNAPSHOT</version>
+ </parent>
+ <artifactId>test-base</artifactId>
+ <packaging>jar</packaging>
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-java</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>htmlunit-driver</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.codeborne</groupId>
+ <artifactId>phantomjsdriver</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ </dependencies>
+</project>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
----------------------------------------------------------------------
diff --git a/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java b/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
new file mode 100644
index 0000000..ee40644
--- /dev/null
+++ b/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
@@ -0,0 +1,216 @@
+/* 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.test.utilities;
+
+import java.util.List;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.chrome.ChromeOptions;
+import org.openqa.selenium.chrome.ChromeDriver;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.firefox.FirefoxOptions;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
+import org.openqa.selenium.ie.InternetExplorerDriver;
+import org.openqa.selenium.remote.DesiredCapabilities;
+import org.openqa.selenium.safari.SafariDriver;
+import org.openqa.selenium.phantomjs.PhantomJSDriver;
+import org.openqa.selenium.phantomjs.PhantomJSDriverService;
+
+
+/**
+ * @author nick
+ * @author Kyle Stiemann
+ *
+ */
+public class SimpleTestDriver {
+
+ protected static String baseUrl, loginUrl, host, port, testFile, browser,
+ username, usernameId, password, passwordId, testContextBase, module;
+ protected static int timeout = 3; // for waiting on page load
+ protected static boolean useGeneratedUrl = true, debug = false, dryrun = false, scroll;
+
+ protected static WebDriver driver;
+ /**
+ * @throws java.lang.Exception
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+
+ loginUrl = System.getProperty("test.server.login.url");
+ host = System.getProperty("test.server.host");
+ port = System.getProperty("test.server.port");
+ username = System.getProperty("test.server.username");
+ usernameId = System.getProperty("test.server.username.id");
+ password = System.getProperty("test.server.password");
+ passwordId = System.getProperty("test.server.password.id");
+ browser = System.getProperty("test.browser");
+ testContextBase = System.getProperty("test.context.base");
+ StringBuilder sb = new StringBuilder();
+ sb.append("http://");
+ sb.append(host);
+ if (port != null && !port.isEmpty()) {
+ sb.append(":");
+ sb.append(port);
+ }
+ sb.append("/");
+ sb.append(testContextBase);
+ baseUrl = sb.toString();
+ String str = System.getProperty("test.url.strategy");
+ useGeneratedUrl = str.equalsIgnoreCase("generateURLs");
+ str = System.getProperty("test.debug");
+ debug = str.equalsIgnoreCase("true");
+ str = System.getProperty("test.timeout");
+ dryrun = new Boolean(System.getProperty("test.dryrun"));
+ timeout = ((str != null) && str.matches("\\d+")) ? Integer.parseInt(str) : 3;
+ String wd = System.getProperty("test.browser.webDriver");
+ String binary = System.getProperty("test.browser.binary");
+ String headlessProperty = System.getProperty("test.browser.headless");
+ boolean headless = (((headlessProperty == null) || (headlessProperty.length() == 0) ||
+ Boolean.valueOf(headlessProperty)));
+ String maximizedProperty = System.getProperty("test.browser.maximized");
+ boolean maximized = "true".equalsIgnoreCase(maximizedProperty);
+
+ System.out.println("before class.");
+ System.out.println(" Debug =" + debug);
+ System.out.println(" Dryrun =" + dryrun);
+ System.out.println(" Timeout =" + timeout);
+ System.out.println(" Login URL =" + loginUrl);
+ System.out.println(" Host =" + host);
+ System.out.println(" Port =" + port);
+ System.out.println(" Context =" + testContextBase);
+ System.out.println(" Generate URL =" + useGeneratedUrl);
+ System.out.println(" Username =" + username);
+ System.out.println(" UsernameId =" + usernameId);
+ System.out.println(" Password =" + password);
+ System.out.println(" PasswordId =" + passwordId);
+ System.out.println(" Browser =" + browser);
+ System.out.println(" Driver =" + wd);
+ System.out.println(" binary =" + binary);
+ System.out.println(" headless =" + headless);
+ System.out.println(" maximized =" + maximized);
+
+ if (browser.equalsIgnoreCase("firefox")) {
+
+ System.setProperty("webdriver.gecko.driver", wd);
+ FirefoxOptions options = new FirefoxOptions();
+ options.setLegacy(true);
+ options.setAcceptInsecureCerts(true);
+
+ if ((binary != null) && (binary.length() != 0)) {
+ options.setBinary(binary);
+ }
+
+ if (headless) {
+ options.setHeadless(true);
+ }
+
+ driver = new FirefoxDriver(options);
+
+ } else if (browser.equalsIgnoreCase("internetExplorer")) {
+ System.setProperty("webdriver.ie.driver", wd);
+ driver = new InternetExplorerDriver();
+ } else if (browser.equalsIgnoreCase("chrome")) {
+
+ System.setProperty("webdriver.chrome.driver", wd);
+ ChromeOptions options = new ChromeOptions();
+
+ if ((binary != null) && (binary.length() > 0)) {
+ options.setBinary(binary);
+ }
+
+ if (headless) {
+ options.addArguments("--headless");
+ }
+
+ options.addArguments("--disable-infobars");
+ options.setAcceptInsecureCerts(true);
+
+ if (maximized) {
+ // The webDriver.manage().window().maximize() feature does not work correctly in headless mode, so set the
+ // window size to 1920x1200 (resolution of a 15.4 inch screen).
+ options.addArguments("--window-size=1920,1200");
+ }
+
+ driver = new ChromeDriver(options);
+
+ } else if (browser.equalsIgnoreCase("phantomjs")) {
+ DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
+ capabilities.setJavascriptEnabled(true);
+ capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary);
+ driver = new PhantomJSDriver(capabilities);
+ } else if (browser.equalsIgnoreCase("htmlUnit")) {
+ driver = new HtmlUnitDriver();
+ } else if (browser.equalsIgnoreCase("safari")) {
+ driver = new SafariDriver();
+ } else {
+ throw new Exception("Unsupported browser: " + browser);
+ }
+
+ if (maximized) {
+ driver.manage().window().maximize();
+ }
+
+ if (!dryrun) {
+ login();
+ }
+
+ }
+
+ /**
+ * Called to login to the portal if necessary.
+ */
+ protected static void login() {
+
+ driver.get(loginUrl);
+
+ List<WebElement> uels = driver.findElements(By.id(usernameId));
+ List<WebElement> pwels = driver.findElements(By.id(passwordId));
+
+ // If there is no login or password fields, don't need to login.
+ if (!uels.isEmpty() && !pwels.isEmpty()) {
+
+ System.out.println("login: found userid and password fields");
+ WebElement userEl = uels.get(0);
+ WebElement pwEl = pwels.get(0);
+
+ // perform login
+ userEl.clear();
+ userEl.sendKeys(username);
+ pwEl.clear();
+ pwEl.sendKeys(password);
+ pwEl.submit();
+
+ }
+ }
+
+ /**
+ * @throws java.lang.Exception
+ */
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ if (driver != null) {
+ driver.quit();
+ }
+ System.out.println(" after class.");
+ }
+
+}
[07/22] portals-pluto git commit: PLUTO-733 Only close the browser
after all tests are done
Posted by as...@apache.org.
PLUTO-733 Only close the browser after all tests are done
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/3090b959
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/3090b959
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/3090b959
Branch: refs/heads/master
Commit: 3090b95928f6bc00b18494bea32ad8fa1c219bc4
Parents: 5ea9551
Author: Kyle Stiemann <st...@gmail.com>
Authored: Wed Oct 10 17:06:22 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/DemoTestDriver.java | 5 +-
.../pluto/test/utilities/SimpleTestDriver.java | 231 ++++++++++---------
2 files changed, 122 insertions(+), 114 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/3090b959/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
index e0b87a9..6ccd254 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
@@ -30,6 +30,9 @@ public class DemoTestDriver extends SimpleTestDriver {
@BeforeClass
public static void setUpBeforeDemoSimpleTestDriverClass() {
- waitingAsserter = new WaitingAsserter(driver, timeout);
+
+ if (waitingAsserter == null) {
+ waitingAsserter = new WaitingAsserter(driver, timeout);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/3090b959/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
----------------------------------------------------------------------
diff --git a/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java b/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
index ee40644..9c45e49 100644
--- a/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
+++ b/test-base/src/main/java/org/apache/portals/pluto/test/utilities/SimpleTestDriver.java
@@ -55,124 +55,132 @@ public class SimpleTestDriver {
@BeforeClass
public static void setUpBeforeClass() throws Exception {
- loginUrl = System.getProperty("test.server.login.url");
- host = System.getProperty("test.server.host");
- port = System.getProperty("test.server.port");
- username = System.getProperty("test.server.username");
- usernameId = System.getProperty("test.server.username.id");
- password = System.getProperty("test.server.password");
- passwordId = System.getProperty("test.server.password.id");
- browser = System.getProperty("test.browser");
- testContextBase = System.getProperty("test.context.base");
- StringBuilder sb = new StringBuilder();
- sb.append("http://");
- sb.append(host);
- if (port != null && !port.isEmpty()) {
- sb.append(":");
- sb.append(port);
- }
- sb.append("/");
- sb.append(testContextBase);
- baseUrl = sb.toString();
- String str = System.getProperty("test.url.strategy");
- useGeneratedUrl = str.equalsIgnoreCase("generateURLs");
- str = System.getProperty("test.debug");
- debug = str.equalsIgnoreCase("true");
- str = System.getProperty("test.timeout");
- dryrun = new Boolean(System.getProperty("test.dryrun"));
- timeout = ((str != null) && str.matches("\\d+")) ? Integer.parseInt(str) : 3;
- String wd = System.getProperty("test.browser.webDriver");
- String binary = System.getProperty("test.browser.binary");
- String headlessProperty = System.getProperty("test.browser.headless");
- boolean headless = (((headlessProperty == null) || (headlessProperty.length() == 0) ||
- Boolean.valueOf(headlessProperty)));
- String maximizedProperty = System.getProperty("test.browser.maximized");
- boolean maximized = "true".equalsIgnoreCase(maximizedProperty);
-
- System.out.println("before class.");
- System.out.println(" Debug =" + debug);
- System.out.println(" Dryrun =" + dryrun);
- System.out.println(" Timeout =" + timeout);
- System.out.println(" Login URL =" + loginUrl);
- System.out.println(" Host =" + host);
- System.out.println(" Port =" + port);
- System.out.println(" Context =" + testContextBase);
- System.out.println(" Generate URL =" + useGeneratedUrl);
- System.out.println(" Username =" + username);
- System.out.println(" UsernameId =" + usernameId);
- System.out.println(" Password =" + password);
- System.out.println(" PasswordId =" + passwordId);
- System.out.println(" Browser =" + browser);
- System.out.println(" Driver =" + wd);
- System.out.println(" binary =" + binary);
- System.out.println(" headless =" + headless);
- System.out.println(" maximized =" + maximized);
-
- if (browser.equalsIgnoreCase("firefox")) {
-
- System.setProperty("webdriver.gecko.driver", wd);
- FirefoxOptions options = new FirefoxOptions();
- options.setLegacy(true);
- options.setAcceptInsecureCerts(true);
-
- if ((binary != null) && (binary.length() != 0)) {
- options.setBinary(binary);
- }
-
- if (headless) {
- options.setHeadless(true);
- }
-
- driver = new FirefoxDriver(options);
-
- } else if (browser.equalsIgnoreCase("internetExplorer")) {
- System.setProperty("webdriver.ie.driver", wd);
- driver = new InternetExplorerDriver();
- } else if (browser.equalsIgnoreCase("chrome")) {
-
- System.setProperty("webdriver.chrome.driver", wd);
- ChromeOptions options = new ChromeOptions();
-
- if ((binary != null) && (binary.length() > 0)) {
- options.setBinary(binary);
+ if (driver == null) {
+ loginUrl = System.getProperty("test.server.login.url");
+ host = System.getProperty("test.server.host");
+ port = System.getProperty("test.server.port");
+ username = System.getProperty("test.server.username");
+ usernameId = System.getProperty("test.server.username.id");
+ password = System.getProperty("test.server.password");
+ passwordId = System.getProperty("test.server.password.id");
+ browser = System.getProperty("test.browser");
+ testContextBase = System.getProperty("test.context.base");
+ StringBuilder sb = new StringBuilder();
+ sb.append("http://");
+ sb.append(host);
+ if (port != null && !port.isEmpty()) {
+ sb.append(":");
+ sb.append(port);
}
-
- if (headless) {
- options.addArguments("--headless");
+ sb.append("/");
+ sb.append(testContextBase);
+ baseUrl = sb.toString();
+ String str = System.getProperty("test.url.strategy");
+ useGeneratedUrl = str.equalsIgnoreCase("generateURLs");
+ str = System.getProperty("test.debug");
+ debug = str.equalsIgnoreCase("true");
+ str = System.getProperty("test.timeout");
+ dryrun = Boolean.valueOf(System.getProperty("test.dryrun"));
+ timeout = ((str != null) && str.matches("\\d+")) ? Integer.parseInt(str) : 3;
+ String wd = System.getProperty("test.browser.webDriver");
+ String binary = System.getProperty("test.browser.binary");
+ String headlessProperty = System.getProperty("test.browser.headless");
+ boolean headless = (((headlessProperty == null) || (headlessProperty.length() == 0) ||
+ Boolean.valueOf(headlessProperty)));
+ String maximizedProperty = System.getProperty("test.browser.maximized");
+ boolean maximized = Boolean.valueOf(maximizedProperty);
+
+ System.out.println("before class.");
+ System.out.println(" Debug =" + debug);
+ System.out.println(" Dryrun =" + dryrun);
+ System.out.println(" Timeout =" + timeout);
+ System.out.println(" Login URL =" + loginUrl);
+ System.out.println(" Host =" + host);
+ System.out.println(" Port =" + port);
+ System.out.println(" Context =" + testContextBase);
+ System.out.println(" Generate URL =" + useGeneratedUrl);
+ System.out.println(" Username =" + username);
+ System.out.println(" UsernameId =" + usernameId);
+ System.out.println(" Password =" + password);
+ System.out.println(" PasswordId =" + passwordId);
+ System.out.println(" Browser =" + browser);
+ System.out.println(" Driver =" + wd);
+ System.out.println(" binary =" + binary);
+ System.out.println(" headless =" + headless);
+ System.out.println(" maximized =" + maximized);
+
+ if (browser.equalsIgnoreCase("firefox")) {
+
+ System.setProperty("webdriver.gecko.driver", wd);
+ FirefoxOptions options = new FirefoxOptions();
+ options.setLegacy(true);
+ options.setAcceptInsecureCerts(true);
+
+ if ((binary != null) && (binary.length() != 0)) {
+ options.setBinary(binary);
+ }
+
+ if (headless) {
+ options.setHeadless(true);
+ }
+
+ driver = new FirefoxDriver(options);
+
+ } else if (browser.equalsIgnoreCase("internetExplorer")) {
+ System.setProperty("webdriver.ie.driver", wd);
+ driver = new InternetExplorerDriver();
+ } else if (browser.equalsIgnoreCase("chrome")) {
+
+ System.setProperty("webdriver.chrome.driver", wd);
+ ChromeOptions options = new ChromeOptions();
+
+ if ((binary != null) && (binary.length() > 0)) {
+ options.setBinary(binary);
+ }
+
+ if (headless) {
+ options.addArguments("--headless");
+ }
+
+ options.addArguments("--disable-infobars");
+ options.setAcceptInsecureCerts(true);
+
+ if (maximized) {
+ // The webDriver.manage().window().maximize() feature does not work correctly in headless mode, so set the
+ // window size to 1920x1200 (resolution of a 15.4 inch screen).
+ options.addArguments("--window-size=1920,1200");
+ }
+
+ driver = new ChromeDriver(options);
+
+ } else if (browser.equalsIgnoreCase("phantomjs")) {
+ DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
+ capabilities.setJavascriptEnabled(true);
+ capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary);
+ driver = new PhantomJSDriver(capabilities);
+ } else if (browser.equalsIgnoreCase("htmlUnit")) {
+ driver = new HtmlUnitDriver();
+ } else if (browser.equalsIgnoreCase("safari")) {
+ driver = new SafariDriver();
+ } else {
+ throw new Exception("Unsupported browser: " + browser);
}
- options.addArguments("--disable-infobars");
- options.setAcceptInsecureCerts(true);
+ Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
+ @Override
+ public void run() {
+ driver.quit();
+ }
+ }));
if (maximized) {
- // The webDriver.manage().window().maximize() feature does not work correctly in headless mode, so set the
- // window size to 1920x1200 (resolution of a 15.4 inch screen).
- options.addArguments("--window-size=1920,1200");
+ driver.manage().window().maximize();
}
- driver = new ChromeDriver(options);
-
- } else if (browser.equalsIgnoreCase("phantomjs")) {
- DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
- capabilities.setJavascriptEnabled(true);
- capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary);
- driver = new PhantomJSDriver(capabilities);
- } else if (browser.equalsIgnoreCase("htmlUnit")) {
- driver = new HtmlUnitDriver();
- } else if (browser.equalsIgnoreCase("safari")) {
- driver = new SafariDriver();
- } else {
- throw new Exception("Unsupported browser: " + browser);
- }
-
- if (maximized) {
- driver.manage().window().maximize();
- }
-
- if (!dryrun) {
- login();
+ if (!dryrun) {
+ login();
+ }
}
-
}
/**
@@ -207,9 +215,6 @@ public class SimpleTestDriver {
*/
@AfterClass
public static void tearDownAfterClass() throws Exception {
- if (driver != null) {
- driver.quit();
- }
System.out.println(" after class.");
}
[22/22] portals-pluto git commit: PLUTO-733 Add Header Phase Portlet
Demo test
Posted by as...@apache.org.
PLUTO-733 Add Header Phase Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/89672e7e
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/89672e7e
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/89672e7e
Branch: refs/heads/master
Commit: 89672e7e4fbaeaecbb24296693254133747c9cf0
Parents: 6028492
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 12 17:25:00 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
demo-integration-tests/pom.xml | 7 +++
.../integration/test/HeaderPhaseDemoIT.java | 62 ++++++++++++++++++++
2 files changed, 69 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/89672e7e/demo-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/demo-integration-tests/pom.xml b/demo-integration-tests/pom.xml
index 49f942c..65ab75d 100644
--- a/demo-integration-tests/pom.xml
+++ b/demo-integration-tests/pom.xml
@@ -47,6 +47,8 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <test.portal.name>Pluto</test.portal.name>
+
<!-- test.context.base context string used when addressing test pages. Used by module stylesheet -->
<test.context.base>pluto/portal/</test.context.base>
<test.dependency.portlet.default.jquery.version>1.12.3</test.dependency.portlet.default.jquery.version>
@@ -241,6 +243,7 @@
<profile>
<id>liferay</id>
<properties>
+ <test.portal.name>Liferay</test.portal.name>
<test.server.login.url>http://${test.server.host}:${test.server.port}/group/pluto-demos</test.server.login.url>
</properties>
</profile>
@@ -264,6 +267,10 @@
<trimStackTrace>false</trimStackTrace>
<systemProperties>
<property>
+ <name>test.portal.name</name>
+ <value>${test.portal.name}</value>
+ </property>
+ <property>
<name>test.server.login.url</name>
<value>${test.server.login.url}</value>
</property>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/89672e7e/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/HeaderPhaseDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/HeaderPhaseDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/HeaderPhaseDemoIT.java
new file mode 100644
index 0000000..7b56f83
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/HeaderPhaseDemoIT.java
@@ -0,0 +1,62 @@
+/* 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.nio.charset.StandardCharsets;
+import org.junit.Test;
+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 HeaderPhaseDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testHeaderPhaseDemo() {
+ navigateToPage("V2 and V3 Header Tests");
+ By characterEncodingByXpath = By.xpath("//p[contains(text(),'Character encoding:')]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(characterEncodingByXpath),
+ textToBePresentInElementLocated(characterEncodingByXpath, StandardCharsets.UTF_8.toString())));
+
+ By contentTypeByXpath = By.xpath("//p[contains(text(),'Content type:')]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(contentTypeByXpath),
+ textToBePresentInElementLocated(contentTypeByXpath, "text/html")));
+
+ By cookieDivByXpath = By.xpath(getXpath("div", "cookieDiv"));
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(cookieDivByXpath),
+ textToBePresentInElementLocated(cookieDivByXpath, "V3HeaderPortlet=something-special"),
+ textToBePresentInElementLocated(cookieDivByXpath, "Author=Scott")));
+
+ String propertyNameXpath = "//li[contains(text(),'Property')][contains(text(),'name:')]";
+ By portletPropertyByXpath = By.xpath(propertyNameXpath + "[contains(text(),'Portlet')]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(portletPropertyByXpath),
+ textToBePresentInElementLocated(portletPropertyByXpath, "V3HeaderPortlet"),
+ textToBePresentInElementLocated(portletPropertyByXpath, "[V3HeaderPortlet]")));
+
+ By portalPropertyByXpath = By.xpath(propertyNameXpath + "[contains(text(),'Portal')]");
+ String portalName = System.getProperty("test.portal.name");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(portalPropertyByXpath),
+ textToBePresentInElementLocated(portalPropertyByXpath, portalName),
+ textToBePresentInElementLocated(portalPropertyByXpath, "[" + portalName)));
+ }
+}
[08/22] portals-pluto git commit: PLUTO-733 Add Path Info Demo test
Posted by as...@apache.org.
PLUTO-733 Add Path Info Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/fb03f2f5
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/fb03f2f5
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/fb03f2f5
Branch: refs/heads/master
Commit: fb03f2f59a5070be2a162ae9b3d3bc9e1e277d06
Parents: 3dcd223
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 14:51:53 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../org/apache/portals/samples/PathDisplay.java | 8 ++-
.../apache/portals/samples/PathInfoPortlet.java | 5 +-
.../src/main/webapp/WEB-INF/jsp/pathinfo.jsp | 2 +-
.../demo/integration/test/PathInfoDemoIT.java | 61 ++++++++++++++++++++
4 files changed, 72 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/fb03f2f5/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
index a59dc35..d41dfa5 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathDisplay.java
@@ -58,6 +58,7 @@ public class PathDisplay {
private String method_path_xlated;
private String method_query_string;
+ private String title;
private String type;
private String caller;
private boolean isAsyncSupported = false;
@@ -68,7 +69,7 @@ public class PathDisplay {
public PathDisplay(HttpServletRequest req, String caller) {
this.caller = caller;
-
+ title = (String) req.getAttribute("title");
async_request_uri = (String) req.getAttribute("javax.servlet.async.request_uri");
async_context_path = (String) req.getAttribute("javax.servlet.async.context_path");
async_servlet_path = (String) req.getAttribute("javax.servlet.async.servlet_path");
@@ -105,7 +106,7 @@ public class PathDisplay {
public PathDisplay(PortletRequest req, String caller) {
this.caller = caller;
-
+ title = (String) req.getAttribute("title");
async_request_uri = (String) req.getAttribute("javax.servlet.async.request_uri");
async_context_path = (String) req.getAttribute("javax.servlet.async.context_path");
async_servlet_path = (String) req.getAttribute("javax.servlet.async.servlet_path");
@@ -155,6 +156,9 @@ public class PathDisplay {
public String toMarkup() {
StringBuilder txt = new StringBuilder(128);
+ if (title != null) {
+ txt.append("<p id=\"path_info_title\">").append(title).append("</p>");
+ }
txt.append("<hr>");
txt.append("<h5>").append(caller).append(" Path Info:</h5>");
txt.append("<table border='0' cellpadding='0'><tr>");
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/fb03f2f5/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
index e28c371..cca2eee 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/PathInfoPortlet.java
@@ -129,13 +129,14 @@ public class PathInfoPortlet {
if (op.equals("fwd")) {
RenderLink renlink = new RenderLink("back", cntlurl);
req.setAttribute("renderLink", renlink);
+ req.setAttribute("title", "Forwarded to Servlet by render method.");
PortletRequestDispatcher rd = pcfg.getPortletContext().getRequestDispatcher(SERVLET);
rd.forward(req, resp);
return;
} else if (op.equals("fwdjsp")) {
RenderLink renlink = new RenderLink("back", cntlurl);
req.setAttribute("renderLink", renlink);
- req.setAttribute("jsptitle", "Forwarded by render method.");
+ req.setAttribute("jsptitle", "Forwarded to JSP by render method.");
PortletRequestDispatcher rd = pcfg.getPortletContext().getRequestDispatcher(JSP);
rd.forward(req, resp);
return;
@@ -144,6 +145,7 @@ public class PathInfoPortlet {
writer.append("<div class='infobox'>");
if (op.equals("nested")) {
+ req.setAttribute("title", "Included nested in Portlet -> Servlet -> JSP.");
PathDisplay pd = new PathDisplay(req, "Render Method (Before)");
writer.write(pd.toMarkup());
PortletRequestDispatcher rd = pcfg.getPortletContext().getRequestDispatcher(SERVLET);
@@ -198,6 +200,7 @@ public class PathInfoPortlet {
writer.append("</script>\n");
} else if (op.equals("named")) {
writer.write("Including named servlet:");
+ req.setAttribute("title", "Included named Servlet.");
PortletRequestDispatcher rd = req.getPortletContext().getNamedDispatcher(NAME);
rd.include(req, resp);
} else {
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/fb03f2f5/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
index 4d1d4f3..c61fac3 100644
--- a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
+++ b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/jsp/pathinfo.jsp
@@ -25,7 +25,7 @@ limitations under the License.
<portlet:defineObjects />
<div class='bluebox'>
-<p>${jsptitle}</p>
+<p id="path_info_title">${jsptitle}</p>
<%
RenderLink rl = (RenderLink) request.getAttribute("renderLink");
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/fb03f2f5/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
new file mode 100644
index 0000000..146ecda
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
+ *
+ * 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.portals.pluto.demo.integration.test;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class PathInfoDemoIT extends DemoTestDriver{
+
+ private static final List<String> EXPECTED_TITLES = unmodifiableList(
+ "Included by resource method.",
+ "Forwarded to Servlet by render method.",
+ "Forwarded to JSP by render method.",
+ "Included by render method.",
+ "Included nested in Portlet -> Servlet -> JSP.",
+ "Included named Servlet.");
+
+ @Test
+ public void testPathInfoDemo() {
+ navigateToPage("Async Tests");
+ By linksByXpath = By.xpath("//h3[text()='Path Info Portlet']/parent::div[@class='body']//a");
+ waitingAsserter.waitFor(visibilityOfElementLocated(linksByXpath));
+ List<WebElement> links = driver.findElements(linksByXpath);
+ List<String> urls = new ArrayList<>();
+
+ for (WebElement link : links) {
+ urls.add(link.getAttribute("href"));
+ }
+
+ for (int i = 0; i < urls.size(); i++) {
+ driver.get(urls.get(i));
+ By titleByXpath = By.xpath("//p[contains(@id,'path_info_title')]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(titleByXpath),
+ textToBe(titleByXpath, EXPECTED_TITLES.get(i))));
+ }
+ }
+}
[12/22] portals-pluto git commit: PLUTO-733 Add Chat Room Demo test
Posted by as...@apache.org.
PLUTO-733 Add Chat Room Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/cdd72b33
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/cdd72b33
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/cdd72b33
Branch: refs/heads/master
Commit: cdd72b33a8b8aa4f26193b67a87ff204ca9f9a21
Parents: 3090b95
Author: Kyle Stiemann <st...@gmail.com>
Authored: Wed Oct 10 17:06:44 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/ChatRoomDemoIT.java | 110 +++++++++++++++++++
1 file changed, 110 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/cdd72b33/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
new file mode 100644
index 0000000..e3f953c
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
@@ -0,0 +1,110 @@
+/* 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.io.UnsupportedEncodingException;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class ChatRoomDemoIT extends DemoTestDriver {
+ private static final String CHAT_ROOM_PORTLET_NAMESPACE = "Pluto_chatRoomDemo_BeanPortletDemo";
+
+ @Test
+ public void testChatRoomDemos() throws UnsupportedEncodingException {
+ String chatDemoURL = baseUrl + Util.encodeURL("Chat Room Demo");
+ driver.get(chatDemoURL);
+
+ // 1. Clear any previous chat history.
+ clickElement(driver, waitingAsserter, "input", CHAT_ROOM_PORTLET_NAMESPACE, "clear");
+
+ String chatHistoryXpath = "(" + getXpath("div", CHAT_ROOM_PORTLET_NAMESPACE, "chatHistory") + ")[1]";
+ waitingAsserter.assertTrue(textEmpty(By.xpath(chatHistoryXpath)));
+
+ // 2. Open a new window/tab to the same page.
+ String originalWindowHandle = driver.getWindowHandle();
+ ((JavascriptExecutor)driver).executeScript("window.open('" + chatDemoURL + "');");
+
+ // 3. In the current window/tab, add a user named "me".
+ // 4. Verify that an image appears for the user.
+ // 5. Send the message "Hello you!".
+ // 6. Verify that the message appears.
+ // 7. Switch to the next window/tab.
+ // 8. Verify that the message from "me" saying "Hello you!" appears.
+ // 9. Add a user named "you".
+ // 10. Verify that an image appears for the user.
+ // 11. Send the message "Hello me!".
+ // 12. Verify that the message appears.
+ By chatHistoryMessageByXpath = By.xpath(chatHistoryXpath + "/p[text()][position() = last()]");
+ String name = null;
+ String message = null;
+
+ for (String windowHandle : driver.getWindowHandles()) {
+
+ // See #7
+ driver.switchTo().window(windowHandle);
+
+ String originalName = "me";
+ name = originalName;
+ String originalMessage = "Hello you!";
+ message = originalMessage;
+
+ // See #8.
+ if (!originalWindowHandle.equals(windowHandle)) {
+
+ name = "you";
+ message = "Hello me!";
+ assertMessageVisible(chatHistoryMessageByXpath, originalName, originalMessage);
+ }
+
+ // See #3 and #9.
+ String formXpath = getXpath("form", CHAT_ROOM_PORTLET_NAMESPACE, "setParams");
+ sendKeysToElement(driver, waitingAsserter, "(" + formXpath + "//input[@name='name'])[1]", name);
+ clickElement(driver, waitingAsserter, "(" + formXpath + "//input[@value='send'][@type='submit'])[1]");
+
+ // See #4 and #10.
+ waitingAsserter.assertTrue(elementToBeClickable(By.xpath(
+ getXpath("div", CHAT_ROOM_PORTLET_NAMESPACE, "image") + "/img")));
+
+ // See #5 and #11.
+ String messageInputXpath = "(" + getXpath("input", CHAT_ROOM_PORTLET_NAMESPACE, "msg") + ")[1]";
+ sendKeysToElement(driver, waitingAsserter, messageInputXpath, message);
+ clickElement(driver, waitingAsserter, "input", CHAT_ROOM_PORTLET_NAMESPACE, "send");
+
+ // See #6 and #12.
+ assertMessageVisible(chatHistoryMessageByXpath, name, message);
+ }
+
+ // 13. Switch back to the original window/tab and verify that the message from "Hello me!" message appears
+ // there.
+ driver.switchTo().window(originalWindowHandle);
+ assertMessageVisible(chatHistoryMessageByXpath, name, message);
+ }
+
+ private void assertMessageVisible(By locator, String name, String message) {
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(locator),
+ textToBePresentInElementLocated(locator, name + ": " + message)));
+ }
+}
[06/22] portals-pluto git commit: PLUTO-733 Add Multipart Form
Portlet Demo test
Posted by as...@apache.org.
PLUTO-733 Add Multipart Form Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/f821c165
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/f821c165
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/f821c165
Branch: refs/heads/master
Commit: f821c1659ba891211103b69a837957e1520c6cd3
Parents: 429e011
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 13:04:46 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/ChatRoomDemoIT.java | 2 +-
.../demo/integration/test/DemoTestDriver.java | 4 ++
.../demo/integration/test/DependencyDemoIT.java | 2 +-
.../integration/test/MultipartFormDemoIT.java | 73 ++++++++++++++++++++
.../demo/integration/test/PortletHubDemoIT.java | 2 +-
.../pluto/demo/integration/test/Util.java | 15 +++-
6 files changed, 93 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
index e3f953c..a2c1d51 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
@@ -45,7 +45,7 @@ public class ChatRoomDemoIT extends DemoTestDriver {
// 2. Open a new window/tab to the same page.
String originalWindowHandle = driver.getWindowHandle();
- ((JavascriptExecutor)driver).executeScript("window.open('" + chatDemoURL + "');");
+ executeScript(driver, "window.open('" + chatDemoURL + "');");
// 3. In the current window/tab, add a user named "me".
// 4. Verify that an image appears for the user.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
index 6ccd254..3f272a1 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
@@ -35,4 +35,8 @@ public class DemoTestDriver extends SimpleTestDriver {
waitingAsserter = new WaitingAsserter(driver, timeout);
}
}
+
+ protected void navigateToPage(String pageName) {
+ driver.get(baseUrl + Util.encodeURL(pageName));
+ }
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
index ac749f5..efa7d43 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
@@ -32,7 +32,7 @@ public class DependencyDemoIT extends DemoTestDriver{
@Test
public void testDependencyDemo() {
- driver.get(baseUrl + "Dependencies");
+ navigateToPage("Dependencies");
assertBadDependencyStringThrewException("String: Hi there!",
"Exception: java.lang.IllegalArgumentException:");
assertBadDependencyStringThrewException("String: <script dffsfssf",
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/MultipartFormDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/MultipartFormDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/MultipartFormDemoIT.java
new file mode 100644
index 0000000..1782d1a
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/MultipartFormDemoIT.java
@@ -0,0 +1,73 @@
+/* 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.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Locale;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class MultipartFormDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testMultipartFormDemo() throws IOException {
+ navigateToPage("File Upload");
+ By colorPickerByXpath = By.xpath("//input[@type='color']");
+ waitingAsserter.waitFor(and(visibilityOfElementLocated(colorPickerByXpath),
+ new ElementEnabled(colorPickerByXpath)));
+
+ String color = "#FFFFFF";
+ WebElement colorPicker = driver.findElement(colorPickerByXpath);
+ executeScript(driver, "arguments[0].value = '" + color + "'", colorPicker);
+
+ String fileNamePrefix = "pluto-test-";
+ Path tempFilePath = Files.createTempFile(fileNamePrefix, ".txt");
+ File tempFile = tempFilePath.toFile();
+ tempFile.deleteOnExit();
+
+ String text = "Test text.";
+ try (PrintWriter out = new PrintWriter(tempFile)) {
+ out.println(text);
+ }
+
+ sendKeysToElement(driver, waitingAsserter, "//input[@type='file']", tempFilePath.toString());
+ clickElement(driver, waitingAsserter, "//input[@type='submit'][@value='submit']");
+
+ By fileInfoByXpath = By.xpath("//h5[text()='Info:']/..");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(fileInfoByXpath),
+ textToBePresentInElementLocated(fileInfoByXpath, "Color: " + color.toLowerCase(Locale.ENGLISH)),
+ textToBePresentInElementLocated(fileInfoByXpath, "Uploaded file name: " + fileNamePrefix),
+ textToBePresentInElementLocated(fileInfoByXpath, "content-type=[text/plain]")));
+
+ By fileContentsByXpath = By.xpath("//h5[text()='File contents:']/..");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(fileContentsByXpath),
+ textToBePresentInElementLocated(fileContentsByXpath, text)));
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
index 1d1119c..45155bc 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
@@ -51,7 +51,7 @@ public class PortletHubDemoIT extends DemoTestDriver {
@Test
public void testPortletHubDemo() throws UnsupportedEncodingException {
- driver.get(baseUrl + Util.encodeURL("V3.0 Portlet Hub Demo"));
+ navigateToPage("V3.0 Portlet Hub Demo");
// Verify that all the different images appear when clicking each radio button.
By imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, "FullMoon"));
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/f821c165/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
index f569f0b..ac14997 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
@@ -24,6 +24,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.openqa.selenium.By;
+import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
@@ -39,8 +40,18 @@ public final class Util {
throw new AssertionError();
}
- public static String encodeURL(String url) throws UnsupportedEncodingException {
- return URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
+ public static String encodeURL(String url) {
+
+ try {
+ return URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ public static Object executeScript(WebDriver webDriver, String script, Object... arguments) {
+ return ((JavascriptExecutor)webDriver).executeScript(script, arguments);
}
public static <T> List<T> unmodifiableList(T... items) {
[10/22] portals-pluto git commit: PLUTO-733 Add Async Portlet Demo
test
Posted by as...@apache.org.
PLUTO-733 Add Async Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/0ff3f226
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/0ff3f226
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/0ff3f226
Branch: refs/heads/master
Commit: 0ff3f226a2d0ea5780612cbc25f51536bd8ba70a
Parents: 970a9fa
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 18:54:12 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/AsyncDemoIT.java | 123 +++++++++++++++++++
.../integration/test/BeanPortletDemoIT.java | 24 ++--
.../demo/integration/test/DependencyDemoIT.java | 24 ++--
.../demo/integration/test/PathInfoDemoIT.java | 24 ++--
4 files changed, 162 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/0ff3f226/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/AsyncDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/AsyncDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/AsyncDemoIT.java
new file mode 100644
index 0000000..0e1a822
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/AsyncDemoIT.java
@@ -0,0 +1,123 @@
+/* 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.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class AsyncDemoIT extends DemoTestDriver {
+ private static final String REQUEST_RECIEVED_XPATH =
+ "(//p[" +
+ "contains(text(),'DispatcherType: ASYNC') or " +
+ "contains(text(),'Dispatch type: ASYNC') or " +
+ "contains(text(),'Dispatcher outputType: FORWARD') or " +
+ "contains(text(),'Dispatch type: FORWARD')" +
+ "][contains(.,'Request #:')])";
+ private static final String MESSAGE_XPATH_TEMPLATE =
+ "//div[contains(@class,'{0}')][contains(.,'Request number:')][contains(.,'DispatcherType: {1}')]";
+
+ @Test
+ public void testAsyncDemo() {
+ navigateToPage("Async Tests");
+ waitingAsserter.waitFor(visibilityOfElementLocated(By.xpath(REQUEST_RECIEVED_XPATH)));
+
+ for (Boolean recursive : unmodifiableList(Boolean.FALSE, Boolean.TRUE)) {
+ sendKeysToElement(driver, waitingAsserter, getXpath("input", "AsyncPortlet", "delay"), "1");
+
+ int reps = 1;
+
+ if (recursive) {
+ clickElement(driver, waitingAsserter, "//input[@name='auto'][@type='checkbox']");
+ sendKeysToElement(driver, waitingAsserter, getXpath("input", "AsyncPortlet", "reps"),
+ Integer.toString(reps));
+ }
+
+ List<WebElement> timeoutRadioButtons = driver.findElements(By.xpath("//input[@name='toType']"));
+
+ for (int i = 0; i < timeoutRadioButtons.size(); i++) {
+
+ timeoutRadioButtons = driver.findElements(By.xpath("//input[@name='toType']"));
+ timeoutRadioButtons.get(i).click();
+
+ List<WebElement> typeRadioButtons = driver.findElements(By.xpath("//input[@name='type']"));
+
+ for (int j = 0; j < typeRadioButtons.size(); j++) {
+
+ typeRadioButtons = driver.findElements(By.xpath("//input[@name='type']"));
+ typeRadioButtons.get(j).click();
+
+ String showFilterCheckboxByXpath = "//input[@name='filter'][@type='checkbox']";
+ waitingAsserter.waitFor(visibilityOfElementLocated(By.xpath(showFilterCheckboxByXpath)));
+ WebElement showFilterCheckbox =
+ driver.findElement(By.xpath(showFilterCheckboxByXpath));
+
+ if (!isChecked(showFilterCheckboxByXpath)) {
+ showFilterCheckbox.click();
+ }
+
+ String showListenerCheckboxXpath = "//input[@name='listener'][@type='checkbox']";
+
+ if (!isChecked(showListenerCheckboxXpath)) {
+ clickElement(driver, waitingAsserter, showListenerCheckboxXpath);
+ }
+
+ clickElement(driver, waitingAsserter, getXpath("input", "AsyncPortlet", "send") +
+ "[@value='execute']");
+
+ for (int r = 1; r <= reps; r++) {
+
+ if (isChecked(showFilterCheckboxByXpath)) {
+ assertMessageVisisble("msgbox", "REQUEST", "[contains(text(),'Filter:')]");
+
+ if (!recursive) {
+ assertMessageVisisble("msgbox", "ASYNC", "[contains(text(),'Filter:')]");
+ }
+ }
+
+ if (isChecked(showListenerCheckboxXpath) && !recursive) {
+ assertMessageVisisble("orangebox", "ASYNC", "[contains(.,'Listener: restarting async.')]");
+ }
+
+ waitingAsserter.waitFor(visibilityOfElementLocated(By.xpath(REQUEST_RECIEVED_XPATH +
+ "[" + r + "]")));
+ }
+ }
+ }
+ }
+ }
+
+ private void assertMessageVisisble(String styleClass, String request, String xpathSuffix) {
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(MESSAGE_XPATH_TEMPLATE
+ .replace("{0}", styleClass).replace("{1}", request) + xpathSuffix)));
+ }
+
+ private boolean isChecked(String xpath) {
+ WebElement checkbox = driver.findElement(By.xpath(xpath));
+ return checkbox.isSelected();
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/0ff3f226/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
index e7842dd..895587d 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
@@ -1,17 +1,19 @@
-/**
- * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
- *
- * 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
+/* 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.
+ * 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;
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/0ff3f226/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
index efa7d43..01ba4c2 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
@@ -1,17 +1,19 @@
-/**
- * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
- *
- * 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
+/* 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.
+ * 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;
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/0ff3f226/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
index 2edc9ad..b9cc3d7 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
@@ -1,17 +1,19 @@
-/**
- * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
- *
- * 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
+/* 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.
+ * 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;
[15/22] portals-pluto git commit: PLUTO-733 Add Status Code Portlet
Demo test
Posted by as...@apache.org.
PLUTO-733 Add Status Code Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/9341939d
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/9341939d
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/9341939d
Branch: refs/heads/master
Commit: 9341939ddc5e3f89080872802b1994072a640631
Parents: eb1a84d
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 12 16:10:38 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../src/main/webapp/WEB-INF/jsp/view-ascp.jsp | 2 +-
.../src/main/webapp/WEB-INF/jsp/view-long.jsp | 2 +-
.../test/FragmentIdentifierDemoIT.java | 3 +-
.../demo/integration/test/StatusCodeDemoIT.java | 47 ++++++++++++++++++++
4 files changed, 51 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/9341939d/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ascp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ascp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ascp.jsp
index 7136009..1f4b559 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ascp.jsp
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-ascp.jsp
@@ -40,7 +40,7 @@ limitations under the License.
</td><td <%=colStyle %>>
<input name='<%=PARAM_STATUSCODE%>' type='text' value='' size='10' maxlength='10'>
</td><td <%=colStyle %>>
- <INPUT VALUE='send' TYPE='submit'>
+ <INPUT ID='<portlet:namespace />-send' VALUE='send' TYPE='submit'>
</td></tr></table>
</FORM>
<p><hr/></p>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/9341939d/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-long.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-long.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-long.jsp
index e12f0b2..99b68ea 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-long.jsp
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-long.jsp
@@ -43,7 +43,7 @@ limitations under the License.
</td><td>
<input name='<%=PARAM_LINE%>' type='text' value='' size='10' maxlength='10'>
</td></tr><tr><td>
- <INPUT VALUE='send' TYPE='submit'>
+ <INPUT ID='<portlet:namespace />-send' VALUE='send' TYPE='submit'>
</td></tr></table>
</FORM>
<%
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/9341939d/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
index a319e1c..8aa5747 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
@@ -39,7 +39,8 @@ public class FragmentIdentifierDemoIT extends DemoTestDriver {
String fragmentId = "fragmentId";
sendKeysToElement(driver, waitingAsserter, "//input[@name='frag'][@type='text']", fragmentId);
sendKeysToElement(driver, waitingAsserter, "//input[@name='line'][@type='text']", "3");
- clickElement(driver, waitingAsserter, "//input[@value='send'][@type='submit']");
+ clickElement(driver, waitingAsserter,
+ "//input[contains(@id,'Pluto_PortletV3Demo_LongPortlet')][@value='send'][@type='submit']");
clickElement(driver, waitingAsserter, "//a[text()='Jump to line 3']");
waitingAsserter.assertTrue(new ExpectedCondition<Boolean>() {
@Override
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/9341939d/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
new file mode 100644
index 0000000..3efaa0e
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
@@ -0,0 +1,47 @@
+/* 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 org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class StatusCodeDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testStatusCodeDemo() {
+ for (String statusCode : unmodifiableList("404", "200", "500")) {
+ navigateToPage("V3.0 Misc Tests - HTTP SC, fragment id");
+ sendKeysToElement(driver, waitingAsserter, "//input[@name='statusCode'][@type='text']", statusCode);
+ clickElement(driver, waitingAsserter,
+ "//input[contains(@id,'Pluto_PortletV3Demo_AuthSCPortlet')][@value='send'][@type='submit']");
+ clickElement(driver, waitingAsserter, "//a[text()='Resource URL, status code = " + statusCode + "']");
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(
+ "//p[contains(text(),'Status code: " + statusCode + "')]")));
+ }
+ }
+}
[20/22] portals-pluto git commit: PLUTO-733 Fix HTMLUnit version
Posted by as...@apache.org.
PLUTO-733 Fix HTMLUnit version
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/d836731b
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/d836731b
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/d836731b
Branch: refs/heads/master
Commit: d836731b1ad810974e2db758deda8595680f0b2a
Parents: 71d740a
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 19 22:12:00 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/d836731b/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a674f8d..f09f0d1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -506,7 +506,7 @@ TODO: Check if we need all of them. -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
- <version>2.21</version>
+ <version>2.31.0</version>
<scope>test</scope>
</dependency>
<dependency>
[09/22] portals-pluto git commit: PLUTO-733 Add Fragment Identifier
Portlet Demo test
Posted by as...@apache.org.
PLUTO-733 Add Fragment Identifier Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/eb1a84dd
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/eb1a84dd
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/eb1a84dd
Branch: refs/heads/master
Commit: eb1a84dd90669ea31cdb4670508ff3588da71a61
Parents: 0ff3f22
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 12 15:27:21 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../test/FragmentIdentifierDemoIT.java | 54 ++++++++++++++++++++
1 file changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/eb1a84dd/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
new file mode 100644
index 0000000..a319e1c
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
@@ -0,0 +1,54 @@
+/* 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 org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class FragmentIdentifierDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testFragmentIdentifierDemo() {
+ navigateToPage("V3.0 Misc Tests - HTTP SC, fragment id");
+
+ String fragmentId = "fragmentId";
+ sendKeysToElement(driver, waitingAsserter, "//input[@name='frag'][@type='text']", fragmentId);
+ sendKeysToElement(driver, waitingAsserter, "//input[@name='line'][@type='text']", "3");
+ clickElement(driver, waitingAsserter, "//input[@value='send'][@type='submit']");
+ clickElement(driver, waitingAsserter, "//a[text()='Jump to line 3']");
+ waitingAsserter.assertTrue(new ExpectedCondition<Boolean>() {
+ @Override
+ public Boolean apply(WebDriver webDriver) {
+ Long pageYOffset = (Long) executeScript(webDriver,
+ "return (document.documentElement.scrollTop || window.pageYOffset);");
+ return (pageYOffset > 0);
+ }
+ });
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.id(fragmentId)));
+ }
+}
[04/22] portals-pluto git commit: PLUTO-733 Add Bean Portlet Demo test
Posted by as...@apache.org.
PLUTO-733 Add Bean Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/970a9fa4
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/970a9fa4
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/970a9fa4
Branch: refs/heads/master
Commit: 970a9fa44bcbb4fe56b5590c5e19e2ff2cc32644
Parents: fb03f2f
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 15:27:13 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../portals/samples/HelloWorldRender.java | 7 ++-
.../integration/test/BeanPortletDemoIT.java | 51 ++++++++++++++++++++
.../demo/integration/test/PathInfoDemoIT.java | 2 +-
3 files changed, 58 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
index c9615f3..536a01d 100644
--- a/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
+++ b/PortletV3AnnotatedDemo/src/main/java/org/apache/portals/samples/HelloWorldRender.java
@@ -21,6 +21,7 @@ package org.apache.portals.samples;
import javax.inject.Inject;
import javax.portlet.RenderRequest;
+import javax.portlet.RenderResponse;
import javax.portlet.annotations.RenderMethod;
/**
@@ -53,6 +54,9 @@ public class HelloWorldRender {
@Inject
private RenderRequest req;
+
+ @Inject
+ private RenderResponse res;
/**
* Bean portlet render method for "BeanHelloWorld" portlet.
@@ -74,7 +78,8 @@ public class HelloWorldRender {
}
txt.append("!!</h3>\n");
- txt.append("<p><table cellspacing='2' cellpadding='0'><tr><td align='left'>\n");
+ txt.append("<p><table id=\"").append(res.getNamespace());
+ txt.append("_scope_info\" cellspacing='2' cellpadding='0'><tr><td align='left'>\n");
txt.append("Application Scoped number:</td><td>").append(apprn.getRandomNumber());
txt.append("</td></tr><tr><td>\n");
txt.append("Session scoped number:</td><td>").append(sessrn.getRandomNumber());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
new file mode 100644
index 0000000..e7842dd
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/BeanPortletDemoIT.java
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
+ *
+ * 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.portals.pluto.demo.integration.test;
+
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class BeanPortletDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testBeanPortletDemo() {
+ navigateToPage("Bean Portlet Demo");
+ By scopeInfoNumbersByXpath = By.xpath(getXpath("table", "BeanPortlet", "scope_info") + "//tr/td[2]");
+ waitingAsserter.waitFor(visibilityOfAllElementsLocatedBy(scopeInfoNumbersByXpath));
+ List<WebElement> scopeInfoNumbers = driver.findElements(scopeInfoNumbersByXpath);
+
+ for (WebElement scopeInfoNumber : scopeInfoNumbers) {
+ Assert.assertTrue(Integer.parseInt(scopeInfoNumber.getText().trim()) > 0);
+ }
+
+ sendKeysToElement(driver, waitingAsserter, "(//input[@name='name'][@type='text'])[1]", "user");
+ clickElement(driver, waitingAsserter, "(//input[@value='send'][@type='submit'])[1]");
+ waitingAsserter.assertTrue(and(
+ visibilityOfElementLocated(By.xpath("//h3[contains(text(),'Hello')][contains(text(),'user!!')]")),
+ visibilityOfElementLocated(By.xpath(getXpath("div", "BeanPortlet", "putResourceHere") + "/img"))));
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/970a9fa4/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
index 146ecda..2edc9ad 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PathInfoDemoIT.java
@@ -43,7 +43,7 @@ public class PathInfoDemoIT extends DemoTestDriver{
public void testPathInfoDemo() {
navigateToPage("Async Tests");
By linksByXpath = By.xpath("//h3[text()='Path Info Portlet']/parent::div[@class='body']//a");
- waitingAsserter.waitFor(visibilityOfElementLocated(linksByXpath));
+ waitingAsserter.waitFor(visibilityOfAllElementsLocatedBy(linksByXpath));
List<WebElement> links = driver.findElements(linksByXpath);
List<String> urls = new ArrayList<>();
[11/22] portals-pluto git commit: PLUTO-733 Add Dependency Portlet
Demo test
Posted by as...@apache.org.
PLUTO-733 Add Dependency Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/429e011b
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/429e011b
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/429e011b
Branch: refs/heads/master
Commit: 429e011b1dd946e55835f334e7d54005e8a3b33b
Parents: de7db48
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 11:37:31 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../java/basic/portlet/DependencyPortlet.java | 4 +-
.../webapp/WEB-INF/jsp/dependencyDialog.jsp | 2 +-
demo-integration-tests/pom.xml | 5 ++
.../demo/integration/test/DependencyDemoIT.java | 72 ++++++++++++++++++++
4 files changed, 80 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/429e011b/PortletV3Demo/src/main/java/basic/portlet/DependencyPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/DependencyPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/DependencyPortlet.java
index eee8ae3..f30ce4d 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/DependencyPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/DependencyPortlet.java
@@ -81,7 +81,7 @@ public class DependencyPortlet {
String vers = req.getRenderParameters().getValue(PARAM_VER);
if (vers == null) {
- resp.addDependency("jQuery", "com.jquery", "1.23.3");
+ resp.addDependency("jQuery", "com.jquery", PARAM_VER_1);
} else {
switch (vers) {
case PARAM_VER_2:
@@ -91,7 +91,7 @@ public class DependencyPortlet {
resp.addDependency("jQuery", "com.jquery", PARAM_VER_3, DEP_VER_3);
break;
default:
- resp.addDependency("jQuery", "com.jquery", "1.23.3");
+ resp.addDependency("jQuery", "com.jquery", PARAM_VER_1);
}
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/429e011b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/dependencyDialog.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/dependencyDialog.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/dependencyDialog.jsp
index 495ed8d..fc3d780 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/dependencyDialog.jsp
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/dependencyDialog.jsp
@@ -30,7 +30,7 @@ limitations under the License.
jQuery version:
</td><td>
- <input type='radio' name='<%=PARAM_VER%>' value='<%=PARAM_VER_1%>' ${version == "1.12.3" ? "checked" : "" } > <%=PARAM_VER_1%>
+ <input type='radio' name='<%=PARAM_VER%>' value='<%=PARAM_VER_1%>' ${version == "1.12.3" ? "checked" : "" } > default
</td><td>
<input type='radio' name='<%=PARAM_VER%>' value='<%=PARAM_VER_2%>' ${version == "2.2.3" ? "checked" : "" } > <%=PARAM_VER_2%>
</td><td>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/429e011b/demo-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/demo-integration-tests/pom.xml b/demo-integration-tests/pom.xml
index 9cee29a..49f942c 100644
--- a/demo-integration-tests/pom.xml
+++ b/demo-integration-tests/pom.xml
@@ -49,6 +49,7 @@
<!-- test.context.base context string used when addressing test pages. Used by module stylesheet -->
<test.context.base>pluto/portal/</test.context.base>
+ <test.dependency.portlet.default.jquery.version>1.12.3</test.dependency.portlet.default.jquery.version>
<!-- This variable is used by the test driver to determine how test
page links are to be found. Values: generateURLs the driver generates URLs
@@ -330,6 +331,10 @@
<name>test.timeout</name>
<value>${test.timeout}</value>
</property>
+ <property>
+ <name>test.dependency.portlet.default.jquery.version</name>
+ <value>${test.dependency.portlet.default.jquery.version}</value>
+ </property>
</systemProperties>
</configuration>
</execution>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/429e011b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
new file mode 100644
index 0000000..ac749f5
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2000-2018 Liferay, Inc. All rights reserved.
+ *
+ * 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.portals.pluto.demo.integration.test;
+
+import java.util.List;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class DependencyDemoIT extends DemoTestDriver{
+
+ @Test
+ public void testDependencyDemo() {
+ driver.get(baseUrl + "Dependencies");
+ assertBadDependencyStringThrewException("String: Hi there!",
+ "Exception: java.lang.IllegalArgumentException:");
+ assertBadDependencyStringThrewException("String: <script dffsfssf",
+ "Exception: java.lang.IllegalArgumentException:");
+ assertBadDependencyStringThrewException("String: <link href='hi'>bad string<link href='bye'>",
+ "Exception: java.lang.IllegalArgumentException:");
+ assertBadDependencyStringThrewException("String: <p>bad head tag</p>",
+ "Exception: java.lang.IllegalArgumentException:");
+ List<WebElement> versionRadioButtons = driver.findElements(By.xpath("//input[@name='version']"));
+
+ for (int i = 0; i < versionRadioButtons.size(); i++) {
+
+ String expectedVersion = versionRadioButtons.get(i).getAttribute("value");
+
+ if (i == 0) {
+ expectedVersion = System.getProperty("test.dependency.portlet.default.jquery.version");
+ }
+
+ versionRadioButtons.get(i).click();
+ clickElement(driver, waitingAsserter,
+ By.xpath("//button[contains(text(),'render with selected version')]"));
+ clickElement(driver, waitingAsserter, "button", "Pluto_PortletV3Demo_DependencyPortlet", "button");
+ By versionTextByXpath = By.xpath(getXpath("p", "Pluto_PortletV3Demo_DependencyPortlet", "fadeText") +
+ "[text()]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(versionTextByXpath),
+ textToBe(versionTextByXpath, "jQuery version: " + expectedVersion)));
+
+ versionRadioButtons = driver.findElements(By.xpath("//input[@name='version']"));
+ }
+ }
+
+ private void assertBadDependencyStringThrewException(String badDependencyString, String expectedExceptionString) {
+ By badDepencencyStringByXpath = By.xpath("//p[contains(text(),\"" + badDependencyString + "\")]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(badDepencencyStringByXpath),
+ textToBePresentInElementLocated(badDepencencyStringByXpath, expectedExceptionString)));
+ }
+}
[05/22] portals-pluto git commit: PLUTO-733 Format source
Posted by as...@apache.org.
PLUTO-733 Format source
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/3dcd223c
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/3dcd223c
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/3dcd223c
Branch: refs/heads/master
Commit: 3dcd223cc543fa0863df9885f51542b37919a775
Parents: f821c16
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 13:05:16 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
.../org/apache/portals/pluto/demo/integration/test/Util.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/3dcd223c/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
index ac14997..5199e09 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
@@ -137,9 +137,9 @@ public final class Util {
waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), new ElementEnabled(locator)));
- if (clearBeforeSendingKeys) {
- clearElement(webDriver, waitingAsserter, locator);
- }
+ if (clearBeforeSendingKeys) {
+ clearElement(webDriver, waitingAsserter, locator);
+ }
locator.findElement(webDriver).sendKeys(keys);
}
[02/22] portals-pluto git commit: PLUTO-733 Author Selenium-based
tests for the Pluto V3 demos (create test utilities and add test for the
Portlet Hub Demo)
Posted by as...@apache.org.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 00f37d8..a674f8d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,766 +1,792 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <parent>
- <groupId>org.apache.portals</groupId>
- <artifactId>portals-pom</artifactId>
- <version>1.4</version>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>pluto</artifactId>
- <packaging>pom</packaging>
- <name>Apache Pluto</name>
- <version>3.0.2-SNAPSHOT</version>
- <!-- Due to a bug in maven 2.0, the description must not contain any line breaks or tabs. -->
- <description>Apache Pluto is the Reference Implementation of the Java Portlet Specification.</description>
- <url>http://portals.apache.org/pluto</url>
-
- <issueManagement>
- <system>jira</system>
- <url>http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10560</url>
- </issueManagement>
- <inceptionYear>2003</inceptionYear>
-
-
- <!-- Mailing Lists ======================================================= -->
-
- <mailingLists>
- <mailingList>
- <name>Pluto User List</name>
- <subscribe>pluto-user-subscribe@portals.apache.org</subscribe>
- <unsubscribe>pluto-user-unsubscribe@portals.apache.org</unsubscribe>
- <post>pluto-user@portals.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-user</archive>
- </mailingList>
- <mailingList>
- <name>Pluto Developer List</name>
- <subscribe>pluto-dev-subscribe@portals.apache.org</subscribe>
- <unsubscribe>pluto-dev-unsubscribe@portals.apache.org</unsubscribe>
- <post>pluto-dev@portals.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-dev</archive>
- </mailingList>
- <mailingList>
- <name>Pluto SCM List</name>
- <subscribe>pluto-scm-subscribe@portals.apache.org</subscribe>
- <unsubscribe>pluto-scm-unsubscribe@portals.apache.org</unsubscribe>
- <post>pluto-scm@portals.apache.org</post>
- <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-scm</archive>
- </mailingList>
- </mailingLists>
-
-
- <!-- Pluto Committers ==================================================== -->
-
- <!-- Email format: [name]#a@T#[domain].d0t.[extension]
-'@' and '.' characters are added because m2 seems to need them to
-generate mailto links. -->
-
- <developers>
-
- <developer>
- <name>Michael Blum</name>
- <id>blumm</id>
- <email>blumm#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>Carsten Ziegeler</name>
- <id>cziegeler</id>
- <email>cziegeler#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>David DeWolf</name>
- <id>ddewolf</id>
- <email>ddewolf@apache.org</email>
- <timezone>-4</timezone>
- <url>http://www.daviddewolf.com</url>
- <organization>Three Pillar Software, Inc.</organization>
- <organizationUrl>http://www.threepillarsoftware.com</organizationUrl>
- <roles>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Scott Nicklous</name>
- <id>msnicklous</id>
- <email>msnicklous#a@T#apache.d0t.org</email>
- <timezone>+1</timezone>
- <organization>IBM Corporation</organization>
- <organizationUrl>http://www.ibm.com</organizationUrl>
- <roles>
- <role>Specification Lead, JSR 362 Portlet Specification 3.0</role>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Neil Griffin</name>
- <id>asfgriff</id>
- <email>neil.griffin#a@T#portletfaces.d0t.org</email>
- <timezone>+8</timezone>
- <organization>Liferay</organization>
- <organizationUrl>https://www.liferay.com/</organizationUrl>
- <roles>
- <role>Specification Architect, JSR 362 Portlet Specification 3.0</role>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Nick Lothian</name>
- <id>nlothian</id>
- <email>nlothian#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>Craig Doremus</name>
- <id>cdoremus</id>
- <email>cdoremus#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>Zhong Zheng</name>
- <id>zheng</id>
- <email>zheng#a@T#apache.d0t.org</email>
- <timezone>+1</timezone>
- <organization />
- <roles>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Santiago Gala</name>
- <id>sgala</id>
- <email>sgala#a@T#hisitech.d0t.com</email>
- <organization />
- </developer>
-
- <developer>
- <name>Raphael Luta</name>
- <id>raphael</id>
- <email>raphael#a@T#apache.d0t.org</email>
- <organization />
- </developer>
-
- <developer>
- <name>David S. Taylor</name>
- <id>taylor</id>
- <email>david#a@T#bluesunrise.d0t.com</email>
- <timezone>+8</timezone>
- <organization>Bluesunrise</organization>
- <organizationUrl>https://www.bluesunrise.com/</organizationUrl>
- <roles>
- <role>Expert Group Member, JSR 362 Portlet Specification 3.0</role>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>Scott T. Weaver</name>
- <id>weaver</id>
- <email>weaver#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>Stefan Hepper</name>
- <id>sthepper</id>
- <email>sthepper#a@T#apache.d0t.org</email>
- </developer>
-
- <developer>
- <name>Elliot Metsger</name>
- <id>esm</id>
- <email>esm#a@T#apache.d0t.org</email>
- <timezone>-4</timezone>
- <url>http://uppertank.net/blog</url>
- <organization>Johns Hopkins University, Sheridan Libraries</organization>
- <organizationUrl>http://www.library.jhu.edu</organizationUrl>
- </developer>
-
- <developer>
- <name>Ate Douma</name>
- <id>ate</id>
- <email>ate#aT#apache.d0t.org</email>
- <timezone>+2</timezone>
- <organization>Hippo</organization>
- <organizationUrl>http://www.onehippo.com</organizationUrl>
- <roles>
- <role>Java Developer</role>
- </roles>
- </developer>
-
- <developer>
- <name>David Jencks</name>
- <id>djencks</id>
- <email>djencks#aT#apache.d0t.org</email>
- <timezone>-7</timezone>
- </developer>
-
- </developers>
-
-
- <!-- Pluto Contributors ================================================== -->
-
- <contributors>
- <contributor>
- <name>Michael Westbay</name>
- <email>westbay#a@T#users.d0t.sourceforge.d0t.net</email>
- </contributor>
- <contributor>
- <name>Ken Weiner</name>
- <email>kweiner#a@T#unicon.d0t.net</email>
- </contributor>
- <contributor>
- <name>Ken Atherton</name>
- <email>katherto#a@T#visa.d0t.com</email>
- </contributor>
- <contributor>
- <name>David Hay</name>
- </contributor>
-
- <contributor>
-
- </contributor>
- </contributors>
-
- <scm>
- <connection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</connection>
- <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</developerConnection>
- <url>https://github.com/apache/portals-pluto</url>
- <tag>HEAD</tag>
- </scm>
-
- <!-- Dependency Version Properties ======================================= -->
-
- <!--
- NOTE:
-
- Modification of these properties affects:
- 1) pluto-maven-plugin/src/main/resources/versions.properties as well!
- -->
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-
- <pluto.container.name>Pluto</pluto.container.name>
- <javax.portlet.version.major>3</javax.portlet.version.major>
- <javax.portlet.version.minor>0</javax.portlet.version.minor>
- <portals.portlet-api.version>${project.version}</portals.portlet-api.version>
- <servlet-api.version>8.0.28</servlet-api.version>
- <jsp-api.version>8.0.28</jsp-api.version>
- <jstl.version>8.0.28</jstl.version>
- <el-api.version>8.0.28</el-api.version>
- <taglibs.standard.version>1.2.1</taglibs.standard.version>
- <jaxb.version>2.1</jaxb.version>
- <jaxb-impl.version>2.1.9</jaxb-impl.version>
- <stax.impl.version>1.2.0</stax.impl.version>
- <commons-digester.version>1.8</commons-digester.version>
- <commons-cli.version>1.0</commons-cli.version>
- <slf4j.version>1.7.5</slf4j.version>
- <springframework.version>2.0.2</springframework.version>
-<!-- <springframework.version>4.2.3.RELEASE</springframework.version> -->
- <maven.version>2.0.5</maven.version>
- <ant.version>1.6.5</ant.version>
- <commons-lang.version>3.4</commons-lang.version>
- <commons-io.version>2.4</commons-io.version>
- <ccpp-api.version>1.0</ccpp-api.version>
- <junit.version>4.12</junit.version>
- <jmock.version>1.2.0</jmock.version>
- <xmlunit.version>1.1</xmlunit.version>
- <cdi.version>2.3.1.Final</cdi.version>
- <annotation-detector.version>3.0.5</annotation-detector.version>
-
- <!-- The following properties are not directly used as maven
-dependencies, they're used by the maven pluto plugin for
-handling installation dependencies
-TODO: Check if we need all of them. -->
- <xerces.version>2.6.2</xerces.version>
- <xalan.version>2.7.0</xalan.version>
- <castor.version>1.1.1</castor.version>
- <commons-collections.version>3.2</commons-collections.version>
- <commons-httpclient.version>3.0</commons-httpclient.version>
- <commons-beanutils.version>1.7.0</commons-beanutils.version>
- <log4j.version>1.2.14</log4j.version>
- <activation.version>1.1</activation.version>
- <ccpp-ri.version>1.0</ccpp-ri.version>
- <rdffilter.version>1.0</rdffilter.version>
- <jena.version>1.4.0</jena.version>
-
- <!-- scope of certain dependencies is "compile" for deployment on tomcat,
- but "provided" for deployment on tomee. See tomee profile. -->
- <dependency.scope>compile</dependency.scope>
-
- <!-- following properties control whether or not demos are included in page
- config file (see profile 'excludeDemos' below) -->
- <includeDemosBegin />
- <includeDemosEnd />
- </properties>
-
- <dependencyManagement>
- <dependencies>
- <!-- Logging =========================================== -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jdk14</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jcl-over-slf4j</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>${slf4j.version}</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.17</version>
- </dependency>
-
- <!-- Specification Libraries =========================================== -->
- <dependency>
- <groupId>javax.portlet</groupId>
- <artifactId>portlet-api</artifactId>
- <version>${project.version}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-servlet-api</artifactId>
- <version>${servlet-api.version}</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- <version>${jaxb.version}</version>
- </dependency>
-
- <dependency>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- <version>${jaxb-impl.version}</version>
- </dependency>
- <dependency>
- <groupId>stax</groupId>
- <artifactId>stax</artifactId>
- <version>${stax.impl.version}</version>
- <exclusions>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- CDI Library -->
- <dependency>
- <groupId>javax.enterprise</groupId>
- <artifactId>cdi-api</artifactId>
- <version>1.2</version>
- </dependency>
- <dependency>
- <groupId>org.jboss.weld.servlet</groupId>
- <artifactId>weld-servlet</artifactId>
- <version>${cdi.version}</version>
- </dependency>
-
- <!-- For method annotation scanning ==================================== -->
- <dependency>
- <groupId>eu.infomas</groupId>
- <artifactId>annotation-detector</artifactId>
- <version>${annotation-detector.version}</version>
- </dependency>
-
- <!-- CCPP Libraries -->
- <dependency>
- <groupId>javax.ccpp</groupId>
- <artifactId>ccpp</artifactId>
- <version>${ccpp-api.version}</version>
- </dependency>
-
- <!-- Testing Libraries ================================================= -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>${junit.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jmock</groupId>
- <artifactId>jmock</artifactId>
- <version>${jmock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>jmock</groupId>
- <artifactId>jmock-cglib</artifactId>
- <version>${jmock.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <version>${xmlunit.version}</version>
- <scope>test</scope>
- </dependency>
- <!-- Misc ================================================= -->
- <dependency>
- <groupId>ant</groupId>
- <artifactId>ant</artifactId>
- <version>${ant.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-core</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-artifact</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-model</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-project</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.maven</groupId>
- <artifactId>maven-plugin-api</artifactId>
- <version>${maven.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-jsp-api</artifactId>
- <version>${jsp-api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>tomcat-el-api</artifactId>
- <version>${el-api.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.taglibs</groupId>
- <artifactId>taglibs-standard-spec</artifactId>
- <version>${taglibs.standard.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.taglibs</groupId>
- <artifactId>taglibs-standard-impl</artifactId>
- <version>${taglibs.standard.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.taglibs</groupId>
- <artifactId>taglibs-standard-jstlel</artifactId>
- <version>${taglibs.standard.version}</version>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- <version>${springframework.version}</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- <version>${springframework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- <version>${springframework.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>${commons-io.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.commons</groupId>
- <artifactId>commons-lang3</artifactId>
- <version>${commons-lang.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-digester</groupId>
- <artifactId>commons-digester</artifactId>
- <version>${commons-digester.version}</version>
- <exclusions>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
- <groupId>commons-cli</groupId>
- <artifactId>commons-cli</artifactId>
- <version>${commons-cli.version}</version>
- <exclusions>
- <exclusion>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </dependencyManagement>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.portals.pluto</groupId>
- <artifactId>pluto-maven-plugin</artifactId>
- <version>${project.version}</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-war-plugin</artifactId>
- <version>3.2.2</version>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <version>0.12</version>
- <configuration>
- <excludes>maven-archetypes/**/archetype-resources/**/*</excludes>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-antrun-plugin</artifactId>
- <version>1.7</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.1</version>
- <configuration>
- <source>1.7</source>
- <target>1.7</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <additionalparam>-Xdoclint:none -Xdoclint:-missing</additionalparam>
- <!-- link to Java EE APIs for cross-references -->
- <links>
- <link>http://docs.oracle.com/javaee/7/api/</link>
- </links>
- <docfilessubdirs>true</docfilessubdirs>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.2.0</version>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Implementation-Title>${project.name}</Implementation-Title>
- <Specification-Version>${project.version}</Specification-Version>
- <Implementation-Version>${project.version}</Implementation-Version>
- <Bundle-DocURL>${project.url}</Bundle-DocURL>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.scm</groupId>
- <artifactId>maven-scm-providers-git</artifactId>
- <!-- http://jira.codehaus.org/browse/SCM-444 -->
- <version>(,1.4]</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-release-plugin</artifactId>
- <configuration>
- <!-- During release (prepare) the org.apache.felix maven-bundle-plugin needs classpath access to just build dependent artifacts
- like the pluto-container-api to determine the needed OSGi imports.
- However, the default maven-release-plugin goals (clean verify) somehow don't provide those.
- To fix that, the default release plugin set of preparationGoals is changed to do an "install" instead of just "verify".
- -->
- <preparationGoals>clean install</preparationGoals>
- <mavenExecutorId>forked-path</mavenExecutorId>
- <autoVersionSubmodules>true</autoVersionSubmodules>
- <pushChanges>false</pushChanges>
- <localCheckout>true</localCheckout>
-
- <!-- by default, the release build includes the V3 demos. To perform the release build without the demos,
- activate the 'excludeDemos profile 'arguments' line as shown below. -->
- <!--
- <arguments>-Ppluto,excludeDemos</arguments>
- -->
- <arguments>-Ppluto</arguments>
- </configuration>
- </plugin>
-
- <!-- Javascript compressor plugin -->
- <plugin>
- <groupId>net.alchim31.maven</groupId>
- <artifactId>yuicompressor-maven-plugin</artifactId>
- <version>1.1</version>
- <executions>
- <execution>
- <id>compress-js</id>
- <goals>
- <goal>compress</goal>
- </goals>
- <configuration>
- <jswarn>false</jswarn>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </pluginManagement>
-
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- </plugin>
- </plugins>
- </build>
-
- <profiles>
- <profile>
- <id>all</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- <!-- profile must also be activated when building for tomee -->
- <property>
- <name>tomee</name>
- </property>
- </activation>
-
- <!-- Pluto Modules ======================================================= -->
- <modules>
- <!-- Portlet API module (spec -->
- <module>portlet-api</module>
-
- <!-- Pluto Container API -->
- <module>pluto-container-api</module>
-
- <!-- Pluto Core Modules -->
- <module>pluto-container</module>
- <module>pluto-taglib</module>
-
- <!-- Pluto Portal and Testsuite Modules -->
- <module>pluto-container-driver-api</module>
- <module>pluto-portal-driver</module>
- <module>pluto-portal-driver-impl</module>
- <module>pluto-portal</module>
- <module>pluto-testsuite</module>
-
- <!-- Aggregated common jar for shared library location -->
- <module>pluto-common</module>
-
- <!-- PortletHub demo portlets -->
- <module>ChatRoomDemo</module>
- <module>PortletHubDemo</module>
- <module>PortletV3Demo</module>
- <module>PortletV3AnnotatedDemo</module>
-
- <!-- Pluto Utilities, Maven Plugins and Ant Tasks -->
- <module>pluto-util</module>
- <module>maven-pluto-plugin</module>
- <module>pluto-ant-tasks</module>
- <module>pluto-site-skin</module>
-
- <!-- the Technology Compliance Kit -->
- <module>portlet-tck_3.0</module>
- </modules>
- </profile>
-
- <profile>
- <id>website</id>
- <!-- For building website documentation, there's no need to include modules. -->
- <modules />
- </profile>
-
- <!-- To build Pluto for deployment on tomee, activate this profile -->
- <!-- Activate using the tomee property: mvn clean install -Dtomee -->
- <profile>
- <id>tomee</id>
- <activation>
- <property>
- <name>tomee</name>
- </property>
- </activation>
- <properties>
- <!-- scope of certain dependencies is "compile" for deployment on tomcat,
- but "provided" for deployment on tomee. See tomee profile. -->
- <dependency.scope>provided</dependency.scope>
- </properties>
- </profile>
-
- </profiles>
-
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.portals</groupId>
+ <artifactId>portals-pom</artifactId>
+ <version>1.4</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <packaging>pom</packaging>
+ <name>Apache Pluto</name>
+ <version>3.0.2-SNAPSHOT</version>
+ <!-- Due to a bug in maven 2.0, the description must not contain any line breaks or tabs. -->
+ <description>Apache Pluto is the Reference Implementation of the Java Portlet Specification.</description>
+ <url>http://portals.apache.org/pluto</url>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10560</url>
+ </issueManagement>
+ <inceptionYear>2003</inceptionYear>
+
+
+ <!-- Mailing Lists ======================================================= -->
+
+ <mailingLists>
+ <mailingList>
+ <name>Pluto User List</name>
+ <subscribe>pluto-user-subscribe@portals.apache.org</subscribe>
+ <unsubscribe>pluto-user-unsubscribe@portals.apache.org</unsubscribe>
+ <post>pluto-user@portals.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-user</archive>
+ </mailingList>
+ <mailingList>
+ <name>Pluto Developer List</name>
+ <subscribe>pluto-dev-subscribe@portals.apache.org</subscribe>
+ <unsubscribe>pluto-dev-unsubscribe@portals.apache.org</unsubscribe>
+ <post>pluto-dev@portals.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-dev</archive>
+ </mailingList>
+ <mailingList>
+ <name>Pluto SCM List</name>
+ <subscribe>pluto-scm-subscribe@portals.apache.org</subscribe>
+ <unsubscribe>pluto-scm-unsubscribe@portals.apache.org</unsubscribe>
+ <post>pluto-scm@portals.apache.org</post>
+ <archive>http://mail-archives.apache.org/mod_mbox/portals-pluto-scm</archive>
+ </mailingList>
+ </mailingLists>
+
+
+ <!-- Pluto Committers ==================================================== -->
+
+ <!-- Email format: [name]#a@T#[domain].d0t.[extension]
+'@' and '.' characters are added because m2 seems to need them to
+generate mailto links. -->
+
+ <developers>
+
+ <developer>
+ <name>Michael Blum</name>
+ <id>blumm</id>
+ <email>blumm#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>Carsten Ziegeler</name>
+ <id>cziegeler</id>
+ <email>cziegeler#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>David DeWolf</name>
+ <id>ddewolf</id>
+ <email>ddewolf@apache.org</email>
+ <timezone>-4</timezone>
+ <url>http://www.daviddewolf.com</url>
+ <organization>Three Pillar Software, Inc.</organization>
+ <organizationUrl>http://www.threepillarsoftware.com</organizationUrl>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>Scott Nicklous</name>
+ <id>msnicklous</id>
+ <email>msnicklous#a@T#apache.d0t.org</email>
+ <timezone>+1</timezone>
+ <organization>IBM Corporation</organization>
+ <organizationUrl>http://www.ibm.com</organizationUrl>
+ <roles>
+ <role>Specification Lead, JSR 362 Portlet Specification 3.0</role>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>Neil Griffin</name>
+ <id>asfgriff</id>
+ <email>neil.griffin#a@T#portletfaces.d0t.org</email>
+ <timezone>+8</timezone>
+ <organization>Liferay</organization>
+ <organizationUrl>https://www.liferay.com/</organizationUrl>
+ <roles>
+ <role>Specification Architect, JSR 362 Portlet Specification 3.0</role>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>Nick Lothian</name>
+ <id>nlothian</id>
+ <email>nlothian#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>Craig Doremus</name>
+ <id>cdoremus</id>
+ <email>cdoremus#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>Zhong Zheng</name>
+ <id>zheng</id>
+ <email>zheng#a@T#apache.d0t.org</email>
+ <timezone>+1</timezone>
+ <organization />
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>Santiago Gala</name>
+ <id>sgala</id>
+ <email>sgala#a@T#hisitech.d0t.com</email>
+ <organization />
+ </developer>
+
+ <developer>
+ <name>Raphael Luta</name>
+ <id>raphael</id>
+ <email>raphael#a@T#apache.d0t.org</email>
+ <organization />
+ </developer>
+
+ <developer>
+ <name>David S. Taylor</name>
+ <id>taylor</id>
+ <email>david#a@T#bluesunrise.d0t.com</email>
+ <timezone>+8</timezone>
+ <organization>Bluesunrise</organization>
+ <organizationUrl>https://www.bluesunrise.com/</organizationUrl>
+ <roles>
+ <role>Expert Group Member, JSR 362 Portlet Specification 3.0</role>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>Scott T. Weaver</name>
+ <id>weaver</id>
+ <email>weaver#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>Stefan Hepper</name>
+ <id>sthepper</id>
+ <email>sthepper#a@T#apache.d0t.org</email>
+ </developer>
+
+ <developer>
+ <name>Elliot Metsger</name>
+ <id>esm</id>
+ <email>esm#a@T#apache.d0t.org</email>
+ <timezone>-4</timezone>
+ <url>http://uppertank.net/blog</url>
+ <organization>Johns Hopkins University, Sheridan Libraries</organization>
+ <organizationUrl>http://www.library.jhu.edu</organizationUrl>
+ </developer>
+
+ <developer>
+ <name>Ate Douma</name>
+ <id>ate</id>
+ <email>ate#aT#apache.d0t.org</email>
+ <timezone>+2</timezone>
+ <organization>Hippo</organization>
+ <organizationUrl>http://www.onehippo.com</organizationUrl>
+ <roles>
+ <role>Java Developer</role>
+ </roles>
+ </developer>
+
+ <developer>
+ <name>David Jencks</name>
+ <id>djencks</id>
+ <email>djencks#aT#apache.d0t.org</email>
+ <timezone>-7</timezone>
+ </developer>
+
+ </developers>
+
+
+ <!-- Pluto Contributors ================================================== -->
+
+ <contributors>
+ <contributor>
+ <name>Michael Westbay</name>
+ <email>westbay#a@T#users.d0t.sourceforge.d0t.net</email>
+ </contributor>
+ <contributor>
+ <name>Ken Weiner</name>
+ <email>kweiner#a@T#unicon.d0t.net</email>
+ </contributor>
+ <contributor>
+ <name>Ken Atherton</name>
+ <email>katherto#a@T#visa.d0t.com</email>
+ </contributor>
+ <contributor>
+ <name>David Hay</name>
+ </contributor>
+
+ <contributor>
+
+ </contributor>
+ </contributors>
+
+ <scm>
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</developerConnection>
+ <url>https://github.com/apache/portals-pluto</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <!-- Dependency Version Properties ======================================= -->
+
+ <!--
+ NOTE:
+
+ Modification of these properties affects:
+ 1) pluto-maven-plugin/src/main/resources/versions.properties as well!
+ -->
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <pluto.container.name>Pluto</pluto.container.name>
+ <javax.portlet.version.major>3</javax.portlet.version.major>
+ <javax.portlet.version.minor>0</javax.portlet.version.minor>
+ <portals.portlet-api.version>${project.version}</portals.portlet-api.version>
+ <servlet-api.version>8.0.28</servlet-api.version>
+ <jsp-api.version>8.0.28</jsp-api.version>
+ <jstl.version>8.0.28</jstl.version>
+ <el-api.version>8.0.28</el-api.version>
+ <taglibs.standard.version>1.2.1</taglibs.standard.version>
+ <jaxb.version>2.1</jaxb.version>
+ <jaxb-impl.version>2.1.9</jaxb-impl.version>
+ <stax.impl.version>1.2.0</stax.impl.version>
+ <commons-digester.version>1.8</commons-digester.version>
+ <commons-cli.version>1.0</commons-cli.version>
+ <slf4j.version>1.7.5</slf4j.version>
+ <springframework.version>2.0.2</springframework.version>
+<!-- <springframework.version>4.2.3.RELEASE</springframework.version> -->
+ <maven.version>2.0.5</maven.version>
+ <ant.version>1.6.5</ant.version>
+ <commons-lang.version>3.4</commons-lang.version>
+ <commons-io.version>2.4</commons-io.version>
+ <ccpp-api.version>1.0</ccpp-api.version>
+ <junit.version>4.12</junit.version>
+ <jmock.version>1.2.0</jmock.version>
+ <xmlunit.version>1.1</xmlunit.version>
+ <cdi.version>2.3.1.Final</cdi.version>
+ <annotation-detector.version>3.0.5</annotation-detector.version>
+
+ <!-- The following properties are not directly used as maven
+dependencies, they're used by the maven pluto plugin for
+handling installation dependencies
+TODO: Check if we need all of them. -->
+ <xerces.version>2.6.2</xerces.version>
+ <xalan.version>2.7.0</xalan.version>
+ <castor.version>1.1.1</castor.version>
+ <commons-collections.version>3.2</commons-collections.version>
+ <commons-httpclient.version>3.0</commons-httpclient.version>
+ <commons-beanutils.version>1.7.0</commons-beanutils.version>
+ <log4j.version>1.2.14</log4j.version>
+ <activation.version>1.1</activation.version>
+ <ccpp-ri.version>1.0</ccpp-ri.version>
+ <rdffilter.version>1.0</rdffilter.version>
+ <jena.version>1.4.0</jena.version>
+
+ <!-- scope of certain dependencies is "compile" for deployment on tomcat,
+ but "provided" for deployment on tomee. See tomee profile. -->
+ <dependency.scope>compile</dependency.scope>
+
+ <!-- following properties control whether or not demos are included in page
+ config file (see profile 'excludeDemos' below) -->
+ <includeDemosBegin />
+ <includeDemosEnd />
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- Logging =========================================== -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jcl-over-slf4j</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
+
+ <!-- Specification Libraries =========================================== -->
+ <dependency>
+ <groupId>javax.portlet</groupId>
+ <artifactId>portlet-api</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-servlet-api</artifactId>
+ <version>${servlet-api.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ <version>${jaxb.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.sun.xml.bind</groupId>
+ <artifactId>jaxb-impl</artifactId>
+ <version>${jaxb-impl.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax</artifactId>
+ <version>${stax.impl.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <!-- CDI Library -->
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld.servlet</groupId>
+ <artifactId>weld-servlet</artifactId>
+ <version>${cdi.version}</version>
+ </dependency>
+
+ <!-- For method annotation scanning ==================================== -->
+ <dependency>
+ <groupId>eu.infomas</groupId>
+ <artifactId>annotation-detector</artifactId>
+ <version>${annotation-detector.version}</version>
+ </dependency>
+
+ <!-- CCPP Libraries -->
+ <dependency>
+ <groupId>javax.ccpp</groupId>
+ <artifactId>ccpp</artifactId>
+ <version>${ccpp-api.version}</version>
+ </dependency>
+
+ <!-- Testing Libraries ================================================= -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jmock</groupId>
+ <artifactId>jmock</artifactId>
+ <version>${jmock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>jmock</groupId>
+ <artifactId>jmock-cglib</artifactId>
+ <version>${jmock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>xmlunit</groupId>
+ <artifactId>xmlunit</artifactId>
+ <version>${xmlunit.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- Misc ================================================= -->
+ <dependency>
+ <groupId>ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>${ant.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-core</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-artifact</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-model</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>${maven.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-jsp-api</artifactId>
+ <version>${jsp-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>tomcat-el-api</artifactId>
+ <version>${el-api.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-spec</artifactId>
+ <version>${taglibs.standard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-impl</artifactId>
+ <version>${taglibs.standard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.taglibs</groupId>
+ <artifactId>taglibs-standard-jstlel</artifactId>
+ <version>${taglibs.standard.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-api</artifactId>
+ <version>3.11.0</version>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-java</artifactId>
+ <version>3.11.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>htmlunit-driver</artifactId>
+ <version>2.21</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.codeborne</groupId>
+ <artifactId>phantomjsdriver</artifactId>
+ <version>1.3.0</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-core</artifactId>
+ <version>${springframework.version}</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-beans</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-web</artifactId>
+ <version>${springframework.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons-io.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${commons-digester.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>commons-cli</groupId>
+ <artifactId>commons-cli</artifactId>
+ <version>${commons-cli.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto-maven-plugin</artifactId>
+ <version>${project.version}</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>3.2.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <version>0.12</version>
+ <configuration>
+ <excludes>maven-archetypes/**/archetype-resources/**/*</excludes>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.7</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <additionalparam>-Xdoclint:none -Xdoclint:-missing</additionalparam>
+ <!-- link to Java EE APIs for cross-references -->
+ <links>
+ <link>http://docs.oracle.com/javaee/7/api/</link>
+ </links>
+ <docfilessubdirs>true</docfilessubdirs>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>3.2.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Implementation-Title>${project.name}</Implementation-Title>
+ <Specification-Version>${project.version}</Specification-Version>
+ <Implementation-Version>${project.version}</Implementation-Version>
+ <Bundle-DocURL>${project.url}</Bundle-DocURL>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.scm</groupId>
+ <artifactId>maven-scm-providers-git</artifactId>
+ <!-- http://jira.codehaus.org/browse/SCM-444 -->
+ <version>(,1.4]</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <!-- During release (prepare) the org.apache.felix maven-bundle-plugin needs classpath access to just build dependent artifacts
+ like the pluto-container-api to determine the needed OSGi imports.
+ However, the default maven-release-plugin goals (clean verify) somehow don't provide those.
+ To fix that, the default release plugin set of preparationGoals is changed to do an "install" instead of just "verify".
+ -->
+ <preparationGoals>clean install</preparationGoals>
+ <mavenExecutorId>forked-path</mavenExecutorId>
+ <autoVersionSubmodules>true</autoVersionSubmodules>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+
+ <!-- by default, the release build includes the V3 demos. To perform the release build without the demos,
+ activate the 'excludeDemos profile 'arguments' line as shown below. -->
+ <!--
+ <arguments>-Ppluto,excludeDemos</arguments>
+ -->
+ <arguments>-Ppluto</arguments>
+ </configuration>
+ </plugin>
+
+ <!-- Javascript compressor plugin -->
+ <plugin>
+ <groupId>net.alchim31.maven</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <version>1.1</version>
+ <executions>
+ <execution>
+ <id>compress-js</id>
+ <goals>
+ <goal>compress</goal>
+ </goals>
+ <configuration>
+ <jswarn>false</jswarn>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>all</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ <!-- profile must also be activated when building for tomee -->
+ <property>
+ <name>tomee</name>
+ </property>
+ </activation>
+
+ <!-- Pluto Modules ======================================================= -->
+ <modules>
+ <!-- Portlet API module (spec -->
+ <module>portlet-api</module>
+
+ <!-- Pluto Container API -->
+ <module>pluto-container-api</module>
+
+ <!-- Pluto Core Modules -->
+ <module>pluto-container</module>
+ <module>pluto-taglib</module>
+
+ <!-- Pluto Portal and Testsuite Modules -->
+ <module>pluto-container-driver-api</module>
+ <module>pluto-portal-driver</module>
+ <module>pluto-portal-driver-impl</module>
+ <module>pluto-portal</module>
+ <module>pluto-testsuite</module>
+
+ <!-- Aggregated common jar for shared library location -->
+ <module>pluto-common</module>
+
+ <!-- PortletHub demo portlets -->
+ <module>ChatRoomDemo</module>
+ <module>PortletHubDemo</module>
+ <module>PortletV3Demo</module>
+ <module>PortletV3AnnotatedDemo</module>
+
+ <!-- Pluto Utilities, Maven Plugins and Ant Tasks -->
+ <module>pluto-util</module>
+ <module>maven-pluto-plugin</module>
+ <module>pluto-ant-tasks</module>
+ <module>pluto-site-skin</module>
+
+ <!-- the Technology Compliance Kit -->
+ <module>test-base</module>
+ <module>portlet-tck_3.0</module>
+ <module>demo-integration-tests</module>
+ </modules>
+ </profile>
+
+ <profile>
+ <id>website</id>
+ <!-- For building website documentation, there's no need to include modules. -->
+ <modules />
+ </profile>
+
+ <!-- To build Pluto for deployment on tomee, activate this profile -->
+ <!-- Activate using the tomee property: mvn clean install -Dtomee -->
+ <profile>
+ <id>tomee</id>
+ <activation>
+ <property>
+ <name>tomee</name>
+ </property>
+ </activation>
+ <properties>
+ <!-- scope of certain dependencies is "compile" for deployment on tomcat,
+ but "provided" for deployment on tomee. See tomee profile. -->
+ <dependency.scope>provided</dependency.scope>
+ </properties>
+ </profile>
+
+ </profiles>
+
+</project>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/portlet-tck_3.0/driver/pom.xml
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/pom.xml b/portlet-tck_3.0/driver/pom.xml
index c93ac26..96e1e5c 100644
--- a/portlet-tck_3.0/driver/pom.xml
+++ b/portlet-tck_3.0/driver/pom.xml
@@ -39,6 +39,11 @@
<scope>compile</scope>
</dependency>
<dependency>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>test-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<scope>compile</scope>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKLiferayTestDriver.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKLiferayTestDriver.java b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKLiferayTestDriver.java
index 01b72e5..7c24d8d 100644
--- a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKLiferayTestDriver.java
+++ b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKLiferayTestDriver.java
@@ -38,31 +38,14 @@ import static org.junit.Assert.assertTrue;
*
*/
@RunWith(value = Parameterized.class)
-public class TCKLiferayTestDriver extends TCKSimpleTestDriver {
+public class TCKLiferayTestDriver extends TCKTestDriver {
private static Properties nonExclusiveTCs = new Properties();
- private static String baseUrl;
private static boolean hadToGet = false;
private static boolean wasExclusive = false;
private static boolean stillExclusive = false;
private static boolean exclusive = false;
- private void getBaseUrl() {
-
- if (baseUrl == null || "".equals(baseUrl)) {
- StringBuilder sb = new StringBuilder();
- sb.append("http://");
- sb.append(host);
- if (port != null && !port.isEmpty()) {
- sb.append(":");
- sb.append(port);
- }
- sb.append("/");
- sb.append(testContextBase);
- baseUrl = sb.toString();
- }
- }
-
private void getNonExclusiveTCs() {
String nonExclusiveTCsFile = System.getProperty("test.non.exclusive.file", "");
System.out.println(" nonExclusiveTCsFile =" + nonExclusiveTCsFile);
@@ -83,9 +66,6 @@ public class TCKLiferayTestDriver extends TCKSimpleTestDriver {
public TCKLiferayTestDriver(String p, String t) {
super(p, t);
- if (baseUrl == null) {
- getBaseUrl();
- }
if (nonExclusiveTCs.size() == 0) {
getNonExclusiveTCs();
}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
----------------------------------------------------------------------
diff --git a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java b/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
deleted file mode 100644
index bfddae6..0000000
--- a/portlet-tck_3.0/driver/src/main/java/javax/portlet/tck/driver/TCKSimpleTestDriver.java
+++ /dev/null
@@ -1,619 +0,0 @@
-/* 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 javax.portlet.tck.driver;
-
-import static org.junit.Assert.*;
-
-import java.io.FileInputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
-import org.junit.runners.Parameterized.Parameters;
-import org.openqa.selenium.By;
-import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.StaleElementReferenceException;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeOptions;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.firefox.FirefoxDriver;
-import org.openqa.selenium.firefox.FirefoxOptions;
-import org.openqa.selenium.htmlunit.HtmlUnitDriver;
-import org.openqa.selenium.ie.InternetExplorerDriver;
-import org.openqa.selenium.remote.DesiredCapabilities;
-import org.openqa.selenium.safari.SafariDriver;
-import org.openqa.selenium.phantomjs.PhantomJSDriver;
-import org.openqa.selenium.phantomjs.PhantomJSDriverService;
-import org.openqa.selenium.support.ui.ExpectedConditions;
-import org.openqa.selenium.support.ui.WebDriverWait;
-
-import javax.portlet.tck.constants.Constants;
-
-
-/**
- * @author nick
- *
- */
-@RunWith(value = Parameterized.class)
-public class TCKSimpleTestDriver {
-
- protected static String loginUrl, host, port, testFile, browser,
- username, usernameId, password, passwordId, testContextBase, module;
- protected static int timeout = 3; // for waiting on page load
- protected static boolean useGeneratedUrl = true, debug = false, dryrun = false, scroll;
-
- protected static WebDriver driver;
- protected String page, tcName;
-
- protected List<String> debugLines = new ArrayList<>();
-
- /**
- * Reads the consolidated list of test cases and provides the list to Junit
- * for parameterized testing.
- * @return a Collection of test cases to run
- */
- @SuppressWarnings("rawtypes")
- @Parameters (name = "{1}")
- public static Collection getTestList () {
- System.out.println("getTestList");
- testFile = System.getProperty("test.list.file");
- System.out.println(" TestFile=" + testFile);
- module = System.getProperty("test.module");
- System.out.println(" Module =" + module);
- scroll = Boolean.valueOf(System.getProperty("test.scroll"));
- System.out.println(" Scroll =" + scroll);
-
- String ignoreFile = System.getProperty("test.ignore.list.file");
- System.out.println(" Ignore file =" + ignoreFile);
- boolean doIgnore = new Boolean(System.getProperty("test.ignore"));
- System.out.println(" Ignore TCs =" + doIgnore);
-
- boolean filterTCs = (module != null && module.length() > 0);
- boolean excTCs = true; // include or exclude TCs
- String filterStr = module;
- if (filterTCs) {
- excTCs = module.startsWith("!");
- filterStr = module.replaceFirst("^!(.*)$", "$1");
- System.out.println(" Filtering = " + (excTCs?"Excluding":"Including") +
- " all " + filterStr + " testcases");
- }
-
- Properties tprops = new Properties();
- try {
- FileInputStream fis = new FileInputStream(testFile);
- tprops.loadFromXML(fis);
- } catch (Exception e) {
- System.out.println("Could not read test cases file. Attempted to read file " + testFile);
- e.printStackTrace();
- return null;
- }
-
- Properties ignoredTCs = new Properties();
- if (doIgnore) {
- try {
- FileInputStream fis = new FileInputStream(ignoreFile);
- ignoredTCs.loadFromXML(fis);
- } catch (Exception e) {
- System.out.println("Could not read test cases file. Attempted to read file " + ignoreFile);
- e.printStackTrace();
- return null;
- }
- }
- System.out.println(" # ignore TCs =" + ignoredTCs.size());
-
- // See if performance can be improved by sorting the test cases by
- // the page to be accessed. The map uses the page as key and has a
- // set of test cases for that page as value. Filter according to
- // test.module.
-
- TreeMap<String, Set<String>> pages = new TreeMap<String, Set<String>>();
- Set<Object> tcs = tprops.keySet();
-
- tcloop:
- for (Object o : tcs) {
- String tcase = (String) o ;
- String tpage = tprops.getProperty(tcase);
- if (filterTCs) {
- boolean c = tcase.contains(filterStr);
- if (excTCs && c) continue; // exclude matches
- if (!excTCs && !c) continue; // exclude non-matches
- }
- // handle ignore list
- if (doIgnore) {
- for (Object itc : ignoredTCs.keySet()) {
- if (tcase.equalsIgnoreCase((String)itc)) {
- System.out.println(" Ignoring :" + tcase);
- continue tcloop;
- }
- }
- }
- if (!pages.containsKey(tpage)) {
- pages.put(tpage, new TreeSet<String>());
- }
- pages.get(tpage).add(tcase);
- }
-
- // now pass TCs, sorted by page, to the driver
-
- List<String[]> tests = new ArrayList<String[]>();
- for (String tpage : pages.keySet()) {
- for (String tcase: pages.get(tpage)) {
- String[] parms = {tpage, tcase};
- tests.add(parms);
- }
- }
-
- int numP = pages.size();
- int numTC = tests.size();
- System.out.println("Executing " + numTC + " tests on " + numP + " pages.");
-
- return tests;
- }
-
- public TCKSimpleTestDriver(String p, String t) {
- page = p;
- tcName = t;
- StringBuilder sb = new StringBuilder();
- sb.append("http://");
- sb.append(host);
- if (port != null && !port.isEmpty()) {
- sb.append(":");
- sb.append(port);
- }
- sb.append("/");
- sb.append(testContextBase);
- sb.append(page);
- sb.toString();
- System.out.println("Testing: " + tcName);
- }
-
- /**
- * @throws java.lang.Exception
- */
- @BeforeClass
- public static void setUpBeforeClass() throws Exception {
-
- loginUrl = System.getProperty("test.server.login.url");
- host = System.getProperty("test.server.host");
- port = System.getProperty("test.server.port");
- username = System.getProperty("test.server.username");
- usernameId = System.getProperty("test.server.username.id");
- password = System.getProperty("test.server.password");
- passwordId = System.getProperty("test.server.password.id");
- browser = System.getProperty("test.browser");
- testContextBase = System.getProperty("test.context.base");
- String str = System.getProperty("test.url.strategy");
- useGeneratedUrl = str.equalsIgnoreCase("generateURLs");
- str = System.getProperty("test.debug");
- debug = str.equalsIgnoreCase("true");
- str = System.getProperty("test.timeout");
- dryrun = new Boolean(System.getProperty("test.dryrun"));
- timeout = ((str != null) && str.matches("\\d+")) ? Integer.parseInt(str) : 3;
- String wd = System.getProperty("test.browser.webDriver");
- String binary = System.getProperty("test.browser.binary");
- String headlessProperty = System.getProperty("test.browser.headless");
- boolean headless = (((headlessProperty == null) || (headlessProperty.length() == 0) || Boolean.valueOf(headlessProperty)));
-
- System.out.println("before class.");
- System.out.println(" Debug =" + debug);
- System.out.println(" Dryrun =" + dryrun);
- System.out.println(" Timeout =" + timeout);
- System.out.println(" Login URL =" + loginUrl);
- System.out.println(" Host =" + host);
- System.out.println(" Port =" + port);
- System.out.println(" Context =" + testContextBase);
- System.out.println(" Generate URL =" + useGeneratedUrl);
- System.out.println(" Username =" + username);
- System.out.println(" UsernameId =" + usernameId);
- System.out.println(" Password =" + password);
- System.out.println(" PasswordId =" + passwordId);
- System.out.println(" Browser =" + browser);
- System.out.println(" Driver =" + wd);
- System.out.println(" binary =" + binary);
- System.out.println(" headless =" + headless);
-
- if (browser.equalsIgnoreCase("firefox")) {
-
- System.setProperty("webdriver.gecko.driver", wd);
- FirefoxOptions options = new FirefoxOptions();
- options.setLegacy(true);
- options.setAcceptInsecureCerts(true);
-
- if ((binary != null) && (binary.length() != 0)) {
- options.setBinary(binary);
- }
-
- if (headless) {
- options.setHeadless(true);
- }
-
- driver = new FirefoxDriver(options);
-
- } else if (browser.equalsIgnoreCase("internetExplorer")) {
- System.setProperty("webdriver.ie.driver", wd);
- driver = new InternetExplorerDriver();
- } else if (browser.equalsIgnoreCase("chrome")) {
-
- System.setProperty("webdriver.chrome.driver", wd);
- ChromeOptions options = new ChromeOptions();
-
- if ((binary != null) && (binary.length() > 0)) {
- options.setBinary(binary);
- }
-
- if (headless) {
- options.addArguments("--headless");
- }
-
- options.addArguments("--disable-infobars");
- options.setAcceptInsecureCerts(true);
-
- driver = new ChromeDriver(options);
-
- } else if (browser.equalsIgnoreCase("phantomjs")) {
- DesiredCapabilities capabilities = DesiredCapabilities.phantomjs();
- capabilities.setJavascriptEnabled(true);
- capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, binary);
- driver = new PhantomJSDriver(capabilities);
- } else if (browser.equalsIgnoreCase("htmlUnit")) {
- driver = new HtmlUnitDriver();
- } else if (browser.equalsIgnoreCase("safari")) {
- driver = new SafariDriver();
- } else {
- throw new Exception("Unsupported browser: " + browser);
- }
-
- if (!dryrun) {
- login();
- }
-
- }
-
- /**
- * @throws java.lang.Exception
- */
- @AfterClass
- public static void tearDownAfterClass() throws Exception {
- if (driver != null) {
- driver.quit();
- }
- System.out.println(" after class.");
- }
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- debugLines.add(" before test.");
- }
-
- /**
- * @throws java.lang.Exception
- */
- @After
- public void tearDown() throws Exception {
- debugLines.add(" after test.");
- if (debug) {
- for (String line : debugLines) {
- System.out.println(line);
- }
- }
- }
-
- @Test
- public void test() {
- debugLines.add(" execute test.");
-
- if (dryrun) {
- return;
- }
-
- try {
-
- // This is optimized for many results being present on the same page.
- // First look for the test results or links already being present on the page.
-
- List<WebElement> wels = driver.findElements(By.name(tcName));
- debugLines.add(" TC elements already on page: " + !wels.isEmpty() + ", tcname===" + tcName + "===");
- if (wels.isEmpty()) {
- wels = accessPage();
- }
-
- // process links if present
- wels = processClickable(wels);
- debugLines.add(" After processing clickable, results found: " + !wels.isEmpty());
-
- // wait for any async JavaScript tests to complete
- processAsync();
-
- checkResults();
-
- } catch(Exception e) {
-
- // Some type of unexpected error occurred, so generate text
- // and mark the TC as failed.
-
- System.out.println(" Exception occurred: " + e.getMessage());
- for (String line : debugLines) {
- System.out.println(line);
- }
-
- throw new AssertionError("Test case " + tcName + " failed. " +
- "\nException: ", e);
- }
- }
-
- /**
- * Tries to access the page for the test case. Looks for the page link
- * and clicks it, waiting for the page to load.
- *
- * @return a list of elements for the TC (should only be one)
- */
- protected List<WebElement> accessPage() throws Exception {
- List<WebElement> wels = driver.findElements(By.linkText(page));
- debugLines.add(" Access page, link found: " + !wels.isEmpty() + ", page===" + page + "===");
-
- if (wels.isEmpty()) {
- // retry through login page
- debugLines.add("accessPage: debugLines: logging in ... ");
- login();
- wels = driver.findElements(By.linkText(page));
- if (wels.isEmpty()) {
- throw new Exception("Page " + page + ": link could not be found.");
- }
- }
-
- WebElement wel = wels.get(0);
- if (scroll) {
- JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
- javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
- }
- click(wel);
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
- wdw.until(ExpectedConditions.visibilityOfElementLocated(By.name(tcName)));
- wels = driver.findElements(By.name(tcName));
- if (wels.isEmpty()) {
- throw new Exception("For test case " + tcName + ": no elements found.");
- }
- return wels;
- }
-
- protected void click(WebElement wel) {
- wel.click();
- }
-
- /**
- * Called to login to the portal if necessary.
- */
- protected static void login() {
-
- driver.get(loginUrl);
-
- List<WebElement> uels = driver.findElements(By.id(usernameId));
- List<WebElement> pwels = driver.findElements(By.id(passwordId));
-
- // If there is no login or password fields, don't need to login.
- if (!uels.isEmpty() && !pwels.isEmpty()) {
-
- System.out.println("login: found userid and password fields");
- WebElement userEl = uels.get(0);
- WebElement pwEl = pwels.get(0);
-
- // perform login
- userEl.clear();
- userEl.sendKeys(username);
- pwEl.clear();
- pwEl.sendKeys(password);
- pwEl.submit();
-
- }
- }
-
- /**
- * Analyzes the page based on the test case name and records success or failure.
- */
- protected void checkResults() {
-
- String resultId = tcName + Constants.RESULT_ID;
- String detailId = tcName + Constants.DETAIL_ID;
-
- List<WebElement> rels = driver.findElements(By.id(resultId));
- List<WebElement> dels = driver.findElements(By.id(detailId));
-
- if (!rels.isEmpty()) {
-
- String res = "";
- try {
- res = rels.get(0).getText();
- } catch(StaleElementReferenceException e) {
- System.out.println(e.getClass().getName() + " caught when trying to use WebElements found with " + resultId);
- rels = driver.findElements(By.id(resultId));
- res = rels.get(0).getText();
- }
-
- String det = "Test case " + tcName + ": ";
- try {
- det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
- } catch(StaleElementReferenceException e) {
- System.out.println(e.getClass().getName() + " caught when trying to use WebElements found with " + detailId);
- dels = driver.findElements(By.id(detailId));
- det += dels.isEmpty() ? "No details provided." : dels.get(0).getText();
- }
-
- boolean ok = res.contains(Constants.SUCCESS);
- debugLines.add(" Test OK: " + ok + ", results: " + res + ", details: " + det);
- assertTrue(det, ok);
- } else {
- debugLines.add(" Results not found");
- assertTrue("Test case " + tcName + " failed. Results could not be found.", false);
- }
- }
-
- /**
- * Looks for a link or button that can be clicked for the TC and clicks it if found.
- *
- * First looks for a test case setup link or button and clicks it if found. Then it
- * looks for a test case execution link and clicks it if found.
- *
- * @return web element list containing the test case results.
- * @throws Exception
- */
- @SuppressWarnings("unused")
- protected List<WebElement> processClickable(List<WebElement> wels) throws Exception {
- String setupId = tcName + Constants.SETUP_ID;
- String actionId = tcName + Constants.CLICK_ID;
- String resultId = tcName + Constants.RESULT_ID;
- String detailId = tcName + Constants.DETAIL_ID;
- String asyncId = tcName + Constants.ASYNC_ID;
- String notreadyId = tcName + Constants.NOTREADY_ID;
- List<WebElement> tcels = null;
-
- for (WebElement wel : wels) {
- tcels = wel.findElements(By.id(setupId));
- if (!tcels.isEmpty()) break;
- }
- debugLines.add(" Setup link found: " + ((tcels != null) && !tcels.isEmpty()));
-
- // If were dealing with async, make sure the JavaScript is initialized
- List<WebElement> acels = driver.findElements(By.id(asyncId));
- debugLines.add(" Async elements found: " + ((acels != null) && !acels.isEmpty()));
- if (acels != null && !acels.isEmpty()) {
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
- wdw.until(ExpectedConditions.invisibilityOfElementLocated(By.id(notreadyId)));
- debugLines.add(" Async elements are now ready.");
- }
-
- // Click setup link if found
- if ((tcels != null) && !tcels.isEmpty()) {
- WebElement wel = tcels.get(0);
- if (scroll) {
- JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
- javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
- }
- try {
- wel.click();
- } catch(StaleElementReferenceException e) {
- System.out.println("setup link: " + e.getClass().getName() + " caught when trying to use WebElements found with " + tcName);
- wels = driver.findElements(By.name(tcName));
- for (WebElement welly : wels) {
- tcels = welly.findElements(By.id(setupId));
- if (!tcels.isEmpty()) break;
- }
- wel = tcels.get(0);
- wel.click();
- }
- debugLines.add(" Clicked setup link.");
-
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
-
- String expr = "//*[@id='" + resultId + "'] | //*[@id='" + actionId + "']";
- debugLines.add(" xpath string: ===" + expr + "===");
-
- wdw.until(ExpectedConditions.presenceOfAllElementsLocatedBy(By.xpath(expr)));
- wels = driver.findElements(By.name(tcName));
-
- debugLines.add(" Found elements: " + (!wels.isEmpty()));
- List<WebElement> xels = driver.findElements(By.xpath(expr));
- for (WebElement w : xels) {
- debugLines.add(" Element: " + w.getTagName() + ", id=" + w.getAttribute("id"));
- }
- }
-
- // Now click the action link, if present
- for (WebElement wel : wels) {
- tcels = wel.findElements(By.id(actionId));
- if (!tcels.isEmpty()) break;
- }
- debugLines.add(" Clickable link found: " + ((tcels != null) && !tcels.isEmpty()));
-
- if (tcels != null && !tcels.isEmpty()) {
- WebElement wel = tcels.get(0);
- if (scroll) {
- JavascriptExecutor javascriptExecutor = (JavascriptExecutor) driver;
- javascriptExecutor.executeScript("window.scrollTo(0, (arguments[0].getBoundingClientRect().top + window.pageYOffset) - (window.innerHeight / 2));", wel);
- }
- try {
- wel.click();
- } catch(StaleElementReferenceException e) {
- System.out.println("action link: " + e.getClass().getName() + " caught when trying to use WebElements found with " + tcName);
- wels = driver.findElements(By.name(tcName));
- for (WebElement welly : wels) {
- tcels = welly.findElements(By.id(actionId));
- if (!tcels.isEmpty()) break;
- }
- wel = tcels.get(0);
- wel.click();
- }
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
- wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
- wels = driver.findElements(By.name(tcName));
- if ((wels == null) || wels.isEmpty()) {
- throw new Exception("Test case " + tcName + " failed. No results after action link click.");
- }
- }
-
-
- return wels;
- }
-
- /**
- * Looks for an async element on the page. The async element will be filed in
- * with results by the test case JavaScript code, which runs asynchronously.
- *
- * If an async element is found, this function waits the timeout period to
- * let the async test case code update the results.
- *
- * @return <code>true</code> if async was handled; <code>false</code> otherwise.
- * @throws Exception
- */
- protected boolean processAsync() throws Exception {
- String asyncId = tcName + Constants.ASYNC_ID;
- String resultId = tcName + Constants.RESULT_ID;
-
- List<WebElement> tcels = null;
-
- tcels = driver.findElements(By.id(asyncId));
-
- debugLines.add(" Element with async id=" + asyncId + " found: " + !tcels.isEmpty());
-
- if (tcels.isEmpty()) {
- // no async element
- return false;
- }
-
- WebDriverWait wdw = new WebDriverWait(driver, timeout);
- wdw.until(ExpectedConditions.visibilityOfElementLocated(By.id(resultId)));
-
- return true;
- }
-
-}
[17/22] portals-pluto git commit: PLUTO-733 Add Portlet Config
Portlet Demo test
Posted by as...@apache.org.
PLUTO-733 Add Portlet Config Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/1df44597
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/1df44597
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/1df44597
Branch: refs/heads/master
Commit: 1df44597ef0cf88b0ab895c55ea543216b3d87ee
Parents: 89672e7
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 12 23:17:38 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../integration/test/PortletConfigDemoIT.java | 109 +++++++++++++++++++
1 file changed, 109 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/1df44597/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletConfigDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletConfigDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletConfigDemoIT.java
new file mode 100644
index 0000000..fdc0950
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletConfigDemoIT.java
@@ -0,0 +1,109 @@
+/* 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 org.openqa.selenium.By;
+
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class PortletConfigDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testPortletConfigDemo() {
+ navigateToPage("V3.0 PM and WS");
+
+ // Portlet Modes for Portlet 1:
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: help, Allowed: true", 1);
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: view, Allowed: true", 1);
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: edit, Allowed: true", 1);
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: mymode_portalmanaged_3, Allowed: false",
+ 1);
+ assertTextVisible("Portlet Modes:",
+ "MIME type: text/html, PortletMode: mymode_nonportalmanaged_1, Allowed: false", 1);
+ assertTextVisible("Portlet Modes:",
+ "MIME type: text/html, PortletMode: mymode_nonportalmanaged_2, Allowed: false", 1);
+ assertTextVisible("Portlet Modes:", "MIME type: text/vnd.wap.wml, PortletMode: view", 1);
+ assertTextVisible("Portlet Modes:", "MIME type: text/vnd.wap.wml, PortletMode: mymode_nonportalmanaged_1", 1);
+
+ // Window States for Portlet 1:
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: testwindowstate_2, Allowed: false", 1);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: normal, Allowed: true", 1);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: testwindowstate_1, Allowed: false", 1);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: maximized, Allowed: true", 1);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: minimized, Allowed: true", 1);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: testwindowstate_2", 1);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: normal", 1);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: testwindowstate_1", 1);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: maximized", 1);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: minimized", 1);
+
+ // Public Render Parameters for Portlet 1:
+ assertTextVisible("Public Render Parameters:",
+ "Name: color, QName: {http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet}alt-color",
+ 1);
+ assertTextVisible("Public Render Parameters:",
+ "Name: photo, QName: {http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet}ph-imgName",
+ 1);
+
+ // Portlet Context Info for Portlet 1:
+ assertTextVisible("Portlet Context Info:", "Portlet application version: 3.0", 1);
+ assertTextVisible("Portlet Context Info:", "ClassLoader:", 1);
+ assertTextVisible("Portlet Context Info:", "Portlet context path: /PortletV3Demo", 1);
+
+ // Portlet Modes for Portlet 2:
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: help, Allowed: true", 2);
+ assertTextVisible("Portlet Modes:", "MIME type: text/html, PortletMode: view, Allowed: true", 2);
+ assertTextVisible("Portlet Modes:",
+ "MIME type: text/html, PortletMode: mymode_nonportalmanaged_1, Allowed: false",
+ 2);
+ assertTextVisible("Portlet Modes:",
+ "MIME type: text/vnd.wap.wml, PortletMode: view", 2);
+
+ // Window States for Portlet 2:
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: normal, Allowed: true", 2);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: testwindowstate_1, Allowed: false", 2);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: maximized, Allowed: true", 2);
+ assertTextVisible("Window States:", "MIME type: text/html, WindowState: minimized, Allowed: true", 2);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: normal", 2);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: testwindowstate_1", 2);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: maximized", 2);
+ assertTextVisible("Window States:", "MIME type: text/vnd.wap.wml, WindowState: minimized", 2);
+
+ // Public Render Parameters for Portlet 2:
+ assertTextVisible("Public Render Parameters:",
+ "Name: color, QName: {http://www.apache.org/portals/pluto/pub-render-params/ResourcePortlet}alt-color",
+ 2);
+
+ // Portlet Context Info for Portlet 2:
+ assertTextVisible("Portlet Context Info:", "Portlet application version: 3.0", 2);
+ assertTextVisible("Portlet Context Info:", "ClassLoader:", 2);
+ assertTextVisible("Portlet Context Info:", "Portlet context path: /PortletV3Demo", 2);
+ }
+
+ private void assertTextVisible(String title, String text, int portlet) {
+ waitingAsserter.assertTrue(visibilityOfAllElementsLocatedBy(By.xpath(
+ "(//h5[text()='" + title + "'])[" + portlet + "]/following-sibling::ul/" +
+ "li[contains(text(),'" + text + "')]")));
+ }
+}
[18/22] portals-pluto git commit: PLUTO-733 Add URL and Parameters
Demo Portlet Tests
Posted by as...@apache.org.
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 <st...@gmail.com>
Authored: Thu Oct 18 12:55:26 2018 -0400
Committer: Neil Griffin <ne...@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);
+ }
+}
[19/22] portals-pluto git commit: PLUTO-733 Add Tag Library Tags
Portlet Demo test
Posted by as...@apache.org.
PLUTO-733 Add Tag Library Tags Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/37a671a2
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/37a671a2
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/37a671a2
Branch: refs/heads/master
Commit: 37a671a269d749c541a9f52b5ad0c4e1cd7f380d
Parents: e97af80
Author: Kyle Stiemann <st...@gmail.com>
Authored: Mon Oct 15 23:19:53 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/TagLibTagsDemoIT.java | 190 +++++++++++++++++++
1 file changed, 190 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/37a671a2/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibTagsDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibTagsDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibTagsDemoIT.java
new file mode 100644
index 0000000..5b580ce
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibTagsDemoIT.java
@@ -0,0 +1,190 @@
+/* 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 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 TagLibTagsDemoIT extends DemoTestDriver {
+
+ private static final String BUTTON_LINK_XPATH_TEMPLATE =
+ "//*[local-name()='a' or local-name()='button'][contains(text(),'{0}')]";
+
+ @Test
+ public void testTagLibTagsDemo() {
+ navigateToPage("Tag Library");
+
+ testRenderURLs();
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Copy & add res param pr3=vr3"));
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"), new Parameter("addrp", "true"));
+ assertNoParametersSet("Action");
+ assertParametersSet("Resource", new Parameter("pr3", "vr3"));
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Copy & add res param pr3=vr3"));
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"),
+ new Parameter("addrp", "true, true"));
+ assertNoParametersSet("Action");
+ assertParametersSet("Resource", new Parameter("pr3", "vr3"));
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Copy & add res param pr3=vr3"));
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"),
+ new Parameter("addrp", "true, true, true"));
+ assertNoParametersSet("Action");
+ assertParametersSet("Resource", new Parameter("pr3", "vr3"));
+
+ clickElement(driver, waitingAsserter,
+ "(" + BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "action pa7=va7 & render pr6=vr6") + ")[2]");
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"),
+ new Parameter("addrp", "true, true, true"), new Parameter("pr6", "vr6"));
+ assertParametersSet("Action", new Parameter("pa7", "va7"));
+ assertParametersSet("Resource", new Parameter("pr3", "vr3"));
+
+ testRenderURLs();
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "add resource parameter pr3=vr3"));
+ assertRenderParametersSet(new Parameter("addrp", "true"));
+ assertNoParametersSet("Action");
+ assertParametersSet("Resource", new Parameter("pr3", "vr3"));
+
+ testRenderURLs();
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Action, no parameters"));
+ assertNoRenderParametersSet();
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "render param pr5=vr5"));
+ assertRenderParametersSet(new Parameter("pr5", "vr5"));
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "action pa4=va4"));
+ assertNoRenderParametersSet();
+ assertParametersSet("Action", new Parameter("pa4", "va4"));
+ assertNoParametersSet("Resource");
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "action pa7=va7 & render pr6=vr6"));
+ assertRenderParametersSet(new Parameter("pr6", "vr6"));
+ assertParametersSet("Action", new Parameter("pa7", "va7"));
+ assertNoParametersSet("Resource");
+
+ testRenderURLs();
+ clickElement(driver, waitingAsserter,
+ "(" + BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "action pa7=va7 & render pr6=vr6") + ")[2]");
+ clickElement(driver, waitingAsserter,
+ "(" + BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "action pa4=va4") + ")[2]");
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"), new Parameter("pr6", "vr6"));
+ assertParametersSet("Action", new Parameter("pa4", "va4"));
+ assertNoParametersSet("Resource");
+ }
+
+ private void testRenderURLs() {
+
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "No parameters"));
+ assertNoRenderParametersSet();
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Add parameter p1=v1"));
+ assertRenderParametersSet(new Parameter("p1", "v1"));
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Copy parameters"));
+ assertRenderParametersSet(new Parameter("p1", "v1"));
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+ clickElement(driver, waitingAsserter,
+ BUTTON_LINK_XPATH_TEMPLATE.replace("{0}", "Copy parameters & add p2=v2"));
+ assertRenderParametersSet(new Parameter("p1", "v1"), new Parameter("p2", "v2"));
+ assertNoParametersSet("Action");
+ assertNoParametersSet("Resource");
+ }
+
+ private void assertNoParametersSet(String methodType, String parametersType) {
+
+ String parametersXpath = getParametersTableXpath(methodType, parametersType) + "/td";
+ waitingAsserter.assertTrue(or(not(presenceOfAllElementsLocatedBy(By.xpath(parametersXpath))),
+ invisibilityOfElementLocated(By.xpath(parametersXpath))));
+ }
+
+ private void assertNoParametersSet(String parametersType) {
+ assertNoParametersSet(parametersType, parametersType);
+ }
+
+ private void assertNoRenderParametersSet() {
+ assertNoParametersSet("Render");
+ assertNoParametersSet("Resource", "Render");
+ }
+
+ private void assertParametersSet(String methodType, String parametersType, Parameter... parameters) {
+
+ if (parameters.length == 0) {
+ throw new NullPointerException();
+ }
+
+ String parametersTableXpath = getParametersTableXpath(methodType, parametersType);
+
+ for (Parameter parameter : parameters) {
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(parametersTableXpath +
+ "//td[contains(text(),'" + parameter.name + "')]" +
+ "/following-sibling::td[contains(text(),'" + parameter.value + "')]")));
+ }
+ }
+
+ private void assertParametersSet(String parametersType, Parameter... parameters) {
+ assertParametersSet(parametersType, parametersType, parameters);
+ }
+
+ private void assertRenderParametersSet(Parameter... parameters) {
+ assertParametersSet("Render", parameters);
+ assertParametersSet("Resource", "Render", parameters);
+ }
+
+ private static String getParametersTableXpath(String methodType, String parametersType) {
+ return "//h4[contains(text(),'" + methodType + "')][contains(text(),'Method') or contains(text(),'method')]" +
+ "/following-sibling::h5[contains(text(),'" + parametersType + "')][contains(text(),'Parameters')]" +
+ "/following-sibling::table";
+ }
+
+ private static final class Parameter {
+
+ private final String name;
+ private final String value;
+
+ public Parameter(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+ }
+}
[16/22] portals-pluto git commit: PLUTO-733 Add Redirect Portlet Demo
test
Posted by as...@apache.org.
PLUTO-733 Add Redirect Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/60284928
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/60284928
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/60284928
Branch: refs/heads/master
Commit: 60284928355e0a8d4e41981a8097b897b9c6aea9
Parents: 9341939
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 12 16:58:02 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../src/main/webapp/WEB-INF/jsp/view-rdp.jsp | 2 +-
.../demo/integration/test/ChatRoomDemoIT.java | 10 ++--
.../demo/integration/test/PortletHubDemoIT.java | 23 ---------
.../demo/integration/test/RedirectDemoIT.java | 52 ++++++++++++++++++++
.../pluto/demo/integration/test/Util.java | 27 ++++++++++
5 files changed, 87 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/60284928/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
index 7e8d59b..4391f91 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/jsp/view-rdp.jsp
@@ -56,7 +56,7 @@ redirect.
</td></tr><tr><td>
Enter URL:
</td><td colspan=3>
- <input id='<portlet:namespace/>-msg' name='<%=PARAM_URL_INPUT%>' type='text' value='' size='50' maxlength='50'>
+ <input id='<portlet:namespace/>-msg' name='<%=PARAM_URL_INPUT%>' type='text' value=''>
</td></tr><tr><td>
<INPUT id ='<portlet:namespace/>-send' VALUE='redirect' TYPE='submit'>
</td></tr></table>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/60284928/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
index a2c1d51..fa963df 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
@@ -30,12 +30,16 @@ import static org.openqa.selenium.support.ui.ExpectedConditions.*;
* @author Kyle Stiemann
*/
public class ChatRoomDemoIT extends DemoTestDriver {
+
+ // Public Constants
+ public static final String CHAT_ROOM_DEMO_URL = baseUrl + Util.encodeURL("Chat Room Demo");
+
+ // Private Constants
private static final String CHAT_ROOM_PORTLET_NAMESPACE = "Pluto_chatRoomDemo_BeanPortletDemo";
@Test
public void testChatRoomDemos() throws UnsupportedEncodingException {
- String chatDemoURL = baseUrl + Util.encodeURL("Chat Room Demo");
- driver.get(chatDemoURL);
+ driver.get(CHAT_ROOM_DEMO_URL);
// 1. Clear any previous chat history.
clickElement(driver, waitingAsserter, "input", CHAT_ROOM_PORTLET_NAMESPACE, "clear");
@@ -45,7 +49,7 @@ public class ChatRoomDemoIT extends DemoTestDriver {
// 2. Open a new window/tab to the same page.
String originalWindowHandle = driver.getWindowHandle();
- executeScript(driver, "window.open('" + chatDemoURL + "');");
+ executeScript(driver, "window.open('" + CHAT_ROOM_DEMO_URL + "');");
// 3. In the current window/tab, add a user named "me".
// 4. Verify that an image appears for the user.
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/60284928/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
index 45155bc..070f2d9 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
@@ -37,8 +37,6 @@ import static org.openqa.selenium.support.ui.ExpectedConditions.*;
* @author Kyle Stiemann
*/
public class PortletHubDemoIT extends DemoTestDriver {
-
- private static final int COLOR_HEX_STRING_LENGTH = 2;
private static final String COLOR_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PH_ColorSelPortlet";
private static final String IMAGE_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_ImageSelPortlet";
private static final List<String> IMAGE_OPTIONS = Util.unmodifiableList("golfball", "baseball", "fussball");
@@ -176,27 +174,6 @@ public class PortletHubDemoIT extends DemoTestDriver {
attributeContains(messageOutputByXpath, "style", "color: " + colorCombo.getCSS_RGBString() + ";"))));
}
- private static ExpectedCondition<Boolean> backgroundColor(By locator, int red, int green, int blue) {
-
- String colorCode = "#" +
- getHexString(red, COLOR_HEX_STRING_LENGTH) +
- getHexString(green, COLOR_HEX_STRING_LENGTH) +
- getHexString(blue, COLOR_HEX_STRING_LENGTH);
-
- return and(visibilityOfElementLocated(locator),
- or(attributeContains(locator, "style", "background-color:" + colorCode + ";"),
- attributeContains(locator, "style",
- "background-color: rgb(" + red + ", " + green + ", " + blue + ");")));
- }
-
- private static String getHexString(int toHexValue, int stringLength) {
- return getZeroPaddedString(Integer.toHexString(toHexValue), stringLength);
- }
-
- private static String getZeroPaddedString(String string, int stringLength) {
- return String.format("%" + stringLength + "s", string).replace(" ", "0");
- }
-
private void handleColorCheckbox(String colorName, boolean colorSelected) {
WebElement colorCheckbox =
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/60284928/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/RedirectDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/RedirectDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/RedirectDemoIT.java
new file mode 100644
index 0000000..95b4b54
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/RedirectDemoIT.java
@@ -0,0 +1,52 @@
+/* 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 org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class RedirectDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testRedirectDemo() {
+ navigateToPage("V3.0 Misc Tests - redirect");
+ int red = 0xFF;
+ int green = 0x00;
+ int blue = 0x00;
+
+ String color = getColorCode(red, green, blue);
+ sendKeysToElement(driver, waitingAsserter, "//input[@name='color'][@type='text']", color);
+ clickElement(driver, waitingAsserter, "//input[@value='redirect'][@type='submit']");
+ waitingAsserter.assertTrue(backgroundColor(By.xpath("//h3[text()='V3 Redirect Portlet']/.."), red, green, blue));
+ sendKeysToElement(driver, waitingAsserter, "//input[@name='url'][@type='text']",
+ ChatRoomDemoIT.CHAT_ROOM_DEMO_URL);
+ clickElement(driver, waitingAsserter, "//input[@value='redirect'][@type='submit']");
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(
+ "//h3[contains(text(),'Hello')][contains(text(),'World')][contains(text(),'!!')]")));
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/60284928/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
index 5199e09..57d809b 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
@@ -35,6 +35,7 @@ import static org.openqa.selenium.support.ui.ExpectedConditions.*;
* @author Kyle Stiemann
*/
public final class Util {
+ private static final int COLOR_HEX_STRING_LENGTH = 2;
private Util() {
throw new AssertionError();
@@ -54,6 +55,18 @@ public final class Util {
return ((JavascriptExecutor)webDriver).executeScript(script, arguments);
}
+ public static String getColorCode(int red, int green, int blue) {
+
+ return "#" +
+ getHexString(red, COLOR_HEX_STRING_LENGTH) +
+ getHexString(green, COLOR_HEX_STRING_LENGTH) +
+ getHexString(blue, COLOR_HEX_STRING_LENGTH);
+ }
+
+ public static String getZeroPaddedString(String string, int stringLength) {
+ return String.format("%" + stringLength + "s", string).replace(" ", "0");
+ }
+
public static <T> List<T> unmodifiableList(T... items) {
return Collections.unmodifiableList(Arrays.asList(items));
}
@@ -63,6 +76,16 @@ public final class Util {
return or(attributeToBe(locator, attributeName, null), attributeToBe(locator, attributeName, ""));
}
+ public static ExpectedCondition<Boolean> backgroundColor(By locator, int red, int green, int blue) {
+
+ String colorCode = getColorCode(red, green, blue);
+
+ return and(visibilityOfElementLocated(locator),
+ or(attributeContains(locator, "style", "background-color:" + colorCode + ";"),
+ attributeContains(locator, "style",
+ "background-color: rgb(" + red + ", " + green + ", " + blue + ");")));
+ }
+
public static ExpectedCondition<Boolean> elementNotPresentOrNotVisible(By locator) {
return or(not(presenceOfAllElementsLocatedBy(locator)), invisibilityOfElementLocated(locator));
}
@@ -148,4 +171,8 @@ public final class Util {
boolean clearBeforeSendingKeys, String elementXpath, CharSequence... keys) {
sendKeysToElement(webDriver, waitingAsserter, clearBeforeSendingKeys, By.xpath(elementXpath), keys);
}
+
+ private static String getHexString(int toHexValue, int stringLength) {
+ return getZeroPaddedString(Integer.toHexString(toHexValue), stringLength);
+ }
}
[21/22] portals-pluto git commit: PLUTO-733 Allow tests to be run in
Liferay
Posted by as...@apache.org.
PLUTO-733 Allow tests to be run in Liferay
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/71d740a6
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/71d740a6
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/71d740a6
Branch: refs/heads/master
Commit: 71d740a612706fdc6db24cbb9fafbe71298af0fc
Parents: 5e5ff90
Author: Kyle Stiemann <st...@gmail.com>
Authored: Fri Oct 19 11:28:43 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../src/main/webapp/WEB-INF/liferay-portlet.xml | 1 +
.../java/basic/portlet/ParamTestPortlet.java | 4 +-
.../java/basic/portlet/UrlAPTestPortlet.java | 12 +++---
.../java/basic/portlet/UrlRPTestPortlet.java | 4 +-
.../main/java/basic/portlet/UrlTestPortlet.java | 20 ++++-----
.../src/main/webapp/WEB-INF/liferay-portlet.xml | 4 ++
demo-integration-tests/pom.xml | 2 +
.../demo/integration/test/ChatRoomDemoIT.java | 16 +++----
.../demo/integration/test/DependencyDemoIT.java | 4 +-
.../test/FragmentIdentifierDemoIT.java | 2 +-
.../test/ParameterPortletsDemoBase.java | 2 +-
.../demo/integration/test/PortletHubDemoIT.java | 45 ++++++++++----------
.../demo/integration/test/StatusCodeDemoIT.java | 2 +-
.../pluto/demo/integration/test/Util.java | 16 +++++--
14 files changed, 72 insertions(+), 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/liferay-portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/liferay-portlet.xml b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/liferay-portlet.xml
index 132e560..19bf0f7 100644
--- a/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/liferay-portlet.xml
+++ b/PortletV3AnnotatedDemo/src/main/webapp/WEB-INF/liferay-portlet.xml
@@ -26,6 +26,7 @@
</portlet>
<portlet>
<portlet-name>BeanPortlet</portlet-name>
+ <instanceable>true</instanceable>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
</portlet>
<portlet>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3Demo/src/main/java/basic/portlet/ParamTestPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ParamTestPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ParamTestPortlet.java
index 4fbd043..5d0d1da 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/ParamTestPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/ParamTestPortlet.java
@@ -87,7 +87,7 @@ public class ParamTestPortlet extends GenericPortlet {
StringBuilder txt = new StringBuilder();
txt.append("<h3>Currently set render parameters:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : pnSet) {
@@ -106,7 +106,7 @@ public class ParamTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.setAttribute(ATTRIB_PARAMS, txt.toString());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3Demo/src/main/java/basic/portlet/UrlAPTestPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/UrlAPTestPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/UrlAPTestPortlet.java
index 0ab4134..ce4301f 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/UrlAPTestPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/UrlAPTestPortlet.java
@@ -94,7 +94,7 @@ public class UrlAPTestPortlet extends GenericPortlet {
StringBuilder txt = new StringBuilder();
txt.append("<h3>Currently set render parameters:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : pnSet) {
@@ -116,7 +116,7 @@ public class UrlAPTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.setAttribute(ATTRIB_PARAMS, txt.toString());
@@ -328,7 +328,7 @@ public class UrlAPTestPortlet extends GenericPortlet {
String style = "style='min-width: 100px;'";
txt.append("<h3>Render parameters for the last ActionRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
if (mrp.isEmpty()) {
txt.append("Render parameters is empty.");
} else {
@@ -353,10 +353,10 @@ public class UrlAPTestPortlet extends GenericPortlet {
txt.append(" </table>");
}
- txt.append("</p>\n");
+ txt.append("</div>\n");
txt.append("<h3>Action parameters for the last ActionRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
if (ap.isEmpty()) {
txt.append("Action parameters is empty.");
} else {
@@ -378,7 +378,7 @@ public class UrlAPTestPortlet extends GenericPortlet {
txt.append(" </table>");
}
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.getPortletSession().setAttribute(ATTRIB_ACTPARAMS, txt.toString());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3Demo/src/main/java/basic/portlet/UrlRPTestPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/UrlRPTestPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/UrlRPTestPortlet.java
index 2b9e472..10699db 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/UrlRPTestPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/UrlRPTestPortlet.java
@@ -102,7 +102,7 @@ public class UrlRPTestPortlet extends GenericPortlet {
StringBuilder txt = new StringBuilder();
txt.append("<h3>Currently set render parameters:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : pnSet) {
@@ -124,7 +124,7 @@ public class UrlRPTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.setAttribute(ATTRIB_PARAMS, txt.toString());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java b/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
index 67be574..8b434ff 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/UrlTestPortlet.java
@@ -97,7 +97,7 @@ public class UrlTestPortlet extends GenericPortlet {
StringBuilder txt = new StringBuilder();
txt.append("<h3>Currently set render parameters:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : pnSet) {
@@ -116,7 +116,7 @@ public class UrlTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.setAttribute(ATTRIB_PARAMS, txt.toString());
@@ -240,7 +240,7 @@ public class UrlTestPortlet extends GenericPortlet {
String style = "style='min-width: 100px;'";
txt.append("<h3>Render parameters for the ResourceRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
// don't display the control parameters
@@ -261,10 +261,10 @@ public class UrlTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
txt.append("<h3>Resource parameters for the ResourceRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : rsp.getNames()) {
@@ -282,7 +282,7 @@ public class UrlTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
writer.write(txt.toString());
}
@@ -311,7 +311,7 @@ public class UrlTestPortlet extends GenericPortlet {
String style = "style='min-width: 100px;'";
txt.append("<h3>Render parameters for the last ActionRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
// don't display the control parameters
@@ -332,10 +332,10 @@ public class UrlTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
txt.append("<h3>Action parameters for the last ActionRequest:</h3>\n");
- txt.append("<p>\n");
+ txt.append("<div>\n");
txt.append(" <table>");
for (String pn : ap.getNames()) {
@@ -353,7 +353,7 @@ public class UrlTestPortlet extends GenericPortlet {
}
txt.append(" </table>");
- txt.append("</p>\n");
+ txt.append("</div>\n");
req.getPortletSession().setAttribute(ATTRIB_ACTPARAMS, txt.toString());
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/PortletV3Demo/src/main/webapp/WEB-INF/liferay-portlet.xml
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/webapp/WEB-INF/liferay-portlet.xml b/PortletV3Demo/src/main/webapp/WEB-INF/liferay-portlet.xml
index 263da12..d7788a5 100644
--- a/PortletV3Demo/src/main/webapp/WEB-INF/liferay-portlet.xml
+++ b/PortletV3Demo/src/main/webapp/WEB-INF/liferay-portlet.xml
@@ -46,6 +46,10 @@
<requires-namespaced-parameters>false</requires-namespaced-parameters>
</portlet>
<portlet>
+ <portlet-name>PortletConfigPortlet2</portlet-name>
+ <requires-namespaced-parameters>false</requires-namespaced-parameters>
+ </portlet>
+ <portlet>
<portlet-name>TagLibPortlet</portlet-name>
<single-page-application>false</single-page-application>
<requires-namespaced-parameters>false</requires-namespaced-parameters>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/demo-integration-tests/pom.xml b/demo-integration-tests/pom.xml
index 65ab75d..74874dc 100644
--- a/demo-integration-tests/pom.xml
+++ b/demo-integration-tests/pom.xml
@@ -18,6 +18,7 @@
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
+ <relativePath>../pom.xml</relativePath>
<groupId>org.apache.portals.pluto</groupId>
<artifactId>pluto</artifactId>
<version>3.0.2-SNAPSHOT</version>
@@ -245,6 +246,7 @@
<properties>
<test.portal.name>Liferay</test.portal.name>
<test.server.login.url>http://${test.server.host}:${test.server.port}/group/pluto-demos</test.server.login.url>
+ <test.context.base>web/guest/</test.context.base>
</properties>
</profile>
<profile>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
index fa963df..b21a8e7 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ChatRoomDemoIT.java
@@ -34,17 +34,14 @@ public class ChatRoomDemoIT extends DemoTestDriver {
// Public Constants
public static final String CHAT_ROOM_DEMO_URL = baseUrl + Util.encodeURL("Chat Room Demo");
- // Private Constants
- private static final String CHAT_ROOM_PORTLET_NAMESPACE = "Pluto_chatRoomDemo_BeanPortletDemo";
-
@Test
public void testChatRoomDemos() throws UnsupportedEncodingException {
driver.get(CHAT_ROOM_DEMO_URL);
// 1. Clear any previous chat history.
- clickElement(driver, waitingAsserter, "input", CHAT_ROOM_PORTLET_NAMESPACE, "clear");
+ clickElement(driver, waitingAsserter, "input", "chatRoomDemo", "BeanPortletDemo", "clear");
- String chatHistoryXpath = "(" + getXpath("div", CHAT_ROOM_PORTLET_NAMESPACE, "chatHistory") + ")[1]";
+ String chatHistoryXpath = "(" + getXpath("div", "chatRoomDemo", "BeanPortletDemo", "chatHistory") + ")[1]";
waitingAsserter.assertTrue(textEmpty(By.xpath(chatHistoryXpath)));
// 2. Open a new window/tab to the same page.
@@ -84,18 +81,17 @@ public class ChatRoomDemoIT extends DemoTestDriver {
}
// See #3 and #9.
- String formXpath = getXpath("form", CHAT_ROOM_PORTLET_NAMESPACE, "setParams");
+ String formXpath = getXpath("form", "chatRoomDemo", "BeanPortletDemo", "setParams");
sendKeysToElement(driver, waitingAsserter, "(" + formXpath + "//input[@name='name'])[1]", name);
clickElement(driver, waitingAsserter, "(" + formXpath + "//input[@value='send'][@type='submit'])[1]");
// See #4 and #10.
- waitingAsserter.assertTrue(elementToBeClickable(By.xpath(
- getXpath("div", CHAT_ROOM_PORTLET_NAMESPACE, "image") + "/img")));
+ waitingAsserter.assertTrue(elementToBeClickable(By.xpath(getXpath("div", "chatRoomDemo", "BeanPortletDemo", "image") + "/img")));
// See #5 and #11.
- String messageInputXpath = "(" + getXpath("input", CHAT_ROOM_PORTLET_NAMESPACE, "msg") + ")[1]";
+ String messageInputXpath = "(" + getXpath("input", "chatRoomDemo", "BeanPortletDemo", "msg") + ")[1]";
sendKeysToElement(driver, waitingAsserter, messageInputXpath, message);
- clickElement(driver, waitingAsserter, "input", CHAT_ROOM_PORTLET_NAMESPACE, "send");
+ clickElement(driver, waitingAsserter, "input", "chatRoomDemo", "BeanPortletDemo", "send");
// See #6 and #12.
assertMessageVisible(chatHistoryMessageByXpath, name, message);
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
index 01ba4c2..c847207 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DependencyDemoIT.java
@@ -56,8 +56,8 @@ public class DependencyDemoIT extends DemoTestDriver{
versionRadioButtons.get(i).click();
clickElement(driver, waitingAsserter,
By.xpath("//button[contains(text(),'render with selected version')]"));
- clickElement(driver, waitingAsserter, "button", "Pluto_PortletV3Demo_DependencyPortlet", "button");
- By versionTextByXpath = By.xpath(getXpath("p", "Pluto_PortletV3Demo_DependencyPortlet", "fadeText") +
+ clickElement(driver, waitingAsserter, "button", "PortletV3Demo", "DependencyPortlet", "button");
+ By versionTextByXpath = By.xpath(getXpath("p", "PortletV3Demo", "DependencyPortlet", "fadeText") +
"[text()]");
waitingAsserter.assertTrue(and(visibilityOfElementLocated(versionTextByXpath),
textToBe(versionTextByXpath, "jQuery version: " + expectedVersion)));
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
index 8aa5747..d86a417 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/FragmentIdentifierDemoIT.java
@@ -40,7 +40,7 @@ public class FragmentIdentifierDemoIT extends DemoTestDriver {
sendKeysToElement(driver, waitingAsserter, "//input[@name='frag'][@type='text']", fragmentId);
sendKeysToElement(driver, waitingAsserter, "//input[@name='line'][@type='text']", "3");
clickElement(driver, waitingAsserter,
- "//input[contains(@id,'Pluto_PortletV3Demo_LongPortlet')][@value='send'][@type='submit']");
+ "//input[contains(@id,'PortletV3Demo')][contains(@id,'LongPortlet')][@value='send'][@type='submit']");
clickElement(driver, waitingAsserter, "//a[text()='Jump to line 3']");
waitingAsserter.assertTrue(new ExpectedCondition<Boolean>() {
@Override
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/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
index 57d2a5a..f4c1022 100644
--- 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
@@ -211,7 +211,7 @@ public class ParameterPortletsDemoBase extends DemoTestDriver {
stringBuilder.append("]");
- return getXpath(stringBuilder.toString(), portletNumber) + "/following-sibling::p/table";
+ return getXpath(stringBuilder.toString(), portletNumber) + "/following-sibling::div/table";
}
protected static String getXpath(String xpath, int portletNumber) {
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
index 070f2d9..bc74d73 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
@@ -26,10 +26,10 @@ import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.Keys;
-import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.Select;
import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import org.openqa.selenium.JavascriptExecutor;
import static org.openqa.selenium.support.ui.ExpectedConditions.*;
/**
@@ -37,15 +37,10 @@ import static org.openqa.selenium.support.ui.ExpectedConditions.*;
* @author Kyle Stiemann
*/
public class PortletHubDemoIT extends DemoTestDriver {
- private static final String COLOR_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PH_ColorSelPortlet";
- private static final String IMAGE_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_ImageSelPortlet";
private static final List<String> IMAGE_OPTIONS = Util.unmodifiableList("golfball", "baseball", "fussball");
- private static final String MESSAGE_BOX_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_MessageBoxPortlet";
- private static final String PARTIAL_ACTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PartialActionPortlet";
- private static final String RESOURCE_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PH_ResourcePortlet_PRP";
private static final String TOKEN = "{0}";
private static final String IMAGE_XPATH_TEMPLATE =
- "//img[@src='/PortletHubDemo/resources/images/" + TOKEN + ".gif']";
+ "//img[contains(@src,'/PortletHubDemo/resources/images/" + TOKEN + ".gif')]";
@Test
public void testPortletHubDemo() throws UnsupportedEncodingException {
@@ -58,15 +53,15 @@ public class PortletHubDemoIT extends DemoTestDriver {
for (String imageName : IMAGE_OPTIONS) {
clickElement(driver, waitingAsserter,
- getXpath("div", IMAGE_SELECTION_PORTLET_NAMESPACE) + "/input[@value='" + imageName + "']");
+ getXpath("div", "PortletHubDemo", "ImageSelPortlet") + "/input[@value='" + imageName + "']");
waitingAsserter.assertTrue(elementNotPresentOrNotVisible(imageByXpath));
imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, imageName + "-trans"));
waitingAsserter.assertTrue(visibilityOfElementLocated(imageByXpath));
}
// Verify that all the different images appear when clicking each dropdown option.
- clickElement(driver, waitingAsserter, "input", IMAGE_SELECTION_PORTLET_NAMESPACE, "dropdown");
- By imageSelectByXpath = By.xpath(getXpath("select", IMAGE_SELECTION_PORTLET_NAMESPACE) + "[@name='imgName']");
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "ImageSelPortlet", "dropdown");
+ By imageSelectByXpath = By.xpath(getXpath("select", "PortletHubDemo", "ImageSelPortlet") + "[@name='imgName']");
waitingAsserter.waitFor(elementToBeClickable(imageSelectByXpath));
Select select = new Select(driver.findElement(imageSelectByXpath));
select.selectByValue("default");
@@ -84,14 +79,14 @@ public class PortletHubDemoIT extends DemoTestDriver {
// Verify that the border checkbox shows and hides the border on the image.
waitingAsserter.assertTrue(and(visibilityOfElementLocated(imageByXpath), attributeEmpty(imageByXpath, "style")));
- clickElement(driver, waitingAsserter, "input", RESOURCE_PORTLET_NAMESPACE, "border");
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "PH", "ResourcePortlet", "PRP", "border");
waitingAsserter.assertTrue(and(visibilityOfElementLocated(imageByXpath),
attributeContains(imageByXpath, "style", "border:")));
// Verify that the different cacheability radion buttons change the visible cacheability text.
String cacheabilityRadioButtonXpathTemplate =
- getXpath("input", RESOURCE_PORTLET_NAMESPACE) + "[@value='" + TOKEN + "']";
- String resourcePortletDivXpath = getXpath("div", RESOURCE_PORTLET_NAMESPACE);
+ getXpath("input", "PortletHubDemo", "PH", "ResourcePortlet", "PRP") + "[@value='" + TOKEN + "']";
+ String resourcePortletDivXpath = getXpath("div", "PortletHubDemo", "PH", "ResourcePortlet", "PRP");
By actionButtonByXpath = By.xpath(resourcePortletDivXpath + "//input[@value='Action']");
for (String cacheability : Util.unmodifiableList("Portlet", "Full", "Page")) {
@@ -119,11 +114,15 @@ public class PortletHubDemoIT extends DemoTestDriver {
waitingAsserter.assertTrue(visibilityOfElementLocated(actionButtonByXpath));
// Verify the background color changes.
+ navigateToPage("V3.0 Portlet Hub Demo");
+ ((JavascriptExecutor)driver).executeScript("window.scrollTo(0,document.body.scrollHeight);");
+
By coloredTableByXpath =
- By.xpath(getXpath("div", RESOURCE_PORTLET_NAMESPACE, "putResourceHere") + "//table[@style]");
+ By.xpath(getXpath("div", "PortletHubDemo", "PH", "ResourcePortlet", "PRP", "putResourceHere") +
+ "//table[@style]");
waitingAsserter.assertTrue(and(visibilityOfElementLocated(coloredTableByXpath),
backgroundColor(coloredTableByXpath, 0xFF, 0xFF, 0xFF)));
- String colorInputXpath = getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, "color");
+ String colorInputXpath = getXpath("input", "PortletHubDemo", "PH", "ColorSelPortlet", "color");
sendKeysToElement(driver, waitingAsserter, colorInputXpath, "#FF0000", Keys.ENTER);
waitingAsserter.assertTrue(and(visibilityOfElementLocated(coloredTableByXpath),
backgroundColor(coloredTableByXpath, 0xFF, 0, 0)));
@@ -134,21 +133,21 @@ public class PortletHubDemoIT extends DemoTestDriver {
for (ColorCombo colorCombo : ColorCombo.getAllPossibleCombos()) {
String lowerCaseFormSubmissionMethod = formSubmissionMethod.toLowerCase(Locale.ENGLISH);
- clickElement(driver, waitingAsserter, "input", COLOR_SELECTION_PORTLET_NAMESPACE,
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "PH", "ColorSelPortlet",
lowerCaseFormSubmissionMethod);
testMessageSent(colorCombo);
}
- clickElement(driver, waitingAsserter, "input", MESSAGE_BOX_PORTLET_NAMESPACE, "clear");
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "MessageBoxPortlet", "clear");
}
// Click the Do Partial Action button and check that the reponse text appears.
- By responseDivByXpath = By.xpath(getXpath("div", PARTIAL_ACTION_PORTLET_NAMESPACE, "responseDiv"));
+ By responseDivByXpath = By.xpath(getXpath("div", "PortletHubDemo", "PartialActionPortlet", "responseDiv"));
waitingAsserter.assertTrue(textEmpty(responseDivByXpath));
for (int i = 1; i <= 10; i++) {
- clickElement(driver, waitingAsserter, "input", PARTIAL_ACTION_PORTLET_NAMESPACE, "doPA");
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "PartialActionPortlet", "doPA");
waitingAsserter.assertTrue(and(visibilityOfElementLocated(responseDivByXpath),
textToBePresentInElementLocated(responseDivByXpath,
"Partial Action has been executed " + i + " times.")));
@@ -161,13 +160,13 @@ public class PortletHubDemoIT extends DemoTestDriver {
handleColorCheckbox("green", colorCombo.isGreenSelected());
handleColorCheckbox("blue", colorCombo.isBlueSelected());
- String messageInputXpath = getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, "msg");
+ String messageInputXpath = getXpath("input", "PortletHubDemo", "PH", "ColorSelPortlet", "msg");
String message = colorCombo.getHexString();
sendKeysToElement(driver, waitingAsserter, messageInputXpath, message);
- clickElement(driver, waitingAsserter, "input", COLOR_SELECTION_PORTLET_NAMESPACE, "send");
+ clickElement(driver, waitingAsserter, "input", "PortletHubDemo", "PH", "ColorSelPortlet", "send");
By messageOutputByXpath =
- By.xpath(getXpath("div", MESSAGE_BOX_PORTLET_NAMESPACE, "responseDiv") +
+ By.xpath(getXpath("div", "PortletHubDemo", "MessageBoxPortlet", "responseDiv") +
"/p[contains(text(),'" + colorCombo.getIndex() + ": " + message + "')]");
waitingAsserter.assertTrue(and(visibilityOfElementLocated(messageOutputByXpath),
or(attributeContains(messageOutputByXpath, "style", "color:#" + message + ";"),
@@ -177,7 +176,7 @@ public class PortletHubDemoIT extends DemoTestDriver {
private void handleColorCheckbox(String colorName, boolean colorSelected) {
WebElement colorCheckbox =
- driver.findElement(By.xpath(getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, colorName)));
+ driver.findElement(By.xpath(getXpath("input", "PortletHubDemo", "PH", "ColorSelPortlet", colorName)));
if ((colorSelected && !colorCheckbox.isSelected()) || (!colorSelected && colorCheckbox.isSelected())) {
colorCheckbox.click();
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
index 3efaa0e..2854d0a 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/StatusCodeDemoIT.java
@@ -38,7 +38,7 @@ public class StatusCodeDemoIT extends DemoTestDriver {
navigateToPage("V3.0 Misc Tests - HTTP SC, fragment id");
sendKeysToElement(driver, waitingAsserter, "//input[@name='statusCode'][@type='text']", statusCode);
clickElement(driver, waitingAsserter,
- "//input[contains(@id,'Pluto_PortletV3Demo_AuthSCPortlet')][@value='send'][@type='submit']");
+ "//input[contains(@id,'PortletV3Demo')][contains(@id,'AuthSCPortlet')][@value='send'][@type='submit']");
clickElement(driver, waitingAsserter, "//a[text()='Resource URL, status code = " + statusCode + "']");
waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(
"//p[contains(text(),'Status code: " + statusCode + "')]")));
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/71d740a6/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
index 57d809b..79087f3 100644
--- a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
@@ -23,6 +23,7 @@ import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import java.util.Locale;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
@@ -43,11 +44,18 @@ public final class Util {
public static String encodeURL(String url) {
- try {
- return URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
+ String portalName = System.getProperty("test.portal.name", "Pluto");
+
+ if ("Pluto".equalsIgnoreCase(portalName)) {
+ try {
+ return URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new RuntimeException(e);
+ }
}
- catch (UnsupportedEncodingException e) {
- throw new RuntimeException(e);
+ else {
+ return url.replace(" ", "-").toLowerCase(Locale.ENGLISH);
}
}
[13/22] portals-pluto git commit: PLUTO-733 Fix namepace usage
Posted by as...@apache.org.
PLUTO-733 Fix namepace usage
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/de7db481
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/de7db481
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/de7db481
Branch: refs/heads/master
Commit: de7db481ae0865d4559f0acb82a0b6b903970a6c
Parents: cdd72b3
Author: Kyle Stiemann <st...@gmail.com>
Authored: Thu Oct 11 11:35:37 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:30 2018 -0400
----------------------------------------------------------------------
PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java | 3 ++-
PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/de7db481/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
----------------------------------------------------------------------
diff --git a/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java b/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
index a640f54..e472247 100644
--- a/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
+++ b/PortletHubDemo/src/main/java/basic/portlet/ResourcePortlet.java
@@ -137,7 +137,8 @@ public class ResourcePortlet extends GenericPortlet {
aurl = resp.createActionURL();
} catch (Exception e) {}
if (aurl != null) {
- bmu = "<form METHOD='POST' ACTION='" + aurl + "'><input id='<portlet:namespace/>-clear' type='submit' name='action' value='Action' /></form>";
+ bmu = "<form METHOD='POST' ACTION='" + aurl + "'>" +
+ "<input id='" + resp.getNamespace() + "-clear' type='submit' name='action' value='Action' /></form>";
}
writer.write("<div style='background-color:" + clr + ";'>\n");
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/de7db481/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
----------------------------------------------------------------------
diff --git a/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
index 7985b41..da0a747 100644
--- a/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
+++ b/PortletV3Demo/src/main/java/basic/portlet/ResourcePortlet.java
@@ -107,7 +107,8 @@ public class ResourcePortlet extends GenericPortlet {
aurl = resp.createActionURL();
} catch (Exception e) {}
if (aurl != null) {
- bmu = "<form METHOD='POST' ACTION='" + aurl + "'><input id='<portlet:namespace/>-clear' type='submit' name='action' value='Action' /></form>";
+ bmu = "<form METHOD='POST' ACTION='" + aurl + "'>" +
+ "<input id='" + resp.getNamespace() + "-clear' type='submit' name='action' value='Action' /></form>";
}
writer.write("<div style='background-color:" + clr + ";'>\n");
[14/22] portals-pluto git commit: PLUTO-733 Add Tag Library Portlet
Demo test
Posted by as...@apache.org.
PLUTO-733 Add Tag Library Portlet Demo test
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/e97af80a
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/e97af80a
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/e97af80a
Branch: refs/heads/master
Commit: e97af80ae68c63d53b2d365784ef168e2e9b0c9d
Parents: 1df4459
Author: Kyle Stiemann <st...@gmail.com>
Authored: Sat Oct 13 00:06:32 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:48:31 2018 -0400
----------------------------------------------------------------------
.../demo/integration/test/TagLibDemoIT.java | 430 +++++++++++++++++++
1 file changed, 430 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/e97af80a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibDemoIT.java
new file mode 100644
index 0000000..1872f2b
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/TagLibDemoIT.java
@@ -0,0 +1,430 @@
+/* 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 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 TagLibDemoIT extends DemoTestDriver {
+
+ @Test
+ public void testTagLibDemo() {
+ navigateToPage("Tag Library");
+
+ clickElement(driver, waitingAsserter, "//input[@value='render'][@type='radio']");
+ clickElement(driver, waitingAsserter, "//input[@value='obj'][@type='radio']");
+
+ String executeButtonXpath = "//button[text()='Execute'][@type='submit']";
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "true");
+ assertTextVisible("resourceRequest", "false");
+ assertTextVisible("actionRequest", "false");
+ assertTextVisible("eventRequest", "false");
+ assertTextVisible("renderResponse", "true");
+ assertTextVisible("resourceResponse", "false");
+ assertTextVisible("actionResponse", "false");
+ assertTextVisible("eventResponse", "false");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "true");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "true");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "false");
+ assertTextVisible("headerResponse", "false");
+ assertTextVisible("clientDataRequest", "false");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "false");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "false");
+ assertTextVisible("resourceParams", "false");
+ assertTextVisible("actionParams", "false");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "true");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='bean'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "true");
+ assertTextVisible("resourceRequest", "undefined");
+ assertTextVisible("actionRequest", "undefined");
+ assertTextVisible("eventRequest", "undefined");
+ assertTextVisible("renderResponse", "true");
+ assertTextVisible("resourceResponse", "undefined");
+ assertTextVisible("actionResponse", "undefined");
+ assertTextVisible("eventResponse", "undefined");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "false");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "false");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "undefined");
+ assertTextVisible("headerResponse", "undefined");
+ assertTextVisible("clientDataRequest", "undefined");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "undefined");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "undefined");
+ assertTextVisible("resourceParams", "undefined");
+ assertTextVisible("actionParams", "undefined");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "false");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='header'][@type='radio']");
+ clickElement(driver, waitingAsserter, "//input[@value='obj'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "false");
+ assertTextVisible("resourceRequest", "false");
+ assertTextVisible("actionRequest", "false");
+ assertTextVisible("eventRequest", "false");
+ assertTextVisible("renderResponse", "false");
+ assertTextVisible("resourceResponse", "false");
+ assertTextVisible("actionResponse", "false");
+ assertTextVisible("eventResponse", "false");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "true");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "true");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "true");
+ assertTextVisible("headerResponse", "true");
+ assertTextVisible("clientDataRequest", "false");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "false");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "false");
+ assertTextVisible("resourceParams", "false");
+ assertTextVisible("actionParams", "false");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "true");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='bean'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "undefined");
+ assertTextVisible("resourceRequest", "undefined");
+ assertTextVisible("actionRequest", "undefined");
+ assertTextVisible("eventRequest", "undefined");
+ assertTextVisible("renderResponse", "undefined");
+ assertTextVisible("resourceResponse", "undefined");
+ assertTextVisible("actionResponse", "undefined");
+ assertTextVisible("eventResponse", "undefined");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "false");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "false");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "true");
+ assertTextVisible("headerResponse", "true");
+ assertTextVisible("clientDataRequest", "undefined");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "undefined");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "undefined");
+ assertTextVisible("resourceParams", "undefined");
+ assertTextVisible("actionParams", "undefined");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "false");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='resource'][@type='radio']");
+ clickElement(driver, waitingAsserter, "//input[@value='obj'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "false");
+ assertTextVisible("resourceRequest", "true");
+ assertTextVisible("actionRequest", "false");
+ assertTextVisible("eventRequest", "false");
+ assertTextVisible("renderResponse", "false");
+ assertTextVisible("resourceResponse", "true");
+ assertTextVisible("actionResponse", "false");
+ assertTextVisible("eventResponse", "false");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "true");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "true");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "false");
+ assertTextVisible("headerResponse", "false");
+ assertTextVisible("clientDataRequest", "true");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "false");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "false");
+ assertTextVisible("resourceParams", "false");
+ assertTextVisible("actionParams", "false");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "true");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='bean'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "undefined");
+ assertTextVisible("resourceRequest", "true");
+ assertTextVisible("actionRequest", "undefined");
+ assertTextVisible("eventRequest", "undefined");
+ assertTextVisible("renderResponse", "undefined");
+ assertTextVisible("resourceResponse", "true");
+ assertTextVisible("actionResponse", "undefined");
+ assertTextVisible("eventResponse", "undefined");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "false");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "false");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "undefined");
+ assertTextVisible("headerResponse", "undefined");
+ assertTextVisible("clientDataRequest", "true");
+ assertTextVisible("mimeResponse", "true");
+ assertTextVisible("stateAwareResponse", "undefined");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "undefined");
+ assertTextVisible("resourceParams", "true");
+ assertTextVisible("actionParams", "undefined");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "false");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='action'][@type='radio']");
+ clickElement(driver, waitingAsserter, "//input[@value='obj'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "false");
+ assertTextVisible("resourceRequest", "false");
+ assertTextVisible("actionRequest", "true");
+ assertTextVisible("eventRequest", "false");
+ assertTextVisible("renderResponse", "false");
+ assertTextVisible("resourceResponse", "false");
+ assertTextVisible("actionResponse", "true");
+ assertTextVisible("eventResponse", "false");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "true");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "true");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "false");
+ assertTextVisible("headerResponse", "false");
+ assertTextVisible("clientDataRequest", "true");
+ assertTextVisible("mimeResponse", "false");
+ assertTextVisible("stateAwareResponse", "true");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "true");
+ assertTextVisible("resourceParams", "false");
+ assertTextVisible("actionParams", "false");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "true");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='bean'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "undefined");
+ assertTextVisible("resourceRequest", "undefined");
+ assertTextVisible("actionRequest", "true");
+ assertTextVisible("eventRequest", "undefined");
+ assertTextVisible("renderResponse", "undefined");
+ assertTextVisible("resourceResponse", "undefined");
+ assertTextVisible("actionResponse", "true");
+ assertTextVisible("eventResponse", "undefined");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "false");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "false");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "undefined");
+ assertTextVisible("headerResponse", "undefined");
+ assertTextVisible("clientDataRequest", "true");
+ assertTextVisible("mimeResponse", "undefined");
+ assertTextVisible("stateAwareResponse", "true");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "true");
+ assertTextVisible("resourceParams", "undefined");
+ assertTextVisible("actionParams", "true");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "false");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='event'][@type='radio']");
+ clickElement(driver, waitingAsserter, "//input[@value='obj'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "false");
+ assertTextVisible("resourceRequest", "false");
+ assertTextVisible("actionRequest", "false");
+ assertTextVisible("eventRequest", "true");
+ assertTextVisible("renderResponse", "false");
+ assertTextVisible("resourceResponse", "false");
+ assertTextVisible("actionResponse", "false");
+ assertTextVisible("eventResponse", "true");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "true");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "true");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "false");
+ assertTextVisible("headerResponse", "false");
+ assertTextVisible("clientDataRequest", "false");
+ assertTextVisible("mimeResponse", "false");
+ assertTextVisible("stateAwareResponse", "true");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "true");
+ assertTextVisible("resourceParams", "false");
+ assertTextVisible("actionParams", "false");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "true");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+
+ clickElement(driver, waitingAsserter, "//input[@value='bean'][@type='radio']");
+ clickElement(driver, waitingAsserter, executeButtonXpath);
+
+ assertTextVisible("renderRequest", "undefined");
+ assertTextVisible("resourceRequest", "undefined");
+ assertTextVisible("actionRequest", "undefined");
+ assertTextVisible("eventRequest", "true");
+ assertTextVisible("renderResponse", "undefined");
+ assertTextVisible("resourceResponse", "undefined");
+ assertTextVisible("actionResponse", "undefined");
+ assertTextVisible("eventResponse", "true");
+ assertTextVisible("portletConfig", "true");
+ assertTextVisible("portletSession", "true");
+ assertTextVisible("portletSessionScope", "false");
+ assertTextVisible("portletPreferences", "true");
+ assertTextVisible("portletPreferencesValues", "false");
+ assertTextVisible("portletRequest", "true");
+ assertTextVisible("portletResponse", "true");
+ assertTextVisible("headerRequest", "undefined");
+ assertTextVisible("headerResponse", "undefined");
+ assertTextVisible("clientDataRequest", "undefined");
+ assertTextVisible("mimeResponse", "undefined");
+ assertTextVisible("stateAwareResponse", "true");
+ assertTextVisible("renderParams", "true");
+ assertTextVisible("mutableRenderParams", "true");
+ assertTextVisible("resourceParams", "undefined");
+ assertTextVisible("actionParams", "undefined");
+ assertTextVisible("portletContext", "true");
+ assertTextVisible("portletMode", "true");
+ assertTextVisible("windowState", "true");
+ assertTextVisible("cookies", "true");
+ assertTextVisible("locale", "false");
+ assertTextVisible("locales", "true");
+ assertTextVisible("namespace", "true");
+ assertTextVisible("contextPath", "true");
+ assertTextVisible("windowId", "true");
+ assertTextVisible("portletName", "true");
+ }
+
+ private void assertTextVisible(String pageObject, String isPresent) {
+ waitingAsserter.assertTrue(visibilityOfAllElementsLocatedBy(By.xpath(
+ "//td[contains(text(),'" + pageObject + "')]" +
+ "/following-sibling::td[contains(text(),'" + isPresent + "')]")));
+ }
+}
[03/22] portals-pluto git commit: PLUTO-733 Author Selenium-based
tests for the Pluto V3 demos (create test utilities and add test for the
Portlet Hub Demo)
Posted by as...@apache.org.
PLUTO-733 Author Selenium-based tests for the Pluto V3 demos (create test utilities and add test for the Portlet Hub Demo)
Project: http://git-wip-us.apache.org/repos/asf/portals-pluto/repo
Commit: http://git-wip-us.apache.org/repos/asf/portals-pluto/commit/5ea95519
Tree: http://git-wip-us.apache.org/repos/asf/portals-pluto/tree/5ea95519
Diff: http://git-wip-us.apache.org/repos/asf/portals-pluto/diff/5ea95519
Branch: refs/heads/master
Commit: 5ea955196d6cda5be1cc715ecf31d5fd8b08a5bd
Parents: fc7000d
Author: Kyle Stiemann <st...@gmail.com>
Authored: Tue Oct 9 16:34:06 2018 -0400
Committer: Neil Griffin <ne...@gmail.com>
Committed: Thu Oct 25 15:47:28 2018 -0400
----------------------------------------------------------------------
demo-integration-tests/pom.xml | 342 ++++
.../demo/integration/test/DemoTestDriver.java | 35 +
.../demo/integration/test/ElementEnabled.java | 57 +
.../demo/integration/test/PortletHubDemoIT.java | 301 ++++
.../pluto/demo/integration/test/Util.java | 140 ++
.../demo/integration/test/WaitingAsserter.java | 49 +
pom.xml | 1558 +++++++++---------
portlet-tck_3.0/driver/pom.xml | 5 +
.../tck/driver/TCKLiferayTestDriver.java | 22 +-
.../portlet/tck/driver/TCKSimpleTestDriver.java | 619 -------
.../javax/portlet/tck/driver/TCKTestDriver.java | 450 +++++
portlet-tck_3.0/pom.xml | 40 +-
test-base/pom.xml | 33 +
.../pluto/test/utilities/SimpleTestDriver.java | 216 +++
14 files changed, 2422 insertions(+), 1445 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/demo-integration-tests/pom.xml b/demo-integration-tests/pom.xml
new file mode 100644
index 0000000..9cee29a
--- /dev/null
+++ b/demo-integration-tests/pom.xml
@@ -0,0 +1,342 @@
+<?xml version="1.0" encoding="UTF-8"?><!--
+ 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.
+--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <parent>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>pluto</artifactId>
+ <version>3.0.2-SNAPSHOT</version>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>javax.portlet</groupId>
+ <artifactId>demo-integration-tests</artifactId>
+ <description>Integration Tests for the Pluto Demos</description>
+ <packaging>jar</packaging>
+
+ <licenses>
+ <license>
+ <name>apache_v2</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
+ </license>
+ </licenses>
+
+ <scm>
+ <connection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</connection>
+ <developerConnection>scm:git:https://git-wip-us.apache.org/repos/asf/portals-pluto.git</developerConnection>
+ <url>https://github.com/apache/portals-pluto</url>
+ <tag>HEAD</tag>
+ </scm>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+
+ <!-- test.context.base context string used when addressing test pages. Used by module stylesheet -->
+ <test.context.base>pluto/portal/</test.context.base>
+
+ <!-- This variable is used by the test driver to determine how test
+ page links are to be found. Values: generateURLs the driver generates URLs
+ based on config information. followLinks the driver looks for links containing
+ the page name and clicks them in order to access the test pages. In this
+ case, the portal must produce navigation links to each of the test pages.
+ If configured to generate URLs, the driver generates URLs of the form: http://<test.server.host>:<test.server.port>/<test.context.base><test.page.name>
+ where <test.page.name> is the name of the test page generated by the individual
+ modules -->
+ <test.url.strategy>followLinks</test.url.strategy>
+
+ <!-- Configuration of portlet container under test for generated URLs -->
+ <!-- (only needed if test.url.strategy=generateURLs) -->
+ <test.server.host>localhost</test.server.host>
+ <test.server.port>8080</test.server.port>
+
+ <!-- Configuration of URL to login page -->
+ <test.server.login.url>http://${test.server.host}:${test.server.port}/pluto/portal/About Apache Pluto</test.server.login.url>
+
+ <!-- HTML field IDs and values for username & password to enable automatic login -->
+ <!-- User specified must be in 'tckuser' role. Please configure 'tckuser' role for the specified user in tomcat-users.xml -->
+ <test.server.username.id>j_username</test.server.username.id>
+ <test.server.username>pluto</test.server.username>
+ <test.server.password.id>j_password</test.server.password.id>
+ <test.server.password>pluto</test.server.password>
+
+ <!-- Specifies the browser to be used by selenium WebDriver for running the tests. -->
+ <!-- Can be used with firefox or HTMLUnit without setting the test.browser.webDriver property. -->
+ <!-- Use of Chrome or IE requires the webDriver to be downloaded and available. Set the -->
+ <!-- test.browser.webDriver property to point to the appropriate WebDriver server. -->
+ <test.browser>firefox</test.browser>
+ <test.browser>HTMLUnit</test.browser>
+
+ <!-- Lines commented out below illustrate how the chromedriver web driver can be configured -->
+ <test.browser>chrome</test.browser>
+ <test.browser.webDriver>c:/ntutil/chromedriver.exe</test.browser.webDriver>
+
+ <!-- commented outline below shows configuration for the Internet Explorer driver -->
+ <!-- test.browser.webDriver>C:\ntutil\IEDriverServer_x64_2.42.0\IEDriverServer.exe</test.browser.webDriver -->
+
+ <!-- Configuration for phantomJS driver -->
+ <!-- To use phantomJS, remove the comment marks around the following two lines.
+ <test.browser>phantomjs</test.browser>
+ <test.browser.webDriver>${phantomjs.binary}</test.browser.webDriver>
+ -->
+
+ <!-- Specify timeout in seconds for the driver to wait for page load. must be an integer. -->
+ <test.timeout>3</test.timeout>
+ </properties>
+
+ <dependencies>
+
+ <!-- For creating and executing tests -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.portals.pluto</groupId>
+ <artifactId>test-base</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>selenium-java</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.seleniumhq.selenium</groupId>
+ <artifactId>htmlunit-driver</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>com.codeborne</groupId>
+ <artifactId>phantomjsdriver</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>${project.artifactId}</finalName>
+
+ <plugins>
+
+ <!-- skip legal file checking for now -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>ianal-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>verify-legal-files</goal>
+ </goals>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <skipIfEmpty>true</skipIfEmpty>
+ </configuration>
+ </plugin>
+
+ <!-- Don't attach source or javadoc archive (for release plugin)-->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <configuration>
+ <attach>false</attach>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-gpg-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.17</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ <reportsDirectories>
+ <reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
+ <reportsDirectory>${project.build.directory}/jasmine</reportsDirectory>
+ </reportsDirectories>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+
+ <!-- To build the tests, use "mvn clean install" from the parent directory. -->
+ <!-- To run all of the tests, use "mvn verify -Prun-demo-tests" from the demo-integration-tests directory. -->
+
+ <!-- To run a subset of the tests, use "mvn verify -Prun-demo-tests -Dit.test=\*<match string>\*" from the -->
+ <!-- demo-integration-tests directory. The driver will then execute all tests whose test case name contains the -->
+ <!-- specified string. -->
+ <!-- Example: "mvn verify -Prun-demo-tests -Dit.test=\*PortleHubDemo\*" will execute all PortletHubDemo tests. -->
+
+ <profiles>
+ <profile>
+ <id>liferay</id>
+ <properties>
+ <test.server.login.url>http://${test.server.host}:${test.server.port}/group/pluto-demos</test.server.login.url>
+ </properties>
+ </profile>
+ <profile>
+ <id>run-demo-tests</id>
+ <build>
+ <plugins>
+ <!-- For running the tests. -->
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <version>2.22.0</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ </goals>
+ <configuration>
+ <useFile>true</useFile>
+ <argLine>-Xms512m -Xmx512m</argLine>
+ <trimStackTrace>false</trimStackTrace>
+ <systemProperties>
+ <property>
+ <name>test.server.login.url</name>
+ <value>${test.server.login.url}</value>
+ </property>
+ <property>
+ <name>test.context.base</name>
+ <value>${test.context.base}</value>
+ </property>
+ <property>
+ <name>test.url.strategy</name>
+ <value>${test.url.strategy}</value>
+ </property>
+ <property>
+ <name>test.server.host</name>
+ <value>${test.server.host}</value>
+ </property>
+ <property>
+ <name>test.server.port</name>
+ <value>${test.server.port}</value>
+ </property>
+ <property>
+ <name>test.server.username.id</name>
+ <value>${test.server.username.id}</value>
+ </property>
+ <property>
+ <name>test.server.username</name>
+ <value>${test.server.username}</value>
+ </property>
+ <property>
+ <name>test.server.password.id</name>
+ <value>${test.server.password.id}</value>
+ </property>
+ <property>
+ <name>test.server.password</name>
+ <value>${test.server.password}</value>
+ </property>
+ <property>
+ <name>test.browser</name>
+ <value>${test.browser}</value>
+ </property>
+ <property>
+ <name>test.browser.webDriver</name>
+ <value>${test.browser.webDriver}</value>
+ </property>
+ <property>
+ <name>test.browser.binary</name>
+ <value>${test.browser.binary}</value>
+ </property>
+ <property>
+ <name>test.browser.headless</name>
+ <value>${test.browser.headless}</value>
+ </property>
+ <property>
+ <name>test.browser.maximized</name>
+ <value>true</value>
+ </property>
+ <property>
+ <name>test.module</name>
+ <value>${test.module}</value>
+ </property>
+ <property>
+ <name>test.debug</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>test.timeout</name>
+ <value>${test.timeout}</value>
+ </property>
+ </systemProperties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
new file mode 100644
index 0000000..e0b87a9
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/DemoTestDriver.java
@@ -0,0 +1,35 @@
+/* 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.apache.portals.pluto.test.utilities.SimpleTestDriver;
+import org.junit.BeforeClass;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class DemoTestDriver extends SimpleTestDriver {
+
+ protected static WaitingAsserter waitingAsserter;
+
+ @BeforeClass
+ public static void setUpBeforeDemoSimpleTestDriverClass() {
+ waitingAsserter = new WaitingAsserter(driver, timeout);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ElementEnabled.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ElementEnabled.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ElementEnabled.java
new file mode 100644
index 0000000..95f4019
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/ElementEnabled.java
@@ -0,0 +1,57 @@
+/* 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 org.openqa.selenium.StaleElementReferenceException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class ElementEnabled implements ExpectedCondition<WebElement> {
+
+ private final By locator;
+
+ public ElementEnabled(By locator) {
+ this.locator = locator;
+ }
+
+ @Override
+ public WebElement apply(WebDriver webDriver) {
+
+ WebElement webElement = null;
+
+ try {
+
+ List<WebElement> webElements = webDriver.findElements(locator);
+
+ if (!webElements.isEmpty() && webElements.get(0).isEnabled()) {
+ webElement = webElements.get(0);
+ }
+ } catch (StaleElementReferenceException e) {
+ // Do nothing.
+ }
+
+ return webElement;
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
new file mode 100644
index 0000000..1d1119c
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/PortletHubDemoIT.java
@@ -0,0 +1,301 @@
+/* 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.io.UnsupportedEncodingException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.NoSuchElementException;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.Keys;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.Select;
+
+import static org.apache.portals.pluto.demo.integration.test.Util.*;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public class PortletHubDemoIT extends DemoTestDriver {
+
+ private static final int COLOR_HEX_STRING_LENGTH = 2;
+ private static final String COLOR_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PH_ColorSelPortlet";
+ private static final String IMAGE_SELECTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_ImageSelPortlet";
+ private static final List<String> IMAGE_OPTIONS = Util.unmodifiableList("golfball", "baseball", "fussball");
+ private static final String MESSAGE_BOX_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_MessageBoxPortlet";
+ private static final String PARTIAL_ACTION_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PartialActionPortlet";
+ private static final String RESOURCE_PORTLET_NAMESPACE = "Pluto_PortletHubDemo_PH_ResourcePortlet_PRP";
+ private static final String TOKEN = "{0}";
+ private static final String IMAGE_XPATH_TEMPLATE =
+ "//img[@src='/PortletHubDemo/resources/images/" + TOKEN + ".gif']";
+
+ @Test
+ public void testPortletHubDemo() throws UnsupportedEncodingException {
+ driver.get(baseUrl + Util.encodeURL("V3.0 Portlet Hub Demo"));
+
+ // Verify that all the different images appear when clicking each radio button.
+ By imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, "FullMoon"));
+ waitingAsserter.assertTrue(visibilityOfElementLocated(imageByXpath));
+
+ for (String imageName : IMAGE_OPTIONS) {
+
+ clickElement(driver, waitingAsserter,
+ getXpath("div", IMAGE_SELECTION_PORTLET_NAMESPACE) + "/input[@value='" + imageName + "']");
+ waitingAsserter.assertTrue(elementNotPresentOrNotVisible(imageByXpath));
+ imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, imageName + "-trans"));
+ waitingAsserter.assertTrue(visibilityOfElementLocated(imageByXpath));
+ }
+
+ // Verify that all the different images appear when clicking each dropdown option.
+ clickElement(driver, waitingAsserter, "input", IMAGE_SELECTION_PORTLET_NAMESPACE, "dropdown");
+ By imageSelectByXpath = By.xpath(getXpath("select", IMAGE_SELECTION_PORTLET_NAMESPACE) + "[@name='imgName']");
+ waitingAsserter.waitFor(elementToBeClickable(imageSelectByXpath));
+ Select select = new Select(driver.findElement(imageSelectByXpath));
+ select.selectByValue("default");
+ imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, "FullMoon"));
+ waitingAsserter.assertTrue(visibilityOfElementLocated(imageByXpath));
+
+ for (String imageName : IMAGE_OPTIONS) {
+
+ select = new Select(driver.findElement(imageSelectByXpath));
+ select.selectByValue(imageName);
+ waitingAsserter.assertTrue(elementNotPresentOrNotVisible(imageByXpath));
+ imageByXpath = By.xpath(IMAGE_XPATH_TEMPLATE.replace(TOKEN, imageName + "-trans"));
+ waitingAsserter.assertTrue(visibilityOfElementLocated(imageByXpath));
+ }
+
+ // Verify that the border checkbox shows and hides the border on the image.
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(imageByXpath), attributeEmpty(imageByXpath, "style")));
+ clickElement(driver, waitingAsserter, "input", RESOURCE_PORTLET_NAMESPACE, "border");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(imageByXpath),
+ attributeContains(imageByXpath, "style", "border:")));
+
+ // Verify that the different cacheability radion buttons change the visible cacheability text.
+ String cacheabilityRadioButtonXpathTemplate =
+ getXpath("input", RESOURCE_PORTLET_NAMESPACE) + "[@value='" + TOKEN + "']";
+ String resourcePortletDivXpath = getXpath("div", RESOURCE_PORTLET_NAMESPACE);
+ By actionButtonByXpath = By.xpath(resourcePortletDivXpath + "//input[@value='Action']");
+
+ for (String cacheability : Util.unmodifiableList("Portlet", "Full", "Page")) {
+
+ String cacheabilityResultXpath = resourcePortletDivXpath + "//p[contains(text(),'Cacheability')]";
+ waitingAsserter.assertTrue(elementNotPresentOrNotVisible(By.xpath(cacheabilityResultXpath +
+ "[contains(text(),'" + cacheability + "')]")));
+ String cacheabilityRadioButtonXpath = cacheabilityRadioButtonXpathTemplate.replace(TOKEN,
+ cacheability.toUpperCase(Locale.ENGLISH));
+ clickElement(driver, waitingAsserter, cacheabilityRadioButtonXpath);
+ By cacheabilityResultByXpath = By.xpath(cacheabilityResultXpath);
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(cacheabilityResultByXpath),
+ textToBePresentInElementLocated(cacheabilityResultByXpath, cacheability)));
+
+ if ("Page".equalsIgnoreCase(cacheability)) {
+ waitingAsserter.assertTrue(visibilityOfElementLocated(actionButtonByXpath));
+ } else {
+ waitingAsserter.assertTrue(visibilityOfElementLocated(By.xpath(resourcePortletDivXpath +
+ "[contains(.,'Action URL could not be created.')]")));
+ }
+ }
+
+ // Click the Action button.
+ clickElement(driver, waitingAsserter, actionButtonByXpath);
+ waitingAsserter.assertTrue(visibilityOfElementLocated(actionButtonByXpath));
+
+ // Verify the background color changes.
+ By coloredTableByXpath =
+ By.xpath(getXpath("div", RESOURCE_PORTLET_NAMESPACE, "putResourceHere") + "//table[@style]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(coloredTableByXpath),
+ backgroundColor(coloredTableByXpath, 0xFF, 0xFF, 0xFF)));
+ String colorInputXpath = getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, "color");
+ sendKeysToElement(driver, waitingAsserter, colorInputXpath, "#FF0000", Keys.ENTER);
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(coloredTableByXpath),
+ backgroundColor(coloredTableByXpath, 0xFF, 0, 0)));
+
+ // Verify that messages can be sent in different colors by different methods.
+ for (String formSubmissionMethod : Util.unmodifiableList("URL", "form")) {
+
+ for (ColorCombo colorCombo : ColorCombo.getAllPossibleCombos()) {
+
+ String lowerCaseFormSubmissionMethod = formSubmissionMethod.toLowerCase(Locale.ENGLISH);
+ clickElement(driver, waitingAsserter, "input", COLOR_SELECTION_PORTLET_NAMESPACE,
+ lowerCaseFormSubmissionMethod);
+ testMessageSent(colorCombo);
+ }
+
+ clickElement(driver, waitingAsserter, "input", MESSAGE_BOX_PORTLET_NAMESPACE, "clear");
+ }
+
+ // Click the Do Partial Action button and check that the reponse text appears.
+ By responseDivByXpath = By.xpath(getXpath("div", PARTIAL_ACTION_PORTLET_NAMESPACE, "responseDiv"));
+ waitingAsserter.assertTrue(textEmpty(responseDivByXpath));
+
+ for (int i = 1; i <= 10; i++) {
+
+ clickElement(driver, waitingAsserter, "input", PARTIAL_ACTION_PORTLET_NAMESPACE, "doPA");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(responseDivByXpath),
+ textToBePresentInElementLocated(responseDivByXpath,
+ "Partial Action has been executed " + i + " times.")));
+ }
+ }
+
+ private void testMessageSent(ColorCombo colorCombo) {
+
+ handleColorCheckbox("red", colorCombo.isRedSelected());
+ handleColorCheckbox("green", colorCombo.isGreenSelected());
+ handleColorCheckbox("blue", colorCombo.isBlueSelected());
+
+ String messageInputXpath = getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, "msg");
+ String message = colorCombo.getHexString();
+ sendKeysToElement(driver, waitingAsserter, messageInputXpath, message);
+ clickElement(driver, waitingAsserter, "input", COLOR_SELECTION_PORTLET_NAMESPACE, "send");
+
+ By messageOutputByXpath =
+ By.xpath(getXpath("div", MESSAGE_BOX_PORTLET_NAMESPACE, "responseDiv") +
+ "/p[contains(text(),'" + colorCombo.getIndex() + ": " + message + "')]");
+ waitingAsserter.assertTrue(and(visibilityOfElementLocated(messageOutputByXpath),
+ or(attributeContains(messageOutputByXpath, "style", "color:#" + message + ";"),
+ attributeContains(messageOutputByXpath, "style", "color: " + colorCombo.getCSS_RGBString() + ";"))));
+ }
+
+ private static ExpectedCondition<Boolean> backgroundColor(By locator, int red, int green, int blue) {
+
+ String colorCode = "#" +
+ getHexString(red, COLOR_HEX_STRING_LENGTH) +
+ getHexString(green, COLOR_HEX_STRING_LENGTH) +
+ getHexString(blue, COLOR_HEX_STRING_LENGTH);
+
+ return and(visibilityOfElementLocated(locator),
+ or(attributeContains(locator, "style", "background-color:" + colorCode + ";"),
+ attributeContains(locator, "style",
+ "background-color: rgb(" + red + ", " + green + ", " + blue + ");")));
+ }
+
+ private static String getHexString(int toHexValue, int stringLength) {
+ return getZeroPaddedString(Integer.toHexString(toHexValue), stringLength);
+ }
+
+ private static String getZeroPaddedString(String string, int stringLength) {
+ return String.format("%" + stringLength + "s", string).replace(" ", "0");
+ }
+
+ private void handleColorCheckbox(String colorName, boolean colorSelected) {
+
+ WebElement colorCheckbox =
+ driver.findElement(By.xpath(getXpath("input", COLOR_SELECTION_PORTLET_NAMESPACE, colorName)));
+
+ if ((colorSelected && !colorCheckbox.isSelected()) || (!colorSelected && colorCheckbox.isSelected())) {
+ colorCheckbox.click();
+ }
+ }
+
+ private static final class ColorCombo {
+
+ // Constants
+ private static final byte BLUE_BIT_POSITION = 0;
+ private static final byte GREEN_BIT_POSITION = BLUE_BIT_POSITION + 1;
+ private static final byte RED_BIT_POSITION = GREEN_BIT_POSITION + 1;
+ private static final byte BINARY_STRING_LENGTH = RED_BIT_POSITION + 1;
+
+ // Data
+ private final byte selectedColorsInBinary;
+
+ public ColorCombo(byte selectedColorsInBinary) {
+ this.selectedColorsInBinary = selectedColorsInBinary;
+ }
+
+ public boolean isRedSelected() {
+ return isColorSelected(selectedColorsInBinary, RED_BIT_POSITION);
+ }
+
+ public boolean isGreenSelected() {
+ return isColorSelected(selectedColorsInBinary, GREEN_BIT_POSITION);
+ }
+
+ public boolean isBlueSelected() {
+ return isColorSelected(selectedColorsInBinary, BLUE_BIT_POSITION);
+ }
+
+ public String getCSS_RGBString() {
+ return "rgb(" +
+ getBinaryString()
+ .replace("", " ").trim().replace(" ", ", ")
+ .replace("1", Integer.toString(0xFF)) +
+ ")";
+ }
+
+ public String getHexString() {
+ return "#" + getBinaryString().replace("1", "F");
+ }
+
+ public String getIndex() {
+ return Integer.toString(selectedColorsInBinary + 1);
+ }
+
+ private String getBinaryString() {
+ return getZeroPaddedString(Integer.toBinaryString(selectedColorsInBinary), BINARY_STRING_LENGTH);
+ }
+
+ private static boolean isColorSelected(byte selectedColors, byte colorBitPosition) {
+ return ((selectedColors >> colorBitPosition) & 1) == 1;
+ }
+
+ public static Iterable<ColorCombo> getAllPossibleCombos() {
+ return new AllPossibleCombosIterable();
+ }
+
+ private static final class AllPossibleCombosIterator implements Iterator<ColorCombo> {
+
+ // Constants
+ private static final byte ALL_COLORS = 0b111;
+ private static final byte NO_COLORS = 0b000;
+
+ // Data
+ private byte selectedColorsInBinary = NO_COLORS;
+
+ @Override
+ public boolean hasNext() {
+ return selectedColorsInBinary <= ALL_COLORS;
+ }
+
+ @Override
+ public ColorCombo next() {
+
+ if (!hasNext()) {
+ throw new NoSuchElementException();
+ }
+
+ ColorCombo colorCombo = new ColorCombo(selectedColorsInBinary);
+ selectedColorsInBinary++;
+
+ return colorCombo;
+ }
+ }
+
+ private static final class AllPossibleCombosIterable implements Iterable<ColorCombo> {
+
+ @Override
+ public Iterator<ColorCombo> iterator() {
+ return new AllPossibleCombosIterator();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
new file mode 100644
index 0000000..f569f0b
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/Util.java
@@ -0,0 +1,140 @@
+/* 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.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import static org.openqa.selenium.support.ui.ExpectedConditions.*;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public final class Util {
+
+ private Util() {
+ throw new AssertionError();
+ }
+
+ public static String encodeURL(String url) throws UnsupportedEncodingException {
+ return URLEncoder.encode(url, StandardCharsets.UTF_8.toString());
+ }
+
+ public static <T> List<T> unmodifiableList(T... items) {
+ return Collections.unmodifiableList(Arrays.asList(items));
+ }
+
+ // Expected Conditions
+ public static ExpectedCondition<Boolean> attributeEmpty(By locator, String attributeName) {
+ return or(attributeToBe(locator, attributeName, null), attributeToBe(locator, attributeName, ""));
+ }
+
+ public static ExpectedCondition<Boolean> elementNotPresentOrNotVisible(By locator) {
+ return or(not(presenceOfAllElementsLocatedBy(locator)), invisibilityOfElementLocated(locator));
+ }
+
+ public static ExpectedCondition<Boolean> textEmpty(By locator) {
+ return or(elementNotPresentOrNotVisible(locator), textToBe(locator, ""));
+ }
+
+ // Element Methods
+ public static void clearElement(WebDriver webDriver, WaitingAsserter waitingAsserter, By locator) {
+
+ waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), new ElementEnabled(locator)));
+ locator.findElement(webDriver).clear();
+ }
+
+ public static void clearElement(WebDriver webDriver, WaitingAsserter waitingAsserter, String elementTagName,
+ String... elementIdFragments) {
+ clearElement(webDriver, waitingAsserter, getXpath(elementTagName, elementIdFragments));
+ }
+
+ public static void clearElement(WebDriver webDriver, WaitingAsserter waitingAsserter, String elementXpath) {
+ clearElement(webDriver, waitingAsserter, By.xpath(elementXpath));
+ }
+
+ public static void clickElement(WebDriver webDriver, WaitingAsserter waitingAsserter, By locator) {
+
+ waitingAsserter.waitFor(and(visibilityOfElementLocated(locator),
+ elementToBeClickable(locator)));
+ locator.findElement(webDriver).click();
+ }
+
+ public static void clickElement(WebDriver webDriver, WaitingAsserter waitingAsserter, String elementTagName,
+ String... elementIdFragments) {
+ clickElement(webDriver, waitingAsserter, getXpath(elementTagName, elementIdFragments));
+ }
+
+ public static void clickElement(WebDriver webDriver, WaitingAsserter waitingAsserter, String elementXpath) {
+ clickElement(webDriver, waitingAsserter, By.xpath(elementXpath));
+ }
+
+ public static WebElement findElement(WebDriver webDriver, String elementXpath) {
+ return webDriver.findElement(By.xpath(elementXpath));
+ }
+
+ public static String getXpath(String elementTagName, String... elementIdFragments) {
+ StringBuilder stringBuilder = new StringBuilder();
+ stringBuilder.append("//");
+ stringBuilder.append(elementTagName);
+
+ for (String idFragment : elementIdFragments) {
+ stringBuilder.append("[");
+ stringBuilder.append("contains(@id,'");
+ stringBuilder.append(idFragment);
+ stringBuilder.append("')]");
+ }
+
+ return stringBuilder.toString();
+ }
+
+ public static void sendKeysToElement(WebDriver webDriver, WaitingAsserter waitingAsserter, By locator,
+ CharSequence... keys) {
+ sendKeysToElement(webDriver, waitingAsserter, true, locator, keys);
+ }
+
+ public static void sendKeysToElement(WebDriver webDriver, WaitingAsserter waitingAsserter, String elementXpath,
+ CharSequence... keys) {
+ sendKeysToElement(webDriver, waitingAsserter, true, By.xpath(elementXpath), keys);
+ }
+
+ public static void sendKeysToElement(WebDriver webDriver, WaitingAsserter waitingAsserter,
+ boolean clearBeforeSendingKeys, By locator, CharSequence... keys) {
+
+ waitingAsserter.waitFor(and(visibilityOfElementLocated(locator), new ElementEnabled(locator)));
+
+ if (clearBeforeSendingKeys) {
+ clearElement(webDriver, waitingAsserter, locator);
+ }
+
+ locator.findElement(webDriver).sendKeys(keys);
+ }
+
+ public static void sendKeysToElement(WebDriver webDriver, WaitingAsserter waitingAsserter,
+ boolean clearBeforeSendingKeys, String elementXpath, CharSequence... keys) {
+ sendKeysToElement(webDriver, waitingAsserter, clearBeforeSendingKeys, By.xpath(elementXpath), keys);
+ }
+}
http://git-wip-us.apache.org/repos/asf/portals-pluto/blob/5ea95519/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/WaitingAsserter.java
----------------------------------------------------------------------
diff --git a/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/WaitingAsserter.java b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/WaitingAsserter.java
new file mode 100644
index 0000000..68a27d5
--- /dev/null
+++ b/demo-integration-tests/src/test/java/org/apache/portals/pluto/demo/integration/test/WaitingAsserter.java
@@ -0,0 +1,49 @@
+/* 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.openqa.selenium.TimeoutException;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+/**
+ *
+ * @author Kyle Stiemann
+ */
+public final class WaitingAsserter {
+
+ private final WebDriverWait webDriverWait;
+
+ public WaitingAsserter(WebDriver driver, long timeOutInSeconds) {
+ this.webDriverWait = new WebDriverWait(driver, timeOutInSeconds);
+ }
+
+ public void assertTrue(ExpectedCondition expectedCondition) {
+
+ try {
+ waitFor(expectedCondition);
+ } catch (TimeoutException e) {
+ throw new AssertionError(e);
+ }
+ }
+
+ public void waitFor(ExpectedCondition expectedCondition) {
+ webDriverWait.until(expectedCondition);
+ }
+}