[seam-commits] Seam SVN: r13731 - branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Sep 9 06:32:03 EDT 2010


Author: jharting
Date: 2010-09-09 06:32:02 -0400 (Thu, 09 Sep 2010)
New Revision: 13731

Modified:
   branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
Log:
Fix hot deployment test for static resources.

Modified: branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java	2010-09-09 08:15:53 UTC (rev 13730)
+++ branches/community/Seam_2_2/src/test/ftest/seamgen/src/main/org/jboss/seam/test/functional/seamgen/HotDeploymentStaticTest.java	2010-09-09 10:32:02 UTC (rev 13731)
@@ -35,23 +35,23 @@
 
 /**
  * This test verifies hot deployment of static resources. It modifies home.xhtml
- * page and verifies that changes are reflected within the running app. All is done
- * within user session to detect if the whole application was restarted or not.
+ * page and verifies that changes are reflected within the running app. All is
+ * done within user session to detect if the whole application was restarted or
+ * not.
  * 
  * @author Jozef Hartinger
  * 
  */
 public class HotDeploymentStaticTest extends SeleniumSeamGenTest
 {
-
+   
    private String newFeature;
-
-   @BeforeClass
-   public void modifyHomePage() throws IOException, InterruptedException
+   
+   public void modifyHomePage() throws InterruptedException
    {
       String homePageLocation = WORKSPACE + "/" + APP_NAME + "/view/home.xhtml";
       newFeature = "Works flawlessly as it is tested by Selenium";
-
+      
       BufferedReader reader = null;
       StringBuilder homePageContentBuilder = new StringBuilder();
       try
@@ -65,16 +65,27 @@
             line = reader.readLine();
          }
       }
+      catch (IOException e)
+      {
+         throw new RuntimeException("Unable to read home page " + homePageLocation);
+      }
       finally
       {
-         reader.close();
+         try
+         {
+            reader.close();
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException("Unable to close home page reader.");
+         }
       }
-
+      
       String homePageContent = homePageContentBuilder.toString();
-
+      
       // add new item into the feature list
-      homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li>" + newFeature + "</li>");
-
+      homePageContent = homePageContent.replaceAll("<li>Internationalization support</li>", "<li>Internationalization support</li>\n<li id=\"newFeature\">" + newFeature + "</li>");
+      
       // write new content
       Writer writer = null;
       try
@@ -83,21 +94,37 @@
          writer.write(homePageContent);
          writer.flush();
       }
+      catch (IOException e)
+      {
+         throw new RuntimeException("Unable write modified home page " + homePageLocation);
+      }
       finally
       {
-         writer.close();
+         try
+         {
+            writer.close();
+         }
+         catch (IOException e)
+         {
+            throw new RuntimeException("Unable to close home page reader.");
+         }
       }
-
+      
       seamGen.deploy();
    }
-
+   
    @Test(dependsOnGroups = { "newProjectGroup" })
-   public void hotDeploymentOfFaceletTemplateTest()
+   public void hotDeploymentOfFaceletTemplateTest() throws InterruptedException
    {
-
+      
       login();
-
-      assertTrue(browser.isTextPresent(newFeature), "New feature not found. Hot deployment failure.");
+      
+      modifyHomePage();
+      
+      waitForAppToDeploy(HOME_PAGE, "id=newFeature");
+      
+      browser.open(HOME_PAGE);
+      assertTrue(browser.isElementPresent("id=newFeature"), "New feature not found. Hot deployment failure.");
       assertTrue(isLoggedIn(), "Session lost. Hot deployment failure.");
    }
 }



More information about the seam-commits mailing list