EMBJOPR SVN: r134 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-04 12:37:12 -0500 (Wed, 04 Feb 2009)
New Revision: 134
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java
Log:
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java 2009-02-04 05:01:05 UTC (rev 133)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as4/DatasourceTest.java 2009-02-04 17:37:12 UTC (rev 134)
@@ -27,10 +27,10 @@
import org.jboss.jopr.jsfunit.*;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.IOException;
+import java.util.*;
import junit.framework.Test;
import junit.framework.TestSuite;
import javax.management.ObjectName;
-import java.util.Map;
import javax.management.JMException;
@@ -56,6 +56,11 @@
/**
* Create a new datasource using the given template and properties.
+ *
+ * Scenario:
+ * NavTree -> Datasources;
+ * Template select;
+ * Fill the form and save.
*
* @param datasourceType is not used.
* @param datasourceTemplate is the value of the HTML select option.
@@ -71,20 +76,18 @@
// Click on the "Add new resource" button
client.click("actionHeaderForm:addNewNotContent"); // 404 if setThrowExceptionOnFailingStatusCode(true) above
- // Select the default datasource (other options: Oracle)
+ // Select the datasource (options: default, Oracle XA, Oracle Local TX)
HtmlSelect menu = (HtmlSelect)client.getElement("resourceCreateForm:selectedTemplate");
-
menu.setSelectedAttribute(datasourceTemplate, true);
// Submit the form. [Continue]
- //HtmlSubmitInput submit = (HtmlSubmitInput) util.getFirstElementByXPath(util.getTabMenuBoxElement(), ".//input[@type='submit']");
- //if( null == submit ){ fail("\"Continue\" button not found."); }
- //submit.click();
-
client.click("resourceCreateForm:addButton");
// Configure the properties associated with this datasource
+ propertiesMap.put("type", DatasourceType.LOCAL_TX_DATASOURCE.getHtmlRadioValue() );
fillOutForm(propertiesMap);
+ // Remove the type property not to be treated later as regular properties.
+ propertiesMap.remove("type");
}
@@ -102,7 +105,11 @@
// Additional or different properties for AS 4
+ // AS 4 has type set through radio button.
+ //propertiesMap.put("type", DatasourceType.LOCAL_TX_DATASOURCE.getHtmlRadioValue() );
+ // Inappropriate - type is then represented other way than other properties.
+
return propertiesMap;
}
@@ -114,15 +121,17 @@
/**
* Delete the datasource given by datasourceName.
*/
- protected void deleteDatasource(String datasourceName) throws IOException {
+ protected void deleteDatasource(String datasourceName) throws IOException, AssertException {
HtmlAnchor datasourceLink = getNavTreeLink("Datasources");
datasourceLink.click();
//HtmlButtonInput deleteButton = getDeleteButton("resourceSummaryForm", datasourceName); /*categorySummaryForm*/
//deleteButton.click();
try {
- ((HtmlInput) getFirstElementByXPath(getRowByName(datasourceName), ".//input[text()='Delete']")).click();
+ ((HtmlInput) getFirstElementByXPath(getRowByName(datasourceName),
+ ".//input[ @value = 'Delete' ]")).click();
} catch (AssertException ex) {
Logger.getLogger(DatasourceTest.class.getName()).log(Level.SEVERE, null, ex);
+ throw ex;
}
}
@@ -165,26 +174,59 @@
* Create a new datasource. Leave some property values that aren't
* required unset.
*/
- public void testCreateDatasource() throws IOException {
+ @Override
+ public void testCreateDatasource() throws IOException, AssertException {
+ /* // Works
+ JMXUtils jmxu = JMXUtils.getInstanceForLocalJBoss();
+ try {
+ Object mBeanAttribute = jmxu.getMBeanAttribute("jboss.j2ee:service=ClientDeployer", "State");
+ log.info("State: "+mBeanAttribute.toString());
+ } catch (JMException ex) {
+ log.fatal(ex.getMessage());
+ ex.printStackTrace();
+ } /**/
+
+ log.info("Printing MBeans info");
+ JMXUtils.getInstanceForLocalJBoss().dumpInfo();///
+
+
Map<String, String> propertiesMap = getDatasourceProperties();
/* AS 4:
<option value="Oracle Local TX__Datasource">Oracle Local TX (Datasource)</option>
<option value="Oracle XA__Datasource">Oracle XA (Datasource)</option>
<option value="default__Datasource">default (Datasource)</option>
- /**/
createDatasource(DatasourceType.LOCAL_TX_DATASOURCE, // unsued for AS 4
// TODO: Differs! Split DatasourceType accordingly...
- DatasourceTemplate.DEFAULT.getTemplateHtmlSelectValue(),
+ DatasourceTemplate.AS4_DEFAULT.getTemplateHtmlSelectValue(),
propertiesMap);
+ /**/
+
+ /*
+ // Option - "No TX datasource" / value = no-tx-datasource TODO: XSLT
+ //((HtmlRadioButtonInput)client.getElement("resourceConfigurationForm:rhq_prop-287459352_3575610:0")).setChecked(true);
+ ((HtmlRadioButtonInput)util.getFirstElementByXPath(tabMenuBox, ".//input[@value='no-tx-datasource']"))
+ .setChecked(true);
+ */
+
+
+ log.info("Clicking Save...");
client.click("resourceConfigurationForm:saveButton");
-
- // Check for the appropriate success messages
- String expectedMessage = "Successfully added new Local TX Datasource";
+ log.info("Clicked");
+
+
+ DebugUtils.writeFile("/home/ondra/work/JOPRembedded/emb.html", client.getPageAsText());////
+
+ log.info("Printing MBeans info"); ////
+ JMXUtils.getInstanceForLocalJBoss().dumpInfo();////
+
+ // Check for the appropriate success messages.
+ String expectedMessage = "Successfully added new Datasource.";
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
-
+
+ // Check whether the dataource is deployed.
assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"),
DatasourceType.LOCAL_TX_DATASOURCE));
assertTrue(checkProperties(propertiesMap.get("jndi-name"),
@@ -195,20 +237,52 @@
// set for properties that were not specified above
// Clean up
- deleteDatasource(propertiesMap.get("jndi-name"));
- expectedMessage = "Successfully deleted Local TX Datasource '"
- + propertiesMap.get("jndi-name") + "'";
+ deleteDatasource(propertiesMap.get("jndi-name"));
+
+ expectedMessage = "Successfully deleted Datasource '"
+ + propertiesMap.get("jndi-name") + " Datasource'.";
+
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+
}
+/*
+ @Override
+ public void testCreateDatasourceMissingRequiredValues() throws IOException {
+ // Leave jndi-name and connection-url unset
+ Map<String, String> propertiesMap = new HashMap<String, String>();
+ propertiesMap.put("user-name", "testUser");
+ propertiesMap.put("max-pool-size", "10");
+ propertiesMap.put("idle-timeout-minutes", "20");
+ createDatasource(DatasourceType.NO_TX_DATASOURCE,
+ //"default__No TX Datasource",
+ isJBoss4 ?
+ DatasourceTemplate.DEFAULT.getTemplateHtmlSelectValue() :
+ DatasourceTemplate.DEFAULT_NO_TX.getTemplateHtmlSelectValue(),
+ propertiesMap);
+ client.click("resourceConfigurationForm:saveButton");
+ // Check for the appropriate error messages
+ checkClientAndServerMessages(
+ "An invalid value was specified for one or more properties",
+ "Value is required", true);
+ }
+*/
+
+
+
+
+
+
+
+
/**
* @return the suite of tests being tested
*/
@@ -220,8 +294,6 @@
-
-
/**
* AS 4 uses State and StateString attributes.
* @param deploymentMBean
@@ -236,7 +308,7 @@
Object state = jmxUtils.getMBeanAttribute(deploymentMBean, "StateString");
//if(!("3".equals(state.toString()))) return false; // started state
- return !( "Started".equals(state.toString()) );
+ return ( "Started".equals(state.toString()) );
}
15 years, 10 months
EMBJOPR SVN: r133 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-04 00:01:05 -0500 (Wed, 04 Feb 2009)
New Revision: 133
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
Log:
Few changes in DatasourceTestBase.java to prepare for AS4 tests versions
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-02-04 04:57:26 UTC (rev 132)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-02-04 05:01:05 UTC (rev 133)
@@ -94,19 +94,55 @@
// --- Datasource Templates --- //
/*
+ AS 4:
<select id="resourceCreateForm:selectedTemplate" size="1" name="resourceCreateForm:selectedTemplate">
<option value="">Select Template</option>
<option value="Oracle Local TX__Datasource">Oracle Local TX (Datasource)</option>
<option value="Oracle XA__Datasource">Oracle XA (Datasource)</option>
<option value="default__Datasource">default (Datasource)</option>
</select>
+
+ AS 5: Template selection depends on the active navtree node.
+
+ <select id="resourceCreateForm:selectedTemplate" size="1" name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle No TX__No TX Datasource">Oracle No TX (No TX Datasource)</option>
+ <option value="default__No TX Datasource">default (No TX Datasource)</option>
+ </select>
+ <select id="resourceCreateForm:selectedTemplate" size="1" name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle Local TX__Local TX Datasource">Oracle Local TX (Local TX Datasource)</option>
+ <option value="default__Local TX Datasource">default (Local TX Datasource)</option>
+ </select>
+ <select id="resourceCreateForm:selectedTemplate" size="1" name="resourceCreateForm:selectedTemplate">
+ <option value="Oracle XA__XA Datasource">Oracle XA (XA Datasource)</option>
+ <option value="default__XA Datasource">default (XA Datasource)</option>
+ </select>
+
*/
protected enum DatasourceTemplate {
- ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
- ORACLE_XA("Oracle XA__Datasource"),
- DEFAULT("default__Datasource");
+ /** AS 4 */
+ AS4_ORACLE_LOCAL_TX("Oracle Local TX__Datasource"),
+ /** AS 4 */
+ AS4_ORACLE_XA("Oracle XA__Datasource"),
+ /** AS 4 */
+ AS4_DEFAULT("default__Datasource"),
+
+ /** AS 5 */
+ AS5_ORACLE_LOCAL_TX("Oracle Local TX__Local TX Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_LOCAL_TX("default__Local TX Datasource"),
+ /** AS 5 */
+ AS5_ORACLE_NO_TX("Oracle No TX__No TX Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_NO_TX("default__No TX Datasource"),
+ /** AS 5 */
+ AS5_ORACLE_XA("Oracle XA__XA Datasource"),
+ /** AS 5 */
+ AS5_DEFAULT_XA("default__XA Datasource");
+
+
+
protected final String templateHtmlSelectValue;
@@ -359,8 +395,8 @@
String expectedMessage = "Successfully added new Local TX Datasource";
checkClientAndServerMessages(expectedMessage, expectedMessage, false);
- assertTrue(isDatasourceDeployed(propertiesMap.get("jndi-name"),
- DatasourceType.LOCAL_TX_DATASOURCE));
+ assertTrue("Datasource is not deployed (isDatasourceDeployed() returned false).",
+ isDatasourceDeployed(propertiesMap.get("jndi-name"), DatasourceType.LOCAL_TX_DATASOURCE));
assertTrue(checkProperties(propertiesMap.get("jndi-name"),
DatasourceType.LOCAL_TX_DATASOURCE,
propertiesMap));
@@ -384,23 +420,29 @@
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("user-name", "testUser");
propertiesMap.put("max-pool-size", "10");
- propertiesMap.put("prefill", "true");
propertiesMap.put("idle-timeout-minutes", "20");
- propertiesMap.put("set-tx-query-timeout", "true");
- propertiesMap.put("query-timeout", "1800");
+ if( !isJBoss4 ){
+ propertiesMap.put("prefill", "true");
+ propertiesMap.put("set-tx-query-timeout", "true");
+ propertiesMap.put("query-timeout", "1800");
+ }
createDatasource(DatasourceType.NO_TX_DATASOURCE,
- DatasourceType.NO_TX_DATASOURCE.getTemplateHtmlSelectValue(), //"default__No TX Datasource",
+ //"default__No TX Datasource",
+ isJBoss4 ?
+ DatasourceTemplate.AS4_DEFAULT.getTemplateHtmlSelectValue() :
+ DatasourceTemplate.AS5_DEFAULT_NO_TX.getTemplateHtmlSelectValue(),
propertiesMap);
client.click("resourceConfigurationForm:saveButton");
// Check for the appropriate error messages
- checkClientAndServerMessages("An invalid value was specified for one "
- + "or more properties",
- "Value is required",
- true);
+ checkClientAndServerMessages(
+ "An invalid value was specified for one or more properties",
+ "Value is required", true);
+
}
+
/**
* Attempt to create a new datasource but set a property value
* beyond its expected range of values. An error should occur.
@@ -419,7 +461,7 @@
propertiesMap.put("max-pool-size", "100000000000000");
createDatasource(DatasourceType.XA_DATASOURCE,
- DatasourceType.XA_DATASOURCE.getTemplateHtmlSelectValue(),
+ DatasourceTemplate.AS5_DEFAULT_XA.getTemplateHtmlSelectValue(),
propertiesMap);
client.click("resourceConfigurationForm:saveButton");
@@ -930,9 +972,10 @@
for(Iterator i = metricsMap.keySet().iterator(); i.hasNext();) {
String metricName = (String)i.next();
- assertEquals("Incorrect metric value for: " + metricName,
- metricsMap.get(metricName),
- getMetricValueFromTable(metricName, "dataTable"));
+ String expected = metricsMap.get(metricName);
+ String actual = getMetricValueFromTable(metricName, "dataTable");
+ assertEquals("Incorrect metric value for '"+metricName+"'='"+actual+"'," +
+ " expected '"+expected+"'", actual, expected);
}
// Check values under the "Summary" tab
@@ -943,11 +986,13 @@
summaryMetrics.add("Available Connection Count");
summaryMetrics.add("Connection Count");
- for(Iterator i = summaryMetrics.iterator(); i.hasNext();) {
+ for(Iterator i = summaryMetrics.iterator(); i.hasNext(); ) {
String metricName = (String)i.next();
- assertEquals("Incorrect metric value for: " + metricName,
- metricsMap.get(metricName),
- getMetricValueFromTable(metricName, "dataTable"));
+
+ String expected = metricsMap.get(metricName);
+ String actual = getMetricValueFromTable(metricName, "dataTable");
+ assertEquals("Incorrect summary metric value for '"+metricName+"'='"+actual+"'," +
+ " expected '"+expected+"'", actual, expected);
}
}
15 years, 11 months
EMBJOPR SVN: r132 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-03 23:57:26 -0500 (Tue, 03 Feb 2009)
New Revision: 132
Modified:
trunk/jsfunit/pom.xml
Log:
Added Cargo's <configuration><type/> <home/> to set JBoss configuration dir.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-02-04 01:06:38 UTC (rev 131)
+++ trunk/jsfunit/pom.xml 2009-02-04 04:57:26 UTC (rev 132)
@@ -243,8 +243,12 @@
</systemProperties>
</container>
- <!-- cargo-configuration -->
+ <!-- Container configuration -->
<configuration>
+ <!-- Set where the configuration dir will be. -->
+ <!-- TODO: Prepend ${basedir}/ and test; Copy to AS 4 and test.-->
+ <type>standalone</type>
+ <home>target/jboss5x</home>
<!-- Raise permgen size, allow classes unloading and permgen sweep -->
<properties>
<cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
@@ -257,7 +261,7 @@
</configfile>
</configfiles>
</configuration>
- <!-- /cargo-configuration -->
+ <!-- /Container configuration -->
</configuration>
<executions>
15 years, 11 months
EMBJOPR SVN: r131 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-03 20:06:38 -0500 (Tue, 03 Feb 2009)
New Revision: 131
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
bool isMBeanStateDeployedImpl() - was returning opposite result it should
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-02-03 20:48:48 UTC (rev 130)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-02-04 01:06:38 UTC (rev 131)
@@ -175,7 +175,7 @@
JMXUtils jmxUtils = JMXUtils.getInstanceForLocalJBoss();
Object state = jmxUtils.getMBeanAttribute(deploymentMBean, "State");
- return !("DEPLOYED".equals( state.toString() ));
+ return ("DEPLOYED".equals( state.toString() ));
}
15 years, 11 months
EMBJOPR SVN: r130 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-03 15:48:48 -0500 (Tue, 03 Feb 2009)
New Revision: 130
Modified:
trunk/jsfunit/pom.xml
Log:
Setting level of logging by telling Cargo plugin which jboss-log4j.xml to use.
This also shows how to set up the JBoss configuration used by Cargo in general.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-02-03 04:27:07 UTC (rev 129)
+++ trunk/jsfunit/pom.xml 2009-02-03 20:48:48 UTC (rev 130)
@@ -130,6 +130,9 @@
<container>
<containerId>jboss42x</containerId>
<home>${JBOSS_HOME}</home>
+ <!-- JVM location; currently doesn't work and isn't documented.
+ I even don't know whether it should be here or on the other place. -->
+ <!--<cargo.java.home>${JAVA_HOME}</cargo.java.home>-->
<log>${basedir}/target/jboss4.2.logs/cargo.log</log>
<timeout>300000</timeout> <!-- 5 minutes -->
<systemProperties>
@@ -138,6 +141,8 @@
<jsfunit.htmlunitsnooper>enabled</jsfunit.htmlunitsnooper> -->
<jsfunit.testdata>${basedir}/testdata</jsfunit.testdata>
<jsfunit.deploy.dir>${basedir}/target/jboss42x/deploy</jsfunit.deploy.dir>
+ <!-- JVM location; see above. -->
+ <!--<cargo.java.home>${JAVA_HOME}</cargo.java.home>-->
</systemProperties>
</container>
</configuration>
@@ -237,12 +242,23 @@
<jsfunit.deploy.dir>${basedir}/target/jboss5x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
- <!-- Raise permgen size -->
+
+ <!-- cargo-configuration -->
<configuration>
+ <!-- Raise permgen size, allow classes unloading and permgen sweep -->
<properties>
- <cargo.jvmargs>-XX:MaxPermSize=512</cargo.jvmargs>
+ <cargo.jvmargs>-XX:PermSize=512m -XX:MaxPermSize=1024 -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled</cargo.jvmargs>
</properties>
+ <!-- Override Cargo's default jboss-log4j.xml -->
+ <configfiles>
+ <configfile>
+ <file>${JBOSS_HOME}/server/default/conf/jboss-log4j.xml</file>
+ <tofile>conf/jboss-log4j.xml</tofile>
+ </configfile>
+ </configfiles>
</configuration>
+ <!-- /cargo-configuration -->
+
</configuration>
<executions>
<execution>
15 years, 11 months
EMBJOPR SVN: r129 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-02 23:27:07 -0500 (Mon, 02 Feb 2009)
New Revision: 129
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Log:
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-02-03 00:21:21 UTC (rev 128)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-02-03 04:27:07 UTC (rev 129)
@@ -23,8 +23,6 @@
package org.jboss.jopr.jsfunit;
import com.gargoylesoftware.htmlunit.BrowserVersion;
-import com.gargoylesoftware.htmlunit.ElementNotFoundException;
-import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.html.*;
import java.io.IOException;
import java.util.*;
@@ -35,8 +33,6 @@
import org.jboss.jsfunit.jsfsession.JSFServerSession;
import org.jboss.jsfunit.jsfsession.JSFSession;
import javax.faces.application.FacesMessage;
-import javax.management.*;
-import org.jboss.mx.util.MBeanServerLocator;
//import org.jboss.jmx.adaptor.rmi.RMIAdaptor; // Needs dependency: jmx-adaptor-plugin
import java.util.regex.Pattern;
import javax.xml.xpath.XPathException;
@@ -70,9 +66,11 @@
*/
public void setUp() throws IOException
{
- isJBoss4 = Package.getPackage("org.jboss.system.server")
- .getImplementationVersion()
- .startsWith("4");
+ // JBoss as version
+ String version = Package.getPackage("org.jboss.system.server")
+ .getImplementationVersion();
+ log.info("Detected AS version: " + version);
+ isJBoss4 = version.startsWith("4");
// Initial JSF request
WebClientSpec wcSpec = new WebClientSpec("/", BrowserVersion.FIREFOX_3);
@@ -215,13 +213,13 @@
* If the input box/radio button does not have an enable/disable checkbox,
* return the input element as is.
*/
- public HtmlInput enableOrDisableFormInput(String propertyName,
- Boolean enableInput) {
+ public HtmlInput enableOrDisableFormInput(String propertyName, Boolean enableInput) {
+
HtmlForm form = (HtmlForm)client.getElement("resourceConfigurationForm");
HtmlInput input = (HtmlInput)form.getFirstByXPath(".//input[@ondblclick='//"
+ propertyName + "']");
- assertNotNull("Form input for property " + propertyName + " not found.", input);
+ assertNotNull("Form input for property '" + propertyName + "' not found.", input);
boolean isRadioButton = input.getTypeAttribute().equals("radio");
String id = input.getId();
15 years, 11 months
EMBJOPR SVN: r128 - trunk/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-02-02 19:21:21 -0500 (Mon, 02 Feb 2009)
New Revision: 128
Modified:
trunk/jsfunit/pom.xml
Log:
Added: -XX:MaxPermSize=512 for AS 5 - Seam kept throwing OutOfMemoryException.
Modified: trunk/jsfunit/pom.xml
===================================================================
--- trunk/jsfunit/pom.xml 2009-02-02 15:14:56 UTC (rev 127)
+++ trunk/jsfunit/pom.xml 2009-02-03 00:21:21 UTC (rev 128)
@@ -237,6 +237,12 @@
<jsfunit.deploy.dir>${basedir}/target/jboss5x/deploy</jsfunit.deploy.dir>
</systemProperties>
</container>
+ <!-- Raise permgen size -->
+ <configuration>
+ <properties>
+ <cargo.jvmargs>-XX:MaxPermSize=512</cargo.jvmargs>
+ </properties>
+ </configuration>
</configuration>
<executions>
<execution>
15 years, 11 months
EMBJOPR SVN: r127 - in trunk: jsfunit/src/test/java/org/jboss/jopr/jsfunit and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2009-02-02 10:14:56 -0500 (Mon, 02 Feb 2009)
New Revision: 127
Modified:
trunk/core/src/main/webapp/secure/operationParameters.xhtml
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
Log:
Added tests for the "Flush" operation and for the "List Formatted Sub Pool Statistics" operation.
Modified: trunk/core/src/main/webapp/secure/operationParameters.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/operationParameters.xhtml 2009-01-28 21:50:27 UTC (rev 126)
+++ trunk/core/src/main/webapp/secure/operationParameters.xhtml 2009-02-02 15:14:56 UTC (rev 127)
@@ -60,7 +60,8 @@
<ui:remove><!--Don't use s:button, as it will not submit the form!--></ui:remove>
<h:panelGrid columns="2" styleClass="buttons-table" columnClasses="button-cell">
- <h:commandButton value="#{messages['button.ok']}"
+ <h:commandButton id="okButton"
+ value="#{messages['button.ok']}"
action="#{operationAction.invokeOperation()}"
styleClass="buttonmed"/>
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-01-28 21:50:27 UTC (rev 126)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-02-02 15:14:56 UTC (rev 127)
@@ -283,6 +283,28 @@
}
/**
+ * Create the specified number of connections to the given
+ * database.
+ *
+ * @return the ArrayList of Connections.
+ */
+ public ArrayList<Connection> createConnections(int numConnections,
+ String jndiName,
+ String username,
+ String password) throws Exception {
+ // Establish multiple connections
+ ArrayList<Connection> connections = new ArrayList<Connection>();
+
+ for(int i = 0; i < numConnections; i++) {
+ Connection con = connectDB(jndiName, username, password);
+ assertNotNull("Null connection", con);
+ connections.add(con);
+ }
+
+ return connections;
+ }
+
+ /**
* Disconnect from the database.
*/
public void disconnectDB(Connection con) throws SQLException {
@@ -292,6 +314,15 @@
}
/**
+ * Close each Connection in the given ArrayList of Connections.
+ */
+ public void closeConnections(ArrayList<Connection> connections) throws SQLException {
+ for(int i = 0; i < connections.size(); i++) {
+ disconnectDB(connections.get(i));
+ }
+ }
+
+ /**
* @return the suite of tests being tested
* @throws UnsupportedOperationException - you have to override this.
* Can't be abstract, must be static.
@@ -930,6 +961,5 @@
*/
protected abstract boolean isMBeanStateDeployedImpl( ObjectName deploymentMBean ) throws JMException, IOException;
-
}
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-01-28 21:50:27 UTC (rev 126)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-02-02 15:14:56 UTC (rev 127)
@@ -31,6 +31,7 @@
import javax.management.ObjectName;
import java.util.Map;
import javax.management.JMException;
+import java.sql.Connection;
/**
* When complete, this class will contain tests for creating,
@@ -331,6 +332,184 @@
// Clean up
deleteDatasource(propertiesMap.get("jndi-name"));
+ }
+
+ /**
+ * Test the "Flush" operation.
+ */
+ public void testFlushOperation() throws IOException {
+
+ // Min pool size will be 6, max pool size will be 15
+ Map<String, String> propertiesMap = createXADatasource("FlushDS");
+
+ performDatasourceOperation(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, "Flush");
+
+ // Make sure the metrics are updated appropriately
+ Map<String, String> expectedMetrics = new HashMap<String, String>();
+ expectedMetrics.put("Available Connection Count", "15.0");
+ expectedMetrics.put("Connection Count", "0.0");
+ expectedMetrics.put("Connection Created Count", "0.0");
+ expectedMetrics.put("Connection Destroyed Count", "0.0");
+ expectedMetrics.put("In Use Connection Count", "0.0");
+ expectedMetrics.put("Max Connections In Use Count", "0.0");
+ expectedMetrics.put("Max Size", "15.0");
+ expectedMetrics.put("Min Size", "6.0");
+
+ checkMetrics(propertiesMap.get("jndi-name"), DatasourceType.XA_DATASOURCE, expectedMetrics);
+
+ // Clean up
+ deleteDatasource(propertiesMap.get("jndi-name"));
}
+
+ /**
+ * Test the "List Formatted Sub Pool Statistics" after creating a new
+ * datasource.
+ */
+ public void testListFormattedSubPoolStatisticsAfterDatasourceCreation() throws Exception {
+
+ // Min pool size will be 5, max pool size will be 20
+ Map<String, String> propertiesMap = createNoTXDatasource("ListFormattedSubPoolStatisticsAfterDatasourceCreationDS");
+
+ performDatasourceOperation(propertiesMap.get("jndi-name"),
+ DatasourceType.NO_TX_DATASOURCE,
+ "List Formatted Sub Pool Statistics");
+
+ // Use the default formatter
+ client.click("parametersForm:okButton");
+
+ HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
+ "(Show/Hide Details)");
+ detailsLink.click();
+
+ // Get the result of the operation
+ HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
+ HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ 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";
+
+
+ assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedResult
+ + "\n\nbut was:\n\n" + actualResult,
+ actualResult.contains(expectedResult));
+
+ // Clean up
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
+
+ /**
+ * Test the "List Formatted Sub Pool Statistics" operation after multiple
+ * connections to a database have been established.
+ */
+ public void testListFormattedSubPoolStatisticsAfterMultipleConnections() throws Exception {
+
+ // Min pool size will be 5, max pool size will be 20
+ Map<String, String> propertiesMap = createLocalTXDatasource("ListFormattedSubPoolStatisticsAfterMultipleConnectionsDS");
+
+ // Create some connections
+ ArrayList<Connection> connections = createConnections(4, propertiesMap.get("jndi-name"),
+ propertiesMap.get("user-name"),
+ propertiesMap.get("password"));
+
+ performDatasourceOperation(propertiesMap.get("jndi-name"),
+ DatasourceType.LOCAL_TX_DATASOURCE,
+ "List Formatted Sub Pool Statistics");
+
+ // Use the default formatter
+ client.click("parametersForm:okButton");
+
+ HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
+ "(Show/Hide Details)");
+ detailsLink.click();
+
+ // Get the result of the operation
+ HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
+ HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ String actualResult = resultTextBox.getText();
+
+ 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"
+ + "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";
+
+ assertTrue("Incorrect sub pool statistics - \nexpected:\n\n" + expectedResult
+ + "\n\nbut was:\n\n" + actualResult,
+ actualResult.contains(expectedResult));
+
+ // Clean up
+ closeConnections(connections);
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
+
+ /**
+ * Test the "List Formatted Sub Pool Statistics" operation after
+ * closing some connections.
+ */
+ public void testListFormattedSubPoolStatisticsAfterClosingConnections() throws Exception {
+
+ // Min pool size will be 5, max pool size will be 20
+ Map<String, String> propertiesMap = createLocalTXDatasource("ListFormattedSubPoolStatisticsAfterClosingConnectionsDS");
+
+ // Create some connections
+ ArrayList<Connection> connections = createConnections(10, propertiesMap.get("jndi-name"),
+ propertiesMap.get("user-name"),
+ propertiesMap.get("password"));
+
+ // Close some connections
+ disconnectDB(connections.get(0));
+ disconnectDB(connections.get(1));
+
+ performDatasourceOperation(propertiesMap.get("jndi-name"),
+ DatasourceType.LOCAL_TX_DATASOURCE,
+ "List Formatted Sub Pool Statistics");
+
+ // Use the default formatter
+ client.click("parametersForm:okButton");
+
+ HtmlAnchor detailsLink = getLinkInsideForm("operationHistoryForm",
+ "(Show/Hide Details)");
+ detailsLink.click();
+
+ // Get the result of the operation
+ HtmlForm form = (HtmlForm)client.getElement("operationHistoryForm");
+ HtmlTextArea resultTextBox = (HtmlTextArea)form.getFirstByXPath(".//textarea");
+ String actualResult = resultTextBox.getText();
+
+ 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:\n\n" + expectedResult
+ + "\n\nbut was:\n\n" + actualResult.substring(0, actualResult.lastIndexOf("Total Block Time")),
+ actualResult.contains(expectedResult));
+
+ // Clean up
+ for(int i = 2; i <=9; i++) {
+ disconnectDB(connections.get(i));
+ }
+
+ deleteDatasource(propertiesMap.get("jndi-name"));
+ }
}
15 years, 11 months