Some thrift test code fixes

Reviewed By: tbr-testaditya


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665014 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Slee 2007-02-21 05:17:48 +00:00
parent 92195ae219
commit e129a2db0c
5 changed files with 49 additions and 13 deletions

View File

@ -1,9 +1,26 @@
struct Hello {
1: i32 simple,
2: map<i32,i32> complex,
3: map<i32, map<i32,i32>> complexer,
struct Goodbyez {
1: i32 val = 325;
}
senum Thinger {
"ASDFKJ",
"r32)*F#@",
"ASDFLJASDF"
}
struct Hello {
1: i32 simple = 53,
2: map<i32,i32> complex = {23:532, 6243:632, 2355:532},
3: map<i32, map<i32,i32>> complexer,
4: string words = "words",
5: Goodbyez thinz = {'val' : 36632}
}
const map<i32,map<i32,i32>> CMAP = { 235: {235:235}, 53:{53:53} }
const i32 CINT = 325;
const Hello WHOA = {'simple' : 532}
exception Goodbye {
1: i32 simple,
2: map<i32,i32> complex,
@ -11,7 +28,8 @@ exception Goodbye {
}
service SmallService {
Hello testMe(1:i32 hello, 2: Hello wonk) throws (1: Goodbye g),
Thinger testThinger(1:Thinger bootz),
Hello testMe(1:i32 hello=64, 2: Hello wonk) throws (1: Goodbye g),
void testVoid() throws (1: Goodbye g),
i32 testI32(1:i32 boo)
}

View File

@ -13,6 +13,12 @@ enum Numberz
typedef i64 UserId
struct Bonk
{
1: string message,
2: i32 type
}
struct Xtruct
{
1: string string_thing,

View File

@ -102,9 +102,13 @@ int main(int argc, char** argv) {
/**
* VOID TEST
*/
printf("testVoid()");
testClient.testVoid();
printf(" = void\n");
try {
printf("testVoid()");
testClient.testVoid();
printf(" = void\n");
} catch (TApplicationException tax) {
printf("%s\n", tax.what());
}
/**
* STRING TEST

View File

@ -3,6 +3,7 @@ package com.facebook.thrift.test;
// Generated code
import thrift.test.*;
import com.facebook.thrift.TApplicationException;
import com.facebook.thrift.transport.TTransport;
import com.facebook.thrift.transport.TSocket;
import com.facebook.thrift.transport.THttpClient;
@ -70,7 +71,7 @@ public class TestClient {
}
TBinaryProtocol binaryProtocol =
new TBinaryProtocol(transport, transport);
new TBinaryProtocol(transport);
ThriftTest.Client testClient =
new ThriftTest.Client(binaryProtocol);
@ -96,9 +97,13 @@ public class TestClient {
/**
* VOID TEST
*/
System.out.print("testVoid()");
testClient.testVoid();
System.out.print(" = void\n");
try {
System.out.print("testVoid()");
testClient.testVoid();
System.out.print(" = void\n");
} catch (TApplicationException tax) {
tax.printStackTrace();
}
/**
* STRING TEST
@ -303,12 +308,14 @@ public class TestClient {
* INSANITY TEST
*/
Insanity insane = new Insanity();
insane.userMap = new HashMap<Integer, Long>();
insane.userMap.put(Numberz.FIVE, (long)5000);
Xtruct truck = new Xtruct();
truck.string_thing = "Truck";
truck.byte_thing = (byte)8;
truck.i32_thing = 8;
truck.i64_thing = 8;
insane.xtructs = new ArrayList<Xtruct>();
insane.xtructs.add(truck);
System.out.print("testInsanity()");
AbstractMap<Long,AbstractMap<Integer,Insanity>> whoa =

View File

@ -23,7 +23,8 @@ require_once $GLOBALS['THRIFT_ROOT'].'/transport/TSocketPool.php';
require_once $GLOBALS['THRIFT_ROOT'].'/transport/TBufferedTransport.php';
/** Include the generated code */
require_once '/home/mcslee/code/projects/thrift/test/php/'.$GEN_DIR.'/ThriftTest.php';
require_once $GEN_DIR.'/ThriftTest.php';
require_once $GEN_DIR.'/ThriftTest_types.php';
$host = 'localhost';
$port = 9090;