Skip to content

Commit 25319f7

Browse files
committed
Protocol conformity and serialization tests for UUIDs - Haxe
1 parent 73cabd2 commit 25319f7

File tree

8 files changed

+246
-159
lines changed

8 files changed

+246
-159
lines changed

lib/haxe/src/org/apache/thrift/TConfiguration.hx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ class TConfiguration
2525
public static inline var DEFAULT_MAX_FRAME_SIZE = 16384000; // this value is used consistently across all Thrift libraries
2626
public static inline var DEFAULT_RECURSION_DEPTH = 64;
2727

28-
public var MaxMessageSize(default,null) : Int = DEFAULT_MAX_MESSAGE_SIZE;
29-
public var MaxFrameSize(default,null) : Int = DEFAULT_MAX_FRAME_SIZE;
30-
public var RecursionLimit(default,null) : Int = DEFAULT_RECURSION_DEPTH;
28+
public var MaxMessageSize(default,default) : Int = DEFAULT_MAX_MESSAGE_SIZE;
29+
public var MaxFrameSize(default,default) : Int = DEFAULT_MAX_FRAME_SIZE;
30+
public var RecursionLimit(default,default) : Int = DEFAULT_RECURSION_DEPTH;
3131

3232
// TODO(JensG): add connection and i/o timeouts
3333

lib/haxe/test/HaxeTests.hxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ thrift -r -gen haxe ../../../lib/rb/benchmark/Benchmark.thrift</preBuildCommand
6363
<options>
6464
<option showHiddenPaths="False" />
6565
<option testMovie="Custom" />
66-
<option testMovieCommand="bin/HaxeTests/Main.exe server multiplex" />
66+
<option testMovieCommand="bin/HaxeTests/Main.exe server constants" />
6767
</options>
6868
<!-- Plugin storage -->
6969
<storage />

lib/haxe/test/src/ConstantsTest.hx

Lines changed: 0 additions & 74 deletions
This file was deleted.

lib/haxe/test/src/Main.hx

Lines changed: 74 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -20,83 +20,92 @@
2020
package;
2121

2222
import org.apache.thrift.*;
23+
import org.apache.thrift.meta_data.*;
2324
import org.apache.thrift.protocol.*;
24-
import org.apache.thrift.transport.*;
2525
import org.apache.thrift.server.*;
26-
import org.apache.thrift.meta_data.*;
27-
28-
import thrift.test.*; // generated code
29-
26+
import org.apache.thrift.transport.*;
27+
import tests.ConstantsTest;
28+
import tests.MultiplexTest;
29+
import tests.StreamTest;
30+
import thrift.test.*;
3031

31-
enum WhatTests {
32-
Normal;
33-
Multiplex;
34-
Constants;
32+
enum WhatTests
33+
{
34+
Normal;
35+
Multiplex;
36+
Constants;
3537
}
3638

3739
class Main
3840
{
39-
static private var tests : WhatTests = Normal;
40-
static private var server : Bool = false;
41+
static private var what : WhatTests = Normal;
42+
static private var server : Bool = false;
4143

42-
static private inline var CMDLINEHELP : String
43-
= "\nHaxeTests [client|server] [multiplex]\n"
44-
+ " client|server ... determines run mode for some tests, default is client\n"
45-
+ " multiplex ........ run multiplex test server or client\n";
44+
static private inline var CMDLINEHELP : String
45+
= "\nHaxeTests [client|server] [multiplex]\n"
46+
+ " client|server ... determines run mode for some tests, default is client\n"
47+
+ " multiplex ........ run multiplex test server or client\n"
48+
+ " constants ........ run constants and conformity tests\n"
49+
;
4650

47-
static private function ParseArgs() {
48-
#if sys
51+
static private function ParseArgs()
52+
{
53+
#if sys
4954

50-
var args = Sys.args();
51-
if ( args != null) {
52-
for ( arg in args) {
53-
switch(arg.toLowerCase()) {
54-
case "client":
55-
server = false;
56-
case "server" :
57-
server = true;
58-
case "multiplex" :
59-
tests = Multiplex;
60-
case "constants" :
61-
tests = Constants;
62-
default:
63-
throw 'Invalid argument "$arg"\n'+CMDLINEHELP;
64-
}
65-
}
66-
}
55+
var args = Sys.args();
56+
if ( args != null)
57+
{
58+
for ( arg in args)
59+
{
60+
switch (arg.toLowerCase())
61+
{
62+
case "client":
63+
server = false;
64+
case "server" :
65+
server = true;
66+
case "multiplex" :
67+
what = Multiplex;
68+
case "constants" :
69+
what = Constants;
70+
default:
71+
throw 'Invalid argument "$arg"\n'+CMDLINEHELP;
72+
}
73+
}
74+
}
6775

68-
#end
69-
}
76+
#end
77+
}
7078

71-
static public function main()
72-
{
73-
try
74-
{
75-
ParseArgs();
79+
static public function main()
80+
{
81+
try
82+
{
83+
ParseArgs();
7684

77-
switch( tests) {
78-
case Normal:
79-
#if sys
80-
StreamTest.Run(server);
81-
#end
82-
case Multiplex:
83-
#if ! (flash || html5 || js)
84-
MultiplexTest.Run(server);
85-
#end
86-
case Constants:
87-
ConstantsTest.Run(server);
88-
default:
89-
throw "Unhandled test mode $tests";
90-
}
85+
switch ( what)
86+
{
87+
case Normal:
88+
#if sys
89+
tests.StreamTest.Run(server);
90+
#end
91+
case Multiplex:
92+
#if ! (flash || html5 || js)
93+
tests.MultiplexTest.Run(server);
94+
#end
95+
case Constants:
96+
tests.ConstantsTest.Run(server);
97+
default:
98+
throw 'Unhandled test mode $what';
99+
}
91100

92-
trace("All tests completed.");
93-
}
94-
catch( e: Dynamic)
95-
{
96-
trace('$e');
97-
#if sys
98-
Sys.exit(1); // indicate error
99-
#end
100-
}
101-
}
101+
trace("All tests completed.");
102+
}
103+
catch ( e: Dynamic)
104+
{
105+
trace('$e');
106+
#if sys
107+
Sys.exit(1); // indicate error
108+
#end
109+
}
110+
}
102111
}

0 commit comments

Comments
 (0)