tapestry-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r421351 - in /tapestry/tapestry4/trunk: ./ tapestry-annotations/ tapestry-annotations/src/java/org/apache/tapestry/annotations/ tapestry-annotations/src/test/org/apache/tapestry/annotations/ tapestry-contrib/ tapestry-framework/ tapestry-fr...
Date Wed, 12 Jul 2006 17:57:13 GMT
Author: jkuhnert
Date: Wed Jul 12 10:57:12 2006
New Revision: 421351

URL: http://svn.apache.org/viewvc?rev=421351&view=rev
Log:
Moved BaseComponentTestCase out into new tapestry-test project, fixed annotation unit tests to use new base class(instead of HivemindTest)

Removed:
    tapestry/tapestry4/trunk/tapestry-framework/src/test/org/apache/tapestry/BaseComponentTestCase.java
Modified:
    tapestry/tapestry4/trunk/pom.xml
    tapestry/tapestry4/trunk/tapestry-annotations/pom.xml
    tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/InitialValueAnnotationWorkerTest.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/MetaAnnotationWorkerTest.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAnnotationUtils.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentClassAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestEventListenerAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectAssetAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java
    tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java
    tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
    tapestry/tapestry4/trunk/tapestry-framework/pom.xml
    tapestry/tapestry4/trunk/tapestry-portlet/pom.xml

Modified: tapestry/tapestry4/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/pom.xml?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/pom.xml (original)
+++ tapestry/tapestry4/trunk/pom.xml Wed Jul 12 10:57:12 2006
@@ -173,6 +173,11 @@
                 <version>2.1</version>
             </dependency>
             <dependency>
+                <groupId>org.apache.tapestry</groupId>
+                <artifactId>tapestry-test</artifactId>
+                <version>4.1.0-SNAPSHOT</version>
+            </dependency>
+            <dependency>
                 <groupId>com.javaforge.tapestry</groupId>
                 <artifactId>tapestry-testng</artifactId>
                 <version>0.0.1</version>

Modified: tapestry/tapestry4/trunk/tapestry-annotations/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/pom.xml?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/pom.xml Wed Jul 12 10:57:12 2006
@@ -14,7 +14,7 @@
     </parent>
     <name>Annotations</name>
     <inceptionYear>2006</inceptionYear>
-    
+
     <dependencies>
         <dependency>
             <groupId>org.apache.tapestry</groupId>
@@ -39,19 +39,28 @@
             <artifactId>easymockclassextension</artifactId>
         </dependency>
         <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <version>3.8.1</version>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>log4j</groupId>
             <artifactId>log4j</artifactId>
             <version>1.2.9</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>4.7</version>
+            <classifier>jdk15</classifier>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.javaforge.tapestry</groupId>
+            <artifactId>tapestry-testng</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-test</artifactId>
+        </dependency>
     </dependencies>
-    
+
     <build>
         <sourceDirectory>src/java</sourceDirectory>
         <resources>
@@ -91,7 +100,7 @@
                 </includes>
             </testResource>
         </testResources>
-        
+
         <plugins>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
@@ -126,7 +135,7 @@
             </plugin>
         </plugins>
     </build>
-    
+
     <reporting>
         <outputDirectory>../target/site/tapestry-annotations</outputDirectory>
         <plugins>
@@ -179,7 +188,9 @@
                         <link>http://jakarta.apache.org/commons/logging/apidocs/</link>
                         <link>http://www.ognl.org/2.6.9/Documentation/javadoc/</link>
                     </links>
-                    <stylesheetfile>${basedir}/../src/site/resources/css/jdstyle.css</stylesheetfile>
+                    <stylesheetfile>
+                        ${basedir}/../src/site/resources/css/jdstyle.css
+                    </stylesheetfile>
                 </configuration>
             </plugin>
         </plugins>

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/java/org/apache/tapestry/annotations/EventListenerAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -47,6 +47,9 @@
     {
         EventListener listener = method.getAnnotation(EventListener.class);
         
+        if (listener == null)
+            return;
+        
         String[] targets = listener.targets();
         String[] elements = listener.elements();
         String formId = listener.submitForm();

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotatedPage.java Wed Jul 12 10:57:12 2006
@@ -160,4 +160,7 @@
     
     @EventListener(events = { "onClick" }, targets = { "email" }, submitForm = "notExisting")
     public void brokenFormListener() { }
+    
+    @InitialValue("literal:5")
+    public abstract int getDefaultPageSize();
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/AnnotationEnhancementWorkerTest.java Wed Jul 12 10:57:12 2006
@@ -28,6 +28,7 @@
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.util.DescribedLocation;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.AnnotationEnhancementWorker}.
@@ -35,12 +36,12 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-
+@Test
 public class AnnotationEnhancementWorkerTest extends BaseAnnotationTestCase
 {
     protected EnhancementOperation newOp(Class baseClass)
     {
-        EnhancementOperation op = (EnhancementOperation) newMock(EnhancementOperation.class);
+        EnhancementOperation op = newMock(EnhancementOperation.class);
 
         expect(op.getBaseClass()).andReturn(baseClass);
 
@@ -73,7 +74,7 @@
         EnhancementOperation op = newOp(AnnotatedPage.class);
         IComponentSpecification spec = newSpec();
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setMethodWorkers(Collections.EMPTY_MAP);
@@ -81,7 +82,7 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testAnnotationMatch()
@@ -99,7 +100,7 @@
 
         methodWorker.performEnhancement(op, spec, m, location);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setMethodWorkers(newMap(InjectObject.class, methodWorker));
@@ -108,12 +109,12 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     protected MethodAnnotationEnhancementWorker newMethodAnnotationEnhancementWorker()
     {
-        return (MethodAnnotationEnhancementWorker) newMock(MethodAnnotationEnhancementWorker.class);
+        return newMock(MethodAnnotationEnhancementWorker.class);
     }
 
     private DescribedLocation newClassLocation(Class baseClass, Class annotationClass)
@@ -141,7 +142,7 @@
 
         methodWorker.performEnhancement(op, spec, m, location);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setMethodWorkers(newMap(InjectObject.class, methodWorker));
@@ -150,14 +151,14 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testAnnotationFailure()
     {
         ClassResolver resolver = new DefaultClassResolver();
 
-        ErrorLog log = newLog();
+        ErrorLog log = newErrorLog();
         Throwable t = new RuntimeException("Woops!");
 
         EnhancementOperation op = newOp(AnnotatedPage.class);
@@ -170,17 +171,15 @@
         Location location = newMethodLocation(AnnotatedPage.class, m, InjectObject.class);
 
         methodWorker.performEnhancement(op, spec, m, location);
-        setThrowable(methodWorker, t);
+        expectLastCall().andThrow(t);
 
-        log
-                .error(
-                        "An error occured processing annotation "
-                                + "@org.apache.tapestry.annotations.InjectObject(value=barney) of "
-                                + "public abstract java.lang.Object org.apache.tapestry.annotations.AnnotatedPage.getInjectedObject(): Woops!",
-                        null,
-                        t);
+        log.error("An error occured processing annotation "
+                + "@org.apache.tapestry.annotations.InjectObject(value=barney) of "
+                + "public abstract java.lang.Object org.apache.tapestry.annotations.AnnotatedPage.getInjectedObject(): Woops!",
+                null,
+                t);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setMethodWorkers(newMap(InjectObject.class, methodWorker));
@@ -190,7 +189,7 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testClassAnnotation()
@@ -200,13 +199,13 @@
         EnhancementOperation op = newOp(DeprecatedBean.class);
         IComponentSpecification spec = newSpec();
 
-        ClassAnnotationEnhancementWorker classWorker = (ClassAnnotationEnhancementWorker) newMock(ClassAnnotationEnhancementWorker.class);
+        ClassAnnotationEnhancementWorker classWorker = newMock(ClassAnnotationEnhancementWorker.class);
 
         DescribedLocation location = newClassLocation(DeprecatedBean.class, Deprecated.class);
 
         classWorker.performEnhancement(op, spec, DeprecatedBean.class, location);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setClassWorkers(newMap(Deprecated.class, classWorker));
@@ -215,32 +214,32 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testClassAnnotationFailure()
     {
         ClassResolver resolver = new DefaultClassResolver();
 
-        ErrorLog log = newLog();
+        ErrorLog log = newErrorLog();
         EnhancementOperation op = newOp(DeprecatedBean.class);
         IComponentSpecification spec = newSpec();
 
-        ClassAnnotationEnhancementWorker classWorker = (ClassAnnotationEnhancementWorker) newMock(ClassAnnotationEnhancementWorker.class);
+        ClassAnnotationEnhancementWorker classWorker = newMock(ClassAnnotationEnhancementWorker.class);
 
         Throwable t = new RuntimeException("Simulated failure.");
 
         DescribedLocation location = newClassLocation(DeprecatedBean.class, Deprecated.class);
 
         classWorker.performEnhancement(op, spec, DeprecatedBean.class, location);
-        setThrowable(classWorker, t);
+        expectLastCall().andThrow(t);
 
         log.error("An error occured processing annotation @java.lang.Deprecated() of "
                 + "class org.apache.tapestry.annotations.DeprecatedBean: Simulated failure.",
                 null,
                 t);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setClassWorkers(newMap(Deprecated.class, classWorker));
@@ -250,7 +249,7 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testClassAnnotationNoMatch()
@@ -258,7 +257,7 @@
         EnhancementOperation op = newOp(DeprecatedBean.class);
         IComponentSpecification spec = newSpec();
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setClassWorkers(Collections.EMPTY_MAP);
@@ -266,7 +265,7 @@
 
         worker.performEnhancement(op, spec);
 
-        verifyControls();
+        verify();
     }
 
     public void testSecondaryEnhancementWorker()
@@ -283,7 +282,7 @@
 
         secondary.peformEnhancement(op, spec, method, classResource);
 
-        replayControls();
+        replay();
 
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setSecondaryAnnotationWorker(secondary);
@@ -291,7 +290,7 @@
 
         worker.performMethodEnhancement(op, spec, method, classResource);
 
-        verifyControls();
+        verify();
     }
 
     public void testSecondaryEnhancementWorkerFailure()
@@ -300,7 +299,7 @@
 
         EnhancementOperation op = newOp();
         IComponentSpecification spec = newSpec();
-        ErrorLog log = newLog();
+        ErrorLog log = newErrorLog();
 
         Method method = findMethod(AnnotatedPage.class, "getPropertyWithInitialValue");
 
@@ -312,7 +311,7 @@
         
         log.error(AnnotationMessages.failureEnhancingMethod(method, cause), null, cause);
         
-        replayControls();
+        replay();
         
         AnnotationEnhancementWorker worker = new AnnotationEnhancementWorker();
         worker.setSecondaryAnnotationWorker(secondary);
@@ -321,11 +320,11 @@
 
         worker.performMethodEnhancement(op, spec, method, classResource);
 
-        verifyControls();
+        verify();
     }
 
     protected SecondaryAnnotationWorker newSecondaryAnnotationWorker()
     {
-        return (SecondaryAnnotationWorker) newMock(SecondaryAnnotationWorker.class);
+        return newMock(SecondaryAnnotationWorker.class);
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/BaseAnnotationTestCase.java Wed Jul 12 10:57:12 2006
@@ -19,8 +19,8 @@
 import org.apache.hivemind.ErrorLog;
 import org.apache.hivemind.Location;
 import org.apache.hivemind.Resource;
-import org.apache.hivemind.test.HiveMindTestCase;
 import org.apache.hivemind.util.ClasspathResource;
+import org.apache.tapestry.BaseComponentTestCase;
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.spec.IComponentSpecification;
 
@@ -29,7 +29,7 @@
  * @since 4.0
  */
 
-public abstract class BaseAnnotationTestCase extends HiveMindTestCase
+public abstract class BaseAnnotationTestCase extends BaseComponentTestCase
 {
 
     protected Method findMethod(Class clazz, String name)
@@ -45,12 +45,12 @@
 
     protected IComponentSpecification newSpec()
     {
-        return (IComponentSpecification) newMock(IComponentSpecification.class);
+        return newMock(IComponentSpecification.class);
     }
 
     protected EnhancementOperation newOp()
     {
-        return (EnhancementOperation) newMock(EnhancementOperation.class);
+        return newMock(EnhancementOperation.class);
     }
 
     protected Resource newResource(Class clazz)
@@ -58,9 +58,9 @@
         return new ClasspathResource(getClassResolver(), clazz.getName().replace('.', '/'));
     }
 
-    protected ErrorLog newLog()
+    protected ErrorLog newErrorLog()
     {
-        return (ErrorLog) newMock(ErrorLog.class);
+        return newMock(ErrorLog.class);
     }
 
     protected Location newMethodLocation(Class baseClass, Method m, Class annotationClass)

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/InitialValueAnnotationWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/InitialValueAnnotationWorkerTest.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/InitialValueAnnotationWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/InitialValueAnnotationWorkerTest.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -22,12 +23,14 @@
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.IPropertySpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.InitialValueAnnotationWorker}.
  * 
  * @author Howard M. Lewis Ship
  */
+@Test
 public class InitialValueAnnotationWorkerTest extends BaseAnnotationTestCase
 {
     public void testCanEnhance()
@@ -47,13 +50,13 @@
         Method method = findMethod(AnnotatedPage.class, "getMapBean");
         Resource resource = newResource(AnnotatedPage.class);
 
-        replayControls();
+        replay();
 
         InitialValueAnnotationWorker worker = new InitialValueAnnotationWorker();
 
         worker.peformEnhancement(op, spec, method, resource);
 
-        verifyControls();
+        verify();
     }
 
     public void testEnhancePersistAnnotationPresent()
@@ -63,13 +66,13 @@
         Method method = findMethod(AnnotatedPage.class, "getPersistentPropertyWithInitialValue");
         Resource resource = newResource(AnnotatedPage.class);
 
-        replayControls();
+        replay();
 
         InitialValueAnnotationWorker worker = new InitialValueAnnotationWorker();
 
         worker.peformEnhancement(op, spec, method, resource);
 
-        verifyControls();
+        verify();
     }
 
     public void testJustInitialValue()
@@ -79,13 +82,13 @@
         Method method = findMethod(AnnotatedPage.class, "getPropertyWithInitialValue");
         Resource resource = newResource(AnnotatedPage.class);
 
-        replayControls();
+        replay();
 
         InitialValueAnnotationWorker worker = new InitialValueAnnotationWorker();
 
         worker.peformEnhancement(op, spec, method, resource);
 
-        verifyControls();
+        verify();
 
         IPropertySpecification ps = spec.getPropertySpecification("propertyWithInitialValue");
 

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/MetaAnnotationWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/MetaAnnotationWorkerTest.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/MetaAnnotationWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/MetaAnnotationWorkerTest.java Wed Jul 12 10:57:12 2006
@@ -14,10 +14,12 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import org.apache.hivemind.ApplicationRuntimeException;
 import org.apache.hivemind.Location;
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Test case for {@link org.apache.tapestry.annotations.MetaAnnotationWorker}.
@@ -25,6 +27,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
+@Test
 public class MetaAnnotationWorkerTest extends BaseAnnotationTestCase
 {
 
@@ -37,11 +40,11 @@
         spec.setProperty("foo", "bar");
         spec.setProperty("biff", "bazz");
 
-        replayControls();
+        replay();
 
         new MetaAnnotationWorker().performEnhancement(op, spec, MetaPage.class, l);
 
-        verifyControls();
+        verify();
     }
 
     public void testMetaInSubclass()
@@ -57,11 +60,11 @@
         // From MetaPageSubclass
         spec.setProperty("in-subclass", "true");
 
-        replayControls();
+        replay();
 
         new MetaAnnotationWorker().performEnhancement(op, spec, MetaPageSubclass.class, l);
 
-        verifyControls();
+        verify();
 
     }
 
@@ -71,7 +74,7 @@
         IComponentSpecification spec = newSpec();
         Location l = newLocation();
 
-        replayControls();
+        replay();
 
         MetaAnnotationWorker worker = new MetaAnnotationWorker();
 
@@ -87,7 +90,7 @@
             assertSame(l, ex.getLocation());
         }
 
-        verifyControls();
+        verify();
 
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/PersistAnnotationWorkerTest.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -21,6 +22,7 @@
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.IPropertySpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.PersistAnnotationWorker}.
@@ -28,6 +30,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
+@Test
 public class PersistAnnotationWorkerTest extends AnnotationEnhancementWorkerTest
 {
     public void testDefaultStrategy()
@@ -37,13 +40,13 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = new ComponentSpecification();
 
-        replayControls();
+        replay();
 
         Method m = findMethod(AnnotatedPage.class, "getPersistentProperty");
 
         new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IPropertySpecification ps = spec.getPropertySpecification("persistentProperty");
 
@@ -60,13 +63,13 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = new ComponentSpecification();
 
-        replayControls();
+        replay();
 
         Method m = findMethod(AnnotatedPage.class, "getClientPersistentProperty");
 
         new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IPropertySpecification ps = spec.getPropertySpecification("clientPersistentProperty");
 
@@ -83,13 +86,13 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = new ComponentSpecification();
 
-        replayControls();
+        replay();
 
         Method m = findMethod(AnnotatedPage.class, "getPersistentPropertyWithInitialValue");
 
         new PersistAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IPropertySpecification ps = spec
                 .getPropertySpecification("persistentPropertyWithInitialValue");

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAnnotationUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAnnotationUtils.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAnnotationUtils.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAnnotationUtils.java Wed Jul 12 10:57:12 2006
@@ -14,9 +14,11 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.ApplicationRuntimeException;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.AnnotationUtils}.
@@ -24,6 +26,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestAnnotationUtils extends BaseAnnotationTestCase
 {
     private String attemptGetPropertyName(Class clazz, String name)

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestAssetAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -23,6 +24,7 @@
 import org.apache.tapestry.spec.IAssetSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.util.DescribedLocation;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.AssetAnnotationWorker}.
@@ -30,23 +32,24 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestAssetAnnotationWorker extends BaseAnnotationTestCase
 {
     public void testSuccess()
     {
         Location l = newLocation();
-        Resource r = (Resource) newMock(Resource.class);
+        Resource r = newMock(Resource.class);
         EnhancementOperation op = newOp();
         IComponentSpecification spec = new ComponentSpecification();
         spec.setSpecificationLocation(r);
 
-        replayControls();
+        replay();
 
         Method m = findMethod(AnnotatedPage.class, "getGlobalStylesheet");
 
         new AssetAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IAssetSpecification as = spec.getAsset("globalStylesheet");
         assertEquals("/style/global.css", as.getPath());

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestBeanAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,11 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertSame;
+
 import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.List;
@@ -25,7 +30,7 @@
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IBeanSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.BeanAnnotationWorker}.
@@ -33,7 +38,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-
+@Test
 public class TestBeanAnnotationWorker extends BaseAnnotationTestCase
 {
     public void testBeanClassSpecified()
@@ -44,11 +49,11 @@
 
         Method m = findMethod(AnnotatedPage.class, "getMapBean");
 
-        replayControls();
+        replay();
 
         new BeanAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IBeanSpecification bs = spec.getBeanSpecification("mapBean");
 
@@ -61,11 +66,9 @@
 
     private EnhancementOperation newOp(String propertyName, Class propertyType)
     {
-        MockControl opc = newControl(EnhancementOperation.class);
-        EnhancementOperation op = (EnhancementOperation) opc.getMock();
-
-        op.getPropertyType(propertyName);
-        opc.setReturnValue(propertyType);
+        EnhancementOperation op = newMock(EnhancementOperation.class);
+        
+        expect(op.getPropertyType(propertyName)).andReturn(propertyType);
 
         return op;
     }
@@ -78,11 +81,11 @@
 
         Method m = findMethod(AnnotatedPage.class, "getHashMapBean");
 
-        replayControls();
+        replay();
 
         new BeanAnnotationWorker().performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
 
         IBeanSpecification bs = spec.getBeanSpecification("hashMapBean");
 
@@ -100,11 +103,11 @@
 
         Method m = findMethod(AnnotatedPage.class, "getBeanWithInitializer");
 
-        replayControls();
+        replay();
 
         new BeanAnnotationWorker().performEnhancement(op, spec, m, null);
 
-        verifyControls();
+        verify();
 
         IBeanSpecification bs = spec.getBeanSpecification("beanWithInitializer");
 
@@ -121,11 +124,11 @@
 
         Method m = findMethod(AnnotatedPage.class, "getRenderLifecycleBean");
 
-        replayControls();
+        replay();
 
         new BeanAnnotationWorker().performEnhancement(op, spec, m, null);
 
-        verifyControls();
+        verify();
 
         IBeanSpecification bs = spec.getBeanSpecification("renderLifecycleBean");
 

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -23,6 +24,7 @@
 import org.apache.tapestry.spec.IBindingSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.IContainedComponent;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.ComponentAnnotationWorker}
@@ -30,6 +32,7 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestComponentAnnotationWorker extends BaseAnnotationTestCase
 {
     private IContainedComponent run(String id, String methodName, Location location)
@@ -38,13 +41,13 @@
 
         EnhancementOperation op = newOp();
 
-        replayControls();
+        replay();
 
         IComponentSpecification spec = new ComponentSpecification();
 
         new ComponentAnnotationWorker().performEnhancement(op, spec, method, location);
 
-        verifyControls();
+        verify();
 
         return spec.getComponent(id);
     }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentClassAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentClassAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentClassAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestComponentClassAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,10 +14,12 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.*;
 import org.apache.hivemind.Location;
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.ComponentClassAnnotationWorker}.
@@ -25,6 +27,7 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestComponentClassAnnotationWorker extends BaseAnnotationTestCase
 {
     private IComponentSpecification attempt(Class baseClass, Location location)
@@ -32,11 +35,11 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = new ComponentSpecification();
 
-        replayControls();
+        replay();
 
         new ComponentClassAnnotationWorker().performEnhancement(op, spec, baseClass, location);
 
-        verifyControls();
+        verify();
 
         return spec;
     }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestEventListenerAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestEventListenerAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestEventListenerAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestEventListenerAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -13,6 +13,11 @@
 // limitations under the License.
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNotNull;
+import static org.testng.AssertJUnit.assertTrue;
+
 import java.lang.reflect.Method;
 import java.util.List;
 
@@ -23,12 +28,14 @@
 import org.apache.tapestry.internal.event.EventBoundListener;
 import org.apache.tapestry.services.impl.ComponentEventInvoker;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 
 /**
  * Tests functionality of {@link TestEventListenerAnnotationWorker}.
  * @author jkuhnert
  */
+@Test
 public class TestEventListenerAnnotationWorker extends BaseAnnotationTestCase
 {
 
@@ -42,7 +49,7 @@
         ComponentEventInvoker invoker = new ComponentEventInvoker();
         worker.setComponentEventInvoker(invoker);
         
-        replayControls();
+        replay();
         
         Method m = findMethod(AnnotatedPage.class, "eventListener");
         
@@ -50,7 +57,7 @@
         assertFalse(worker.canEnhance(findMethod(AnnotatedPage.class, "getPersistentProperty")));
         worker.peformEnhancement(op, spec, m, resource);
         
-        verifyControls();
+        verify();
         
         ComponentEventProperty property = invoker.getComponentEvents("email");
         assertNotNull(property);
@@ -77,14 +84,14 @@
         ComponentEventInvoker invoker = new ComponentEventInvoker();
         worker.setComponentEventInvoker(invoker);
         
-        replayControls();
+        replay();
         
         Method m = findMethod(AnnotatedPage.class, "formListener");
         
         assertTrue(worker.canEnhance(m));
         worker.peformEnhancement(op, spec, m, resource);
         
-        verifyControls();
+        verify();
         
         ComponentEventProperty property = invoker.getComponentEvents("email");
         assertNotNull(property);
@@ -105,7 +112,7 @@
         
         EventListenerAnnotationWorker worker = new EventListenerAnnotationWorker();
         
-        replayControls();
+        replay();
         
         Method m = findMethod(AnnotatedPage.class, "brokenTargetListener");
         
@@ -118,6 +125,25 @@
             assertExceptionSubstring(e, "No targets found for");
         }
         
-        verifyControls();
+        verify();
+    }
+    
+    public void testCanEnhance()
+    {
+        EnhancementOperation op = newOp();
+        IComponentSpecification spec = newSpec();
+        Resource resource = newResource(AnnotatedPage.class);
+        
+        EventListenerAnnotationWorker worker = new EventListenerAnnotationWorker();
+        
+        replay();
+        
+        Method m = findMethod(AnnotatedPage.class, "getDefaultPageSize");
+        
+        assertFalse(worker.canEnhance(m));
+        
+        worker.peformEnhancement(op, spec, m, resource);
+        
+        verify();
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectAssetAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectAssetAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectAssetAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectAssetAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,12 +14,19 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.easymock.EasyMock.*;
+import static org.testng.AssertJUnit.assertNotNull;
+
 import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 
 import org.apache.hivemind.Location;
+import org.apache.hivemind.service.MethodSignature;
+import org.apache.tapestry.IAsset;
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.enhance.InjectAssetWorker;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.InjectAssetAnnotationWorker}.
@@ -27,6 +34,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestInjectAssetAnnotationWorker extends BaseAnnotationTestCase
 {
     public void testDefault()
@@ -41,20 +49,28 @@
         Location l = newLocation();
 
         EnhancementOperation op = newOp();
+        
         IComponentSpecification spec = newSpec();
-
-        InjectAssetWorker delegate = (InjectAssetWorker) newMock(InjectAssetWorker.class);
-
+        
+        InjectAssetWorker delegate = new InjectAssetWorker();
+        
         Method m = findMethod(AnnotatedPage.class, "getStylesheetAsset");
-
-        delegate.injectAsset(op, "stylesheet", "stylesheetAsset", l);
-
-        replayControls();
-
+        
+        expect(op.getPropertyType("stylesheetAsset")).andReturn(IAsset.class);
+        
+        op.claimReadonlyProperty("stylesheetAsset");
+        
+        expect(op.getAccessorMethodName("stylesheetAsset")).andReturn("getStylesheetAsset");
+        
+        op.addMethod(eq(Modifier.PUBLIC), isA(MethodSignature.class), 
+                eq("return getAsset(\"stylesheet\");"), eq(l));
+        
         InjectAssetAnnotationWorker worker = new InjectAssetAnnotationWorker(delegate);
+        
+        replay();
 
         worker.performEnhancement(op, spec, m, l);
 
-        verifyControls();
+        verify();
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectComponentAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,10 +14,13 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.assertNotNull;
+
 import org.apache.hivemind.Location;
 import org.apache.tapestry.enhance.EnhancementOperation;
 import org.apache.tapestry.enhance.InjectComponentWorker;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.InjectComponentAnnotationWorker}.
@@ -25,6 +28,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestInjectComponentAnnotationWorker extends BaseAnnotationTestCase
 {
 
@@ -41,16 +45,18 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = newSpec();
 
-        InjectComponentWorker delegate = (InjectComponentWorker) newMock(InjectComponentWorker.class);
-
+        InjectComponentWorker delegate = org.easymock.classextension.EasyMock.createMock(InjectComponentWorker.class);
+        
         delegate.injectComponent(op, "fred", "fredField", l);
-
-        replayControls();
-
+        
+        replay();
+        org.easymock.classextension.EasyMock.replay(delegate);
+        
         InjectComponentAnnotationWorker worker = new InjectComponentAnnotationWorker(delegate);
 
         worker.performEnhancement(op, spec, findMethod(AnnotatedPage.class, "getFredField"), l);
-
-        verifyControls();
+        
+        verify();
+        org.easymock.classextension.EasyMock.verify(delegate);
     }
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestInjectObjectAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,8 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.assertNotNull;
+
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -21,6 +23,7 @@
 import org.apache.tapestry.enhance.InjectObjectWorker;
 import org.apache.tapestry.services.InjectedValueProvider;
 import org.apache.tapestry.spec.IComponentSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.InjectObjectAnnotationWorker}.
@@ -28,7 +31,7 @@
  * @author Howard M. Lewis Ship
  * @since 4.0
  */
-
+@Test
 public class TestInjectObjectAnnotationWorker extends BaseAnnotationTestCase
 {
     public void testDefault()
@@ -45,28 +48,31 @@
         EnhancementOperation op = newOp();
         IComponentSpecification spec = newSpec();
 
-        InjectObjectWorker delegate = (InjectObjectWorker) newMock(InjectObjectWorker.class);
+        InjectObjectWorker delegate = org.easymock.classextension.EasyMock.createNiceMock(InjectObjectWorker.class);
 
-        InjectedValueProvider provider = (InjectedValueProvider) newMock(InjectedValueProvider.class);
+        InjectedValueProvider provider = newMock(InjectedValueProvider.class);
 
         delegate.setProvider(provider);
-
-        replayControls();
-
+        
+        replay();
+        org.easymock.classextension.EasyMock.replay(delegate);
+        
         InjectObjectAnnotationWorker worker = new InjectObjectAnnotationWorker(delegate);
         worker.setProvider(provider);
-
-        verifyControls();
-
+        
+        verify();
+        org.easymock.classextension.EasyMock.verify(delegate);
+        
         Method m = findMethod(AnnotatedPage.class, "getInjectedObject");
-
+        
         delegate.injectObject(op, "barney", "injectedObject", l);
-
-        replayControls();
-
+        
+        replay();
+        
         worker.performEnhancement(op, spec, m, l);
-
-        verifyControls();
+        
+        verify();
+        org.easymock.classextension.EasyMock.verify(delegate);
     }
 
 }

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestMessageAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,9 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.easymock.EasyMock.*;
+import static org.testng.AssertJUnit.assertEquals;
+
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
@@ -28,9 +31,9 @@
 import org.apache.tapestry.services.ComponentConstructor;
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
-import org.easymock.MockControl;
-import org.easymock.internal.ArrayMatcher;
+import org.testng.annotations.Test;
 
+@Test
 public class TestMessageAnnotationWorker extends BaseAnnotationTestCase
 {
     public void testConvertMethodNameToKeyName()
@@ -78,7 +81,7 @@
 
         Method method = findMethod(AnnotatedPage.class, "voidMessage");
 
-        replayControls();
+        replay();
 
         try
         {
@@ -92,7 +95,7 @@
                     ex.getMessage());
         }
 
-        verifyControls();
+        verify();
 
     }
 
@@ -111,11 +114,11 @@
                 l);
         op.claimReadonlyProperty("likeGetter");
 
-        replayControls();
+        replay();
 
         new MessageAnnotationWorker().performEnhancement(op, spec, method, l);
 
-        verifyControls();
+        verify();
     }
 
     private void attempt(String methodName, String codeBlock)
@@ -128,11 +131,11 @@
 
         op.addMethod(Modifier.PUBLIC, new MethodSignature(method), codeBlock, l);
 
-        replayControls();
+        replay();
 
         new MessageAnnotationWorker().performEnhancement(op, spec, method, l);
 
-        verifyControls();
+        verify();
     }
 
     private Object construct(Class baseClass, String methodName, Messages messages)
@@ -158,68 +161,59 @@
 
     public void testNoParams()
     {
-        MockControl control = newControl(Messages.class);
-        Messages messages = (Messages) control.getMock();
-
-        messages.getMessage("no-params");
-        control.setReturnValue("<no params>");
+        Messages messages = newMock(Messages.class);
+        
+        expect(messages.getMessage("no-params")).andReturn("<no params>");
 
         MessagesTarget mt = (MessagesTarget) construct(MessagesTarget.class, "noParams", messages);
 
-        replayControls();
+        replay();
 
         assertEquals("<no params>", mt.noParams());
 
-        verifyControls();
+        verify();
     }
 
     public void testObjectParam()
     {
-        MockControl control = newControl(Messages.class);
-        Messages messages = (Messages) control.getMock();
+        Messages messages = newMock(Messages.class);
 
         Object[] params = new Object[]
         { "PinkFloyd" };
 
-        messages.format("object-param", params);
-        control.setMatcher(new ArrayMatcher());
-        control.setReturnValue("<object param>");
-
+        expect(messages.format(eq("object-param"), aryEq(params))).andReturn("<object param>");
+        
         MessagesTarget mt = (MessagesTarget) construct(
                 MessagesTarget.class,
                 "objectParam",
                 messages);
 
-        replayControls();
+        replay();
 
         assertEquals("<object param>", mt.objectParam("PinkFloyd"));
 
-        verifyControls();
+        verify();
     }
 
     public void testPrimitiveParam()
     {
-
-        MockControl control = newControl(Messages.class);
-        Messages messages = (Messages) control.getMock();
+        Messages messages = newMock(Messages.class);
 
         Object[] params = new Object[]
         { 451 };
 
-        messages.format("primitive-param", params);
-        control.setMatcher(new ArrayMatcher());
-        control.setReturnValue("<primitive param>");
-
+        expect(messages.format(eq("primitive-param"), aryEq(params))).andReturn("<primitive param>");
+        
         MessagesTarget mt = (MessagesTarget) construct(
                 MessagesTarget.class,
                 "primitiveParam",
                 messages);
 
-        replayControls();
+        replay();
 
         assertEquals("<primitive param>", mt.primitiveParam(451));
 
-        verifyControls();
+        verify();
 
     }
 

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestParameterAnnotationWorker.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,10 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.easymock.EasyMock.expect;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -21,7 +25,7 @@
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.IParameterSpecification;
-import org.easymock.MockControl;
+import org.testng.annotations.Test;
 
 /**
  * Tests for {@link org.apache.tapestry.annotations.ParameterAnnotationWorker}.
@@ -29,6 +33,7 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestParameterAnnotationWorker extends BaseAnnotationTestCase
 {
     private IParameterSpecification attempt(String propertyName, Location location)
@@ -41,20 +46,18 @@
     {
         Method m = findMethod(AnnotatedPage.class, "get"
                 + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1));
-
-        MockControl opc = newControl(EnhancementOperation.class);
-        EnhancementOperation op = (EnhancementOperation) opc.getMock();
-
-        op.getPropertyType(propertyName);
-        opc.setReturnValue(m.getReturnType());
-
+        
+        EnhancementOperation op = newMock(EnhancementOperation.class);
+        
+        expect(op.getPropertyType(propertyName)).andReturn(m.getReturnType());
+        
         IComponentSpecification spec = new ComponentSpecification();
 
-        replayControls();
+        replay();
 
         new ParameterAnnotationWorker().performEnhancement(op, spec, m, location);
 
-        verifyControls();
+        verify();
 
         return spec.getParameter(parameterName);
     }
@@ -65,7 +68,7 @@
 
         IParameterSpecification ps = attempt("simpleParameter", l);
 
-        assertListsEqual(new Object[] {}, ps.getAliasNames().toArray());
+        assertListEquals(new Object[] {}, ps.getAliasNames().toArray());
         assertEquals(true, ps.getCache());
         assertEquals(null, ps.getDefaultValue());
         assertEquals(null, ps.getDescription());
@@ -93,8 +96,7 @@
     {
         IParameterSpecification ps = attempt("aliasedParameter", null);
 
-        assertListsEqual(new String[]
-        { "fred" }, ps.getAliasNames().toArray());
+        assertListEquals(new String[]{ "fred" }, ps.getAliasNames().toArray());
     }
 
     public void testDeprecated()

Modified: tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java (original)
+++ tapestry/tapestry4/trunk/tapestry-annotations/src/test/org/apache/tapestry/annotations/TestSimpleAnnotationWorkers.java Wed Jul 12 10:57:12 2006
@@ -14,6 +14,9 @@
 
 package org.apache.tapestry.annotations;
 
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertSame;
+
 import java.lang.reflect.Method;
 
 import org.apache.hivemind.Location;
@@ -21,6 +24,7 @@
 import org.apache.tapestry.spec.ComponentSpecification;
 import org.apache.tapestry.spec.IComponentSpecification;
 import org.apache.tapestry.spec.InjectSpecification;
+import org.testng.annotations.Test;
 
 /**
  * Test for the "simple" annotation workers, that collect basic information and update the component
@@ -29,6 +33,7 @@
  * @author Howard Lewis Ship
  * @since 4.0
  */
+@Test
 public class TestSimpleAnnotationWorkers extends BaseAnnotationTestCase
 {
     public void testInjectPage()
@@ -108,11 +113,11 @@
 
         Method method = findMethod(AnnotatedPage.class, methodName);
 
-        replayControls();
+        replay();
 
         worker.performEnhancement(op, spec, method, location);
 
-        verifyControls();
+        verify();
 
         return spec;
     }

Modified: tapestry/tapestry4/trunk/tapestry-contrib/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-contrib/pom.xml?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-contrib/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-contrib/pom.xml Wed Jul 12 10:57:12 2006
@@ -55,6 +55,10 @@
             <version>1.2.9</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-test</artifactId>
+        </dependency>
     </dependencies>
     
     <build>

Modified: tapestry/tapestry4/trunk/tapestry-framework/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/pom.xml?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-framework/pom.xml Wed Jul 12 10:57:12 2006
@@ -96,6 +96,10 @@
             <groupId>com.javaforge.tapestry</groupId>
             <artifactId>tapestry-testng</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-test</artifactId>
+        </dependency>
     </dependencies>
 
     <build>

Modified: tapestry/tapestry4/trunk/tapestry-portlet/pom.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-portlet/pom.xml?rev=421351&r1=421350&r2=421351&view=diff
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-portlet/pom.xml (original)
+++ tapestry/tapestry4/trunk/tapestry-portlet/pom.xml Wed Jul 12 10:57:12 2006
@@ -128,6 +128,10 @@
             <artifactId>portlet-api</artifactId>
             <version>1.0</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.tapestry</groupId>
+            <artifactId>tapestry-test</artifactId>
+        </dependency>
     </dependencies>
 
     <reporting>



Mime
View raw message