Seam SVN: r13733 - in branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest: seamgen/src/main/org/jboss/seam/test/functional/seamgen and 1 other directories.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-09-10 10:17:32 -0400 (Fri, 10 Sep 2010)
New Revision: 13733
Added:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumDateSelector.java
Modified:
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/GenerateEntitiesTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java
branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
Log:
Minor changes in functional tests.
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml 2010-09-10 14:16:53 UTC (rev 13732)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/examples/build.xml 2010-09-10 14:17:32 UTC (rev 13733)
@@ -263,13 +263,13 @@
<target name="copy.selenium" unless="copy.selenium.done">
<copyInlineDependencies id="selenium.server" scope="compile" todir="${ftest.lib.dir}">
- <dependency groupId="org.seleniumhq.selenium.server" artifactId="selenium-server" version="1.0.1" classifier="standalone">
+ <dependency groupId="org.seleniumhq.selenium.server" artifactId="selenium-server" version="1.0.3" classifier="standalone">
<exclusion groupId="org.seleniumhq.selenium.core" artifactId="selenium-core" />
<exclusion groupId="org.seleniumhq.selenium.server" artifactId="selenium-server-coreless" />
<exclusion groupId="org.apache.ant" artifactId="ant-trax" />
<exclusion groupId="org.apache.ant" artifactId="ant-nodeps" />
</dependency>
- <dependency groupId="org.seleniumhq.selenium.client-drivers" artifactId="selenium-java-client-driver" version="1.0.1">
+ <dependency groupId="org.seleniumhq.selenium.client-drivers" artifactId="selenium-java-client-driver" version="1.0.3">
<exclusion groupId="org.codehaus.groovy.maven.runtime" artifactId="gmaven-runtime-default" />
</dependency>
<dependency groupId="org.subethamail" artifactId="subethasmtp-smtp" version="1.2" >
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/GenerateEntitiesTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/GenerateEntitiesTest.java 2010-09-10 14:16:53 UTC (rev 13732)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/GenerateEntitiesTest.java 2010-09-10 14:17:32 UTC (rev 13733)
@@ -24,10 +24,9 @@
import java.io.InputStream;
import java.util.Date;
+import org.jboss.seam.example.common.test.selenium.SeleniumDateSelector;
import org.testng.annotations.BeforeGroups;
-import com.thoughtworks.selenium.Wait;
-
/**
* This class and its subclasses test seam-gen's "generate-entities" feature.
* Every test method should be part of "generate-entitiesTest" in order to get
@@ -121,29 +120,15 @@
*/
public void selectDate(Date date)
{
- // TODO
- final String richFaces = "id=person:birthdateField:birthdateDayCell24";
- final String iceFaces = "id=person:birthdateField:birthdate_calendar_1569";
- final String icefacesCalendarButton = "person:birthdateField:birthdate_calendarButton";
+ final String richFacesButton = "id=person:birthdateField:birthdatePopupButton";
+ final String richFacesCalendar = "xpath=//div[@class='rich-calendar-tool-btn' and text()='Today']";
- if (browser.isElementPresent(richFaces))
+ if (browser.isElementPresent(richFacesButton))
{
- browser.click(richFaces);
+ browser.click(richFacesButton);
+ browser.waitForElement(richFacesCalendar);
+ SeleniumDateSelector.RICHFACES.setDate(browser, date);
}
- else if (browser.isElementPresent(icefacesCalendarButton))
- {
- browser.click(icefacesCalendarButton);
- new Wait()
- {
-
- @Override
- public boolean until()
- {
- return browser.isElementPresent(iceFaces);
- }
- }.wait("Calendar did not appear.", Long.valueOf(SELENIUM_TIMEOUT));
- browser.click(iceFaces);
- }
else
{
throw new RuntimeException("Unable to select date." + browser.getHtmlSource());
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-10 14:16:53 UTC (rev 13732)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-10 14:17:32 UTC (rev 13733)
@@ -35,23 +35,23 @@
/**
* This test verifies hot deployment of static resources. It modifies home.xhtml
- * page and verifies that changes are reflected within the running app. All is done
- * within user session to detect if the whole application was restarted or not.
+ * page and verifies that changes are reflected within the running app. All is
+ * done within user session to detect if the whole application was restarted or
+ * not.
*
* @author Jozef Hartinger
*
*/
public class HotDeploymentStaticTest extends SeleniumSeamGenTest
{
-
+
private String newFeature;
-
- @BeforeClass
- public void modifyHomePage() throws IOException, InterruptedException
+
+ public void modifyHomePage() throws InterruptedException
{
String homePageLocation = WORKSPACE + "/" + APP_NAME + "/view/home.xhtml";
newFeature = "Works flawlessly as it is tested by Selenium";
-
+
BufferedReader reader = null;
StringBuilder homePageContentBuilder = new StringBuilder();
try
@@ -65,16 +65,27 @@
line = reader.readLine();
}
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to read home page " + homePageLocation);
+ }
finally
{
- reader.close();
+ try
+ {
+ reader.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
String homePageContent = homePageContentBuilder.toString();
-
+
// add new item into the feature list
- homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li>" + newFeature + "</li>");
-
+ homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li id=\"newFeature\">" + newFeature + "</li>");
+
// write new content
Writer writer = null;
try
@@ -83,21 +94,37 @@
writer.write(homePageContent);
writer.flush();
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable write modified home page " + homePageLocation);
+ }
finally
{
- writer.close();
+ try
+ {
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
seamGen.deploy();
}
-
+
@Test(dependsOnGroups = { "newProjectGroup" })
- public void hotDeploymentOfFaceletTemplateTest()
+ public void hotDeploymentOfFaceletTemplateTest() throws InterruptedException
{
-
+
login();
-
- assertTrue(browser.isTextPresent(newFeature), "New feature not found. Hot deployment failure.");
+
+ modifyHomePage();
+
+ waitForAppToDeploy(HOME_PAGE, "id=newFeature");
+
+ browser.open(HOME_PAGE);
+ assertTrue(browser.isElementPresent("id=newFeature"), "New feature not found. Hot deployment failure.");
assertTrue(isLoggedIn(), "Session lost. Hot deployment failure.");
}
}
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java 2010-09-10 14:16:53 UTC (rev 13732)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/SeleniumSeamGenTest.java 2010-09-10 14:17:32 UTC (rev 13733)
@@ -24,6 +24,7 @@
import static org.testng.Assert.assertTrue;
import org.jboss.seam.example.common.test.selenium.SeamSelenium;
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
import org.testng.annotations.BeforeMethod;
/**
@@ -142,7 +143,16 @@
i -= step;
if (i <= 0)
{
- throw new RuntimeException("Timeout waiting for " + element + " at " + url);
+ String logPath = OUTPUT_DIR + APP_NAME + "/" + element.replace(":", "");
+ try {
+ SeamSeleniumTest.browser.captureScreenshot(logPath + ".png");
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ SeamSeleniumTest.browser.logHTMLContext(logPath + ".html");
+ stopBrowser();
+ }
+ throw new RuntimeException("Timeout waiting for " + element + " at " + url + " after " + DEPLOY_TIMEOUT + " miliseconds");
}
Thread.sleep(step);
browser.open(url); // try again
Modified: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-10 14:16:53 UTC (rev 13732)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-10 14:17:32 UTC (rev 13733)
@@ -27,6 +27,7 @@
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Wait;
+import com.thoughtworks.selenium.SeleniumException;
/**
* This class slightly enhaces a Selenium API for controlling a browser.
@@ -274,4 +275,18 @@
}
}.wait("Timeout while waiting for document body after icefaces click.", timeout);
}
+
+ @Override
+ public void open(String url)
+ {
+ try
+ {
+ super.open(url);
+ }
+ catch (SeleniumException e)
+ {
+ // since 1.0.3 Selenium throws SeleniumException when a server returns 404
+ // we suppress this behavior in order to retain backward compatibility
+ }
+ }
}
Added: branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumDateSelector.java
===================================================================
--- branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumDateSelector.java (rev 0)
+++ branches/enterprise/JBPAPP_4_3_FP01/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeleniumDateSelector.java 2010-09-10 14:17:32 UTC (rev 13733)
@@ -0,0 +1,221 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.seam.example.common.test.selenium;
+
+import java.text.DateFormatSymbols;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.StringTokenizer;
+
+/**
+ * Selects date using Selenium in calendar provided by framework. Each framework
+ * is responsible for managing movement in calendar grid
+ *
+ * @author kpiwko
+ *
+ */
+public enum SeleniumDateSelector
+{
+ RICHFACES
+ {
+ @Override
+ public void setDay(SeamSelenium browser, int day)
+ {
+ String locator = "xpath=//td[contains(@class, 'rich-calendar-cell') and not(contains(@class,'rich-calendar-boundary-dates')) and text() ='" + Integer.toString(day) + "']";
+ browser.waitForElement(locator);
+ browser.click(locator);
+ }
+
+ @Override
+ public void setMonth(SeamSelenium browser, int month)
+ {
+ String monthLocator = "xpath=//div[@class='rich-calendar-tool-btn' and contains(.,',')]";
+ StringTokenizer stk = new StringTokenizer(browser.getText(monthLocator), ",");
+ String calMonth = stk.nextToken().trim();
+ int steps = monthStepsCount(calMonth, month);
+
+ movement(browser, "xpath=//div[@class='rich-calendar-tool-btn' and normalize-space(text())='<']", "xpath=//div[@class='rich-calendar-tool-btn' and normalize-space(text())='>']", steps);
+ }
+
+ @Override
+ public void setYear(SeamSelenium browser, int year)
+ {
+ String yearLocator = "xpath=//div[@class='rich-calendar-tool-btn' and contains(.,',')]";
+ StringTokenizer stk = new StringTokenizer(browser.getText(yearLocator), ",");
+ // omit first token
+ stk.nextToken();
+ String calYear = stk.nextToken().trim();
+ int steps = yearStepsCount(calYear, year);
+
+ movement(browser, "xpath=//div[@class='rich-calendar-tool-btn' and normalize-space(text())='<<']", "xpath=//div[@class='rich-calendar-tool-btn' and normalize-space(text())='>>']", steps);
+ }
+
+ };
+
+ /**
+ * Selects date using Selenium browser
+ *
+ * @param browser
+ * Selenium browser instance
+ * @param date
+ * Date to be selected
+ */
+ public void setDate(SeamSelenium browser, Date date)
+ {
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+
+ setYear(browser, cal.get(Calendar.YEAR));
+ setMonth(browser, cal.get(Calendar.MONTH));
+ setDay(browser, cal.get(Calendar.DAY_OF_MONTH));
+ }
+
+ /**
+ * Selects day in calendar
+ *
+ * @param browser
+ * Selenium browser instance
+ * @param day
+ * Integer containing the day to be selected, indexing from 1
+ */
+ protected abstract void setDay(SeamSelenium browser, int day);
+
+ /**
+ * Selects month in calendar
+ *
+ * @param browser
+ * Selenium browser instance
+ * @param month
+ * Integer containing the month to be selected, indexing from 1
+ */
+ protected abstract void setMonth(SeamSelenium browser, int month);
+
+ /**
+ * Selects year in calendar
+ *
+ * @param browser
+ * Selenium browser instance
+ * @param year
+ * Integer containing the year to be selected
+ */
+ protected abstract void setYear(SeamSelenium browser, int year);
+
+ /**
+ * Determines direction of month in calendar interface
+ *
+ * @param calMonth
+ * Which month is currently shown on calendar
+ * @param month
+ * Which month is desired to be set, indexing from 1
+ * @return Number of steps which must be done in either of direction, where
+ * sign has meaning:
+ * <ul>
+ * <li>- goes to past</li>
+ * <li>+ goes to future</li>
+ * </ul>
+ */
+ protected int monthStepsCount(String calMonth, int month)
+ {
+ final List<String> months = Arrays.asList((new DateFormatSymbols()).getMonths());
+ int mindex = months.indexOf(calMonth);
+ if (mindex == -1)
+ throw new IllegalArgumentException("Unknown month: " + calMonth + " for locale: " + Locale.getDefault());
+
+ return month - (mindex + 1);
+ }
+
+ /**
+ * Determines direction of year in calendar interface
+ *
+ * @param calYear
+ * Which year is currently shown on calendar
+ * @param year
+ * Which month is desired to be set, indexing from 1
+ * @return Number of steps which must be done in either of direction, where
+ * sign has meaning:
+ * <ul>
+ * <li>- goes to past</li>
+ * <li>+ goes to future</li>
+ * </ul>
+ */
+ protected final int yearStepsCount(String calYear, int year)
+ {
+ int yindex;
+ try
+ {
+ yindex = Integer.valueOf(calYear);
+ }
+ catch (NumberFormatException nfe)
+ {
+ throw new IllegalArgumentException("Invalid year: " + calYear, nfe);
+ }
+
+ return year - yindex;
+ }
+
+ /**
+ * Moves in either backward or forward direction according to step count.
+ * Uses locator of element for both directions.
+ *
+ * @param browser
+ * Selenium browser instance
+ * @param backLocator
+ * Element which moves calendar to past
+ * @param forwardLocator
+ * Element which moves calendar to future
+ * @param steps
+ * Number of steps to be done, determined by monthStepsCount() or
+ * yearStepsCount() function
+ * @see SeleniumDateSelector#monthStepsCount(String, int)
+ * @see SeleniumDateSelector#yearStepsCount(String, int)
+ */
+ protected void movement(SeamSelenium browser, String backLocator, String forwardLocator, int steps)
+ {
+ // going to past
+ if (steps < 0)
+ {
+ for (int i = 0; i > steps; i--)
+ click(browser, backLocator);
+ }
+ // going to future
+ else
+ {
+ for (int i = 0; i < steps; i++)
+ click(browser, forwardLocator);
+ }
+ }
+
+ /**
+ * Clicks on element. Allow differentiate action according to framework, such
+ * as wait for page to load for IceFaces
+ *
+ * @param browser Selenium browser
+ * @param locator Locator of element to be clicked on
+ */
+ protected void click(SeamSelenium browser, String locator)
+ {
+ browser.click(locator);
+ }
+}
14 years, 3 months
Seam SVN: r13732 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: src/main/org/jboss/seam/example/common/test/selenium and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-09-10 10:16:53 -0400 (Fri, 10 Sep 2010)
New Revision: 13732
Modified:
branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
Log:
Minor changes in functional tests.
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-09 10:32:02 UTC (rev 13731)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-10 14:16:53 UTC (rev 13732)
@@ -35,23 +35,23 @@
/**
* This test verifies hot deployment of static resources. It modifies home.xhtml
- * page and verifies that changes are reflected within the running app. All is done
- * within user session to detect if the whole application was restarted or not.
+ * page and verifies that changes are reflected within the running app. All is
+ * done within user session to detect if the whole application was restarted or
+ * not.
*
* @author Jozef Hartinger
*
*/
public class HotDeploymentStaticTest extends SeleniumSeamGenTest
{
-
+
private String newFeature;
-
- @BeforeClass
- public void modifyHomePage() throws IOException, InterruptedException
+
+ public void modifyHomePage() throws InterruptedException
{
String homePageLocation = WORKSPACE + "/" + APP_NAME + "/view/home.xhtml";
newFeature = "Works flawlessly as it is tested by Selenium";
-
+
BufferedReader reader = null;
StringBuilder homePageContentBuilder = new StringBuilder();
try
@@ -65,16 +65,27 @@
line = reader.readLine();
}
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to read home page " + homePageLocation);
+ }
finally
{
- reader.close();
+ try
+ {
+ reader.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
String homePageContent = homePageContentBuilder.toString();
-
+
// add new item into the feature list
- homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li>" + newFeature + "</li>");
-
+ homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li id=\"newFeature\">" + newFeature + "</li>");
+
// write new content
Writer writer = null;
try
@@ -83,21 +94,37 @@
writer.write(homePageContent);
writer.flush();
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable write modified home page " + homePageLocation);
+ }
finally
{
- writer.close();
+ try
+ {
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
seamGen.deploy();
}
-
+
@Test(dependsOnGroups = { "newProjectGroup" })
- public void hotDeploymentOfFaceletTemplateTest()
+ public void hotDeploymentOfFaceletTemplateTest() throws InterruptedException
{
-
+
login();
-
- assertTrue(browser.isTextPresent(newFeature), "New feature not found. Hot deployment failure.");
+
+ modifyHomePage();
+
+ waitForAppToDeploy(HOME_PAGE, "id=newFeature");
+
+ browser.open(HOME_PAGE);
+ assertTrue(browser.isElementPresent("id=newFeature"), "New feature not found. Hot deployment failure.");
assertTrue(isLoggedIn(), "Session lost. Hot deployment failure.");
}
}
Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-09 10:32:02 UTC (rev 13731)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-10 14:16:53 UTC (rev 13732)
@@ -28,6 +28,7 @@
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleniumException;
import com.thoughtworks.selenium.Wait;
+import com.thoughtworks.selenium.SeleniumException;
/**
* This class slightly enhaces a Selenium API for controlling a browser.
@@ -341,4 +342,18 @@
{
this.suppressSeleniumTimeoutException = suppressSeleniumTimeoutException;
}
+
+ @Override
+ public void open(String url)
+ {
+ try
+ {
+ super.open(url);
+ }
+ catch (SeleniumException e)
+ {
+ // since 1.0.3 Selenium throws SeleniumException when a server returns 404
+ // we suppress this behavior in order to retain backward compatibility
+ }
+ }
}
14 years, 3 months
Seam SVN: r13731 - branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-09-09 06:32:02 -0400 (Thu, 09 Sep 2010)
New Revision: 13731
Modified:
branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
Log:
Fix hot deployment test for static resources.
Modified: branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-09 08:15:53 UTC (rev 13730)
+++ branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java 2010-09-09 10:32:02 UTC (rev 13731)
@@ -35,23 +35,23 @@
/**
* This test verifies hot deployment of static resources. It modifies home.xhtml
- * page and verifies that changes are reflected within the running app. All is done
- * within user session to detect if the whole application was restarted or not.
+ * page and verifies that changes are reflected within the running app. All is
+ * done within user session to detect if the whole application was restarted or
+ * not.
*
* @author Jozef Hartinger
*
*/
public class HotDeploymentStaticTest extends SeleniumSeamGenTest
{
-
+
private String newFeature;
-
- @BeforeClass
- public void modifyHomePage() throws IOException, InterruptedException
+
+ public void modifyHomePage() throws InterruptedException
{
String homePageLocation = WORKSPACE + "/" + APP_NAME + "/view/home.xhtml";
newFeature = "Works flawlessly as it is tested by Selenium";
-
+
BufferedReader reader = null;
StringBuilder homePageContentBuilder = new StringBuilder();
try
@@ -65,16 +65,27 @@
line = reader.readLine();
}
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to read home page " + homePageLocation);
+ }
finally
{
- reader.close();
+ try
+ {
+ reader.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
String homePageContent = homePageContentBuilder.toString();
-
+
// add new item into the feature list
- homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li>" + newFeature + "</li>");
-
+ homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li id=\"newFeature\">" + newFeature + "</li>");
+
// write new content
Writer writer = null;
try
@@ -83,21 +94,37 @@
writer.write(homePageContent);
writer.flush();
}
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable write modified home page " + homePageLocation);
+ }
finally
{
- writer.close();
+ try
+ {
+ writer.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("Unable to close home page reader.");
+ }
}
-
+
seamGen.deploy();
}
-
+
@Test(dependsOnGroups = { "newProjectGroup" })
- public void hotDeploymentOfFaceletTemplateTest()
+ public void hotDeploymentOfFaceletTemplateTest() throws InterruptedException
{
-
+
login();
-
- assertTrue(browser.isTextPresent(newFeature), "New feature not found. Hot deployment failure.");
+
+ modifyHomePage();
+
+ waitForAppToDeploy(HOME_PAGE, "id=newFeature");
+
+ browser.open(HOME_PAGE);
+ assertTrue(browser.isElementPresent("id=newFeature"), "New feature not found. Hot deployment failure.");
assertTrue(isLoggedIn(), "Session lost. Hot deployment failure.");
}
}
14 years, 3 months
Seam SVN: r13730 - branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-09-09 04:15:53 -0400 (Thu, 09 Sep 2010)
New Revision: 13730
Modified:
branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
Log:
Suppress Selenium throwing exception on 404 to retain backward compatibility.
Modified: branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-08 14:36:47 UTC (rev 13729)
+++ branches/community/Seam_2_2/src/test/ftest/src/main/org/jboss/seam/example/common/test/selenium/SeamSelenium.java 2010-09-09 08:15:53 UTC (rev 13730)
@@ -26,6 +26,7 @@
import java.io.OutputStreamWriter;
import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.SeleniumException;
import com.thoughtworks.selenium.Wait;
/**
@@ -316,4 +317,20 @@
}
}.wait("Timeout while waiting for document body after icefaces click.", timeout);
}
+
+ @Override
+ public void open(String url)
+ {
+ try
+ {
+ super.open(url);
+ }
+ catch (SeleniumException e)
+ {
+ // since 1.0.3 Selenium throws SeleniumException when a server returns 404
+ // we suppress this behavior in order to retain backward compatibility
+ }
+ }
+
+
}
14 years, 3 months
Seam SVN: r13729 - in branches/community/Seam_2_2: src/test/ftest/examples/groovybooking and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-09-08 10:36:47 -0400 (Wed, 08 Sep 2010)
New Revision: 13729
Modified:
branches/community/Seam_2_2/examples/groovybooking/build.properties
branches/community/Seam_2_2/examples/groovybooking/readme.txt
branches/community/Seam_2_2/src/test/ftest/examples/groovybooking/build.xml
Log:
Fix functional tests for groovybooking example
Modified: branches/community/Seam_2_2/examples/groovybooking/build.properties
===================================================================
--- branches/community/Seam_2_2/examples/groovybooking/build.properties 2010-09-07 14:00:37 UTC (rev 13728)
+++ branches/community/Seam_2_2/examples/groovybooking/build.properties 2010-09-08 14:36:47 UTC (rev 13729)
@@ -1,2 +1,2 @@
-# Uncomment when deploying to JBoss AS 5 (the default)
+# Set to true when deploying to JBoss AS 4
loadPersistenceUnits=false
Modified: branches/community/Seam_2_2/examples/groovybooking/readme.txt
===================================================================
--- branches/community/Seam_2_2/examples/groovybooking/readme.txt 2010-09-07 14:00:37 UTC (rev 13728)
+++ branches/community/Seam_2_2/examples/groovybooking/readme.txt 2010-09-08 14:36:47 UTC (rev 13729)
@@ -6,8 +6,8 @@
Thus, you prefix all the typical targets (explode, restart, unexplode) with
"jbosswar." (e.g., jbosswar.explode, jbosswar.restart, jbosswar.unexplode).
-Please note that you need to uncomment the loadPersistenceUnits=true property
-in build.properties when deploying to JBoss AS 5.
+Please note that you need to set the loadPersistenceUnits property to "true"
+in build.properties when deploying to JBoss AS 4.
When editing Groovy files from the src/action directory, you can run ant
"jbosswar.explode" to see your changes take effect. When editing Groovy files
Modified: branches/community/Seam_2_2/src/test/ftest/examples/groovybooking/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/groovybooking/build.xml 2010-09-07 14:00:37 UTC (rev 13728)
+++ branches/community/Seam_2_2/src/test/ftest/examples/groovybooking/build.xml 2010-09-08 14:36:47 UTC (rev 13729)
@@ -26,13 +26,13 @@
<property name="jboss4.undeploy.target" value="jbosswar.unexplode" />
<property name="jboss4.context.path" value="/jboss-seam-groovybooking" />
- <property name="loadPersistenceUnits" value="false" />
+ <property name="loadPersistenceUnits" value="true" />
<target name="set.deploy.properties">
- <propertyset id="jboss4.deploy.properties" />
- <propertyset id="jboss5.deploy.properties">
+ <propertyset id="jboss4.deploy.properties">
<propertyref name="loadPersistenceUnits" id="loadPersistenceUnits" />
</propertyset>
+ <propertyset id="jboss5.deploy.properties" />
</target>
<import file="../build.xml" />
14 years, 3 months
Seam SVN: r13728 - dist/trunk.
by seam-commits@lists.jboss.org
Author: tsurdilovic
Date: 2010-09-07 10:00:37 -0400 (Tue, 07 Sep 2010)
New Revision: 13728
Modified:
dist/trunk/pom.xml
Log:
upgraded drools to 5.1.1
Modified: dist/trunk/pom.xml
===================================================================
--- dist/trunk/pom.xml 2010-09-07 10:30:13 UTC (rev 13727)
+++ dist/trunk/pom.xml 2010-09-07 14:00:37 UTC (rev 13728)
@@ -42,7 +42,7 @@
<jms.api.version>1.1</jms.api.version>
<hibernate.version>3.5.1-Final</hibernate.version>
- <drools.version>5.1.0.M2</drools.version>
+ <drools.version>5.1.1</drools.version>
<jbpm.version>4.2</jbpm.version>
<picketlink.idm.version>1.5.0.Alpha01</picketlink.idm.version>
<joda.time.version>1.6</joda.time.version>
14 years, 3 months
Seam SVN: r13726 - examples/trunk.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-09-07 06:15:12 -0400 (Tue, 07 Sep 2010)
New Revision: 13726
Modified:
examples/trunk/pom.xml
Log:
more modern parent
Modified: examples/trunk/pom.xml
===================================================================
--- examples/trunk/pom.xml 2010-09-06 17:20:06 UTC (rev 13725)
+++ examples/trunk/pom.xml 2010-09-07 10:15:12 UTC (rev 13726)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.jboss.seam</groupId>
<artifactId>seam-parent</artifactId>
- <version>1</version>
+ <version>3</version>
</parent>
<groupId>org.jboss.seam.examples</groupId>
14 years, 3 months
Seam SVN: r13725 - modules/security/trunk.
by seam-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2010-09-06 13:20:06 -0400 (Mon, 06 Sep 2010)
New Revision: 13725
Modified:
modules/security/trunk/pom.xml
Log:
upgrade to released snapshot
Modified: modules/security/trunk/pom.xml
===================================================================
--- modules/security/trunk/pom.xml 2010-09-06 13:52:00 UTC (rev 13724)
+++ modules/security/trunk/pom.xml 2010-09-06 17:20:06 UTC (rev 13725)
@@ -5,7 +5,7 @@
<parent>
<artifactId>seam-parent</artifactId>
<groupId>org.jboss.seam</groupId>
- <version>3-SNAPSHOT</version>
+ <version>3</version>
</parent>
<groupId>org.jboss.seam.security</groupId>
14 years, 3 months
Seam SVN: r13724 - in branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files: idea and 1 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-09-06 09:52:00 -0400 (Mon, 06 Sep 2010)
New Revision: 13724
Modified:
branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/eclipse/.classpath
branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/idea/module.iml
branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/netbeans/project.xml
Log:
JBPAPP-5015 fixed jta.jar link
Modified: branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/eclipse/.classpath
===================================================================
--- branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/eclipse/.classpath 2010-09-06 10:00:00 UTC (rev 13723)
+++ branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/eclipse/.classpath 2010-09-06 13:52:00 UTC (rev 13724)
@@ -33,7 +33,7 @@
<classpathentry kind="lib" path="lib/persistence-api.jar" />
<classpathentry kind="lib" path="lib/ejb-api.jar" />
<classpathentry kind="lib" path="lib/jsr250-api.jar" />
- <classpathentry kind="lib" path="lib/jta.jar" />
+ <classpathentry kind="lib" path="lib/jboss-transaction-api.jar" />
<classpathentry kind="lib" path="lib/core.jar"/>
<classpathentry kind="lib" path="lib/jboss-embedded-api.jar"/>
<classpathentry kind="lib" path="lib/hibernate-search.jar" />
Modified: branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/idea/module.iml
===================================================================
--- branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/idea/module.iml 2010-09-06 10:00:00 UTC (rev 13723)
+++ branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/idea/module.iml 2010-09-06 13:52:00 UTC (rev 13724)
@@ -326,7 +326,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/lib/jta.jar!/" />
+ <root url="jar://$MODULE_DIR$/lib/jboss-transaction-api.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
Modified: branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/netbeans/project.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/netbeans/project.xml 2010-09-06 10:00:00 UTC (rev 13723)
+++ branches/enterprise/JBPAPP_5_0/seam-gen/ide-project-files/netbeans/project.xml 2010-09-06 13:52:00 UTC (rev 13724)
@@ -96,18 +96,18 @@
<java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/2">
<compilation-unit>
<package-root>src/main</package-root>
- <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jboss-transaction-api.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
<package-root>src/hot</package-root>
- <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jboss-transaction-api.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/richfaces-ui.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
<compilation-unit>
<package-root>src/test</package-root>
<unit-tests/>
- <classpath mode="compile">bootstrap:lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/testng-jdk15.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jta.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
+ <classpath mode="compile">bootstrap:lib/hibernate-validator.jar:lib/hibernate-core.jar:lib/hibernate-annotations.jar:lib/hibernate-commons-annotations.jar:lib/hibernate-entitymanager.jar:lib/jboss-seam.jar:lib/jboss-seam-debug.jar:lib/jboss-cache.jar:lib/jbpm-jpdl.jar:lib/antlr.jar:lib/jgroups.jar:lib/jsf-facelets.jar:lib/jstl.jar:lib/jsf-api.jar:lib/servlet-api.jar:lib/testng-jdk15.jar:lib/jboss-el.jar:lib/el-api.jar:lib/mvel2.jar:lib/drools-api.jar:lib/drools-core.jar:lib/drools-compiler.jar:lib/janino.jar:lib/antlr-runtime.jar:lib/mail.jar:lib/persistence-api.jar:lib/ejb-api.jar:lib/jsr250-api.jar:lib/jboss-transaction-api.jar:lib/core.jar:lib/jboss-embedded-api.jar:lib/hibernate-search.jar:lib/richfaces-api.jar:lib/@driverJar@:lib/lucene-core.jar</classpath>
<source-level>1.5</source-level>
</compilation-unit>
</java-data>
14 years, 3 months