You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by ul...@apache.org on 2010/03/22 15:18:21 UTC

svn commit: r926095 - in /tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src: main/java/org/apache/tapestry5/test/PageTester.java test/java/org/apache/tapestry5/integration/PageTesterTest.java

Author: uli
Date: Mon Mar 22 14:18:20 2010
New Revision: 926095

URL: http://svn.apache.org/viewvc?rev=926095&view=rev
Log:
TAP5-1054: Not able to pass an empty string as appName to PageTester

Modified:
    tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
    tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java

Modified: tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java?rev=926095&r1=926094&r2=926095&view=diff
==============================================================================
--- tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java (original)
+++ tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/main/java/org/apache/tapestry5/test/PageTester.java Mon Mar 22 14:18:20 2010
@@ -1,10 +1,10 @@
-// Copyright 2006, 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2006, 2007, 2008, 2009, 2010 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -47,7 +47,6 @@ import java.util.Map;
  */
 public class PageTester
 {
-    @SuppressWarnings({ "FieldCanBeLocal" })
     private final Logger logger = LoggerFactory.getLogger(PageTester.class);
 
     private final Registry registry;
@@ -86,10 +85,11 @@ public class PageTester
      *                      there).
      * @param moduleClasses Classes of additional modules to load
      */
+    @SuppressWarnings("unchecked")
     public PageTester(String appPackage, String appName, String contextPath, Class... moduleClasses)
     {
         Defense.notBlank(appPackage, "appPackage");
-        Defense.notBlank(appName, "appName");
+        Defense.notNull(appName, "appName");
         Defense.notBlank(contextPath, "contextPath");
 
         SymbolProvider provider = new SingleKeySymbolProvider(InternalConstants.TAPESTRY_APP_PACKAGE_PARAM, appPackage);
@@ -483,7 +483,7 @@ public class PageTester
             if (e.getName().equalsIgnoreCase(ancestorName))
                 return e;
 
-            e = e.getParent();
+            e = e.getContainer();
         }
 
         throw new RuntimeException(

Modified: tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java?rev=926095&r1=926094&r2=926095&view=diff
==============================================================================
--- tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java (original)
+++ tapestry/tapestry5/branches/5.1.0.x-dev/tapestry-core/src/test/java/org/apache/tapestry5/integration/PageTesterTest.java Mon Mar 22 14:18:20 2010
@@ -1,10 +1,10 @@
-//  Copyright 2008, 2009 The Apache Software Foundation
+// Copyright 2008, 2009 The Apache Software Foundation
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
 // you may not use this file except in compliance with the License.
 // You may obtain a copy of the License at
 //
-//     http://www.apache.org/licenses/LICENSE-2.0
+// http://www.apache.org/licenses/LICENSE-2.0
 //
 // Unless required by applicable law or agreed to in writing, software
 // distributed under the License is distributed on an "AS IS" BASIS,
@@ -22,6 +22,7 @@ import org.apache.tapestry5.test.PageTes
 import org.testng.Assert;
 import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 import java.util.Collections;
@@ -32,24 +33,38 @@ import java.util.Map;
  */
 public class PageTesterTest extends Assert
 {
-    private PageTester tester;
+    private PageTester nonEmptyAppNameTester;
+    
+    private PageTester emptyAppNameTester;
 
     @BeforeClass
     public void setup()
     {
-        tester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
+        nonEmptyAppNameTester = new PageTester(TestConstants.APP2_PACKAGE, TestConstants.APP2_NAME, "src/test/app2");
+        
+        emptyAppNameTester = new PageTester(TestConstants.APP2_PACKAGE, "", "src/test/app2");
     }
 
     @AfterClass
     public void cleanup()
     {
-        tester.shutdown();
+        nonEmptyAppNameTester.shutdown();
 
-        tester = null;
+        nonEmptyAppNameTester = null;
+        
+        emptyAppNameTester.shutdown();
+
+        emptyAppNameTester = null;
+    }
+
+    @DataProvider(name = "testers")
+    public Object[][] getTesters()
+    {
+        return new Object[][] { { nonEmptyAppNameTester }, { emptyAppNameTester } };
     }
 
-    @Test
-    public void on_activate_chain_is_followed()
+    @Test(dataProvider = "testers")
+    public void on_activate_chain_is_followed(PageTester tester)
     {
         Document launchDoc = tester.renderPage("Launch");
 
@@ -63,8 +78,8 @@ public class PageTesterTest extends Asse
         assertEquals(finalDoc.getElementById("page-name").getChildMarkup(), "Final");
     }
 
-    @Test
-    public void application_path_is_defined_as_a_symbol()
+    @Test(dataProvider = "testers")
+    public void application_path_is_defined_as_a_symbol(PageTester tester)
     {
         SymbolSource source = tester.getRegistry().getService(SymbolSource.class);