From 7cb6201ad9c73ba9cc884da7358be24cba559def Mon Sep 17 00:00:00 2001 From: Till Schneidereit Date: Thu, 26 Nov 2009 01:14:24 +0100 Subject: [PATCH] Changed the way InjectionConfig's are configured: They now receive their injector reference at creation time instead of through the InjectionPoint --- src/org/swiftsuspenders/InjectionConfig.as | 4 +-- src/org/swiftsuspenders/Injector.as | 15 +++++--- .../ConstructorInjectionPoint.as | 5 ++- .../injectionpoints/InjectionPoint.as | 8 ++++- .../injectionpoints/MethodInjectionPoint.as | 10 +++--- .../NoParamsConstructorInjectionPoint.as | 2 +- .../PostConstructInjectionPoint.as | 3 +- .../injectionpoints/PropertyInjectionPoint.as | 11 +++--- .../swiftsuspenders/InjectionConfigTests.as | 34 +++++++++---------- .../ConstructorInjectionPointTests.as | 18 +++++----- .../MethodInjectionPointTest.as | 13 +++---- .../PropertyInjectionPointTests.as | 6 ++-- 12 files changed, 67 insertions(+), 62 deletions(-) diff --git a/src/org/swiftsuspenders/InjectionConfig.as b/src/org/swiftsuspenders/InjectionConfig.as index 3c139a3..84056cc 100644 --- a/src/org/swiftsuspenders/InjectionConfig.as +++ b/src/org/swiftsuspenders/InjectionConfig.as @@ -1,2 +1,2 @@ -/* * Copyright (c) 2009 the original author or authors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.swiftsuspenders { import flash.utils.Dictionary; import org.swiftsuspenders.injectionresults.IInjectionResult; import org.swiftsuspenders.injectionresults.InjectClassResult; import org.swiftsuspenders.injectionresults.InjectNullResult; import org.swiftsuspenders.injectionresults.InjectSingletonResult; import org.swiftsuspenders.injectionresults.InjectValueResult; - public class InjectionConfig { /******************************************************************************************* * public properties * *******************************************************************************************/ public var request : Class; public var response : Object; public var injectionType : int; public var injectionName : String; /******************************************************************************************* * public methods * *******************************************************************************************/ public function InjectionConfig(request : Class, response : Object, injectionType : int, injectionName : String) { this.request = request; this.response = response; this.injectionType = injectionType; this.injectionName = injectionName; } public function getResponse(injector : Injector, singletons : Dictionary) : Object { return createResultByInjectionType().getResponse(injector, singletons); } /******************************************************************************************* * private methods * *******************************************************************************************/ private function createResultByInjectionType() : IInjectionResult { switch (injectionType) { case InjectionType.CLASS: { return new InjectClassResult(this); } case InjectionType.VALUE: { return new InjectValueResult(this); } case InjectionType.SINGLETON: { return new InjectSingletonResult(this); } default: { break; } } return new InjectNullResult(); } } } \ No newline at end of file +/* * Copyright (c) 2009 the original author or authors * * Permission is hereby granted to use, modify, and distribute this file * in accordance with the terms of the license agreement accompanying it. */ package org.swiftsuspenders { import flash.utils.Dictionary; import org.swiftsuspenders.injectionresults.IInjectionResult; import org.swiftsuspenders.injectionresults.InjectClassResult; import org.swiftsuspenders.injectionresults.InjectNullResult; import org.swiftsuspenders.injectionresults.InjectSingletonResult; import org.swiftsuspenders.injectionresults.InjectValueResult; + public class InjectionConfig { /******************************************************************************************* * public properties * *******************************************************************************************/ public var request : Class; public var response : Object; public var injectionType : int; public var injectionName : String; public var injector : Injector; /******************************************************************************************* * public methods * *******************************************************************************************/ public function InjectionConfig(request : Class, response : Object, injectionType : int, injectionName : String, injector : Injector) { this.request = request; this.response = response; this.injectionType = injectionType; this.injectionName = injectionName; this.injector = injector; } public function getResponse(singletons : Dictionary) : Object { return createResultByInjectionType().getResponse(injector, singletons); } /******************************************************************************************* * private methods * *******************************************************************************************/ private function createResultByInjectionType() : IInjectionResult { switch (injectionType) { case InjectionType.CLASS: { return new InjectClassResult(this); } case InjectionType.VALUE: { return new InjectValueResult(this); } case InjectionType.SINGLETON: { return new InjectSingletonResult(this); } default: { break; } } return new InjectNullResult(); } } } \ No newline at end of file diff --git a/src/org/swiftsuspenders/Injector.as b/src/org/swiftsuspenders/Injector.as index 74a59f4..d6a67f1 100644 --- a/src/org/swiftsuspenders/Injector.as +++ b/src/org/swiftsuspenders/Injector.as @@ -52,7 +52,7 @@ package org.swiftsuspenders whenAskedFor : Class, useValue : Object, named : String = "") : * { var config : InjectionConfig = new InjectionConfig( - whenAskedFor, useValue, InjectionType.VALUE, named); + whenAskedFor, useValue, InjectionType.VALUE, named, this); addMapping(config, named); return config; } @@ -61,7 +61,7 @@ package org.swiftsuspenders whenAskedFor : Class, instantiateClass : Class, named : String = "") : * { var config : InjectionConfig = new InjectionConfig( - whenAskedFor, instantiateClass, InjectionType.CLASS, named); + whenAskedFor, instantiateClass, InjectionType.CLASS, named, this); addMapping(config, named); return config; } @@ -75,7 +75,7 @@ package org.swiftsuspenders whenAskedFor : Class, useSingletonOf : Class, named : String = "") : * { var config : InjectionConfig = new InjectionConfig( - whenAskedFor, useSingletonOf, InjectionType.SINGLETON, named); + whenAskedFor, useSingletonOf, InjectionType.SINGLETON, named, this); addMapping(config, named); return config; } @@ -117,7 +117,7 @@ package org.swiftsuspenders for (var i : int = 0; i < length; i++) { var injectionPoint : InjectionPoint = injectionPoints[i]; - injectionPoint.applyInjection(target, this, m_singletons); + injectionPoint.applyInjection(target, m_singletons); } } @@ -130,7 +130,7 @@ package org.swiftsuspenders getInjectionPoints(clazz); injectionPoint = m_constructorInjectionPoints[clazz]; } - var instance : * = injectionPoint.applyInjection(clazz, this, m_singletons); + var instance : * = injectionPoint.applyInjection(clazz, m_singletons); injectInto(instance); return instance; } @@ -148,6 +148,11 @@ package org.swiftsuspenders } } + public function createChildInjector() : Injector + { + return new Injector(); + } + /******************************************************************************************* * protected/ private methods * diff --git a/src/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as index 3f3f453..d27e1cb 100644 --- a/src/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as @@ -33,10 +33,9 @@ package org.swiftsuspenders.injectionpoints super(node, injectorMappings); } - override public function applyInjection( - target : Object, injector : Injector, singletons : Dictionary) : Object + override public function applyInjection(target : Object, singletons : Dictionary) : Object { - var p : Array = gatherParameterValues(target, injector, singletons); + var p : Array = gatherParameterValues(target, singletons); //the only way to implement ctor injections, really! switch (p.length) { diff --git a/src/org/swiftsuspenders/injectionpoints/InjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/InjectionPoint.as index 3902856..a0be7ac 100644 --- a/src/org/swiftsuspenders/injectionpoints/InjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/InjectionPoint.as @@ -12,6 +12,12 @@ package org.swiftsuspenders.injectionpoints public class InjectionPoint { + /******************************************************************************************* + * protected properties * + *******************************************************************************************/ + protected var injectionName : String; + + /******************************************************************************************* * public methods * *******************************************************************************************/ @@ -20,7 +26,7 @@ package org.swiftsuspenders.injectionpoints initializeInjection(node, injectorMappings); } - public function applyInjection(target : Object, injector : Injector, singletons : Dictionary) : Object + public function applyInjection(target : Object, singletons : Dictionary) : Object { return target; } diff --git a/src/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as index 57d15fe..57830e4 100644 --- a/src/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as @@ -32,10 +32,9 @@ package org.swiftsuspenders.injectionpoints super(node, injectorMappings); } - override public function applyInjection( - target : Object, injector : Injector, singletons : Dictionary) : Object + override public function applyInjection(target : Object, singletons : Dictionary) : Object { - var parameters : Array = gatherParameterValues(target, injector, singletons); + var parameters : Array = gatherParameterValues(target, singletons); var method : Function = target[methodName]; method.apply(target, parameters); return target; @@ -91,8 +90,7 @@ package org.swiftsuspenders.injectionpoints } } - protected function gatherParameterValues( - target : Object, injector : Injector, singletons : Dictionary) : Array + protected function gatherParameterValues(target : Object, singletons : Dictionary) : Array { var parameters : Array = []; var length : int = mappings.length; @@ -112,7 +110,7 @@ package org.swiftsuspenders.injectionpoints )); } - var injection : Object = config.getResponse(injector, singletons); + var injection : Object = config.getResponse(singletons); parameters[i] = injection; } return parameters; diff --git a/src/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as index e837077..844f6ac 100644 --- a/src/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as @@ -17,7 +17,7 @@ package org.swiftsuspenders.injectionpoints super(null, null); } - override public function applyInjection(target : Object, injector : Injector, singletons : Dictionary) : Object + override public function applyInjection(target : Object, singletons : Dictionary) : Object { return new target(); } diff --git a/src/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as index 8a84e81..dc5c168 100644 --- a/src/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as @@ -33,8 +33,7 @@ package org.swiftsuspenders.injectionpoints return orderValue; } - override public function applyInjection( - target : Object, injector : Injector, singletons : Dictionary) : Object + override public function applyInjection(target : Object, singletons : Dictionary) : Object { target[methodName](); return target; diff --git a/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as b/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as index 319f37e..77342c5 100644 --- a/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as +++ b/src/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as @@ -31,8 +31,7 @@ package org.swiftsuspenders.injectionpoints super(node, injectorMappings); } - override public function applyInjection( - target : Object, injector : Injector, singletons : Dictionary) : Object + override public function applyInjection(target : Object, singletons : Dictionary) : Object { var config : InjectionConfig = mappings[propertyType]; if (!config) @@ -44,7 +43,7 @@ package org.swiftsuspenders.injectionpoints ) ); } - var injection : Object = config.getResponse(injector, singletons); + var injection : Object = config.getResponse(singletons); target[propertyName] = injection; return target; } @@ -58,11 +57,11 @@ package org.swiftsuspenders.injectionpoints var mappings : Dictionary; if (node.hasOwnProperty('arg') && node.arg.(@key == 'name').length) { - var name : String = node.arg.@value.toString(); - mappings = injectorMappings[name]; + injectionName = node.arg.@value.toString(); + mappings = injectorMappings[injectionName]; if (!mappings) { - mappings = injectorMappings[name] = new Dictionary(); + mappings = injectorMappings[injectionName] = new Dictionary(); } } else diff --git a/test/org/swiftsuspenders/InjectionConfigTests.as b/test/org/swiftsuspenders/InjectionConfigTests.as index 60e5ae6..e49c25d 100644 --- a/test/org/swiftsuspenders/InjectionConfigTests.as +++ b/test/org/swiftsuspenders/InjectionConfigTests.as @@ -25,7 +25,7 @@ package org.swiftsuspenders public function configIsInstantiated():void { var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", null); Assert.assertTrue(config is InjectionConfig); } @@ -35,8 +35,8 @@ package org.swiftsuspenders { var response:Clazz = new Clazz(); var config : InjectionConfig = new InjectionConfig( - Clazz, response, InjectionType.VALUE, ""); - var returnedResponse:Object = config.getResponse( injector, null); + Clazz, response, InjectionType.VALUE, "", injector); + var returnedResponse:Object = config.getResponse(null); Assert.assertStrictlyEquals(response, returnedResponse); } @@ -45,8 +45,8 @@ package org.swiftsuspenders public function injectionTypeClassReturnsRespone():void { var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.CLASS, ""); - var returnedResponse:Object = config.getResponse( injector, null); + Clazz, Clazz, InjectionType.CLASS, "", injector); + var returnedResponse:Object = config.getResponse(null); Assert.assertTrue( returnedResponse is Clazz); } @@ -56,8 +56,8 @@ package org.swiftsuspenders { var singletons:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); - var returnedResponse:Object = config.getResponse( injector, singletons); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); + var returnedResponse:Object = config.getResponse(singletons); Assert.assertTrue( returnedResponse is Clazz); } @@ -67,8 +67,8 @@ package org.swiftsuspenders { var singletons:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); - var returnedResponse:Object = config.getResponse( injector, singletons); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); + var returnedResponse:Object = config.getResponse(singletons); Assert.assertTrue( singletons[Clazz] == returnedResponse ); } @@ -78,8 +78,8 @@ package org.swiftsuspenders { var singletons:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, "named"); - var returnedResponse:Object = config.getResponse( injector, singletons); + Clazz, Clazz, InjectionType.SINGLETON, "named", injector); + var returnedResponse:Object = config.getResponse(singletons); Assert.assertTrue( singletons["named"][Clazz] == returnedResponse ); } @@ -89,9 +89,9 @@ package org.swiftsuspenders { var singletons:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); - var returnedResponse:Object = config.getResponse( injector, singletons); - var secondResponse:Object = config.getResponse( injector, singletons); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); + var returnedResponse:Object = config.getResponse(singletons); + var secondResponse:Object = config.getResponse(singletons); Assert.assertStrictlyEquals( returnedResponse, secondResponse ) } @@ -101,9 +101,9 @@ package org.swiftsuspenders { var singletons:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, "named"); - var returnedResponse:Object = config.getResponse( injector, singletons); - var secondResponse:Object = config.getResponse( injector, singletons); + Clazz, Clazz, InjectionType.SINGLETON, "named", injector); + var returnedResponse:Object = config.getResponse(singletons); + var secondResponse:Object = config.getResponse(singletons); Assert.assertStrictlyEquals( returnedResponse, secondResponse ) } diff --git a/test/org/swiftsuspenders/injectionpoints/ConstructorInjectionPointTests.as b/test/org/swiftsuspenders/injectionpoints/ConstructorInjectionPointTests.as index 55aeb5b..6a3363b 100644 --- a/test/org/swiftsuspenders/injectionpoints/ConstructorInjectionPointTests.as +++ b/test/org/swiftsuspenders/injectionpoints/ConstructorInjectionPointTests.as @@ -29,10 +29,9 @@ package org.swiftsuspenders.injectionpoints public function injectionOfFirstOptionalPropertyIntoTwoOptionalParametersConstructor():void { var injector:Injector = new Injector(); - var mappings:Dictionary = new Dictionary(); var config_clazz : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); var fqcn_clazz:String = getQualifiedClassName(Clazz); mappings[fqcn_clazz] = config_clazz; @@ -41,7 +40,7 @@ package org.swiftsuspenders.injectionpoints var singletons:Dictionary = new Dictionary(); var injectee:TwoOptionalParametersConstructorInjectee = - injectionPoint.applyInjection(TwoOptionalParametersConstructorInjectee, injector, singletons) as TwoOptionalParametersConstructorInjectee; + injectionPoint.applyInjection(TwoOptionalParametersConstructorInjectee, singletons) as TwoOptionalParametersConstructorInjectee; Assert.assertTrue("dependency 1 should be Clazz instance", injectee.getDependency() is Clazz); @@ -52,10 +51,9 @@ package org.swiftsuspenders.injectionpoints public function injectionOfSecondOptionalPropertyIntoTwoOptionalParametersConstructor():void { var injector:Injector = new Injector(); - var mappings:Dictionary = new Dictionary(); var string_reference : InjectionConfig = new InjectionConfig( - String, STRING_REFERENCE, InjectionType.VALUE, ""); + String, STRING_REFERENCE, InjectionType.VALUE, "", injector); var fqcn_string:String = getQualifiedClassName(String); mappings[fqcn_string] = string_reference; @@ -64,7 +62,7 @@ package org.swiftsuspenders.injectionpoints var singletons:Dictionary = new Dictionary(); var injectee:TwoOptionalParametersConstructorInjectee = - injectionPoint.applyInjection(TwoOptionalParametersConstructorInjectee, injector, singletons) as TwoOptionalParametersConstructorInjectee; + injectionPoint.applyInjection(TwoOptionalParametersConstructorInjectee, singletons) as TwoOptionalParametersConstructorInjectee; Assert.assertTrue("dependency 1 should be Clazz null", injectee.getDependency() == null); @@ -73,11 +71,10 @@ package org.swiftsuspenders.injectionpoints private function applyConstructorInjectionToTwoUnamedParameterInjectee():TwoParametersConstructorInjectee { - var injector:Injector = new Injector(); var injectionPoint:ConstructorInjectionPoint = createTwoPropertySingletonClazzAndInterfaceConstructorInjectionPoint(); var singletons:Dictionary = new Dictionary(); var injectee:TwoParametersConstructorInjectee = - injectionPoint.applyInjection(TwoParametersConstructorInjectee, injector, singletons) as TwoParametersConstructorInjectee; + injectionPoint.applyInjection(TwoParametersConstructorInjectee, singletons) as TwoParametersConstructorInjectee; return injectee; } @@ -92,11 +89,12 @@ package org.swiftsuspenders.injectionpoints private function createUnamedTwoPropertyPropertySingletonInjectionConfigDictionary():Dictionary { + var injector:Injector = new Injector(); var configDictionary:Dictionary = new Dictionary(); var config_clazz : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); var string_reference : InjectionConfig = new InjectionConfig( - String, STRING_REFERENCE, InjectionType.VALUE, ""); + String, STRING_REFERENCE, InjectionType.VALUE, "", injector); var fqcn_clazz:String = getQualifiedClassName(Clazz); var fqcn_string:String = getQualifiedClassName(String); diff --git a/test/org/swiftsuspenders/injectionpoints/MethodInjectionPointTest.as b/test/org/swiftsuspenders/injectionpoints/MethodInjectionPointTest.as index ab2670c..d5c2f47 100644 --- a/test/org/swiftsuspenders/injectionpoints/MethodInjectionPointTest.as +++ b/test/org/swiftsuspenders/injectionpoints/MethodInjectionPointTest.as @@ -39,7 +39,7 @@ package org.swiftsuspenders.injectionpoints var injectionPoint:MethodInjectionPoint = createTwoPropertySingletonClazzAndInterfaceMethodInjectionPoint(); var singletons:Dictionary = new Dictionary(); - injectionPoint.applyInjection(injectee, injector, singletons); + injectionPoint.applyInjection(injectee, singletons); return injectee; } @@ -55,11 +55,10 @@ package org.swiftsuspenders.injectionpoints private function applyMethodInjectionToOneRequiredOneOptionalPropertyIntoMethod():OneRequiredOneOptionalPropertyMethodInjectee { var injectee:OneRequiredOneOptionalPropertyMethodInjectee = new OneRequiredOneOptionalPropertyMethodInjectee(); - var injector:Injector = new Injector(); var injectionPoint:MethodInjectionPoint = createOneRequiredOneOptionalPropertySingletonClazzAndInterfaceMethodInjectionPoint(); var singletons:Dictionary = new Dictionary(); - injectionPoint.applyInjection(injectee, injector, singletons); + injectionPoint.applyInjection(injectee, singletons); return injectee; } @@ -74,11 +73,12 @@ package org.swiftsuspenders.injectionpoints private function createUnamedTwoPropertyPropertySingletonInjectionConfigDictionary():Dictionary { + var injector:Injector = new Injector(); var configDictionary:Dictionary = new Dictionary(); var config_clazz : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); var config_interface : InjectionConfig = new InjectionConfig( - Interface, Clazz, InjectionType.SINGLETON, ""); + Interface, Clazz, InjectionType.SINGLETON, "", injector); var fqcn_clazz:String = getQualifiedClassName(Clazz); var fqcn_interface:String = getQualifiedClassName(Interface); @@ -90,9 +90,10 @@ package org.swiftsuspenders.injectionpoints private function createUnnamedPropertySingletonInjectionConfigDictionary():Dictionary { + var injector:Injector = new Injector(); var configDictionary:Dictionary = new Dictionary(); var config_clazz : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); var fqcn_clazz:String = getQualifiedClassName(Clazz); configDictionary[fqcn_clazz] = config_clazz; diff --git a/test/org/swiftsuspenders/injectionpoints/PropertyInjectionPointTests.as b/test/org/swiftsuspenders/injectionpoints/PropertyInjectionPointTests.as index 7b01e68..b1eaead 100644 --- a/test/org/swiftsuspenders/injectionpoints/PropertyInjectionPointTests.as +++ b/test/org/swiftsuspenders/injectionpoints/PropertyInjectionPointTests.as @@ -17,11 +17,10 @@ package org.swiftsuspenders.injectionpoints public function injectionOfSinglePropertyIsApplied():void { var injectee:ClassInjectee = new ClassInjectee(); - var injector:Injector = new Injector(); var injectionPoint:PropertyInjectionPoint = createSingleProertySingletonClazzVariableInjectionPoint(); var singletons:Dictionary = new Dictionary(); - injectionPoint.applyInjection(injectee, injector, singletons); + injectionPoint.applyInjection(injectee, singletons); Assert.assertTrue("injectee should contain Clazz instance", injectee.property is Clazz); } @@ -36,9 +35,10 @@ package org.swiftsuspenders.injectionpoints private function createUnamedSinglePropertySingletonInjectionConfigDictionary():Dictionary { + var injector:Injector = new Injector(); var classConfigDisctionary:Dictionary = new Dictionary(); var config : InjectionConfig = new InjectionConfig( - Clazz, Clazz, InjectionType.SINGLETON, ""); + Clazz, Clazz, InjectionType.SINGLETON, "", injector); var fqcn:String = getQualifiedClassName(Clazz); classConfigDisctionary[fqcn] = config; return classConfigDisctionary;