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/24 03:58:52 UTC

svn commit: r531674 [2/2] - 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-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java Mon Apr 23 18:58:49 2007
@@ -21,8 +21,10 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
@@ -32,7 +34,7 @@
 import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.Locatable;
 import org.apache.tapestry.ioc.Location;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.services.ClassFactory;
@@ -179,7 +181,7 @@
 
     @SuppressWarnings("unchecked")
     private static Object calculateParameterValue(Class parameterType,
-            final Annotation[] parameterAnnotations, ServiceLocator locator,
+            final Annotation[] parameterAnnotations, ObjectLocator locator,
             Map<Class, Object> parameterDefaults)
     {
         AnnotationProvider provider = new AnnotationProvider()
@@ -216,7 +218,7 @@
         return locator.getObject(parameterType, provider);
     }
 
-    public static Object[] calculateParametersForMethod(Method method, ServiceLocator locator,
+    public static Object[] calculateParametersForMethod(Method method, ObjectLocator locator,
             Map<Class, Object> parameterDefaults)
     {
         Class[] parameterTypes = method.getParameterTypes();
@@ -226,7 +228,7 @@
     }
 
     public static Object[] calculateParametersForConstructor(Constructor constructor,
-            ServiceLocator locator, Map<Class, Object> parameterDefaults)
+            ObjectLocator locator, Map<Class, Object> parameterDefaults)
     {
         Class[] parameterTypes = constructor.getParameterTypes();
         Annotation[][] annotations = constructor.getParameterAnnotations();
@@ -234,7 +236,7 @@
         return calculateParameters(locator, parameterDefaults, parameterTypes, annotations);
     }
 
-    public static Object[] calculateParameters(ServiceLocator locator,
+    public static Object[] calculateParameters(ObjectLocator locator,
             Map<Class, Object> parameterDefaults, Class[] parameterTypes,
             Annotation[][] parameterAnnotations)
     {
@@ -417,5 +419,49 @@
         if (dotx < 0) return input;
 
         return input.substring(dotx + 1);
+    }
+
+    /**
+     * Searches a class for the "best" constructor, the public constructor with the most parameters.
+     * Returns null if there are no public constructors. If there is more than one constructor with
+     * the maximum number of parameters, it is not determined which will be returned (don't build a
+     * class like that!).
+     * 
+     * @param clazz
+     *            to search for a constructor for
+     * @return the constructor to be used to instantiate the class, or null if no appropriate
+     *         constructor was found
+     */
+    public static Constructor findAutobuildConstructor(Class clazz)
+    {
+        Constructor[] constructors = clazz.getConstructors();
+
+        switch (constructors.length)
+        {
+            case 1:
+
+                return constructors[0];
+
+            case 0:
+
+                return null;
+
+            default:
+                break;
+        }
+
+        // Choose a constructor with the most parameters.
+
+        Comparator<Constructor> comparator = new Comparator<Constructor>()
+        {
+            public int compare(Constructor o1, Constructor o2)
+            {
+                return o2.getParameterTypes().length - o1.getParameterTypes().length;
+            }
+        };
+
+        Arrays.sort(constructors, comparator);
+
+        return constructors[0];
     }
 }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/OneShotLock.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/OneShotLock.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/OneShotLock.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/internal/util/OneShotLock.java Mon Apr 23 18:58:49 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.
@@ -28,7 +28,7 @@
      * @throws IllegalStateException
      *             if the lock is set
      */
-    public void check()
+    public synchronized void check()
     {
         innerCheck();
     }
@@ -49,7 +49,7 @@
     }
 
     /** Checks the lock, then sets it. */
-    public void lock()
+    public synchronized void lock()
     {
         innerCheck();
 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/services/TapestryIOCModule.java Mon Apr 23 18:58:49 2007
@@ -31,7 +31,7 @@
 import org.apache.tapestry.ioc.OrderedConfiguration;
 import org.apache.tapestry.ioc.ServiceBinder;
 import org.apache.tapestry.ioc.ServiceLifecycle;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.internal.services.ChainBuilderImpl;
@@ -56,14 +56,6 @@
  */
 public final class TapestryIOCModule
 {
-    private final ClassFactory _classFactory;
-
-    public TapestryIOCModule(@InjectService("ClassFactory")
-    ClassFactory classFactory)
-    {
-        _classFactory = classFactory;
-    }
-
     public static void bind(ServiceBinder binder)
     {
         binder.bind(LoggingDecorator.class, LoggingDecoratorImpl.class);
@@ -84,9 +76,10 @@
     }
 
     /**
-     * Provides access to additional service lifecycles. Two lifecycles are built in ("singleton"
-     * and "primitive") but additional ones are accessed via this service (and its mapped
-     * configuration).
+     * Provides access to additional service lifecycles. One lifecycles is built in ("singleton")
+     * but additional ones are accessed via this service (and its mapped configuration). Only
+     * proxiable services (those with explicit service interfaces) can be managed in terms of a
+     * lifecycle.
      */
     public static ServiceLifecycleSource build(final Map<String, ServiceLifecycle> configuration)
     {
@@ -101,28 +94,26 @@
 
     /** Contributes the "perthread" scope. */
     public void contributeServiceLifecycleSource(
-            MappedConfiguration<String, ServiceLifecycle> configuration,
-            @InjectService("ThreadCleanupHub")
-            ThreadCleanupHub threadCleanupHub)
+            MappedConfiguration<String, ServiceLifecycle> configuration, ObjectLocator locator)
     {
-        configuration.add(PERTHREAD_SCOPE, new PerThreadServiceLifecycle(threadCleanupHub,
-                _classFactory));
+        configuration.add(PERTHREAD_SCOPE, locator.autobuild(PerThreadServiceLifecycle.class));
     }
 
     /**
      * The master {@link ObjectProvider} is responsible for identifying a particular ObjectProvider
      * by its prefix, and delegating to that instance.
      */
-    public ObjectProvider buildMasterObjectProvider(List<ObjectProvider> configuration,
-            @InjectService("ChainBuilder")
-            ChainBuilder chainBuilder)
+    public static ObjectProvider buildMasterObjectProvider(List<ObjectProvider> configuration,
+
+    @InjectService("ChainBuilder")
+    ChainBuilder chainBuilder)
     {
         return chainBuilder.build(ObjectProvider.class, configuration);
     }
 
     /**
      * Contributes "DefaultProvider", ordered last, that delegates to
-     * {@link ServiceLocator#getService(Class)}.
+     * {@link ObjectLocator#getService(Class)}.
      * <p>
      * Contributes "Value", which injects values (not services) triggered by the {@link Value}
      * annotation.
@@ -137,7 +128,7 @@
         {
 
             public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider,
-                    ServiceLocator locator)
+                    ObjectLocator locator)
             {
                 return locator.getService(objectType);
             }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/java/org/apache/tapestry/ioc/test/IOCTestCase.java Mon Apr 23 18:58:49 2007
@@ -36,7 +36,7 @@
 import org.apache.tapestry.ioc.Resource;
 import org.apache.tapestry.ioc.ServiceBuilderResources;
 import org.apache.tapestry.ioc.ServiceDecorator;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.ServiceResources;
 import org.apache.tapestry.ioc.def.ContributionDef;
 import org.apache.tapestry.ioc.def.DecoratorDef;
@@ -189,9 +189,9 @@
         return newMock(ServiceDef.class);
     }
 
-    protected final ServiceLocator mockServiceLocator()
+    protected final ObjectLocator mockObjectLocator()
     {
-        return newMock(ServiceLocator.class);
+        return newMock(ObjectLocator.class);
     }
 
     protected final ServiceResources mockServiceResources()
@@ -294,13 +294,13 @@
         expect(r.getPath()).andReturn(path).atLeastOnce();
     }
 
-    protected final <T> void train_getService(ServiceLocator locator, Class<T> serviceInterface,
+    protected final <T> void train_getService(ObjectLocator locator, Class<T> serviceInterface,
             T service)
     {
         expect(locator.getService(serviceInterface)).andReturn(service);
     }
 
-    protected final <T> void train_getService(ServiceLocator locator, String serviceId,
+    protected final <T> void train_getService(ObjectLocator locator, String serviceId,
             Class<T> serviceInterface, T service)
     {
         expect(locator.getService(serviceId, serviceInterface)).andReturn(service);
@@ -346,7 +346,7 @@
     }
 
     protected final <T> void train_provide(ObjectProvider provider, Class<T> objectType,
-            AnnotationProvider annotationProvider, ServiceLocator locator, T object)
+            AnnotationProvider annotationProvider, ObjectLocator locator, T object)
     {
         expect(provider.provide(objectType, annotationProvider, locator)).andReturn(object);
     }

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/IOCStrings.properties Mon Apr 23 18:58:49 2007
@@ -79,5 +79,6 @@
  no-constructor=Class %s (implementation of service '%s') does not contain any public constructors.
  bind-method-must-be-static=Method %s appears to be a service binder method, but is an instance method, not a static method.
  error-in-bind-method=Error invoking service binder method %s: %s
- 
+no-autobuild-constructor=Class %s does not contain a public constructor needed to autobuild.
+autobuild-constructor-error=Error invoking constructor %s: %s
  

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/services/ServiceStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/services/ServiceStrings.properties?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/services/ServiceStrings.properties (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/main/resources/org/apache/tapestry/ioc/internal/services/ServiceStrings.properties Mon Apr 23 18:58:49 2007
@@ -39,3 +39,4 @@
 missing-symbol-close-brace-in-path=Input string '%s' is missing a symbol closing brace (in %s).
 failed-coercion=Coercion of %s to type %s (via %s) failed: %s
 registry-shutdown=Proxy for service %s is no longer active because the IOC Registry has been shut down.
+service-build-failure=Exception constructing service '%s': %s
\ No newline at end of file

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/configuration.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/configuration.apt?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/configuration.apt (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/configuration.apt Mon Apr 23 18:58:49 2007
@@ -236,7 +236,7 @@
   other things to be injected.
   
   
-  * {{{apidocs/org/apache/tapestry/ioc/ServiceLocator.html}ServiceLocator}}:  access to other services visible
+  * {{{apidocs/org/apache/tapestry/ioc/ObjectLocator.html}ObjectLocator}}:  access to other services visible
   to the contributing module
   
   []

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/module.apt Mon Apr 23 18:58:49 2007
@@ -134,7 +134,7 @@
       
   * org.apache.commons.logging.Log: log for the module (derived from the module's class name)
    
-  * {{{apidocs/org/apache/tapestry/ioc/ServiceLocator.html}ServiceLocator}}:  access to other services
+  * {{{apidocs/org/apache/tapestry/ioc/ObjectLocator.html}ObjectLocator}}:  access to other services
   
   []
   

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/site/apt/service.apt Mon Apr 23 18:58:49 2007
@@ -133,12 +133,16 @@
   Here we've annotated the parameters of the service builder method to identify what
   service to inject for that parameter.  
   
+  This is an example of when you would want to use the service builder method, rather than
+  just binding the service interface to the implementation class: because we want to do something extra,
+  in this case, register the new indexer service with the scheduler.
+  
   Note that we don't invoke those service builder methods ... we just "advertise" that we need
   the named services.  Tapestry IoC will provide the necessary proxies and, when we start to
   invoke methods on those proxies, will ensure that the full service, including its
   interceptors and its dependencies, are ready to go. Again, this is done in a 
   thread-safe manner.   
-  
+
   What happens if there is more than one service that implements the JobScheduler interface, or
   the FileSystem interface?  You'll see a runtime exception, because Tapestry is unable to resolve
   it down to a <single> service. At this point, it is necessary to <disambiguate> the link between
@@ -166,6 +170,7 @@
   (or service decorator) methods, you can 
   {{{module.html#Caching Services}cache dependency injections}} in your module, by defining
   a constructor.  This reduces duplication in your module.
+ 
   
 Injecting Dependencies for Autobuilt Services
 
@@ -375,9 +380,23 @@
   of a service dependency on the fly.  However, in the general case (where the
   id of service dependencies is known at build time), it is easier
   to use the @InjectService annotation.
-  
+      
   The Log's name (used when configuring logging settings for the service) consists of
-  the module class name and the service id seperated by a period, i.e. "org.example.myapp.MyModule.Indexer".  
+  the module class name and the service id seperated by a period, i.e. "org.example.myapp.MyModule.Indexer". 
+  
+  Further, ServiceResources includes an autobuild() method that allows you to easily trigger
+  the construction of a class, including dependencies.  Thus the previos example could be rewritten as:
+  
++-----------------------------------------------------------------------------------+
+  public static Indexer build(ServiceResources resources, JobScheduler jobScheduler)
+  {
+    IndexerImpl indexer = resources.autobuild(IndexerImpl.class);
+      
+    scheduler.scheduleDailyJob(resources.getServiceId(), indexer);
+
+    return indexer;
+  }
++-----------------------------------------------------------------------------------+  
   
   This works the exact same way with autobuilt services, except that the parameters of the service
   implementation constructor are considered, rather than the parameters of the service

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/conf/testng.xml
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/conf/testng.xml?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/conf/testng.xml (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/conf/testng.xml Mon Apr 23 18:58:49 2007
@@ -15,7 +15,7 @@
    limitations under the License.
 -->
 
-<suite name="Tapestry IOC" parallel="false" thread-count="10" annotations="1.5" verbose="2">
+<suite name="Tapestry IOC" parallel="false" annotations="1.5" verbose="0">
   <test name="Tapestry IOC">
     <packages>
       <package name="org.apache.tapestry.ioc"/>

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/DuplicateServiceTypeModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/DuplicateServiceTypeModule.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/DuplicateServiceTypeModule.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/DuplicateServiceTypeModule.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,29 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+public class DuplicateServiceTypeModule
+{
+    public Runnable buildFred()
+    {
+        return null;
+    }
+
+    public Runnable buildBarney()
+    {
+        return null;
+    }
+
+}

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/FailInConstructorRunnable.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/FailInConstructorRunnable.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/FailInConstructorRunnable.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/FailInConstructorRunnable.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,28 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+public class FailInConstructorRunnable implements Runnable
+{
+    public FailInConstructorRunnable()
+    {
+        throw new RuntimeException("Failure in Runnable constructor.");
+    }
+
+    public void run()
+    {
+    }
+
+}

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/Greeter.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/Greeter.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/Greeter.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/Greeter.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,20 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+public interface Greeter
+{
+    String getGreeting();
+}

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/GreeterModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/GreeterModule.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/GreeterModule.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/GreeterModule.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,53 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+import org.apache.tapestry.ioc.annotations.InjectService;
+
+public class GreeterModule
+{
+    public Greeter buildHelloGreeter()
+    {
+        return new Greeter()
+        {
+            public String getGreeting()
+            {
+                return "Hello";
+            }
+        };
+    }
+
+    public Greeter buildGoodbyeGreeter()
+    {
+        return new Greeter()
+        {
+            public String getGreeting()
+            {
+                return "Goodbye";
+            }
+        };
+    }
+
+    public Greeter buildGreeter(@InjectService("${greeter}")
+    Greeter greeter)
+    {
+        return greeter;
+    }
+
+    public void contributeApplicationDefaults(MappedConfiguration<String, String> configuration)
+    {
+        configuration.add("greeter", "HelloGreeter");
+    }
+}

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/IntegrationTest.java Mon Apr 23 18:58:49 2007
@@ -14,6 +14,7 @@
 
 package org.apache.tapestry.ioc;
 
+import java.sql.PreparedStatement;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -318,7 +319,9 @@
     @Test
     public void eager_service_loading()
     {
-        assertFalse(EagerLoadModule._eagerLoadDidHappen);
+        assertFalse(
+                EagerLoadModule._eagerLoadDidHappen,
+                "EagerLoadModule is not in correct initial state.");
 
         Registry r = buildRegistry(EagerLoadModule.class);
 
@@ -387,4 +390,184 @@
 
         assertTrue(holder instanceof StringHolderImpl);
     }
+
+    @Test
+    public void service_builder_method_uses_autobuild()
+    {
+        Registry r = buildRegistry(ServiceBuilderAutobuilderModule.class);
+
+        StringHolder holder = r.getService(StringHolder.class);
+
+        // Check that it works.
+
+        holder.setValue("Foo");
+
+        assertEquals(holder.getValue(), "Foo");
+    }
+
+    @Test
+    public void autobuild_via_registry()
+    {
+        Registry r = buildRegistry();
+
+        StringHolder holder = r.autobuild(StringHolderImpl.class);
+
+        assertSame(holder.getClass(), StringHolderImpl.class);
+
+        // Check that it works.
+
+        holder.setValue("Foo");
+
+        assertEquals(holder.getValue(), "Foo");
+    }
+
+    @Test
+    public void service_builder_method_uses_autobuild_with_failure()
+    {
+        Registry r = buildRegistry(ServiceBuilderAutobuilderModule.class);
+
+        // We can get the proxy.
+
+        Runnable runnable = r.getService(Runnable.class);
+
+        try
+        {
+            // But it fails at realization
+
+            runnable.run();
+
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(
+                    ex,
+                    "Class org.apache.tapestry.ioc.UnbuildableRunnable does not contain a public constructor needed to autobuild.");
+
+            // Like to check that the message includes the source location
+
+            assertTrue(ex.getMessage().matches(
+                    ".*\\(at ServiceBuilderAutobuilderModule.java:\\d+\\).*"));
+        }
+    }
+
+    @Test
+    public void autobuild_via_registry_no_constructor()
+    {
+        Registry r = buildRegistry();
+
+        try
+        {
+            r.autobuild(UnbuildableRunnable.class);
+
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(
+                    ex,
+                    "Class org.apache.tapestry.ioc.UnbuildableRunnable does not contain a public constructor needed to autobuild.");
+        }
+    }
+
+    @Test
+    public void autobuild_via_registry_constructor_exception()
+    {
+        Registry r = buildRegistry();
+
+        try
+        {
+            r.autobuild(FailInConstructorRunnable.class);
+
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(
+                    ex,
+                    "Error invoking constructor org.apache.tapestry.ioc.FailInConstructorRunnable()",
+                    "Failure in Runnable constructor.");
+
+            // Like to check that the message includes the source location
+
+            assertTrue(ex.getMessage().matches(".*\\(at FailInConstructorRunnable.java:\\d+\\).*"));
+        }
+    }
+
+    @Test
+    public void get_service_by_unknown_id()
+    {
+        Registry r = buildRegistry();
+
+        try
+        {
+            r.getService("PeekABoo", Runnable.class);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertMessageContains(ex, "Service id \'PeekABoo\' is not defined by any module.");
+        }
+    }
+
+    @Test
+    public void request_service_by_type_with_no_matches()
+    {
+
+        Registry r = buildRegistry();
+
+        try
+        {
+            r.getService(PreparedStatement.class);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(
+                    ex.getMessage(),
+                    "No service implements the interface java.sql.PreparedStatement.");
+        }
+    }
+
+    @Test
+    public void request_service_by_type_with_multiple_matches()
+    {
+        Registry r = buildRegistry(DuplicateServiceTypeModule.class);
+
+        try
+        {
+            r.getService(Runnable.class);
+            unreachable();
+        }
+        catch (RuntimeException ex)
+        {
+            assertEquals(
+                    ex.getMessage(),
+                    "Service interface java.lang.Runnable is matched by 2 services: Barney, Fred.  Automatic dependency resolution requires that exactly one service implement the interface.");
+        }
+
+    }
+
+    @Test
+    public void symbol_in_inject_annotation_is_expanded()
+    {
+        Registry r = buildRegistry(GreeterModule.class);
+
+        Greeter g = r.getService("Greeter", Greeter.class);
+
+        assertEquals(g.getGreeting(), "Hello");
+        assertEquals(g.toString(), "<Proxy for Greeter(org.apache.tapestry.ioc.Greeter)>");
+    }
+
+    @Test
+    public void symbol_in_registry_call_for_service_is_expanded()
+    {
+        Registry r = buildRegistry(GreeterModule.class);
+
+        Greeter g = r.getService("${greeter}", Greeter.class);
+
+        assertEquals(g.getGreeting(), "Hello");
+        assertEquals(g.toString(), "<Proxy for HelloGreeter(org.apache.tapestry.ioc.Greeter)>");
+    }
+
 }

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/ServiceBuilderAutobuilderModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/ServiceBuilderAutobuilderModule.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/ServiceBuilderAutobuilderModule.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/ServiceBuilderAutobuilderModule.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,28 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+public class ServiceBuilderAutobuilderModule
+{
+    public StringHolder build(ServiceResources resources)
+    {
+        return resources.autobuild(StringHolderImpl.class);
+    }
+
+    public Runnable buildRunnable(ServiceResources resources)
+    {
+        return resources.autobuild(UnbuildableRunnable.class);
+    }
+}

Added: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnbuildableRunnable.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnbuildableRunnable.java?view=auto&rev=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnbuildableRunnable.java (added)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/UnbuildableRunnable.java Mon Apr 23 18:58:49 2007
@@ -0,0 +1,30 @@
+// Copyright 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.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package org.apache.tapestry.ioc;
+
+/**
+ * Used to test failure to autobuild a service because of a lack of a public constructor.
+ */
+public class UnbuildableRunnable implements Runnable
+{
+    private UnbuildableRunnable()
+    {
+    }
+
+    public void run()
+    {
+    }
+
+}

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ContributionDefImplTest.java Mon Apr 23 18:58:49 2007
@@ -24,7 +24,7 @@
 import org.apache.tapestry.ioc.MappedConfiguration;
 import org.apache.tapestry.ioc.ModuleBuilderSource;
 import org.apache.tapestry.ioc.OrderedConfiguration;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.apache.tapestry.ioc.def.ContributionDef;
 import org.apache.tapestry.ioc.test.IOCTestCase;
@@ -45,7 +45,7 @@
     {
         _toContribute = new Object();
         Configuration configuration = mockConfiguration();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
 
         configuration.add(_toContribute);
 
@@ -64,7 +64,7 @@
     public void unordered_collection_with_service_lookup()
     {
         Configuration configuration = mockConfiguration();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         UpcaseService service = mockUpcaseService();
 
         train_getService(locator, "zip.Zap", UpcaseService.class, service);
@@ -85,7 +85,7 @@
     public void unordered_collection_with_incorrect_configuration_parameter()
     {
         Configuration configuration = mockConfiguration();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
 
         Throwable t = new RuntimeException("Missing service.");
 
@@ -120,7 +120,7 @@
     public void ordered_collection_with_service_lookup()
     {
         OrderedConfiguration configuration = mockOrderedConfiguration();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         UpcaseService service = mockUpcaseService();
 
         train_getService(locator, "zip.Zap", UpcaseService.class, service);
@@ -142,7 +142,7 @@
     public void mapped_collection_with_service_lookup()
     {
         MappedConfiguration configuration = mockMappedConfiguration();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         UpcaseService service = mockUpcaseService();
 
         train_getService(locator, "zip.Zap", UpcaseService.class, service);

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/ModuleImplTest.java Mon Apr 23 18:58:49 2007
@@ -44,7 +44,7 @@
         ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log,
                 getClassFactory());
 
-        Module module = new ModuleImpl(registry, moduleDef, log);
+        Module module = new ModuleImpl(registry, moduleDef, null, log);
 
         expect(registry.logForService("Upcase")).andReturn(log);
 
@@ -84,7 +84,7 @@
 
         ModuleDef moduleDef = new DefaultModuleDefImpl(ModuleImplTestModule.class, log, null);
 
-        Module module = new ModuleImpl(registry, moduleDef, log);
+        Module module = new ModuleImpl(registry, moduleDef, null, log);
 
         replay();
 
@@ -119,7 +119,7 @@
 
         replay();
 
-        Module module = new ModuleImpl(registry, moduleDef, log);
+        Module module = new ModuleImpl(registry, moduleDef, null, log);
 
         Set<DecoratorDef> defs = module.findMatchingDecoratorDefs(serviceDef);
 
@@ -138,7 +138,7 @@
 
         replay();
 
-        Module module = new ModuleImpl(registry, def, log);
+        Module module = new ModuleImpl(registry, def, null, log);
 
         try
         {
@@ -164,7 +164,7 @@
         Log log = mockLog();
         ModuleDef def = new DefaultModuleDefImpl(ExtraPublicConstructorsModule.class, log, null);
         ClassFactory factory = newMock(ClassFactory.class);
-        Module module = new ModuleImpl(registry, def, log);
+        Module module = new ModuleImpl(registry, def, null, log);
 
         log.warn(contains("contains more than one public constructor"));
 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImplTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImplTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ThreadLocaleImplTest.java Mon Apr 23 18:58:49 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.
@@ -25,7 +25,9 @@
 {
     private ThreadLocale _threadLocale;
 
-    private static final Locale FAKE_LOCALE = new Locale("klingon");
+    private static final Locale FAKE_LOCALE1 = new Locale("klingon");
+
+    private static final Locale FAKE_LOCALE2 = new Locale("ferrengi");
 
     @BeforeClass
     public void setup()
@@ -38,9 +40,9 @@
     {
         final Locale initial = _threadLocale.getLocale();
 
-        _threadLocale.setLocale(FAKE_LOCALE);
+        _threadLocale.setLocale(FAKE_LOCALE1);
 
-        assertSame(_threadLocale.getLocale(), FAKE_LOCALE);
+        assertSame(_threadLocale.getLocale(), FAKE_LOCALE1);
 
         Runnable r = new Runnable()
         {
@@ -54,14 +56,15 @@
 
         t.start();
         t.join();
+
+        cleanupThread();
     }
 
-    @Test
     public void thread_locale_reverts_after_cleanup()
     {
         Locale initial = _threadLocale.getLocale();
 
-        _threadLocale.setLocale(FAKE_LOCALE);
+        _threadLocale.setLocale(FAKE_LOCALE2);
 
         cleanupThread();
 

Modified: tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java (original)
+++ tapestry/tapestry5/tapestry-ioc/trunk/src/test/java/org/apache/tapestry/ioc/internal/services/ValueObjectProviderTest.java Mon Apr 23 18:58:49 2007
@@ -17,7 +17,7 @@
 import java.lang.annotation.Annotation;
 
 import org.apache.tapestry.ioc.AnnotationProvider;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.Value;
 import org.apache.tapestry.ioc.services.SymbolSource;
 import org.apache.tapestry.ioc.services.TypeCoercer;
@@ -32,7 +32,7 @@
         SymbolSource symbolSource = mockSymbolSource();
         TypeCoercer coercer = mockTypeCoercer();
         AnnotationProvider annotationProvider = mockAnnotationProvider();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
 
         train_getAnnotation(annotationProvider, Value.class, null);
 
@@ -51,7 +51,7 @@
         SymbolSource symbolSource = mockSymbolSource();
         TypeCoercer coercer = mockTypeCoercer();
         AnnotationProvider annotationProvider = mockAnnotationProvider();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         String annotationValue = "${foo}";
         String expanded = "Foo";
         Runnable coerced = mockRunnable();

Modified: tapestry/tapestry5/tapestry-project/trunk/src/site/apt/index.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-project/trunk/src/site/apt/index.apt?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-project/trunk/src/site/apt/index.apt (original)
+++ tapestry/tapestry5/tapestry-project/trunk/src/site/apt/index.apt Mon Apr 23 18:58:49 2007
@@ -94,13 +94,10 @@
   
 New and Noteworthy
 
-  Another pass at simplifying and improving {{{tapestry-ioc/}tapestry-ioc}}, using ideas
-  from {{{http://code.google.com/p/google-guice/}Guice}}. The idea is to combine
-  @Inject with other annotations to supply overrding details (but @Inject on its own
-  is usually sufficient).
-
   The {{{tapestry-ioc/}tapestry-ioc}} module has been simplified, removing the concept
-  of module ids and namespaces, as well as private services.
+  of module ids and namespaces, as well as private services, and borrowing a lot of cool
+  ideas from {{{http://code.google.com/p/google-guice/}Guice}}. The goal is to make the container
+  all but invisible.
 
   Work has been started on {{{http://hibernate.org}Hibernate}} integration in the
   new {{{tapestry-hibernate/}tapestry-hibernate}} module.

Modified: tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringObjectProvider.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringObjectProvider.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringObjectProvider.java (original)
+++ tapestry/tapestry5/tapestry-spring/trunk/src/main/java/org/apache/tapestry/spring/SpringObjectProvider.java Mon Apr 23 18:58:49 2007
@@ -21,7 +21,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.ObjectProvider;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.ioc.annotations.InjectService;
 import org.springframework.web.context.WebApplicationContext;
 
@@ -67,7 +67,7 @@
      * The expression is the name of a spring bean inside the context.
      */
     public <T> T provide(Class<T> objectType, AnnotationProvider annotationProvider,
-            ServiceLocator locator)
+            ObjectLocator locator)
     {
         SpringBean annotation = annotationProvider.getAnnotation(SpringBean.class);
 

Modified: tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java?view=diff&rev=531674&r1=531673&r2=531674
==============================================================================
--- tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java (original)
+++ tapestry/tapestry5/tapestry-spring/trunk/src/test/java/org/apache/tapestry/spring/SpringObjectProviderTest.java Mon Apr 23 18:58:49 2007
@@ -17,7 +17,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.tapestry.ioc.AnnotationProvider;
 import org.apache.tapestry.ioc.ObjectProvider;
-import org.apache.tapestry.ioc.ServiceLocator;
+import org.apache.tapestry.ioc.ObjectLocator;
 import org.apache.tapestry.test.TapestryTestCase;
 import org.springframework.web.context.WebApplicationContext;
 import org.testng.annotations.Test;
@@ -33,7 +33,7 @@
     {
         Log log = mockLog();
         WebApplicationContext webContext = newWebApplicationContext();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         Throwable t = new RuntimeException("Simulated failure.");
         AnnotationProvider annotationProvider = mockAnnotationProvider();
         SpringBean annotation = newSpringBean(BEAN_NAME);
@@ -80,7 +80,7 @@
     {
         Log log = mockLog();
         WebApplicationContext webContext = newWebApplicationContext();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         AnnotationProvider annotationProvider = mockAnnotationProvider();
         SpringBean annotation = newSpringBean(BEAN_NAME);
 
@@ -108,7 +108,7 @@
     {
         Log log = mockLog();
         WebApplicationContext webContext = newWebApplicationContext();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         SampleBean bean = newMock(SampleBean.class);
         AnnotationProvider annotationProvider = mockAnnotationProvider();
         SpringBean annotation = newSpringBean(BEAN_NAME.toUpperCase());
@@ -135,7 +135,7 @@
     {
         Log log = mockLog();
         WebApplicationContext webContext = newWebApplicationContext();
-        ServiceLocator locator = mockServiceLocator();
+        ObjectLocator locator = mockObjectLocator();
         AnnotationProvider annotationProvider = mockAnnotationProvider();
         SpringBean annotation = newSpringBean(BEAN_NAME);