Author: ozizka(a)redhat.com
Date: 2009-07-16 18:50:23 -0400 (Thu, 16 Jul 2009)
New Revision: 563
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
* War tests updated.
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java
(rev 0)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbJoprTestConstants.java 2009-07-16
22:50:23 UTC (rev 563)
@@ -0,0 +1,23 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+package org.jboss.jopr.jsfunit;
+
+/**
+ *
+ * @author Ondrej Zizka
+ */
+public interface EmbJoprTestConstants {
+
+ //public static final String AS_NODE_NAME_FORMAT = "JBoss AS 5 (%s)";
+ public static final String AS_NODE_NAME_FORMAT = "JBoss EAP 5 (%s)";
+
+ public static final String LABEL_AS_SERVERS_SUMMARY = "JBoss Application
Server";
+
+}// interface
+
+
+
+
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-07-16
16:28:25 UTC (rev 562)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-07-16
22:50:23 UTC (rev 563)
@@ -60,7 +60,7 @@
* @author Ondrej Zizka
* @author Stan Silvert
*/
-public abstract class EmbjoprTestCase extends ServletTestCase {
+public abstract class EmbjoprTestCase extends ServletTestCase implements
EmbJoprTestConstants {
protected final Logger log = Logger.getLogger(this.getClass().getName());
@@ -573,20 +573,21 @@
String expectedServerMsg,
FacesMessage.Severity expectedSeverity ) {
- // Check that the expected message appears on the client side
- assertTrue("This expected message was not found on the page: " +
expectedClientMsg,
- client.getPageAsText().contains(expectedClientMsg));
-
// Check that the expected message appears on the server side
assertTrue("Expected message not found in faces messages (no messages in
Faces)",
server.getFacesMessages().hasNext());
-
+
FacesMessage message = server.getFacesMessages().next();
assertEquals("Incorrect message severity", expectedSeverity,
message.getSeverity());
-
+
assertTrue("Expected message: " + expectedServerMsg + " Actual:
"+ message.getDetail(),
message.getDetail().contains(expectedServerMsg));
+
+ // Check that the expected message appears on the client side
+ assertTrue("This expected message was not found on the page: " +
expectedClientMsg,
+ client.getPageAsText().contains(expectedClientMsg));
+
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java 2009-07-16
16:28:25 UTC (rev 562)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/app/war/WarTest.java 2009-07-16
22:50:23 UTC (rev 563)
@@ -31,8 +31,6 @@
import org.jboss.jopr.jsfunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.*;
-import java.net.InetAddress;
-import java.net.Socket;
import java.util.Properties;
import javax.faces.application.FacesMessage;
import junit.framework.Test;
@@ -293,8 +291,8 @@
client.getPageAsText().contains("UP"));
// Check whether the server is listed. If not, Exception is thrown.
ContentTableRow row =
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application
Server")
- .getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader(LABEL_AS_SERVERS_SUMMARY)
+ .getFirstRowContainingLink( String.format(AS_NODE_NAME_FORMAT, jbossConfig)); //
"JBoss EAP 5 (...)");
// Click the server link
//HtmlAnchor link row.getLinkByLabel("JBoss App Server:default");
Node firstLink =
row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
@@ -494,7 +492,7 @@
// Metrics Summary - currently hidden.
- ContentTable metricsTable =
ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Numeric Metrics");
+ ContentTable metricsTable =
ejtt.getTabMenu().getTabContentBox().findTableUnderHeader("Numeric Metrics");
if( null == metricsTable )
log.info("Metrics table not present.");
else{
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
---
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-07-16
16:28:25 UTC (rev 562)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-07-16
22:50:23 UTC (rev 563)
@@ -689,6 +689,8 @@
/**
* Returns first table under given header.
+ * If the header is not found or there's no table following the header, returns
null or throws HtmlElementNotFoundException,
+ * depending on throwIfNotFound.
*
* Unfortunately, headers are not H2 or similar, but DIV
class="instructionalText".
* To be revised later.
@@ -713,6 +715,10 @@
return new ContentTable(tableElement);
}
+ /**
+ * Returns first table under given header.
+ * @throws HtmlElementNotFoundException if the header is not found or there's no
table following the header.
+ */
public ContentTable getTableUnderHeader( String headerText ) throws
ActionOutOfSyncException, HtmlElementNotFoundException {
return getTableUnderHeader(headerText, true );
}