[jboss-cvs] JBossAS SVN: r59924 - projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jan 22 15:24:44 EST 2007


Author: chilin
Date: 2007-01-22 15:24:44 -0500 (Mon, 22 Jan 2007)
New Revision: 59924

Added:
   projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JBossmqPageTest.java
Removed:
   projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JmsPageTest.java
Log:
c:/temp/message.txt

Copied: projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JBossmqPageTest.java (from rev 59923, projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JmsPageTest.java)
===================================================================
--- projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JBossmqPageTest.java	                        (rev 0)
+++ projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JBossmqPageTest.java	2007-01-22 20:24:44 UTC (rev 59924)
@@ -0,0 +1,1280 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * 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.admin.console.webtest;
+
+import java.net.URL;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlHiddenInput;
+import com.gargoylesoftware.htmlunit.html.HtmlOption;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.html.HtmlSelect;
+import com.gargoylesoftware.htmlunit.html.HtmlTable;
+import com.gargoylesoftware.htmlunit.html.HtmlTableBody;
+import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
+import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
+import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
+
+/**
+ * Integration tests for managing JBossMQ general settings.
+ * 
+ * @author <a href="chi.lin at unisys.com">Chi Lin </a>
+ * @version $Revision$
+ */
+public class JmsPageTest extends AdminConsoleTestCase {
+
+    private static Log log = LogFactory.getLog(JmsPageTest.class);
+
+    private final static String URL_JMS_PAGE = "http://localhost:8080/admin/jms/list.html";
+
+    /*
+     * Define various href anchors
+     */
+    private final static String HREF_SETTINGS_PAGE = "javascript:void(setPageAndSubmit('page1'))";
+
+    private final static String HREF_MORE_PAGE = "javascript:void(setPageAndSubmit('page2'))";
+
+    private final static String HREF_MSG_SQL_PAGE = "javascript:void(setPageAndSubmit('page3'))";
+
+    private final static String HREF_STATE_SQL_PAGE = "javascript:void(setPageAndSubmit('page4'))";
+
+    private final static String HREF_DATASOURCE_LOCALTX = "/admin/datasource/datasource/list.html?type=localtxdatasources";
+
+    private final URL jmsUrl;
+
+    protected final Properties msgProps;
+
+    public JmsPageTest(String arg0) throws Exception {
+        super(arg0);
+        jmsUrl = new URL(URL_JMS_PAGE);
+
+        /*
+         * Load the message properties:
+         */
+        msgProps = loadProperties(jmsMsgFile);
+    }
+
+    /**
+     * @see TestCase#setUp()
+     */
+    protected void setUp() throws Exception {
+        super.setUp();
+    }
+
+    /**
+     * @see TestCase#tearDown()
+     */
+    protected void tearDown() throws Exception {
+        super.tearDown();
+    }
+
+    /**
+     * Verify the provided page contains the expected input fields of the jms
+     * "Settings" page. Note that the value of the input fields are not checked.
+     * 
+     * @param jmsPage
+     *            The HtmlPage to be verified.
+     * @throws Exception
+     */
+    private void verifyJmsSettingsPage(HtmlPage jmsPage) throws Exception {
+        /*
+         * Get the jms form and verify the existence of the input fields:
+         */
+        final HtmlForm form = jmsPage.getFormByName("jms");
+        final HtmlTextInput highMemoryMark = (HtmlTextInput) form
+                .getInputByName("highMemoryMark");
+        final HtmlTextInput maxMemoryMark = (HtmlTextInput) form
+                .getInputByName("maxMemoryMark");
+        final HtmlTextInput maximumHard = (HtmlTextInput) form
+                .getInputByName("maximumHard");
+        final HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        final HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        final HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
+                .getInputByName("softenNoMoreOftenThanMillis");
+        final HtmlTextInput softenWaitMillis = (HtmlTextInput) form
+                .getInputByName("softenWaitMillis");
+        final HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        final HtmlSelect dataSourceName = (HtmlSelect) form
+                .getSelectByName("dataSourceName");
+        final List dataSourceOptions = dataSourceName.getOptions();
+        final HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        final HtmlTextInput recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        final HtmlTextInput recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        final HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        final HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        final HtmlTextInput securityDomain = (HtmlTextInput) form
+                .getInputByName("securityDomain");
+        final List textAreas = form.getTextAreasByName("defaultSecurityRoles");
+        assertEquals(1, textAreas.size());
+    }
+
+    /**
+     * Verify the provided page contains the expected table and table cells of
+     * the jms "More" page.
+     * 
+     * @param morePage
+     *            The HtmlPage to be verified.
+     * @throws Exception
+     */
+    private void verifyMorePage(HtmlPage morePage) throws Exception {
+        /*
+         * Get the jmsTable and verify it is not empty:
+         */
+        final HtmlTable table = (HtmlTable) morePage
+                .getHtmlElementById("jmsTable");
+        final List rows = table.getRows();
+        assertFalse(TABLE_EMPTY, rows.isEmpty());
+
+        /*
+         * Verify correct labels exist in the table:
+         */
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.softenedSize"), table.getCellAt(0, 0)
+                .asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.currentMemoryUsage"), table.getCellAt(1,
+                0).asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.totalCacheSize"), table.getCellAt(2, 0)
+                .asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.hardRefCacheSize"), table
+                .getCellAt(3, 0).asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.softRefCacheSize"), table
+                .getCellAt(4, 0).asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.cacheHits"), table.getCellAt(5, 0)
+                .asText());
+        assertEquals(TABLE_CELL_MISMATCH, msgProps
+                .getProperty("jms.view.cacheMisses"), table.getCellAt(6, 0)
+                .asText());
+
+        /*
+         * Verify the data column of each row is not null:
+         */
+        HtmlTableRow row = null;
+        for (int i = 0; i < rows.size(); i++) {
+            row = (HtmlTableRow) rows.get(i);
+            assertNotNull("Null data in table, row = " + i, row.getCell(1));
+        }
+    }
+
+    /**
+     * Verify the provided page contains the expected input fields of the jms
+     * "Message SQL" page. Note that the value of the input fields are not
+     * checked.
+     * 
+     * @param jmsPage
+     *            The HtmlPage to be verified.
+     * @throws Exception
+     */
+    private void verifyMessageSqlPage(HtmlPage msgSqlPage) throws Exception {
+        /*
+         * Verify the SQL properties for message persistence are present:
+         */
+        final HtmlForm form = msgSqlPage.getFormByName("jms");
+        final HtmlTextInput blobType = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(BLOB_TYPE)");
+        final HtmlTextInput insertTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(INSERT_TX)");
+        final HtmlTextInput insertMessage = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(INSERT_MESSAGE)");
+        final HtmlTextInput selectAllUncommitedTxs = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(SELECT_ALL_UNCOMMITED_TXS)");
+        final HtmlTextInput selectMaxTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(SELECT_MAX_TX)");
+        final HtmlTextInput deleteAllTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_ALL_TX)");
+        final HtmlTextInput selectMessagesInDest = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(SELECT_MESSAGES_IN_DEST)");
+        final HtmlTextInput selectMessage = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(SELECT_MESSAGE)");
+        final HtmlTextInput markMessage = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(MARK_MESSAGE)");
+        final HtmlTextInput updateMessage = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(UPDATE_MESSAGE)");
+        final HtmlTextInput updateMarkedMessages = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(UPDATE_MARKED_MESSAGES)");
+        final HtmlTextInput updateMarkedMessagesWithTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(UPDATE_MARKED_MESSAGES_WITH_TX)");
+        final HtmlTextInput deleteMarkedMessagesWithTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES_WITH_TX)");
+        final HtmlTextInput deleteTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_TX)");
+        final HtmlTextInput deleteMarkedMessages = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES)");
+        final HtmlTextInput deleteTemporaryMessages = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_TEMPORARY_MESSAGES)");
+        final HtmlTextInput deleteMessage = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_MESSAGE)");
+        final HtmlTextInput createMessageTable = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_MESSAGE_TABLE)");
+        final HtmlTextInput createIdxMessageTxopTxid = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_IDX_MESSAGE_TXOP_TXID)");
+        final HtmlTextInput createIdxMessageDestination = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_IDX_MESSAGE_DESTINATION)");
+        final HtmlTextInput createTxTable = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_TX_TABLE)");
+        final HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
+    }
+
+    /**
+     * Verify the provided page contains the expected input fields of the jms
+     * "State SQL" page. Note that the value of the input fields are not
+     * checked.
+     * 
+     * @param jmsPage
+     *            The HtmlPage to be verified.
+     * @throws Exception
+     */
+    private void verifyStateSqlPage(HtmlPage stateSqlPage) throws Exception {
+        /*
+         * Verify the SQL properties for state persistence are present:
+         */
+        final HtmlForm form = stateSqlPage.getFormByName("jms");
+        final HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(CREATE_TABLES_ON_STARTUP)");
+        final HtmlTextInput createUserTalbe = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(CREATE_USER_TABLE)");
+        final HtmlTextInput createRoleTable = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(CREATE_ROLE_TABLE)");
+        final HtmlTextInput createSubscriptionTable = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(CREATE_SUBSCRIPTION_TABLE)");
+        final HtmlTextInput getSubscription = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(GET_SUBSCRIPTION)");
+        final HtmlTextInput lockSubscription = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(LOCK_SUBSCRIPTION)");
+        final HtmlTextInput getSubscriptionsForTopic = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(GET_SUBSCRIPTIONS_FOR_TOPIC)");
+        final HtmlTextInput insertSubscription = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(INSERT_SUBSCRIPTION)");
+        final HtmlTextInput updateSubscription = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(UPDATE_SUBSCRIPTION)");
+        final HtmlTextInput removeSubscription = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(REMOVE_SUBSCRIPTION)");
+        final HtmlTextInput getUserByClientid = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(GET_USER_BY_CLIENTID)");
+        final HtmlTextInput getUser = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(GET_USER)");
+    }
+
+    /**
+     * Restore the jms settings back to the saved values.
+     * 
+     * @param jmsPage
+     *            The current jms page
+     * @param savedJmsPage
+     *            The jms page the values are to be restored from
+     * @throws Exception
+     */
+    private void restoreJmsSettings(HtmlPage jmsPage, HtmlPage savedJmsPage)
+            throws Exception {
+        /*
+         * Get the current and saved jms forms:
+         */
+        HtmlForm form = jmsPage.getFormByName("jms");
+        HtmlForm savedForm = savedJmsPage.getFormByName("jms");
+
+        /*
+         * Restore the values from the saved form:
+         */
+        HtmlTextInput highMemoryMark = (HtmlTextInput) form
+                .getInputByName("highMemoryMark");
+        highMemoryMark.setValueAttribute(savedForm.getInputByName(
+                "highMemoryMark").asText());
+
+        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
+                .getInputByName("maxMemoryMark");
+        maxMemoryMark.setValueAttribute(savedForm.getInputByName(
+                "maxMemoryMark").asText());
+
+        HtmlTextInput maximumHard = (HtmlTextInput) form
+                .getInputByName("maximumHard");
+        maximumHard.setValueAttribute(savedForm.getInputByName("maximumHard")
+                .asText());
+
+        HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        minimumHard.setValueAttribute(savedForm.getInputByName("minimumHard")
+                .asText());
+
+        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        softenAtLeastEveryMillis.setValueAttribute(savedForm.getInputByName(
+                "softenAtLeastEveryMillis").asText());
+
+        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
+                .getInputByName("softenNoMoreOftenThanMillis");
+        softenNoMoreOftenThanMillis.setValueAttribute(savedForm.getInputByName(
+                "softenNoMoreOftenThanMillis").asText());
+
+        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
+                .getInputByName("softenWaitMillis");
+        softenWaitMillis.setValueAttribute(savedForm.getInputByName(
+                "softenWaitMillis").asText());
+
+        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        makeSoftReferences.setChecked(savedForm.getInputByName(
+                "makeSoftReferences").isChecked());
+
+        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        connectionRetryAttempts.setValueAttribute(savedForm.getInputByName(
+                "connectionRetryAttempts").asText());
+
+        HtmlTextInput recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        recoveryRetries.setValueAttribute(savedForm.getInputByName(
+                "recoveryRetries").asText());
+
+        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        recoveryTimeout.setValueAttribute(savedForm.getInputByName(
+                "recoveryTimeout").asText());
+
+        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        recoverMessagesChunk.setValueAttribute(savedForm.getInputByName(
+                "recoverMessagesChunk").asText());
+
+        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        hasSecurityManager.setChecked(savedForm.getInputByName(
+                "hasSecurityManager").isChecked());
+
+        HtmlTextInput securityDomain = (HtmlTextInput) form
+                .getInputByName("securityDomain");
+        securityDomain.setValueAttribute(savedForm.getInputByName(
+                "securityDomain").asText());
+
+        List textAreas = form.getTextAreasByName("defaultSecurityRoles");
+        List savedTextAreas = savedForm
+                .getTextAreasByName("defaultSecurityRoles");
+        HtmlTextArea defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
+        HtmlTextArea savedDefaultSecurityRoles = (HtmlTextArea) savedTextAreas
+                .get(0);
+        defaultSecurityRoles.setText(savedDefaultSecurityRoles.getText());
+
+        /*
+         * Click the "Save" button to submit the form:
+         */
+        clickButton(form, SAVE_BUTTON);
+    }
+
+    /**
+     * Create a local transactions data source with the specified name,
+     * connection url, and driver class.
+     * 
+     * @param jndiName
+     *            The jndi name of the data source
+     * @param connectionUrl
+     *            The connection url
+     * @param driverClass
+     *            The driver class
+     * @throws Exception
+     */
+    private void createDataSource(String jndiName, String connectionUrl,
+            String driverClass) throws Exception {
+        /*
+         * Get the jms home page and click the "Local Transactions" link:
+         */
+        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
+        HtmlPage localTxPage = clickLink(homePage, HREF_DATASOURCE_LOCALTX);
+
+        /*
+         * Click the "Create" button:
+         */
+        HtmlForm identifierForm = localTxPage
+                .getFormByName("datasourceIdentifier");
+        HtmlPage createPage = clickButton(identifierForm, CREATE_BUTTON);
+
+        /*
+         * Get the "datasource" form and fill in data for the required
+         * attributes:
+         */
+        HtmlForm datasourceForm = createPage.getFormByName("datasource");
+
+        HtmlTextInput htmlJndiName = (HtmlTextInput) datasourceForm
+                .getInputByName("JNDIname");
+        htmlJndiName.setValueAttribute(jndiName);
+
+        HtmlTextInput htmlConnectionUrl = (HtmlTextInput) datasourceForm
+                .getInputByName("connectionURL");
+        htmlConnectionUrl.setValueAttribute(connectionUrl);
+
+        HtmlTextInput htmlDriverClass = (HtmlTextInput) datasourceForm
+                .getInputByName("driverClassName");
+        htmlDriverClass.setValueAttribute(driverClass);
+
+        /*
+         * Click the "Save" button to create the data source:
+         */
+        clickButton(datasourceForm, SAVE_BUTTON);
+    }
+
+    /**
+     * Remove the specified local transactions data source.
+     * 
+     * @param jndiName
+     *            The jndi name of the data source
+     * @throws Exception
+     */
+    private void removeDataSource(String jndiName) throws Exception {
+        /*
+         * Get the jms home page and click the "Local Transactions" link:
+         */
+        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
+        HtmlPage localTxPage = clickLink(homePage, HREF_DATASOURCE_LOCALTX);
+
+        /*
+         * Get the dsTable and walk through the forms and table bodies to find
+         * the row containing the data source we're looking for:
+         */
+        HtmlForm form = null;
+        List bodies = null;
+        HtmlTableBody tBody = null;
+        List rows = null;
+        HtmlTableRow row = null;
+
+        HtmlTable table = (HtmlTable) localTxPage.getHtmlElementById("dsTable");
+        List forms = table.getHtmlElementsByTagName("form");
+        Iterator formIter = forms.iterator();
+
+        while (formIter.hasNext()) {
+            form = (HtmlForm) formIter.next();
+            bodies = form.getHtmlElementsByTagName("tbody");
+            assertEquals("Form should contain 1 <tbody>.", 1, bodies.size());
+
+            tBody = (HtmlTableBody) bodies.get(0);
+            rows = tBody.getRows();
+            assertEquals("<tbody> should contain 1 row.", 1, rows.size());
+
+            row = (HtmlTableRow) rows.get(0);
+            log.debug("name = " + row.getCell(0).asText());
+            if (jndiName.equals(row.getCell(0).asText())) {
+                /*
+                 * Found our row. Register a confirm handler to ok the remove
+                 * request:
+                 */
+                log.debug("found our row");
+                webClient.setConfirmHandler(new ConfirmHandlerImpl(true));
+
+                /*
+                 * Remove the data source and exit the loop:
+                 */
+                clickButton(form, REMOVE_BUTTON);
+                break;
+            }
+        }
+    }
+
+    /**
+     * Test the action to view the jms page.
+     * 
+     * @throws Exception
+     */
+    public void testViewJmsPage() throws Exception {
+        /*
+         * Get the jms home page:
+         */
+        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
+
+        /*
+         * Click the "Manage JBossMQ" link and verify the page content:
+         */
+        HtmlPage jmsPage = clickLink(homePage, HREF_MANAGE_JBOSSMQ);
+        verifyJmsSettingsPage(jmsPage);
+    }
+
+    /**
+     * Test the action to click various tabs from the jms "Settings" page.
+     * 
+     * @throws Exception
+     */
+    public void testClickTabsFromJmsPage() throws Exception {
+        /*
+         * Get the jms page:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+
+        /*
+         * Click the "More" tab and verify the corrct page was obtained:
+         */
+        HtmlPage morePage = clickLink(jmsPage, HREF_MORE_PAGE);
+        verifyMorePage(morePage);
+
+        /*
+         * Click the "Message SQL" tab and verify the corrct page was obtained:
+         */
+        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
+        verifyMessageSqlPage(msgSqlPage);
+
+        /*
+         * Click the "State SQL" tab and verify the corrct page was obtained:
+         */
+        HtmlPage stateSqlPage = clickLink(jmsPage, HREF_STATE_SQL_PAGE);
+        verifyStateSqlPage(stateSqlPage);
+    }
+
+    /**
+     * Test the action to click various tabs from the jms "More" page.
+     * 
+     * @throws Exception
+     */
+    public void testClickTabsFromMorePage() throws Exception {
+        /*
+         * Get the "More" page:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlPage morePage = clickLink(jmsPage, HREF_MORE_PAGE);
+
+        /*
+         * Click the "Settings" tab and verify the page:
+         */
+        HtmlPage settingsPage = clickLink(morePage, HREF_SETTINGS_PAGE);
+        verifyJmsSettingsPage(settingsPage);
+
+        /*
+         * Click the "Message SQL" tab and verify the page:
+         */
+        HtmlPage msgSqlPage = clickLink(morePage, HREF_MSG_SQL_PAGE);
+        verifyMessageSqlPage(msgSqlPage);
+
+        /*
+         * Click the "State SQL" tab and verify the page:
+         */
+        HtmlPage stateSqlPage = clickLink(morePage, HREF_STATE_SQL_PAGE);
+        verifyStateSqlPage(stateSqlPage);
+    }
+
+    /**
+     * Test the action to click various tabs from the jms "Message SQL" page.
+     * 
+     * @throws Exception
+     */
+    public void testClickTabsFromMessageSqlPage() throws Exception {
+        /*
+         * Get the "Message SQL" page:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
+
+        /*
+         * Click the "Settings" tab and verify the page:
+         */
+        HtmlPage settingsPage = clickLink(msgSqlPage, HREF_SETTINGS_PAGE);
+        verifyJmsSettingsPage(settingsPage);
+
+        /*
+         * Click the "More" tab and verify the page:
+         */
+        HtmlPage morePage = clickLink(msgSqlPage, HREF_MORE_PAGE);
+        verifyMorePage(morePage);
+
+        /*
+         * Click the "State SQL" tab and verify the page:
+         */
+        HtmlPage stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
+        verifyStateSqlPage(stateSqlPage);
+    }
+
+    /**
+     * Test the action to click various tabs from the jms "State SQL" page.
+     * 
+     * @throws Exception
+     */
+    public void testClickTabsFromStateSqlPage() throws Exception {
+        /*
+         * Get the "State SQL" page:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlPage stateSqlPage = clickLink(jmsPage, HREF_STATE_SQL_PAGE);
+
+        /*
+         * Click the "Settings" tab and verify the page:
+         */
+        HtmlPage settingsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
+        verifyJmsSettingsPage(settingsPage);
+
+        /*
+         * Click the "More" tab and verify the page:
+         */
+        HtmlPage morePage = clickLink(stateSqlPage, HREF_MORE_PAGE);
+        verifyMorePage(morePage);
+
+        /*
+         * Click the "Message SQL" tab and verify the page:
+         */
+        HtmlPage msgSqlPage = clickLink(stateSqlPage, HREF_MSG_SQL_PAGE);
+        verifyMessageSqlPage(msgSqlPage);
+    }
+
+    /**
+     * Test the action to update the jms attributes with invalid type of data.
+     * 
+     * @throws Exception
+     */
+    public void testUpdateJmsAttributesWithInvalidDataType() throws Exception {
+        /*
+         * Get the jms page & form:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Assign invalid type of data to the attributes:
+         */
+        String badData = "badData";
+        HtmlTextInput highMemoryMark = (HtmlTextInput) form
+                .getInputByName("highMemoryMark");
+        highMemoryMark.setValueAttribute(badData);
+
+        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
+                .getInputByName("maxMemoryMark");
+        maxMemoryMark.setValueAttribute(badData);
+
+        HtmlTextInput maximumHard = (HtmlTextInput) form
+                .getInputByName("maximumHard");
+        maximumHard.setValueAttribute(badData);
+
+        HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        minimumHard.setValueAttribute(badData);
+
+        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        softenAtLeastEveryMillis.setValueAttribute(badData);
+
+        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
+                .getInputByName("softenNoMoreOftenThanMillis");
+        softenNoMoreOftenThanMillis.setValueAttribute(badData);
+
+        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
+                .getInputByName("softenWaitMillis");
+        softenWaitMillis.setValueAttribute(badData);
+
+        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        connectionRetryAttempts.setValueAttribute(badData);
+
+        HtmlTextInput recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        recoveryRetries.setValueAttribute(badData);
+
+        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        recoveryTimeout.setValueAttribute(badData);
+
+        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        recoverMessagesChunk.setValueAttribute(badData);
+
+        /*
+         * Click the "Save" button and verify the error messages were returned
+         * correctly:
+         */
+        jmsPage = clickButton(form, SAVE_BUTTON);
+        String jmsPageText = jmsPage.asText();
+
+        String expectedMsg = msgProps.getProperty("jms.view.highMemoryMark")
+                + " must be a long";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.maxMemoryMark")
+                + " must be a long";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.maximumHard")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.minimumHard")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.connectionRetryAttempts")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.recoveryRetries")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.recoveryTimeout")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.softenAtLeastEveryMillis")
+                + " must be a long";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps
+                .getProperty("jms.view.softenNoMoreOftenThanMillis")
+                + " must be a long";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.softenWaitMillis")
+                + " must be a long";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+    }
+
+    /**
+     * Test the action to update jms attributes with data that're out of range.
+     * 
+     * @throws Exception
+     */
+    public void testUpdateJmsAttributesWithInvalidDataRange() throws Exception {
+        /*
+         * Get the jms page & form:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Assign invalid values to the attributes:
+         */
+        HtmlTextInput maximumHard = (HtmlTextInput) form
+                .getInputByName("maximumHard");
+        maximumHard.setValueAttribute("-1");
+
+        HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        minimumHard.setValueAttribute("0");
+
+        long maxInt = Integer.MAX_VALUE;
+        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        connectionRetryAttempts.setValueAttribute(Long.toString(maxInt + 1));
+
+        long minInt = Integer.MIN_VALUE;
+        HtmlTextInput recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        recoveryRetries.setValueAttribute(Long.toString(minInt - 1));
+
+        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        recoveryTimeout.setValueAttribute("-1");
+
+        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        recoverMessagesChunk.setValueAttribute("2");
+
+        /*
+         * Click the "Save" button and verify the error messages were returned
+         * correctly:
+         */
+        jmsPage = clickButton(form, SAVE_BUTTON);
+        String jmsPageText = jmsPage.asText();
+
+        String expectedMsg = msgProps.getProperty("jms.view.maximumHard")
+                + " is not in the range 0 through 2147483647";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.minimumHard")
+                + " is not in the range 1 through 2147483647";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.connectionRetryAttempts")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.recoveryRetries")
+                + " must be an integer";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.recoveryTimeout")
+                + " is not in the range 0 through 2147483647";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+
+        expectedMsg = msgProps.getProperty("jms.view.recoverMessagesChunk")
+                + " is not in the range 0 through 1";
+        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
+    }
+
+    /**
+     * Test the action to cancel the jms attribute changes.
+     * 
+     * @throws Exception
+     */
+    public void testCancelJmsAttributeChanges() throws Exception {
+        /*
+         * Get the jms page & form:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Change the values of some attributes:
+         */
+        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
+                .getInputByName("maxMemoryMark");
+        String savedMaxMemoryMark = maxMemoryMark.asText();
+        maxMemoryMark.setValueAttribute("999");
+
+        HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        String savedMinimumHard = minimumHard.asText();
+        minimumHard.setValueAttribute("99");
+
+        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        String savedSoftenAtLeastEveryMillis = softenAtLeastEveryMillis
+                .asText();
+        softenAtLeastEveryMillis.setValueAttribute("9999");
+
+        /*
+         * Click the "Cancel" button and make sure the previous settings were
+         * retained:
+         */
+        jmsPage = clickButton(form, CANCEL_BUTTON);
+        form = jmsPage.getFormByName("jms");
+
+        maxMemoryMark = (HtmlTextInput) form.getInputByName("maxMemoryMark");
+        assertEquals(savedMaxMemoryMark, maxMemoryMark.asText());
+
+        minimumHard = (HtmlTextInput) form.getInputByName("minimumHard");
+        assertEquals(savedMinimumHard, minimumHard.asText());
+
+        softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        assertEquals(savedSoftenAtLeastEveryMillis, softenAtLeastEveryMillis
+                .asText());
+    }
+
+    /**
+     * Test the action to update the jms attributes on the "Settings" page. All
+     * attributes on the "Settings" page are modified except for the data
+     * source, which will be tested in the testChangeDataSource() test case.
+     * 
+     * @throws Exception
+     */
+    public void testUpdateJmsAttributesOnSettingsPage() throws Exception {
+        /*
+         * Get the jms page & form and save a copy of the settings:
+         */
+        HtmlPage savedJmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Assign new values to the attributes:
+         */
+        HtmlTextInput highMemoryMark = (HtmlTextInput) form
+                .getInputByName("highMemoryMark");
+        highMemoryMark.setValueAttribute("100");
+
+        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
+                .getInputByName("maxMemoryMark");
+        maxMemoryMark.setValueAttribute("200");
+
+        HtmlTextInput maximumHard = (HtmlTextInput) form
+                .getInputByName("maximumHard");
+        maximumHard.setValueAttribute("10");
+
+        HtmlTextInput minimumHard = (HtmlTextInput) form
+                .getInputByName("minimumHard");
+        minimumHard.setValueAttribute("2");
+
+        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        softenAtLeastEveryMillis.setValueAttribute("5000");
+
+        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
+                .getInputByName("softenNoMoreOftenThanMillis");
+        softenNoMoreOftenThanMillis.setValueAttribute("1000");
+
+        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
+                .getInputByName("softenWaitMillis");
+        softenWaitMillis.setValueAttribute("2000");
+
+        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        makeSoftReferences.setChecked(true);
+
+        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        connectionRetryAttempts.setValueAttribute("8");
+
+        HtmlTextInput recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        recoveryRetries.setValueAttribute("5");
+
+        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        recoveryTimeout.setValueAttribute("10");
+
+        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        recoverMessagesChunk.setValueAttribute("1");
+
+        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        hasSecurityManager.setChecked(false);
+
+        HtmlTextInput securityDomain = (HtmlTextInput) form
+                .getInputByName("securityDomain");
+        securityDomain.setValueAttribute("java:/jaas/rmi-ssl");
+
+        List textAreas = form.getTextAreasByName("defaultSecurityRoles");
+        HtmlTextArea defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
+        String role1 = "test1:read:write";
+        String role2 = "test2:read:write:create";
+        defaultSecurityRoles.setText(role1 + NL + role2);
+
+        /*
+         * Click the "Save" button to submit the changes:
+         */
+        clickButton(form, SAVE_BUTTON);
+
+        /*
+         * Sleep for a few seconds then get the jms page again and verify the
+         * changes:
+         */
+        Thread.sleep(hotDeployWaitTime * 2);
+        jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        form = jmsPage.getFormByName("jms");
+        highMemoryMark = (HtmlTextInput) form.getInputByName("highMemoryMark");
+        assertEquals("100", highMemoryMark.asText());
+
+        maxMemoryMark = (HtmlTextInput) form.getInputByName("maxMemoryMark");
+        assertEquals("200", maxMemoryMark.asText());
+
+        maximumHard = (HtmlTextInput) form.getInputByName("maximumHard");
+        assertEquals("10", maximumHard.asText());
+
+        minimumHard = (HtmlTextInput) form.getInputByName("minimumHard");
+        assertEquals("2", minimumHard.asText());
+
+        softenAtLeastEveryMillis = (HtmlTextInput) form
+                .getInputByName("softenAtLeastEveryMillis");
+        assertEquals("5000", softenAtLeastEveryMillis.asText());
+
+        softenNoMoreOftenThanMillis = (HtmlTextInput) form
+                .getInputByName("softenNoMoreOftenThanMillis");
+        assertEquals("1000", softenNoMoreOftenThanMillis.asText());
+
+        softenWaitMillis = (HtmlTextInput) form
+                .getInputByName("softenWaitMillis");
+        assertEquals("2000", softenWaitMillis.asText());
+
+        makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        assertTrue(ITEM_NOT_CHECKED, makeSoftReferences.isChecked());
+
+        connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        assertEquals("8", connectionRetryAttempts.asText());
+
+        recoveryRetries = (HtmlTextInput) form
+                .getInputByName("recoveryRetries");
+        assertEquals("5", recoveryRetries.asText());
+
+        recoveryTimeout = (HtmlTextInput) form
+                .getInputByName("recoveryTimeout");
+        assertEquals("10", recoveryTimeout.asText());
+
+        recoverMessagesChunk = (HtmlTextInput) form
+                .getInputByName("recoverMessagesChunk");
+        assertEquals("1", recoverMessagesChunk.asText());
+
+        hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        assertFalse(ITEM_CHECKED, hasSecurityManager.isChecked());
+
+        securityDomain = (HtmlTextInput) form.getInputByName("securityDomain");
+        assertEquals("java:/jaas/rmi-ssl", securityDomain.asText());
+
+        textAreas = form.getTextAreasByName("defaultSecurityRoles");
+        defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
+        assertEquals("2", defaultSecurityRoles.getRowsAttribute());
+        // HtmlTextArea.getText() converts "\r\n" to "\n" so the expected
+        // string must be build accordingly.
+        assertEquals(role1 + "\n" + role2, defaultSecurityRoles.getText()
+                .trim());
+
+        /*
+         * Restore the previous settings:
+         */
+        restoreJmsSettings(jmsPage, savedJmsPage);
+
+        /*
+         * Sleep for a few seconds for the changes to take effect before
+         * starting the next test:
+         */
+        Thread.sleep(hotDeployWaitTime * 2);
+    }
+
+    /**
+     * Test the action to update the jms attributes on "Settings", "Message
+     * SQL", and "State SQL" pages. Only selected attributes on each page are
+     * updated.
+     * 
+     * @throws Exception
+     */
+    public void testUpdateJmsAttributesOnMultiplePages() throws Exception {
+        /*
+         * Get the jms page & form:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Change some attribute values on the "Settings" page, make sure all
+         * check boxes are checked:
+         */
+        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        makeSoftReferences.setChecked(true);
+
+        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        connectionRetryAttempts.setValueAttribute("20");
+
+        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        hasSecurityManager.setChecked(true);
+
+        /*
+         * Switch to the "Message SQL" tab and verify the check box values are
+         * retained as hidden attribues:
+         */
+        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
+        form = msgSqlPage.getFormByName("jms");
+
+        HtmlHiddenInput hiddenMakeSoftReferences = (HtmlHiddenInput) form
+                .getInputByName("makeSoftReferences");
+        assertEquals("on", hiddenMakeSoftReferences.asText());
+
+        HtmlHiddenInput hiddenHasSecurityManager = (HtmlHiddenInput) form
+                .getInputByName("hasSecurityManager");
+        assertEquals("on", hiddenHasSecurityManager.asText());
+
+        /*
+         * Change some "Message SQL" property values:
+         */
+        HtmlTextInput blobType = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(BLOB_TYPE)");
+        String savedBlobType = blobType.asText();
+        blobType.setValueAttribute("TEST_BLOB");
+
+        HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
+        String savedCreateTablesOnStartup = createTablesOnStartup.asText();
+        createTablesOnStartup.setValueAttribute("TEST_VALUE");
+
+        /*
+         * Switch to the "State SQL" tab and change some property values:
+         */
+        HtmlPage stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
+        form = stateSqlPage.getFormByName("jms");
+
+        HtmlTextInput getUser = (HtmlTextInput) form
+                .getInputByName("stateSqlMap(GET_USER)");
+        String savedGetUser = getUser.asText();
+        getUser.setValueAttribute("SOME SELECT STATEMENTS");
+
+        /*
+         * Return to the "Settings" tab and save the changes:
+         */
+        jmsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
+        form = jmsPage.getFormByName("jms");
+        clickButton(form, SAVE_BUTTON);
+
+        /*
+         * Sleep for a few seconds then get the jms page again and verify the
+         * changes:
+         */
+        Thread.sleep(hotDeployWaitTime * 3);
+        jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        form = jmsPage.getFormByName("jms");
+
+        makeSoftReferences = (HtmlCheckBoxInput) form
+                .getInputByName("makeSoftReferences");
+        assertTrue(ITEM_NOT_CHECKED, makeSoftReferences.isChecked());
+
+        connectionRetryAttempts = (HtmlTextInput) form
+                .getInputByName("connectionRetryAttempts");
+        assertEquals("20", connectionRetryAttempts.asText());
+
+        hasSecurityManager = (HtmlCheckBoxInput) form
+                .getInputByName("hasSecurityManager");
+        assertTrue(ITEM_NOT_CHECKED, hasSecurityManager.isChecked());
+
+        /*
+         * Switch to the "Message SQL" tab and verify the changes:
+         */
+        msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
+        form = msgSqlPage.getFormByName("jms");
+
+        blobType = (HtmlTextInput) form.getInputByName("msgSqlMap(BLOB_TYPE)");
+        assertEquals("TEST_BLOB", blobType.asText());
+
+        createTablesOnStartup = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
+        assertEquals("TEST_VALUE", createTablesOnStartup.asText());
+
+        /*
+         * Restore the "Message SQL" property values:
+         */
+        blobType.setValueAttribute(savedBlobType);
+        createTablesOnStartup.setValueAttribute(savedCreateTablesOnStartup);
+
+        /*
+         * Switch to the "State SQL" tab and verify the changes:
+         */
+        stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
+        form = stateSqlPage.getFormByName("jms");
+
+        getUser = (HtmlTextInput) form.getInputByName("stateSqlMap(GET_USER)");
+        assertEquals("SOME SELECT STATEMENTS", getUser.asText());
+
+        /*
+         * Restore the "State SQL" property value:
+         */
+        getUser.setValueAttribute(savedGetUser);
+
+        /*
+         * Return to the "Settings" tab and save the restored values:
+         */
+        jmsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
+        form = jmsPage.getFormByName("jms");
+        clickButton(form, SAVE_BUTTON);
+
+        /*
+         * Sleep for a few seconds for the changes to take effect:
+         */
+        Thread.sleep(hotDeployWaitTime * 3);
+    }
+
+    /**
+     * Test the action to select a different data source from the "Settings"
+     * page. This test verifies when a postgres data source is selected, the
+     * proper SQL properties are loaded from the properties file. However the
+     * changes will not be saved. So even though there's no postgres database
+     * existed on the system, the test won't cause any exception.
+     * 
+     * @throws Exception
+     */
+    public void testChangeDataSource() throws Exception {
+        String postgresDataSourceName = "postgresDS";
+        String postgresConnectionUrl = "jdbc:postgresql://localhost:5432/myPostgreDB";
+        String postgresDriverClass = "org.postgresql.Driver";
+
+        /*
+         * Create a postgres data source and wait for it to get deployed:
+         */
+        createDataSource(postgresDataSourceName, postgresConnectionUrl,
+                postgresDriverClass);
+        Thread.sleep(hotDeployWaitTime * 2);
+
+        /*
+         * Load the persistenceSql.properties into memory:
+         */
+        Properties sqlProps = loadProperties(persistSqlFile);
+
+        /*
+         * Get the jms page & form:
+         */
+        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
+        HtmlForm form = jmsPage.getFormByName("jms");
+
+        /*
+         * Select the new postgres data source from the drop down list:
+         */
+        HtmlSelect dataSourceName = (HtmlSelect) form
+                .getSelectByName("dataSourceName");
+        List dataSourceOptions = dataSourceName.getOptions();
+        HtmlOption option;
+        for (int i = 0; i < dataSourceOptions.size(); i++) {
+            option = (HtmlOption) dataSourceOptions.get(i);
+            if (postgresDataSourceName.equals(option.getValueAttribute())) {
+                jmsPage = (HtmlPage) option.setSelected(true);
+                break;
+            }
+        }
+
+        /*
+         * Switch to the "Message SQL" tab and verify the SQL properties for
+         * postgres DB are loaded correctly. Only the property values that're
+         * unique to postgres DB are checked:
+         */
+        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
+        form = msgSqlPage.getFormByName("jms");
+
+        String expectedBlobType = sqlProps.getProperty("postgre.msg.BLOB_TYPE");
+        HtmlTextInput blobType = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(BLOB_TYPE)");
+        assertEquals(expectedBlobType, blobType.asText());
+
+        String expectedSelectMaxTx = sqlProps
+                .getProperty("postgre.msg.SELECT_MAX_TX");
+        HtmlTextInput selectMaxTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(SELECT_MAX_TX)");
+        assertEquals(expectedSelectMaxTx, selectMaxTx.asText());
+
+        String expectedDeleteMarkedMsgsWithTx = sqlProps
+                .getProperty("postgre.msg.DELETE_MARKED_MESSAGES_WITH_TX");
+        HtmlTextInput deleteMarkedMsgsWithTx = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES_WITH_TX)");
+        assertEquals(expectedDeleteMarkedMsgsWithTx, deleteMarkedMsgsWithTx
+                .asText());
+
+        String expectedCreateMessageTable = sqlProps
+                .getProperty("postgre.msg.CREATE_MESSAGE_TABLE");
+        HtmlTextInput createMessageTable = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_MESSAGE_TABLE)");
+        assertEquals(expectedCreateMessageTable, createMessageTable.asText());
+
+        String expectedCreateTxTable = sqlProps
+                .getProperty("postgre.msg.CREATE_TX_TABLE");
+        HtmlTextInput createTxTable = (HtmlTextInput) form
+                .getInputByName("msgSqlMap(CREATE_TX_TABLE)");
+        assertEquals(expectedCreateTxTable, createTxTable.asText());
+
+        /*
+         * Remove the postgres data source and wait for it to get undeployed:
+         */
+        removeDataSource(postgresDataSourceName);
+        Thread.sleep(hotDeployWaitTime * 2);
+    }
+}
\ No newline at end of file

Deleted: projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JmsPageTest.java
===================================================================
--- projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JmsPageTest.java	2007-01-22 20:20:42 UTC (rev 59923)
+++ projects/admin-console/trunk/src/webtest/org/jboss/admin/console/webtest/JmsPageTest.java	2007-01-22 20:24:44 UTC (rev 59924)
@@ -1,1280 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * 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.admin.console.webtest;
-
-import java.net.URL;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-
-import junit.framework.TestCase;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
-import com.gargoylesoftware.htmlunit.html.HtmlForm;
-import com.gargoylesoftware.htmlunit.html.HtmlHiddenInput;
-import com.gargoylesoftware.htmlunit.html.HtmlOption;
-import com.gargoylesoftware.htmlunit.html.HtmlPage;
-import com.gargoylesoftware.htmlunit.html.HtmlSelect;
-import com.gargoylesoftware.htmlunit.html.HtmlTable;
-import com.gargoylesoftware.htmlunit.html.HtmlTableBody;
-import com.gargoylesoftware.htmlunit.html.HtmlTableRow;
-import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
-import com.gargoylesoftware.htmlunit.html.HtmlTextInput;
-
-/**
- * Integration tests for managing JBossMQ general settings.
- * 
- * @author <a href="chi.lin at unisys.com">Chi Lin </a>
- * @version $Revision$
- */
-public class JmsPageTest extends AdminConsoleTestCase {
-
-    private static Log log = LogFactory.getLog(JmsPageTest.class);
-
-    private final static String URL_JMS_PAGE = "http://localhost:8080/admin/jms/list.html";
-
-    /*
-     * Define various href anchors
-     */
-    private final static String HREF_SETTINGS_PAGE = "javascript:void(setPageAndSubmit('page1'))";
-
-    private final static String HREF_MORE_PAGE = "javascript:void(setPageAndSubmit('page2'))";
-
-    private final static String HREF_MSG_SQL_PAGE = "javascript:void(setPageAndSubmit('page3'))";
-
-    private final static String HREF_STATE_SQL_PAGE = "javascript:void(setPageAndSubmit('page4'))";
-
-    private final static String HREF_DATASOURCE_LOCALTX = "/admin/datasource/datasource/list.html?type=localtxdatasources";
-
-    private final URL jmsUrl;
-
-    protected final Properties msgProps;
-
-    public JmsPageTest(String arg0) throws Exception {
-        super(arg0);
-        jmsUrl = new URL(URL_JMS_PAGE);
-
-        /*
-         * Load the message properties:
-         */
-        msgProps = loadProperties(jmsMsgFile);
-    }
-
-    /**
-     * @see TestCase#setUp()
-     */
-    protected void setUp() throws Exception {
-        super.setUp();
-    }
-
-    /**
-     * @see TestCase#tearDown()
-     */
-    protected void tearDown() throws Exception {
-        super.tearDown();
-    }
-
-    /**
-     * Verify the provided page contains the expected input fields of the jms
-     * "Settings" page. Note that the value of the input fields are not checked.
-     * 
-     * @param jmsPage
-     *            The HtmlPage to be verified.
-     * @throws Exception
-     */
-    private void verifyJmsSettingsPage(HtmlPage jmsPage) throws Exception {
-        /*
-         * Get the jms form and verify the existence of the input fields:
-         */
-        final HtmlForm form = jmsPage.getFormByName("jms");
-        final HtmlTextInput highMemoryMark = (HtmlTextInput) form
-                .getInputByName("highMemoryMark");
-        final HtmlTextInput maxMemoryMark = (HtmlTextInput) form
-                .getInputByName("maxMemoryMark");
-        final HtmlTextInput maximumHard = (HtmlTextInput) form
-                .getInputByName("maximumHard");
-        final HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        final HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        final HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
-                .getInputByName("softenNoMoreOftenThanMillis");
-        final HtmlTextInput softenWaitMillis = (HtmlTextInput) form
-                .getInputByName("softenWaitMillis");
-        final HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        final HtmlSelect dataSourceName = (HtmlSelect) form
-                .getSelectByName("dataSourceName");
-        final List dataSourceOptions = dataSourceName.getOptions();
-        final HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        final HtmlTextInput recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        final HtmlTextInput recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        final HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        final HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        final HtmlTextInput securityDomain = (HtmlTextInput) form
-                .getInputByName("securityDomain");
-        final List textAreas = form.getTextAreasByName("defaultSecurityRoles");
-        assertEquals(1, textAreas.size());
-    }
-
-    /**
-     * Verify the provided page contains the expected table and table cells of
-     * the jms "More" page.
-     * 
-     * @param morePage
-     *            The HtmlPage to be verified.
-     * @throws Exception
-     */
-    private void verifyMorePage(HtmlPage morePage) throws Exception {
-        /*
-         * Get the jmsTable and verify it is not empty:
-         */
-        final HtmlTable table = (HtmlTable) morePage
-                .getHtmlElementById("jmsTable");
-        final List rows = table.getRows();
-        assertFalse(TABLE_EMPTY, rows.isEmpty());
-
-        /*
-         * Verify correct labels exist in the table:
-         */
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.softenedSize"), table.getCellAt(0, 0)
-                .asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.currentMemoryUsage"), table.getCellAt(1,
-                0).asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.totalCacheSize"), table.getCellAt(2, 0)
-                .asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.hardRefCacheSize"), table
-                .getCellAt(3, 0).asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.softRefCacheSize"), table
-                .getCellAt(4, 0).asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.cacheHits"), table.getCellAt(5, 0)
-                .asText());
-        assertEquals(TABLE_CELL_MISMATCH, msgProps
-                .getProperty("jms.view.cacheMisses"), table.getCellAt(6, 0)
-                .asText());
-
-        /*
-         * Verify the data column of each row is not null:
-         */
-        HtmlTableRow row = null;
-        for (int i = 0; i < rows.size(); i++) {
-            row = (HtmlTableRow) rows.get(i);
-            assertNotNull("Null data in table, row = " + i, row.getCell(1));
-        }
-    }
-
-    /**
-     * Verify the provided page contains the expected input fields of the jms
-     * "Message SQL" page. Note that the value of the input fields are not
-     * checked.
-     * 
-     * @param jmsPage
-     *            The HtmlPage to be verified.
-     * @throws Exception
-     */
-    private void verifyMessageSqlPage(HtmlPage msgSqlPage) throws Exception {
-        /*
-         * Verify the SQL properties for message persistence are present:
-         */
-        final HtmlForm form = msgSqlPage.getFormByName("jms");
-        final HtmlTextInput blobType = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(BLOB_TYPE)");
-        final HtmlTextInput insertTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(INSERT_TX)");
-        final HtmlTextInput insertMessage = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(INSERT_MESSAGE)");
-        final HtmlTextInput selectAllUncommitedTxs = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(SELECT_ALL_UNCOMMITED_TXS)");
-        final HtmlTextInput selectMaxTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(SELECT_MAX_TX)");
-        final HtmlTextInput deleteAllTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_ALL_TX)");
-        final HtmlTextInput selectMessagesInDest = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(SELECT_MESSAGES_IN_DEST)");
-        final HtmlTextInput selectMessage = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(SELECT_MESSAGE)");
-        final HtmlTextInput markMessage = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(MARK_MESSAGE)");
-        final HtmlTextInput updateMessage = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(UPDATE_MESSAGE)");
-        final HtmlTextInput updateMarkedMessages = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(UPDATE_MARKED_MESSAGES)");
-        final HtmlTextInput updateMarkedMessagesWithTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(UPDATE_MARKED_MESSAGES_WITH_TX)");
-        final HtmlTextInput deleteMarkedMessagesWithTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES_WITH_TX)");
-        final HtmlTextInput deleteTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_TX)");
-        final HtmlTextInput deleteMarkedMessages = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES)");
-        final HtmlTextInput deleteTemporaryMessages = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_TEMPORARY_MESSAGES)");
-        final HtmlTextInput deleteMessage = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_MESSAGE)");
-        final HtmlTextInput createMessageTable = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_MESSAGE_TABLE)");
-        final HtmlTextInput createIdxMessageTxopTxid = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_IDX_MESSAGE_TXOP_TXID)");
-        final HtmlTextInput createIdxMessageDestination = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_IDX_MESSAGE_DESTINATION)");
-        final HtmlTextInput createTxTable = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_TX_TABLE)");
-        final HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
-    }
-
-    /**
-     * Verify the provided page contains the expected input fields of the jms
-     * "State SQL" page. Note that the value of the input fields are not
-     * checked.
-     * 
-     * @param jmsPage
-     *            The HtmlPage to be verified.
-     * @throws Exception
-     */
-    private void verifyStateSqlPage(HtmlPage stateSqlPage) throws Exception {
-        /*
-         * Verify the SQL properties for state persistence are present:
-         */
-        final HtmlForm form = stateSqlPage.getFormByName("jms");
-        final HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(CREATE_TABLES_ON_STARTUP)");
-        final HtmlTextInput createUserTalbe = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(CREATE_USER_TABLE)");
-        final HtmlTextInput createRoleTable = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(CREATE_ROLE_TABLE)");
-        final HtmlTextInput createSubscriptionTable = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(CREATE_SUBSCRIPTION_TABLE)");
-        final HtmlTextInput getSubscription = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(GET_SUBSCRIPTION)");
-        final HtmlTextInput lockSubscription = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(LOCK_SUBSCRIPTION)");
-        final HtmlTextInput getSubscriptionsForTopic = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(GET_SUBSCRIPTIONS_FOR_TOPIC)");
-        final HtmlTextInput insertSubscription = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(INSERT_SUBSCRIPTION)");
-        final HtmlTextInput updateSubscription = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(UPDATE_SUBSCRIPTION)");
-        final HtmlTextInput removeSubscription = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(REMOVE_SUBSCRIPTION)");
-        final HtmlTextInput getUserByClientid = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(GET_USER_BY_CLIENTID)");
-        final HtmlTextInput getUser = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(GET_USER)");
-    }
-
-    /**
-     * Restore the jms settings back to the saved values.
-     * 
-     * @param jmsPage
-     *            The current jms page
-     * @param savedJmsPage
-     *            The jms page the values are to be restored from
-     * @throws Exception
-     */
-    private void restoreJmsSettings(HtmlPage jmsPage, HtmlPage savedJmsPage)
-            throws Exception {
-        /*
-         * Get the current and saved jms forms:
-         */
-        HtmlForm form = jmsPage.getFormByName("jms");
-        HtmlForm savedForm = savedJmsPage.getFormByName("jms");
-
-        /*
-         * Restore the values from the saved form:
-         */
-        HtmlTextInput highMemoryMark = (HtmlTextInput) form
-                .getInputByName("highMemoryMark");
-        highMemoryMark.setValueAttribute(savedForm.getInputByName(
-                "highMemoryMark").asText());
-
-        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
-                .getInputByName("maxMemoryMark");
-        maxMemoryMark.setValueAttribute(savedForm.getInputByName(
-                "maxMemoryMark").asText());
-
-        HtmlTextInput maximumHard = (HtmlTextInput) form
-                .getInputByName("maximumHard");
-        maximumHard.setValueAttribute(savedForm.getInputByName("maximumHard")
-                .asText());
-
-        HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        minimumHard.setValueAttribute(savedForm.getInputByName("minimumHard")
-                .asText());
-
-        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        softenAtLeastEveryMillis.setValueAttribute(savedForm.getInputByName(
-                "softenAtLeastEveryMillis").asText());
-
-        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
-                .getInputByName("softenNoMoreOftenThanMillis");
-        softenNoMoreOftenThanMillis.setValueAttribute(savedForm.getInputByName(
-                "softenNoMoreOftenThanMillis").asText());
-
-        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
-                .getInputByName("softenWaitMillis");
-        softenWaitMillis.setValueAttribute(savedForm.getInputByName(
-                "softenWaitMillis").asText());
-
-        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        makeSoftReferences.setChecked(savedForm.getInputByName(
-                "makeSoftReferences").isChecked());
-
-        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        connectionRetryAttempts.setValueAttribute(savedForm.getInputByName(
-                "connectionRetryAttempts").asText());
-
-        HtmlTextInput recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        recoveryRetries.setValueAttribute(savedForm.getInputByName(
-                "recoveryRetries").asText());
-
-        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        recoveryTimeout.setValueAttribute(savedForm.getInputByName(
-                "recoveryTimeout").asText());
-
-        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        recoverMessagesChunk.setValueAttribute(savedForm.getInputByName(
-                "recoverMessagesChunk").asText());
-
-        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        hasSecurityManager.setChecked(savedForm.getInputByName(
-                "hasSecurityManager").isChecked());
-
-        HtmlTextInput securityDomain = (HtmlTextInput) form
-                .getInputByName("securityDomain");
-        securityDomain.setValueAttribute(savedForm.getInputByName(
-                "securityDomain").asText());
-
-        List textAreas = form.getTextAreasByName("defaultSecurityRoles");
-        List savedTextAreas = savedForm
-                .getTextAreasByName("defaultSecurityRoles");
-        HtmlTextArea defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
-        HtmlTextArea savedDefaultSecurityRoles = (HtmlTextArea) savedTextAreas
-                .get(0);
-        defaultSecurityRoles.setText(savedDefaultSecurityRoles.getText());
-
-        /*
-         * Click the "Save" button to submit the form:
-         */
-        clickButton(form, SAVE_BUTTON);
-    }
-
-    /**
-     * Create a local transactions data source with the specified name,
-     * connection url, and driver class.
-     * 
-     * @param jndiName
-     *            The jndi name of the data source
-     * @param connectionUrl
-     *            The connection url
-     * @param driverClass
-     *            The driver class
-     * @throws Exception
-     */
-    private void createDataSource(String jndiName, String connectionUrl,
-            String driverClass) throws Exception {
-        /*
-         * Get the jms home page and click the "Local Transactions" link:
-         */
-        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
-        HtmlPage localTxPage = clickLink(homePage, HREF_DATASOURCE_LOCALTX);
-
-        /*
-         * Click the "Create" button:
-         */
-        HtmlForm identifierForm = localTxPage
-                .getFormByName("datasourceIdentifier");
-        HtmlPage createPage = clickButton(identifierForm, CREATE_BUTTON);
-
-        /*
-         * Get the "datasource" form and fill in data for the required
-         * attributes:
-         */
-        HtmlForm datasourceForm = createPage.getFormByName("datasource");
-
-        HtmlTextInput htmlJndiName = (HtmlTextInput) datasourceForm
-                .getInputByName("JNDIname");
-        htmlJndiName.setValueAttribute(jndiName);
-
-        HtmlTextInput htmlConnectionUrl = (HtmlTextInput) datasourceForm
-                .getInputByName("connectionURL");
-        htmlConnectionUrl.setValueAttribute(connectionUrl);
-
-        HtmlTextInput htmlDriverClass = (HtmlTextInput) datasourceForm
-                .getInputByName("driverClassName");
-        htmlDriverClass.setValueAttribute(driverClass);
-
-        /*
-         * Click the "Save" button to create the data source:
-         */
-        clickButton(datasourceForm, SAVE_BUTTON);
-    }
-
-    /**
-     * Remove the specified local transactions data source.
-     * 
-     * @param jndiName
-     *            The jndi name of the data source
-     * @throws Exception
-     */
-    private void removeDataSource(String jndiName) throws Exception {
-        /*
-         * Get the jms home page and click the "Local Transactions" link:
-         */
-        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
-        HtmlPage localTxPage = clickLink(homePage, HREF_DATASOURCE_LOCALTX);
-
-        /*
-         * Get the dsTable and walk through the forms and table bodies to find
-         * the row containing the data source we're looking for:
-         */
-        HtmlForm form = null;
-        List bodies = null;
-        HtmlTableBody tBody = null;
-        List rows = null;
-        HtmlTableRow row = null;
-
-        HtmlTable table = (HtmlTable) localTxPage.getHtmlElementById("dsTable");
-        List forms = table.getHtmlElementsByTagName("form");
-        Iterator formIter = forms.iterator();
-
-        while (formIter.hasNext()) {
-            form = (HtmlForm) formIter.next();
-            bodies = form.getHtmlElementsByTagName("tbody");
-            assertEquals("Form should contain 1 <tbody>.", 1, bodies.size());
-
-            tBody = (HtmlTableBody) bodies.get(0);
-            rows = tBody.getRows();
-            assertEquals("<tbody> should contain 1 row.", 1, rows.size());
-
-            row = (HtmlTableRow) rows.get(0);
-            log.debug("name = " + row.getCell(0).asText());
-            if (jndiName.equals(row.getCell(0).asText())) {
-                /*
-                 * Found our row. Register a confirm handler to ok the remove
-                 * request:
-                 */
-                log.debug("found our row");
-                webClient.setConfirmHandler(new ConfirmHandlerImpl(true));
-
-                /*
-                 * Remove the data source and exit the loop:
-                 */
-                clickButton(form, REMOVE_BUTTON);
-                break;
-            }
-        }
-    }
-
-    /**
-     * Test the action to view the jms page.
-     * 
-     * @throws Exception
-     */
-    public void testViewJmsPage() throws Exception {
-        /*
-         * Get the jms home page:
-         */
-        HtmlPage homePage = (HtmlPage) webClient.getPage(adminUrl);
-
-        /*
-         * Click the "Manage JBossMQ" link and verify the page content:
-         */
-        HtmlPage jmsPage = clickLink(homePage, HREF_MANAGE_JBOSSMQ);
-        verifyJmsSettingsPage(jmsPage);
-    }
-
-    /**
-     * Test the action to click various tabs from the jms "Settings" page.
-     * 
-     * @throws Exception
-     */
-    public void testClickTabsFromJmsPage() throws Exception {
-        /*
-         * Get the jms page:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-
-        /*
-         * Click the "More" tab and verify the corrct page was obtained:
-         */
-        HtmlPage morePage = clickLink(jmsPage, HREF_MORE_PAGE);
-        verifyMorePage(morePage);
-
-        /*
-         * Click the "Message SQL" tab and verify the corrct page was obtained:
-         */
-        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
-        verifyMessageSqlPage(msgSqlPage);
-
-        /*
-         * Click the "State SQL" tab and verify the corrct page was obtained:
-         */
-        HtmlPage stateSqlPage = clickLink(jmsPage, HREF_STATE_SQL_PAGE);
-        verifyStateSqlPage(stateSqlPage);
-    }
-
-    /**
-     * Test the action to click various tabs from the jms "More" page.
-     * 
-     * @throws Exception
-     */
-    public void testClickTabsFromMorePage() throws Exception {
-        /*
-         * Get the "More" page:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlPage morePage = clickLink(jmsPage, HREF_MORE_PAGE);
-
-        /*
-         * Click the "Settings" tab and verify the page:
-         */
-        HtmlPage settingsPage = clickLink(morePage, HREF_SETTINGS_PAGE);
-        verifyJmsSettingsPage(settingsPage);
-
-        /*
-         * Click the "Message SQL" tab and verify the page:
-         */
-        HtmlPage msgSqlPage = clickLink(morePage, HREF_MSG_SQL_PAGE);
-        verifyMessageSqlPage(msgSqlPage);
-
-        /*
-         * Click the "State SQL" tab and verify the page:
-         */
-        HtmlPage stateSqlPage = clickLink(morePage, HREF_STATE_SQL_PAGE);
-        verifyStateSqlPage(stateSqlPage);
-    }
-
-    /**
-     * Test the action to click various tabs from the jms "Message SQL" page.
-     * 
-     * @throws Exception
-     */
-    public void testClickTabsFromMessageSqlPage() throws Exception {
-        /*
-         * Get the "Message SQL" page:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
-
-        /*
-         * Click the "Settings" tab and verify the page:
-         */
-        HtmlPage settingsPage = clickLink(msgSqlPage, HREF_SETTINGS_PAGE);
-        verifyJmsSettingsPage(settingsPage);
-
-        /*
-         * Click the "More" tab and verify the page:
-         */
-        HtmlPage morePage = clickLink(msgSqlPage, HREF_MORE_PAGE);
-        verifyMorePage(morePage);
-
-        /*
-         * Click the "State SQL" tab and verify the page:
-         */
-        HtmlPage stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
-        verifyStateSqlPage(stateSqlPage);
-    }
-
-    /**
-     * Test the action to click various tabs from the jms "State SQL" page.
-     * 
-     * @throws Exception
-     */
-    public void testClickTabsFromStateSqlPage() throws Exception {
-        /*
-         * Get the "State SQL" page:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlPage stateSqlPage = clickLink(jmsPage, HREF_STATE_SQL_PAGE);
-
-        /*
-         * Click the "Settings" tab and verify the page:
-         */
-        HtmlPage settingsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
-        verifyJmsSettingsPage(settingsPage);
-
-        /*
-         * Click the "More" tab and verify the page:
-         */
-        HtmlPage morePage = clickLink(stateSqlPage, HREF_MORE_PAGE);
-        verifyMorePage(morePage);
-
-        /*
-         * Click the "Message SQL" tab and verify the page:
-         */
-        HtmlPage msgSqlPage = clickLink(stateSqlPage, HREF_MSG_SQL_PAGE);
-        verifyMessageSqlPage(msgSqlPage);
-    }
-
-    /**
-     * Test the action to update the jms attributes with invalid type of data.
-     * 
-     * @throws Exception
-     */
-    public void testUpdateJmsAttributesWithInvalidDataType() throws Exception {
-        /*
-         * Get the jms page & form:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Assign invalid type of data to the attributes:
-         */
-        String badData = "badData";
-        HtmlTextInput highMemoryMark = (HtmlTextInput) form
-                .getInputByName("highMemoryMark");
-        highMemoryMark.setValueAttribute(badData);
-
-        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
-                .getInputByName("maxMemoryMark");
-        maxMemoryMark.setValueAttribute(badData);
-
-        HtmlTextInput maximumHard = (HtmlTextInput) form
-                .getInputByName("maximumHard");
-        maximumHard.setValueAttribute(badData);
-
-        HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        minimumHard.setValueAttribute(badData);
-
-        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        softenAtLeastEveryMillis.setValueAttribute(badData);
-
-        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
-                .getInputByName("softenNoMoreOftenThanMillis");
-        softenNoMoreOftenThanMillis.setValueAttribute(badData);
-
-        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
-                .getInputByName("softenWaitMillis");
-        softenWaitMillis.setValueAttribute(badData);
-
-        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        connectionRetryAttempts.setValueAttribute(badData);
-
-        HtmlTextInput recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        recoveryRetries.setValueAttribute(badData);
-
-        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        recoveryTimeout.setValueAttribute(badData);
-
-        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        recoverMessagesChunk.setValueAttribute(badData);
-
-        /*
-         * Click the "Save" button and verify the error messages were returned
-         * correctly:
-         */
-        jmsPage = clickButton(form, SAVE_BUTTON);
-        String jmsPageText = jmsPage.asText();
-
-        String expectedMsg = msgProps.getProperty("jms.view.highMemoryMark")
-                + " must be a long";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.maxMemoryMark")
-                + " must be a long";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.maximumHard")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.minimumHard")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.connectionRetryAttempts")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.recoveryRetries")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.recoveryTimeout")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.softenAtLeastEveryMillis")
-                + " must be a long";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps
-                .getProperty("jms.view.softenNoMoreOftenThanMillis")
-                + " must be a long";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.softenWaitMillis")
-                + " must be a long";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-    }
-
-    /**
-     * Test the action to update jms attributes with data that're out of range.
-     * 
-     * @throws Exception
-     */
-    public void testUpdateJmsAttributesWithInvalidDataRange() throws Exception {
-        /*
-         * Get the jms page & form:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Assign invalid values to the attributes:
-         */
-        HtmlTextInput maximumHard = (HtmlTextInput) form
-                .getInputByName("maximumHard");
-        maximumHard.setValueAttribute("-1");
-
-        HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        minimumHard.setValueAttribute("0");
-
-        long maxInt = Integer.MAX_VALUE;
-        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        connectionRetryAttempts.setValueAttribute(Long.toString(maxInt + 1));
-
-        long minInt = Integer.MIN_VALUE;
-        HtmlTextInput recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        recoveryRetries.setValueAttribute(Long.toString(minInt - 1));
-
-        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        recoveryTimeout.setValueAttribute("-1");
-
-        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        recoverMessagesChunk.setValueAttribute("2");
-
-        /*
-         * Click the "Save" button and verify the error messages were returned
-         * correctly:
-         */
-        jmsPage = clickButton(form, SAVE_BUTTON);
-        String jmsPageText = jmsPage.asText();
-
-        String expectedMsg = msgProps.getProperty("jms.view.maximumHard")
-                + " is not in the range 0 through 2147483647";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.minimumHard")
-                + " is not in the range 1 through 2147483647";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.connectionRetryAttempts")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.recoveryRetries")
-                + " must be an integer";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.recoveryTimeout")
-                + " is not in the range 0 through 2147483647";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-
-        expectedMsg = msgProps.getProperty("jms.view.recoverMessagesChunk")
-                + " is not in the range 0 through 1";
-        assertTrue(EXP_MSG_NOT_FOUND, findMessage(jmsPageText, expectedMsg));
-    }
-
-    /**
-     * Test the action to cancel the jms attribute changes.
-     * 
-     * @throws Exception
-     */
-    public void testCancelJmsAttributeChanges() throws Exception {
-        /*
-         * Get the jms page & form:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Change the values of some attributes:
-         */
-        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
-                .getInputByName("maxMemoryMark");
-        String savedMaxMemoryMark = maxMemoryMark.asText();
-        maxMemoryMark.setValueAttribute("999");
-
-        HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        String savedMinimumHard = minimumHard.asText();
-        minimumHard.setValueAttribute("99");
-
-        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        String savedSoftenAtLeastEveryMillis = softenAtLeastEveryMillis
-                .asText();
-        softenAtLeastEveryMillis.setValueAttribute("9999");
-
-        /*
-         * Click the "Cancel" button and make sure the previous settings were
-         * retained:
-         */
-        jmsPage = clickButton(form, CANCEL_BUTTON);
-        form = jmsPage.getFormByName("jms");
-
-        maxMemoryMark = (HtmlTextInput) form.getInputByName("maxMemoryMark");
-        assertEquals(savedMaxMemoryMark, maxMemoryMark.asText());
-
-        minimumHard = (HtmlTextInput) form.getInputByName("minimumHard");
-        assertEquals(savedMinimumHard, minimumHard.asText());
-
-        softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        assertEquals(savedSoftenAtLeastEveryMillis, softenAtLeastEveryMillis
-                .asText());
-    }
-
-    /**
-     * Test the action to update the jms attributes on the "Settings" page. All
-     * attributes on the "Settings" page are modified except for the data
-     * source, which will be tested in the testChangeDataSource() test case.
-     * 
-     * @throws Exception
-     */
-    public void testUpdateJmsAttributesOnSettingsPage() throws Exception {
-        /*
-         * Get the jms page & form and save a copy of the settings:
-         */
-        HtmlPage savedJmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Assign new values to the attributes:
-         */
-        HtmlTextInput highMemoryMark = (HtmlTextInput) form
-                .getInputByName("highMemoryMark");
-        highMemoryMark.setValueAttribute("100");
-
-        HtmlTextInput maxMemoryMark = (HtmlTextInput) form
-                .getInputByName("maxMemoryMark");
-        maxMemoryMark.setValueAttribute("200");
-
-        HtmlTextInput maximumHard = (HtmlTextInput) form
-                .getInputByName("maximumHard");
-        maximumHard.setValueAttribute("10");
-
-        HtmlTextInput minimumHard = (HtmlTextInput) form
-                .getInputByName("minimumHard");
-        minimumHard.setValueAttribute("2");
-
-        HtmlTextInput softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        softenAtLeastEveryMillis.setValueAttribute("5000");
-
-        HtmlTextInput softenNoMoreOftenThanMillis = (HtmlTextInput) form
-                .getInputByName("softenNoMoreOftenThanMillis");
-        softenNoMoreOftenThanMillis.setValueAttribute("1000");
-
-        HtmlTextInput softenWaitMillis = (HtmlTextInput) form
-                .getInputByName("softenWaitMillis");
-        softenWaitMillis.setValueAttribute("2000");
-
-        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        makeSoftReferences.setChecked(true);
-
-        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        connectionRetryAttempts.setValueAttribute("8");
-
-        HtmlTextInput recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        recoveryRetries.setValueAttribute("5");
-
-        HtmlTextInput recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        recoveryTimeout.setValueAttribute("10");
-
-        HtmlTextInput recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        recoverMessagesChunk.setValueAttribute("1");
-
-        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        hasSecurityManager.setChecked(false);
-
-        HtmlTextInput securityDomain = (HtmlTextInput) form
-                .getInputByName("securityDomain");
-        securityDomain.setValueAttribute("java:/jaas/rmi-ssl");
-
-        List textAreas = form.getTextAreasByName("defaultSecurityRoles");
-        HtmlTextArea defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
-        String role1 = "test1:read:write";
-        String role2 = "test2:read:write:create";
-        defaultSecurityRoles.setText(role1 + NL + role2);
-
-        /*
-         * Click the "Save" button to submit the changes:
-         */
-        clickButton(form, SAVE_BUTTON);
-
-        /*
-         * Sleep for a few seconds then get the jms page again and verify the
-         * changes:
-         */
-        Thread.sleep(hotDeployWaitTime * 2);
-        jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        form = jmsPage.getFormByName("jms");
-        highMemoryMark = (HtmlTextInput) form.getInputByName("highMemoryMark");
-        assertEquals("100", highMemoryMark.asText());
-
-        maxMemoryMark = (HtmlTextInput) form.getInputByName("maxMemoryMark");
-        assertEquals("200", maxMemoryMark.asText());
-
-        maximumHard = (HtmlTextInput) form.getInputByName("maximumHard");
-        assertEquals("10", maximumHard.asText());
-
-        minimumHard = (HtmlTextInput) form.getInputByName("minimumHard");
-        assertEquals("2", minimumHard.asText());
-
-        softenAtLeastEveryMillis = (HtmlTextInput) form
-                .getInputByName("softenAtLeastEveryMillis");
-        assertEquals("5000", softenAtLeastEveryMillis.asText());
-
-        softenNoMoreOftenThanMillis = (HtmlTextInput) form
-                .getInputByName("softenNoMoreOftenThanMillis");
-        assertEquals("1000", softenNoMoreOftenThanMillis.asText());
-
-        softenWaitMillis = (HtmlTextInput) form
-                .getInputByName("softenWaitMillis");
-        assertEquals("2000", softenWaitMillis.asText());
-
-        makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        assertTrue(ITEM_NOT_CHECKED, makeSoftReferences.isChecked());
-
-        connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        assertEquals("8", connectionRetryAttempts.asText());
-
-        recoveryRetries = (HtmlTextInput) form
-                .getInputByName("recoveryRetries");
-        assertEquals("5", recoveryRetries.asText());
-
-        recoveryTimeout = (HtmlTextInput) form
-                .getInputByName("recoveryTimeout");
-        assertEquals("10", recoveryTimeout.asText());
-
-        recoverMessagesChunk = (HtmlTextInput) form
-                .getInputByName("recoverMessagesChunk");
-        assertEquals("1", recoverMessagesChunk.asText());
-
-        hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        assertFalse(ITEM_CHECKED, hasSecurityManager.isChecked());
-
-        securityDomain = (HtmlTextInput) form.getInputByName("securityDomain");
-        assertEquals("java:/jaas/rmi-ssl", securityDomain.asText());
-
-        textAreas = form.getTextAreasByName("defaultSecurityRoles");
-        defaultSecurityRoles = (HtmlTextArea) textAreas.get(0);
-        assertEquals("2", defaultSecurityRoles.getRowsAttribute());
-        // HtmlTextArea.getText() converts "\r\n" to "\n" so the expected
-        // string must be build accordingly.
-        assertEquals(role1 + "\n" + role2, defaultSecurityRoles.getText()
-                .trim());
-
-        /*
-         * Restore the previous settings:
-         */
-        restoreJmsSettings(jmsPage, savedJmsPage);
-
-        /*
-         * Sleep for a few seconds for the changes to take effect before
-         * starting the next test:
-         */
-        Thread.sleep(hotDeployWaitTime * 2);
-    }
-
-    /**
-     * Test the action to update the jms attributes on "Settings", "Message
-     * SQL", and "State SQL" pages. Only selected attributes on each page are
-     * updated.
-     * 
-     * @throws Exception
-     */
-    public void testUpdateJmsAttributesOnMultiplePages() throws Exception {
-        /*
-         * Get the jms page & form:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Change some attribute values on the "Settings" page, make sure all
-         * check boxes are checked:
-         */
-        HtmlCheckBoxInput makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        makeSoftReferences.setChecked(true);
-
-        HtmlTextInput connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        connectionRetryAttempts.setValueAttribute("20");
-
-        HtmlCheckBoxInput hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        hasSecurityManager.setChecked(true);
-
-        /*
-         * Switch to the "Message SQL" tab and verify the check box values are
-         * retained as hidden attribues:
-         */
-        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
-        form = msgSqlPage.getFormByName("jms");
-
-        HtmlHiddenInput hiddenMakeSoftReferences = (HtmlHiddenInput) form
-                .getInputByName("makeSoftReferences");
-        assertEquals("on", hiddenMakeSoftReferences.asText());
-
-        HtmlHiddenInput hiddenHasSecurityManager = (HtmlHiddenInput) form
-                .getInputByName("hasSecurityManager");
-        assertEquals("on", hiddenHasSecurityManager.asText());
-
-        /*
-         * Change some "Message SQL" property values:
-         */
-        HtmlTextInput blobType = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(BLOB_TYPE)");
-        String savedBlobType = blobType.asText();
-        blobType.setValueAttribute("TEST_BLOB");
-
-        HtmlTextInput createTablesOnStartup = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
-        String savedCreateTablesOnStartup = createTablesOnStartup.asText();
-        createTablesOnStartup.setValueAttribute("TEST_VALUE");
-
-        /*
-         * Switch to the "State SQL" tab and change some property values:
-         */
-        HtmlPage stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
-        form = stateSqlPage.getFormByName("jms");
-
-        HtmlTextInput getUser = (HtmlTextInput) form
-                .getInputByName("stateSqlMap(GET_USER)");
-        String savedGetUser = getUser.asText();
-        getUser.setValueAttribute("SOME SELECT STATEMENTS");
-
-        /*
-         * Return to the "Settings" tab and save the changes:
-         */
-        jmsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
-        form = jmsPage.getFormByName("jms");
-        clickButton(form, SAVE_BUTTON);
-
-        /*
-         * Sleep for a few seconds then get the jms page again and verify the
-         * changes:
-         */
-        Thread.sleep(hotDeployWaitTime * 3);
-        jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        form = jmsPage.getFormByName("jms");
-
-        makeSoftReferences = (HtmlCheckBoxInput) form
-                .getInputByName("makeSoftReferences");
-        assertTrue(ITEM_NOT_CHECKED, makeSoftReferences.isChecked());
-
-        connectionRetryAttempts = (HtmlTextInput) form
-                .getInputByName("connectionRetryAttempts");
-        assertEquals("20", connectionRetryAttempts.asText());
-
-        hasSecurityManager = (HtmlCheckBoxInput) form
-                .getInputByName("hasSecurityManager");
-        assertTrue(ITEM_NOT_CHECKED, hasSecurityManager.isChecked());
-
-        /*
-         * Switch to the "Message SQL" tab and verify the changes:
-         */
-        msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
-        form = msgSqlPage.getFormByName("jms");
-
-        blobType = (HtmlTextInput) form.getInputByName("msgSqlMap(BLOB_TYPE)");
-        assertEquals("TEST_BLOB", blobType.asText());
-
-        createTablesOnStartup = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_TABLES_ON_STARTUP)");
-        assertEquals("TEST_VALUE", createTablesOnStartup.asText());
-
-        /*
-         * Restore the "Message SQL" property values:
-         */
-        blobType.setValueAttribute(savedBlobType);
-        createTablesOnStartup.setValueAttribute(savedCreateTablesOnStartup);
-
-        /*
-         * Switch to the "State SQL" tab and verify the changes:
-         */
-        stateSqlPage = clickLink(msgSqlPage, HREF_STATE_SQL_PAGE);
-        form = stateSqlPage.getFormByName("jms");
-
-        getUser = (HtmlTextInput) form.getInputByName("stateSqlMap(GET_USER)");
-        assertEquals("SOME SELECT STATEMENTS", getUser.asText());
-
-        /*
-         * Restore the "State SQL" property value:
-         */
-        getUser.setValueAttribute(savedGetUser);
-
-        /*
-         * Return to the "Settings" tab and save the restored values:
-         */
-        jmsPage = clickLink(stateSqlPage, HREF_SETTINGS_PAGE);
-        form = jmsPage.getFormByName("jms");
-        clickButton(form, SAVE_BUTTON);
-
-        /*
-         * Sleep for a few seconds for the changes to take effect:
-         */
-        Thread.sleep(hotDeployWaitTime * 3);
-    }
-
-    /**
-     * Test the action to select a different data source from the "Settings"
-     * page. This test verifies when a postgres data source is selected, the
-     * proper SQL properties are loaded from the properties file. However the
-     * changes will not be saved. So even though there's no postgres database
-     * existed on the system, the test won't cause any exception.
-     * 
-     * @throws Exception
-     */
-    public void testChangeDataSource() throws Exception {
-        String postgresDataSourceName = "postgresDS";
-        String postgresConnectionUrl = "jdbc:postgresql://localhost:5432/myPostgreDB";
-        String postgresDriverClass = "org.postgresql.Driver";
-
-        /*
-         * Create a postgres data source and wait for it to get deployed:
-         */
-        createDataSource(postgresDataSourceName, postgresConnectionUrl,
-                postgresDriverClass);
-        Thread.sleep(hotDeployWaitTime * 2);
-
-        /*
-         * Load the persistenceSql.properties into memory:
-         */
-        Properties sqlProps = loadProperties(persistSqlFile);
-
-        /*
-         * Get the jms page & form:
-         */
-        HtmlPage jmsPage = (HtmlPage) webClient.getPage(jmsUrl);
-        HtmlForm form = jmsPage.getFormByName("jms");
-
-        /*
-         * Select the new postgres data source from the drop down list:
-         */
-        HtmlSelect dataSourceName = (HtmlSelect) form
-                .getSelectByName("dataSourceName");
-        List dataSourceOptions = dataSourceName.getOptions();
-        HtmlOption option;
-        for (int i = 0; i < dataSourceOptions.size(); i++) {
-            option = (HtmlOption) dataSourceOptions.get(i);
-            if (postgresDataSourceName.equals(option.getValueAttribute())) {
-                jmsPage = (HtmlPage) option.setSelected(true);
-                break;
-            }
-        }
-
-        /*
-         * Switch to the "Message SQL" tab and verify the SQL properties for
-         * postgres DB are loaded correctly. Only the property values that're
-         * unique to postgres DB are checked:
-         */
-        HtmlPage msgSqlPage = clickLink(jmsPage, HREF_MSG_SQL_PAGE);
-        form = msgSqlPage.getFormByName("jms");
-
-        String expectedBlobType = sqlProps.getProperty("postgre.msg.BLOB_TYPE");
-        HtmlTextInput blobType = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(BLOB_TYPE)");
-        assertEquals(expectedBlobType, blobType.asText());
-
-        String expectedSelectMaxTx = sqlProps
-                .getProperty("postgre.msg.SELECT_MAX_TX");
-        HtmlTextInput selectMaxTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(SELECT_MAX_TX)");
-        assertEquals(expectedSelectMaxTx, selectMaxTx.asText());
-
-        String expectedDeleteMarkedMsgsWithTx = sqlProps
-                .getProperty("postgre.msg.DELETE_MARKED_MESSAGES_WITH_TX");
-        HtmlTextInput deleteMarkedMsgsWithTx = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(DELETE_MARKED_MESSAGES_WITH_TX)");
-        assertEquals(expectedDeleteMarkedMsgsWithTx, deleteMarkedMsgsWithTx
-                .asText());
-
-        String expectedCreateMessageTable = sqlProps
-                .getProperty("postgre.msg.CREATE_MESSAGE_TABLE");
-        HtmlTextInput createMessageTable = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_MESSAGE_TABLE)");
-        assertEquals(expectedCreateMessageTable, createMessageTable.asText());
-
-        String expectedCreateTxTable = sqlProps
-                .getProperty("postgre.msg.CREATE_TX_TABLE");
-        HtmlTextInput createTxTable = (HtmlTextInput) form
-                .getInputByName("msgSqlMap(CREATE_TX_TABLE)");
-        assertEquals(expectedCreateTxTable, createTxTable.asText());
-
-        /*
-         * Remove the postgres data source and wait for it to get undeployed:
-         */
-        removeDataSource(postgresDataSourceName);
-        Thread.sleep(hotDeployWaitTime * 2);
-    }
-}
\ No newline at end of file




More information about the jboss-cvs-commits mailing list