public void testClient(TTransport transport, TProtocol prot)
throws TException {
ThriftTest.Client testClient =
new ThriftTest.Client(prot);
Insanity insane = new Insanity();
/**
* CONNECT TEST
*/
transport.open();
long start = System.nanoTime();
/**
* VOID TEST
*/
testClient.testVoid();
/**
* STRING TEST
*/
String s = testClient.testString("Test");
/**
* IDENTITY TEST
*/
if (prot instanceof THeaderProtocol) {
assertEquals(identity,
((THeaderTransport)prot.getTransport()).getPeerIdentity());
}
/**
* BYTE TEST
*/
byte i8 = testClient.testByte((byte)1);
/**
* I32 TEST
*/
int i32 = testClient.testI32(-1);
/**
* I64 TEST
*/
long i64 = testClient.testI64(-34359738368L);
/**
* DOUBLE TEST
*/
double t = 5.325098235;
double dub = testClient.testDouble(t);
assertEquals(t, dub);
/**
* STRUCT TEST
*/
Xtruct out = new Xtruct();
out.string_thing = "Zero";
out.byte_thing = (byte) 1;
out.i32_thing = -3;
out.i64_thing = -5;
Xtruct in = testClient.testStruct(out);
assertEquals(out, in);
/**
* NESTED STRUCT TEST
*/
Xtruct2 out2 = new Xtruct2();
out2.byte_thing = (short)1;
out2.struct_thing = out;
out2.i32_thing = 5;
Xtruct2 in2 = testClient.testNest(out2);
in = in2.struct_thing;
assertEquals(out2, in2);
/**
* MAP TEST
*/
Map<Integer,Integer> mapout = new HashMap<Integer,Integer>();
for (int i = 0; i < 5; ++i) {
mapout.put(i, i - 10);
}
Map<Integer,Integer> mapin = testClient.testMap(mapout);
assertEquals(mapout, mapin);
/**
* SET TEST
*/
Set<Integer> setout = new HashSet<Integer>();
for (int i = -2; i < 3; ++i) {
setout.add(i);
}
Set<Integer> setin = testClient.testSet(setout);
assertEquals(setout, setin);
/**
* LIST TEST
*/
List<Integer> listout = new ArrayList<Integer>();
for (int i = -2; i < 3; ++i) {
listout.add(i);
}
List<Integer> listin = testClient.testList(listout);
assertEquals(listout, listin);
/**
* ENUM TEST
*/
int ret = testClient.testEnum(Numberz.ONE);
ret = testClient.testEnum(Numberz.TWO);
ret = testClient.testEnum(Numberz.THREE);
ret = testClient.testEnum(Numberz.FIVE);
ret = testClient.testEnum(Numberz.EIGHT);
/**
* TYPEDEF TEST
*/
long uid = testClient.testTypedef(309858235082523L);
/**
* NESTED MAP TEST
*/
Map<Integer,Map<Integer,Integer>> mm =
testClient.testMapMap(1);
/**
* INSANITY TEST
*/
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);
Map<Long,Map<Integer,Insanity>> whoa =
testClient.testInsanity(insane);
for (long key : whoa.keySet()) {
Map<Integer,Insanity> val = whoa.get(key);
for (int k2 : val.keySet()) {
Insanity v2 = val.get(k2);
Map<Integer, Long> userMap = v2.userMap;
if (userMap != null) {
for (int k3 : userMap.keySet()) {
}
}