Author: ivank
Date: Fri Oct 28 13:36:43 2011
New Revision: 1190306
URL: http://svn.apache.org/viewvc?rev=1190306&view=rev
Log:
BOOKKEEPER-71: hedwig c++ client does not build . (ivank)
Added:
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/README
Removed:
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/config.h.in
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/servercontrol.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/servercontrol.h
zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/ServerControl.java
zookeeper/bookkeeper/trunk/hedwig-server/src/test/java/org/apache/hedwig/ServerControlDaemon.java
Modified:
zookeeper/bookkeeper/trunk/CHANGES.txt
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/configure.ac
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/callback.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/client.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/Makefile.am
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/client.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/eventdispatcher.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/exceptions.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/publisherimpl.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/network-delays.sh
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/server-control.sh
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/tester.sh
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/Makefile.am
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/main.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/publishtest.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubdatatest.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubtest.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/subscribetest.cpp
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/util.h
zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/utiltest.cpp
Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Fri Oct 28 13:36:43 2011
@@ -74,6 +74,8 @@ BUGFIXES:
BOOKKEEPER-88: derby doesn't like - in the topic names (breed via ivank)
+ BOOKKEEPER-71: hedwig c++ client does not build . (ivank)
+
IMPROVEMENTS:
BOOKKEEPER-28: Create useful startup scripts for bookkeeper and hedwig (ivank)
Added: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/README
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/README?rev=1190306&view=auto
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/README (added)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/README Fri Oct 28 13:36:43 2011
@@ -0,0 +1,10 @@
+To build:
+ $ libtoolize
+ $ autoreconf -fi
+ $ ./configure
+ $ make
+
+The devel packages for protobuf, cppunit, log4cxx & boost are required.
+
+To test:
+ $ make check
\ No newline at end of file
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/configure.ac
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/configure.ac?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/configure.ac (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/configure.ac Fri Oct 28 13:36:43
2011
@@ -16,7 +16,7 @@
# limitations under the License.
#
-AC_INIT([Hedwig C++ Client], [0.1], [zookeeper-dev@hadoop.apache.org], [hedwig-cpp], [http://hadoop.apache.org/zookeeper//])
+AC_INIT([Hedwig C++ Client], [0.1], [bookkeeper-dev@zookeeper.apache.org], [hedwig-cpp],
[http://zookeeper.apache.org/bookkeeper/])
AC_PREREQ([2.59])
AM_INIT_AUTOMAKE([1.9 no-define foreign])
@@ -27,10 +27,17 @@ AC_CONFIG_FILES([Makefile lib/Makefile t
AC_PROG_LIBTOOL
AC_CONFIG_MACRO_DIR([m4])
PKG_CHECK_MODULES([DEPS], [liblog4cxx protobuf cppunit])
+PKG_CHECK_MODULES([TESTDEPS], [cppunit])
+
AX_BOOST_BASE
AX_BOOST_ASIO
AX_BOOST_THREAD
+AC_CHECK_HEADER(tr1/memory, [AC_MSG_RESULT([Found builtin TR1 library])],[
+ AC_CHECK_HEADER(boost/tr1/memory.hpp,
+ [AC_DEFINE(USE_BOOST_TR1, [], [Found Boost TR1 library])],
+ [AC_MSG_ERROR([TR1 not found, builtin TR1 or boost TR1 is required])])])
+
DX_HTML_FEATURE(ON)
DX_INIT_DOXYGEN(hedwig-c++, c-doc.Doxyfile, doc)
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/callback.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/callback.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/callback.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/callback.h Fri Oct 28
13:36:43 2011
@@ -21,7 +21,12 @@
#include <string>
#include <hedwig/exceptions.h>
#include <hedwig/protocol.h>
+
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/memory.hpp>
+#else
#include <tr1/memory>
+#endif
namespace Hedwig {
class OperationCallback {
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/client.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/client.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/client.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/inc/hedwig/client.h Fri Oct 28 13:36:43
2011
@@ -19,7 +19,12 @@
#define HEDWIG_CLIENT_H
#include <string>
+
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/memory.hpp>
+#else
#include <tr1/memory>
+#endif
#include <hedwig/subscribe.h>
#include <hedwig/publish.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/Makefile.am
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/Makefile.am?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/Makefile.am (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/Makefile.am Fri Oct 28 13:36:43
2011
@@ -16,7 +16,7 @@
# limitations under the License.
#
-PROTODEF = ../../../../../protocol/src/main/protobuf/PubSubProtocol.proto
+PROTODEF = ../../../../../hedwig-protocol/src/main/protobuf/PubSubProtocol.proto
lib_LTLIBRARIES = libhedwig01.la
libhedwig01_la_SOURCES = protocol.cpp channel.cpp client.cpp util.cpp clientimpl.cpp publisherimpl.cpp
subscriberimpl.cpp eventdispatcher.cpp data.cpp
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/channel.h Fri Oct 28 13:36:43
2011
@@ -25,8 +25,13 @@
#include "data.h"
#include "eventdispatcher.h"
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/memory.hpp>
+#include <boost/tr1/unordered_map.hpp>
+#else
#include <tr1/memory>
#include <tr1/unordered_map>
+#endif
#include <google/protobuf/io/zero_copy_stream_impl.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/client.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/client.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/client.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/client.cpp Fri Oct 28 13:36:43
2011
@@ -16,6 +16,10 @@
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <hedwig/client.h>
#include <memory>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "clientimpl.h"
#include "channel.h"
#include "publisherimpl.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.h Fri Oct 28 13:36:43
2011
@@ -28,7 +28,12 @@
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/unordered_map.hpp>
+#else
#include <tr1/unordered_map>
+#endif
+
#include <list>
#include "util.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <hedwig/protocol.h>
#include "data.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/data.h Fri Oct 28 13:36:43 2011
@@ -23,7 +23,13 @@
#include <hedwig/callback.h>
#include <pthread.h>
+
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/unordered_set.hpp>
+#else
#include <tr1/unordered_set>
+#endif
+
#include "util.h"
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/eventdispatcher.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/eventdispatcher.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/eventdispatcher.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/eventdispatcher.cpp Fri Oct
28 13:36:43 2011
@@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "eventdispatcher.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/exceptions.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/exceptions.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/exceptions.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/exceptions.cpp Fri Oct 28 13:36:43
2011
@@ -16,6 +16,10 @@
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <hedwig/exceptions.h>
#include <stdlib.h>
#include <string.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/publisherimpl.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/publisherimpl.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/publisherimpl.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/publisherimpl.cpp Fri Oct 28
13:36:43 2011
@@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "publisherimpl.h"
#include "channel.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.cpp Fri Oct 28
13:36:43 2011
@@ -15,6 +15,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include "subscriberimpl.h"
#include "util.h"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/subscriberimpl.h Fri Oct 28
13:36:43 2011
@@ -22,7 +22,13 @@
#include <hedwig/callback.h>
#include "clientimpl.h"
#include <utility>
+
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/memory.hpp>
+#else
#include <tr1/memory>
+#endif
+
#include <deque>
#include <boost/shared_ptr.hpp>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <string>
#include <netdb.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/util.h Fri Oct 28 13:36:43 2011
@@ -26,7 +26,13 @@
#include <list>
#include <iostream>
#include <utility>
+
+#ifdef USE_BOOST_TR1
+#include <boost/tr1/functional.hpp>
+#else
#include <tr1/functional>
+#endif
+
#include <semaphore.h>
#include <pthread.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/network-delays.sh
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/network-delays.sh?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/network-delays.sh (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/network-delays.sh Fri Oct
28 13:36:43 2011
@@ -25,18 +25,22 @@ setup_delays() {
case "$UNAME" in
Darwin|FreeBSD)
sudo ipfw pipe 1 config delay ${1}ms
- sudo ipfw add pipe 1 dst-port 12349
- sudo ipfw add pipe 1 dst-port 12350
- sudo ipfw add pipe 1 src-port 12349
- sudo ipfw add pipe 1 src-port 12350
+ sudo ipfw add pipe 1 dst-port 4081
+ sudo ipfw add pipe 1 dst-port 4081
+ sudo ipfw add pipe 1 src-port 4082
+ sudo ipfw add pipe 1 src-port 4082
+ sudo ipfw add pipe 1 src-port 4083
+ sudo ipfw add pipe 1 src-port 4083
;;
Linux)
sudo tc qdisc add dev lo root handle 1: prio
sudo tc qdisc add dev lo parent 1:3 handle 30: netem delay ${1}ms
- sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 12349 0xffff
flowid 1:3
- sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 12350 0xffff
flowid 1:3
- sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 12349 0xffff
flowid 1:3
- sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 12350 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 4081 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 4081 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4082 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4082 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4083 0xffff
flowid 1:3
+ sudo tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4083 0xffff
flowid 1:3
;;
*)
echo "Unknown system type, $UNAME, only Linux, Darwin & FreeBSD supported"
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/server-control.sh
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/server-control.sh?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/server-control.sh (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/server-control.sh Fri Oct
28 13:36:43 2011
@@ -17,33 +17,132 @@
# limitations under the License.
#
-HEDWIGBASE=../../../../..
+BASE=../../../../../
+BKSCRIPT=$BASE/bookkeeper-server/bin/bookkeeper
+HWSCRIPT=$BASE/hedwig-server/bin/hedwig
+ZKCLIENT=org.apache.zookeeper.ZooKeeperMain
+
+check_bk_down() {
+ NUM_UP=100
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ NUM_UP=`sh $BKSCRIPT $ZKCLIENT ls /ledgers/available 2> /dev/null | awk 'BEGIN{SERVERS=0}
/^\[/ { gsub(/[,\[\]]/, ""); SERVERS=NF} END{ print SERVERS }'`
+ if [ $NUM_UP == 0 ]; then
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ $NUM_UP != 0 ]; then
+ echo "Warning: Couldn't stop all bookies"
+ exit 1;
+ fi
+}
+
+check_bk_up() {
+ NUM_BOOKIES=$1
+ NUM_UP=0
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ NUM_UP=`sh $BKSCRIPT $ZKCLIENT ls /ledgers/available 2> /dev/null | awk 'BEGIN{SERVERS=0}
/^\[/ { gsub(/[,\[\]]/, ""); SERVERS=NF} END{ print SERVERS }'`
+ if [ $NUM_UP == $NUM_BOOKIES ]; then
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ $NUM_UP != $NUM_BOOKIES ]; then
+ echo "Couldn't start bookkeeper"
+ exit 1;
+ fi
+}
+
+check_hw_down() {
+ REGION=$1
+ NUM_UP=100
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ NUM_UP=`sh $BKSCRIPT $ZKCLIENT ls /hedwig/$REGION/hosts 2> /dev/null | awk 'BEGIN{SERVERS=0}
/^\[/ { gsub(/[,\[\]]/, ""); SERVERS=NF} END{ print SERVERS }'`
+ if [ $NUM_UP == 0 ]; then
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ $NUM_UP != 0 ]; then
+ echo "Warning: Couldn't stop all hedwig servers"
+ exit 1;
+ fi
+}
+
+check_hw_up() {
+ REGION=$1
+ NUM_SERVERS=$2
+ NUM_UP=0
+ for i in 0 1 2 3 4 5 6 7 8 9; do
+ NUM_UP=`sh $BKSCRIPT $ZKCLIENT ls /hedwig/$REGION/hosts 2> /dev/null | awk 'BEGIN{SERVERS=0}
/^\[/ { gsub(/[,\[\]]/, ""); SERVERS=NF} END{ print SERVERS }'`
+ if [ $NUM_UP == $NUM_SERVERS ]; then
+ break;
+ fi
+ sleep 1
+ done
+
+ if [ $NUM_UP != $NUM_SERVERS ]; then
+ echo "Couldn't start hedwig"
+ exit 1;
+ fi
+}
+
+start_hw_server () {
+ REGION=$1
+ COUNT=$2
+ PORT=$((4080+$COUNT))
+
+ export HEDWIG_SERVER_CONF=/tmp/hw-server-$COUNT.conf
+ cat > $HEDWIG_SERVER_CONF <<EOF
+zk_host=localhost:2181
+# The number of milliseconds of each tick in ZooKeeper.
+zk_timeout=2000
+# The port at which the clients will connect.
+server_port=$PORT
+# The SSL port at which the clients will connect (only if SSL is enabled).
+ssl_server_port=9876
+# Flag indicating if the server should also operate in SSL mode.
+ssl_enabled=false
+region=$REGION
+EOF
+ sh $HWSCRIPT server 2>&1 > hwoutput.$COUNT.log &
+ echo $! > hwprocess.$COUNT.pid
+}
+
+start_cluster() {
+ if [ -e bkprocess.pid ] || [ `ls hwprocess.*.pid 2> /dev/null | wc -l` != 0 ]; then
+ stop_cluster;
+ fi
+
+ sh $BKSCRIPT localbookie 3 2>&1 > bkoutput.log &
+ echo $! > bkprocess.pid
+ check_bk_up 3
+
+ for i in 1 2 3; do
+ start_hw_server CppUnitTest $i
+ done
+ check_hw_up CppUnitTest 3
+}
+
+stop_cluster() {
+ for i in hwprocess.*.pid; do
+ if [ ! -e $i ]; then
+ continue;
+ fi
+ kill `cat $i`;
+ rm $i;
+ done
+ check_hw_down
+
+ if [ ! -e bkprocess.pid ]; then
+ return;
+ fi
+
+ kill `cat bkprocess.pid`
+ rm bkprocess.pid
-HEDWIGJAR=`ls $HEDWIGBASE/server/target/server-*-with-dependencies.jar`
-if [ ! $? -eq 0 ]; then
- echo "\n\nCould not find server-VERSION-with-dependencies.jar. \nYou need to build the
java part of hedwig. \nRun mvn package in the toplevel hedwig directory.\n\n"
- exit 1;
-fi
-
-HEDWIGSERVERTESTS=$HEDWIGBASE/server/target/test-classes/
-if [ ! -e $HEDWIGSERVERTESTS ]; then
- echo "\n\nThe hedwig java server tests need to be build.\b\b"
- exit 1;
-fi
-
-export CP=.:$HEDWIGJAR:$HEDWIGSERVERTESTS
-
-start_control_server() {
- if [ -e server-control.pid ]; then
- kill -9 `cat server-control.pid`
- rm server-control.pid
- fi
- java -cp $CP -Dlog4j.configuration=log4j.properties org.apache.hedwig.ServerControlDaemon
<&- 1> servercontrol.out 2>&1 &
- echo $! > server-control.pid
- sleep 5
-}
-
-stop_control_server() {
- kill -9 `cat server-control.pid`
- rm server-control.pid
+ check_bk_down
}
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/tester.sh
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/tester.sh?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/tester.sh (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/scripts/tester.sh Fri Oct 28 13:36:43
2011
@@ -27,11 +27,12 @@ all() {
setup_delays $HEDWIG_NETWORK_DELAY
fi
- start_control_server;
+ stop_cluster;
+ start_cluster;
../test/hedwigtest
RESULT=$?
- stop_control_server;
+ stop_cluster;
if [ "z$HEDWIG_NETWORK_DELAY" != "z" ]; then
clear_delays
@@ -57,11 +58,11 @@ EOF
}
case "$1" in
- start-control-server)
- start_control_server
+ start-cluster)
+ start_cluster
;;
- stop-control-server)
- stop_control_server
+ stop-cluster)
+ stop_cluster
;;
setup-delays)
setup_delays $2
@@ -79,11 +80,11 @@ Usage: tester.sh [command]
tester.sh all
Run through the tests, setting up and cleaning up all prerequisites.
-tester.sh start-control-server
- Starts the deamon which the tests use to start and stop hedwig/zookeeper/bookeeper servers
+tester.sh start-cluster
+ Start a hedwig cluster
-tester.sh stop-control-server
- Stops the aforementioned daemon
+tester.sh stop-cluster
+ Stops a hedwig cluster
tester.sh setup-delays <delay>
Set the millisecond delay for accessing the hedwig servers for the tests.
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/Makefile.am
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/Makefile.am?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/Makefile.am (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/Makefile.am Fri Oct 28 13:36:43
2011
@@ -17,9 +17,9 @@
#
bin_PROGRAMS = hedwigtest
-hedwigtest_SOURCES = main.cpp utiltest.cpp pubsubdatatest.cpp publishtest.cpp subscribetest.cpp
servercontrol.cpp pubsubtest.cpp
-hedwigtest_CPPFLAGS = -I$(top_srcdir)/inc $(DEPS_CFLAGS) $(BOOST_CPPFLAGS)
-hedwigtest_LDADD = $(DEPS_LIBS) -L$(top_builddir)/lib -lhedwig01
+hedwigtest_SOURCES = main.cpp utiltest.cpp pubsubdatatest.cpp publishtest.cpp subscribetest.cpp
pubsubtest.cpp
+hedwigtest_CPPFLAGS = -I$(top_srcdir)/inc $(DEPS_CFLAGS) $(TESTDEPS_CFLAGS) $(BOOST_CPPFLAGS)
+hedwigtest_LDADD = $(DEPS_LIBS) $(TESTDEPS_LIBS) -L$(top_builddir)/lib -lhedwig01
hedwigtest_LDFLAGS = -no-undefined $(BOOST_ASIO_LIB) $(BOOST_LDFLAGS) $(BOOST_THREAD_LIB)
check: hedwigtest
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/main.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/main.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/main.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/main.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include "../lib/channel.h"
#include "../lib/util.h"
#include <hedwig/protocol.h>
@@ -26,7 +30,6 @@
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/helpers/exception.h>
-#include "servercontrol.h"
#include "util.h"
#include <cppunit/extensions/TestFactoryRegistry.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/publishtest.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/publishtest.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/publishtest.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/publishtest.cpp Fri Oct 28
13:36:43 2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -27,7 +31,6 @@
#include <log4cxx/logger.h>
-#include "servercontrol.h"
#include "util.h"
static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("hedwig."__FILE__));
@@ -36,14 +39,6 @@ using namespace CppUnit;
class PublishTestSuite : public CppUnit::TestFixture {
private:
- HedwigTest::ServerControl* control;
- HedwigTest::TestServerPtr zk;
- HedwigTest::TestServerPtr bk1;
- HedwigTest::TestServerPtr bk2;
- HedwigTest::TestServerPtr bk3;
- HedwigTest::TestServerPtr hw1;
- HedwigTest::TestServerPtr hw2;
-
CPPUNIT_TEST_SUITE( PublishTestSuite );
CPPUNIT_TEST(testSyncPublish);
CPPUNIT_TEST(testAsyncPublish);
@@ -54,7 +49,7 @@ private:
CPPUNIT_TEST_SUITE_END();
public:
- PublishTestSuite() : control(NULL) {
+ PublishTestSuite() {
}
~PublishTestSuite() {
@@ -62,46 +57,14 @@ public:
void setUp()
{
- control = new HedwigTest::ServerControl(HedwigTest::DEFAULT_CONTROLSERVER_PORT);
- zk = control->startZookeeperServer(12345);
- bk1 = control->startBookieServer(12346, zk);
- bk2 = control->startBookieServer(12347, zk);
- bk3 = control->startBookieServer(12348, zk);
-
- std::string region("testRegion");
- hw1 = control->startPubSubServer(12349, region, zk);
- hw2 = control->startPubSubServer(12350, region, zk);
}
void tearDown()
{
- if (hw2.get()) {
- hw2->kill();
- }
- if (hw1.get()) {
- hw1->kill();
- }
-
- if (bk1.get()) {
- bk1->kill();
- }
- if (bk2.get()) {
- bk2->kill();
- }
- if (bk3.get()) {
- bk3->kill();
- }
-
- if (zk.get()) {
- zk->kill();
- }
- if (control) {
- delete control;
- }
}
void testSyncPublish() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
Hedwig::Client* client = new Hedwig::Client(*conf);
Hedwig::Publisher& pub = client->getPublisher();
@@ -115,7 +78,7 @@ public:
void testAsyncPublish() {
SimpleWaitCondition* cond = new SimpleWaitCondition();
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
Hedwig::Client* client = new Hedwig::Client(*conf);
Hedwig::Publisher& pub = client->getPublisher();
@@ -136,7 +99,7 @@ public:
SimpleWaitCondition* cond2 = new SimpleWaitCondition();
SimpleWaitCondition* cond3 = new SimpleWaitCondition();
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
Hedwig::Client* client = new Hedwig::Client(*conf);
Hedwig::Publisher& pub = client->getPublisher();
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubdatatest.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubdatatest.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubdatatest.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubdatatest.cpp Fri Oct
28 13:36:43 2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubtest.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubtest.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubtest.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/pubsubtest.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -28,21 +32,12 @@
#include <log4cxx/logger.h>
-#include "servercontrol.h"
#include "util.h"
static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("hedwig."__FILE__));
class PubSubTestSuite : public CppUnit::TestFixture {
private:
- HedwigTest::ServerControl* control;
- HedwigTest::TestServerPtr zk;
- HedwigTest::TestServerPtr bk1;
- HedwigTest::TestServerPtr bk2;
- HedwigTest::TestServerPtr bk3;
- HedwigTest::TestServerPtr hw1;
-
-
CPPUNIT_TEST_SUITE( PubSubTestSuite );
CPPUNIT_TEST(testPubSubContinuousOverClose);
// CPPUNIT_TEST(testPubSubContinuousOverServerDown);
@@ -52,8 +47,7 @@ private:
CPPUNIT_TEST_SUITE_END();
public:
- PubSubTestSuite() : control(NULL) {
-
+ PubSubTestSuite() {
}
~PubSubTestSuite() {
@@ -61,42 +55,10 @@ public:
void setUp()
{
- control = new HedwigTest::ServerControl(HedwigTest::DEFAULT_CONTROLSERVER_PORT);
- zk = control->startZookeeperServer(12345);
- bk1 = control->startBookieServer(12346, zk);
- bk2 = control->startBookieServer(12347, zk);
- bk3 = control->startBookieServer(12348, zk);
-
- std::string region("testRegion");
- hw1 = control->startPubSubServer(12349, region, zk);
}
void tearDown()
{
- try {
- if (hw1.get()) {
- hw1->kill();
- }
-
- if (bk1.get()) {
- bk1->kill();
- }
- if (bk2.get()) {
- bk2->kill();
- }
- if (bk3.get()) {
- bk3->kill();
- }
-
- if (zk.get()) {
- zk->kill();
- }
- } catch (std::exception& e) {
- // don't allow an exception to break everything, we're going deleting the control no
matter what
- }
- if (control) {
- delete control;
- }
}
class MyMessageHandlerCallback : public Hedwig::MessageHandlerCallback {
@@ -139,7 +101,7 @@ public:
std::string topic = "pubSubTopic";
std::string sid = "MySubscriberid-1";
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -189,7 +151,7 @@ public:
std::string topic = "pubSubTopic";
std::string sid = "MySubscriberid-1";
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -239,7 +201,7 @@ public:
std::string topicB = "pubSubTopicB";
std::string sid = "MySubscriberid-3";
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -288,7 +250,7 @@ public:
std::string sidA = "MySubscriberid-4";
std::string sidB = "MySubscriberid-5";
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -337,7 +299,7 @@ public:
std::string topic = "pubSubTopic";
std::string sid = "MySubscriberid-6";
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/subscribetest.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/subscribetest.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/subscribetest.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/subscribetest.cpp Fri Oct 28
13:36:43 2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
@@ -27,22 +31,12 @@
#include <log4cxx/logger.h>
-#include "servercontrol.h"
#include "util.h"
static log4cxx::LoggerPtr logger(log4cxx::Logger::getLogger("hedwig."__FILE__));
class SubscribeTestSuite : public CppUnit::TestFixture {
private:
- HedwigTest::ServerControl* control;
- HedwigTest::TestServerPtr zk;
- HedwigTest::TestServerPtr bk1;
- HedwigTest::TestServerPtr bk2;
- HedwigTest::TestServerPtr bk3;
- HedwigTest::TestServerPtr hw1;
- HedwigTest::TestServerPtr hw2;
-
-
CPPUNIT_TEST_SUITE( SubscribeTestSuite );
CPPUNIT_TEST(testSyncSubscribe);
CPPUNIT_TEST(testSyncSubscribeAttach);
@@ -55,7 +49,7 @@ private:
CPPUNIT_TEST_SUITE_END();
public:
- SubscribeTestSuite() : control(NULL) {
+ SubscribeTestSuite() {
}
@@ -64,47 +58,14 @@ public:
void setUp()
{
- control = new HedwigTest::ServerControl(HedwigTest::DEFAULT_CONTROLSERVER_PORT);
- zk = control->startZookeeperServer(12345);
- bk1 = control->startBookieServer(12346, zk);
- bk2 = control->startBookieServer(12347, zk);
- bk3 = control->startBookieServer(12348, zk);
-
- std::string region("testRegion");
- hw1 = control->startPubSubServer(12349, region, zk);
- hw2 = control->startPubSubServer(12350, region, zk);
}
void tearDown()
{
- try {
- if (hw1.get()) {
- hw1->kill();
- }
-
- if (bk1.get()) {
- bk1->kill();
- }
- if (bk2.get()) {
- bk2->kill();
- }
- if (bk3.get()) {
- bk3->kill();
- }
-
- if (zk.get()) {
- zk->kill();
- }
- } catch (std::exception& e) {
- // don't allow an exception to break everything, we're going deleting the control no
matter what
- }
- if (control) {
- delete control;
- }
}
void testSyncSubscribe() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -116,7 +77,7 @@ public:
}
void testSyncSubscribeAttach() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -131,7 +92,7 @@ public:
SimpleWaitCondition* cond1 = new SimpleWaitCondition();
std::auto_ptr<SimpleWaitCondition> cond1ptr(cond1);
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -153,7 +114,7 @@ public:
SimpleWaitCondition* cond2 = new SimpleWaitCondition();
std::auto_ptr<SimpleWaitCondition> cond2ptr(cond2);
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -177,7 +138,7 @@ public:
SimpleWaitCondition* cond1 = new SimpleWaitCondition();
std::auto_ptr<SimpleWaitCondition> cond1ptr(cond1);
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -195,7 +156,7 @@ public:
}
void testAsyncSubcribeCloseSubscriptionAndThenResubscribe() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -210,7 +171,7 @@ public:
}
void testUnsubscribeWithoutSubscribe() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
@@ -222,7 +183,7 @@ public:
}
void testSubscribeTwice() {
- Hedwig::Configuration* conf = new TestServerConfiguration(hw1);
+ Hedwig::Configuration* conf = new TestServerConfiguration();
std::auto_ptr<Hedwig::Configuration> confptr(conf);
Hedwig::Client* client = new Hedwig::Client(*conf);
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/util.h
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/util.h?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/util.h (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/util.h Fri Oct 28 13:36:43
2011
@@ -95,7 +95,7 @@ private:
class TestServerConfiguration : public Hedwig::Configuration {
public:
- TestServerConfiguration(HedwigTest::TestServerPtr& server) : server(server), address(server->getAddress())
{}
+ TestServerConfiguration() : address("localhost:4081") {}
virtual int getInt(const std::string& /*key*/, int defaultVal) const {
return defaultVal;
@@ -114,7 +114,6 @@ public:
}
private:
- HedwigTest::TestServerPtr server;
const std::string address;
};
Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/utiltest.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/utiltest.cpp?rev=1190306&r1=1190305&r2=1190306&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/utiltest.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/test/utiltest.cpp Fri Oct 28 13:36:43
2011
@@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
#include <cppunit/Test.h>
#include <cppunit/TestSuite.h>
#include <cppunit/extensions/HelperMacros.h>
|