File tree Expand file tree Collapse file tree 5 files changed +61
-0
lines changed
test/integration/channeling Expand file tree Collapse file tree 5 files changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import flash.utils.describeType;
44import flash.utils.Dictionary ;
55import flash.utils.getDefinitionByName ;
66import flash.utils.getQualifiedClassName ;
7+ import integration.channeling.testObj.moduleA.ComTest1Command ;
78import org.mvcexpress.core.messenger.Messenger ;
89import org.mvcexpress.core.namespace.pureLegsCore ;
910import org.mvcexpress.core.traceObjects.MvcTraceActions ;
@@ -134,6 +135,19 @@ public class CommandMap {
134135 //////////////////////////////////////////////
135136 }
136137
138+ //----------------------------------
139+ // CHANNELING
140+ //----------------------------------
141+
142+ public function channelMap (type :String , commandClass :Class , scopeName :String = "global" ):void {
143+ trace ( "CommandMap.channelMap > type : " + type + ", commandClass : " + commandClass + ", scopeName : " + scopeName );
144+
145+ }
146+
147+ //----------------------------------
148+ // INTERNAL
149+ //----------------------------------
150+
137151 /** function to be called by messenger on needed message type sent */
138152 private function handleCommandExecute (messageType :String , params :Object ):void {
139153 var commandList: Vector .< Class >;
Original file line number Diff line number Diff line change @@ -104,6 +104,10 @@ public class ModuleCore {
104104 moduleBase. sendMessageToAll(type , params);
105105 }
106106
107+ protected function sendChannelMessage (type :String , params :Object = null , scopeName :String = "global" ):void {
108+ trace ("ModuleCore.sendChannelMessage > type : " + type + ", params : " + params + ", scopeName : " + scopeName);
109+ }
110+
107111 //----------------------------------
108112 // Debug
109113 //----------------------------------
Original file line number Diff line number Diff line change @@ -137,6 +137,21 @@ public class ChannelingTests {
137137 Assert. assertFalse(channelModulA. view . test2handled);
138138 Assert. assertFalse(channelModulA. view . test3handled);
139139 }
140+
141+ [Test ]
142+
143+ public function channeling_messegeToCommandChanneling_addChannelCommand_commandsHandlesMessage ():void {
144+ //
145+ channelModulA. mapCommand_ComTest1();
146+ //
147+ Assert. assertFalse("Cammand test1 executed flag mast be false" , channelModulA. command1executed);
148+ //
149+ channelModulA. sendChannelMessage_comTest1();
150+ //
151+ Assert. assertTrue("Command test1 must be true after commandMap.channelMap() and sendChannelMessage()" , channelModulA. command1executed);
152+
153+ }
154+
140155
141156}
142157}
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ public class ChannelModuleA extends ModuleCore {
1212
1313 static public const NAME : String = "ChannelModuleA" ;
1414
15+ public var command1executed: Boolean = false ;
16+
1517 public function ChannelModuleA () {
1618 super (ChannelModuleA. NAME );
1719 }
@@ -42,6 +44,14 @@ public class ChannelModuleA extends ModuleCore {
4244 view . dispatchEvent (new Event ("addChannelHandler_testChannel_test4_withParams" ));
4345 }
4446
47+ public function mapCommand_ComTest1 ():void {
48+ commandMap. channelMap("CommTest1" , ComTest1Command);
49+ }
50+
51+ public function sendChannelMessage_comTest1 ():void {
52+ sendChannelMessage("CommTest1" , this );
53+ }
54+
4555 override protected function onInit ():void {
4656
4757 }
Original file line number Diff line number Diff line change 1+ package integration.channeling.testObj.moduleA {
2+ import org.mvcexpress.mvc.Command ;
3+
4+ /**
5+ * TODO:CLASS COMMENT
6+ * @author Raimundas Banevicius (http://www.mindscriptact.com/)
7+ */
8+ public class ComTest1Command extends Command {
9+
10+ //[Inject]
11+ //public var myProxy:MyProxy;
12+
13+ public function execute (moduleA :ChannelModuleA ):void {
14+ moduleA. command1executed = true ;
15+ }
16+
17+ }
18+ }
You can’t perform that action at this time.
0 commit comments