[embjopr-commits] EMBJOPR SVN: r224 - in trunk/jsfunit: testdata/ear and 1 other directory.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Fri Mar 13 17:15:14 EDT 2009


Author: ozizka at 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




More information about the embjopr-commits mailing list