[embjopr-commits] EMBJOPR SVN: r360 - in trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit: as5 and 1 other directory.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Mon Apr 27 17:14:35 EDT 2009


Author: ozizka at redhat.com
Date: 2009-04-27 17:14:35 -0400 (Mon, 27 Apr 2009)
New Revision: 360

Modified:
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
   trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
Log:
Added WarTest#testWarHotDeployManyWarsAtOnce()

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-04-27 19:46:16 UTC (rev 359)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/AppConstants.java	2009-04-27 21:14:35 UTC (rev 360)
@@ -147,6 +147,7 @@
     public static final String BASIC_WAR_DUD_RETRY = "hellothere-DUD_RETRY.war";
     public static final String BASIC_WAR_STOPSTART = "hellothere-STOP_START.war";
     public static final String BASIC_WAR_RESTART = "hellothere-RESTART.war";
+    public static final String BASIC_WAR_MULTI_HOTDEPLOY = "hellothere-multi-hotdeploy.war";
 
 		public static final String WAR_UNPACKED = "unpacked-web1.war";
 		public static final String WAR_UNPACKED_ZIP = "unpacked-web1.war.zip";

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java	2009-04-27 19:46:16 UTC (rev 359)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/ApplicationsPageTest.java	2009-04-27 21:14:35 UTC (rev 360)
@@ -85,9 +85,9 @@
 		// Deploy enough apps.
 		// TODO: Create test which would only deploy many apps at once (hotdeploy/embjopr/both?).
 		// TODO: Undeploy.
+		String fileSrcPath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
 		for (int i = 0; i < 8; i++) {
 			// Deploy the same APP multiple times.
-			String fileSrcPath = ejtt.getTestDataDir() +"/ear/"+ BASIC_EAR;
 			String fileDestPath = ejtt.getTempDir() + "/appPagination/appPagination"+i+".ear";
 			FileUtils.copyFile( new File(fileSrcPath), new File(fileDestPath) );
 			ejtt.deployment.deployViaEmbJoprRepeatedly( DeployableTypes.EAR, fileDestPath );

Modified: trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java
===================================================================
--- trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-04-27 19:46:16 UTC (rev 359)
+++ trunk/jsfunit/src/test/java/org/jboss/jopr/jsfunit/as5/WarTest.java	2009-04-27 21:14:35 UTC (rev 360)
@@ -36,6 +36,7 @@
 import javax.faces.application.FacesMessage;
 import junit.framework.Test;
 import junit.framework.TestSuite;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.math.NumberUtils;
 import org.apache.commons.lang.math.RandomUtils;
@@ -57,6 +58,8 @@
 	public static final int DEPLOY_UP_STATE_WAIT_CHECK_INTERVAL = 6000;
 	public static final int DEPLOY_UP_STATE_WAIT_CHECK_RETRIES = 50;
 
+	public static final DeployableTypes APP_TYPE = DeployableTypes.WAR;
+
 	
 
 	/**
@@ -1061,7 +1064,9 @@
 	}
 
 
-
+	/**
+	 * Deploys a WAR and checks that it doesn't appear under the Embedded Web App's node.
+	 */
 	public void testStandaloneWarDoesntAppearInEmbeddedWars() throws IOException, EmbJoprTestException
 	{
 		final String DEPLOYABLE_NAME = BASIC_WAR_10;
@@ -1090,14 +1095,56 @@
 	}
 
 
+	/**
+	 * Hot-deploy several WARs and check that after some time, all of them are deployed and UP.
+	 */
+	public void testWarHotDeployManyWarsAtOnce() throws IOException, EmbJoprTestException
+	{
+		final String TEMP_DEPLOYABLE_NAME = BASIC_WAR_MULTI_HOTDEPLOY;
+		final int APP_COPIES = 25;
 
+		final String fileNamePattern = "multiHotdeploy%d"+APP_TYPE.getExtension();
 
+		try {
 
+			// Hot-deploy several WARs.
+			String fileSrcPath = ejtt.getTestDataDir() +"/"+APP_TYPE.getDataDir()+"/"+ TEMP_DEPLOYABLE_NAME;
+			for (int i = 0; i < APP_COPIES; i++) {
+				String fileDestPath = ejtt.getDeployDir() +"/"+ String.format(fileNamePattern, i);
+				FileUtils.copyFile( new File(fileSrcPath), new File(fileDestPath) );
+			}
 
+			// Wait for them to get displayed and UP.
+			for (int i = 0; i < APP_COPIES; i++) {
+				String deployableName = String.format(fileNamePattern, i);
+				ejtt.deployment.waitActivelyForDeployment(APP_TYPE, deployableName, 5000, 10);
+			}
 
+		}
+		finally {
+			// Undeploy all of them.
+			for (int i = 0; i < APP_COPIES; i++) {
+				String deployableName = String.format(fileNamePattern, i);
+				try {
+					//undeployWAR( deployableName ); // TODO: Generalize
+					ejtt.deployment.undeployViaEmbJopr(APP_TYPE, deployableName);
+				} catch( Exception ex ){
+					log.warn("Cathed an expected exception when trying to undeploy "+deployableName+": "+ex );
+				}
+			}
+		}
+		
+	}// testWarHotDeployManyWarsAtOnce()
 
 
 
+
+
+
+
+
+
+
 	/**
 	 * Deploys WAR.
 	 */




More information about the embjopr-commits mailing list