THRIFT-1336 thrift: added server and processor test code
move the tests from src to test:
lib\cpp\src\thrift\concurrency\test to lib\cpp\test\concurrency
lib\cpp\src\thrift\processor\test to lib\cpp\test\processor
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1337098 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index 6e2b2ba..4834e9f 100755
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -207,52 +207,8 @@
src/thrift/qt/TQIODeviceTransport.h \
src/thrift/qt/TQTcpServer.h
-
-noinst_PROGRAMS = concurrency_test \
- processor_test
-
-concurrency_test_SOURCES = \
- src/thrift/concurrency/test/Tests.cpp \
- src/thrift/concurrency/test/ThreadFactoryTests.h \
- src/thrift/concurrency/test/ThreadManagerTests.h \
- src/thrift/concurrency/test/TimerManagerTests.h
-
-concurrency_test_LDADD = libthrift.la
-
-processor_test_SOURCES = src/thrift/processor/test/ProcessorTest.cpp \
- src/thrift/processor/test/EventLog.cpp \
- src/thrift/processor/test/ServerThread.cpp \
- src/thrift/processor/test/EventLog.h \
- src/thrift/processor/test/Handlers.h \
- src/thrift/processor/test/ServerThread.h
-
-processor_test_LDADD = libprocessortest.la \
- libthrift.la \
- libthriftnb.la \
- $(BOOST_LDFLAGS) \
- -levent \
- $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
-
-check_PROGRAMS = \
- concurrency_test \
- processor_test
-
-TESTS = \
- $(check_PROGRAMS)
-
-noinst_LTLIBRARIES = libprocessortest.la
-
THRIFT = $(top_builddir)/compiler/cpp/thrift
-gen-cpp/ChildService.cpp: $(top_srcdir)/lib/cpp/src/thrift/processor/test/proc.thrift
- $(THRIFT) --gen cpp:templates,cob_style $<
-
-nodist_libprocessortest_la_SOURCES = \
- src/thrift/processor/test/gen-cpp/ChildService.h \
- src/thrift/processor/test/gen-cpp/ChildService.cpp \
- src/thrift/processor/test/gen-cpp/ParentService.h \
- src/thrift/processor/test/gen-cpp/ParentService.cpp
-
WINDOWS_DIST = \
README_WINDOWS \
src/thrift/windows \
diff --git a/lib/cpp/test/Makefile.am b/lib/cpp/test/Makefile.am
old mode 100644
new mode 100755
index bf41935..f7b1c26
--- a/lib/cpp/test/Makefile.am
+++ b/lib/cpp/test/Makefile.am
@@ -17,7 +17,7 @@
# under the License.
#
-noinst_LTLIBRARIES = libtestgencpp.la
+noinst_LTLIBRARIES = libtestgencpp.la libprocessortest.la
nodist_libtestgencpp_la_SOURCES = \
gen-cpp/DebugProtoTest_types.cpp \
gen-cpp/OptionalRequiredTest_types.cpp \
@@ -29,6 +29,14 @@
ThriftTest_extras.cpp \
DebugProtoTest_extras.cpp
+nodist_libprocessortest_la_SOURCES = \
+ gen-cpp/ChildService.cpp \
+ gen-cpp/ChildService.h \
+ gen-cpp/ParentService.cpp \
+ gen-cpp/ParentService.h \
+ gen-cpp/proc_types.cpp \
+ gen-cpp/proc_types.h
+
ThriftTest_extras.o: gen-cpp/ThriftTest_types.h
DebugProtoTest_extras.o: gen-cpp/DebugProtoTest_types.h
@@ -52,7 +60,9 @@
TransportTest \
ZlibTest \
TFileTransportTest \
- UnitTests
+ UnitTests \
+ concurrency_test \
+ processor_test
TESTS_ENVIRONMENT= \
BOOST_TEST_LOG_SINK=tests.xml \
@@ -163,7 +173,29 @@
SpecializationTest_LDADD = libtestgencpp.la
+concurrency_test_SOURCES = \
+ concurrency/Tests.cpp \
+ concurrency/ThreadFactoryTests.h \
+ concurrency/ThreadManagerTests.h \
+ concurrency/TimerManagerTests.h
+concurrency_test_LDADD = \
+ $(top_builddir)/lib/cpp/libthrift.la
+
+processor_test_SOURCES = \
+ processor/ProcessorTest.cpp \
+ processor/EventLog.cpp \
+ processor/ServerThread.cpp \
+ processor/EventLog.h \
+ processor/Handlers.h \
+ processor/ServerThread.h
+
+processor_test_LDADD = libprocessortest.la \
+ $(top_builddir)/lib/cpp/libthrift.la \
+ $(top_builddir)/lib/cpp/libthriftnb.la \
+ $(BOOST_LDFLAGS) \
+ -levent \
+ $(BOOST_ROOT_PATH)/lib/libboost_unit_test_framework.a
#
# Common thrift code generation rules
#
@@ -181,6 +213,9 @@
gen-cpp/SecondService.cpp gen-cpp/ThriftTest_constants.cpp gen-cpp/ThriftTest.cpp gen-cpp/ThriftTest_types.cpp gen-cpp/ThriftTest_types.h: $(top_srcdir)/test/ThriftTest.thrift
$(THRIFT) --gen cpp:dense $<
+gen-cpp/ChildService.cpp: processor/proc.thrift
+ $(THRIFT) --gen cpp:templates,cob_style $<
+
INCLUDES = \
-I$(top_srcdir)/lib/cpp/src
diff --git a/lib/cpp/src/thrift/concurrency/test/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp
similarity index 100%
rename from lib/cpp/src/thrift/concurrency/test/Tests.cpp
rename to lib/cpp/test/concurrency/Tests.cpp
diff --git a/lib/cpp/src/thrift/concurrency/test/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h
similarity index 100%
rename from lib/cpp/src/thrift/concurrency/test/ThreadFactoryTests.h
rename to lib/cpp/test/concurrency/ThreadFactoryTests.h
diff --git a/lib/cpp/src/thrift/concurrency/test/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h
similarity index 100%
rename from lib/cpp/src/thrift/concurrency/test/ThreadManagerTests.h
rename to lib/cpp/test/concurrency/ThreadManagerTests.h
diff --git a/lib/cpp/src/thrift/concurrency/test/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h
similarity index 100%
rename from lib/cpp/src/thrift/concurrency/test/TimerManagerTests.h
rename to lib/cpp/test/concurrency/TimerManagerTests.h
diff --git a/lib/cpp/src/thrift/processor/test/EventLog.cpp b/lib/cpp/test/processor/EventLog.cpp
old mode 100644
new mode 100755
similarity index 98%
rename from lib/cpp/src/thrift/processor/test/EventLog.cpp
rename to lib/cpp/test/processor/EventLog.cpp
index 7d27569..0ac3028
--- a/lib/cpp/src/thrift/processor/test/EventLog.cpp
+++ b/lib/cpp/test/processor/EventLog.cpp
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-#include "processor/test/EventLog.h"
+#include "EventLog.h"
#include <stdarg.h>
diff --git a/lib/cpp/src/thrift/processor/test/EventLog.h b/lib/cpp/test/processor/EventLog.h
old mode 100644
new mode 100755
similarity index 98%
rename from lib/cpp/src/thrift/processor/test/EventLog.h
rename to lib/cpp/test/processor/EventLog.h
index 007b666..d731cec
--- a/lib/cpp/src/thrift/processor/test/EventLog.h
+++ b/lib/cpp/test/processor/EventLog.h
@@ -19,7 +19,7 @@
#ifndef _THRIFT_TEST_EVENTLOG_H_
#define _THRIFT_TEST_EVENTLOG_H_ 1
-#include "concurrency/Monitor.h"
+#include <thrift/concurrency/Monitor.h>
namespace apache { namespace thrift { namespace test {
diff --git a/lib/cpp/src/thrift/processor/test/Handlers.h b/lib/cpp/test/processor/Handlers.h
old mode 100644
new mode 100755
similarity index 99%
rename from lib/cpp/src/thrift/processor/test/Handlers.h
rename to lib/cpp/test/processor/Handlers.h
index a4f5070..2be262a
--- a/lib/cpp/src/thrift/processor/test/Handlers.h
+++ b/lib/cpp/test/processor/Handlers.h
@@ -19,7 +19,7 @@
#ifndef _THRIFT_PROCESSOR_TEST_HANDLERS_H_
#define _THRIFT_PROCESSOR_TEST_HANDLERS_H_ 1
-#include "processor/test/EventLog.h"
+#include "EventLog.h"
#include "gen-cpp/ParentService.h"
#include "gen-cpp/ChildService.h"
diff --git a/lib/cpp/src/thrift/processor/test/ProcessorTest.cpp b/lib/cpp/test/processor/ProcessorTest.cpp
similarity index 99%
rename from lib/cpp/src/thrift/processor/test/ProcessorTest.cpp
rename to lib/cpp/test/processor/ProcessorTest.cpp
index fd43d14..58b82fb 100755
--- a/lib/cpp/src/thrift/processor/test/ProcessorTest.cpp
+++ b/lib/cpp/test/processor/ProcessorTest.cpp
@@ -35,9 +35,9 @@
#include <thrift/server/TSimpleServer.h>
#include <thrift/transport/TSocket.h>
-#include <thrift/processor/test/EventLog.h>
-#include <thrift/processor/test/ServerThread.h>
-#include <thrift/processor/test/Handlers.h>
+#include "EventLog.h"
+#include "ServerThread.h"
+#include "Handlers.h"
#include "gen-cpp/ChildService.h"
using namespace std;
diff --git a/lib/cpp/src/thrift/processor/test/ServerThread.cpp b/lib/cpp/test/processor/ServerThread.cpp
old mode 100644
new mode 100755
similarity index 94%
rename from lib/cpp/src/thrift/processor/test/ServerThread.cpp
rename to lib/cpp/test/processor/ServerThread.cpp
index d90fdf3..9f2087c
--- a/lib/cpp/src/thrift/processor/test/ServerThread.cpp
+++ b/lib/cpp/test/processor/ServerThread.cpp
@@ -19,13 +19,13 @@
#ifndef _THRIFT_TEST_SERVERTHREAD_TCC_
#define _THRIFT_TEST_SERVERTHREAD_TCC_ 1
-#include "processor/test/ServerThread.h"
+#include "ServerThread.h"
-#include "concurrency/PosixThreadFactory.h"
-#include "concurrency/ThreadManager.h"
-#include "server/TThreadPoolServer.h"
-#include "transport/TBufferTransports.h"
-#include "transport/TServerSocket.h"
+#include <thrift/concurrency/PosixThreadFactory.h>
+#include <thrift/concurrency/ThreadManager.h>
+#include <thrift/server/TThreadPoolServer.h>
+#include <thrift/transport/TBufferTransports.h>
+#include <thrift/transport/TServerSocket.h>
namespace apache { namespace thrift { namespace test {
diff --git a/lib/cpp/src/thrift/processor/test/ServerThread.h b/lib/cpp/test/processor/ServerThread.h
old mode 100644
new mode 100755
similarity index 95%
rename from lib/cpp/src/thrift/processor/test/ServerThread.h
rename to lib/cpp/test/processor/ServerThread.h
index 76ceded..0dd5127
--- a/lib/cpp/src/thrift/processor/test/ServerThread.h
+++ b/lib/cpp/test/processor/ServerThread.h
@@ -19,12 +19,12 @@
#ifndef _THRIFT_TEST_SERVERTHREAD_H_
#define _THRIFT_TEST_SERVERTHREAD_H_ 1
-#include "TProcessor.h"
-#include "protocol/TProtocol.h"
-#include "server/TServer.h"
-#include "transport/TTransport.h"
+#include <thrift/TProcessor.h>
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/server/TServer.h>
+#include <thrift/transport/TTransport.h>
-#include "processor/test/EventLog.h"
+#include "EventLog.h"
namespace apache { namespace thrift { namespace test {
diff --git a/lib/cpp/src/thrift/processor/test/proc.thrift b/lib/cpp/test/processor/proc.thrift
similarity index 100%
rename from lib/cpp/src/thrift/processor/test/proc.thrift
rename to lib/cpp/test/processor/proc.thrift