diff --git a/FunctionalTests/src/FunctionalTests.mxml b/FunctionalTests/src/FunctionalTests.mxml index 728a539..69d2538 100644 --- a/FunctionalTests/src/FunctionalTests.mxml +++ b/FunctionalTests/src/FunctionalTests.mxml @@ -49,6 +49,7 @@ group.children.push(new RTMPBadRequests(this, hostDefault)); group.children.push(new RTMPLoad(this, hostDefault, applicationDefault, "RTMP")); group.children.push(new RTMPLoad(this, hostDefault, applicationDefault, "RTMPE")); + // TODO : group.children.push(new RTMPp2p(this, hostDefault, applicationDefault)); mapTests.push(group); group = new Test(this, "RTMFP", "List of RTMFP tests", true); group.children.push(new RTMFPLoad(this, hostDefault, applicationDefault)); @@ -56,6 +57,7 @@ group = new Test(this, "Other", "List of other tests", true); group.children.push(new DeserializationJSON(this, hostDefault, applicationDefault)); group.children.push(new DeserializationXMLRPC(this, hostDefault, applicationDefault)); + group.children.push(new ParentFunctions(this, hostDefault, applicationDefault)); mapTests.push(group); luaGroup = new Test(this, "LUA", "List of LUA server tests", true); diff --git a/FunctionalTests/src/ParentFunctions.as b/FunctionalTests/src/ParentFunctions.as new file mode 100644 index 0000000..827a315 --- /dev/null +++ b/FunctionalTests/src/ParentFunctions.as @@ -0,0 +1,89 @@ +package +{ + import flash.events.NetStatusEvent; + import flash.events.TimerEvent; + import flash.net.NetConnection; + import flash.net.Responder; + import flash.utils.Timer; + + import mx.controls.Alert; + + public class ParentFunctions extends Test + { + private var _host:String; + private var _url:String; + private var _connection:NetConnection; + + public function ParentFunctions(app:FunctionalTests, host:String, url:String) + { + super(app, "ParentFunctions", "Check heritage of sub applications"); + _host=host; + _url=url; + } + + override public function run(onFinished:Function):void { + + super.run(onFinished); + + _connection = new NetConnection(); + _connection.addEventListener(NetStatusEvent.NET_STATUS, onStatus); + _connection.connect("rtmfp://" + _host + _url + "subapp/subsubapp"); + } + + // 1st response + public function onRealNameApp(response:String):void { + if (response=="subsubapp") { + _connection.call("getNameParentApp", new Responder(onNameParentApp)); + } else { + onResult({err:"onRealNameApp : Expected 'subsubapp' and received '"+response+"'"}); + _connection.close(); + } + } + + // 2nd response + public function onNameParentApp(response:String):void { + if (response=="subapp") { + // getNameApp doesn't exists in subsubApp => so it will fail + _connection.call("getNameApp", new Responder(null, onErrorNameApp)); + } else { + onResult({err:"onNameParentApp : Expected 'subapp' and received '"+response+"'"}); + _connection.close(); + } + } + + // 3rd response + public function onErrorNameApp(error:Object):void { + if (error.description=="Method 'getNameApp' not found on application /FunctionalTests/subapp/subsubapp") { + _connection.call("getNameSuperParentApp", new Responder(onNameSuperParentApp)); + } else { + onResult({err:"onErrorNameApp : Unexpected error '"+error.description+"'"}); + _connection.close(); + } + } + + // Last response + public function onNameSuperParentApp(response:String):void { + if (response=="FunctionalTests") { + _connection.close(); + onResult({}); // Test Terminated! + } else { + onResult({err:"onNameSuperParentApp : Expected 'subapp' and received '"+response+"'"}); + _connection.close(); + } + } + + public function onStatus(event:NetStatusEvent):void { + + switch(event.info.code) { + case "NetConnection.Connect.Success": + _connection.call("getRealNameApp", new Responder(onRealNameApp)); + break; + case "NetConnection.Connect.Closed": + break; + default: + onResult({err:event.info.code}); + } + } + + } +} \ No newline at end of file diff --git a/FunctionalTests/www/FunctionalTests/FunctionalTests.swf b/FunctionalTests/www/FunctionalTests/FunctionalTests.swf index 3d4cc5b..9834541 100644 Binary files a/FunctionalTests/www/FunctionalTests/FunctionalTests.swf and b/FunctionalTests/www/FunctionalTests/FunctionalTests.swf differ diff --git a/FunctionalTests/www/FunctionalTests/main.lua b/FunctionalTests/www/FunctionalTests/main.lua index 28d5c09..560ecfe 100644 --- a/FunctionalTests/www/FunctionalTests/main.lua +++ b/FunctionalTests/www/FunctionalTests/main.lua @@ -15,6 +15,13 @@ function serverPolicyFile:onConnection(client) end serverPolicyFile:start(843); -- start the server on the port 843 + +-- ******* For ParentFunctions Test ******* +function getNameApp() + INFO("FunctionalTests::getNameApp called") + return "FunctionalTests" +end + -- ******* Main functions ******* function onConnection(client,...) diff --git a/FunctionalTests/www/FunctionalTests/subapp/main.lua b/FunctionalTests/www/FunctionalTests/subapp/main.lua index 6a1ebb7..4bd68c5 100644 --- a/FunctionalTests/www/FunctionalTests/subapp/main.lua +++ b/FunctionalTests/www/FunctionalTests/subapp/main.lua @@ -1,4 +1,10 @@ +-- For ParentFunctions test +function getNameApp() + INFO("subapp::getNameApp called") + return "subapp" +end + function onConnection(client,...) INFO("New client on FunctionalTests/subapp (protocol : ", client.protocol, ")") diff --git a/FunctionalTests/www/FunctionalTests/subapp/subsubapp/main.lua b/FunctionalTests/www/FunctionalTests/subapp/subsubapp/main.lua new file mode 100644 index 0000000..9945a4e --- /dev/null +++ b/FunctionalTests/www/FunctionalTests/subapp/subsubapp/main.lua @@ -0,0 +1,20 @@ + +function onConnection(client,...) + + INFO("New client on FunctionalTests/subapp/subapp (protocol : ", client.protocol, ")") + + function client:getRealNameApp() + INFO("getRealNameApp called") + return "subsubapp" + end + + function client:getNameParentApp() + INFO("getNameParentApp called") + return super:getNameApp() + end + + function client:getNameSuperParentApp() + INFO("getNameSuperParentApp called") + return super.super:getNameApp() + end +end \ No newline at end of file diff --git a/MonaServer/sources/Service.cpp b/MonaServer/sources/Service.cpp index 8262d0e..31b837a 100644 --- a/MonaServer/sources/Service.cpp +++ b/MonaServer/sources/Service.cpp @@ -127,12 +127,12 @@ Service* Service::open(Exception& ex, const string& path) { pSubService = it->second; } - if (!nextPath.empty()) + // if file or folder exists, return the service (or sub service) + if (pSubService->open(ex)) { + if (nextPath.empty()) + return pSubService; return pSubService->open(ex, nextPath); - - // if file or folder exists, return the service - if (pSubService->open(ex)) - return pSubService; + } // service doesn't exist (and no children possible here!) if (it != _services.end() && ex.code() == Exception::APPLICATION) {