Thrift now works in PHP, hot stuff

Summary: End to end communication working in Thrift with PHP

Problem: It's a bit slower than pillar still. Need to find out why.

Reviewed By: aditya

Test Plan: Unit tests are in the test directory. Get lucas on the PHP case...




git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664720 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/java/src/TestClient.java b/test/java/src/TestClient.java
index 70cf826..cbcd802 100644
--- a/test/java/src/TestClient.java
+++ b/test/java/src/TestClient.java
@@ -78,14 +78,7 @@
         System.out.print("testByte(1)");
         UInt8 u8 = testClient.testByte(new UInt8((short)1));
         System.out.print(" = " + u8.get() + "\n");
-
-        /**
-         * U32 TEST
-         */
-        System.out.print("testU32(1)");
-        UInt32 u32 = testClient.testU32(new UInt32(1));
-        System.out.print(" = " + u32.get() + "\n");
-    
+  
         /**
          * I32 TEST
          */
@@ -94,13 +87,6 @@
         System.out.print(" = " + i32.get() + "\n");
 
         /**
-         * U64 TEST
-         */
-        System.out.print("testU64(34359738368)");
-        UInt64 u64 = testClient.testU64(new UInt64(34359738368L));
-        System.out.print(" = " + u64.toLong() + "\n");
-
-        /**
          * I64 TEST
          */
         System.out.print("testI64(-34359738368)");
@@ -110,27 +96,23 @@
         /**
          * STRUCT TEST
          */
-        System.out.print("testStruct({\"Zero\", 1, 2, -3, 4, -5})");
+        System.out.print("testStruct({\"Zero\", 1, -3, -5})");
         Xtruct out = new Xtruct();
         out.string_thing.value = "Zero";
         out.byte_thing.set((short)1);
-        out.u32_thing.set(2);
         out.i32_thing.set(-3);
-        out.u64_thing.set(4);
         out.i64_thing.set(-5);
         Xtruct in = testClient.testStruct(out);
         System.out.print(" = {" +
                          "\"" + in.string_thing.value + "\", " +
                          in.byte_thing.get() + ", " +
-                         in.u32_thing.get() + ", " +
                          in.i32_thing.get() + ", " +
-                         in.u64_thing.toLong() + ", " +
                          in.i64_thing.get() + "}\n");
 
         /**
          * NESTED STRUCT TEST
          */
-        System.out.print("testNest({1, {\"Zero\", 1, 2, -3, 4, -5}), 5}");
+        System.out.print("testNest({1, {\"Zero\", 1, -3, -5}), 5}");
         Xtruct2 out2 = new Xtruct2();
         out2.byte_thing.set((short)1);
         out2.struct_thing = out;
@@ -141,9 +123,7 @@
                          in2.byte_thing.get() + ", {" +
                          "\"" + in.string_thing.value + "\", " +
                          in.byte_thing.get() + ", " +
-                         in.u32_thing.get() + ", " +
                          in.i32_thing.get() + ", " +
-                         in.u64_thing.toLong() + ", " +
                          in.i64_thing.get() + "}, " +
                          in2.i32_thing.get() + "}\n");
 
@@ -267,8 +247,8 @@
          * TYPEDEF TEST
          */
         System.out.print("testTypedef(309858235082523)");
-        UInt64 uid = testClient.testTypedef(new UInt64(309858235082523L));
-        System.out.print(" = " + uid.toLong() + "\n");
+        Int64 uid = testClient.testTypedef(new Int64(309858235082523L));
+        System.out.print(" = " + uid.get() + "\n");
 
         /**
          * NESTED MAP TEST
@@ -291,31 +271,29 @@
          * INSANITY TEST
          */
         Insanity insane = new Insanity();
-        insane.userMap.put(Numberz.FIVE, new UInt64(5000));
+        insane.userMap.put(Numberz.FIVE, new Int64(5000));
         Xtruct truck = new Xtruct();
         truck.string_thing.value = "Truck";
         truck.byte_thing.set((short)8);
-        truck.u32_thing.set(8);
         truck.i32_thing.set(8);
-        truck.u64_thing.set(8);
         truck.i64_thing.set(8);
         insane.xtructs.add(truck);
         System.out.print("testInsanity()");
-        HashMap<UInt64,HashMap<Int32,Insanity>> whoa =
+        HashMap<Int64,HashMap<Int32,Insanity>> whoa =
           testClient.testInsanity(insane);
         System.out.print(" = {");
-        for (UInt64 key : whoa.keySet()) {
+        for (Int64 key : whoa.keySet()) {
           HashMap<Int32,Insanity> val = whoa.get(key);
-          System.out.print(key.toLong() + " => {");
+          System.out.print(key.get() + " => {");
 
           for (Int32 k2 : val.keySet()) {
             Insanity v2 = val.get(k2);
             System.out.print(k2.get() + " => {");
-            HashMap<Int32, UInt64> userMap = v2.userMap;
+            HashMap<Int32, Int64> userMap = v2.userMap;
             System.out.print("{");
             for (Int32 k3 : userMap.keySet()) {
               System.out.print(k3.get() + " => " +
-                               userMap.get(k3).toLong() + ", ");
+                               userMap.get(k3).get() + ", ");
             }
             System.out.print("}, ");
 
@@ -325,9 +303,7 @@
               System.out.print("{" +
                                "\"" + x.string_thing.value + "\", " +
                                x.byte_thing.get() + ", " +
-                               x.u32_thing.get() + ", "+
                                x.i32_thing.get() + ", "+
-                               x.u64_thing.toLong() + ", "+
                                x.i64_thing.get() + "}, ");
             }
             System.out.print("}");
diff --git a/test/java/src/TestServer.java b/test/java/src/TestServer.java
index c5edca4..0acc8a2 100644
--- a/test/java/src/TestServer.java
+++ b/test/java/src/TestServer.java
@@ -35,21 +35,11 @@
     return thing;
   }
 
-  public UInt32 testU32(UInt32 thing) {
-    System.out.print("testU32(" + thing.get() + ")\n");
-    return thing;
-  }
-
   public Int32 testI32(Int32 thing) {
     System.out.print("testI32(" + thing.get() + ")\n");
     return thing;
   }
 
-  public UInt64 testU64(UInt64 thing) {
-    System.out.print("testU64(" + thing.toLong() + ")\n");
-    return thing;
-  }
-
   public Int64 testI64(Int64 thing) {
     System.out.print("testI64(" + thing.get() + ")\n");
     return thing;
@@ -59,9 +49,7 @@
     System.out.print("testStruct({" +
                      "\"" + thing.string_thing.value + "\", " +
                      thing.byte_thing.get() + ", " +
-                     thing.u32_thing.get() + ", " +
                      thing.i32_thing.get() + ", " +
-                     thing.u64_thing.toLong() + ", " +
                      thing.i64_thing.get() + "})\n");
     return thing;
   }
@@ -72,9 +60,7 @@
                      nest.byte_thing.get() + ", {" +
                      "\"" + thing.string_thing.value + "\", " +
                      thing.byte_thing.get() + ", " +
-                     thing.u32_thing.get() + ", " +
                      thing.i32_thing.get() + ", " +
-                     thing.u64_thing.toLong() + ", " +
                      thing.i64_thing.get() + "}, " +
                      nest.i32_thing.get() + "})\n");
     return nest;
@@ -130,8 +116,8 @@
     return thing;
   }
 
-  public UInt64 testTypedef(UInt64 thing) {
-    System.out.print("testTypedef(" + thing.toLong() + ")\n");
+  public Int64 testTypedef(Int64 thing) {
+    System.out.print("testTypedef(" + thing.get() + ")\n");
     return thing;
   }
 
@@ -153,31 +139,27 @@
     return mapmap;
   }
 
-  public HashMap<UInt64, HashMap<Int32,Insanity>> testInsanity(Insanity argument) {
+  public HashMap<Int64, HashMap<Int32,Insanity>> testInsanity(Insanity argument) {
     System.out.print("testInsanity()\n");
     
     Xtruct hello = new Xtruct();
     hello.string_thing.value = "Hello2";
     hello.byte_thing.set((short)2);
-    hello.u32_thing.set(2);
     hello.i32_thing.set(2);
-    hello.u64_thing.set(2);
     hello.i64_thing.set(2);
 
     Xtruct goodbye = new Xtruct();
     goodbye.string_thing.value = "Goodbye4";
     goodbye.byte_thing.set((short)4);
-    goodbye.u32_thing.set(4);
     goodbye.i32_thing.set(4);
-    goodbye.u64_thing.set(4);
     goodbye.i64_thing.set(4);
 
     Insanity crazy = new Insanity();
-    crazy.userMap.put(Numberz.EIGHT, new UInt64(8));
+    crazy.userMap.put(Numberz.EIGHT, new Int64(8));
     crazy.xtructs.add(goodbye);
 
     Insanity looney = new Insanity();
-    crazy.userMap.put(Numberz.FIVE, new UInt64(5));
+    crazy.userMap.put(Numberz.FIVE, new Int64(5));
     crazy.xtructs.add(hello);
 
     HashMap<Int32,Insanity> first_map = new HashMap<Int32, Insanity>();
@@ -188,10 +170,10 @@
 
     second_map.put(Numberz.SIX, looney);
 
-    HashMap<UInt64,HashMap<Int32,Insanity>> insane =
-      new HashMap<UInt64, HashMap<Int32,Insanity>>();
-    insane.put(new UInt64(1), first_map);
-    insane.put(new UInt64(2), second_map);
+    HashMap<Int64,HashMap<Int32,Insanity>> insane =
+      new HashMap<Int64, HashMap<Int32,Insanity>>();
+    insane.put(new Int64(1), first_map);
+    insane.put(new Int64(2), second_map);
 
     return insane;
   }