You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2012/05/03 00:49:55 UTC
svn commit: r1333239 - in /thrift/trunk:
lib/java/test/org/apache/thrift/test/TestClient.java
test/cpp/src/TestClient.cpp
Author: roger
Date: Wed May 2 22:49:55 2012
New Revision: 1333239
URL: http://svn.apache.org/viewvc?rev=1333239&view=rev
Log:
THRIFT-1588 Java Generated Exceptions don't follow inheritance pattern as other Languages
Patch: Nathaniel Cook
Modified:
thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
thrift/trunk/test/cpp/src/TestClient.cpp
Modified: thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java?rev=1333239&r1=1333238&r2=1333239&view=diff
==============================================================================
--- thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java (original)
+++ thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java Wed May 2 22:49:55 2012
@@ -372,7 +372,68 @@ public class TestClient {
}
System.out.print("}\n");
- // Test oneway
+
+ /**
+ * EXECPTION TEST
+ */
+ try {
+ System.out.print("testClient.testException(\"Xception\") =>");
+ testClient.testException("Xception");
+ System.out.print(" void\nFAILURE\n");
+ } catch(Xception e) {
+ System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ }
+
+ try {
+ System.out.print("testClient.testException(\"Xception\") =>");
+ testClient.testException("Xception");
+ System.out.print(" void\nFAILURE\n");
+ } catch(TException e) {
+ System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ }
+
+ try {
+ System.out.print("testClient.testException(\"success\") =>");
+ testClient.testException("success");
+ System.out.print(" void\n");
+ }catch(Exception e) {
+ System.out.print(" exception\nFAILURE\n");
+ }
+
+
+ /**
+ * MULTI EXCEPTION TEST
+ */
+
+ try {
+ System.out.print("testClient.testMultiException(\"Xception\", \"test 1\") =>");
+ testClient.testMultiException("Xception", "test 1");
+ System.out.print(" result\nFAILURE\n");
+ } catch(Xception e) {
+ System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ }
+
+ try {
+ System.out.print("testClient.testMultiException(\"Xception2\", \"test 2\") =>");
+ testClient.testMultiException("Xception2", "test 2");
+ System.out.print(" result\nFAILURE\n");
+ } catch(Xception2 e) {
+ System.out.print(" {%u, {\"%s\"}}\n", e.errorCode, e.struct_thing.string_thing.c_str());
+ }
+
+ try {
+ System.out.print("testClient.testMultiException(\"success\", \"test 3\") =>");
+ testClient.testMultiException("success", "test 3");
+ System.out.print(" {{\"%s\"}}\n", result.string_thing.c_str());
+ } catch(Exception e) {
+ System.out.print(" exception\nFAILURE\n");
+ }
+
+
+
+ /**
+ * ONEWAY TEST
+ */
System.out.print("testOneway(3)...");
long startOneway = System.nanoTime();
testClient.testOneway(3);
Modified: thrift/trunk/test/cpp/src/TestClient.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/test/cpp/src/TestClient.cpp?rev=1333239&r1=1333238&r2=1333239&view=diff
==============================================================================
--- thrift/trunk/test/cpp/src/TestClient.cpp (original)
+++ thrift/trunk/test/cpp/src/TestClient.cpp Wed May 2 22:49:55 2012
@@ -530,6 +530,15 @@ int main(int argc, char** argv) {
}
try {
+ printf("testClient.testException(\"Xception\") =>");
+ testClient.testException("Xception");
+ printf(" void\nFAILURE\n");
+
+ } catch(TException& e) {
+ printf(" Caught TException\n");
+ }
+
+ try {
printf("testClient.testException(\"success\") =>");
testClient.testException("success");
printf(" void\n");