EMBJOPR SVN: r236 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 14:41:34 -0400 (Tue, 17 Mar 2009)
New Revision: 236
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
EJTT: Fixed waitUntilNodeLoadedByAjax() and waitUntilLoaded() - constants replaced with arguments.
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-17 18:39:30 UTC (rev 235)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-17 18:41:34 UTC (rev 236)
@@ -173,7 +173,7 @@
// If found, return true.
return null != self.findNodeByLabel("Applications");
}
- }).throwOnTimeout().waitWithTimeout(1000, 3);
+ }).throwOnTimeout().waitWithTimeout(msInterval, retries);
}
@@ -193,7 +193,7 @@
// If found, return true.
return null != self.findNodeByLabel(nodeLabel);
}
- }).throwOnTimeout().waitWithTimeout(1000, 3);
+ }).throwOnTimeout().waitWithTimeout(msInterval, retries);
}
catch( Exception ex ){
throw new EmbJoprTestException(
15 years, 10 months
EMBJOPR SVN: r235 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directories.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 14:39:30 -0400 (Tue, 17 Mar 2009)
New Revision: 235
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
EAR tests: Added testEarConfigurationTabCancel()
EJTT: Added waitUntilNodeLoadedByAjax()
EmbJoprTestCase: Added getFormPropertiesValues()
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-17 18:36:17 UTC (rev 234)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-17 18:39:30 UTC (rev 235)
@@ -246,7 +246,38 @@
}
throw new IllegalStateException("Value of '"+metricName+"' not found.");
- }
+ }
+
+
+
+ /**
+ * Takes a Properties object, takes their names
+ * and calls getFormPropertiesValues( Collection<String> ).
+ */
+ public Properties getFormPropertiesValues( Properties propsTemplate ){
+ return getFormPropertiesValues(EmbJoprTestToolkit.stringPropertyNames(propsTemplate));
+ }
+
+ /**
+ * Takes a list of properties to load
+ * and returns a Properties object filled with their values.
+ */
+ public Properties getFormPropertiesValues( Collection<String> propsToLoad ){
+
+ Properties props = new Properties();
+
+ //for( String propName : EmbJoprTestToolkit.stringPropertyNames(propsToLoad) )
+ for( String propName : propsToLoad )
+ {
+ HtmlInput input = getConfigFormInput(propName);
+ String propValue = getFormInputValueAsText(input);
+ props.setProperty(propName, propValue);
+ }
+
+ return props;
+
+ }
+
/**
* fillOutForm sets the values of input boxes and "Yes/No" radio
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-17 18:36:17 UTC (rev 234)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-17 18:39:30 UTC (rev 235)
@@ -403,25 +403,6 @@
// 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 ));
@@ -457,6 +438,57 @@
*
* FAILS because some of the values are read-only. EMBJOPR-96
*/
+ public void testEarConfigurationTabCancel() 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.clickConfigurationTab();
+
+
+ // Load properties (we will use their names).
+ Properties propsToSet = new Properties();
+ String filePath = ejtt.getTestDataDir()+"/ear/"+"ear-conf-basic.properties";
+ propsToSet.load(new FileInputStream( filePath ));
+
+ // Get the current properties.
+ Properties propsOriginal = getFormPropertiesValues( propsToSet );
+
+
+ // Set the configuration options and CANCEL
+ fillOutForm( propsToSet );
+ ejtt.getClickableByID("resourceConfigurationForm:cancelButton").click();
+
+
+ // TODO: We should get back to Conf tab automatically: EMBJOPR-100
+ ejtt.tabMenu.clickConfigurationTab();
+
+ // Now check whether the values are the same as before editing.
+ checkForm( propsOriginal );
+
+ }
+ 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 testEarRedeployment() throws IOException, EmbJoprTestException {
// Deploy the EAR.
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-17 18:36:17 UTC (rev 234)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-17 18:39:30 UTC (rev 235)
@@ -147,7 +147,14 @@
/**
- * Waits
+ * Waits and refreshes the page until ProfileService plugin
+ * has loaded the data for the nav tree.
+ *
+ * The difference from #waitUntilReady() is that this method
+ * waits for JOPR backend data to be ready (server side),
+ * while waitUntilReady() waits until the Tree.Item JavaScript object
+ * is initialized (client side).
+ *
* @param msInterval Milliseconds to wait between tries.
* @param retries Number of retries. Total time = (retries - 1) * msInterval.
* @throws java.lang.Exception Whatever exception is thrown from the isTrue() method.
@@ -171,9 +178,32 @@
+ /**
+ * Waits until the node with given label exists in the nav tree.
+ */
+ public void waitUntilNodeLoadedByAjax( final String nodeLabel, int msInterval, int retries )
+ throws EmbJoprTestException
+ {
+ final NavTree self = this;
+ try {
+ new ActiveConditionChecker( new DescribedCondition("Nav tree contains "+nodeLabel+" node.") {
+ int callsMade = 0;
+ public boolean isTrue() throws HtmlElementNotFoundException {
+ // If found, return true.
+ return null != self.findNodeByLabel(nodeLabel);
+ }
+ }).throwOnTimeout().waitWithTimeout(1000, 3);
+ }
+ catch( Exception ex ){
+ throw new EmbJoprTestException(
+ "Exception when finding node '"+nodeLabel+"': "+ex.getMessage(), ex);
+ }
+ }
+
+
/**
* Finds the nav tree node by it's link label.
*
@@ -262,7 +292,7 @@
}
catch( Exception ex ){
throw new EmbJoprTestException(
- "Caught when checking Tree.Item JS object: "+ex.getMessage(), ex);
+ "Exception when checking Tree.Item JS object: "+ex.getMessage(), ex);
}
}
15 years, 10 months
EMBJOPR SVN: r234 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 14:36:17 -0400 (Tue, 17 Mar 2009)
New Revision: 234
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java
Log:
Added EmbJoprTestException to remaining JMS tests which call getNodeArrow() indirectly
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-17 18:34:16 UTC (rev 233)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/JMSTest.java 2009-03-17 18:36:17 UTC (rev 234)
@@ -32,6 +32,7 @@
import org.jboss.jopr.jsfunit.*;
import javax.management.MBeanServer;
import javax.management.ObjectName;
+import org.jboss.jopr.jsfunit.exceptions.EmbJoprTestException;
import org.jboss.mx.util.MBeanServerLocator;
import org.jboss.deployers.spi.management.KnownComponentTypes;
import org.jboss.metatype.api.values.SimpleValueSupport;
@@ -85,7 +86,7 @@
*/
protected void createDestination(DestinationType destinationType,
String templateName,
- Map<String, MetaValue> propertiesMap) throws IOException {
+ Map<String, MetaValue> propertiesMap) throws IOException, EmbJoprTestException {
expandNavTreeArrow(JMS_NAV_LABEL);
createResource(destinationType.getNavLabel(), templateName, propertiesMap);
}
@@ -106,7 +107,7 @@
* Create a basic queue. Return the mapping of property names to property
* values.
*/
- protected Map<String, MetaValue> createQueue(String queueName) throws IOException {
+ protected Map<String, MetaValue> createQueue(String queueName) throws IOException, EmbJoprTestException {
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(queueName));
@@ -127,7 +128,7 @@
* Create a basic topic. Return the mapping of property names to property
* values.
*/
- protected Map<String, MetaValue> createTopic(String topicName) throws IOException {
+ protected Map<String, MetaValue> createTopic(String topicName) throws IOException, EmbJoprTestException {
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(topicName));
propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
@@ -239,7 +240,7 @@
* Assertion: Verify the ability to handle a missing required value when
* creating a queue. Make sure the appropriate error message occurs.
*/
- public void testCreateQueueMissingRequiredValue() throws IOException {
+ public void testCreateQueueMissingRequiredValue() throws IOException, EmbJoprTestException {
createDestinationMissingRequiredValue(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE);
}
@@ -248,7 +249,7 @@
* Assertion: Verify the ability to handle a missing required value when
* creating a topic. Make sure the appropriate error message occurs.
*/
- public void testCreateTopicMissingRequiredValue() throws IOException {
+ public void testCreateTopicMissingRequiredValue() throws IOException, EmbJoprTestException {
createDestinationMissingRequiredValue(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE);
}
@@ -256,7 +257,7 @@
* Common code for the testCreate*MissingRequiredValue() tests.
*/
private void createDestinationMissingRequiredValue(DestinationType destinationType,
- String destinationTemplate) throws IOException {
+ String destinationTemplate) throws IOException, EmbJoprTestException {
// Leave the JNDI name unset
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("clustered", SimpleValueSupport.wrap(Boolean.TRUE));
@@ -276,7 +277,7 @@
* expected range of values when creating a queue. Make sure the appropriate
* error message occurs.
*/
- public void testCreateQueuePropertyOutOfRange() throws IOException {
+ public void testCreateQueuePropertyOutOfRange() throws IOException, EmbJoprTestException {
createDestinationPropertyOutOfRange(DestinationType.QUEUE,
QUEUE_DEFAULT_TEMPLATE,
"PropertyOutOfRangeQueue");
@@ -288,7 +289,7 @@
* expected range of values when creating a topic. Make sure the appropriate
* error message occurs.
*/
- public void testCreateTopicPropertyOutOfRange() throws IOException {
+ public void testCreateTopicPropertyOutOfRange() throws IOException, EmbJoprTestException {
createDestinationPropertyOutOfRange(DestinationType.TOPIC,
TOPIC_DEFAULT_TEMPLATE,
"PropertyOutOfRangeTopic");
@@ -300,7 +301,7 @@
*/
private void createDestinationPropertyOutOfRange(DestinationType destinationType,
String destinationTemplate,
- String jndiName) throws IOException {
+ String jndiName) throws IOException, EmbJoprTestException {
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
@@ -325,7 +326,7 @@
* invalid type when creating a queue. Make sure the appropriate
* error message occurs.
*/
- public void testCreateQueueInvalidPropertyType() throws IOException {
+ public void testCreateQueueInvalidPropertyType() throws IOException, EmbJoprTestException {
createDestinationInvalidPropertyType(DestinationType.QUEUE,
QUEUE_DEFAULT_TEMPLATE,
"InvalidPropertyTypeQueue");
@@ -337,7 +338,7 @@
* invalid type when creating a topic. Make sure the appropriate
* error message occurs.
*/
- public void testCreateTopicInvalidPropertyType() throws IOException {
+ public void testCreateTopicInvalidPropertyType() throws IOException, EmbJoprTestException {
createDestinationInvalidPropertyType(DestinationType.TOPIC,
TOPIC_DEFAULT_TEMPLATE,
"InvalidPropertyTypeTopic");
@@ -348,7 +349,7 @@
*/
private void createDestinationInvalidPropertyType(DestinationType destinationType,
String destinationTemplate,
- String jndiName) throws IOException {
+ String jndiName) throws IOException, EmbJoprTestException {
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
@@ -373,7 +374,7 @@
* when creating a queue. Make sure the appropriate error message
* occurs.
*/
- public void testCreateQueueDuplicateJNDIName() throws IOException {
+ public void testCreateQueueDuplicateJNDIName() throws IOException, EmbJoprTestException {
createDestinationDuplicateJNDIName(DestinationType.QUEUE, QUEUE_DEFAULT_TEMPLATE,
"TestQueue");
}
@@ -384,7 +385,7 @@
* when creating a queue. Make sure the appropriate error message
* occurs.
*/
- public void testCreateTopicDuplicateJNDIName() throws IOException {
+ public void testCreateTopicDuplicateJNDIName() throws IOException, EmbJoprTestException {
createDestinationDuplicateJNDIName(DestinationType.TOPIC, TOPIC_DEFAULT_TEMPLATE,
"TestTopic");
}
@@ -394,7 +395,7 @@
*/
public void createDestinationDuplicateJNDIName(DestinationType destinationType,
String destinationTemplate,
- String jndiName) throws IOException {
+ String jndiName) throws IOException, EmbJoprTestException {
// The properties we want to configure
Map<String, MetaValue> propertiesMap = new HashMap<String, MetaValue>();
propertiesMap.put("JNDIName", SimpleValueSupport.wrap(jndiName));
15 years, 10 months
EMBJOPR SVN: r233 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 14:34:16 -0400 (Tue, 17 Mar 2009)
New Revision: 233
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:
Added EmbJoprTestException to several tests which call getNodeArrow()
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-17 17:35:33 UTC (rev 232)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/DatasourceTestBase.java 2009-03-17 18:34:16 UTC (rev 233)
@@ -162,7 +162,8 @@
*/
protected abstract void createDatasource(DatasourceType datasourceType,
String datasourceTemplate,
- Map<String, String> propertiesMap) throws IOException;
+ Map<String, String> propertiesMap)
+ throws IOException, EmbJoprTestException;
/**
* Delete the datasource given by datasourceName.
@@ -401,7 +402,7 @@
* Create a basic Local TX Datasource. Return the mapping of property
* names to property values.
*/
- protected Map<String, String> createLocalTXDatasource(String datasourceName) throws IOException {
+ protected Map<String, String> createLocalTXDatasource(String datasourceName) throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", datasourceName);
propertiesMap.put("max-pool-size", "20");
@@ -428,7 +429,7 @@
* Create a basic No TX Datasource. Return the mapping of property
* names to property values.
*/
- protected Map<String, String> createNoTXDatasource(String datasourceName) throws IOException {
+ protected Map<String, String> createNoTXDatasource(String datasourceName) throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", datasourceName);
propertiesMap.put("prefill", "true");
@@ -457,7 +458,7 @@
* Create a basic XA Datasource. Return the mapping of property
* name to property values.
*/
- protected Map<String, String> createXADatasource(String datasourceName) throws IOException {
+ protected Map<String, String> createXADatasource(String datasourceName) throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", datasourceName);
propertiesMap.put("xa-datasource-class", "org.postgresql.xa.PGXADataSource");
@@ -666,7 +667,7 @@
*
* TODO: Check if works for AS 4 .
*/
- public void testCreateDatasourceMissingRequiredValues() throws IOException {
+ public void testCreateDatasourceMissingRequiredValues() throws IOException, EmbJoprTestException {
// Leave jndi-name and connection-url unset
Map<String, String> propertiesMap = new HashMap<String, String>();
@@ -699,7 +700,7 @@
*
* TODO: Check if works for AS 4 .
*/
- public void testCreateDatasourcePropertyOutOfRange() throws IOException {
+ public void testCreateDatasourcePropertyOutOfRange() throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", "InvalidDS");
propertiesMap.put("user-name", "testUser");
@@ -727,7 +728,7 @@
*
* TODO: Check if works for AS 4 .
*/
- public void testCreateDatasourceInvalidPropertyType() throws IOException {
+ public void testCreateDatasourceInvalidPropertyType() throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", "InvalidDS");
propertiesMap.put("min-pool-size", "10");
@@ -755,7 +756,7 @@
* that is the correct type but is not an allowed value for that
* property. An error should occur.
*/
- public void testCreateDatasourcePropertyNotAllowed() throws IOException {
+ public void testCreateDatasourcePropertyNotAllowed() throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", "InvalidDS");
propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
@@ -781,7 +782,7 @@
* Attempt to create a new datasource using a JNDI name that already exists.
* An error should occur.
*/
- public void testCreateDatasourceDuplicateJNDIName() throws IOException {
+ public void testCreateDatasourceDuplicateJNDIName() throws IOException, EmbJoprTestException {
Map<String, String> propertiesMap = new HashMap<String, String>();
propertiesMap.put("jndi-name", "DefaultDS");
propertiesMap.put("driver-class", "org.hsqldb.jdbcDriver");
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-17 17:35:33 UTC (rev 232)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/DatasourceTest.java 2009-03-17 18:34:16 UTC (rev 233)
@@ -65,7 +65,7 @@
@Override
protected void createDatasource(DatasourceType datasourceType,
String datasourceTemplate,
- Map<String, String> propertiesMap) throws IOException {
+ Map<String, String> propertiesMap) throws IOException, EmbJoprTestException {
// Expand the "Datasources" tree node
ClickableElement datasourcesArrow = getNavTreeArrow(DS_NAV_LABEL);
15 years, 10 months
EMBJOPR SVN: r232 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 13:35:33 -0400 (Tue, 17 Mar 2009)
New Revision: 232
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java
Log:
Added ejtt.navTree.waitUntilReady(100, 15) into getNavTreeArrow():
ejtt.navTree.waitUntilReady(100, 15); // Tree.Item can be still loading.
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-17 17:32:55 UTC (rev 231)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/EmbjoprTestCase.java 2009-03-17 17:35:33 UTC (rev 232)
@@ -184,7 +184,10 @@
* (eg. "Web Applications (WAR)", "Datasources", etc.) in the
* navigation tree.
*/
- public ClickableElement getNavTreeArrow(String resourceName) {
+ public ClickableElement getNavTreeArrow(String resourceName) throws EmbJoprTestException {
+
+ ejtt.navTree.waitUntilReady(100, 15); // Tree.Item can be still loading.
+
HtmlAnchor link = getNavTreeLink(resourceName);
String id = link.getIdAttribute();
@@ -198,7 +201,7 @@
/**
* Expand the nav tree arrow for the given resource.
*/
- public void expandNavTreeArrow(String resourceName) throws IOException {
+ public void expandNavTreeArrow(String resourceName) throws IOException, EmbJoprTestException {
// Expand the tree node
ClickableElement resourceArrow = getNavTreeArrow(resourceName);
15 years, 10 months
EMBJOPR SVN: r231 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 13:32:55 -0400 (Tue, 17 Mar 2009)
New Revision: 231
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
NavTree.waitUntilReady() changed
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-17 16:52:23 UTC (rev 230)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-17 17:32:55 UTC (rev 231)
@@ -251,13 +251,19 @@
return true;
}
- public void waitUntilReady( int msInterval, int retries ) throws Exception {
+ public void waitUntilReady( int msInterval, int retries ) throws EmbJoprTestException {
final NavTree self = this;
- new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
- public boolean isTrue() throws Exception {
- return self.isReady();
- }
- }).throwOnTimeout().waitWithTimeout(msInterval, retries);
+ try {
+ new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
+ public boolean isTrue() throws Exception {
+ return self.isReady();
+ }
+ }).throwOnTimeout().waitWithTimeout(msInterval, retries);
+ }
+ catch( Exception ex ){
+ throw new EmbJoprTestException(
+ "Caught when checking Tree.Item JS object: "+ex.getMessage(), ex);
+ }
}
15 years, 10 months
EMBJOPR SVN: r230 - 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-17 12:52:23 -0400 (Tue, 17 Mar 2009)
New Revision: 230
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
NavTree.waitUntilReady() changed
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java 2009-03-17 16:24:33 UTC (rev 229)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java 2009-03-17 16:52:23 UTC (rev 230)
@@ -34,9 +34,9 @@
import org.mozilla.javascript.NativeFunction;
/**
- * Login test. Makes use of default login in EmbjoprTestCase::setUp()
+ * JavaScript tests. Primarily written to try how Rhino JavaScript impl works.
*
- * @author Stan Silvert
+ * @author Ondrej Zizka
*/
public class JavaScriptTest extends EmbjoprTestCase
{
@@ -50,7 +50,7 @@
- public void testTreeItemLoaded() throws IOException
+ public void testTreeItemLoaded() throws IOException, Exception
{
JavaScriptEngine jse = client.getContentPage().getEnclosingWindow().getWebClient().getJavaScriptEngine();
@@ -70,26 +70,30 @@
// JS null object?
jsTreeItem = jse.execute((HtmlPage) client.getContentPage(), "null", "testTreeItemLoaded", 0);
- log.info( jsTreeItem.getClass().getName() );
- log.info( ObjectUtils.toString(jsTreeItem) );
+ if( null == jsTreeItem ){
+ // True.
+ }
+ else {
+ log.info( jsTreeItem.getClass().getName() );
+ log.info( ObjectUtils.toString(jsTreeItem) );
+ }
-
-
-
-
+ // Own active condition waiting
new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
final EmbJoprTestToolkit selfEjtt = ejtt;
public boolean isTrue() throws Exception {
- Object obj = selfEjtt.getJavaScriptObject("Test.Item");
+ Object obj = selfEjtt.getJavaScriptObject("Tree.Item");
if( null == obj ) return false;
//if ( org.mozilla.javascript.NOT_FOUND ) return false;
if( ! (obj instanceof NativeFunction ) ) return false;
return true;
}
- });
-
+ }).throwOnTimeout().waitWithTimeout(100, 20);
+ // Using EJTT method
+ ejtt.navTree.waitUntilReady( 100, 20 );
+
}
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-17 16:24:33 UTC (rev 229)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-17 16:52:23 UTC (rev 230)
@@ -244,20 +244,20 @@
public boolean isReady(){
- Object obj = getJavaScriptObject("Test.Item");
+ Object obj = getJavaScriptObject("Tree.Item");
if( null == obj ) return false;
//if ( org.mozilla.javascript.NOT_FOUND ) return false;
if( ! (obj instanceof NativeFunction ) ) return false;
return true;
}
- public void waitUntilReady(){
+ public void waitUntilReady( int msInterval, int retries ) throws Exception {
final NavTree self = this;
new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
public boolean isTrue() throws Exception {
return self.isReady();
}
- });
+ }).throwOnTimeout().waitWithTimeout(msInterval, retries);
}
15 years, 10 months
EMBJOPR SVN: r229 - 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-17 12:24:33 -0400 (Tue, 17 Mar 2009)
New Revision: 229
Added:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
NavTree.waitUntilReady()
Added: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java (rev 0)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/JavaScriptTest.java 2009-03-17 16:24:33 UTC (rev 229)
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jopr.jsfunit;
+
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
+import java.io.IOException;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.apache.commons.lang.ObjectUtils;
+import org.jboss.jopr.jsfunit.util.ActiveConditionChecker;
+import org.jboss.jopr.jsfunit.util.DescribedCondition;
+import org.jboss.jopr.jsfunit.util.EmbJoprTestToolkit;
+import org.mozilla.javascript.NativeFunction;
+
+/**
+ * Login test. Makes use of default login in EmbjoprTestCase::setUp()
+ *
+ * @author Stan Silvert
+ */
+public class JavaScriptTest extends EmbjoprTestCase
+{
+
+ /**
+ * @return the suite of tests being tested
+ */
+ public static Test suite() {
+ return new TestSuite( JavaScriptTest.class );
+ }
+
+
+
+ public void testTreeItemLoaded() throws IOException
+ {
+ JavaScriptEngine jse = client.getContentPage().getEnclosingWindow().getWebClient().getJavaScriptEngine();
+
+ log.info( "Script is "+ (jse.isScriptRunning()?"":"not") +" running." );
+
+ Object jsTreeItem = jse.execute((HtmlPage) client.getContentPage(), "Tree.Item", "testTreeItemLoaded", 0);
+ log.info( jsTreeItem.getClass().getName() );
+ log.info( ObjectUtils.toString(jsTreeItem) );
+
+ //org.mozilla.javascript.InterpretedFunction
+ // extends NativeFunction implements Script
+ // extends BaseFunction
+ NativeFunction func = (NativeFunction) jsTreeItem;
+ log.info( "Source: " + func.getEncodedSource() );
+
+
+
+ // JS null object?
+ jsTreeItem = jse.execute((HtmlPage) client.getContentPage(), "null", "testTreeItemLoaded", 0);
+ log.info( jsTreeItem.getClass().getName() );
+ log.info( ObjectUtils.toString(jsTreeItem) );
+
+
+
+
+
+
+ new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
+ final EmbJoprTestToolkit selfEjtt = ejtt;
+ public boolean isTrue() throws Exception {
+ Object obj = selfEjtt.getJavaScriptObject("Test.Item");
+ if( null == obj ) return false;
+ //if ( org.mozilla.javascript.NOT_FOUND ) return false;
+ if( ! (obj instanceof NativeFunction ) ) return false;
+ return true;
+ }
+ });
+
+
+ }
+
+
+}
\ No newline at end of file
Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-17 14:17:59 UTC (rev 228)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/MultipleUserLoginTest.java 2009-03-17 16:24:33 UTC (rev 229)
@@ -123,7 +123,7 @@
/**
- * Logs in using several
+ * Logs in using multiple accounts simultaneously.
* @throws java.io.IOException
*
* PASSED.
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-17 14:17:59 UTC (rev 228)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java 2009-03-17 16:24:33 UTC (rev 229)
@@ -8,12 +8,14 @@
import org.jboss.jopr.jsfunit.exceptions.*;
import com.gargoylesoftware.htmlunit.html.*;
+import com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine;
import java.io.IOException;
import java.net.URL;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.jboss.jopr.jsfunit.AppConstants;
import org.jboss.jsfunit.jsfsession.*;
+import org.mozilla.javascript.NativeFunction;
import org.w3c.dom.Element;
@@ -40,10 +42,12 @@
this.selfEjtt = this;
}
+ public EmbJoprTestToolkit getEjtt(){ return this; }
+
/**
* Single nav tree instance.
*
@@ -77,6 +81,20 @@
public String getDeployDir() {
return System.getProperty(AppConstants.SYSPROP_DEPLOY_DIR);
}
+
+ public JavaScriptEngine getJavaScriptEngine(){
+ return client.getContentPage().getEnclosingWindow().getWebClient().getJavaScriptEngine();
+ }
+
+ /**
+ * @returns JavaScript object, as returned by JavaScriptEngine#execute().
+ */
+ public Object getJavaScriptObject( String jsExpression ){
+ return this.getJavaScriptEngine().execute(
+ (HtmlPage) client.getContentPage(),
+ jsExpression,
+ "testTreeItemLoaded", 0);
+ }
/**
@@ -224,10 +242,31 @@
return (ClickableElement)client.getElement(id);
}
+
+ public boolean isReady(){
+ Object obj = getJavaScriptObject("Test.Item");
+ if( null == obj ) return false;
+ //if ( org.mozilla.javascript.NOT_FOUND ) return false;
+ if( ! (obj instanceof NativeFunction ) ) return false;
+ return true;
+ }
+
+ public void waitUntilReady(){
+ final NavTree self = this;
+ new ActiveConditionChecker( new DescribedCondition("Tree.Item JS object is initialized.") {
+ public boolean isTrue() throws Exception {
+ return self.isReady();
+ }
+ });
+ }
+
+
}// class NavTree
+
+
/**
* Represents nav tree node.
* Contains convenience methods to work with the node.
15 years, 10 months
EMBJOPR SVN: r228 - trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-17 10:17:59 -0400 (Tue, 17 Mar 2009)
New Revision: 228
Modified:
trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java
Log:
EAR tests changes
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-16 16:23:04 UTC (rev 227)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/EarTest.java 2009-03-17 14:17:59 UTC (rev 228)
@@ -22,7 +22,6 @@
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.*;
@@ -34,7 +33,6 @@
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.*;
@@ -94,27 +92,30 @@
public void testBasicEarDeployment() throws IOException, EmbJoprTestException
{
- // Deploy the EAR.
- String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
- deployEar( earFilePath );
+ try {
+ // Deploy the EAR.
+ String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+BASIC_EAR;
+ deployEar( earFilePath );
- String expectedMessage = BASIC_EAR + " created successfully";
+ String expectedMessage = BASIC_EAR + " created successfully";
- checkClientAndServerMessages(expectedMessage, expectedMessage, false);
+ checkClientAndServerMessages(expectedMessage, expectedMessage, false);
- // Use JMX to assert that the EAR components really did deploy successfully.
- //id="vfszip:/home/brq/ozizka/JoprEmbedded/jboss-as-5.x/build/output/jboss-5.1.0.Beta1/server/default/deploy/eardeployment.ear/",type=Deployment
- //id="vfszip:/home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/eardeployment.ear",* not found.
- assertTrue("JMX doesn't report EAR as deployed: eardeployment.ear", isEarDeployed(BASIC_EAR));
- assertTrue("JMX doesn't report EJB sessiona.jar as deployed.", isEJBDeployed("sessiona.jar"));
- assertTrue("JMX doesn't report EJB sessionb.jar as deployed.", isEJBDeployed("sessionb.jar"));
+ // Use JMX to assert that the EAR components really did deploy successfully.
+ //id="vfszip:/home/brq/ozizka/JoprEmbedded/jboss-as-5.x/build/output/jboss-5.1.0.Beta1/server/default/deploy/eardeployment.ear/",type=Deployment
+ //id="vfszip:/home/ondra/work/JOPRembedded/embjopr-svn-trunk/jsfunit/target/jboss5x/deploy/eardeployment.ear",* not found.
+ assertTrue("JMX doesn't report EAR as deployed: eardeployment.ear", isEarDeployed(BASIC_EAR));
+ assertTrue("JMX doesn't report EJB sessiona.jar as deployed.", isEJBDeployed("sessiona.jar"));
+ assertTrue("JMX doesn't report EJB sessionb.jar as deployed.", isEJBDeployed("sessionb.jar"));
+ }
+ finally {
+ // Undeploy the EAR.
+ undeployEar( BASIC_EAR );
- // Undeploy the EAR.
- undeployEar( BASIC_EAR );
+ String expectedMessage = "Successfully deleted Enterprise Application (EAR) '"+BASIC_EAR+"'.";
+ assertTrue(client.getPageAsText().contains( expectedMessage ));
+ }
- expectedMessage = "Successfully deleted Enterprise Application (EAR) '"+BASIC_EAR+"'.";
- assertTrue(client.getPageAsText().contains( expectedMessage ));
-
// This assert doesn't work. The JXM view is not consistent with the mananaged view.
// JBAS-XXXX
//assertFalse(isEarDeployed("eardeployment.ear"));
@@ -138,13 +139,17 @@
verify the archive has been deployed successfully.
*/
- public void DISABLEDtestBadEarRedeploy() throws IOException, HtmlElementNotFoundException {
+ public void DISABLEDtestBadEarRedeploy() throws IOException, HtmlElementNotFoundException, ActionNotAvailableException {
- String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+EAR_MALFORMED_APP_FILENAME;
- deployEar(earFilePath);
+ try {
+ String earFilePath = System.getProperty(SYSPROP_TESTDATA_DIR) + "/ear/"+EAR_MALFORMED_APP_FILENAME;
+ deployEar(earFilePath);
- checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
-
+ checkClientAndServerMessages("Failed to create Resource", "Failed to create Resource", true);
+ }
+ finally {
+ undeployEar(BASIC_EAR);
+ }
}
@@ -466,7 +471,7 @@
// Navigate to the Configuration tab
ContentTableRow earRow = ejtt.getDefaultContentTable().getFirstRowContainingLink(BASIC_EAR);
earRow.getLinkByLabel(BASIC_EAR).click();
- ejtt.tabMenu.clickControlTab();
+ ejtt.tabMenu.clickContentTab();
String xPath = ".//table//input[@type='file']";
HtmlFileInput fileInput = ejtt.tabMenu.getTabContentBox().getElement().getFirstByXPath(xPath);
@@ -539,8 +544,9 @@
// Resource Traits
// Check the Path.
- ContentInfoTable infoTable = ejtt.getContentInfoTable(
- ejtt.getTabMenu().getTabContentBox().getTableUnderHeader("Resource Traits").getElement() );
+ HtmlTable tbl = ejtt.getTabMenu().getTabContentBox().
+ getTableUnderHeader("Trait Values").getElement();
+ ContentInfoTable infoTable = ejtt.getContentInfoTable( tbl );
Properties props = infoTable.getProperties();
String path = ejtt.getDeployDir()+"/"+BASIC_EAR;
15 years, 10 months
EMBJOPR SVN: r227 - trunk/core/src/main/webapp/secure.
by embjopr-commits@lists.jboss.org
Author: ozizka(a)redhat.com
Date: 2009-03-16 12:23:04 -0400 (Mon, 16 Mar 2009)
New Revision: 227
Modified:
trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml
Log:
Added ID metricsTraitsTable to resourceInstanceMetrics.xhtml
Modified: trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml
===================================================================
--- trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml 2009-03-13 22:37:38 UTC (rev 226)
+++ trunk/core/src/main/webapp/secure/resourceInstanceMetrics.xhtml 2009-03-16 16:23:04 UTC (rev 227)
@@ -53,6 +53,7 @@
<h2>#{messages['metrics.resourceInstance.traitValues']}</h2>
<rich:dataTable value="#{traitDisplayList}"
+ id="metricsTraitsTable"
var="trait"
columnClasses="standard-traitscolumn" width="100%">
<rich:column rendered="#{trait['a'] ne null}" width="33%">
15 years, 10 months