Add testAsync to ThriftTest.thrift which verifies async void works properly.
Summary:
- testAsync takes a number of seconds to sleep. The test client makes sure
that the RPC returns in less than 0.2 seconds even though it asks the server
to sleep for 3 seconds.
- Implemented this test for C++ and Java.
Test Plan:
- ran cpp TestServer and TestClient and verified functionality
- tested cpp and java test server/client against each other - tests passed
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665484 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/cpp/src/TestServer.cpp b/test/cpp/src/TestServer.cpp
index 773225e..14a8a8e 100644
--- a/test/cpp/src/TestServer.cpp
+++ b/test/cpp/src/TestServer.cpp
@@ -255,6 +255,12 @@
return;
}
}
+
+ void testAsync(int sleepFor) {
+ printf("testAsync(%d): Sleeping...\n", sleepFor);
+ sleep(sleepFor);
+ printf("testAsync(%d): done sleeping!\n", sleepFor);
+ }
};
int main(int argc, char **argv) {