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 2007/04/21 19:20:06 UTC

svn commit: r531068 [2/7] - in /tapestry/tapestry5: tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/services/ tapestry-core/trunk/src/main/java/org/apache/tapestry/internal/test/ tapestry-core/trunk/src/main/java/org/apache/tapestry/serv...

Modified: tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/main/java/org/apache/tapestry/test/TapestryTestCase.java Sat Apr 21 10:19:58 2007
@@ -100,440 +100,372 @@
 public abstract class TapestryTestCase extends IOCTestCase
 {
 
-    protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
-            Class<? extends Annotation> annotationClass, String... fieldNames)
+    /**
+     * Creates a new markup writer instance (not a markup writer mock). Output can be directed at
+     * the writer, which uses the default (HTML) markup model. The writer's toString() value
+     * represents all the collected markup in the writer.
+     * 
+     * @return
+     */
+    protected final MarkupWriter createMarkupWriter()
     {
-        train_findFieldsWithAnnotation(transformation, annotationClass, Arrays.asList(fieldNames));
+        return new MarkupWriterImpl();
     }
 
-    protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
-            Class<? extends Annotation> annotationClass, List<String> fieldNames)
+    protected final void train_getAliasesForMode(AliasManager manager, String mode,
+            Map<Class, Object> configuration)
     {
-        expect(transformation.findFieldsWithAnnotation(annotationClass)).andReturn(fieldNames);
+        expect(manager.getAliasesForMode(mode)).andReturn(configuration);
     }
 
-    protected final <T extends Annotation> void train_getFieldAnnotation(
-            ClassTransformation transformation, String fieldName, Class<T> annotationClass,
-            T annotation)
+    protected final ApplicationStateCreator mockApplicationStateCreator()
     {
-        expect(transformation.getFieldAnnotation(fieldName, annotationClass)).andReturn(annotation);
+        return newMock(ApplicationStateCreator.class);
     }
 
-    protected final MutableComponentModel newMutableComponentModel()
+    protected final ApplicationStatePersistenceStrategy mockApplicationStatePersistenceStrategy()
     {
-        return newMock(MutableComponentModel.class);
+        return newMock(ApplicationStatePersistenceStrategy.class);
     }
 
-    protected final ClassTransformation newClassTransformation()
+    protected final ApplicationStatePersistenceStrategySource mockApplicationStatePersistenceStrategySource()
     {
-        return newMock(ClassTransformation.class);
+        return newMock(ApplicationStatePersistenceStrategySource.class);
     }
 
-    protected final void train_addInjectedField(ClassTransformation ct, Class type,
-            String suggestedName, Object value, String fieldName)
+    protected final Asset mockAsset()
     {
-        expect(ct.addInjectedField(type, suggestedName, value)).andReturn(fieldName);
+        return newMock(Asset.class);
     }
 
-    protected final void train_findUnclaimedFields(ClassTransformation transformation,
-            String... fieldNames)
+    protected final AssetFactory mockAssetFactory()
     {
-        expect(transformation.findUnclaimedFields()).andReturn(Arrays.asList(fieldNames));
+        return newMock(AssetFactory.class);
     }
 
-    /** Writes a change to a file. */
-    protected final void touch(File f) throws Exception
+    protected final AssetSource mockAssetSource()
     {
-        long startModified = f.lastModified();
-
-        while (true)
-        {
-            OutputStream o = new FileOutputStream(f);
-            o.write(0);
-            o.close();
-
-            long newModified = f.lastModified();
+        return newMock(AssetSource.class);
+    }
 
-            if (newModified != startModified) return;
+    protected final Binding mockBinding()
+    {
+        return newMock(Binding.class);
+    }
 
-            // Sleep 1/20 second and try again
+    protected final BindingFactory mockBindingFactory()
+    {
+        return newMock(BindingFactory.class);
+    }
 
-            sleep(50);
-        }
+    protected final BindingSource mockBindingSource()
+    {
+        return newMock(BindingSource.class);
     }
 
-    protected final ComponentClassResolver newComponentClassResolver()
+    protected final Block mockBlock()
     {
-        return newMock(ComponentClassResolver.class);
+        return newMock(Block.class);
     }
 
-    protected final void train_newBinding(BindingFactory factory, String description,
-            ComponentResources container, ComponentResources component, String expression,
-            Location l, Binding binding)
+    protected final ClasspathAssetAliasManager mockClasspathAssetAliasManager()
     {
-        expect(factory.newBinding(description, container, component, expression, l)).andReturn(
-                binding);
+        return newMock(ClasspathAssetAliasManager.class);
     }
 
-    protected final ComponentResources newComponentResources()
+    protected final ClassTransformation mockClassTransformation()
     {
-        return newMock(ComponentResources.class);
+        return newMock(ClassTransformation.class);
     }
 
-    protected final Binding newBinding()
+    protected final Component mockComponent()
     {
-        return newMock(Binding.class);
+        return newMock(Component.class);
     }
 
-    protected final BindingFactory newBindingFactory()
+    protected final ComponentClassResolver mockComponentClassResolver()
     {
-        return newMock(BindingFactory.class);
+        return newMock(ComponentClassResolver.class);
     }
 
-    protected final ComponentModel newComponentModel()
+    protected final ComponentEventHandler mockComponentEventHandler()
     {
-        return newMock(ComponentModel.class);
+        return newMock(ComponentEventHandler.class);
     }
 
-    protected final void train_addMethod(ClassTransformation transformation,
-            MethodSignature signature, String... body)
+    protected final ComponentModel mockComponentModel()
     {
-        transformation.addMethod(eq(signature), codeEq(join(body)));
+        return newMock(ComponentModel.class);
     }
 
-    protected final void train_newMemberName(ClassTransformation transformation, String suggested,
-            String name)
+    protected final ComponentResources mockComponentResources()
     {
-        expect(transformation.newMemberName(suggested)).andReturn(name);
+        return newMock(ComponentResources.class);
     }
 
-    protected final void train_newMemberName(ClassTransformation transformation, String prefix,
-            String baseName, String name)
+    protected final Context mockContext()
     {
-        expect(transformation.newMemberName(prefix, baseName)).andReturn(name);
+        return newMock(Context.class);
     }
 
-    protected final void train_extendMethod(ClassTransformation transformation,
-            MethodSignature signature, String... body)
+    protected final Environment mockEnvironment()
     {
-        transformation.extendMethod(eq(signature), codeEq(join(body)));
+        return newMock(Environment.class);
     }
 
-    protected final void train_extendConstructor(ClassTransformation transformation, String... body)
+    protected final Field mockField()
     {
-        transformation.extendConstructor(codeEq(join(body)));
+        return newMock(Field.class);
     }
 
-    protected final void train_getResourcesFieldName(ClassTransformation transformation, String name)
+    protected final FieldValidator mockFieldValidator()
     {
-        expect(transformation.getResourcesFieldName()).andReturn(name).atLeastOnce();
+        return newMock(FieldValidator.class);
     }
 
-    protected final void train_addField(ClassTransformation transformation, int modifiers,
-            String type, String suggestedName, String actualName)
+    protected FieldValidatorSource mockFieldValidatorSource()
     {
-        expect(transformation.addField(modifiers, type, suggestedName)).andReturn(actualName);
+        return newMock(FieldValidatorSource.class);
     }
 
-    protected final void train_getFieldType(ClassTransformation transformation, String fieldName,
-            String type)
+    protected final Field mockFieldWithLabel(String label)
     {
-        expect(transformation.getFieldType(fieldName)).andReturn(type).atLeastOnce();
+        Field field = mockField();
 
+        train_getLabel(field, label);
+
+        return field;
     }
 
-    protected final void train_name(Parameter parameter, String name)
+    protected final Heartbeat mockHeartbeat()
     {
-        expect(parameter.name()).andReturn(name).atLeastOnce();
+        return newMock(Heartbeat.class);
     }
 
-    protected final void train_findMethodsWithAnnotation(ClassTransformation tf,
-            Class<? extends Annotation> annotationType, List<MethodSignature> sigs)
+    protected final HttpServletRequest mockHttpServletRequest()
     {
-        expect(tf.findMethodsWithAnnotation(annotationType)).andReturn(sigs);
+        return newMock(HttpServletRequest.class);
     }
 
-    protected final Request newRequest()
+    protected final HttpServletResponse mockHttpServletResponse()
     {
-        return newMock(Request.class);
+        return newMock(HttpServletResponse.class);
     }
 
-    protected final void train_provideInjection(InjectionProvider provider, String fieldName,
-            String fieldType, ServiceLocator locator, ClassTransformation transformation,
-            MutableComponentModel model, boolean result)
+    protected final HttpSession mockHttpSession()
     {
-        expect(provider.provideInjection(fieldName, fieldType, locator, transformation, model))
-                .andReturn(result);
+        return newMock(HttpSession.class);
     }
 
-    protected final void train_toClass(ClassTransformation transformation, String type,
-            Class classForType)
+    protected final Inject mockInject()
     {
-        expect(transformation.toClass(type)).andReturn(classForType);
+        return newMock(Inject.class);
     }
 
-    protected final ParameterModel newParameterModel()
+    protected final Link mockLink()
     {
-        return newMock(ParameterModel.class);
+        return newMock(Link.class);
     }
 
-    protected final void train_getComponentClassName(ComponentModel model, String className)
+    protected final MarkupWriter mockMarkupWriter()
     {
-        expect(model.getComponentClassName()).andReturn(className).atLeastOnce();
+        return newMock(MarkupWriter.class);
     }
 
-    protected final void train_isRequired(ParameterModel model, boolean isRequired)
+    protected final MutableComponentModel mockMutableComponentModel()
     {
-        expect(model.isRequired()).andReturn(isRequired);
+        return newMock(MutableComponentModel.class);
     }
 
-    protected final void train_getParameterModel(ComponentModel model, String parameterName,
-            ParameterModel parameterModel)
+    protected final ParameterModel mockParameterModel()
     {
-        expect(model.getParameterModel(parameterName)).andReturn(parameterModel);
+        return newMock(ParameterModel.class);
     }
 
-    protected final void train_getParameterNames(ComponentModel model, String... names)
+    protected final Path mockPath()
     {
-        expect(model.getParameterNames()).andReturn(Arrays.asList(names));
+        return newMock(Path.class);
     }
 
-    protected final void train_isInvariant(Binding binding, boolean isInvariant)
+    protected final PropertyConduit mockPropertyConduit()
     {
-        expect(binding.isInvariant()).andReturn(isInvariant);
+        return newMock(PropertyConduit.class);
     }
 
-    protected final MarkupWriter newMarkupWriter()
+    protected final PropertyModel mockPropertyEditModel()
     {
-        return newMock(MarkupWriter.class);
+        return newMock(PropertyModel.class);
     }
 
-    protected final void train_get(Binding binding, Object value)
+    protected final Request mockRequest()
     {
-        expect(binding.get()).andReturn(value);
+        return newMock(Request.class);
     }
 
-    protected final void train_encodeURL(Response response, String inputURL, String outputURL)
+    protected final RequestHandler mockRequestHandler()
     {
-        expect(response.encodeURL(inputURL)).andReturn(outputURL);
+        return newMock(RequestHandler.class);
     }
 
-    protected final Response newResponse()
+    protected final ResourceDigestGenerator mockResourceDigestGenerator()
     {
-        return newMock(Response.class);
+        return newMock(ResourceDigestGenerator.class);
     }
 
-    protected void train_getAttribute(HttpSession session, String attributeName, Object value)
+    protected final Response mockResponse()
     {
-        expect(session.getAttribute(attributeName)).andReturn(value);
+        return newMock(Response.class);
     }
 
-    protected final HttpServletRequest newHttpServletRequest()
+    protected final Session mockSession()
     {
-        return newMock(HttpServletRequest.class);
+        return newMock(Session.class);
     }
 
-    protected final void train_getSession(HttpServletRequest request, boolean create,
-            HttpSession session)
+    protected final Translator mockTranslator()
     {
-        expect(request.getSession(create)).andReturn(session);
+        return newMock(Translator.class);
     }
 
-    protected final HttpServletResponse newHttpServletResponse()
+    protected final ValidationConstraintGenerator mockValidationConstraintGenerator()
     {
-        return newMock(HttpServletResponse.class);
+        return newMock(ValidationConstraintGenerator.class);
     }
 
-    protected final void train_setContentLength(HttpServletResponse response, int length)
+    protected final ValidationMessagesSource mockValidationMessagesSource()
     {
-        response.setContentLength(length);
+        return newMock(ValidationMessagesSource.class);
     }
 
-    protected final void train_setDateHeader(HttpServletResponse response, String headerName,
-            long date)
+    protected final ValidationTracker mockValidationTracker()
     {
-        response.setDateHeader(headerName, date);
+        return newMock(ValidationTracker.class);
     }
 
-    protected final void train_setContentType(HttpServletResponse response, String contentType)
+    protected final Validator mockValidator()
     {
-        response.setContentType(contentType);
+        return newMock(Validator.class);
     }
 
-    protected final void train_getOutputStream(HttpServletResponse response,
-            ServletOutputStream stream)
+    /** Writes a change to a file. */
+    protected final void touch(File f) throws Exception
     {
-        try
-        {
-            expect(response.getOutputStream()).andReturn(stream);
-        }
-        catch (IOException e)
+        long startModified = f.lastModified();
+
+        while (true)
         {
-            fail(e.getMessage(), e);
+            OutputStream o = new FileOutputStream(f);
+            o.write(0);
+            o.close();
+
+            long newModified = f.lastModified();
+
+            if (newModified != startModified) return;
+
+            // Sleep 1/20 second and try again
+
+            sleep(50);
         }
     }
 
-    protected final HttpSession newHttpSession()
+    protected final void train_addField(ClassTransformation transformation, int modifiers,
+            String type, String suggestedName, String actualName)
     {
-        return newMock(HttpSession.class);
+        expect(transformation.addField(modifiers, type, suggestedName)).andReturn(actualName);
     }
 
-    protected final void train_getAttributeNames(Session session, String prefix, String... names)
+    protected final void train_addInjectedField(ClassTransformation ct, Class type,
+            String suggestedName, Object value, String fieldName)
     {
-        expect(session.getAttributeNames(prefix)).andReturn(Arrays.asList(names));
+        expect(ct.addInjectedField(type, suggestedName, value)).andReturn(fieldName);
     }
 
-    protected final void train_getAttribute(Session session, String name, Object attribute)
+    protected final void train_addMethod(ClassTransformation transformation,
+            MethodSignature signature, String... body)
     {
-        expect(session.getAttribute(name)).andReturn(attribute);
+        transformation.addMethod(eq(signature), codeEq(join(body)));
     }
 
-    protected final Session newSession()
+    protected final void train_buildConstraints(ValidationConstraintGenerator generator,
+            Class propertyType, AnnotationProvider provider, String... constraints)
     {
-        return newMock(Session.class);
+        expect(generator.buildConstraints(propertyType, provider)).andReturn(
+                Arrays.asList(constraints));
     }
 
-    protected final void train_getSession(Request request, boolean create, Session session)
+    protected final <T> void train_create(ApplicationStateCreator<T> creator, T aso)
     {
-        expect(request.getSession(create)).andReturn(session);
+        expect(creator.create()).andReturn(aso);
     }
 
-    protected final void train_encodeRedirectURL(Response response, String URI, String encoded)
+    protected final void train_createAsset(AssetFactory factory, Resource resource, Asset asset)
     {
-        expect(response.encodeRedirectURL(URI)).andReturn(encoded);
+        expect(factory.createAsset(resource)).andReturn(asset);
     }
 
-    protected final void train_getPage(ComponentResources resources, Component page)
+    protected final void train_createValidator(FieldValidatorSource source, Field field,
+            String validatorType, String constraintValue, String overrideId,
+            Messages overrideMessages, Locale locale, FieldValidator result)
     {
-        expect(resources.getPage()).andReturn(page).atLeastOnce();
+        expect(
+                source.createValidator(
+                        field,
+                        validatorType,
+                        constraintValue,
+                        overrideId,
+                        overrideMessages,
+                        locale)).andReturn(result);
     }
 
-    protected final void train_getCompleteId(ComponentResources resources, String completeId)
+    protected final void train_encodeRedirectURL(Response response, String URI, String encoded)
     {
-        expect(resources.getCompleteId()).andReturn(completeId).atLeastOnce();
+        expect(response.encodeRedirectURL(URI)).andReturn(encoded);
     }
 
-    protected final void train_getComponentResources(Component component,
-            ComponentResources resources)
+    protected final void train_encodeURL(Response response, String inputURL, String outputURL)
     {
-        expect(component.getComponentResources()).andReturn(resources).atLeastOnce();
+        expect(response.encodeURL(inputURL)).andReturn(outputURL);
     }
 
-    protected final void train_getContainer(ComponentResources resources, Component container)
+    protected final <T> void train_exists(ApplicationStatePersistenceStrategy strategy,
+            Class<T> asoClass, boolean exists)
     {
-        expect(resources.getContainer()).andReturn(container).atLeastOnce();
+        expect(strategy.exists(asoClass)).andReturn(exists);
     }
 
-    protected final RequestHandler newRequestHandler()
+    protected final void train_extendConstructor(ClassTransformation transformation, String... body)
     {
-        return newMock(RequestHandler.class);
+        transformation.extendConstructor(codeEq(join(body)));
     }
 
-    protected final void train_service(RequestHandler handler, Request request, Response response,
-            boolean result) throws IOException
-    {
-        expect(handler.service(request, response)).andReturn(result);
-    }
-
-    protected final void train_getLocale(Request request, Locale locale)
-    {
-        expect(request.getLocale()).andReturn(locale).atLeastOnce();
-    }
-
-    protected final void train_getParentModel(ComponentModel model, ComponentModel parentModel)
-    {
-        expect(model.getParentModel()).andReturn(parentModel).atLeastOnce();
-    }
-
-    protected final void train_getBaseResource(ComponentModel model, Resource resource)
-    {
-        expect(model.getBaseResource()).andReturn(resource).atLeastOnce();
-    }
-
-    protected final Asset newAsset()
-    {
-        return newMock(Asset.class);
-    }
-
-    protected final void train_createAsset(AssetFactory factory, Resource resource, Asset asset)
-    {
-        expect(factory.createAsset(resource)).andReturn(asset);
-    }
-
-    protected final void train_getRootResource(AssetFactory factory, Resource rootResource)
-    {
-        expect(factory.getRootResource()).andReturn(rootResource);
-    }
-
-    protected final AssetFactory newAssetFactory()
-    {
-        return newMock(AssetFactory.class);
-    }
-
-    protected final Context newContext()
-    {
-        return newMock(Context.class);
-    }
-
-    protected final void train_getClassName(ClassTransformation transformation, String className)
-    {
-        expect(transformation.getClassName()).andReturn(className).atLeastOnce();
-    }
-
-    protected final void train_value(Id annotation, String value)
-    {
-        expect(annotation.value()).andReturn(value).atLeastOnce();
-    }
-
-    protected final <T extends Annotation> void train_getMethodAnnotation(ClassTransformation ct,
-            MethodSignature signature, Class<T> annotationClass, T annotation)
-    {
-        expect(ct.getMethodAnnotation(signature, annotationClass)).andReturn(annotation)
-                .atLeastOnce();
-    }
-
-    protected final ClasspathAssetAliasManager newClasspathAssetAliasManager()
-    {
-        return newMock(ClasspathAssetAliasManager.class);
-    }
-
-    protected final void train_toClientURL(ClasspathAssetAliasManager manager, String resourcePath,
-            String clientURL)
-    {
-        expect(manager.toClientURL(resourcePath)).andReturn(clientURL);
-    }
-
-    protected final ResourceDigestGenerator newResourceDigestGenerator()
-    {
-        return newMock(ResourceDigestGenerator.class);
-    }
-
-    protected final void train_generateChecksum(ResourceDigestGenerator generator, URL url,
-            String digest)
+    protected final void train_extendMethod(ClassTransformation transformation,
+            MethodSignature signature, String... body)
     {
-        expect(generator.generateDigest(url)).andReturn(digest);
+        transformation.extendMethod(eq(signature), codeEq(join(body)));
     }
 
-    protected final void train_requiresDigest(ResourceDigestGenerator generator, String path,
-            boolean requiresDigest)
+    protected final void train_findAsset(AssetSource source, Resource root, String path,
+            Locale locale, Asset asset)
     {
-        expect(generator.requiresDigest(path)).andReturn(requiresDigest);
+        expect(source.findAsset(root, path, locale)).andReturn(asset);
     }
 
-    protected final void train_getPath(Request request, String path)
+    protected final void train_findFieldsOfType(ClassTransformation transformation, String type,
+            String... fieldNames)
     {
-        expect(request.getPath()).andReturn(path).atLeastOnce();
+        expect(transformation.findFieldsOfType(type)).andReturn(Arrays.asList(fieldNames));
     }
 
-    protected final void train_toResourcePath(ClasspathAssetAliasManager manager, String clientURL,
-            String resourcePath)
+    protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
+            Class<? extends Annotation> annotationClass, List<String> fieldNames)
     {
-        expect(manager.toResourcePath(clientURL)).andReturn(resourcePath).atLeastOnce();
+        expect(transformation.findFieldsWithAnnotation(annotationClass)).andReturn(fieldNames);
     }
 
-    protected final void train_getDateHeader(Request request, String name, long value)
+    protected final void train_findFieldsWithAnnotation(ClassTransformation transformation,
+            Class<? extends Annotation> annotationClass, String... fieldNames)
     {
-        expect(request.getDateHeader(name)).andReturn(value).atLeastOnce();
+        train_findFieldsWithAnnotation(transformation, annotationClass, Arrays.asList(fieldNames));
     }
 
     protected final void train_findMethods(ClassTransformation transformation,
@@ -565,65 +497,75 @@
         expect(transformation.findMethods(EasyMock.isA(MethodFilter.class))).andAnswer(answer);
     }
 
-    protected final void train_isRootClass(MutableComponentModel model, boolean isRootClass)
+    protected final void train_findMethodsWithAnnotation(ClassTransformation tf,
+            Class<? extends Annotation> annotationType, List<MethodSignature> sigs)
     {
-        expect(model.isRootClass()).andReturn(isRootClass);
+        expect(tf.findMethodsWithAnnotation(annotationType)).andReturn(sigs);
     }
 
-    protected final void train_getValidationMessages(ValidationMessagesSource messagesSource,
-            Locale locale, Messages messages)
+    protected final void train_findUnclaimedFields(ClassTransformation transformation,
+            String... fieldNames)
     {
-        expect(messagesSource.getValidationMessages(locale)).andReturn(messages).atLeastOnce();
+        expect(transformation.findUnclaimedFields()).andReturn(Arrays.asList(fieldNames));
     }
 
-    protected final void train_getLocale(ComponentResourcesCommon resources, Locale locale)
+    protected final void train_generateChecksum(ResourceDigestGenerator generator, URL url,
+            String digest)
     {
-        expect(resources.getLocale()).andReturn(locale).atLeastOnce();
+        expect(generator.generateDigest(url)).andReturn(digest);
     }
 
-    protected <C, T> void train_getConstraintType(Validator<C, T> validator, Class<C> constraintType)
+    protected final <T> void train_get(ApplicationStatePersistenceStrategy strategy,
+            Class<T> asoClass, ApplicationStateCreator<T> creator, T aso)
     {
-        expect(validator.getConstraintType()).andReturn(constraintType);
+        expect(strategy.get(asoClass, creator)).andReturn(aso);
     }
 
-    protected final Validator newValidator()
+    protected final void train_get(ApplicationStatePersistenceStrategySource source,
+            String strategyName, ApplicationStatePersistenceStrategy strategy)
     {
-        return newMock(Validator.class);
+        expect(source.get(strategyName)).andReturn(strategy).atLeastOnce();
     }
 
-    protected final ValidationMessagesSource newValidationMessagesSource()
+    protected final void train_get(Binding binding, Object value)
     {
-        return newMock(ValidationMessagesSource.class);
+        expect(binding.get()).andReturn(value);
     }
 
-    protected final FieldValidator newFieldValidator()
+    protected final <T extends Annotation> void train_getAnnotation(AnnotationProvider provider,
+            Class<T> annotationClass, T annotation)
     {
-        return newMock(FieldValidator.class);
+        expect(provider.getAnnotation(annotationClass)).andReturn(annotation).atLeastOnce();
     }
 
-    protected FieldValidatorSource newFieldValidatorSource()
+    protected void train_getAttribute(HttpSession session, String attributeName, Object value)
     {
-        return newMock(FieldValidatorSource.class);
+        expect(session.getAttribute(attributeName)).andReturn(value);
     }
 
-    protected final Component newComponent()
+    protected final void train_getAttribute(Session session, String name, Object attribute)
     {
-        return newMock(Component.class);
+        expect(session.getAttribute(name)).andReturn(attribute);
     }
 
-    protected final void train_getComponent(ComponentResources resources, Component component)
+    protected final void train_getAttributeNames(Session session, String prefix, String... names)
     {
-        expect(resources.getComponent()).andReturn(component).atLeastOnce();
+        expect(session.getAttributeNames(prefix)).andReturn(Arrays.asList(names));
     }
 
-    protected final void train_getPersistentFieldNames(ComponentModel model, String... names)
+    protected final void train_getBaseResource(ComponentModel model, Resource resource)
     {
-        expect(model.getPersistentFieldNames()).andReturn(Arrays.asList(names)).atLeastOnce();
+        expect(model.getBaseResource()).andReturn(resource).atLeastOnce();
     }
 
-    protected final BindingSource newBindingSource()
+    protected final void train_getClassName(ClassTransformation transformation, String className)
     {
-        return newMock(BindingSource.class);
+        expect(transformation.getClassName()).andReturn(className).atLeastOnce();
+    }
+
+    protected final void train_getClasspathAsset(AssetSource source, String path, Asset asset)
+    {
+        expect(source.getClasspathAsset(path)).andReturn(asset);
     }
 
     protected final void train_getClasspathAsset(AssetSource source, String path, Locale locale,
@@ -632,243 +574,251 @@
         expect(source.getClasspathAsset(path, locale)).andReturn(asset);
     }
 
-    protected final void train_getClasspathAsset(AssetSource source, String path, Asset asset)
+    protected final void train_getCompleteId(ComponentResources resources, String completeId)
     {
-        expect(source.getClasspathAsset(path)).andReturn(asset);
+        expect(resources.getCompleteId()).andReturn(completeId).atLeastOnce();
     }
 
-    protected final void toClientURL(Asset asset, String clientURL)
+    protected final void train_getComponent(ComponentResources resources, Component component)
     {
-        expect(asset.toClientURL()).andReturn(clientURL);
+        expect(resources.getComponent()).andReturn(component).atLeastOnce();
     }
 
-    protected final <T> void train_peek(Environment env, Class<T> type, T value)
+    protected final void train_getComponentClassName(ComponentModel model, String className)
     {
-        expect(env.peek(type)).andReturn(value);
+        expect(model.getComponentClassName()).andReturn(className).atLeastOnce();
     }
 
-    protected final <T> void train_peekRequired(Environment env, Class<T> type, T value)
+    protected final void train_getComponentResources(Component component,
+            ComponentResources resources)
     {
-        expect(env.peekRequired(type)).andReturn(value);
+        expect(component.getComponentResources()).andReturn(resources).atLeastOnce();
     }
 
-    protected final Environment newEnvironment()
+    protected final void train_getConduit(PropertyModel model, PropertyConduit conduit)
     {
-        return newMock(Environment.class);
+        expect(model.getConduit()).andReturn(conduit).atLeastOnce();
     }
 
-    protected final AssetSource newAssetSource()
+    protected <C, T> void train_getConstraintType(Validator<C, T> validator, Class<C> constraintType)
     {
-        return newMock(AssetSource.class);
+        expect(validator.getConstraintType()).andReturn(constraintType);
     }
 
-    protected final Translator newTranslator()
+    protected final void train_getContainer(ComponentResources resources, Component container)
     {
-        return newMock(Translator.class);
+        expect(resources.getContainer()).andReturn(container).atLeastOnce();
     }
 
-    protected final ValidationTracker newValidationTracker()
+    protected final void train_getContainerMessages(ComponentResources resources,
+            Messages containerMessages)
     {
-        return newMock(ValidationTracker.class);
+        expect(resources.getContainerMessages()).andReturn(containerMessages).atLeastOnce();
     }
 
-    protected final Field newField()
+    protected final void train_getContainerResources(ComponentResources resources,
+            ComponentResources containerResources)
     {
-        return newMock(Field.class);
+        expect(resources.getContainerResources()).andReturn(containerResources).atLeastOnce();
     }
 
-    protected final void train_inError(ValidationTracker tracker, Field field, boolean inError)
+    protected final void train_getDateHeader(Request request, String name, long value)
     {
-        expect(tracker.inError(field)).andReturn(inError);
+        expect(request.getDateHeader(name)).andReturn(value).atLeastOnce();
     }
 
-    protected final ComponentEventHandler newComponentEventHandler()
+    protected final <T extends Annotation> void train_getFieldAnnotation(
+            ClassTransformation transformation, String fieldName, Class<T> annotationClass,
+            T annotation)
     {
-        return newMock(ComponentEventHandler.class);
+        expect(transformation.getFieldAnnotation(fieldName, annotationClass)).andReturn(annotation);
     }
 
-    @SuppressWarnings("unchecked")
-    protected final void train_handleResult(ComponentEventHandler handler, Object result,
-            Component component, String methodDescription, boolean abort)
+    protected final void train_getFieldPersistenceStrategy(ComponentModel model, String fieldName,
+            String fieldStrategy)
     {
-        expect(handler.handleResult(result, component, methodDescription)).andReturn(abort);
+        expect(model.getFieldPersistenceStrategy(fieldName)).andReturn(fieldStrategy).atLeastOnce();
     }
 
-    protected final void train_toRedirectURI(Link link, String URI)
+    protected final void train_getFieldType(ClassTransformation transformation, String fieldName,
+            String type)
     {
-        expect(link.toRedirectURI()).andReturn(URI).atLeastOnce();
+        expect(transformation.getFieldType(fieldName)).andReturn(type).atLeastOnce();
+
     }
 
-    protected final Link newLink()
+    protected final void train_getId(ComponentResources resources, String id)
     {
-        return newMock(Link.class);
+        expect(resources.getId()).andReturn(id).atLeastOnce();
     }
 
-    protected final Block newBlock()
+    protected final void train_getLabel(Field field, String label)
     {
-        return newMock(Block.class);
+        expect(field.getLabel()).andReturn(label).atLeastOnce();
     }
 
-    protected final void train_getSupportsInformalParameters(ComponentModel model, boolean supports)
+    protected final void train_getLocale(ComponentResourcesCommon resources, Locale locale)
     {
-        expect(model.getSupportsInformalParameters()).andReturn(supports);
+        expect(resources.getLocale()).andReturn(locale).atLeastOnce();
     }
 
-    protected final Inject newInject()
+    protected final void train_getLocale(Request request, Locale locale)
     {
-        return newMock(Inject.class);
+        expect(request.getLocale()).andReturn(locale).atLeastOnce();
     }
 
-    protected final void train_findFieldsOfType(ClassTransformation transformation, String type,
-            String... fieldNames)
+    protected void train_getMessageKey(Validator validator, String messageKey)
     {
-        expect(transformation.findFieldsOfType(type)).andReturn(Arrays.asList(fieldNames));
+        expect(validator.getMessageKey()).andReturn(messageKey).atLeastOnce();
     }
 
-    protected final Heartbeat newHeartbeat()
+    protected final void train_getMessages(ComponentResources resources, Messages messages)
     {
-        return newMock(Heartbeat.class);
+        expect(resources.getMessages()).andReturn(messages).atLeastOnce();
     }
 
-    protected void train_getMessageKey(Validator validator, String messageKey)
+    protected final void train_getMeta(ComponentModel model, String key, String value)
     {
-        expect(validator.getMessageKey()).andReturn(messageKey).atLeastOnce();
+        expect(model.getMeta(key)).andReturn(value).atLeastOnce();
     }
 
-    protected final Field newFieldWithLabel(String label)
+    protected final <T extends Annotation> void train_getMethodAnnotation(ClassTransformation ct,
+            MethodSignature signature, Class<T> annotationClass, T annotation)
     {
-        Field field = newField();
-
-        train_getLabel(field, label);
+        expect(ct.getMethodAnnotation(signature, annotationClass)).andReturn(annotation)
+                .atLeastOnce();
+    }
 
-        return field;
+    protected final void train_getMethodIdentifier(ClassTransformation transformation,
+            MethodSignature signature, String id)
+    {
+        expect(transformation.getMethodIdentifier(signature)).andReturn(id);
     }
 
-    protected final void train_getLabel(Field field, String label)
+    protected final void train_getOutputStream(HttpServletResponse response,
+            ServletOutputStream stream)
     {
-        expect(field.getLabel()).andReturn(label).atLeastOnce();
+        try
+        {
+            expect(response.getOutputStream()).andReturn(stream);
+        }
+        catch (IOException e)
+        {
+            fail(e.getMessage(), e);
+        }
     }
 
-    protected final void train_getContainerResources(ComponentResources resources,
-            ComponentResources containerResources)
+    protected final void train_getPage(ComponentResources resources, Component page)
     {
-        expect(resources.getContainerResources()).andReturn(containerResources).atLeastOnce();
+        expect(resources.getPage()).andReturn(page).atLeastOnce();
     }
 
-    protected final void train_getContainerMessages(ComponentResources resources,
-            Messages containerMessages)
+    protected final void train_getParameterModel(ComponentModel model, String parameterName,
+            ParameterModel parameterModel)
     {
-        expect(resources.getContainerMessages()).andReturn(containerMessages).atLeastOnce();
+        expect(model.getParameterModel(parameterName)).andReturn(parameterModel);
     }
 
-    protected final void train_getId(ComponentResources resources, String id)
+    protected final void train_getParameterNames(ComponentModel model, String... names)
     {
-        expect(resources.getId()).andReturn(id).atLeastOnce();
+        expect(model.getParameterNames()).andReturn(Arrays.asList(names));
     }
 
-    protected final void train_getMessages(ComponentResources resources, Messages messages)
+    protected final void train_getParentModel(ComponentModel model, ComponentModel parentModel)
     {
-        expect(resources.getMessages()).andReturn(messages).atLeastOnce();
+        expect(model.getParentModel()).andReturn(parentModel).atLeastOnce();
     }
 
-    protected final void train_getValueType(Validator validator, Class valueType)
+    protected final void train_getPath(Request request, String path)
     {
-        expect(validator.getValueType()).andReturn(valueType).atLeastOnce();
+        expect(request.getPath()).andReturn(path).atLeastOnce();
     }
 
-    protected final void train_invokeIfBlank(Validator validator, boolean invokeIfBlank)
+    protected final void train_getPersistentFieldNames(ComponentModel model, String... names)
     {
-        expect(validator.invokeIfBlank()).andReturn(invokeIfBlank).atLeastOnce();
+        expect(model.getPersistentFieldNames()).andReturn(Arrays.asList(names)).atLeastOnce();
     }
 
-    protected final void train_getFieldPersistenceStrategy(ComponentModel model, String fieldName,
-            String fieldStrategy)
+    protected final void train_getResourcesFieldName(ClassTransformation transformation, String name)
     {
-        expect(model.getFieldPersistenceStrategy(fieldName)).andReturn(fieldStrategy).atLeastOnce();
+        expect(transformation.getResourcesFieldName()).andReturn(name).atLeastOnce();
     }
 
-    protected final ApplicationStatePersistenceStrategy newApplicationStatePersistenceStrategy()
+    protected final void train_getRootResource(AssetFactory factory, Resource rootResource)
     {
-        return newMock(ApplicationStatePersistenceStrategy.class);
+        expect(factory.getRootResource()).andReturn(rootResource);
     }
 
-    protected final ApplicationStateCreator newApplicationStateCreator()
+    protected final void train_getSession(HttpServletRequest request, boolean create,
+            HttpSession session)
     {
-        return newMock(ApplicationStateCreator.class);
+        expect(request.getSession(create)).andReturn(session);
     }
 
-    protected final ApplicationStatePersistenceStrategySource newApplicationStatePersistenceStrategySource()
+    protected final void train_getSession(Request request, boolean create, Session session)
     {
-        return newMock(ApplicationStatePersistenceStrategySource.class);
+        expect(request.getSession(create)).andReturn(session);
     }
 
-    protected final <T> void train_get(ApplicationStatePersistenceStrategy strategy,
-            Class<T> asoClass, ApplicationStateCreator<T> creator, T aso)
+    protected final void train_getSupportsInformalParameters(ComponentModel model, boolean supports)
     {
-        expect(strategy.get(asoClass, creator)).andReturn(aso);
+        expect(model.getSupportsInformalParameters()).andReturn(supports);
     }
 
-    protected final <T> void train_create(ApplicationStateCreator<T> creator, T aso)
+    protected final void train_getValidationMessages(ValidationMessagesSource messagesSource,
+            Locale locale, Messages messages)
     {
-        expect(creator.create()).andReturn(aso);
+        expect(messagesSource.getValidationMessages(locale)).andReturn(messages).atLeastOnce();
     }
 
-    protected final void train_get(ApplicationStatePersistenceStrategySource source,
-            String strategyName, ApplicationStatePersistenceStrategy strategy)
+    protected final void train_getValueType(Validator validator, Class valueType)
     {
-        expect(source.get(strategyName)).andReturn(strategy).atLeastOnce();
+        expect(validator.getValueType()).andReturn(valueType).atLeastOnce();
     }
 
-    protected final <T extends Annotation> void train_getAnnotation(AnnotationProvider provider,
-            Class<T> annotationClass, T annotation)
+    @SuppressWarnings("unchecked")
+    protected final void train_handleResult(ComponentEventHandler handler, Object result,
+            Component component, String methodDescription, boolean abort)
     {
-        expect(provider.getAnnotation(annotationClass)).andReturn(annotation).atLeastOnce();
+        expect(handler.handleResult(result, component, methodDescription)).andReturn(abort);
     }
 
-    protected final void train_getConduit(PropertyModel model, PropertyConduit conduit)
+    protected final void train_inError(ValidationTracker tracker, Field field, boolean inError)
     {
-        expect(model.getConduit()).andReturn(conduit).atLeastOnce();
+        expect(tracker.inError(field)).andReturn(inError);
     }
 
-    protected final PropertyConduit newPropertyConduit()
+    protected final void train_invokeIfBlank(Validator validator, boolean invokeIfBlank)
     {
-        return newMock(PropertyConduit.class);
+        expect(validator.invokeIfBlank()).andReturn(invokeIfBlank).atLeastOnce();
     }
 
-    protected final PropertyModel newPropertyEditModel()
+    protected final void train_isInvariant(Binding binding, boolean isInvariant)
     {
-        return newMock(PropertyModel.class);
+        expect(binding.isInvariant()).andReturn(isInvariant);
     }
 
-    protected final void train_createValidator(FieldValidatorSource source, Field field,
-            String validatorType, String constraintValue, String overrideId,
-            Messages overrideMessages, Locale locale, FieldValidator result)
+    protected final void train_isRequired(ParameterModel model, boolean isRequired)
     {
-        expect(
-                source.createValidator(
-                        field,
-                        validatorType,
-                        constraintValue,
-                        overrideId,
-                        overrideMessages,
-                        locale)).andReturn(result);
+        expect(model.isRequired()).andReturn(isRequired);
     }
 
-    protected final void train_buildConstraints(ValidationConstraintGenerator generator,
-            Class propertyType, AnnotationProvider provider, String... constraints)
+    protected final void train_isRootClass(MutableComponentModel model, boolean isRootClass)
     {
-        expect(generator.buildConstraints(propertyType, provider)).andReturn(
-                Arrays.asList(constraints));
+        expect(model.isRootClass()).andReturn(isRootClass);
     }
 
-    protected final ValidationConstraintGenerator newValidationConstraintGenerator()
+    protected final void train_name(Parameter parameter, String name)
     {
-        return newMock(ValidationConstraintGenerator.class);
+        expect(parameter.name()).andReturn(name).atLeastOnce();
     }
 
-    protected final void train_getMeta(ComponentModel model, String key, String value)
+    protected final void train_newBinding(BindingFactory factory, String description,
+            ComponentResources container, ComponentResources component, String expression,
+            Location l, Binding binding)
     {
-        expect(model.getMeta(key)).andReturn(value).atLeastOnce();
+        expect(factory.newBinding(description, container, component, expression, l)).andReturn(
+                binding);
     }
 
     protected void train_newBinding(BindingSource bindingSource, String description,
@@ -883,16 +833,34 @@
                         expression)).andReturn(binding);
     }
 
-    /**
-     * Creates a new markup writer instance (not a markup writer mock). Output can be directed at
-     * the writer, which uses the default (HTML) markup model. The writer's toString() value
-     * represents all the collected markup in the writer.
-     * 
-     * @return
-     */
-    protected final MarkupWriter createMarkupWriter()
+    protected final void train_newMemberName(ClassTransformation transformation, String suggested,
+            String name)
     {
-        return new MarkupWriterImpl();
+        expect(transformation.newMemberName(suggested)).andReturn(name);
+    }
+
+    protected final void train_newMemberName(ClassTransformation transformation, String prefix,
+            String baseName, String name)
+    {
+        expect(transformation.newMemberName(prefix, baseName)).andReturn(name);
+    }
+
+    protected final <T> void train_peek(Environment env, Class<T> type, T value)
+    {
+        expect(env.peek(type)).andReturn(value);
+    }
+
+    protected final <T> void train_peekRequired(Environment env, Class<T> type, T value)
+    {
+        expect(env.peekRequired(type)).andReturn(value);
+    }
+
+    protected final void train_provideInjection(InjectionProvider provider, String fieldName,
+            String fieldType, ServiceLocator locator, ClassTransformation transformation,
+            MutableComponentModel model, boolean result)
+    {
+        expect(provider.provideInjection(fieldName, fieldType, locator, transformation, model))
+                .andReturn(result);
     }
 
     @SuppressWarnings("unchecked")
@@ -913,40 +881,69 @@
         getMocksControl().andAnswer(answer);
     }
 
-    protected final void train_toClientURL(Asset asset, String URL)
+    protected final void train_requiresDigest(ResourceDigestGenerator generator, String path,
+            boolean requiresDigest)
     {
-        expect(asset.toClientURL()).andReturn(URL).atLeastOnce();
+        expect(generator.requiresDigest(path)).andReturn(requiresDigest);
     }
 
-    protected final void train_getMethodIdentifier(ClassTransformation transformation,
-            MethodSignature signature, String id)
+    protected final void train_service(RequestHandler handler, Request request, Response response,
+            boolean result) throws IOException
     {
-        expect(transformation.getMethodIdentifier(signature)).andReturn(id);
+        expect(handler.service(request, response)).andReturn(result);
     }
 
-    protected final void getAliasesForMode(AliasManager manager, String mode,
-            Map<Class, Object> configuration)
+    protected final void train_setContentLength(HttpServletResponse response, int length)
     {
-        expect(manager.getAliasesForMode(mode)).andReturn(configuration);
+        response.setContentLength(length);
     }
 
-    protected final void train_findAsset(AssetSource source, Resource root, String path, Locale locale, Asset asset)
+    protected final void train_setContentType(HttpServletResponse response, String contentType)
     {
-        expect(source.findAsset(root, path, locale)).andReturn(asset);
+        response.setContentType(contentType);
     }
 
-    protected final Path newPath()
+    protected final void train_setDateHeader(HttpServletResponse response, String headerName,
+            long date)
     {
-        return newMock(Path.class);
+        response.setDateHeader(headerName, date);
     }
 
-    protected final void train_value(Path annotation, String value)
+    protected final void train_toClass(ClassTransformation transformation, String type,
+            Class classForType)
+    {
+        expect(transformation.toClass(type)).andReturn(classForType);
+    }
+
+    protected final void train_toClientURL(Asset asset, String URL)
+    {
+        expect(asset.toClientURL()).andReturn(URL).atLeastOnce();
+    }
+
+    protected final void train_toClientURL(ClasspathAssetAliasManager manager, String resourcePath,
+            String clientURL)
+    {
+        expect(manager.toClientURL(resourcePath)).andReturn(clientURL);
+    }
+
+    protected final void train_toRedirectURI(Link link, String URI)
+    {
+        expect(link.toRedirectURI()).andReturn(URI).atLeastOnce();
+    }
+
+    protected final void train_toResourcePath(ClasspathAssetAliasManager manager, String clientURL,
+            String resourcePath)
+    {
+        expect(manager.toResourcePath(clientURL)).andReturn(resourcePath).atLeastOnce();
+    }
+
+    protected final void train_value(Id annotation, String value)
     {
         expect(annotation.value()).andReturn(value).atLeastOnce();
     }
 
-    protected final <T> void train_exists(ApplicationStatePersistenceStrategy strategy, Class<T> asoClass, boolean exists)
+    protected final void train_value(Path annotation, String value)
     {
-        expect(strategy.exists(asoClass)).andReturn(exists);
+        expect(annotation.value()).andReturn(value).atLeastOnce();
     }
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/guide/component-classes.apt Sat Apr 21 10:19:58 2007
@@ -77,6 +77,11 @@
   to store some of the classes.  The sub-package name becomes part of the page name or component type.  Thus you might define a page component 
   <<<com.example.myapp.pages.admin.CreateUser>>> and the logical page name (which often shows up inside URLs) will be <<admin/CreateUser>>.
   
+  Tapestry performs some simple optimizations of the logical page name (or component type, or mixin type).  It checks to see if the package name
+  is either a prefix or a suffix of the unqualified class name (case insensitively, of course) and removes the prefix or suffix if so.  The net result is
+  that a class name such as <<<com.example.myapp.pages.user.EditUser>>> will have a page name of <<<user/Edit>>> (<not> <<<user/EditUser>>>).  The goal here is to provide
+  shorter, more natural URLs.
+  
 Pages vs. Components
 
   The distinction in Tapestry 5 between pages and component is very, very small.  The only
@@ -103,15 +108,23 @@
   
   Because transformation doesn't occur until <runtime>, the build stage of your application is not
   affected by the fact that you are creating a Tapestry application. Further, your classes are absolutely
-  simple POJOs during testing.
+  simple POJOs during unit testing.
   
-Class Reloading
+Live Class Reloading
 
   Component classes are monitored for changes by the framework. 
   {{{reload.html}Classes are reloaded when changed.}} This allows you to build your application
   with a speed approaching that of a scripting environment, without sacrificing any of the power
   of the Java platform.
   
+  And it's fast!  You won't even notice that this magic class reloading has occured. 
+  
+  The net result: super productivity --- change your class, see the change instantly. This is designed to be
+  a blend of the best of scripting environments (such as Python or Ruby) with all the speed and power of Java backing it up.
+  
+  However, class reloading <only> applies to component classes.  Other classes, such as service interfaces and implementations, or
+  other data objects, are loaded by the normal class loader and not subject to live class reloading.
+  
 Instance Variables
 
   Tapestry components may have instance variables (unlike Tapestry 4, where you had to 
@@ -133,7 +146,7 @@
   <transient> instance variable. This means that its value resets to its
   default value
   at the end of reach request (when the
-  {{{lifecycle.html}page is detached from the request}}.
+  {{{lifecycle.html}page is detached from the request}}).
   
   If you have a variable that can keep its value between requests and you would like
   to defeat that reset logic, then you should attach a
@@ -169,13 +182,12 @@
 
   Components often contain other components.  Components inside another components template are called <embedded components>.  
   The containing component's
-  {{{templates.html}template}} will contain \<comp\> element identifying where the the embedded components go.
+  {{{templates.html}template}} will contain special elements, in the Tapestry namespace, identifying where the the embedded components go.
   
   You can define the type of component inside template, or you can create an instance variable for the component
   and use the
   {{{../apidocs/org/apache/tapestry/annotations/Component.html}Component}} annotation to define the component type
-  and parameters.  You should not provide the type attribute of the \<comp\> element, just the id attribute (if you do provide
-  the type attribute, Tapestry will log an error and use the type of the annotated field).
+  and parameters. 
   
   Example:
   
@@ -227,5 +239,5 @@
   You may override the default component id (as derived from the field name)
   using the id() attribute of the Component annotation.
   
-  If you define a component in the component class, and there is no corresponding \<comp\> element in the template,
+  If you define a component in the component class, and there is no corresponding  element in the template,
   Tapestry will log an error.

Modified: tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/site/apt/index.apt Sat Apr 21 10:19:58 2007
@@ -12,6 +12,14 @@
 
   Progress on Tapestry 5 is really taking off. This space lists some cool new features that have been added
   recently.
+  
+  * Explicit \<!DOCTYPE\> declarations inside page and component templates will now be forwarded through to the client
+    web browser.
+    
+  * The mapping from class names to page names (or component types) has been tweaked to remove some redunancy;
+    For example,
+    class org.example.myapp.pages.edit.EditUser will now have the name "edit/User" rather than "edit/EditUser". This
+    results in shorter, clearer, more natural URLs.
     
   * The type of component may now be specified in a template using the element name, rather than the
     t:type attribute (this represents an incompatible change from 5.0.2).
@@ -50,7 +58,7 @@
   * BeanEditForm component that creates a form and related controls to edit the properties of any JavaBean, automatically.
     Inspired by {{{http://www.trailsframework.org/}Trails}} and {{{http://beanform.sourceforge.net/}BeanForm}} (both for Tapestry 4).
   
-  * Case insensitve URLs.  Tapestry no longer cares about the case of the page names and commponent ids it puts
+  * Case insensitve URLs.  Tapestry no longer cares about the case of the page names and component ids it puts
     into URLs, and they are now generated in all lower-case for that clean "Web 2.0" look.  And they're 
     shorter and "prettier", too!
   

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ValidationTrackerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ValidationTrackerImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ValidationTrackerImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/ValidationTrackerImplTest.java Sat Apr 21 10:19:58 2007
@@ -182,7 +182,7 @@
 
     private final Field newFieldWithElementName(String elementName)
     {
-        Field field = newField();
+        Field field = mockField();
 
         // Fields generated this way, for the purposes of this test, do not
         // ever change their elementName. In real life, elementNames can change.

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormSupportImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormSupportImplTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormSupportImplTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormSupportImplTest.java Sat Apr 21 10:19:58 2007
@@ -32,8 +32,8 @@
     @Test
     public void execute_deferred_execute_in_added_order()
     {
-        Runnable r1 = newRunnable();
-        Runnable r2 = newRunnable();
+        Runnable r1 = mockRunnable();
+        Runnable r2 = mockRunnable();
 
         getMocksControl().checkOrder(true);
 
@@ -55,9 +55,9 @@
     @Test
     public void deferred_commands_execute_once()
     {
-        Runnable r1 = newRunnable();
-        Runnable r2 = newRunnable();
-        Runnable r3 = newRunnable();
+        Runnable r1 = mockRunnable();
+        Runnable r2 = mockRunnable();
+        Runnable r3 = mockRunnable();
 
         getMocksControl().checkOrder(true);
 
@@ -92,7 +92,7 @@
         String name = "param";
         String value = "zaphod";
 
-        FormParameterLookup lookup = newFormParameterLookup();
+        FormParameterLookup lookup = mockFormParameterLookup();
 
         train_getParameter(lookup, name, value);
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/FormTest.java Sat Apr 21 10:19:58 2007
@@ -24,7 +24,7 @@
     @Test
     public void record_error()
     {
-        ValidationTracker tracker = newValidationTracker();
+        ValidationTracker tracker = mockValidationTracker();
         String message = "A recorded message.";
 
         tracker.recordError(message);
@@ -43,9 +43,9 @@
     @Test
     public void record_error_for_field()
     {
-        ValidationTracker tracker = newValidationTracker();
+        ValidationTracker tracker = mockValidationTracker();
         String message = "A recorded message.";
-        Field field = newField();
+        Field field = mockField();
 
         tracker.recordError(field, message);
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/IfTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/IfTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/IfTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/IfTest.java Sat Apr 21 10:19:58 2007
@@ -34,7 +34,7 @@
     @Test
     public void false_test_renders_else_block()
     {
-        Block block = newBlock();
+        Block block = mockBlock();
 
         replay();
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/LoopTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/LoopTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/LoopTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/LoopTest.java Sat Apr 21 10:19:58 2007
@@ -26,7 +26,7 @@
     @Test
     public void non_empty_iterator()
     {
-        Heartbeat hb = newHeartbeat();
+        Heartbeat hb = mockHeartbeat();
 
         // Really hard to test the exact timing of all this; it will have to
         // be "proven" by integration tests.

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputRawTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputRawTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputRawTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputRawTest.java Sat Apr 21 10:19:58 2007
@@ -23,7 +23,7 @@
     @Test
     public void value_is_null()
     {
-        MarkupWriter writer = newMarkupWriter();
+        MarkupWriter writer = mockMarkupWriter();
 
         replay();
 
@@ -37,7 +37,7 @@
     @Test
     public void value_is_empty_string()
     {
-        MarkupWriter writer = newMarkupWriter();
+        MarkupWriter writer = mockMarkupWriter();
 
         replay();
 
@@ -55,7 +55,7 @@
     {
         String value = "&nbsp;";
 
-        MarkupWriter writer = newMarkupWriter();
+        MarkupWriter writer = mockMarkupWriter();
 
         writer.writeRaw(value);
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/OutputTest.java Sat Apr 21 10:19:58 2007
@@ -43,7 +43,7 @@
     public void simple_output()
     {
         MarkupWriter writer = createMarkupWriter();
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
 
         replay();
 
@@ -67,7 +67,7 @@
 
         MarkupWriter writer = createMarkupWriter();
 
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
 
         train_renderInformalParameters(resources, writer, "foo", "bar");
 
@@ -91,7 +91,7 @@
 
         MarkupWriter writer = createMarkupWriter();
 
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
 
         Format format = new Format()
         {

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/corelib/components/SubmitTest.java Sat Apr 21 10:19:58 2007
@@ -45,8 +45,8 @@
     @Test
     public void trigger_deferred()
     {
-        FormParameterLookup lookup = newFormParameterLookup();
-        ComponentResources resources = newComponentResources();
+        FormParameterLookup lookup = mockFormParameterLookup();
+        ComponentResources resources = mockComponentResources();
         FormSupportImpl support = new FormSupportImpl(lookup);
 
         String elementName = "myname";
@@ -76,7 +76,7 @@
     public void trigger_immediate()
     {
         FormSupport support = newFormSupport();
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
         Heartbeat heartbeat = new HeartbeatImpl();
 
         String elementName = "myname";

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/integration/app1/pages/Localization.java Sat Apr 21 10:19:58 2007
@@ -17,7 +17,6 @@
 import java.util.Locale;
 
 import org.apache.tapestry.annotations.Inject;
-import org.apache.tapestry.annotations.OnEvent;
 import org.apache.tapestry.annotations.Service;
 import org.apache.tapestry.ioc.Messages;
 import org.apache.tapestry.ioc.services.ClassFactory;
@@ -30,11 +29,11 @@
     private Messages _messages;
 
     @Inject
-    @Service("service:ClassFactory")
+    @Service("ClassFactory")
     private ClassFactory _iocClassFactory;
 
     @Inject
-    @Service("service:ComponentClassFactory")
+    @Service("ComponentClassFactory")
     private ClassFactory _componentClassFactory;
 
     @Inject
@@ -43,6 +42,9 @@
     @Inject
     private Request _request;
 
+    @Inject
+    private PersistentLocale _persistentLocale;
+
     public Locale getLocale()
     {
         return _locale;
@@ -68,19 +70,14 @@
         return _iocClassFactory;
     }
 
-    @Inject
-    private PersistentLocale persistentLocale;
-
-    @OnEvent(component = "french")
-    public void changeLocaleToFrench()
+    public void onActionFromFrench()
     {
-        persistentLocale.set(Locale.FRENCH);
+        _persistentLocale.set(Locale.FRENCH);
     }
 
-    @OnEvent(component = "english")
-    public void changeLocaleToEnglish()
+    public void onActionFromEnglish()
     {
-        persistentLocale.set(Locale.ENGLISH);
+        _persistentLocale.set(Locale.ENGLISH);
     }
 
 }

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/DefaultValidationDecoratorTest.java Sat Apr 21 10:19:58 2007
@@ -30,7 +30,7 @@
     @Test
     public void label_has_no_field()
     {
-        Environment env = newEnvironment();
+        Environment env = mockEnvironment();
 
         replay();
 
@@ -45,9 +45,9 @@
     public void label_error_no_existing_class_attribute()
     {
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-        Environment env = newEnvironment();
-        Field field = newField();
-        ValidationTracker tracker = newValidationTracker();
+        Environment env = mockEnvironment();
+        Field field = mockField();
+        ValidationTracker tracker = mockValidationTracker();
 
         train_peekRequired(env, ValidationTracker.class, tracker);
         train_inError(tracker, field, true);
@@ -69,9 +69,9 @@
     public void label_error_with_existing_class_attribute()
     {
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-        Environment env = newEnvironment();
-        Field field = newField();
-        ValidationTracker tracker = newValidationTracker();
+        Environment env = mockEnvironment();
+        Field field = mockField();
+        ValidationTracker tracker = mockValidationTracker();
 
         train_peekRequired(env, ValidationTracker.class, tracker);
         train_inError(tracker, field, true);
@@ -93,9 +93,9 @@
     public void field_error()
     {
         MarkupWriter writer = new MarkupWriterImpl(new XMLMarkupModel(), null);
-        Environment env = newEnvironment();
-        Field field = newField();
-        ValidationTracker tracker = newValidationTracker();
+        Environment env = mockEnvironment();
+        Field field = mockField();
+        ValidationTracker tracker = mockValidationTracker();
 
         train_peekRequired(env, ValidationTracker.class, tracker);
         train_inError(tracker, field, true);
@@ -130,9 +130,9 @@
     @Test
     public void field_ok()
     {
-        Environment env = newEnvironment();
-        Field field = newField();
-        ValidationTracker tracker = newValidationTracker();
+        Environment env = mockEnvironment();
+        Field field = mockField();
+        ValidationTracker tracker = mockValidationTracker();
 
         train_peekRequired(env, ValidationTracker.class, tracker);
         train_inError(tracker, field, false);
@@ -149,9 +149,9 @@
     @Test
     public void label_when_field_not_in_error()
     {
-        Environment env = newEnvironment();
-        Field field = newField();
-        ValidationTracker tracker = newValidationTracker();
+        Environment env = mockEnvironment();
+        Field field = mockField();
+        ValidationTracker tracker = mockValidationTracker();
 
         train_peekRequired(env, ValidationTracker.class, tracker);
         train_inError(tracker, field, false);

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/TapestryInternalUtilsTest.java Sat Apr 21 10:19:58 2007
@@ -291,7 +291,7 @@
     @Test
     public void default_order_no_annotation()
     {
-        PropertyConduit conduit = newPropertyConduit();
+        PropertyConduit conduit = mockPropertyConduit();
 
         train_getAnnotation(conduit, Order.class, null);
 
@@ -305,7 +305,7 @@
     @Test
     public void default_order_with_annotation()
     {
-        PropertyConduit conduit = newPropertyConduit();
+        PropertyConduit conduit = mockPropertyConduit();
         Order order = newMock(Order.class);
 
         train_getAnnotation(conduit, Order.class, order);
@@ -336,7 +336,7 @@
     @Test
     public void default_label_key_found()
     {
-        Messages messages = newMessages();
+        Messages messages = mockMessages();
         train_contains(messages, "myid-label", true);
         train_get(messages, "myid-label", "My Id");
 
@@ -352,7 +352,7 @@
     @Test
     public void default_label_from_name()
     {
-        Messages messages = newMessages();
+        Messages messages = mockMessages();
 
         stub_contains(messages, false);
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGeneratorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGeneratorTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGeneratorTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/beaneditor/ValidateAnnotationConstraintGeneratorTest.java Sat Apr 21 10:19:58 2007
@@ -27,7 +27,7 @@
     @Test
     public void no_annotation()
     {
-        PropertyConduit conduit = newPropertyConduit();
+        PropertyConduit conduit = mockPropertyConduit();
 
         train_getAnnotation(conduit, Validate.class, null);
 
@@ -43,7 +43,7 @@
     @Test
     public void single_constraint()
     {
-        PropertyConduit conduit = newPropertyConduit();
+        PropertyConduit conduit = mockPropertyConduit();
         Validate validate = newValidate("required");
 
         train_getAnnotation(conduit, Validate.class, validate);
@@ -60,7 +60,7 @@
     @Test
     public void multiple_constraints()
     {
-        PropertyConduit conduit = newPropertyConduit();
+        PropertyConduit conduit = mockPropertyConduit();
         Validate validate = newValidate("required,minlength=3");
 
         train_getAnnotation(conduit, Validate.class, validate);

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/BindingFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/BindingFactoryTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/BindingFactoryTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/BindingFactoryTest.java Sat Apr 21 10:19:58 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -34,8 +34,8 @@
     @Test
     public void literal_binding()
     {
-        ComponentResources res = newInternalComponentResources();
-        Location l = newLocation();
+        ComponentResources res = mockInternalComponentResources();
+        Location l = mockLocation();
 
         replay();
 
@@ -65,10 +65,10 @@
     @Test
     public void translate_binding()
     {
-        Translator translator = newTranslator();
+        Translator translator = mockTranslator();
         TranslatorSource source = newMock(TranslatorSource.class);
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         String description = "foo bar";
         String expression = "mock";

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/PropBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/PropBindingFactoryTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/PropBindingFactoryTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/PropBindingFactoryTest.java Sat Apr 21 10:19:58 2007
@@ -47,7 +47,7 @@
 
     private ComponentResources newComponentResources(Component component)
     {
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
         train_getComponent(resources, component);
 
         train_getCompleteId(resources, "foo.Bar:baz");
@@ -60,7 +60,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -87,7 +87,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -103,7 +103,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -119,7 +119,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -135,7 +135,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -156,7 +156,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -172,7 +172,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -206,7 +206,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -235,7 +235,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -273,8 +273,8 @@
     public void method_not_found_in_preamble()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -299,8 +299,8 @@
     public void method_not_found_in_terminal()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -330,8 +330,8 @@
     public void void_method_in_preamble()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -356,8 +356,8 @@
     public void void_method_as_terminal()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -382,8 +382,8 @@
     public void property_path_through_missing_property()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -411,8 +411,8 @@
     public void property_path_through_write_only_property()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -442,7 +442,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -466,7 +466,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -495,7 +495,7 @@
     {
         TargetBean bean = new TargetBean();
         ComponentResources resources = newComponentResources(bean);
-        Location l = newLocation();
+        Location l = mockLocation();
 
         replay();
 
@@ -525,8 +525,8 @@
     public void unknown_property()
     {
         TargetBean bean = new TargetBean();
-        ComponentResources resources = newComponentResources();
-        Location l = newLocation();
+        ComponentResources resources = mockComponentResources();
+        Location l = mockLocation();
 
         train_getComponent(resources, bean);
 
@@ -551,10 +551,10 @@
     @Test
     public void special_prop_binding_value_null()
     {
-        Location l = newLocation();
+        Location l = mockLocation();
         String description = "my description";
-        ComponentResources resources = newComponentResources();
-        Component component = newComponent();
+        ComponentResources resources = mockComponentResources();
+        Component component = mockComponent();
 
         train_getComponent(resources, component);
 
@@ -570,9 +570,9 @@
     @Test(dataProvider = "values")
     public void special_prop_binding_values(String expression, Object expected)
     {
-        Location l = newLocation();
+        Location l = mockLocation();
         String description = "my description";
-        ComponentResources resources = newComponentResources();
+        ComponentResources resources = mockComponentResources();
 
         replay();
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidateBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidateBindingFactoryTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidateBindingFactoryTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/bindings/ValidateBindingFactoryTest.java Sat Apr 21 10:19:58 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -35,11 +35,11 @@
     @Test
     public void not_a_field()
     {
-        FieldValidatorSource source = newFieldValidatorSource();
-        ComponentResources container = newComponentResources();
-        ComponentResources component = newComponentResources();
-        Component instance = newComponent();
-        Location l = newLocation();
+        FieldValidatorSource source = mockFieldValidatorSource();
+        ComponentResources container = mockComponentResources();
+        ComponentResources component = mockComponentResources();
+        Component instance = mockComponent();
+        Location l = mockLocation();
 
         train_getComponent(component, instance);
         train_getCompleteId(component, "foo.Bar:baz");
@@ -67,12 +67,12 @@
     public void success()
     {
 
-        FieldValidatorSource source = newFieldValidatorSource();
-        ComponentResources container = newComponentResources();
-        ComponentResources component = newComponentResources();
+        FieldValidatorSource source = mockFieldValidatorSource();
+        ComponentResources container = mockComponentResources();
+        ComponentResources component = mockComponentResources();
         FieldComponent instance = newMock(FieldComponent.class);
-        Location l = newLocation();
-        FieldValidator validator = newFieldValidator();
+        Location l = mockLocation();
+        FieldValidator validator = mockFieldValidator();
 
         String expression = "required,minLength=5";
 

Modified: tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/grid/ListGridDataSourceTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/grid/ListGridDataSourceTest.java?view=diff&rev=531068&r1=531067&r2=531068
==============================================================================
--- tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/grid/ListGridDataSourceTest.java (original)
+++ tapestry/tapestry5/tapestry-core/trunk/src/test/java/org/apache/tapestry/internal/grid/ListGridDataSourceTest.java Sat Apr 21 10:19:58 2007
@@ -56,8 +56,8 @@
     {
         BeanModelSource source = getService(BeanModelSource.class);
 
-        ComponentResources resources = newComponentResources();
-        Messages messages = newMessages();
+        ComponentResources resources = mockComponentResources();
+        Messages messages = mockMessages();
 
         train_getMessages(resources, messages);
         stub_contains(messages, false);