[embjopr-commits] EMBJOPR SVN: r362 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.
embjopr-commits at lists.jboss.org
embjopr-commits at lists.jboss.org
Tue Apr 28 11:05:21 EDT 2009
Author: fjuma
Date: 2009-04-28 11:05:21 -0400 (Tue, 28 Apr 2009)
New Revision: 362
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
Modifying the operations tests for datasources to match the new layout for the operations page.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-04-28 00:48:27 UTC (rev 361)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-04-28 15:05:21 UTC (rev 362)
@@ -57,6 +57,8 @@
public abstract class DatasourceTestBase extends EmbjoprTestCase {
public static final String DS_NAV_LABEL = "Datasources";
+
+ public static final String POOL_SEPARATOR = "------------------------------------------------------";
// Datasource types, as they appear in the left nav
protected enum DatasourceType {
@@ -98,7 +100,7 @@
this.templateHtmlSelectValue = htmlSelectValue;
this.typeName = typeName;
}
-
+
}// DatasourceTypes
// --- Datasource Templates --- //
@@ -665,7 +667,7 @@
// Check for the appropriate error messages
checkClientAndServerMessages("An invalid value was specified for one or more properties",
"Value is required", true);
- }
+ }
/**
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-04-28 00:48:27 UTC (rev 361)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-04-28 15:05:21 UTC (rev 362)
@@ -55,6 +55,8 @@
private static final ComponentType NO_TX_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.NoTx.getType();
private static final ComponentType XA_COMPONENT_TYPE = KnownComponentTypes.DataSourceTypes.XA.getType();
+ private static final String OPERATION_RESULTS = "operationResults";
+
/**
* Create a new datasource using the given type, template, and properties.
*
@@ -622,31 +624,24 @@
// Use the default formatter
client.click("parametersForm:okButton");
- HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
- "(Show/Hide Details)");
- detailsLink.click();
+ // Get the result of the operation
+ HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+ HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
- // Get the result of the operation
- HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
- HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ assertNotNull("Could not get the result of the operation", resultTextBox);
+
String actualResult = resultTextBox.getText();
-
- String expectedResult = "Sub Pool Statistics: \nSub Pool Count: 1\n"
- + "------------------------------------------------------\n\n"
- + "Track By Transaction: false\n"
- + "Available Connections Count: 20\n"
- + "Max Connections In Use Count:0\n"
- + "Connections Destroyed Count:0\n"
- + "Connections In Use Count:0\n"
- + "Total Block Time:0\n"
- + "Average Block Time For Sub Pool:0\n"
- + "Maximum Wait Time For Sub Pool:0\n"
- + "Total Timed Out:0";
-
+
+ // Set up the expected results
+ StringBuffer expectedBuffer = new StringBuffer();
+ expectedBuffer.append("Sub Pool Statistics: \n");
+ expectedBuffer.append("Sub Pool Count: 0\n");
+ expectedBuffer.append(POOL_SEPARATOR);
+ expectedBuffer.append("\n\n");
- assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedResult
+ assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedBuffer.toString()
+ "\n\nbut was:\n\n" + actualResult,
- actualResult.contains(expectedResult));
+ actualResult.contains(expectedBuffer.toString()));
// Clean up
deleteDatasource(propertiesMap.get("jndi-name"), DatasourceType.NO_TX_DATASOURCE);
@@ -698,26 +693,30 @@
// Use the default formatter
client.click("parametersForm:okButton");
- HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
- "(Show/Hide Details)");
- detailsLink.click();
+ // Get the result of the operation
+ HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+ HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
- // Get the result of the operation
- HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
- HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ assertNotNull("Could not get the result of the operation", resultTextBox);
+
String actualResult = resultTextBox.getText();
+
+ // Set up the expected results
+ StringBuffer expectedBuffer = new StringBuffer();
+ expectedBuffer.append("Sub Pool Statistics: \n");
+ expectedBuffer.append("Sub Pool Count: 1\n");
+ expectedBuffer.append(POOL_SEPARATOR);
+ expectedBuffer.append("\n\n");
+ expectedBuffer.append("Track By Transaction: true\n");
+ expectedBuffer.append("Available Connections Count: 16\n");
+ expectedBuffer.append("Max Connections In Use Count:4\n");
+ expectedBuffer.append("Connections Destroyed Count:0\n");
+ expectedBuffer.append("Connections In Use Count:4\n");
- String expectedResult = "Sub Pool Statistics: \nSub Pool Count: 1\n"
- + "------------------------------------------------------\n\n"
- + "Track By Transaction: true\n"
- + "Available Connections Count: 16\n"
- + "Max Connections In Use Count:4\n"
- + "Connections Destroyed Count:0\n"
- + "Connections In Use Count:4\n";
-
- assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" + expectedResult
+ assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n"
+ + expectedBuffer.toString()
+ "\n\nbut was:\n\n" + actualResult,
- actualResult.contains(expectedResult));
+ actualResult.contains(expectedBuffer.toString()));
} finally {
// Clean up
@@ -778,26 +777,30 @@
// Use the default formatter
client.click("parametersForm:okButton");
- HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
- "(Show/Hide Details)");
- detailsLink.click();
+ // Get the result of the operation
+ HtmlDivision historyPanel = (HtmlDivision)client.getElement(OPERATION_RESULTS);
+ HtmlTextArea resultTextBox = (HtmlTextArea)historyPanel.getFirstByXPath(".//textarea[@class='property-value-input']");
- // Get the result of the operation
- HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
- HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ assertNotNull("Could not get the result of the operation", resultTextBox);
+
String actualResult = resultTextBox.getText();
+
+ // Set up the expected results
+ StringBuffer expectedBuffer = new StringBuffer();
+ expectedBuffer.append("Sub Pool Statistics: \n");
+ expectedBuffer.append("Sub Pool Count: 1\n");
+ expectedBuffer.append(POOL_SEPARATOR);
+ expectedBuffer.append("\n\n");
+ expectedBuffer.append("Track By Transaction: true\n");
+ expectedBuffer.append("Available Connections Count: 12\n");
+ expectedBuffer.append("Max Connections In Use Count:10\n");
+ expectedBuffer.append("Connections Destroyed Count:0\n");
+ expectedBuffer.append("Connections In Use Count:8");
- String expectedResult = "Sub Pool Statistics: \nSub Pool Count: 1\n"
- + "------------------------------------------------------\n\n"
- + "Track By Transaction: true\n"
- + "Available Connections Count: 12\n"
- + "Max Connections In Use Count:10\n"
- + "Connections Destroyed Count:0\n"
- + "Connections In Use Count:8";
-
- assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n" + expectedResult
+ assertTrue("Incorrect sub pool statistics - \nexpected the result to contain:\n\n"
+ + expectedBuffer.toString()
+ "\n\nbut was:\n\n" + actualResult,
- actualResult.contains(expectedResult));
+ actualResult.contains(expectedBuffer.toString()));
} finally {
// Clean up
More information about the embjopr-commits
mailing list