Author: ozizka(a)redhat.com
Date: 2009-04-20 12:12:09 -0400 (Mon, 20 Apr 2009)
New Revision: 310
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
EAR and WAR tests updated.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-04-20
15:33:19 UTC (rev 309)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-04-20
16:12:09 UTC (rev 310)
@@ -352,11 +352,11 @@
String id = input.getId();
String xpath;
if(isRadioButton) {
- xpath =
".//input[(a)onchange=\"setInputUnset(document.getElementById('"+ id
+ xpath =
".//input[(a)onclick=\"setInputUnset(document.getElementById('"+ id
+ "'), this.checked);setInputUnset(document.getElementById('"
+ id.substring(0, id.lastIndexOf(":")) + ":1'),
this.checked);\"]";
} else {
- xpath =
".//input[(a)onchange=\"setInputUnset(document.getElementById('"
+ xpath =
".//input[(a)onclick=\"setInputUnset(document.getElementById('"
+ id + "'), this.checked);\"]";
}
@@ -495,11 +495,29 @@
/**
* Check that the given messages occur on the client side and server side.
+ * Uses checkClientAndServerMessages( String, String, FacesMessage.Severity ),
+ * kept for backwards compat.
*/
public void checkClientAndServerMessages(String expectedClientMsg,
String expectedServerMsg,
- boolean isErrorMsg) {
+ boolean isErrorMsg)
+ {
+ FacesMessage.Severity expectedSeverity = FacesMessage.SEVERITY_INFO;
+
+ if(isErrorMsg) {
+ expectedSeverity = FacesMessage.SEVERITY_ERROR;
+ }
+ }
+
+ /**
+ * Check that the given messages with given severity
+ * occur on the client side and server side.
+ */
+ public void checkClientAndServerMessages(String expectedClientMsg,
+ 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));
@@ -509,11 +527,8 @@
server.getFacesMessages().hasNext());
FacesMessage message = server.getFacesMessages().next();
- if(isErrorMsg) {
- assertEquals("Incorrect message severity",
FacesMessage.SEVERITY_ERROR, message.getSeverity());
- } else {
- assertEquals("Incorrect message severity",
FacesMessage.SEVERITY_INFO, message.getSeverity());
- }
+
+ assertEquals("Incorrect message severity", expectedSeverity,
message.getSeverity());
assertTrue("Expected message: " + expectedServerMsg + " Actual:
"+ message.getDetail(),
message.getDetail().contains(expectedServerMsg));
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-20
15:33:19 UTC (rev 309)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-04-20
16:12:09 UTC (rev 310)
@@ -184,6 +184,7 @@
{
String headerText = "JBossAS Server";
+ String jbossConfig = ejtt.getJBossConfig();
assertTrue("Page doesn't contain the header: "+headerText,
client.getPageAsText().contains(headerText));
@@ -194,7 +195,7 @@
// Check whether the server is listed. If not, Exception is thrown.
ContentTableRow row =
ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application
Server")
- .getFirstRowContainingLink("JBAS (default)");
+ .getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
// Click the server link
//HtmlAnchor link row.getLinkByLabel("JBAS (default)");
Node firstLink =
row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
@@ -208,7 +209,8 @@
{
String pageText = client.getPageAsText();
- String headerText = "JBAS (default)";
+ String jbossConfig = ejtt.getJBossConfig();
+ String headerText = "JBoss AS 5 ("+jbossConfig+")";
assertTrue("Page doesn't contain the header: "+headerText,
pageText.contains(headerText));
@@ -1035,10 +1037,16 @@
HtmlSubmitInput submit =
ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
submit.click();
- // Check that the new app is deployed.
- ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME2, 3000,
15);
-
+ // We should get:
+ // The specified file must have the same name as the existing
+ // deployed EAR File (EarWithWar-Counter.ear).
+ String msg = "The specified file must have the same name " +
+ "as the existing deployed EAR File";
+ checkClientAndServerMessages( msg, msg, FacesMessage.SEVERITY_WARN );
+ // Check that the old app is deployed.
+ ejtt.deployment.waitActivelyForDeployment(DeployableTypes.EAR, DEPLOYABLE_NAME, 3000,
15);
+
}
finally {
try {
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-20
15:33:19 UTC (rev 309)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java 2009-04-20
16:12:09 UTC (rev 310)
@@ -156,6 +156,7 @@
{
String headerText = "JBossAS Server";
+ String jbossConfig = ejtt.getJBossConfig();
assertTrue("Page doesn't contain the header: "+headerText,
client.getPageAsText().contains(headerText));
@@ -166,7 +167,7 @@
// Check whether the server is listed. If not, Exception is thrown.
ContentTableRow row =
ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("JBoss Application
Server")
- .getFirstRowContainingLink("JBAS (default)");
+ .getFirstRowContainingLink("JBoss AS 5 ("+jbossConfig+")");
// Click the server link
//HtmlAnchor link row.getLinkByLabel("JBoss App Server:default");
Node firstLink =
row.getCellByColumnName("Name").getElementsByTagName("a").item(0);
@@ -180,7 +181,8 @@
{
String pageText = client.getPageAsText();
- String headerText = "JBAS (default)";
+ String jbossConfig = ejtt.getJBossConfig();
+ String headerText = "JBoss AS 5 ("+jbossConfig+")";
assertTrue("Page doesn't contain the header: "+headerText,
pageText.contains(headerText));
@@ -1006,7 +1008,7 @@
try {
undeployWAR(DEPLOYABLE_NAME);
} catch( Exception ex ){
- DebugUtils.writeFile("testRestartWar-undeploy.html",
client.getPageAsText());///
+ DebugUtils.writeFile("target/testRestartWar-undeploy.html",
client.getPageAsText());///
log.debug("Cathed an expected exception when trying to undeploy
"+DEPLOYABLE_NAME+": "+ex );
}
}
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-04-20
15:33:19 UTC (rev 309)
+++
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-04-20
16:12:09 UTC (rev 310)
@@ -254,7 +254,7 @@
}catch(Exception ex){
log.error("Caught when writing file: "+ex);
}
- throw new HtmlElementNotFoundException("Nav tree form not found using ID:
"+ID_NAV_TREE_FORM);
+ throw new HtmlElementNotFoundException("Nav tree form not found using ID:
"+ID_NAV_TREE_FORM, currentTest);
}
// A table which has an anchor containing given text.