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 2010/01/02 04:44:57 UTC

svn commit: r895114 - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry5/internal/beaneditor/ main/java/org/apache/tapestry5/internal/services/ test/java/org/apache/tapestry5/internal/services/

Author: hlship
Date: Sat Jan  2 03:44:55 2010
New Revision: 895114

URL: http://svn.apache.org/viewvc?rev=895114&view=rev
Log:
TAP5-914: When autobuilding a Java bean (such as a Session State Object), the code should use the OperationTracker

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BeanModelSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImplTest.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java?rev=895114&r1=895113&r2=895114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/beaneditor/BeanModelImpl.java Sat Jan  2 03:44:55 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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.
@@ -19,8 +19,10 @@
 import org.apache.tapestry5.beaneditor.PropertyModel;
 import org.apache.tapestry5.beaneditor.RelativePosition;
 import org.apache.tapestry5.internal.services.CoercingPropertyConduitWrapper;
+import org.apache.tapestry5.ioc.Invokable;
 import org.apache.tapestry5.ioc.Messages;
 import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.OperationTracker;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.Defense;
 import org.apache.tapestry5.ioc.services.ClassFabUtils;
@@ -42,17 +44,17 @@
 
     private final ObjectLocator locator;
 
+    private final OperationTracker tracker;
+
     private final Map<String, PropertyModel> properties = CollectionFactory.newCaseInsensitiveMap();
 
     // The list of property names, in desired order (generally not alphabetical order).
 
     private final List<String> propertyNames = CollectionFactory.newList();
 
-    public BeanModelImpl(
-            Class<T> beanType, PropertyConduitSource
-            propertyConduitSource,
-            TypeCoercer typeCoercer, Messages
-            messages, ObjectLocator locator)
+    public BeanModelImpl(Class<T> beanType, PropertyConduitSource propertyConduitSource,
+            TypeCoercer typeCoercer, Messages messages, ObjectLocator locator,
+            OperationTracker tracker)
 
     {
         this.beanType = beanType;
@@ -60,6 +62,7 @@
         this.typeCoercer = typeCoercer;
         this.messages = messages;
         this.locator = locator;
+        this.tracker = tracker;
     }
 
     public Class<T> getBeanType()
@@ -69,7 +72,14 @@
 
     public T newInstance()
     {
-        return locator.autobuild(beanType);
+        return tracker.invoke("Instantiating new instance of " + beanType.getName(),
+                new Invokable<T>()
+                {
+                    public T invoke()
+                    {
+                        return locator.autobuild(beanType);
+                    }
+                });
     }
 
     public PropertyModel add(String propertyName)
@@ -84,13 +94,12 @@
         Defense.notBlank(propertyName, "propertyName");
 
         if (properties.containsKey(propertyName))
-            throw new RuntimeException(BeanEditorMessages.duplicatePropertyName(
-                    beanType,
+            throw new RuntimeException(BeanEditorMessages.duplicatePropertyName(beanType,
                     propertyName));
     }
 
     public PropertyModel add(RelativePosition position, String existingPropertyName,
-                             String propertyName, PropertyConduit conduit)
+            String propertyName, PropertyConduit conduit)
     {
         Defense.notNull(position, "position");
 
@@ -116,7 +125,7 @@
     }
 
     public PropertyModel add(RelativePosition position, String existingPropertyName,
-                             String propertyName)
+            String propertyName)
     {
         PropertyConduit conduit = createConduit(propertyName);
 
@@ -141,7 +150,7 @@
     private CoercingPropertyConduitWrapper createConduit(String propertyName)
     {
         return new CoercingPropertyConduitWrapper(propertyConduitSource.create(beanType,
-                                                                               propertyName), typeCoercer);
+                propertyName), typeCoercer);
     }
 
     public PropertyModel get(String propertyName)
@@ -149,9 +158,8 @@
         PropertyModel propertyModel = properties.get(propertyName);
 
         if (propertyModel == null)
-            throw new RuntimeException(BeanEditorMessages.unknownProperty(beanType,
-                                                                          propertyName,
-                                                                          properties.keySet()));
+            throw new RuntimeException(BeanEditorMessages.unknownProperty(beanType, propertyName,
+                    properties.keySet()));
 
         return propertyModel;
     }
@@ -160,7 +168,8 @@
     {
         for (PropertyModel model : properties.values())
         {
-            if (model.getId().equalsIgnoreCase(propertyId)) return model;
+            if (model.getId().equalsIgnoreCase(propertyId))
+                return model;
         }
 
         // Not found, so we throw an exception. A bit of work to set
@@ -173,8 +182,7 @@
             ids.add(model.getId());
         }
 
-        throw new RuntimeException(BeanEditorMessages.unknownPropertyId(beanType,
-                                                                        propertyId, ids));
+        throw new RuntimeException(BeanEditorMessages.unknownPropertyId(beanType, propertyId, ids));
 
     }
 
@@ -189,7 +197,8 @@
         {
             PropertyModel model = properties.get(propertyName);
 
-            if (model == null) continue;
+            if (model == null)
+                continue;
 
             // De-referencing from the model is needed because the name provided may not be a
             // case-exact match, so we get the normalized or canonical name from the model because
@@ -234,7 +243,6 @@
         List<String> reorderedPropertyNames = CollectionFactory.newList();
         Map<String, PropertyModel> reduced = CollectionFactory.newCaseInsensitiveMap();
 
-
         for (String name : propertyNames)
         {
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImpl.java?rev=895114&r1=895113&r2=895114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImpl.java Sat Jan  2 03:44:55 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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.
@@ -14,7 +14,11 @@
 
 package org.apache.tapestry5.internal.services;
 
+import org.apache.tapestry5.ioc.Invokable;
 import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.OperationTracker;
+import org.apache.tapestry5.ioc.ServiceResources;
+
 import static org.apache.tapestry5.ioc.internal.util.CollectionFactory.newConcurrentMap;
 import org.apache.tapestry5.services.*;
 
@@ -33,7 +37,7 @@
         private final ApplicationStateCreator<T> creator;
 
         ApplicationStateAdapter(Class<T> ssoClass, ApplicationStatePersistenceStrategy strategy,
-                                ApplicationStateCreator<T> creator)
+                ApplicationStateCreator<T> creator)
         {
             this.ssoClass = ssoClass;
             this.strategy = strategy;
@@ -57,7 +61,8 @@
     }
 
     /**
-     * The map will be extended periodically as new ASOs, not in the configuration, are encountered. Thut is is thread
+     * The map will be extended periodically as new ASOs, not in the configuration, are encountered.
+     * Thut is is thread
      * safe.
      */
     private final Map<Class, ApplicationStateAdapter> classToAdapter = newConcurrentMap();
@@ -66,19 +71,23 @@
 
     private final ObjectLocator locator;
 
+    private final OperationTracker tracker;
+
     @SuppressWarnings("unchecked")
     public ApplicationStateManagerImpl(Map<Class, ApplicationStateContribution> configuration,
-                                       ApplicationStatePersistenceStrategySource source, ObjectLocator locator)
+            ApplicationStatePersistenceStrategySource source, ObjectLocator locator,
+            OperationTracker tracker)
     {
         this.source = source;
         this.locator = locator;
+        this.tracker = tracker;
 
         for (Class asoClass : configuration.keySet())
         {
             ApplicationStateContribution contribution = configuration.get(asoClass);
 
             ApplicationStateAdapter adapter = newAdapter(asoClass, contribution.getStrategy(),
-                                                         contribution.getCreator());
+                    contribution.getCreator());
 
             classToAdapter.put(asoClass, adapter);
         }
@@ -87,7 +96,7 @@
 
     @SuppressWarnings("unchecked")
     private <T> ApplicationStateAdapter<T> newAdapter(final Class<T> ssoClass, String strategyName,
-                                                      ApplicationStateCreator<T> creator)
+            ApplicationStateCreator<T> creator)
     {
         if (creator == null)
         {
@@ -95,7 +104,14 @@
             {
                 public T create()
                 {
-                    return locator.autobuild(ssoClass);
+                    return tracker.invoke("Instantiating instance of SSO class "
+                            + ssoClass.getName(), new Invokable<T>()
+                    {
+                        public T invoke()
+                        {
+                            return locator.autobuild(ssoClass);
+                        }
+                    });
                 }
             };
         }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BeanModelSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BeanModelSourceImpl.java?rev=895114&r1=895113&r2=895114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BeanModelSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/BeanModelSourceImpl.java Sat Jan  2 03:44:55 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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.
@@ -14,6 +14,10 @@
 
 package org.apache.tapestry5.internal.services;
 
+import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.List;
+
 import org.apache.tapestry5.beaneditor.BeanModel;
 import org.apache.tapestry5.beaneditor.NonVisual;
 import org.apache.tapestry5.beaneditor.ReorderProperties;
@@ -21,20 +25,20 @@
 import org.apache.tapestry5.internal.beaneditor.BeanModelUtils;
 import org.apache.tapestry5.ioc.Location;
 import org.apache.tapestry5.ioc.Messages;
-import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.ServiceResources;
 import org.apache.tapestry5.ioc.annotations.Primary;
 import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry5.ioc.internal.util.Defense;
-import org.apache.tapestry5.ioc.services.*;
+import org.apache.tapestry5.ioc.services.ClassFactory;
+import org.apache.tapestry5.ioc.services.ClassPropertyAdapter;
+import org.apache.tapestry5.ioc.services.PropertyAccess;
+import org.apache.tapestry5.ioc.services.PropertyAdapter;
+import org.apache.tapestry5.ioc.services.TypeCoercer;
 import org.apache.tapestry5.services.BeanModelSource;
 import org.apache.tapestry5.services.ComponentLayer;
 import org.apache.tapestry5.services.DataTypeAnalyzer;
 import org.apache.tapestry5.services.PropertyConduitSource;
 
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-
 public class BeanModelSourceImpl implements BeanModelSource
 {
     private final TypeCoercer typeCoercer;
@@ -47,8 +51,7 @@
 
     private final DataTypeAnalyzer dataTypeAnalyzer;
 
-    private final ObjectLocator locator;
-
+    private final ServiceResources resources;
 
     private static class PropertyOrder implements Comparable<PropertyOrder>
     {
@@ -69,17 +72,21 @@
         {
             int result = classDepth - o.classDepth;
 
-            if (result == 0) result = sortKey - o.sortKey;
+            if (result == 0)
+                result = sortKey - o.sortKey;
 
-            if (result == 0) result = propertyName.compareTo(o.propertyName);
+            if (result == 0)
+                result = propertyName.compareTo(o.propertyName);
 
             return result;
         }
     }
 
     /**
-     * @param classAdapter  defines the bean that contains the properties
-     * @param propertyNames the initial set of property names, which will be rebuilt in the correct order
+     * @param classAdapter
+     *            defines the bean that contains the properties
+     * @param propertyNames
+     *            the initial set of property names, which will be rebuilt in the correct order
      */
     private void orderProperties(ClassPropertyAdapter classAdapter, List<String> propertyNames)
     {
@@ -123,15 +130,16 @@
     }
 
     public BeanModelSourceImpl(TypeCoercer typeCoercer, PropertyAccess propertyAccess,
-                               PropertyConduitSource propertyConduitSource, @ComponentLayer ClassFactory classFactory,
-                               @Primary DataTypeAnalyzer dataTypeAnalyzer, ObjectLocator locator)
+            PropertyConduitSource propertyConduitSource, @ComponentLayer
+            ClassFactory classFactory, @Primary
+            DataTypeAnalyzer dataTypeAnalyzer, ServiceResources resources)
     {
         this.typeCoercer = typeCoercer;
         this.propertyAccess = propertyAccess;
         this.propertyConduitSource = propertyConduitSource;
         this.classFactory = classFactory;
         this.dataTypeAnalyzer = dataTypeAnalyzer;
-        this.locator = locator;
+        this.resources = resources;
     }
 
     public <T> BeanModel<T> createDisplayModel(Class<T> beanClass, Messages messages)
@@ -144,31 +152,36 @@
         return create(beanClass, true, messages);
     }
 
-    public <T> BeanModel<T> create(Class<T> beanClass, boolean filterReadOnlyProperties, Messages messages)
+    public <T> BeanModel<T> create(Class<T> beanClass, boolean filterReadOnlyProperties,
+            Messages messages)
     {
         Defense.notNull(beanClass, "beanClass");
         Defense.notNull(messages, "messages");
 
         ClassPropertyAdapter adapter = propertyAccess.getAdapter(beanClass);
 
-        BeanModel<T> model = new BeanModelImpl<T>(beanClass, propertyConduitSource, typeCoercer, messages,
-                                                  locator);
+        BeanModel<T> model = new BeanModelImpl<T>(beanClass, propertyConduitSource, typeCoercer,
+                messages, resources, resources.getTracker());
 
         for (final String propertyName : adapter.getPropertyNames())
         {
             PropertyAdapter pa = adapter.getPropertyAdapter(propertyName);
 
-            if (!pa.isRead()) continue;
+            if (!pa.isRead())
+                continue;
 
-            if (pa.getAnnotation(NonVisual.class) != null) continue;
+            if (pa.getAnnotation(NonVisual.class) != null)
+                continue;
 
-            if (filterReadOnlyProperties && !pa.isUpdate()) continue;
+            if (filterReadOnlyProperties && !pa.isUpdate())
+                continue;
 
             final String dataType = dataTypeAnalyzer.identifyDataType(pa);
 
             // If an unregistered type, then ignore the property.
 
-            if (dataType == null) continue;
+            if (dataType == null)
+                continue;
 
             model.add(propertyName).dataType(dataType);
         }
@@ -191,7 +204,6 @@
             BeanModelUtils.reorder(model, reorderAnnotation.value());
         }
 
-
         return model;
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java?rev=895114&r1=895113&r2=895114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/SessionApplicationStatePersistenceStrategy.java Sat Jan  2 03:44:55 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008, 2009 The Apache Software Foundation
+// Copyright 2007, 2008, 2009, 2010 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.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImplTest.java?rev=895114&r1=895113&r2=895114&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry5/internal/services/ApplicationStateManagerImplTest.java Sat Jan  2 03:44:55 2010
@@ -1,4 +1,4 @@
-// Copyright 2007, 2008 The Apache Software Foundation
+// Copyright 2007, 2008, 2010 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.
@@ -18,6 +18,7 @@
 import org.apache.tapestry5.internal.transform.pages.ReadOnlyBean;
 import org.apache.tapestry5.internal.util.Holder;
 import org.apache.tapestry5.ioc.ObjectLocator;
+import org.apache.tapestry5.ioc.internal.QuietOperationTracker;
 import org.apache.tapestry5.services.*;
 import org.easymock.EasyMock;
 import static org.easymock.EasyMock.eq;
@@ -42,9 +43,7 @@
         ReadOnlyBean aso = new ReadOnlyBean();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName,
-                                                                                                  creator));
+                new ApplicationStateContribution(strategyName, creator));
 
         train_get(source, strategyName, strategy);
 
@@ -52,7 +51,8 @@
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         assertSame(manager.get(asoClass), aso);
 
@@ -70,16 +70,15 @@
         ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName,
-                                                                                                  creator));
+                new ApplicationStateContribution(strategyName, creator));
 
         train_get(source, strategyName, strategy);
         train_exists(strategy, asoClass, false);
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         assertFalse(manager.exists(asoClass));
 
@@ -97,16 +96,15 @@
         ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName,
-                                                                                                  creator));
+                new ApplicationStateContribution(strategyName, creator));
 
         train_get(source, strategyName, strategy);
         train_exists(strategy, asoClass, true);
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         assertTrue(manager.exists(asoClass));
 
@@ -124,8 +122,7 @@
         Object aso = new ReadOnlyBean();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName));
+                new ApplicationStateContribution(strategyName));
 
         train_get(source, strategyName, strategy);
 
@@ -133,7 +130,8 @@
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         manager.set(asoClass, aso);
 
@@ -152,7 +150,6 @@
 
         train_get(source, ApplicationStateManagerImpl.DEFAULT_STRATEGY, strategy);
 
-
         IAnswer answer = new IAnswer()
         {
             public Object answer() throws Throwable
@@ -176,7 +173,8 @@
 
         Map<Class, ApplicationStateContribution> configuration = Collections.emptyMap();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, locator);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                locator, new QuietOperationTracker());
 
         Object actual = manager.get(asoClass);
 
@@ -195,16 +193,15 @@
         ApplicationStateCreator<ReadOnlyBean> creator = mockApplicationStateCreator();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName,
-                                                                                                  creator));
+                new ApplicationStateContribution(strategyName, creator));
 
         train_get(source, strategyName, strategy);
         train_exists(strategy, asoClass, false);
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         assertNull(manager.getIfExists(asoClass));
 
@@ -222,9 +219,7 @@
         ReadOnlyBean aso = new ReadOnlyBean();
 
         Map<Class, ApplicationStateContribution> configuration = Collections.singletonMap(asoClass,
-                                                                                          new ApplicationStateContribution(
-                                                                                                  strategyName,
-                                                                                                  creator));
+                new ApplicationStateContribution(strategyName, creator));
 
         train_get(source, strategyName, strategy);
         train_exists(strategy, asoClass, true);
@@ -232,7 +227,8 @@
 
         replay();
 
-        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source, null);
+        ApplicationStateManager manager = new ApplicationStateManagerImpl(configuration, source,
+                null, null);
 
         assertSame(manager.getIfExists(asoClass), aso);