diff --git a/src/hex/control/trigger/CommandTriggerBuilder.hx b/src/hex/control/trigger/CommandTriggerBuilder.hx index 49a5c59..e1b8716 100644 --- a/src/hex/control/trigger/CommandTriggerBuilder.hx +++ b/src/hex/control/trigger/CommandTriggerBuilder.hx @@ -10,7 +10,6 @@ import hex.annotation.AnnotationReplaceBuilder; import hex.control.payload.ExecutionPayload; import hex.control.trigger.Command; import hex.di.IDependencyInjector; -import hex.error.PrivateConstructorException; import hex.module.IContextModule; import hex.util.MacroUtil; @@ -26,24 +25,16 @@ class CommandTriggerBuilder { public static inline var MapAnnotation = "Map"; - /** @private */ - function new() - { - throw new PrivateConstructorException( "This class can't be instantiated." ); - } + /** @private */ function new() throw new hex.error.PrivateConstructorException( "This class can't be instantiated." ); macro static public function build() : Array { - var fields = Context.getBuildFields(); + var fields = Context.getBuildFields(); + if ( Context.getLocalClass().get().isInterface ) return fields; - if ( Context.getLocalClass().get().isInterface ) - { - return fields; - } - - var CommandClassType = MacroUtil.getClassType( Type.getClassName( Command ) ); - var MacroCommandClassType = MacroUtil.getClassType( Type.getClassName( MacroCommand ) ); - var IContextModuleClassType = MacroUtil.getClassType( Type.getClassName( IContextModule ) ); + var CommandClassType = MacroUtil.getClassType( Type.getClassName( Command ) ); + var MacroCommandClassType = MacroUtil.getClassType( Type.getClassName( MacroCommand ) ); + var IContextModuleClassType = MacroUtil.getClassType( Type.getClassName( IContextModule ) ); var IDependencyInjectorClassType = MacroUtil.getClassType( Type.getClassName( IDependencyInjector ) ); for ( f in fields ) @@ -58,7 +49,6 @@ class CommandTriggerBuilder if ( isMapped ) { var className = Context.getLocalModule(); - if ( m.length > 1 ) { Context.error( "'" + f.name + "' method defines more than one command mapping (with '@" + @@ -107,7 +97,6 @@ class CommandTriggerBuilder "' annotation) to '" + f.name + "' method in '" + className + "' class", command.pos ); } - var typePath = MacroUtil.getTypePath( command.name, command.pos ); if ( !MacroUtil.isSubClassOf( MacroUtil.getClassType( command.name ), CommandClassType ) ) @@ -116,7 +105,6 @@ class CommandTriggerBuilder "' annotation), but it doesn't extend '" + CommandClassType.module + "' class", command.pos ); } - var arguments :Array = []; for ( arg in func.args ) { @@ -139,7 +127,6 @@ class CommandTriggerBuilder ]; arguments.push( { expr: EObjectDecl( fields ), pos: Context.currentPos() } ); } - } var className = MacroUtil.getPack( command.name ); @@ -158,7 +145,7 @@ class CommandTriggerBuilder this.injector.mapClassNameToValue( 'Array', payloads ); hex.control.payload.PayloadUtil.mapPayload( payloads, this.injector ); - var command = this.injector.getOrCreateNewInstance( $p { className } ); + var command = this.injector.instantiateUnmapped( $p { className } ); hex.control.payload.PayloadUtil.unmapPayload( payloads, this.injector ); command.setOwner( this.module ); @@ -173,22 +160,15 @@ class CommandTriggerBuilder { func.expr = macro { - var injections : Array<{value:Dynamic, className:String, mapName:String}> = $a { arguments }; - var payloads = []; - for ( injected in injections ) - { - payloads.push( new hex.control.payload.ExecutionPayload( injected.value, null, injected.mapName ).withClassName( injected.className ) ); - } - + var injections : Array<{value: Dynamic, className: String, mapName: String}> = $a { arguments }; + var payloads = [ for ( injected in injections ) new hex.control.payload.ExecutionPayload( injected.value, null, injected.mapName ).withClassName( injected.className ) ]; hex.control.payload.PayloadUtil.mapPayload( payloads, this.injector ); - var command = this.injector.getOrCreateNewInstance( $p { className } ); + var command = this.injector.instantiateUnmapped( $p { className } ); hex.control.payload.PayloadUtil.unmapPayload( payloads, this.injector ); command.setOwner( this.module ); command.execute(); - - - + return command; }; } @@ -220,7 +200,7 @@ class CommandTriggerBuilder pos: Context.currentPos() }); - return fields; + return hex.di.annotation.AnnotationTransformer.reflect( macro hex.di.IInjectorContainer, fields ); } static function _searchForInjection( expr : Expr ) : Void @@ -233,20 +213,14 @@ class CommandTriggerBuilder { switch( arg.expr ) { + case EMeta( meta1, _.expr => EMeta( meta2, _.expr => EVars( vars ) ) ) if ( meta1.name == "Inject" && meta2.name == "Optional" ): + _generateInjectionCode( meta1, arg, vars, _shouldThrowAnError( meta2 ) ); + + case EMeta( meta1, _.expr => EMeta( meta2, _.expr => EVars( vars ) ) ) if ( meta1.name == "Optional" && meta2.name == "Inject" ): + _generateInjectionCode( meta2, arg, vars, _shouldThrowAnError( meta1 ) ); + case EMeta( s, _.expr => EVars( vars ) ) if ( s.name == "Inject" ): - var mapName = if ( s.params.length > 0 ) - { - var transformed = AnnotationReplaceBuilder.processParam(s.params[ 0 ]); - switch(transformed.expr) - { - case EConst(CString(name)): name; - case _: ""; - } - } else ""; - - var varName = vars[0].name; - var varType = vars[0].type; - arg.expr = (macro var $varName : $varType = this.injector.getInstanceWithClassName( $v{ MacroUtil.getFQCNFromComplexType( varType ) }, $v{mapName} )).expr; + _generateInjectionCode( s, arg, vars ); case _: CommandTriggerBuilder._searchForInjection( arg ); @@ -257,12 +231,42 @@ class CommandTriggerBuilder } } - static function hasMetaValue( meta, metaName : String ) + static function _shouldThrowAnError( s : MetadataEntry ) : Bool + { + if ( s.params.length > 0 ) + { + var transformed = AnnotationReplaceBuilder.processParam( s.params[ 0 ] ); + return switch( transformed.expr ) + { + case EConst(CIdent( "true" )): false; + case EConst(CIdent("false")): true; + case _: false; + } + } + + return false; + } + + static function _generateInjectionCode( s : MetadataEntry, arg : Expr, vars : Array, shouldThrowAnError = true ) { - var meta = Lambda.find( meta, function(m) return m.name == metaName ); - return ( meta != null ); + var mapName = if ( s.params.length > 0 ) + { + var transformed = AnnotationReplaceBuilder.processParam( s.params[ 0 ] ); + switch( transformed.expr ) + { + case EConst(CString(name)): name; + case _: ""; + } + } else ""; + + var varName = vars[0].name; + var varType = vars[0].type; + arg.expr = (macro var $varName : $varType = this.injector.getInstanceWithClassName( $v{ MacroUtil.getFQCNFromComplexType( varType ) }, $v{mapName}, null, $v{shouldThrowAnError} )).expr; } + static function hasMetaValue( meta, metaName : String ) + return Lambda.find( meta, function(m) return m.name == metaName ) != null; + static function getMetaValue( meta : Null, metaName : String ) { var meta : MetadataEntry = Lambda.find( meta, function(m) return m.name == metaName ); diff --git a/test/hex/control/trigger/CommandTriggerTest.hx b/test/hex/control/trigger/CommandTriggerTest.hx index 5da1dab..fd806c6 100644 --- a/test/hex/control/trigger/CommandTriggerTest.hx +++ b/test/hex/control/trigger/CommandTriggerTest.hx @@ -3,15 +3,16 @@ package hex.control.trigger; import hex.collection.Locator; import hex.control.trigger.MockCommandClassWithParameters; import hex.control.trigger.MockCommandClassWithoutParameters; -import hex.control.trigger.mock.MockController; import hex.control.trigger.mock.AnotherMockCommand; import hex.control.trigger.mock.MockCommand; +import hex.control.trigger.mock.MockController; import hex.control.trigger.mock.MockMacroCommand; import hex.control.trigger.mock.MockMacroController; import hex.control.trigger.mock.MockModule; import hex.di.IDependencyInjector; import hex.di.Injector; -import hex.log.ILogger; +import hex.di.error.MissingMappingException; +import hex.module.IContextModule; import hex.module.IModule; import hex.unittest.assertion.Assert; import hex.unittest.runner.MethodRunner; @@ -118,10 +119,11 @@ class CommandTriggerTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var result = ''; - controller.doSomething( vos[ 0 ], vos[ 1 ], vos[ 2 ], vos[ 3 ], vos[ 4 ], vos[ 5 ], vos[ 6 ], vos[ 7 ], [3, 4], vos[ 8 ] ) - .onComplete( function(r) result = r ); + controller.doSomething( vos[ 0 ], vos[ 1 ], vos[ 2 ], vos[ 3 ], vos[ 4 ], vos[ 5 ], vos[ 6 ], vos[ 7 ], [3, 4], vos[ 8 ], vos[ 9 ] ) + .onComplete( function(r) { result = r; } ); Assert.equals( 'string2', result ); @@ -135,6 +137,7 @@ class CommandTriggerTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -147,6 +150,7 @@ class CommandTriggerTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -159,5 +163,122 @@ class CommandTriggerTest Assert.equals( vos[ 6 ], acmd.pArray ); Assert.equals( vos[ 7 ], acmd.pStringMap ); Assert.equals( vos[ 8 ], acmd.pDate ); + Assert.equals( vos[ 9 ], acmd.pEnum ); + } + + @Test( "test local var injection" ) + public function testLocalVarInjection() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + injector.mapToValue( String, 'test' ); + + //testing + var result = this._controller.testLocalVarInjection(); + Assert.equals( 'test', result ); + } + + @Test( "test local var injection with name" ) + public function testLocalVarInjectionWithName() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + injector.mapToValue( String, 'test', 'test' ); + + //testing + var result = this._controller.testLocalVarInjectionWithName(); + Assert.equals( 'test', result ); + } + + @Test( "test local var with missing optional injection" ) + public function testLocalVarWithMissingOptionalInjection() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + + //testing + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarOptionalInjection, [] ); + + injector.mapToValue( String, 'test3', 'test3' ); + var result = this._controller.testLocalVarOptionalInjection(); + Assert.deepEquals( [ null, null, 'test3' ], result ); + } + + @Test( "test local var optional injection" ) + public function testLocalVarOptionalInjection() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + injector.mapToValue( String, 'test1', 'test1' ); + injector.mapToValue( String, 'test2', 'test2' ); + + //testing + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarOptionalInjection, [] ); + + injector.mapToValue( String, 'test3', 'test3' ); + var result = this._controller.testLocalVarOptionalInjection(); + Assert.deepEquals( [ 'test1', 'test2', 'test3' ], result ); + } + + @Test( "test local var with parameterized optional injection" ) + public function testLocalVarWithParameterizedOptionalInjection() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + injector.mapToValue( String, 'test1', 'test1' ); + injector.mapToValue( String, 'test2', 'test2' ); + + //testing + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarParamOptionalInjection, [] ); + + injector.mapToValue( String, 'test3', 'test3' ); + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarParamOptionalInjection, [] ); + + injector.mapToValue( String, 'test4', 'test4' ); + var result = this._controller.testLocalVarParamOptionalInjection(); + Assert.deepEquals( [ 'test1', 'test2', 'test3', 'test4' ], result ); + } + + @Test( "test local var with replaced parameterized optional injection" ) + public function testLocalVarWithReplacedParameterizedOptionalInjection() : Void + { + //Settings + var injector = new Injector(); + injector.mapToValue( IDependencyInjector, injector ); + injector.mapToValue( IContextModule, new MockModule() ); + + this._controller = injector.instantiateUnmapped( MockController ); + injector.mapToValue( String, 'test1', 'test1' ); + injector.mapToValue( String, 'test2', 'test2' ); + + //testing + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarReplacedParamOptionalInjection, [] ); + + injector.mapToValue( String, 'test3', 'test3' ); + Assert.methodCallThrows( MissingMappingException, this._controller, this._controller.testLocalVarReplacedParamOptionalInjection, [] ); + + injector.mapToValue( String, 'test4', 'test4' ); + var result = this._controller.testLocalVarReplacedParamOptionalInjection(); + Assert.deepEquals( [ 'test1', 'test2', 'test3', 'test4' ], result ); } } \ No newline at end of file diff --git a/test/hex/control/trigger/MacroCommandTest.hx b/test/hex/control/trigger/MacroCommandTest.hx index c7e17a2..ecb48f4 100644 --- a/test/hex/control/trigger/MacroCommandTest.hx +++ b/test/hex/control/trigger/MacroCommandTest.hx @@ -38,6 +38,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -49,7 +50,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -81,6 +83,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -98,6 +101,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -115,6 +119,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], acmd.pArray ); Assert.equals( vos[ 7 ], acmd.pStringMap ); Assert.equals( vos[ 8 ], acmd.pDate ); + Assert.equals( vos[ 9 ], acmd.pEnum ); } @Test( "test MacroCommand failure" ) @@ -138,6 +143,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -149,7 +155,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -181,6 +188,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -198,6 +206,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -226,6 +235,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -237,7 +247,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -269,6 +280,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -286,6 +298,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -314,6 +327,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -325,7 +339,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -357,6 +372,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -374,6 +390,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // // @@ -415,6 +432,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -426,7 +444,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -458,6 +477,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -475,6 +495,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -515,6 +536,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -526,7 +548,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -557,6 +580,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -574,6 +598,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -614,6 +639,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -625,7 +651,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -656,6 +683,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -673,6 +701,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -713,6 +742,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -724,7 +754,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -756,6 +787,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -773,6 +805,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -813,6 +846,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -824,7 +858,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -856,6 +891,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -873,6 +909,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -913,6 +950,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -924,7 +962,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -956,6 +995,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -973,6 +1013,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1013,6 +1054,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1024,7 +1066,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1056,6 +1099,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1084,6 +1128,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1095,7 +1140,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1127,6 +1173,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1144,6 +1191,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1184,6 +1232,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1195,7 +1244,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1227,6 +1277,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1273,6 +1324,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1284,7 +1336,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1316,6 +1369,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1333,6 +1387,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1373,6 +1428,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1384,7 +1440,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1416,6 +1473,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1433,6 +1491,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1477,6 +1536,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1488,7 +1548,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1520,6 +1581,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -1537,6 +1599,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1569,6 +1632,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1580,7 +1644,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1612,6 +1677,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -1629,6 +1695,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1661,6 +1728,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1672,7 +1740,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1704,6 +1773,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommand.command; @@ -1721,6 +1791,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1765,6 +1836,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1776,7 +1848,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1808,6 +1881,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandCancel.command; @@ -1825,6 +1899,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1869,6 +1944,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1880,7 +1956,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // @@ -1912,6 +1989,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], mo.pArray ); Assert.equals( vos[ 7 ], mo.pStringMap ); Assert.equals( vos[ 8 ], mo.pDate ); + Assert.equals( vos[ 9 ], mo.pEnum ); // var cmd = MockCommandFailing.command; @@ -1929,6 +2007,7 @@ class MacroCommandTest Assert.equals( vos[ 6 ], cmd.pArray ); Assert.equals( vos[ 7 ], cmd.pStringMap ); Assert.equals( vos[ 8 ], cmd.pDate ); + Assert.equals( vos[ 9 ], cmd.pEnum ); // var acmd = AnotherMockCommand.command; @@ -1973,6 +2052,7 @@ class MacroCommandTest vos[ 6 ] = [ 'hello', 'world' ]; vos[ 7 ] = [ 'hello' => 'world' ]; vos[ 8 ] = Date.now(); + vos[ 9 ] = MockEnum.TEST; var payloads = [ @@ -1984,7 +2064,8 @@ class MacroCommandTest new ExecutionPayload( vos[ 5 ] ).withClassName( 'Bool' ), new ExecutionPayload( vos[ 6 ] ).withClassName( 'Array' ), new ExecutionPayload( vos[ 7 ] ).withClassName( 'Map' ), - new ExecutionPayload( vos[ 8 ], Date ) + new ExecutionPayload( vos[ 8 ], Date ), + new ExecutionPayload( vos[ 9 ] ).withClassName( 'hex.control.MockEnum' ) ]; // diff --git a/test/hex/control/trigger/mock/AnotherMockCommand.hx b/test/hex/control/trigger/mock/AnotherMockCommand.hx index a1970be..021d78e 100644 --- a/test/hex/control/trigger/mock/AnotherMockCommand.hx +++ b/test/hex/control/trigger/mock/AnotherMockCommand.hx @@ -39,6 +39,9 @@ class AnotherMockCommand extends Command @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockCommand.hx b/test/hex/control/trigger/mock/MockCommand.hx index b1e555d..8e131bd 100644 --- a/test/hex/control/trigger/mock/MockCommand.hx +++ b/test/hex/control/trigger/mock/MockCommand.hx @@ -39,6 +39,9 @@ class MockCommand extends Command @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockCommandCancel.hx b/test/hex/control/trigger/mock/MockCommandCancel.hx index c5ec02c..c12f8ee 100644 --- a/test/hex/control/trigger/mock/MockCommandCancel.hx +++ b/test/hex/control/trigger/mock/MockCommandCancel.hx @@ -39,6 +39,9 @@ class MockCommandCancel extends Command @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockCommandFailing.hx b/test/hex/control/trigger/mock/MockCommandFailing.hx index af0f726..5788a67 100644 --- a/test/hex/control/trigger/mock/MockCommandFailing.hx +++ b/test/hex/control/trigger/mock/MockCommandFailing.hx @@ -39,6 +39,9 @@ class MockCommandFailing extends Command @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockController.hx b/test/hex/control/trigger/mock/MockController.hx index d0c79d9..6b0d534 100644 --- a/test/hex/control/trigger/mock/MockController.hx +++ b/test/hex/control/trigger/mock/MockController.hx @@ -30,4 +30,84 @@ class MockController { return a + b; } + + public function testLocalVarInjection() : String + { + @Inject + var test : String; + return test; + } + + public function testLocalVarInjectionWithName() : String + { + @Inject( 'test' ) + var test : String; + return test; + } + + public function testLocalVarOptionalInjection() : Array + { + @Optional + @Inject( 'test1' ) + var test1 : String; + + @Inject( 'test2' ) + @Optional + var test2 : String; + + @Inject( 'test3' ) + var test3 : String; + + return [ test1, test2, test3 ]; + } + + public function testLocalVarParamOptionalInjection() : Array + { + @Optional( true ) + @Inject( 'test1' ) + var test1 : String; + + @Inject( 'test2' ) + @Optional( true ) + var test2 : String; + + @Inject( 'test3' ) + @Optional( false ) + var test3 : String; + + @Optional( false ) + @Inject( 'test4' ) + var test4 : String; + + return [ test1, test2, test3, test4 ]; + } + + static var IS_TRUE = true; + static var IS_FALSE = false; + + static var NAME_1 = 'test1'; + static var NAME_2 = 'test2'; + static var NAME_3 = 'test3'; + static var NAME_4 = 'test4'; + + public function testLocalVarReplacedParamOptionalInjection() : Array + { + @Optional( IS_TRUE ) + @Inject( NAME_1 ) + var test1 : String; + + @Inject( NAME_2 ) + @Optional( IS_TRUE ) + var test2 : String; + + @Inject( NAME_3 ) + @Optional( IS_FALSE ) + var test3 : String; + + @Optional( IS_FALSE ) + @Inject( NAME_4 ) + var test4 : String; + + return [ test1, test2, test3, test4 ]; + } } \ No newline at end of file diff --git a/test/hex/control/trigger/mock/MockMacroCommand.hx b/test/hex/control/trigger/mock/MockMacroCommand.hx index c3d4bfc..483c2d5 100644 --- a/test/hex/control/trigger/mock/MockMacroCommand.hx +++ b/test/hex/control/trigger/mock/MockMacroCommand.hx @@ -1,5 +1,6 @@ package hex.control.trigger.mock; +import hex.control.MockEnum; import hex.control.async.Nothing; import hex.control.trigger.MacroCommand; @@ -39,6 +40,9 @@ class MockMacroCommand extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandCancel.hx b/test/hex/control/trigger/mock/MockMacroCommandCancel.hx index 59e3cb5..9a032bc 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandCancel.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandCancel.hx @@ -39,6 +39,9 @@ class MockMacroCommandCancel extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandFailing.hx b/test/hex/control/trigger/mock/MockMacroCommandFailing.hx index 0eabc1c..d26448e 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandFailing.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandFailing.hx @@ -39,6 +39,9 @@ class MockMacroCommandFailing extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandWithCancelHandler.hx b/test/hex/control/trigger/mock/MockMacroCommandWithCancelHandler.hx index c06ca32..e00fbe6 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandWithCancelHandler.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandWithCancelHandler.hx @@ -43,6 +43,9 @@ class MockMacroCommandWithCancelHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandWithCompleteHandler.hx b/test/hex/control/trigger/mock/MockMacroCommandWithCompleteHandler.hx index 17fab7b..a242835 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandWithCompleteHandler.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandWithCompleteHandler.hx @@ -43,6 +43,9 @@ class MockMacroCommandWithCompleteHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandWithFailHandler.hx b/test/hex/control/trigger/mock/MockMacroCommandWithFailHandler.hx index 773321c..17b5544 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandWithFailHandler.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandWithFailHandler.hx @@ -43,6 +43,9 @@ class MockMacroCommandWithFailHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandWithGuardRefused.hx b/test/hex/control/trigger/mock/MockMacroCommandWithGuardRefused.hx index b5933d7..31753b5 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandWithGuardRefused.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandWithGuardRefused.hx @@ -39,6 +39,9 @@ class MockMacroCommandWithGuardRefused extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroCommandWithPayloadOverriding.hx b/test/hex/control/trigger/mock/MockMacroCommandWithPayloadOverriding.hx index aa3a6e2..62ff0d1 100644 --- a/test/hex/control/trigger/mock/MockMacroCommandWithPayloadOverriding.hx +++ b/test/hex/control/trigger/mock/MockMacroCommandWithPayloadOverriding.hx @@ -40,6 +40,9 @@ class MockMacroCommandWithPayloadOverriding extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockMacroController.hx b/test/hex/control/trigger/mock/MockMacroController.hx index 23d1125..d134810 100644 --- a/test/hex/control/trigger/mock/MockMacroController.hx +++ b/test/hex/control/trigger/mock/MockMacroController.hx @@ -1,6 +1,7 @@ package hex.control.trigger.mock; import hex.collection.ILocator; +import hex.control.MockEnum; import hex.control.async.Expect; /** @@ -12,8 +13,6 @@ class MockMacroController { public function new(){} - - @Map( hex.control.trigger.mock.MockMacroCommand ) public function doSomething ( @@ -26,7 +25,8 @@ class MockMacroController a : Array, @Type( 'Map' ) m : Map, @Ignore ai : Array, - d : Date + d : Date, + me : MockEnum ) : Expect; public function sum( a : Int, b : Int ) : Int diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandCancel.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandCancel.hx index ad2f12e..771c184 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandCancel.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandCancel.hx @@ -39,6 +39,9 @@ class MockNonAtomicMacroCommandCancel extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandFailing.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandFailing.hx index 7203060..c0ab235 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandFailing.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandFailing.hx @@ -39,6 +39,9 @@ class MockNonAtomicMacroCommandFailing extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCancelHandler.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCancelHandler.hx index fb46078..35568c4 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCancelHandler.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCancelHandler.hx @@ -43,6 +43,9 @@ class MockNonAtomicMacroCommandWithCancelHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCompleteHandler.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCompleteHandler.hx index c39203f..2caba2a 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCompleteHandler.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithCompleteHandler.hx @@ -43,6 +43,9 @@ class MockNonAtomicMacroCommandWithCompleteHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithFailHandler.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithFailHandler.hx index b6f8c42..e328d75 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithFailHandler.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithFailHandler.hx @@ -43,6 +43,9 @@ class MockNonAtomicMacroCommandWithFailHandler extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithGuardRefused.hx b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithGuardRefused.hx index ef897e8..b172066 100644 --- a/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithGuardRefused.hx +++ b/test/hex/control/trigger/mock/MockNonAtomicMacroCommandWithGuardRefused.hx @@ -39,6 +39,9 @@ class MockNonAtomicMacroCommandWithGuardRefused extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockParallelMacroCommand.hx b/test/hex/control/trigger/mock/MockParallelMacroCommand.hx index 8817d7f..630691b 100644 --- a/test/hex/control/trigger/mock/MockParallelMacroCommand.hx +++ b/test/hex/control/trigger/mock/MockParallelMacroCommand.hx @@ -39,6 +39,9 @@ class MockParallelMacroCommand extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockParallelMacroCommandCancel.hx b/test/hex/control/trigger/mock/MockParallelMacroCommandCancel.hx index b332f09..11461f7 100644 --- a/test/hex/control/trigger/mock/MockParallelMacroCommandCancel.hx +++ b/test/hex/control/trigger/mock/MockParallelMacroCommandCancel.hx @@ -39,6 +39,9 @@ class MockParallelMacroCommandCancel extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockParallelMacroCommandFailing.hx b/test/hex/control/trigger/mock/MockParallelMacroCommandFailing.hx index 293824c..a525119 100644 --- a/test/hex/control/trigger/mock/MockParallelMacroCommandFailing.hx +++ b/test/hex/control/trigger/mock/MockParallelMacroCommandFailing.hx @@ -39,6 +39,9 @@ class MockParallelMacroCommandFailing extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandCancel.hx b/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandCancel.hx index 85d0c8e..5e1646f 100644 --- a/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandCancel.hx +++ b/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandCancel.hx @@ -39,6 +39,9 @@ class MockParallelNonAtomicMacroCommandCancel extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super(); diff --git a/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandFailing.hx b/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandFailing.hx index ca965e4..9dc8a59 100644 --- a/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandFailing.hx +++ b/test/hex/control/trigger/mock/MockParallelNonAtomicMacroCommandFailing.hx @@ -39,6 +39,9 @@ class MockParallelNonAtomicMacroCommandFailing extends MacroCommand @Inject public var pDate : Date; + @Inject + public var pEnum : MockEnum; + public function new() { super();