You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by jk...@apache.org on 2008/01/30 23:17:08 UTC

svn commit: r616923 - in /tapestry/tapestry-test/trunk: pom.xml src/java/org/apache/tapestry/BaseComponentTestCase.java

Author: jkuhnert
Date: Wed Jan 30 14:17:06 2008
New Revision: 616923

URL: http://svn.apache.org/viewvc?rev=616923&view=rev
Log:
Updated version to 4.1.4-SNAPSHOT and added logic to support new BrowserEvent parameters.

Modified:
    tapestry/tapestry-test/trunk/pom.xml
    tapestry/tapestry-test/trunk/src/java/org/apache/tapestry/BaseComponentTestCase.java

Modified: tapestry/tapestry-test/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry-test/trunk/pom.xml?rev=616923&r1=616922&r2=616923&view=diff
==============================================================================
--- tapestry/tapestry-test/trunk/pom.xml (original)
+++ tapestry/tapestry-test/trunk/pom.xml Wed Jan 30 14:17:06 2008
@@ -5,7 +5,7 @@
     <groupId>org.apache.tapestry</groupId>
     <artifactId>tapestry-test</artifactId>
     <packaging>jar</packaging>
-    <version>4.1.3</version>
+    <version>4.1.4-SNAPSHOT</version>
     <description>Tapestry Test Utilities</description>
     <name>Tapestry Test</name>
     <inceptionYear>2006</inceptionYear>
@@ -85,7 +85,7 @@
         <dependency>
             <groupId>org.apache.tapestry</groupId>
             <artifactId>tapestry-framework</artifactId>
-            <version>4.1.3</version>
+            <version>4.1.4-SNAPSHOT</version>
             <scope>provided</scope>
         </dependency>
         <dependency>
@@ -96,7 +96,7 @@
         <dependency>
             <groupId>org.easymock</groupId>
             <artifactId>easymockclassextension</artifactId>
-            <version>2.2.2</version>
+            <version>2.3</version>
         </dependency>
         <dependency>
             <groupId>org.testng</groupId>
@@ -189,7 +189,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-source-plugin</artifactId>
-                <inherited>true</inherited>
                 <executions>
                     <execution>
                         <goals>
@@ -197,6 +196,12 @@
                         </goals>
                     </execution>
                 </executions>
+                <configuration>
+                    <archive>
+                        <compress>true</compress>
+                        <index>true</index>
+                    </archive>
+                </configuration>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>

Modified: tapestry/tapestry-test/trunk/src/java/org/apache/tapestry/BaseComponentTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry-test/trunk/src/java/org/apache/tapestry/BaseComponentTestCase.java?rev=616923&r1=616922&r2=616923&view=diff
==============================================================================
--- tapestry/tapestry-test/trunk/src/java/org/apache/tapestry/BaseComponentTestCase.java (original)
+++ tapestry/tapestry-test/trunk/src/java/org/apache/tapestry/BaseComponentTestCase.java Wed Jan 30 14:17:06 2008
@@ -34,7 +34,7 @@
 /**
  * Base class for testing components, or testing classes that operate on components. Simplifies
  * creating much of the infrastructure around the components.
- *  
+ *
  */
 public class BaseComponentTestCase extends TestBase
 {
@@ -44,7 +44,7 @@
     {
         if (_creator == null)
             _creator = new Creator();
-        
+
         return _creator;
     }
 
@@ -52,7 +52,7 @@
     {
         return new DefaultClassResolver();
     }
-    
+
     protected CharArrayWriter _charArrayWriter;
 
     protected IMarkupWriter newBufferWriter()
@@ -62,15 +62,15 @@
 
         return new MarkupWriterImpl("text/html", pw, new AsciiMarkupFilter());
     }
-    
+
     protected IJSONWriter newBufferJSONWriter()
     {
         _charArrayWriter = new CharArrayWriter();
         PrintWriter pw = new PrintWriter(_charArrayWriter);
-        
+
         return new JSONWriterImpl(pw);
     }
-    
+
     protected void assertBuffer(String expected)
     {
         String actual = _charArrayWriter.toString();
@@ -84,7 +84,7 @@
     {
         assertTrue(t.getMessage().contains(msg));
     }
-    
+
     protected IRequestCycle newCycle()
     {
         return newMock(IRequestCycle.class);
@@ -93,50 +93,50 @@
     protected IRequestCycle newCycle(IMarkupWriter writer)
     {
         IRequestCycle cycle = newMock(IRequestCycle.class);
-        
+
         trainResponseBuilder(cycle, writer);
-        
+
         return cycle;
     }
-    
+
     protected IRequestCycle newCycle(boolean rewinding)
     {
         return newCycle(rewinding, null);
     }
-    
+
     protected IRequestCycle newCycle(boolean rewinding, boolean trainWriter)
     {
         IRequestCycle cycle = newRequestCycle();
-        
+
         trainIsRewinding(cycle, rewinding);
-        
+
         if (trainWriter)
             trainResponseBuilder(cycle, null);
-        
+
         return cycle;
     }
-    
+
     protected IRequestCycle newCycle(boolean rewinding, IMarkupWriter writer)
     {
         IRequestCycle cycle = newRequestCycle();
         checkOrder(cycle, false);
-        
+
         trainIsRewinding(cycle, rewinding);
-        
+
         if (writer != null)
             trainResponseBuilder(cycle, writer);
-        
+
         return cycle;
     }
-    
+
     protected void trainResponseBuilder(IRequestCycle cycle, IMarkupWriter writer)
     {
-        ResponseBuilder builder = 
-            new DefaultResponseBuilder(writer == null ? NullWriter.getSharedInstance() : writer);
-        
+        ResponseBuilder builder =
+                new DefaultResponseBuilder(writer == null ? NullWriter.getSharedInstance() : writer);
+
         expect(cycle.getResponseBuilder()).andReturn(builder);
     }
-    
+
     protected void trainIsRewinding(IRequestCycle cycle, boolean rewinding)
     {
         expect(cycle.isRewinding()).andReturn(rewinding);
@@ -176,7 +176,7 @@
     {
         IBinding binding = newMock(IBinding.class);
         checkOrder(binding, false);
-        
+
         expect(binding.getObject()).andReturn(value);
         return binding;
     }
@@ -185,7 +185,7 @@
     {
         IBinding binding = newBinding();
         checkOrder(binding, false);
-        
+
         trainGetLocation(binding, location);
 
         return binding;
@@ -195,7 +195,7 @@
     {
         IComponent component = newMock(IComponent.class);
         checkOrder(component, false);
-        
+
         expect(component.getExtendedId()).andReturn(extendedId);
         expect(component.getLocation()).andReturn(location);
         return component;
@@ -228,9 +228,9 @@
     {
         IPage page = newMock(IPage.class);
         checkOrder(page, false);
-        
+
         expect(page.getPageName()).andReturn(name).times(count);
-        
+
         return page;
     }
 
@@ -296,7 +296,7 @@
     }
 
     protected IEngine newEngine(ClassResolver resolver)
-    {   
+    {
         return newMock(IEngine.class);
     }
 
@@ -341,13 +341,13 @@
     }
 
     protected void trainGetLink(IEngineService service, IRequestCycle cycle, boolean post,
-            Object parameter, ILink link)
+                                Object parameter, ILink link)
     {
         expect(service.getLink(post, parameter)).andReturn(link);
     }
 
     protected void trainGetLinkCheckIgnoreParameter(IEngineService service, IRequestCycle cycle,
-            boolean post, Object parameter, ILink link)
+                                                    boolean post, Object parameter, ILink link)
     {
         expect(service.getLink(eq(post), anyObject())).andReturn(link);
     }
@@ -381,17 +381,17 @@
     {
         return newMock(Location.class);
     }
-    
+
     protected Location fabricateLocation(int line)
     {
         Location location = newLocation();
         checkOrder(location, false);
-        
+
         expect(location.getLineNumber()).andReturn(line).anyTimes();
-        
+
         return location;
     }
-    
+
     protected void trainEncodeURL(IRequestCycle rc, String URL, String encodedURL)
     {
         expect(rc.encodeURL(URL)).andReturn(encodedURL);
@@ -421,12 +421,12 @@
     {
         expect(writer.getNestedWriter()).andReturn(nested);
     }
-    
+
     protected void trainGetURL(ILink link, String scheme, String anchor, String URL)
     {
         trainGetURL(link, scheme, anchor, URL, 0);
     }
-    
+
     protected void trainGetURL(ILink link, String scheme, String anchor, String URL, int port)
     {
         expect(link.getURL(scheme, null, port, anchor, true)).andReturn(URL);
@@ -476,11 +476,11 @@
     {
         expect(component.getId()).andReturn(id);
     }
-    
+
     protected void trainExtractBrowserEvent(IRequestCycle cycle)
     {
         expect(cycle.getParameter(BrowserEvent.NAME)).andReturn("onClick").anyTimes();
-        
+
         expect(cycle.getParameter(BrowserEvent.TYPE)).andReturn("click");
         expect(cycle.getParameters(BrowserEvent.KEYS)).andReturn(null);
         expect(cycle.getParameter(BrowserEvent.CHAR_CODE)).andReturn(null);
@@ -489,12 +489,13 @@
         expect(cycle.getParameter(BrowserEvent.LAYER_X)).andReturn(null);
         expect(cycle.getParameter(BrowserEvent.LAYER_Y)).andReturn(null);
         expect(cycle.getParameter(BrowserEvent.COMPONENT_ID)).andReturn("element");
+        expect(cycle.getParameter(BrowserEvent.COMPONENT_ID_PATH)).andReturn("element");
 
         expect(cycle.getParameter(BrowserEvent.TARGET + "." + BrowserEvent.TARGET_ATTR_ID)).andReturn("element1");
-        
+
         expect(cycle.getParameter(BrowserEvent.METHOD_ARGUMENTS)).andReturn("[1,2]");
     }
-    
+
     /**
      * Convienience method for invoking {@link #buildFrameworkRegistry(String[])} with only a single
      * file.
@@ -502,7 +503,7 @@
      * @param file
      *          The path to the hivemind xml configuration file.
      * @return The constructed registry.
-     * 
+     *
      * @throws Exception When file can't be found or parsed.
      */
     protected Registry buildFrameworkRegistry(String file)
@@ -510,7 +511,7 @@
     {
         return buildFrameworkRegistry(new String[] { file });
     }
-    
+
     /**
      * Builds a minimal registry, containing only the specified files, plus the master module
      * descriptor (i.e., those visible on the classpath).
@@ -533,12 +534,12 @@
 
             descriptorResources.add(resource);
         }
-        
+
         ModuleDescriptorProvider provider = new XmlModuleDescriptorProvider(resolver, descriptorResources);
 
         return buildFrameworkRegistry(provider);
     }
-    
+
     /**
      * Builds a registry, containing only the modules delivered by the specified
      * {@link org.apache.hivemind.ModuleDescriptorProvider}, plus the master module descriptor
@@ -568,7 +569,7 @@
      * @param l
      *         The resource to build the registry from.
      * @return A constructed {@link Registry} instance.
-     * 
+     *
      * @throws Exception If error building registry.
      */
     protected Registry buildMinimalRegistry(Resource l)
@@ -578,7 +579,7 @@
 
         return builder.constructRegistry(Locale.getDefault());
     }
-    
+
     /**
      * Returns the given file as a {@link Resource} from the classpath. Typically, this is to find
      * files in the same folder as the invoking class.
@@ -596,30 +597,29 @@
 
         return new URLResource(url);
     }
-    
+
     public static boolean assertListEquals(Object[] expected, Object[] actual)
     {
         if (expected == null || actual == null)
             notEquals(expected, actual);
-        
+
         if (!Arrays.equals(expected, actual))
             notEquals(expected, actual);
-        
+
         return true;
     }
-    
+
     public static boolean assertListEquals(Object[] expected, List actual)
     {
         if (expected == null || actual == null)
             notEquals(expected, actual);
-        
+
         Object[] acarr = actual.toArray(new Object[actual.size()]);
         return assertListEquals(expected, acarr);
     }
-    
+
     public static void notEquals(Object expected, Object actual)
     {
-        throw new AssertionError("Parameters don't match, expected: <"
-                + expected + "> actual: <" + actual + ">");
+        throw new AssertionError("Parameters don't match, expected: <" + expected + "> actual: <" + actual + ">");
     }
 }