You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/07/23 19:40:57 UTC

svn commit: r679136 - in /tapestry/tapestry5/trunk: ./ tapestry-core/src/main/java/org/apache/tapestry5/test/ tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/ tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ tapes...

Author: hlship
Date: Wed Jul 23 10:40:56 2008
New Revision: 679136

URL: http://svn.apache.org/viewvc?rev=679136&view=rev
Log:
TAPESTRY-2531: Upgrade EasyMock dependency to latest version, 2.4

Modified:
    tapestry/tapestry5/trunk/pom.xml
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetFactoryTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientPersistentFieldStorageImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentClassResolverImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InheritedBindingTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/LinkFactoryImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/TestBase.java
    tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/RegistryStartupTest.java

Modified: tapestry/tapestry5/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/pom.xml?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/pom.xml (original)
+++ tapestry/tapestry5/trunk/pom.xml Wed Jul 23 10:40:56 2008
@@ -156,7 +156,7 @@
             <dependency>
                 <groupId>org.easymock</groupId>
                 <artifactId>easymock</artifactId>
-                <version>2.3</version>
+                <version>2.4</version>
                 <scope>test</scope>
             </dependency>
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/test/TapestryTestCase.java Wed Jul 23 10:40:56 2008
@@ -801,7 +801,7 @@
             }
         };
 
-        getMocksControl().andAnswer(answer);
+        setAnswer(answer);
     }
 
     protected final void train_requiresDigest(ResourceDigestGenerator generator, String path, boolean requiresDigest)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/corelib/components/LoopTest.java Wed Jul 23 10:40:56 2008
@@ -16,6 +16,7 @@
 
 import org.apache.tapestry5.internal.test.InternalBaseTestCase;
 import org.apache.tapestry5.services.Heartbeat;
+import org.easymock.EasyMock;
 import org.testng.annotations.Test;
 
 import java.util.Arrays;
@@ -32,10 +33,10 @@
         // be "proven" by integration tests.
 
         hb.begin();
-        getMocksControl().times(3);
+        EasyMock.expectLastCall().times(3);
 
         hb.end();
-        getMocksControl().times(3);
+        EasyMock.expectLastCall().times(3);
 
         replay();
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetFactoryTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetFactoryTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClasspathAssetFactoryTest.java Wed Jul 23 10:40:56 2008
@@ -20,6 +20,7 @@
 import org.apache.tapestry5.ioc.internal.util.ClasspathResource;
 import org.apache.tapestry5.services.AssetFactory;
 import org.apache.tapestry5.services.ClasspathAssetAliasManager;
+import org.easymock.EasyMock;
 import org.testng.annotations.Test;
 
 public class ClasspathAssetFactoryTest extends InternalBaseTestCase
@@ -39,7 +40,7 @@
 
         train_toClientURL(aliasManager, "foo/Bar.txt", expectedClientURL);
 
-        getMocksControl().times(2); // Cache of the raw path, not the final path which may be optimized
+        EasyMock.expectLastCall().times(2); // Cache of the raw path, not the final path which may be optimized
 
         replay();
 
@@ -83,7 +84,7 @@
 
         train_toClientURL(aliasManager, "foo/Bar.txt", expectedClientURL);
 
-        getMocksControl().times(2); // 2nd time is the toString() call
+        EasyMock.expectLastCall().times(2); // 2nd time is the toString() call
 
         replay();
 
@@ -114,7 +115,7 @@
 
         train_toClientURL(aliasManager, "foo/Bar.ABC123.txt", expectedClientURL);
 
-        getMocksControl().times(2); // 2nd time is the toString() call
+        EasyMock.expectLastCall().times(2); // 2nd time is the toString() call
 
         replay();
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientPersistentFieldStorageImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientPersistentFieldStorageImplTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientPersistentFieldStorageImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ClientPersistentFieldStorageImplTest.java Wed Jul 23 10:40:56 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -63,7 +63,7 @@
         // Use an IAnswer to capture the value.
 
         link.addParameter(eq(ClientPersistentFieldStorageImpl.PARAMETER_NAME), isA(String.class));
-        getMocksControl().andAnswer(new IAnswer<Void>()
+        setAnswer(new IAnswer<Void>()
         {
             public Void answer() throws Throwable
             {

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentClassResolverImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentClassResolverImplTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentClassResolverImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ComponentClassResolverImplTest.java Wed Jul 23 10:40:56 2008
@@ -54,7 +54,7 @@
 
         logger.info(EasyMock.isA(String.class));
 
-        getMocksControl().atLeastOnce();
+        EasyMock.expectLastCall().atLeastOnce();
 
         return logger;
     }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InheritedBindingTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InheritedBindingTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InheritedBindingTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/InheritedBindingTest.java Wed Jul 23 10:40:56 2008
@@ -1,4 +1,4 @@
-// Copyright 2007 The Apache Software Foundation
+// Copyright 2007, 2008 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.
@@ -208,7 +208,7 @@
         Object parameter = new Object();
 
         inner.set(parameter);
-        getMocksControl().andThrow(exception);
+        setThrowable(exception);
 
         replay();
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/LinkFactoryImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/LinkFactoryImplTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/LinkFactoryImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/LinkFactoryImplTest.java Wed Jul 23 10:40:56 2008
@@ -207,7 +207,7 @@
         IAnswer<Void> createdPageLinkAnswer = newAnswerForCreatedLink(holder);
 
         listener.createdPageLink(isA(Link.class));
-        getMocksControl().andAnswer(createdPageLinkAnswer);
+        setAnswer(createdPageLinkAnswer);
 
         train_getBaseURL(securityManager, page, null);
 
@@ -255,7 +255,7 @@
         IAnswer<Void> createdPageLinkAnswer = newAnswerForCreatedLink(holder);
 
         listener.createdPageLink(isA(Link.class));
-        getMocksControl().andAnswer(createdPageLinkAnswer);
+        setAnswer(createdPageLinkAnswer);
 
         train_getBaseURL(securityManager, page, null);
 
@@ -451,7 +451,7 @@
                                         isA(ComponentEventCallback.class))).andAnswer(triggerEventAnswer);
 
         listener.createdPageLink(isA(Link.class));
-        getMocksControl().andAnswer(createdPageLinkAnswer);
+        setAnswer(createdPageLinkAnswer);
     }
 
     @SuppressWarnings("unchecked")
@@ -469,7 +469,7 @@
                                         isA(ComponentEventCallback.class))).andAnswer(triggerEventAnswer);
 
         listener.createdActionLink(isA(Link.class));
-        getMocksControl().andAnswer(createdPageLinkAnswer);
+        setAnswer(createdPageLinkAnswer);
     }
 
     private IAnswer<Void> newAnswerForCreatedLink(final Holder<Link> holder)
@@ -497,7 +497,7 @@
                 ComponentEventCallback handler = (ComponentEventCallback) EasyMock
                         .getCurrentArguments()[2];
 
-                handler.handleResult(new Object[] { "foo", "bar" });
+                handler.handleResult(new Object[]{"foo", "bar"});
 
                 return true;
             }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/RequestImplTest.java Wed Jul 23 10:40:56 2008
@@ -87,7 +87,7 @@
         UnsupportedEncodingException exception = new UnsupportedEncodingException("Oops.");
 
         sr.setCharacterEncoding(encoding);
-        getMocksControl().andThrow(exception);
+        setThrowable(exception);
 
         replay();
 
@@ -123,8 +123,8 @@
     @DataProvider(name = "xhr_inputs")
     public Object[][] xhr_inputs()
     {
-        return new Object[][] { { null, false }, { "", false }, { "some other value", false },
-                { "XMLHttpRequest", true } };
+        return new Object[][]{{null, false}, {"", false}, {"some other value", false},
+                {"XMLHttpRequest", true}};
     }
 
     @Test

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/TestBase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/TestBase.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/TestBase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry5/ioc/test/TestBase.java Wed Jul 23 10:40:56 2008
@@ -15,6 +15,7 @@
 package org.apache.tapestry5.ioc.test;
 
 import org.easymock.EasyMock;
+import org.easymock.IAnswer;
 import org.easymock.IExpectationSetters;
 import org.easymock.IMocksControl;
 import org.testng.Assert;
@@ -117,6 +118,16 @@
     }
 
     /**
+     * Convienience for {@link EasyMock#expectLastCall()} with {@link IExpectationSetters#andAnswer(org.easymock.IAnswer)}.
+     *
+     * @param answer callback for the most recent method invocation
+     */
+    protected final void setAnswer(IAnswer answer)
+    {
+        EasyMock.expectLastCall().andAnswer(answer);
+    }
+
+    /**
      * Invoked from code that should not be reachable. For example, place a call to unreachable() after invoking a
      * method that is expected to throw an exception.
      */

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/RegistryStartupTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/RegistryStartupTest.java?rev=679136&r1=679135&r2=679136&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/RegistryStartupTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/test/java/org/apache/tapestry5/ioc/internal/services/RegistryStartupTest.java Wed Jul 23 10:40:56 2008
@@ -74,8 +74,7 @@
         getMocksControl().checkOrder(true);
 
         r1.run();
-
-        getMocksControl().andThrow(t);
+        setThrowable(t);
 
         logger.error(ServiceMessages.startupFailure(t));