EMBJOPR SVN: r226 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 18:37:38 -0400 (Fri, 13 Mar 2009)
New Revision: 226
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Added tests for EAR.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-13 21:20:31 UTC (rev 225)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-13 22:37:38 UTC (rev 226)
@@ -289,7 +289,7 @@
* junit.framework.ComparisonFailure: expected:<eardeployment.ear> but was:<ondra-redhat>
at org.jboss.jopr.jsfunit.as5.EarTest.testEarSummaryTab(EarTest.java:323)
*/
- public void DISABLEDtestEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
+ public void testEarSummaryTab() throws EmbJoprTestException, IOException, Exception {
final int DEPLOY_TIMEOUT_SEC = 10;
@@ -297,75 +297,80 @@
String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
deployEar( earFilePath );
- // Wait until the EAR appears...
- new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
- public boolean isTrue() throws Exception {
- // Refresh, then check.
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
- return null != earRow;
- }
- }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
-
+ try {
- ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ // Wait until the EAR appears...
+ new ActiveConditionChecker(new DescribedCondition("EAR appears in Summary tab list") {
+ public boolean isTrue() throws Exception {
+ // Refresh, then check.
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ ContentTableRow earRow = ejtt.getDefaultContentTable().findFirstRowContainingLink(BASIC_EAR);
+ return null != earRow;
+ }
+ }).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout(2000, 5);
- // Wait until the Status is "UP".
- // TODO: Replace with ActiveConditionChecker.
- int maxLoops = DEPLOY_TIMEOUT_SEC;
- do {
- String statusText = earRow.getCellTextByColumnName("Status");
- log.debug("EAR Status: "+statusText);
- if( "UP".equals(statusText) )
- break;
- // Refresh page after 1 second.
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
- // We don't want an infinite loop by mistake.
- if( maxLoops-- <= 0 ){
- throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
- }
- } while( true );
+ // Wait until the Status is "UP".
+ // TODO: Replace with ActiveConditionChecker.
+ int maxLoops = DEPLOY_TIMEOUT_SEC;
+ do {
+ String statusText = earRow.getCellTextByColumnName("Status");
+ log.debug("EAR Status: "+statusText);
+ if( "UP".equals(statusText) )
+ break;
- // FAILS because of EMBJOPR-80.
- earRow.getLinkByLabel(BASIC_EAR).click();
+ // Refresh page after 1 second.
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ // We don't want an infinite loop by mistake.
+ if( maxLoops-- <= 0 ){
+ throw new EmbJoprTestException("EAR "+BASIC_EAR+" not UP after "+DEPLOY_TIMEOUT_SEC+" seconds.");
+ }
+ } while( true );
- // Check the values in info table(s)
+ // FAILS because of EMBJOPR-80.
+ earRow.getLinkByLabel(BASIC_EAR).click();
- // General Properties
- HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
- ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
- Properties props = infoTable.getProperties();
- assertEquals(BASIC_EAR, props.getProperty("Name").trim());
- //assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
- // TODO: Fill JIRA? Description of EAR should be taken from application.xml <display-name>
- //assertEquals("JBossTest Ear Deployment Testsuite", props.getProperty("Description"));
+ // Check the values in info table(s)
+ // General Properties
+ HtmlTable genpropTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("General Properties").getElement();
+ ContentInfoTable infoTable = ejtt.getContentInfoTable( genpropTable );
+ Properties props = infoTable.getProperties();
- // Resource Traits
- infoTable = ejtt.getContentInfoTable(
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
- props = infoTable.getProperties();
+ assertEquals(BASIC_EAR, props.getProperty("Name").trim());
+ //assertEquals("?", props.getProperty("Version")); // TODO: Where does RHQ get the version from?
+ // TODO: Fill JIRA? Description of EAR should be taken from application.xml <display-name>
+ //assertEquals("JBossTest Ear Deployment Testsuite", props.getProperty("Description"));
- String path = System.getProperty(SYSPROP_DEPLOY_DIR)+"/"+BASIC_EAR;
- assertEquals(path, props.getProperty("Path").trim());
-
- assertEquals("no", props.getProperty("Exploded?").trim());
+ // Resource Traits
+ infoTable = ejtt.getContentInfoTable(
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+ props = infoTable.getProperties();
- // Metrics Summary
- HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
- infoTable = ejtt.getContentInfoTable(summaryTable);
- // (nothing here yet)
+ String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
+ assertEquals(path, props.getProperty("Path").trim());
- // Undeploy the EAR
- undeployEar( BASIC_EAR );
+ assertEquals("no", props.getProperty("Exploded?").trim());
+ // Metrics Summary
+ HtmlTable summaryTable = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Metrics Summary").getElement();
+ infoTable = ejtt.getContentInfoTable(summaryTable);
+ // (nothing here yet)
+
+
+ }
+ finally {
+ // Undeploy the EAR
+ undeployEar( BASIC_EAR );
+ }
+
}// testEarSummary()
@@ -373,12 +378,12 @@
/**
* Changes EAR configuration, and checks whether the changes were saved.
*
- * PASSED.
+ * FAILS because some of the values are read-only. EMBJOPR-96
*/
public void testEarConfigurationTab() throws IOException, EmbJoprTestException {
// Deploy the EAR.
- String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
+ String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
deployEar( earFilePath );
try {
@@ -401,7 +406,7 @@
log.info("Res ./ URL: "+ObjectUtils.toString(resUrl));
resUrl = this.getClass().getResource("/org/jboss/jopr/jsfunit/as5/props/ear-conf-basic.properties");
log.info("Res full URL: "+ObjectUtils.toString(resUrl));
-
+
Enumeration<URL> resources = this.getClass().getClassLoader().getResources("ear-conf-basic.properties");
while( resources.hasMoreElements() ){
log.info("Resources URL: "+ObjectUtils.toString( resources.nextElement() ));
@@ -428,9 +433,10 @@
// TODO: We don't see the success message! EMBJOPR-89
//checkClientAndServerMessages("successfully", "successfully", false);
+ // FAILS because some of the values are read-only. EMBJOPR-96
checkForm(props);
- // TODO: Finish
+ // TODO: Finish when the properties are marked read-only.
}
finally {
@@ -440,7 +446,154 @@
}
+
/**
+ * Changes EAR configuration, and checks whether the changes were saved.
+ *
+ * FAILS because some of the values are read-only. EMBJOPR-96
+ */
+ public void testEarRedeployment() throws IOException, EmbJoprTestException {
+
+ // Deploy the EAR.
+ String earFilePath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
+ deployEar( earFilePath );
+
+ try {
+
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+ // Navigate to the Configuration tab
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ earRow.getLinkByLabel(BASIC_EAR).click();
+ ejtt.tabMenu.clickControlTab();
+
+ String xPath = ".//table//input[@type='file']";
+ HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+ fileInput.setValueAttribute(earFilePath);
+ xPath = ".//table//input[@type='submit']";
+ HtmlSubmitInput submit = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
+ submit.click();
+
+
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
+ }
+
+
+
+ /**
+ * Deploys exploded EAR and checks whether it is reported as exploded.
+ *
+ * FAILS: EMBJOPR-95
+ */
+ public void testUnzippedEarReportedAsExploded() throws IOException, EmbJoprTestException {
+
+ // Deploy the EAR.
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+ deployEar( earFilePath );
+
+ try {
+ // Wait for EAR to be deployed and UP
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+ ContentTable table = ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits");
+ ContentInfoTable infoTable = ejtt.getTabMenu().getTabContentBox().getContentInfoTable(table.getElement());
+ Properties properties = infoTable.getProperties();
+ assertEquals("'Exploded?' should be 'yes'", "yes", properties.getProperty("Exploded?").toLowerCase() );
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
+ }
+
+
+
+
+ /**
+ * Checks EAR metrics tab.
+ */
+ public void testEarMetricsTab() throws IOException, EmbJoprTestException {
+
+ // Deploy the EAR.
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+ deployEar( earFilePath );
+
+ try {
+
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+ // Navigate to the Metrics tab
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ earRow.getLinkByLabel(BASIC_EAR).click();
+ ejtt.tabMenu.clickMetricsTab();
+
+ // Resource Traits
+
+ // Check the Path.
+ ContentInfoTable infoTable = ejtt.getContentInfoTable(
+ ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+ Properties props = infoTable.getProperties();
+
+ String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
+ assertEquals(path, props.getProperty("Path").trim());
+
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
+ }
+
+
+ /**
+ * Changes EAR configuration, and checks whether the changes were saved.
+ *
+ * FAILS because some of the values are read-only. EMBJOPR-96
+ */
+ public void testEarMetricsTabRefreshButton() throws IOException, EmbJoprTestException {
+
+ // Deploy the EAR.
+ String earFilePath = ejtt.getTestDataDir() + "/ear/"+BASIC_EAR;
+ deployEar( earFilePath );
+
+ try {
+
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+
+ // Navigate to the Metrics tab
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ earRow.getLinkByLabel(BASIC_EAR).click();
+ ejtt.tabMenu.clickMetricsTab();
+
+ // Click the Refresh button.
+ // Can this change to submit? Perhaps set an ID and use ejtt.getClickableById().
+ ejtt.tabMenu.getTabContentBox().getButtonByLabel("Refresh").click();
+
+ // Check that we are still on the right tab.
+ assertTrue("Metrics tab is active", ejtt.tabMenu.isTabActive("Metrics") );
+ assertTrue("Page contains EAR name", client.getPageAsText().contains(BASIC_EAR) );
+ assertTrue("Page contains 'Refresh'", client.getPageAsText().contains("Refresh") );
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
+ }
+
+
+ /**
* Deploys an exploded EAR application.
*
* PASSED.
@@ -480,13 +633,14 @@
+
+
+
/**
* Waits for the deployable to be in the UP State.
*
* @param type Type of deployable - EAR, WAR, SAR, ...
* @param name Name of the deployable, like 'hello.war'.
- * @throws org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException
- * @throws java.io.IOException
*/
private void waitActivelyForDeployment(
final DeployableTypes type, final String name,
@@ -656,7 +810,7 @@
// TODO: Move to utils
private void deleteFromDeployDir( String deployableName ) throws IOException{
- String deployDir = System.getProperty(SYSPROP_DEPLOY_DIR);
+ String deployDir = ejtt.getDeployDir();
File dirToDelete = new File( deployDir, deployableName);
// Just not to delete something accidentally...
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java 2009-03-13 21:20:31 UTC (rev 225)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/ActiveConditionChecker.java 2009-03-13 22:37:38 UTC (rev 226)
@@ -28,9 +28,12 @@
@SuppressWarnings("empty-statement")
public boolean waitWithTimeout( int msInterval, int retries ) throws Exception {
+ log.info("Waiting for condition: "+condition.getDescription());
+
while( retries-- > 0 ){
if( this.condition.isTrue() )
return true;
+ log.info(" Condition not satisfied, "+retries+" left. Sleeping for "+msInterval+" ms.");
try {
Thread.sleep(msInterval);
} catch (InterruptedException ex){
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 21:20:31 UTC (rev 225)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 22:37:38 UTC (rev 226)
@@ -74,6 +74,9 @@
return System.getProperty(AppConstants.SYSPROP_TESTDATA_DIR);
}
+ public String getDeployDir() {
+ return System.getProperty(AppConstants.SYSPROP_DEPLOY_DIR);
+ }
/**
@@ -327,19 +330,34 @@
/** Returns true if the tab with given label is active (it's content is shown). */
public boolean isTabActive( String label ) throws IOException, HtmlElementNotFoundException {
+ return isTabActive( getTabByLabel(label) );
+ }
- StyledElement tabContent = getTabByLabel(label);
- return "span".equals( tabContent.getTagName() )
- && tabContent.getClassAttribute().contains("active");
+ /** Returns true if the tab with given ID is active (it's content is shown). */
+ public boolean isTabActiveByID( String id ) throws IOException, HtmlElementNotFoundException {
+ return isTabActive( getTabByID(id) );
}
/** Returns true if the tab with given label is disabled (grayed and can't be activated). */
public boolean isTabDisabled( String label ) throws HtmlElementNotFoundException {
- StyledElement tabContent = getTabByLabel(label);
- return "span".equals( tabContent.getTagName() )
- && tabContent.getClassAttribute().contains("disabled");
+ return isTabDisabled( getTabByLabel(label) );
}
+ /** Returns true if the tab with given ID is disabled (grayed and can't be activated). */
+ public boolean isTabDisabledByID( String id ) throws HtmlElementNotFoundException {
+ return isTabDisabled( getTabByID(id) );
+ }
+
+ public boolean isTabActive( StyledElement tab ){
+ return "span".equals( tab.getTagName() )
+ && tab.getClassAttribute().contains("active");
+ }
+
+ public boolean isTabDisabled( StyledElement tab ){
+ return "span".equals( tab.getTagName() )
+ && tab.getClassAttribute().contains("disabled");
+ }
+
/** Shotcut - getTab(label).click(); Not necesarilly clicks an anchor. */
public void clickTab( String label ) throws IOException, ActionNotAvailableException, HtmlElementNotFoundException {
@@ -516,6 +534,14 @@
}
+ /**
+ * Returns content info table based on given table element.
+ */
+ public ContentInfoTable getContentInfoTable(HtmlTable tableElement) {
+ return new ContentInfoTable(tableElement);
+ }
+
+
}// inner class TabContentBox
15 years, 10 months
EMBJOPR SVN: r225 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 17:20:31 -0400 (Fri, 13 Mar 2009)
New Revision: 225
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Fixed getClickableById() in EJTT. Thanks to Charles for noticing
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 21:15:14 UTC (rev 224)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 21:20:31 UTC (rev 225)
@@ -1051,7 +1051,7 @@
public ClickableElement getClickableByID( String id ) throws HtmlElementNotFoundException {
ClickableElement clickable = (ClickableElement) client.getElement( id );
if( null == clickable )
- throw new HtmlElementNotFoundException("Can't find element with ID: "+clickable);
+ throw new HtmlElementNotFoundException("Can't find element with ID: "+id);
return clickable;
}
15 years, 10 months
EMBJOPR SVN: r224 - in trunk/jsfunit: testdata/ear and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 17:15:14 -0400 (Fri, 13 Mar 2009)
New Revision: 224
Added:
trunk/jsfunit/testdata/ear/ear-conf-basic.properties
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
Log:
Added properties check to EAR Configuration test
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-13 21:10:26 UTC (rev 223)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-13 21:15:14 UTC (rev 224)
@@ -22,6 +22,7 @@
package org.jboss.jopr.jsfunit.as5;
+import java.net.URL;
import org.jboss.jopr.jsfunit.util.DescribedCondition;
import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
import org.jboss.jopr.jsfunit.*;
@@ -33,9 +34,11 @@
import javax.faces.application.FacesMessage;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.apache.commons.lang.ObjectUtils;
import org.apache.commons.lang.StringUtils;
import org.jboss.jopr.jsfunit.AppConstants.DeployableTypes;
import org.jboss.jopr.jsfunit.exceptions.*;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit.*;
import org.w3c.dom.Node;
@@ -368,9 +371,7 @@
/**
- *
- * @throws java.io.IOException
- * @throws org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException
+ * Changes EAR configuration, and checks whether the changes were saved.
*
* PASSED.
*/
@@ -380,50 +381,101 @@
String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
deployEar( earFilePath );
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
+ try {
- ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
+ waitActivelyForDeployment(DeployableTypes.EAR, BASIC_EAR, 3000, 15);
- // TODO: Finish
+ // Navigate to the Configuration tab
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
+ earRow.getLinkByLabel(BASIC_EAR).click();
+ ejtt.tabMenu.clickConfigurationTab();
- undeployEar(BASIC_EAR);
+ // Read properties.
+ Properties props = new Properties();
+ /* Debug - Maven doesn't copy resources well due to <testSourceDirectory> hack
+ URL resUrl = this.getClass().getResource("props/ear-conf-basic.properties");
+ log.info("Res URL: "+ObjectUtils.toString(resUrl));
+ resUrl = this.getClass().getResource("ear-conf-basic.properties");
+ log.info("Res ./ URL: "+ObjectUtils.toString(resUrl));
+ resUrl = this.getClass().getResource("/org/jboss/jopr/jsfunit/as5/props/ear-conf-basic.properties");
+ log.info("Res full URL: "+ObjectUtils.toString(resUrl));
+
+ Enumeration<URL> resources = this.getClass().getClassLoader().getResources("ear-conf-basic.properties");
+ while( resources.hasMoreElements() ){
+ log.info("Resources URL: "+ObjectUtils.toString( resources.nextElement() ));
+ }
+ InputStream propsFile = this.getClass().getResourceAsStream(
+ //"/org/jboss/jopr/jsfunit/as5/props/ear-conf-basic.properties");
+ "props/ear-conf-basic.properties");
+ /**/
+
+
+ String filePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
+ props.load(new FileInputStream( filePath ));
+
+
+ // Set the configuration options and Save
+ fillOutForm(props);
+ //ejtt.getTabMenu().getTabContentBox().getButtonByLabel("Save");
+ ejtt.getClickableByID("resourceConfigurationForm:saveButton").click();
+
+
+ // Check whether the properties were saved.
+ ejtt.tabMenu.clickConfigurationTab();
+
+ // TODO: We don't see the success message! EMBJOPR-89
+ //checkClientAndServerMessages("successfully", "successfully", false);
+
+ checkForm(props);
+
+ // TODO: Finish
+
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
+
}
/**
+ * Deploys an exploded EAR application.
*
- * @throws java.io.IOException
- * @throws org.jboss.jopr.jsfunit.exceptions.HtmlElementNotFoundException
- *
* PASSED.
* Now fails, because EAR does not appear.
*/
public void testDeployUnpackedEar() throws IOException, EmbJoprTestException {
- //DebugUtils.writeFile("sysProp.txt", System.getProperties().toString());///
-
// Deploy the unpacked EAR.
// We have to use hotdeploy - can't upload a directory.
log.info("Unzipping ear/"+EAR_UNPACKED_ZIP);
unzipToDeployDir("ear/"+EAR_UNPACKED_ZIP, "");
- // Loop, wait for the app to appear.
- log.info("Waiting for EAR to appear.");
- waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 12 );
+ try {
+ // Loop, wait for the app to appear.
+ log.info("Waiting for EAR to appear.");
+ waitActivelyForDeployment( DeployableTypes.EAR, EAR_UNPACKED, 5000, 5 );
- ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(EAR_UNPACKED);
+ ejtt.getNavTree().getNodeByLabel(NAV_EAR).click();
- // TODO: Finish
+ ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(EAR_UNPACKED);
- // TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
+ // TODO: Finish
- // TODO: Preliminary test - check system properties, their validity, java version, etc.
+ // TODO: Check whether Exploded?: yes. EMBJOPR-95
+ // TODO: DeploymentUtils, DeployableTypes, isAvailable enum inner classes
+
+ // TODO: Preliminary test - check system properties, their validity, java version, etc.
+ }
+ finally {
+ // Delete the EAR dir.
+ deleteFromDeployDir(EAR_UNPACKED_ZIP);
+ }
}
@@ -444,9 +496,15 @@
{
try {
String conditionDesc = type.name()+" "+name+" appears in embjopr as deployed";
+ final EmbJoprTestToolkit selfEjtt = ejtt;
boolean deployedSuccessfuly =
new ActiveConditionChecker( new DescribedCondition(conditionDesc) {
+ int callsMade = 0;
public boolean isTrue() throws HtmlElementNotFoundException, IOException {
+ // Refresh the page if this is not the first call.
+ if( callsMade++ > 0 )
+ selfEjtt.refreshPage();
+ // If found, return true.
return new DeploymentUtils().isDeployedAccordingToEmbJopr( type, name );
}
} ).dumpPageOnTimeout(this).throwOnTimeout().waitWithTimeout( intervalMS, retries );
@@ -493,6 +551,7 @@
}
}
+
/**
* Returns true if there's a file of the given name in server's deploy dir;
* false otherwise.
@@ -520,11 +579,14 @@
deleteDirectory(fileToDelete);
}
+ }// isDeployedAccordingToFileSystem()
+
- }
+ }// class DeploymentUtils
- }
+
+
// TODO: Move to utils
/**
Added: trunk/jsfunit/testdata/ear/ear-conf-basic.properties
===================================================================
--- trunk/jsfunit/testdata/ear/ear-conf-basic.properties (rev 0)
+++ trunk/jsfunit/testdata/ear/ear-conf-basic.properties 2009-03-13 21:15:14 UTC (rev 224)
@@ -0,0 +1,14 @@
+
+blackList = false
+cache = false
+domain = my.domain
+excluded = my.excluded
+excludedExport = my.excludedExport
+# ALL, NON_EMPTY
+exportAll = ALL
+importAll = false
+included = my.included
+name = my.name
+parentDomain = my.parentDomain
+parentFirst = false
+version = 10.9.8.7
\ No newline at end of file
15 years, 10 months
EMBJOPR SVN: r223 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 17:10:26 -0400 (Fri, 13 Mar 2009)
New Revision: 223
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Added getClickableByID() to EmbJoprtestToolkit
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 20:56:22 UTC (rev 222)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 21:10:26 UTC (rev 223)
@@ -1045,7 +1045,17 @@
return button;
}
+ /**
+ * Finds element by ID and returns retyped as HTML button.
+ */
+ public ClickableElement getClickableByID( String id ) throws HtmlElementNotFoundException {
+ ClickableElement clickable = (ClickableElement) client.getElement( id );
+ if( null == clickable )
+ throw new HtmlElementNotFoundException("Can't find element with ID: "+clickable);
+ return clickable;
+ }
+
/** Converts java.util.Properties to java.util.Map. */
public static Map<String,String> propertiesAsMap( Properties props )
{
@@ -1062,6 +1072,10 @@
return map;
}
+ /**
+ * Converts properties to Set of Strings.
+ * Substitutes JDK 1.6's Properties::stringPropertyNames().
+ */
public static Set<String> stringPropertyNames( Properties props )
{
Set<String> propNames = new HashSet<String>();
15 years, 10 months
EMBJOPR SVN: r222 - trunk/jsfunit/src/main/webapp/WEB-INF.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 16:56:22 -0400 (Fri, 13 Mar 2009)
New Revision: 222
Modified:
trunk/jsfunit/src/main/webapp/WEB-INF/web.xml
Log:
web.xml in JSFUnit's war: Added org.ajax4jsf.COMPRESS_SCRIPT=false, this prevents the JS files to be shrinked, making JS debugging easier.
Modified: trunk/jsfunit/src/main/webapp/WEB-INF/web.xml
===================================================================
--- trunk/jsfunit/src/main/webapp/WEB-INF/web.xml 2009-03-13 18:20:30 UTC (rev 221)
+++ trunk/jsfunit/src/main/webapp/WEB-INF/web.xml 2009-03-13 20:56:22 UTC (rev 222)
@@ -36,6 +36,12 @@
<param-value>jboss-console</param-value>
</context-param>
+ <!-- It doesn't allow A4J to reformat JavaScript files (makes it impossible to debug) -->
+ <context-param>
+ <param-name>org.ajax4jsf.COMPRESS_SCRIPT</param-name>
+ <param-value>false</param-value>
+ </context-param>
+
<!-- JSFUnit -->
<filter>
<filter-name>JSFUnitFilter</filter-name>
15 years, 10 months
EMBJOPR SVN: r221 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 14:20:30 -0400 (Fri, 13 Mar 2009)
New Revision: 221
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
stringPropertyNames() removed from EmbjoprTestCase
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-13 17:43:46 UTC (rev 220)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-13 18:20:30 UTC (rev 221)
@@ -272,7 +272,7 @@
/** Convert Properties to Map and call fillOutForm(Map). */
public void fillOutForm(Properties props) {
Map<String,String> map = new HashMap<String,String>(props.size());
- for( String propName : props.stringPropertyNames() ) {
+ for( String propName : EmbJoprTestToolkit.stringPropertyNames(props) ) {
map.put(propName, props.getProperty(propName));
}
fillOutForm(map);
@@ -284,7 +284,7 @@
boolean foundNonMatching = false;
StringBuilder sb = new StringBuilder("Non-matching properties: \n");
- for( String propName : props.stringPropertyNames() ) {
+ for( String propName : EmbJoprTestToolkit.stringPropertyNames(props) ) {
HtmlInput input = getConfigFormInput(propName);
String expected = props.getProperty(propName);
String actual = getFormInputValueAsText(input);
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 17:43:46 UTC (rev 220)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 18:20:30 UTC (rev 221)
@@ -1053,10 +1053,7 @@
// Get Properties names.
//Set<String> propnames = props.stringPropertyNames();// JDK 1.6
- Set<String> propNames = new HashSet<String>();
- Enumeration<?> propNamesIter = props.propertyNames();
- while( propNamesIter.hasMoreElements() )
- propNames.add( (String)propNamesIter.nextElement());
+ Set<String> propNames = stringPropertyNames(props);
// Put all properties into the map.
for( String propName : propNames ) {
@@ -1065,8 +1062,18 @@
return map;
}
+ public static Set<String> stringPropertyNames( Properties props )
+ {
+ Set<String> propNames = new HashSet<String>();
+ Enumeration<?> propNamesIter = props.propertyNames();
+ while( propNamesIter.hasMoreElements() )
+ propNames.add( (String)propNamesIter.nextElement());
+ return propNames;
+ }
+
+
// TODO
protected class JMXDeploymentInfo {
15 years, 10 months
EMBJOPR SVN: r220 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: fjuma
Date: 2009-03-13 13:43:46 -0400 (Fri, 13 Mar 2009)
New Revision: 220
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
Log:
Commenting out calls to refreshTreeNode() in the JSFUnit tests to try and prevent the TypeError from occurring during the Hudson runs.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-13 17:22:56 UTC (rev 219)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-13 17:43:46 UTC (rev 220)
@@ -547,7 +547,7 @@
DatasourceType datasourceType,
Map<String, String> metricsMap) throws IOException, EmbJoprTestException {
- refreshTreeNode(DS_NAV_LABEL);
+ //refreshTreeNode(DS_NAV_LABEL);
ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
datasourceTypeArrow.click();
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-03-13 17:22:56 UTC (rev 219)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-13 17:43:46 UTC (rev 220)
@@ -138,7 +138,7 @@
DatasourceType datasourceType,
String tabName) throws IOException, EmbJoprTestException {
- refreshTreeNode(DS_NAV_LABEL);
+ //refreshTreeNode(DS_NAV_LABEL);
ClickableElement datasourceTypeArrow = getNavTreeArrow(datasourceType.getLabel());
datasourceTypeArrow.click();
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-13 17:22:56 UTC (rev 219)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-13 17:43:46 UTC (rev 220)
@@ -97,7 +97,7 @@
*/
protected void deleteDestination(DestinationType destinationType,
String destinationName) throws Exception {
- refreshTreeNode(JMS_NAV_LABEL);
+ //refreshTreeNode(JMS_NAV_LABEL);
clickNavTreeLink(destinationType.getNavLabel());
deleteResource("resourceSummaryForm", destinationName);
}
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-03-13 17:22:56 UTC (rev 219)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ResourceTestBase.java 2009-03-13 17:43:46 UTC (rev 220)
@@ -209,7 +209,7 @@
String resourceSubCategory,
String resourceName,
String tabName) throws IOException, EmbJoprTestException {
- refreshTreeNode(resourceCategory);
+ //refreshTreeNode(resourceCategory);
ClickableElement datasourceTypeArrow = getNavTreeArrow(resourceSubCategory);
datasourceTypeArrow.click();
15 years, 10 months
EMBJOPR SVN: r219 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 13:22:56 -0400 (Fri, 13 Mar 2009)
New Revision: 219
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
stringPropertyNames() removed
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 16:03:15 UTC (rev 218)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 17:22:56 UTC (rev 219)
@@ -1050,7 +1050,16 @@
public static Map<String,String> propertiesAsMap( Properties props )
{
Map<String,String> map = new HashMap<String,String>(props.size());
- for( String propName : props.stringPropertyNames() ) {
+
+ // Get Properties names.
+ //Set<String> propnames = props.stringPropertyNames();// JDK 1.6
+ Set<String> propNames = new HashSet<String>();
+ Enumeration<?> propNamesIter = props.propertyNames();
+ while( propNamesIter.hasMoreElements() )
+ propNames.add( (String)propNamesIter.nextElement());
+
+ // Put all properties into the map.
+ for( String propName : propNames ) {
map.put(propName, props.getProperty(propName));
}
return map;
15 years, 10 months
EMBJOPR SVN: r218 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: util and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 12:03:15 -0400 (Fri, 13 Mar 2009)
New Revision: 218
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
Toolkit update
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-13 15:53:07 UTC (rev 217)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-13 16:03:15 UTC (rev 218)
@@ -40,6 +40,7 @@
import org.jboss.profileservice.spi.NoSuchDeploymentException;
import javax.naming.InitialContext;
import javax.naming.NamingException;
+import org.apache.commons.lang.StringUtils;
import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.managed.api.*;
import org.jboss.metatype.api.values.MetaValue;
@@ -267,7 +268,65 @@
setFormInput(input, properties.get(propertyName));
}
}
-
+
+ /** Convert Properties to Map and call fillOutForm(Map). */
+ public void fillOutForm(Properties props) {
+ Map<String,String> map = new HashMap<String,String>(props.size());
+ for( String propName : props.stringPropertyNames() ) {
+ map.put(propName, props.getProperty(propName));
+ }
+ fillOutForm(map);
+ }
+
+ /** Check if the form is filled according to given Properties. */
+ public void checkForm(Properties props)
+ {
+ boolean foundNonMatching = false;
+ StringBuilder sb = new StringBuilder("Non-matching properties: \n");
+
+ for( String propName : props.stringPropertyNames() ) {
+ HtmlInput input = getConfigFormInput(propName);
+ String expected = props.getProperty(propName);
+ String actual = getFormInputValueAsText(input);
+ if( StringUtils.equals(expected, actual) ) continue;
+ foundNonMatching = true;
+ sb.append( propName+": expected '"+expected+"', found '"+actual+"'\n");
+ }
+ if( foundNonMatching ){
+ fail( sb.toString() );
+ }
+ }
+
+ /** Looks for a form input of given property. */
+ public HtmlInput getConfigFormInput( String propertyName )
+ {
+ HtmlForm form = (HtmlForm)client.getElement("resourceConfigurationForm");
+ HtmlInput input = (HtmlInput)form.getFirstByXPath(".//input[@ondblclick='//"
+ + propertyName + "']");
+
+ assertNotNull("Form input for property '"+ propertyName +"' not found.", input);
+ return input;
+ }
+
+ /** Looks for an enable/disable checkbox corresponding to this input element. */
+ public HtmlCheckBoxInput getCheckBoxForInput( HtmlInput input ){
+ boolean isRadioButton = input.getTypeAttribute().equals("radio");
+ String id = input.getId();
+ String xpath;
+ if(isRadioButton) {
+ xpath = ".//input[@onchange=\"setInputUnset(document.getElementById('"+ id
+ + "'), this.checked);setInputUnset(document.getElementById('"
+ + id.substring(0, id.lastIndexOf(":")) + ":1'), this.checked);\"]";
+ } else {
+ xpath = ".//input[@onchange=\"setInputUnset(document.getElementById('"
+ + id + "'), this.checked);\"]";
+ }
+
+ HtmlCheckBoxInput checkBox = (HtmlCheckBoxInput)input.getEnclosingForm().getFirstByXPath(xpath);
+ return (HtmlCheckBoxInput) checkBox;
+ }
+
+
/**
* Attempt to enable or disable the given input box or "Yes/No" radio button
* that corresponds to the given property name on a resource configuration
@@ -350,6 +409,43 @@
/**
+ * Returns the value of HTML input.
+ * @returns
+ * If the input is marked as unset, returns "unset".
+ * For radios, returns the value of the checked radio.
+ * For others, simply returns value attribute.
+ */
+ public String getFormInputValueAsText(HtmlInput input) {
+
+ HtmlCheckBoxInput checkbox = getCheckBoxForInput(input);
+ if( checkbox.isChecked() )
+ return "unset";
+
+ boolean isRadioButton = input.getTypeAttribute().equals("radio");
+ if(!isRadioButton){
+ return input.getValueAttribute();
+ }
+ else {
+
+ HtmlRadioButtonInput radio = (HtmlRadioButtonInput)input;
+
+ // Multiple choices - find the appropriate radio button.
+ String inputName = input.getNameAttribute();
+ String xPath = ".//input[@name='"+ inputName +"']";
+ List<HtmlInput> radios = (List<HtmlInput>) input.getEnclosingForm().getByXPath(xPath);
+
+ for (HtmlInput htmlInput : radios) {
+ if( htmlInput.isChecked() ){
+ return htmlInput.getValueAttribute();
+ }
+ }
+ return null;
+
+ }
+ }
+
+
+ /**
* Check that the given messages occur on the client side and server side.
*/
public void checkClientAndServerMessages(String expectedClientMsg,
@@ -675,7 +771,7 @@
actualProperties.get(propertyName));
}
}
-
+
/**
* Create a map of property names to property values for a particular
* component.
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 15:53:07 UTC (rev 217)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-13 16:03:15 UTC (rev 218)
@@ -69,10 +69,17 @@
+
+ public String getTestDataDir() {
+ return System.getProperty(AppConstants.SYSPROP_TESTDATA_DIR);
+ }
+
+
+
/**
* Reloads the current page.
*/
- private void refreshPage() throws IOException {
+ public void refreshPage() throws IOException {
((HtmlPage)client.getContentPage()).refresh();
}
@@ -290,7 +297,7 @@
return new TabContentBox(tabContentBox);
}
- public ClickableElement getTab( String label ) throws HtmlElementNotFoundException {
+ public ClickableElement getTabByLabel( String label ) throws HtmlElementNotFoundException {
DomElement element = (DomElement)client.getElement("tabmenu");
String xPath = "ul/li/span[normalize-space(string())='"+label+"'] | ul/li/a[normalize-space(string())='"+label+"']";
@@ -304,17 +311,31 @@
}
+ public ClickableElement getTabByID( String tabID ) throws HtmlElementNotFoundException {
+ ClickableElement element = (ClickableElement)client.getElement(tabID);
+ if( null == element )
+ throw new HtmlElementNotFoundException("Tab with id '"+tabID+"' not found, perhaps disabled?");
+
+ return element;
+ }
+
+ public void clickSummaryTab() throws HtmlElementNotFoundException, IOException{ getTabByID("summaryTab").click(); }
+ public void clickConfigurationTab() throws HtmlElementNotFoundException, IOException{ getTabByID("configurationTab").click(); }
+ public void clickMetricsTab() throws HtmlElementNotFoundException, IOException{ getTabByID("metricsTab").click(); }
+ public void clickControlTab() throws HtmlElementNotFoundException, IOException{ getTabByID("controlTab").click(); }
+ public void clickContentTab() throws HtmlElementNotFoundException, IOException{ getTabByID("contentTab").click(); }
+
/** Returns true if the tab with given label is active (it's content is shown). */
public boolean isTabActive( String label ) throws IOException, HtmlElementNotFoundException {
- StyledElement tabContent = getTab(label);
+ StyledElement tabContent = getTabByLabel(label);
return "span".equals( tabContent.getTagName() )
&& tabContent.getClassAttribute().contains("active");
}
/** Returns true if the tab with given label is disabled (grayed and can't be activated). */
public boolean isTabDisabled( String label ) throws HtmlElementNotFoundException {
- StyledElement tabContent = getTab(label);
+ StyledElement tabContent = getTabByLabel(label);
return "span".equals( tabContent.getTagName() )
&& tabContent.getClassAttribute().contains("disabled");
}
@@ -322,7 +343,7 @@
/** Shotcut - getTab(label).click(); Not necesarilly clicks an anchor. */
public void clickTab( String label ) throws IOException, ActionNotAvailableException, HtmlElementNotFoundException {
- StyledElement tabContent = getTab(label);
+ StyledElement tabContent = getTabByLabel(label);
if( !( tabContent instanceof ClickableElement ) )
throw new ActionNotAvailableException("Tab element <"+tabContent.getTagName()+"> is not clickable: "+label);
@@ -1014,6 +1035,29 @@
}
+ /**
+ * Finds element by ID and returns retyped as HTML button.
+ */
+ public HtmlButtonInput getButtonByID( String id ) throws HtmlElementNotFoundException {
+ HtmlButtonInput button = (HtmlButtonInput) client.getElement( id );
+ if( null == button )
+ throw new HtmlElementNotFoundException("Can't find button with ID: "+button);
+ return button;
+ }
+
+
+ /** Converts java.util.Properties to java.util.Map. */
+ public static Map<String,String> propertiesAsMap( Properties props )
+ {
+ Map<String,String> map = new HashMap<String,String>(props.size());
+ for( String propName : props.stringPropertyNames() ) {
+ map.put(propName, props.getProperty(propName));
+ }
+ return map;
+ }
+
+
+
// TODO
protected class JMXDeploymentInfo {
15 years, 10 months
EMBJOPR SVN: r217 - trunk/core/src/main/webapp/include.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-13 11:53:07 -0400 (Fri, 13 Mar 2009)
New Revision: 217
Modified:
trunk/core/src/main/webapp/include/tabMenu.xhtml
Log:
Added IDs to inactive tabs - to simplify recogning them when inactive.
Modified: trunk/core/src/main/webapp/include/tabMenu.xhtml
===================================================================
--- trunk/core/src/main/webapp/include/tabMenu.xhtml 2009-03-12 20:34:17 UTC (rev 216)
+++ trunk/core/src/main/webapp/include/tabMenu.xhtml 2009-03-13 15:53:07 UTC (rev 217)
@@ -47,7 +47,7 @@
<!-- ACTIVE panel (currently being viewed) -->
<h:panelGroup layout="block" rendered="#{activeTab eq 'summary'}">
<li>
- <span class="active">#{messages['tab.menu.summary']}</span>
+ <span id="summaryTab" class="active">#{messages['tab.menu.summary']}</span>
</li>
</h:panelGroup>
<!-- ENABLED panel (can be viewed) -->
@@ -65,7 +65,7 @@
<!-- ACTIVE panel (currently being viewed) -->
<h:panelGroup layout="block" rendered="#{activeTab eq 'configuration'}">
<li>
- <span class="active">#{messages['tab.menu.configuration']}</span>
+ <span id="configurationTab" class="active">#{messages['tab.menu.configuration']}</span>
</li>
</h:panelGroup>
<!-- ENABLED panel (can be viewed) -->
@@ -80,7 +80,7 @@
<!-- DISABLED panel (can not be viewed) -->
<h:panelGroup layout="block" rendered="#{!navigationAction.enabledTabs.contains('configuration')}">
<li>
- <span class="disabled">#{messages['tab.menu.configuration']}</span>
+ <span id="configurationTab" class="disabled">#{messages['tab.menu.configuration']}</span>
</li>
</h:panelGroup>
</h:panelGroup>
@@ -90,7 +90,7 @@
<!-- ACTIVE panel (currently being viewed) -->
<h:panelGroup layout="block" rendered="#{activeTab eq 'metric'}">
<li>
- <span class="active">#{messages['tab.menu.metrics']}</span>
+ <span id="metricsTab" class="active">#{messages['tab.menu.metrics']}</span>
</li>
</h:panelGroup>
<!-- ENABLED panel (can be viewed) -->
@@ -105,7 +105,7 @@
<!-- DISABLED panel (can not be viewed) -->
<h:panelGroup layout="block" rendered="#{!navigationAction.enabledTabs.contains('metric')}">
<li>
- <span class="disabled">#{messages['tab.menu.metrics']}</span>
+ <span id="metricsTab" class="disabled">#{messages['tab.menu.metrics']}</span>
</li>
</h:panelGroup>
</h:panelGroup>
@@ -115,7 +115,7 @@
<!-- ACTIVE panel (currently being viewed) -->
<h:panelGroup layout="block" rendered="#{activeTab eq 'operation'}">
<li>
- <span class="active">#{messages['tab.menu.control']}</span>
+ <span id="controlTab" class="active">#{messages['tab.menu.control']}</span>
</li>
</h:panelGroup>
<!-- ENABLED panel (can be viewed) -->
@@ -130,7 +130,7 @@
<!-- DISABLED panel (can not be viewed) -->
<h:panelGroup layout="block" rendered="#{!navigationAction.enabledTabs.contains('operation')}">
<li>
- <span class="disabled">#{messages['tab.menu.control']}</span>
+ <span id="controlTab" class="disabled">#{messages['tab.menu.control']}</span>
</li>
</h:panelGroup>
</h:panelGroup>
@@ -140,7 +140,7 @@
<!-- ACTIVE panel (currently being viewed) -->
<h:panelGroup layout="block" rendered="#{activeTab eq 'content'}">
<li>
- <span class="active">#{messages['tab.menu.content']}</span>
+ <span id="contentTab" class="active">#{messages['tab.menu.content']}</span>
</li>
</h:panelGroup>
<!-- ENABLED panel (can be viewed) -->
@@ -155,7 +155,7 @@
<!-- DISABLED panel (can not be viewed) -->
<h:panelGroup layout="block" rendered="#{!navigationAction.enabledTabs.contains('content')}">
<li>
- <span class="disabled">#{messages['tab.menu.content']}</span>
+ <span id="contentTab" class="disabled">#{messages['tab.menu.content']}</span>
</li>
</h:panelGroup>
</h:panelGroup>
15 years, 10 months