THRIFT-5593 Implement uuid for Haxe
Client: hx
Patch: Jens Geyer
Relies on https://github.com/flashultra/uuid/issues/4 being fixed, thus may require using the most recent uuid package from Github instead of the Haxelib package.
diff --git a/test/haxe/src/TestClient.hx b/test/haxe/src/TestClient.hx
index 579dc00..3a07562 100644
--- a/test/haxe/src/TestClient.hx
+++ b/test/haxe/src/TestClient.hx
@@ -27,6 +27,8 @@
import haxe.ds.StringMap;
import haxe.ds.ObjectMap;
+import uuid.Uuid;
+
import org.apache.thrift.*;
import org.apache.thrift.helper.*;
import org.apache.thrift.protocol.*;
@@ -366,6 +368,14 @@
rslt.Expect( false, 'ZigZag.UnitTest: $e Test #101');
}
+ try {
+ UuidHelper.UnitTest();
+ rslt.Expect( true, 'UuidHelper.UnitTest Test #102');
+ }
+ catch( e : Dynamic) {
+ rslt.Expect( false, 'UuidHelper.UnitTest: $e Test #102');
+ }
+
#end
}
@@ -537,6 +547,19 @@
trace(' = $dub');
rslt.Expect(dub == 5.325098235, '$dub == 5.325098235');
+
+ var uuidOut : String = UuidHelper.CanonicalUuid("{00112233-4455-6677-8899-AABBCCDDEEFF}");
+ trace('testUuid(${uuidOut}');
+ try {
+ var uuidIn = client.testUuid(uuidOut);
+ trace('testUuid() = ${uuidIn}');
+ rslt.Expect( uuidIn == uuidOut, '${uuidIn} == ${uuidOut}');
+ }
+ catch (e : TApplicationException) {
+ trace('testUuid(${uuidOut}): '+e.errorMsg); // may not be supported by the server
+ }
+
+
var binOut = PrepareTestData(true);
trace('testBinary('+BytesToHex(binOut)+')');
try {
diff --git a/test/haxe/src/TestServerHandler.hx b/test/haxe/src/TestServerHandler.hx
index 0e19105..34e471b 100644
--- a/test/haxe/src/TestServerHandler.hx
+++ b/test/haxe/src/TestServerHandler.hx
@@ -25,6 +25,7 @@
import org.apache.thrift.server.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.helper.*;
+import uuid.Uuid;
import haxe.Int32;
import haxe.Int64;
@@ -147,6 +148,19 @@
}
/**
+ * Prints 'testUuid("%s")'
+ * @param Uuid thing - the uuid to print
+ * @return Uuid - returns the uuid 'thing'
+ *
+ * @param thing
+ */
+ public function testUuid(thing : String) : String
+ {
+ trace('testUuid($thing)');
+ return thing;
+ }
+
+ /**
* Prints 'testStruct("{%s}")' where thing has been formatted
* into a string of comma separated values
* @param Xtruct thing - the Xtruct to print