THRIFT-2815 Support for Multiplexing Services on any Transport, Protocol and Server
Client: Haxe
Patch: Jens Geyer
This closes #262
diff --git a/lib/haxe/test/src/Main.hx b/lib/haxe/test/src/Main.hx
index da0a7f5..6c262d7 100644
--- a/lib/haxe/test/src/Main.hx
+++ b/lib/haxe/test/src/Main.hx
@@ -27,19 +27,67 @@
import thrift.test.*; // generated code
+
+enum WhatTests {
+ Normal;
+ Multiplex;
+}
+
class Main
{
+ static private var tests : WhatTests = Normal;
+ static private var server : Bool = false;
+
+ static private inline var CMDLINEHELP : String
+ = "\nHaxeTests [client|server] [multiplex]\n"
+ + " client|server ... determines run mode for some tests, default is client\n"
+ + " multiplex ........ run multiplex test server or client\n";
+
+ static private function ParseArgs() {
+ #if sys
+
+ var args = Sys.args();
+ if ( args != null) {
+ for ( arg in args) {
+ switch(arg.toLowerCase()) {
+ case "client":
+ server = false;
+ case "server" :
+ server = true;
+ case "multiplex" :
+ tests = Multiplex;
+ default:
+ throw 'Invalid argument "$arg"\n'+CMDLINEHELP;
+ }
+ }
+ }
+
+ #end
+ }
+
static public function main()
{
try
{
- StreamTest.Run();
+ ParseArgs();
+
+ switch( tests) {
+ case Normal:
+ StreamTest.Run(server);
+ case Multiplex:
+ MultiplexTest.Run(server);
+ default:
+ throw "Unhandled test mode $tests";
+ }
trace("All tests completed.");
}
catch( e: Dynamic)
{
trace('$e');
+ #if sys
+ Sys.exit(1); // indicate error
+ #end
}
}
}
\ No newline at end of file