asunit4 4.2.2.pre → 4.2.3.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +26 -0
- data/bin/AsUnit-4.1.2.swc +0 -0
- data/bin/AsUnit-4.2.3.pre.swc +0 -0
- data/bin/AsUnitRunner.swf +0 -0
- data/bin/Flex4AsUnitRunner.swf +0 -0
- data/build.xml +42 -2
- data/lib/SwiftSuspenders-v1.5.1.swc +0 -0
- data/lib/flexUnitTasks.jar +0 -0
- data/pkg/sprout-asunit4-library-4.1.2.gem +0 -0
- data/rakefile.rb +4 -1
- data/sprout/lib/asunit4.rb +1 -1
- data/src/asunit/asserts/assertMatches.as +6 -0
- data/src/asunit/asserts/assertThrowsWithMessage.as +5 -0
- data/src/asunit/core/AsUnitCore.as +42 -88
- data/src/asunit/core/FlashBuilderCore.as +2 -2
- data/src/asunit/core/FlashDevelopCore.as +1 -1
- data/src/asunit/core/FlexUnitCICore.as +17 -0
- data/src/asunit/core/TextCore.as +36 -54
- data/src/asunit/framework/Assert.as +76 -11
- data/src/asunit/framework/Async.as +1 -1
- data/src/asunit/framework/IResult.as +1 -6
- data/src/asunit/framework/IRunListener.as +0 -3
- data/src/asunit/framework/IRunner.as +0 -3
- data/src/asunit/framework/IRunnerFactory.as +3 -3
- data/src/asunit/framework/ITestListener.as +1 -2
- data/src/asunit/framework/Method.as +82 -80
- data/src/asunit/framework/Result.as +3 -24
- data/src/asunit/framework/RunnerFactory.as +13 -34
- data/src/asunit/framework/SuiteIterator.as +28 -22
- data/src/asunit/framework/TestCase.as +8 -3
- data/src/asunit/printers/FlashBuilderPrinter.as +25 -83
- data/src/asunit/printers/FlashDevelopPrinter.as +1 -2
- data/src/asunit/printers/FlexUnitCIPrinter.as +181 -0
- data/src/asunit/printers/TextPrinter.as +17 -46
- data/src/asunit/printers/XMLPrinter.as +127 -0
- data/src/asunit/runners/LegacyRunner.as +6 -1
- data/src/asunit/runners/SuiteRunner.as +30 -66
- data/src/asunit/runners/TestRunner.as +90 -255
- data/test/AllTests.as +9 -4
- data/test/AsUnitCIRunner.as +18 -0
- data/test/AsUnitRunner.as +2 -0
- data/test/AsUnitRunnerCS3.fla +0 -0
- data/test/asunit/core/AsUnitCoreTest.as +33 -15
- data/test/asunit/framework/AssertEqualsArraysIgnoringOrderTest.as +14 -0
- data/test/asunit/framework/AssertThrowsWithMessageTest.as +50 -0
- data/test/asunit/framework/AsyncTest.as +0 -4
- data/test/asunit/framework/ProceedOnEventTest.as +1 -2
- data/test/asunit/framework/ResultObserverTest.as +61 -0
- data/test/asunit/framework/RunnerFactoryTest.as +7 -9
- data/test/asunit/framework/VisualTestCaseTest.as +2 -26
- data/test/asunit/printers/FlashBuilderPrinterTest.as +18 -0
- data/test/asunit/printers/XMLPrinterTest.as +131 -0
- data/test/asunit/runners/LegacyRunnerTest.as +4 -4
- data/test/asunit/runners/SuiteRunnerTest.as +10 -7
- data/test/asunit/runners/TestRunnerAsyncMethodTest.as +9 -7
- data/test/asunit/runners/TestRunnerErrorMethodTest.as +1 -1
- data/test/asunit/runners/TestRunnerExpectsErrorTest.as +2 -2
- data/test/asunit/runners/TestRunnerExpectsErrorWithMessageTest.as +125 -0
- data/test/asunit/runners/TestRunnerIgnoredMethodTest.as +2 -3
- data/test/asunit/runners/TestRunnerTest.as +4 -27
- data/test/asunit/support/{CustomTestRunner.as → CustomSuiteRunner.as} +7 -3
- data/test/asunit/support/InjectionVerification.as +2 -30
- data/test/asunit/support/SuiteWithCustomRunner.as +1 -1
- data/vendor/as3injection/org/swiftsuspenders/InjectionConfig.as +78 -0
- data/vendor/as3injection/org/swiftsuspenders/InjectionType.as +16 -0
- data/vendor/as3injection/org/swiftsuspenders/Injector.as +376 -0
- data/vendor/as3injection/org/swiftsuspenders/InjectorError.as +17 -0
- data/vendor/as3injection/org/swiftsuspenders/Reflector.as +95 -0
- data/vendor/as3injection/org/swiftsuspenders/getConstructor.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/ConstructorInjectionPoint.as +94 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/InjectionPoint.as +35 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/MethodInjectionPoint.as +122 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as +24 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PostConstructInjectionPoint.as +52 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionpoints/PropertyInjectionPoint.as +62 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectClassResult.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectOtherRuleResult.as +34 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectSingletonResult.as +43 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectValueResult.as +33 -0
- data/vendor/as3injection/org/swiftsuspenders/injectionresults/InjectionResult.as +26 -0
- metadata +44 -19
- data/bin/AsUnit-4.2.1.pre.swc +0 -0
- data/bin/AsUnit-4.2.2.pre.swc +0 -0
- data/src/asunit/framework/CallbackBridge.as +0 -175
- data/src/asunit/framework/ITestResult.as +0 -21
- data/src/asunit/framework/InjectionDelegate.as +0 -96
- data/src/asunit/framework/MessageBridge.as +0 -24
- data/src/asunit/framework/TestObserver.as +0 -12
- data/test/asunit/framework/CallbackBridgeTest.as +0 -73
- data/test/asunit/framework/InjectionDelegateTest.as +0 -79
- data/test/asunit/support/AnnotatedSubClass.as +0 -18
- data/test/asunit/support/AnnotatedSuperClass.as +0 -15
- data/test/asunit/support/FakeRunner.as +0 -32
- data/test/asunit/support/InjectTimeoutOnAsync.as +0 -14
- data/test/asunit/support/TestForFakeRunner.as +0 -14
@@ -0,0 +1,17 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders
|
9
|
+
{
|
10
|
+
public class InjectorError extends Error
|
11
|
+
{
|
12
|
+
public function InjectorError(message:*="", id:*=0)
|
13
|
+
{
|
14
|
+
super(message, id);
|
15
|
+
}
|
16
|
+
}
|
17
|
+
}
|
@@ -0,0 +1,95 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders
|
9
|
+
{
|
10
|
+
import flash.system.ApplicationDomain;
|
11
|
+
import flash.utils.describeType;
|
12
|
+
import flash.utils.getDefinitionByName;
|
13
|
+
import flash.utils.getQualifiedClassName;
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @author tschneidereit
|
17
|
+
*/
|
18
|
+
public class Reflector
|
19
|
+
{
|
20
|
+
/*******************************************************************************************
|
21
|
+
* public methods *
|
22
|
+
*******************************************************************************************/
|
23
|
+
public function Reflector()
|
24
|
+
{
|
25
|
+
}
|
26
|
+
|
27
|
+
public function classExtendsOrImplements(classOrClassName : Object,
|
28
|
+
superclass : Class, application : ApplicationDomain = null) : Boolean
|
29
|
+
{
|
30
|
+
var actualClass : Class;
|
31
|
+
|
32
|
+
if (classOrClassName is Class)
|
33
|
+
{
|
34
|
+
actualClass = Class(classOrClassName);
|
35
|
+
}
|
36
|
+
else if (classOrClassName is String)
|
37
|
+
{
|
38
|
+
try
|
39
|
+
{
|
40
|
+
actualClass = Class(getDefinitionByName(classOrClassName as String));
|
41
|
+
}
|
42
|
+
catch (e : Error)
|
43
|
+
{
|
44
|
+
throw new Error("The class name " + classOrClassName +
|
45
|
+
" is not valid because of " + e + "\n" + e.getStackTrace());
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
if (!actualClass)
|
50
|
+
{
|
51
|
+
throw new Error("The parameter classOrClassName must be a valid Class " +
|
52
|
+
"instance or fully qualified class name.");
|
53
|
+
}
|
54
|
+
|
55
|
+
if (actualClass == superclass)
|
56
|
+
return true;
|
57
|
+
|
58
|
+
var factoryDescription : XML = describeType(actualClass).factory[0];
|
59
|
+
|
60
|
+
return (factoryDescription.children().(
|
61
|
+
name() == "implementsInterface" || name() == "extendsClass").(
|
62
|
+
attribute("type") == getQualifiedClassName(superclass)).length() > 0);
|
63
|
+
}
|
64
|
+
|
65
|
+
public function getClass(value : *, applicationDomain : ApplicationDomain = null) : Class
|
66
|
+
{
|
67
|
+
if (value is Class)
|
68
|
+
{
|
69
|
+
return value;
|
70
|
+
}
|
71
|
+
return getConstructor(value);
|
72
|
+
}
|
73
|
+
|
74
|
+
public function getFQCN(value : *, replaceColons : Boolean = false) : String
|
75
|
+
{
|
76
|
+
var fqcn:String;
|
77
|
+
if (value is String)
|
78
|
+
{
|
79
|
+
fqcn = value;
|
80
|
+
// Add colons if missing and desired.
|
81
|
+
if (!replaceColons && fqcn.indexOf('::') == -1)
|
82
|
+
{
|
83
|
+
var lastDotIndex:int = fqcn.lastIndexOf('.');
|
84
|
+
if (lastDotIndex == -1) return fqcn;
|
85
|
+
return fqcn.substring(0, lastDotIndex) + '::' + fqcn.substring(lastDotIndex + 1);
|
86
|
+
}
|
87
|
+
}
|
88
|
+
else
|
89
|
+
{
|
90
|
+
fqcn = getQualifiedClassName(value);
|
91
|
+
}
|
92
|
+
return replaceColons ? fqcn.replace('::', '.') : fqcn;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}
|
@@ -0,0 +1,33 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2010 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders
|
9
|
+
{
|
10
|
+
import flash.utils.Proxy;
|
11
|
+
import flash.utils.getDefinitionByName;
|
12
|
+
import flash.utils.getQualifiedClassName;
|
13
|
+
|
14
|
+
internal function getConstructor(value : Object) : Class
|
15
|
+
{
|
16
|
+
/*
|
17
|
+
There are several types for which the 'constructor' property doesn't work:
|
18
|
+
- instances of Proxy, XML and XMLList throw exceptions when trying to access 'constructor'
|
19
|
+
- int and uint return Number as their constructor
|
20
|
+
For these, we have to fall back to more verbose ways of getting the constructor.
|
21
|
+
|
22
|
+
Additionally, Vector instances always return Vector.<*> when queried for their constructor.
|
23
|
+
Ideally, that would also be resolved, but the SwiftSuspenders wouldn't be compatible with
|
24
|
+
Flash Player < 10, anymore.
|
25
|
+
*/
|
26
|
+
if (value is Proxy || value is Number || value is XML || value is XMLList)
|
27
|
+
{
|
28
|
+
var fqcn : String = getQualifiedClassName(value);
|
29
|
+
return Class(getDefinitionByName(fqcn));
|
30
|
+
}
|
31
|
+
return value.constructor;
|
32
|
+
}
|
33
|
+
}
|
@@ -0,0 +1,94 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders.injectionpoints
|
9
|
+
{
|
10
|
+
import flash.utils.describeType;
|
11
|
+
|
12
|
+
import org.swiftsuspenders.Injector;
|
13
|
+
|
14
|
+
public class ConstructorInjectionPoint extends MethodInjectionPoint
|
15
|
+
{
|
16
|
+
/*******************************************************************************************
|
17
|
+
* public methods *
|
18
|
+
*******************************************************************************************/
|
19
|
+
public function ConstructorInjectionPoint(node : XML, clazz : Class, injector : Injector)
|
20
|
+
{
|
21
|
+
/*
|
22
|
+
In many cases, the flash player doesn't give us type information for constructors until
|
23
|
+
the class has been instantiated at least once. Therefore, we do just that if we don't get
|
24
|
+
type information for at least one parameter.
|
25
|
+
*/
|
26
|
+
if (node.parameter.(@type == '*').length() == node.parameter.@type.length())
|
27
|
+
{
|
28
|
+
createDummyInstance(node, clazz);
|
29
|
+
}
|
30
|
+
super(node, injector);
|
31
|
+
}
|
32
|
+
|
33
|
+
override public function applyInjection(target : Object, injector : Injector) : Object
|
34
|
+
{
|
35
|
+
var p : Array = gatherParameterValues(target, injector);
|
36
|
+
//the only way to implement ctor injections, really!
|
37
|
+
switch (p.length)
|
38
|
+
{
|
39
|
+
case 0 : return (new target());
|
40
|
+
case 1 : return (new target(p[0]));
|
41
|
+
case 2 : return (new target(p[0], p[1]));
|
42
|
+
case 3 : return (new target(p[0], p[1], p[2]));
|
43
|
+
case 4 : return (new target(p[0], p[1], p[2], p[3]));
|
44
|
+
case 5 : return (new target(p[0], p[1], p[2], p[3], p[4]));
|
45
|
+
case 6 : return (new target(p[0], p[1], p[2], p[3], p[4], p[5]));
|
46
|
+
case 7 : return (new target(p[0], p[1], p[2], p[3], p[4], p[5], p[6]));
|
47
|
+
case 8 : return (new target(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]));
|
48
|
+
case 9 : return (new target(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8]));
|
49
|
+
case 10 : return (new target(p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]));
|
50
|
+
}
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
|
54
|
+
/*******************************************************************************************
|
55
|
+
* protected methods *
|
56
|
+
*******************************************************************************************/
|
57
|
+
override protected function initializeInjection(node : XML, injector : Injector) : void
|
58
|
+
{
|
59
|
+
var nameArgs : XMLList = node.parent().metadata.(@name == 'Inject').arg.(@key == 'name');
|
60
|
+
methodName = 'constructor';
|
61
|
+
|
62
|
+
gatherParameters(node, nameArgs, injector);
|
63
|
+
}
|
64
|
+
|
65
|
+
/*******************************************************************************************
|
66
|
+
* private methods *
|
67
|
+
*******************************************************************************************/
|
68
|
+
private function createDummyInstance(constructorNode : XML, clazz : Class) : void
|
69
|
+
{
|
70
|
+
try
|
71
|
+
{
|
72
|
+
switch (constructorNode.children().length())
|
73
|
+
{
|
74
|
+
case 0 : (new clazz()); break;
|
75
|
+
case 1 : (new clazz(null)); break;
|
76
|
+
case 2 : (new clazz(null, null)); break;
|
77
|
+
case 3 : (new clazz(null, null, null)); break;
|
78
|
+
case 4 : (new clazz(null, null, null, null)); break;
|
79
|
+
case 5 : (new clazz(null, null, null, null, null)); break;
|
80
|
+
case 6 : (new clazz(null, null, null, null, null, null)); break;
|
81
|
+
case 7 : (new clazz(null, null, null, null, null, null, null)); break;
|
82
|
+
case 8 : (new clazz(null, null, null, null, null, null, null, null)); break;
|
83
|
+
case 9 : (new clazz(null, null, null, null, null, null, null, null, null)); break;
|
84
|
+
case 10 : (new clazz(null, null, null, null, null, null, null, null, null, null)); break;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
catch (error : Error)
|
88
|
+
{
|
89
|
+
trace(error);
|
90
|
+
}
|
91
|
+
constructorNode.setChildren(describeType(clazz).factory.constructor[0].children());
|
92
|
+
}
|
93
|
+
}
|
94
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders.injectionpoints
|
9
|
+
{
|
10
|
+
import org.swiftsuspenders.Injector;
|
11
|
+
|
12
|
+
public class InjectionPoint
|
13
|
+
{
|
14
|
+
/*******************************************************************************************
|
15
|
+
* public methods *
|
16
|
+
*******************************************************************************************/
|
17
|
+
public function InjectionPoint(node : XML, injector : Injector)
|
18
|
+
{
|
19
|
+
initializeInjection(node, injector);
|
20
|
+
}
|
21
|
+
|
22
|
+
public function applyInjection(target : Object, injector : Injector) : Object
|
23
|
+
{
|
24
|
+
return target;
|
25
|
+
}
|
26
|
+
|
27
|
+
|
28
|
+
/*******************************************************************************************
|
29
|
+
* protected methods *
|
30
|
+
*******************************************************************************************/
|
31
|
+
protected function initializeInjection(node : XML, injector : Injector) : void
|
32
|
+
{
|
33
|
+
}
|
34
|
+
}
|
35
|
+
}
|
@@ -0,0 +1,122 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders.injectionpoints
|
9
|
+
{
|
10
|
+
import flash.utils.getDefinitionByName;
|
11
|
+
import flash.utils.getQualifiedClassName;
|
12
|
+
|
13
|
+
import org.swiftsuspenders.InjectionConfig;
|
14
|
+
import org.swiftsuspenders.Injector;
|
15
|
+
import org.swiftsuspenders.InjectorError;
|
16
|
+
|
17
|
+
public class MethodInjectionPoint extends InjectionPoint
|
18
|
+
{
|
19
|
+
/*******************************************************************************************
|
20
|
+
* private properties *
|
21
|
+
*******************************************************************************************/
|
22
|
+
protected var methodName : String;
|
23
|
+
protected var m_injectionConfigs : Array;
|
24
|
+
protected var requiredParameters : int = 0;
|
25
|
+
|
26
|
+
|
27
|
+
/*******************************************************************************************
|
28
|
+
* public methods *
|
29
|
+
*******************************************************************************************/
|
30
|
+
public function MethodInjectionPoint(node : XML, injector : Injector)
|
31
|
+
{
|
32
|
+
super(node, injector);
|
33
|
+
}
|
34
|
+
|
35
|
+
override public function applyInjection(target : Object, injector : Injector) : Object
|
36
|
+
{
|
37
|
+
var parameters : Array = gatherParameterValues(target, injector);
|
38
|
+
var method : Function = target[methodName];
|
39
|
+
method.apply(target, parameters);
|
40
|
+
return target;
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
/*******************************************************************************************
|
45
|
+
* protected methods *
|
46
|
+
*******************************************************************************************/
|
47
|
+
override protected function initializeInjection(node : XML, injector : Injector) : void
|
48
|
+
{
|
49
|
+
var nameArgs : XMLList = node.arg.(@key == 'name');
|
50
|
+
var methodNode : XML = node.parent();
|
51
|
+
methodName = methodNode.@name.toString();
|
52
|
+
|
53
|
+
gatherParameters(methodNode, nameArgs, injector);
|
54
|
+
}
|
55
|
+
|
56
|
+
protected function gatherParameters(
|
57
|
+
methodNode : XML, nameArgs : XMLList, injector : Injector) : void
|
58
|
+
{
|
59
|
+
m_injectionConfigs = [];
|
60
|
+
var i : int = 0;
|
61
|
+
for each (var parameter : XML in methodNode.parameter)
|
62
|
+
{
|
63
|
+
var injectionName : String = '';
|
64
|
+
if (nameArgs[i])
|
65
|
+
{
|
66
|
+
injectionName = nameArgs[i].@value.toString();
|
67
|
+
}
|
68
|
+
var parameterTypeName : String = parameter.@type.toString();
|
69
|
+
var parameterType : Class;
|
70
|
+
if (parameterTypeName == '*')
|
71
|
+
{
|
72
|
+
if (parameter.@optional.toString() == 'false')
|
73
|
+
{
|
74
|
+
//TODO: Find a way to trace name of affected class here
|
75
|
+
throw new Error('Error in method definition of injectee. Required ' +
|
76
|
+
'parameters can\'t have type "*".');
|
77
|
+
}
|
78
|
+
else
|
79
|
+
{
|
80
|
+
parameterTypeName = null;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
else
|
84
|
+
{
|
85
|
+
parameterType = Class(injector.getApplicationDomain().getDefinition(parameterTypeName));
|
86
|
+
}
|
87
|
+
m_injectionConfigs.push(injector.getMapping(parameterType, injectionName));
|
88
|
+
if (parameter.@optional.toString() == 'false')
|
89
|
+
{
|
90
|
+
requiredParameters++;
|
91
|
+
}
|
92
|
+
i++;
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
protected function gatherParameterValues(target : Object, injector : Injector) : Array
|
97
|
+
{
|
98
|
+
var parameters : Array = [];
|
99
|
+
var length : int = m_injectionConfigs.length;
|
100
|
+
for (var i : int = 0; i < length; i++)
|
101
|
+
{
|
102
|
+
var config : InjectionConfig = m_injectionConfigs[i];
|
103
|
+
var injection : Object = config.getResponse(injector);
|
104
|
+
if (injection == null)
|
105
|
+
{
|
106
|
+
if (i >= requiredParameters)
|
107
|
+
{
|
108
|
+
break;
|
109
|
+
}
|
110
|
+
throw(new InjectorError(
|
111
|
+
'Injector is missing a rule to handle injection into target ' + target +
|
112
|
+
'. Target dependency: ' + getQualifiedClassName(config.request) +
|
113
|
+
', method: ' + methodName + ', parameter: ' + (i + 1)
|
114
|
+
));
|
115
|
+
}
|
116
|
+
|
117
|
+
parameters[i] = injection;
|
118
|
+
}
|
119
|
+
return parameters;
|
120
|
+
}
|
121
|
+
}
|
122
|
+
}
|
data/vendor/as3injection/org/swiftsuspenders/injectionpoints/NoParamsConstructorInjectionPoint.as
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders.injectionpoints
|
9
|
+
{
|
10
|
+
import org.swiftsuspenders.Injector;
|
11
|
+
|
12
|
+
public class NoParamsConstructorInjectionPoint extends InjectionPoint
|
13
|
+
{
|
14
|
+
public function NoParamsConstructorInjectionPoint()
|
15
|
+
{
|
16
|
+
super(null, null);
|
17
|
+
}
|
18
|
+
|
19
|
+
override public function applyInjection(target : Object, injector : Injector) : Object
|
20
|
+
{
|
21
|
+
return new target();
|
22
|
+
}
|
23
|
+
}
|
24
|
+
}
|
@@ -0,0 +1,52 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2009 the original author or authors
|
3
|
+
*
|
4
|
+
* Permission is hereby granted to use, modify, and distribute this file
|
5
|
+
* in accordance with the terms of the license agreement accompanying it.
|
6
|
+
*/
|
7
|
+
|
8
|
+
package org.swiftsuspenders.injectionpoints
|
9
|
+
{
|
10
|
+
import org.swiftsuspenders.Injector;
|
11
|
+
|
12
|
+
public class PostConstructInjectionPoint extends InjectionPoint
|
13
|
+
{
|
14
|
+
/*******************************************************************************************
|
15
|
+
* private properties *
|
16
|
+
*******************************************************************************************/
|
17
|
+
protected var methodName : String;
|
18
|
+
protected var orderValue:int;
|
19
|
+
|
20
|
+
|
21
|
+
/*******************************************************************************************
|
22
|
+
* public methods *
|
23
|
+
*******************************************************************************************/
|
24
|
+
public function PostConstructInjectionPoint(node:XML, injector : Injector)
|
25
|
+
{
|
26
|
+
super(node, injector);
|
27
|
+
}
|
28
|
+
|
29
|
+
public function get order():int
|
30
|
+
{
|
31
|
+
return orderValue;
|
32
|
+
}
|
33
|
+
|
34
|
+
override public function applyInjection(target : Object, injector : Injector) : Object
|
35
|
+
{
|
36
|
+
target[methodName]();
|
37
|
+
return target;
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
/*******************************************************************************************
|
42
|
+
* protected methods *
|
43
|
+
*******************************************************************************************/
|
44
|
+
override protected function initializeInjection(node : XML, injector : Injector) : void
|
45
|
+
{
|
46
|
+
var orderArg : XMLList = node.arg.(@key == 'order');
|
47
|
+
var methodNode : XML = node.parent();
|
48
|
+
orderValue = int(orderArg.@value);
|
49
|
+
methodName = methodNode.@name.toString();
|
50
|
+
}
|
51
|
+
}
|
52
|
+
}
|