Author: jharting
Date: 2009-01-20 04:53:13 -0500 (Tue, 20 Jan 2009)
New Revision: 9956
Added:
trunk/src/test/ftest/examples/messages/
trunk/src/test/ftest/examples/messages/build.xml
trunk/src/test/ftest/examples/messages/jboss-embedded.xml
trunk/src/test/ftest/examples/messages/jboss.xml
trunk/src/test/ftest/examples/messages/src/
trunk/src/test/ftest/examples/messages/src/org/
trunk/src/test/ftest/examples/messages/src/org/jboss/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
Modified:
trunk/examples/messages/view/messages.jsp
trunk/src/test/ftest/build.xml
Log:
JBSEAM-3690 Added tests for messages example
Modified: trunk/examples/messages/view/messages.jsp
===================================================================
--- trunk/examples/messages/view/messages.jsp 2009-01-20 09:14:30 UTC (rev 9955)
+++ trunk/examples/messages/view/messages.jsp 2009-01-20 09:53:13 UTC (rev 9956)
@@ -8,34 +8,34 @@
<body>
<f:view>
<h2>Message List</h2>
- <h:outputText value="No messages to display"
rendered="#{messageList.rowCount==0}"/>
- <h:dataTable var="msg" value="#{messageList}"
rendered="#{messageList.rowCount>0}">
+ <h:outputText id="noMessages" value="No messages to display"
rendered="#{messageList.rowCount==0}"/>
+ <h:dataTable id="messages" var="msg"
value="#{messageList}" rendered="#{messageList.rowCount>0}">
<h:column>
<f:facet name="header">
<h:outputText value="Read"/>
</f:facet>
- <h:selectBooleanCheckbox value="#{msg.read}"
disabled="true"/>
+ <h:selectBooleanCheckbox id="read" value="#{msg.read}"
disabled="true"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Title"/>
</f:facet>
- <s:link value="#{msg.title}"
action="#{messageManager.select}"/>
+ <s:link id="link" value="#{msg.title}"
action="#{messageManager.select}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Date/Time"/>
</f:facet>
- <h:outputText value="#{msg.datetime}">
+ <h:outputText id="date" value="#{msg.datetime}">
<s:convertDateTime type="both" dateStyle="medium"
timeStyle="short"/>
</h:outputText>
</h:column>
<h:column>
- <s:button value="Delete"
action="#{messageManager.delete}"/>
+ <s:button id="delete" value="Delete"
action="#{messageManager.delete}"/>
</h:column>
</h:dataTable>
- <h3><h:outputText value="#{message.title}"/></h3>
- <div><h:outputText value="#{message.text}"/></div>
+ <h3><h:outputText id="title"
value="#{message.title}"/></h3>
+ <div><h:outputText id="text"
value="#{message.text}"/></div>
</f:view>
</body>
</html>
\ No newline at end of file
Modified: trunk/src/test/ftest/build.xml
===================================================================
--- trunk/src/test/ftest/build.xml 2009-01-20 09:14:30 UTC (rev 9955)
+++ trunk/src/test/ftest/build.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -59,6 +59,7 @@
<testexample name="hibernate" />
<testexample name="icefaces" />
<testexample name="jpa" />
+ <testexample name="messages" />
<testexample name="nestedbooking" />
<testexample name="numberguess" />
<testexample name="quartz" />
@@ -75,6 +76,7 @@
<!-- Execute tests for all examples on jboss-embedded -->
<testexample name="blog" />
<testexample name="dvdstore" />
+ <testexample name="messages" />
<testexample name="numberguess" />
<testexample name="registration" />
<testexample name="seampay" />
@@ -133,6 +135,7 @@
<cleanexample name="hibernate" />
<cleanexample name="icefaces" />
<cleanexample name="jpa" />
+ <cleanexample name="messages" />
<cleanexample name="nestedbooking" />
<cleanexample name="numberguess" />
<cleanexample name="quartz" />
@@ -152,6 +155,7 @@
<undeployexample name="hibernate" />
<undeployexample name="icefaces" />
<undeployexample name="jpa" />
+ <undeployexample name="messages" />
<undeployexample name="nestedbooking" />
<undeployexample name="numberguess" />
<undeployexample name="quartz" />
Added: trunk/src/test/ftest/examples/messages/build.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/build.xml (rev 0)
+++ trunk/src/test/ftest/examples/messages/build.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.
+-->
+<project name="messages.ftest.build" basedir="."
default="build">
+ <property name="example.name" value="messages"/>
+ <property name="jboss.deploy.target" value="deploy"/>
+ <property name="jboss.undeploy.target" value="undeploy"/>
+ <property name="jboss.example.ready.check.url"
value="seam-messages/messages.seam"/>
+ <property name="jboss-embedded.deploy.target"
value="tomcat.deploy"/>
+ <property name="jboss-embedded.undeploy.target"
value="tomcat.undeploy"/>
+ <property name="jboss-embedded.example.ready.check.url"
value="jboss-seam-messages/messages.seam"/>
+
+ <import file="../build.xml" />
+</project>
Property changes on: trunk/src/test/ftest/examples/messages/build.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/messages/jboss-embedded.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/jboss-embedded.xml (rev
0)
+++ trunk/src/test/ftest/examples/messages/jboss-embedded.xml 2009-01-20 09:53:13 UTC (rev
9956)
@@ -0,0 +1,31 @@
+<!--
+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.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Messages example" verbose="2"
parallel="false">
+ <test name="messages_jboss-embedded">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/jboss-seam-messages"
/>
+ <classes>
+ <class name="org.jboss.seam.example.messages.test.selenium.MessageTest"
/>
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/messages/jboss-embedded.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: trunk/src/test/ftest/examples/messages/jboss.xml
===================================================================
--- trunk/src/test/ftest/examples/messages/jboss.xml (rev 0)
+++ trunk/src/test/ftest/examples/messages/jboss.xml 2009-01-20 09:53:13 UTC (rev 9956)
@@ -0,0 +1,31 @@
+<!--
+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.
+-->
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Messages example" verbose="2"
parallel="false">
+ <test name="messages_jboss">
+ <parameter name="PROPERTY_FILE" value="" />
+ <parameter name="CONTEXT_PATH" value="/seam-messages" />
+ <classes>
+ <class name="org.jboss.seam.example.messages.test.selenium.MessageTest"
/>
+ </classes>
+ </test>
+</suite>
Property changes on: trunk/src/test/ftest/examples/messages/jboss.xml
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added:
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
===================================================================
---
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
(rev 0)
+++
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java 2009-01-20
09:53:13 UTC (rev 9956)
@@ -0,0 +1,83 @@
+/*
+ * 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.messages.test.selenium;
+
+import java.text.MessageFormat;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertEquals;
+
+/**
+ * Test for messages example
+ * @author Jozef Hartinger
+ *
+ */
+public class MessageTest extends SeamSeleniumTest
+{
+
+ public static final String MESSAGES_URL = "/messages.seam";
+ public static final String MESSAGES_LINK = "messages:{0}:link";
+ public static final String MESSAGES_DELETE = "messages:{0}:delete";
+ public static final String MESSAGES_CHECKBOX = "messages:{0}:read";
+ public static final String MESSAGES_COUNT =
"//table[@id='messages']/tbody/tr";
+ public static final String MESSAGE_TITLE = "title";
+ public static final String MESSAGE_TEXT = "text";
+
+ @Override
+ @BeforeMethod
+ public void setUp()
+ {
+ super.setUp();
+ browser.open(CONTEXT_PATH + MESSAGES_URL);
+ }
+
+ @Test(dataProvider = "messages")
+ public void readMessageTest(int i, String title, String text)
+ {
+ browser.clickAndWait(MessageFormat.format(MESSAGES_LINK, i));
+ assertEquals("Unexpected message title displayed.", title,
browser.getText(MESSAGE_TITLE));
+ assertEquals("Unexpected message text displayed.", text,
browser.getText(MESSAGE_TEXT));
+ assertTrue("Checkbox should be checked after message is read.",
browser.isChecked(MessageFormat.format(MESSAGES_CHECKBOX, i)));
+ }
+
+ @Test(dependsOnMethods = {"readMessageTest"}, dataProvider =
"messages")
+ public void deleteMessageTest(int i, String title, String name)
+ {
+ int messageCount = browser.getXpathCount(MESSAGES_COUNT).intValue();
+ // delete first message in a table
+ browser.clickAndWait(MessageFormat.format(MESSAGES_DELETE, 0));
+ assertEquals("Unexpected count of messages.", --messageCount,
browser.getXpathCount(MESSAGES_COUNT));
+ assertFalse("Message title still present.",
browser.isTextPresent(title));
+ }
+
+ @DataProvider(name = "messages")
+ public Object[][] getMessages()
+ {
+ Object[][] messages = { { 0, "Greetings Earthling", "This is another
example of a message." }, { 1, "Hello World", "This is an example of a
message." } };
+ return messages;
+ }
+}
Property changes on:
trunk/src/test/ftest/examples/messages/src/org/jboss/seam/example/messages/test/selenium/MessageTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain