zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [12/22] zookeeper git commit: ZOOKEEPER-3031: MAVEN MIGRATION - Step 1.4 - move client dir
Date Tue, 21 Aug 2018 05:31:12 GMT
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/ZKMocks.cc
----------------------------------------------------------------------
diff --git a/src/c/tests/ZKMocks.cc b/src/c/tests/ZKMocks.cc
deleted file mode 100644
index 1310ab9..0000000
--- a/src/c/tests/ZKMocks.cc
+++ /dev/null
@@ -1,544 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <arpa/inet.h>  // for htonl
-#include <memory>
-
-#include <zookeeper.h>
-#include <proto.h>
-
-#ifdef THREADED
-#include "PthreadMocks.h"
-#endif
-#include "ZKMocks.h"
-
-using namespace std;
-
-TestClientId testClientId;
-const char* TestClientId::PASSWD="1234567890123456";
-
-HandshakeRequest* HandshakeRequest::parse(const std::string& buf) {
-    auto_ptr<HandshakeRequest> req(new HandshakeRequest);
-
-    memcpy(&req->protocolVersion,buf.data(), sizeof(req->protocolVersion));
-    req->protocolVersion = htonl(req->protocolVersion);
-
-    int offset=sizeof(req->protocolVersion);
-
-    memcpy(&req->lastZxidSeen,buf.data()+offset,sizeof(req->lastZxidSeen));
-    req->lastZxidSeen = zoo_htonll(req->lastZxidSeen);
-    offset+=sizeof(req->lastZxidSeen);
-
-    memcpy(&req->timeOut,buf.data()+offset,sizeof(req->timeOut));
-    req->timeOut = htonl(req->timeOut);
-    offset+=sizeof(req->timeOut);
-
-    memcpy(&req->sessionId,buf.data()+offset,sizeof(req->sessionId));
-    req->sessionId = zoo_htonll(req->sessionId);
-    offset+=sizeof(req->sessionId);
-
-    memcpy(&req->passwd_len,buf.data()+offset,sizeof(req->passwd_len));
-    req->passwd_len = htonl(req->passwd_len);
-    offset+=sizeof(req->passwd_len);
-
-    memcpy(req->passwd,buf.data()+offset,sizeof(req->passwd));
-    offset+=sizeof(req->passwd);
-
-    memcpy(&req->readOnly,buf.data()+offset,sizeof(req->readOnly));
-
-    if(testClientId.client_id==req->sessionId &&
-            !memcmp(testClientId.passwd,req->passwd,sizeof(req->passwd)))
-        return req.release();
-    // the request didn't match -- may not be a handshake request after all
-
-    return 0;
-}
-
-// *****************************************************************************
-// watcher action implementation
-void activeWatcher(zhandle_t *zh,
-                   int type, int state, const char *path,void* ctx) {
-
-    if (zh == 0 || ctx == 0)
-      return;
-
-    WatcherAction* action = (WatcherAction *)ctx;
-
-    if (type == ZOO_SESSION_EVENT) {
-        if (state == ZOO_EXPIRED_SESSION_STATE)
-            action->onSessionExpired(zh);
-        else if(state == ZOO_CONNECTING_STATE)
-            action->onConnectionLost(zh);
-        else if(state == ZOO_CONNECTED_STATE)
-            action->onConnectionEstablished(zh);
-    } else if (type == ZOO_CHANGED_EVENT)
-        action->onNodeValueChanged(zh,path);
-    else if (type == ZOO_DELETED_EVENT)
-        action->onNodeDeleted(zh,path);
-    else if (type == ZOO_CHILD_EVENT)
-        action->onChildChanged(zh,path);
-
-    // TODO: implement for the rest of the event types
-
-    action->setWatcherTriggered();
-}
-
-SyncedBoolCondition WatcherAction::isWatcherTriggered() const {
-    return SyncedBoolCondition(triggered_,mx_);
-}
-
-// a set of async completion signatures
-
-void asyncCompletion(int rc, ACL_vector *acl,Stat *stat, const void *data){
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->aclCompl(rc,acl,stat);
-}
-
-void asyncCompletion(int rc, const char *value, int len, const Stat *stat,
-        const void *data) {
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->dataCompl(rc,value,len,stat);
-}
-
-void asyncCompletion(int rc, const Stat *stat, const void *data) {
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->statCompl(rc,stat);
-}
-
-void asyncCompletion(int rc, const char *value, const void *data) {
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->stringCompl(rc,value);
-}
-
-void asyncCompletion(int rc,const String_vector *strings, const void *data) {
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->stringsCompl(rc,strings);
-}
-
-void asyncCompletion(int rc, const void *data) {
-    assert("Completion data is NULL"&&data);
-    static_cast<AsyncCompletion*>((void*)data)->voidCompl(rc);
-}
-
-// a predicate implementation
-bool IOThreadStopped::operator()() const{
-#ifdef THREADED
-    adaptor_threads* adaptor=(adaptor_threads*)zh_->adaptor_priv;
-    return CheckedPthread::isTerminated(adaptor->io);
-#else
-    assert("IOThreadStopped predicate is only for use with THREADED client" &&
-           false);
-    return false;
-#endif
-}
-
-//******************************************************************************
-//
-DECLARE_WRAPPER(int,flush_send_queue,(zhandle_t*zh, int timeout))
-{
-    if(!Mock_flush_send_queue::mock_)
-        return CALL_REAL(flush_send_queue,(zh,timeout));
-    return Mock_flush_send_queue::mock_->call(zh,timeout);
-}
-
-Mock_flush_send_queue* Mock_flush_send_queue::mock_=0;
-
-//******************************************************************************
-//
-DECLARE_WRAPPER(int32_t,get_xid,())
-{
-    if(!Mock_get_xid::mock_)
-        return CALL_REAL(get_xid,());
-    return Mock_get_xid::mock_->call();
-}
-
-Mock_get_xid* Mock_get_xid::mock_=0;
-
-//******************************************************************************
-// activateWatcher mock
-
-DECLARE_WRAPPER(void,activateWatcher,(zhandle_t *zh, watcher_registration_t* reg, int rc))
-{
-    if(!Mock_activateWatcher::mock_){
-        CALL_REAL(activateWatcher,(zh, reg,rc));
-    }else{
-        Mock_activateWatcher::mock_->call(zh, reg,rc);
-    }
-}
-Mock_activateWatcher* Mock_activateWatcher::mock_=0;
-
-class ActivateWatcherWrapper: public Mock_activateWatcher{
-public:
-    ActivateWatcherWrapper():ctx_(0),activated_(false){}
-
-    virtual void call(zhandle_t *zh, watcher_registration_t* reg, int rc){
-        CALL_REAL(activateWatcher,(zh, reg,rc));
-        synchronized(mx_);
-        if(reg->context==ctx_){
-            activated_=true;
-            ctx_=0;
-        }
-    }
-
-    void setContext(void* ctx){
-        synchronized(mx_);
-        ctx_=ctx;
-        activated_=false;
-    }
-
-    SyncedBoolCondition isActivated() const{
-        return SyncedBoolCondition(activated_,mx_);
-    }
-    mutable Mutex mx_;
-    void* ctx_;
-    bool activated_;
-};
-
-WatcherActivationTracker::WatcherActivationTracker():
-    wrapper_(new ActivateWatcherWrapper)
-{
-}
-
-WatcherActivationTracker::~WatcherActivationTracker(){
-    delete wrapper_;
-}
-
-void WatcherActivationTracker::track(void* ctx){
-    wrapper_->setContext(ctx);
-}
-
-SyncedBoolCondition WatcherActivationTracker::isWatcherActivated() const{
-    return wrapper_->isActivated();
-}
-
-//******************************************************************************
-//
-DECLARE_WRAPPER(void,deliverWatchers,(zhandle_t* zh,int type,int state, const char* path, watcher_object_list_t **list))
-{
-    if(!Mock_deliverWatchers::mock_){
-        CALL_REAL(deliverWatchers,(zh,type,state,path, list));
-    }else{
-        Mock_deliverWatchers::mock_->call(zh,type,state,path, list);
-    }
-}
-
-Mock_deliverWatchers* Mock_deliverWatchers::mock_=0;
-
-struct RefCounterValue{
-    RefCounterValue(zhandle_t* const& zh,int32_t expectedCounter,Mutex& mx):
-        zh_(zh),expectedCounter_(expectedCounter),mx_(mx){}
-    bool operator()() const{
-        {
-            synchronized(mx_);
-            if(zh_==0)
-                return false;
-        }
-        return inc_ref_counter(zh_,0)==expectedCounter_;
-    }
-    zhandle_t* const& zh_;
-    int32_t expectedCounter_;
-    Mutex& mx_;
-};
-
-
-class DeliverWatchersWrapper: public Mock_deliverWatchers{
-public:
-    DeliverWatchersWrapper(int type,int state,bool terminate):
-        type_(type),state_(state),
-        allDelivered_(false),terminate_(terminate),zh_(0),deliveryCounter_(0){}
-    virtual void call(zhandle_t* zh, int type, int state,
-                      const char* path, watcher_object_list **list) {
-        {
-            synchronized(mx_);
-            zh_=zh;
-            allDelivered_=false;
-        }
-        CALL_REAL(deliverWatchers,(zh,type,state,path, list));
-        if(type_==type && state_==state){
-            if(terminate_){
-                // prevent zhandle_t from being prematurely distroyed;
-                // this will also ensure that zookeeper_close() cleanups the
-                //  thread resources by calling finish_adaptor()
-                inc_ref_counter(zh,1);
-                terminateZookeeperThreads(zh);
-            }
-            synchronized(mx_);
-            allDelivered_=true;
-            deliveryCounter_++;
-        }
-    }
-    SyncedBoolCondition isDelivered() const{
-        if(terminate_){
-            int i=ensureCondition(RefCounterValue(zh_,1,mx_),1000);
-            assert(i<1000);
-        }
-        return SyncedBoolCondition(allDelivered_,mx_);
-    }
-    void resetDeliveryCounter(){
-        synchronized(mx_);
-        deliveryCounter_=0;
-    }
-    SyncedIntegerEqual deliveryCounterEquals(int expected) const{
-        if(terminate_){
-            int i=ensureCondition(RefCounterValue(zh_,1,mx_),1000);
-            assert(i<1000);
-        }
-        return SyncedIntegerEqual(deliveryCounter_,expected,mx_);
-    }
-    int type_;
-    int state_;
-    mutable Mutex mx_;
-    bool allDelivered_;
-    bool terminate_;
-    zhandle_t* zh_;
-    int deliveryCounter_;
-};
-
-WatcherDeliveryTracker::WatcherDeliveryTracker(
-        int type,int state,bool terminateCompletionThread):
-    deliveryWrapper_(new DeliverWatchersWrapper(
-            type,state,terminateCompletionThread)){
-}
-
-WatcherDeliveryTracker::~WatcherDeliveryTracker(){
-    delete deliveryWrapper_;
-}
-
-SyncedBoolCondition WatcherDeliveryTracker::isWatcherProcessingCompleted() const {
-    return deliveryWrapper_->isDelivered();
-}
-
-void WatcherDeliveryTracker::resetDeliveryCounter(){
-    deliveryWrapper_->resetDeliveryCounter();
-}
-
-SyncedIntegerEqual WatcherDeliveryTracker::deliveryCounterEquals(int expected) const {
-    return deliveryWrapper_->deliveryCounterEquals(expected);
-}
-
-//******************************************************************************
-//
-string HandshakeResponse::toString() const {
-    string buf;
-    int32_t tmp=htonl(protocolVersion);
-    buf.append((char*)&tmp,sizeof(tmp));
-    tmp=htonl(timeOut);
-    buf.append((char*)&tmp,sizeof(tmp));
-    int64_t tmp64=zoo_htonll(sessionId);
-    buf.append((char*)&tmp64,sizeof(sessionId));
-    tmp=htonl(passwd_len);
-    buf.append((char*)&tmp,sizeof(tmp));
-    buf.append(passwd,sizeof(passwd));
-    buf.append(&readOnly,sizeof(readOnly));
-    // finally set the buffer length
-    tmp=htonl(buf.size()+sizeof(tmp));
-    buf.insert(0,(char*)&tmp, sizeof(tmp));
-    return buf;
-}
-
-string ZooGetResponse::toString() const{
-    oarchive* oa=create_buffer_oarchive();
-
-    ReplyHeader h = {xid_,1,ZOK};
-    serialize_ReplyHeader(oa, "hdr", &h);
-
-    GetDataResponse resp;
-    char buf[1024];
-    assert("GetDataResponse is too long"&&data_.size()<=sizeof(buf));
-    resp.data.len=data_.size();
-    resp.data.buff=buf;
-    data_.copy(resp.data.buff, data_.size());
-    resp.stat=stat_;
-    serialize_GetDataResponse(oa, "reply", &resp);
-    int32_t len=htonl(get_buffer_len(oa));
-    string res((char*)&len,sizeof(len));
-    res.append(get_buffer(oa),get_buffer_len(oa));
-
-    close_buffer_oarchive(&oa,1);
-    return res;
-}
-
-string ZooStatResponse::toString() const{
-    oarchive* oa=create_buffer_oarchive();
-
-    ReplyHeader h = {xid_,1,rc_};
-    serialize_ReplyHeader(oa, "hdr", &h);
-
-    SetDataResponse resp;
-    resp.stat=stat_;
-    serialize_SetDataResponse(oa, "reply", &resp);
-    int32_t len=htonl(get_buffer_len(oa));
-    string res((char*)&len,sizeof(len));
-    res.append(get_buffer(oa),get_buffer_len(oa));
-
-    close_buffer_oarchive(&oa,1);
-    return res;
-}
-
-string ZooGetChildrenResponse::toString() const{
-    oarchive* oa=create_buffer_oarchive();
-
-    ReplyHeader h = {xid_,1,rc_};
-    serialize_ReplyHeader(oa, "hdr", &h);
-
-    GetChildrenResponse resp;
-    // populate the string vector
-    allocate_String_vector(&resp.children,strings_.size());
-    for(int i=0;i<(int)strings_.size();++i)
-        resp.children.data[i]=strdup(strings_[i].c_str());
-    serialize_GetChildrenResponse(oa, "reply", &resp);
-    deallocate_GetChildrenResponse(&resp);
-
-    int32_t len=htonl(get_buffer_len(oa));
-    string res((char*)&len,sizeof(len));
-    res.append(get_buffer(oa),get_buffer_len(oa));
-
-    close_buffer_oarchive(&oa,1);
-    return res;
-}
-
-string ZNodeEvent::toString() const{
-    oarchive* oa=create_buffer_oarchive();
-    struct WatcherEvent evt = {type_,0,(char*)path_.c_str()};
-    struct ReplyHeader h = {WATCHER_EVENT_XID,0,ZOK };
-
-    serialize_ReplyHeader(oa, "hdr", &h);
-    serialize_WatcherEvent(oa, "event", &evt);
-
-    int32_t len=htonl(get_buffer_len(oa));
-    string res((char*)&len,sizeof(len));
-    res.append(get_buffer(oa),get_buffer_len(oa));
-
-    close_buffer_oarchive(&oa,1);
-    return res;
-}
-
-string PingResponse::toString() const{
-    oarchive* oa=create_buffer_oarchive();
-
-    ReplyHeader h = {PING_XID,1,ZOK};
-    serialize_ReplyHeader(oa, "hdr", &h);
-
-    int32_t len=htonl(get_buffer_len(oa));
-    string res((char*)&len,sizeof(len));
-    res.append(get_buffer(oa),get_buffer_len(oa));
-
-    close_buffer_oarchive(&oa,1);
-    return res;
-}
-
-//******************************************************************************
-// Zookeeper server simulator
-//
-bool ZookeeperServer::hasMoreRecv() const{
-  return recvHasMore.get()!=0  || connectionLost;
-}
-
-ssize_t ZookeeperServer::callRecv(int s,void *buf,size_t len,int flags){
-    if(connectionLost){
-        recvReturnBuffer.erase();
-        return 0;
-    }
-    // done transmitting the current buffer?
-    if(recvReturnBuffer.size()==0){
-        synchronized(recvQMx);
-        if(recvQueue.empty()){
-            recvErrno=EAGAIN;
-            return Mock_socket::callRecv(s,buf,len,flags);
-        }
-        --recvHasMore;
-        Element& el=recvQueue.front();
-        if(el.first!=0){
-            recvReturnBuffer=el.first->toString();
-            delete el.first;
-        }
-        recvErrno=el.second;
-        recvQueue.pop_front();
-    }
-    return Mock_socket::callRecv(s,buf,len,flags);
-}
-
-void ZookeeperServer::onMessageReceived(const RequestHeader& rh, iarchive* ia){
-    // no-op by default
-}
-
-void ZookeeperServer::notifyBufferSent(const std::string& buffer){
-    if(HandshakeRequest::isValid(buffer)){
-        // could be a connect request
-        auto_ptr<HandshakeRequest> req(HandshakeRequest::parse(buffer));
-        if(req.get()!=0){
-            // handle the handshake
-            int64_t sessId=sessionExpired?req->sessionId+1:req->sessionId;
-            sessionExpired=false;
-            addRecvResponse(new HandshakeResponse(sessId));
-            return;
-        }
-        // not a connect request -- fall thru
-    }
-    // parse the buffer to extract the request type and its xid
-    iarchive *ia=create_buffer_iarchive((char*)buffer.data(), buffer.size());
-    RequestHeader rh;
-    deserialize_RequestHeader(ia,"hdr",&rh);
-    // notify the "server" a client request has arrived
-    if (rh.xid == -8) {
-        Element e = Element(new ZooStatResponse,0);
-        e.first->setXID(-8);
-        addRecvResponse(e);
-        close_buffer_iarchive(&ia);
-        return;
-    } else {
-        onMessageReceived(rh,ia);
-    }
-    close_buffer_iarchive(&ia);
-    if(rh.type==ZOO_CLOSE_OP){
-        ++closeSent;
-        return; // no reply for close requests
-    }
-    // get the next response from the response queue and append it to the
-    // receive list
-    Element e;
-    {
-        synchronized(respQMx);
-        if(respQueue.empty())
-            return;
-        e=respQueue.front();
-        respQueue.pop_front();
-    }
-    e.first->setXID(rh.xid);
-    addRecvResponse(e);
-}
-
-void forceConnected(zhandle_t* zh){
-    // simulate connected state
-    zh->state=ZOO_CONNECTED_STATE;
-
-    // Simulate we're connected to the first host in our host list
-    zh->fd=ZookeeperServer::FD;
-    assert(zh->addrs.count > 0);
-    zh->addr_cur = zh->addrs.data[0];
-    zh->addrs.next++;
-
-    zh->input_buffer=0;
-    gettimeofday(&zh->last_recv,0);
-    gettimeofday(&zh->last_send,0);
-}
-
-void terminateZookeeperThreads(zhandle_t* zh){
-    // this will cause the zookeeper threads to terminate
-    zh->close_requested=1;
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/ZKMocks.h
----------------------------------------------------------------------
diff --git a/src/c/tests/ZKMocks.h b/src/c/tests/ZKMocks.h
deleted file mode 100644
index 2717ded..0000000
--- a/src/c/tests/ZKMocks.h
+++ /dev/null
@@ -1,511 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ZKMOCKS_H_
-#define ZKMOCKS_H_
-
-#include <zookeeper.h>
-#include "src/zk_adaptor.h"
-
-#include "Util.h"
-#include "LibCMocks.h"
-#include "MocksBase.h"
-
-// *****************************************************************************
-// sets internal zhandle_t members to certain values to simulate the client 
-// connected state. This function should only be used with the single-threaded
-// Async API tests!
-void forceConnected(zhandle_t* zh); 
-
-/**
- * Gracefully terminates zookeeper I/O and completion threads. 
- */
-void terminateZookeeperThreads(zhandle_t* zh);
-
-// *****************************************************************************
-// Abstract watcher action
-struct SyncedBoolCondition;
-
-class WatcherAction{
-public:
-    WatcherAction():triggered_(false){}
-    virtual ~WatcherAction(){}
-    
-    virtual void onSessionExpired(zhandle_t*){}
-    virtual void onConnectionEstablished(zhandle_t*){}
-    virtual void onConnectionLost(zhandle_t*){}
-    virtual void onNodeValueChanged(zhandle_t*,const char* path){}
-    virtual void onNodeDeleted(zhandle_t*,const char* path){}
-    virtual void onChildChanged(zhandle_t*,const char* path){}
-    
-    SyncedBoolCondition isWatcherTriggered() const;
-    void setWatcherTriggered(){
-        synchronized(mx_);
-        triggered_=true;
-    }
-
-protected:
-    mutable Mutex mx_;
-    bool triggered_;
-};
-// zh->context is a pointer to a WatcherAction instance
-// based on the event type and state, the watcher calls a specific watcher 
-// action method
-void activeWatcher(zhandle_t *zh, int type, int state, const char *path,void* ctx);
-
-// *****************************************************************************
-// a set of async completion signatures
-class AsyncCompletion{
-public:
-    virtual ~AsyncCompletion(){}
-    virtual void aclCompl(int rc, ACL_vector *acl,Stat *stat){}
-    virtual void dataCompl(int rc, const char *value, int len, const Stat *stat){}
-    virtual void statCompl(int rc, const Stat *stat){}
-    virtual void stringCompl(int rc, const char *value){}
-    virtual void stringsCompl(int rc,const String_vector *strings){}
-    virtual void voidCompl(int rc){}
-};
-void asyncCompletion(int rc, ACL_vector *acl,Stat *stat, const void *data);
-void asyncCompletion(int rc, const char *value, int len, const Stat *stat, 
-        const void *data);
-void asyncCompletion(int rc, const Stat *stat, const void *data);
-void asyncCompletion(int rc, const char *value, const void *data);
-void asyncCompletion(int rc,const String_vector *strings, const void *data);
-void asyncCompletion(int rc, const void *data);
-
-// *****************************************************************************
-// some common predicates to use with ensureCondition():
-// checks if the connection is established
-struct ClientConnected{
-    ClientConnected(zhandle_t* zh):zh_(zh){}
-    bool operator()() const{
-        return zoo_state(zh_)==ZOO_CONNECTED_STATE;
-    }
-    zhandle_t* zh_;
-};
-// check in the session expired
-struct SessionExpired{
-    SessionExpired(zhandle_t* zh):zh_(zh){}
-    bool operator()() const{
-        return zoo_state(zh_)==ZOO_EXPIRED_SESSION_STATE;
-    }
-    zhandle_t* zh_;
-};
-// checks if the IO thread has stopped; CheckedPthread must be active
-struct IOThreadStopped{
-    IOThreadStopped(zhandle_t* zh):zh_(zh){}
-    bool operator()() const;
-    zhandle_t* zh_;
-};
-
-// a synchronized boolean condition
-struct SyncedBoolCondition{
-    SyncedBoolCondition(const bool& cond,Mutex& mx):cond_(cond),mx_(mx){}
-    bool operator()() const{
-        synchronized(mx_);
-        return cond_;
-    }
-    const bool& cond_;
-    Mutex& mx_;
-};
-
-// a synchronized integer comparison
-struct SyncedIntegerEqual{
-    SyncedIntegerEqual(const int& cond,int expected,Mutex& mx):
-        cond_(cond),expected_(expected),mx_(mx){}
-    bool operator()() const{
-        synchronized(mx_);
-        return cond_==expected_;
-    }
-    const int& cond_;
-    const int expected_;
-    Mutex& mx_;
-};
-
-// *****************************************************************************
-// make sure to call zookeeper_close() even in presence of exceptions 
-struct CloseFinally{
-    CloseFinally(zhandle_t** zh):zh_(zh){}
-    ~CloseFinally(){
-        execute();
-    }
-    int execute(){
-        if(zh_==0)return ZOK;
-        zhandle_t* lzh=*zh_;
-        *zh_=0;
-        disarm();
-        return zookeeper_close(lzh);
-    }
-    void disarm(){zh_=0;}
-    zhandle_t ** zh_;
-};
-
-struct TestClientId: clientid_t{
-    static const int SESSION_ID=123456789;
-    static const char* PASSWD;
-    TestClientId(){
-        client_id=SESSION_ID;
-        memcpy(passwd,PASSWD,sizeof(passwd));
-    }
-};
-
-// *****************************************************************************
-// special client id recongnized by the ZK server simulator 
-extern TestClientId testClientId;
-#define TEST_CLIENT_ID &testClientId
-
-// *****************************************************************************
-//
-struct HandshakeRequest: public connect_req
-{
-    static HandshakeRequest* parse(const std::string& buf);
-    static bool isValid(const std::string& buf){
-        // this is just quick and dirty check before we go and parse the request
-        return buf.size()==HANDSHAKE_REQ_SIZE;
-    }
-};
-
-// *****************************************************************************
-// flush_send_queue
-class Mock_flush_send_queue: public Mock
-{
-public:
-    Mock_flush_send_queue():counter(0),callReturns(ZOK){mock_=this;}
-    ~Mock_flush_send_queue(){mock_=0;}
-    
-    int counter;
-    int callReturns;
-    virtual int call(zhandle_t* zh, int timeout){
-        counter++;
-        return callReturns;
-    }
-
-    static Mock_flush_send_queue* mock_;
-};
-
-// *****************************************************************************
-// get_xid
-class Mock_get_xid: public Mock
-{
-public:
-    static const int32_t XID=123456;
-    Mock_get_xid(int retValue=XID):callReturns(retValue){mock_=this;}
-    ~Mock_get_xid(){mock_=0;}
-    
-    int callReturns;
-    virtual int call(){
-        return callReturns;
-    }
-
-    static Mock_get_xid* mock_;
-};
-
-// *****************************************************************************
-// activateWatcher
-class Mock_activateWatcher: public Mock{
-public:
-    Mock_activateWatcher(){mock_=this;}
-    virtual ~Mock_activateWatcher(){mock_=0;}
-    
-    virtual void call(zhandle_t *zh, watcher_registration_t* reg, int rc){}
-    static Mock_activateWatcher* mock_;
-};
-
-class ActivateWatcherWrapper;
-class WatcherActivationTracker{
-public:
-    WatcherActivationTracker();
-    ~WatcherActivationTracker();
-    
-    void track(void* ctx);
-    SyncedBoolCondition isWatcherActivated() const;
-private:
-    ActivateWatcherWrapper* wrapper_;
-};
-
-// *****************************************************************************
-// deliverWatchers
-class Mock_deliverWatchers: public Mock{
-public:
-    Mock_deliverWatchers(){mock_=this;}
-    virtual ~Mock_deliverWatchers(){mock_=0;}
-    
-    virtual void call(zhandle_t* zh,int type,int state, const char* path, watcher_object_list **){}
-    static Mock_deliverWatchers* mock_;
-};
-
-class DeliverWatchersWrapper;
-class WatcherDeliveryTracker{
-public:
-    // filters deliveries by state and type
-    WatcherDeliveryTracker(int type,int state,bool terminateCompletionThread=true);
-    ~WatcherDeliveryTracker();
-    
-    // if the thread termination requested (see the ctor params)
-    // this function will wait for the I/O and completion threads to 
-    // terminate before returning a SyncBoolCondition instance
-    SyncedBoolCondition isWatcherProcessingCompleted() const;
-    void resetDeliveryCounter();
-    SyncedIntegerEqual deliveryCounterEquals(int expected) const;
-private:
-    DeliverWatchersWrapper* deliveryWrapper_;
-};
-
-// *****************************************************************************
-// a zookeeper Stat wrapper
-struct NodeStat: public Stat
-{
-    NodeStat(){
-        czxid=0;
-        mzxid=0;
-        ctime=0;
-        mtime=0;
-        version=1;
-        cversion=0;
-        aversion=0;
-        ephemeralOwner=0;
-    }
-    NodeStat(const Stat& other){
-        memcpy(this,&other,sizeof(*this));
-    }
-};
-
-// *****************************************************************************
-// Abstract server Response
-class Response
-{
-public:
-    virtual ~Response(){}
-    
-    virtual void setXID(int32_t xid){}
-    // this method is used by the ZookeeperServer class to serialize 
-    // the instance of Response
-    virtual std::string toString() const =0;
-};
-
-// *****************************************************************************
-// Handshake response
-class HandshakeResponse: public Response
-{
-public:
-    HandshakeResponse(int64_t sessId=1):
-        protocolVersion(1),timeOut(10000),sessionId(sessId),
-        passwd_len(sizeof(passwd)),readOnly(0)
-    {
-        memcpy(passwd,"1234567890123456",sizeof(passwd));
-    }
-    int32_t protocolVersion;
-    int32_t timeOut;
-    int64_t sessionId;
-    int32_t passwd_len;
-    char passwd[16];
-    char readOnly;
-    virtual std::string toString() const ;
-};
-
-// zoo_get() response
-class ZooGetResponse: public Response
-{
-public:
-    ZooGetResponse(const char* data, int len,int32_t xid=0,int rc=ZOK,const Stat& stat=NodeStat())
-        :xid_(xid),data_(data,len),rc_(rc),stat_(stat)
-    {
-    }
-    virtual std::string toString() const;
-    virtual void setXID(int32_t xid) {xid_=xid;}
-    
-private:
-    int32_t xid_;
-    std::string data_;
-    int rc_;
-    Stat stat_;
-};
-
-// zoo_exists(), zoo_set() response
-class ZooStatResponse: public Response
-{
-public:
-    ZooStatResponse(int32_t xid=0,int rc=ZOK,const Stat& stat=NodeStat())
-        :xid_(xid),rc_(rc),stat_(stat)
-    {
-    }
-    virtual std::string toString() const;
-    virtual void setXID(int32_t xid) {xid_=xid;}
-    
-private:
-    int32_t xid_;
-    int rc_;
-    Stat stat_;
-};
-
-// zoo_get_children()
-class ZooGetChildrenResponse: public Response
-{
-public:
-    typedef std::vector<std::string> StringVector;
-    ZooGetChildrenResponse(const StringVector& v,int rc=ZOK):
-        xid_(0),strings_(v),rc_(rc)
-    {
-    }
-    
-    virtual std::string toString() const;
-    virtual void setXID(int32_t xid) {xid_=xid;}
-
-    int32_t xid_;
-    StringVector strings_;
-    int rc_;
-};
-
-// PING response
-class PingResponse: public Response
-{
-public:
-    virtual std::string toString() const;    
-};
-
-// watcher znode event
-class ZNodeEvent: public Response
-{
-public:
-    ZNodeEvent(int type,const char* path):type_(type),path_(path){}
-    
-    virtual std::string toString() const;
-    
-private:
-    int type_;
-    std::string path_;
-};
-
-// ****************************************************************************
-// Zookeeper server simulator
-
-class ZookeeperServer: public Mock_socket
-{
-public:
-    ZookeeperServer():
-        serverDownSkipCount_(-1),sessionExpired(false),connectionLost(false)
-    {
-        connectReturns=-1;
-        connectErrno=EWOULDBLOCK;        
-    }
-    virtual ~ZookeeperServer(){
-        clearRecvQueue();
-        clearRespQueue();
-    }
-    virtual int callClose(int fd){
-        if(fd!=FD)
-            return LIBC_SYMBOLS.close(fd);
-        clearRecvQueue();
-        clearRespQueue();
-        return Mock_socket::callClose(fd);
-    }
-    // connection handling
-    // what to do when the handshake request comes in?
-    int serverDownSkipCount_;
-    // this will cause getsockopt(zh->fd,SOL_SOCKET,SO_ERROR,&error,&len) return 
-    // a failure after skipCount dropped to zero, thus simulating a server down 
-    // condition
-    // passing skipCount==-1 will make every connect attempt succeed
-    void setServerDown(int skipCount=0){ 
-        serverDownSkipCount_=skipCount;
-        optvalSO_ERROR=0;            
-    }
-    virtual void setSO_ERROR(void *optval,socklen_t len){
-        if(serverDownSkipCount_!=-1){
-            if(serverDownSkipCount_==0)
-                optvalSO_ERROR=ECONNREFUSED;
-            else
-                serverDownSkipCount_--;
-        }
-        Mock_socket::setSO_ERROR(optval,len);
-    }
-
-    // this is a trigger that gets reset back to false
-    // a connect request will return a non-matching session id thus causing 
-    // the client throw SESSION_EXPIRED
-    volatile bool sessionExpired;
-    void returnSessionExpired(){ sessionExpired=true; }
-    
-    // this is a one shot trigger that gets reset back to false
-    // next recv call will return 0 length, thus simulating a connecton loss
-    volatile bool connectionLost;
-    void setConnectionLost() {connectionLost=true;}
-    
-    // recv
-    // this queue is used for server responses: client's recv() system call 
-    // returns next available message from this queue
-    typedef std::pair<Response*,int> Element;
-    typedef std::deque<Element> ResponseList;
-    ResponseList recvQueue;
-    mutable Mutex recvQMx;
-    AtomicInt recvHasMore;
-    ZookeeperServer& addRecvResponse(Response* resp, int errnum=0){
-        synchronized(recvQMx);
-        recvQueue.push_back(Element(resp,errnum));
-        ++recvHasMore;
-        return *this;
-    }
-    ZookeeperServer& addRecvResponse(int errnum){
-        synchronized(recvQMx);
-        recvQueue.push_back(Element(0,errnum));
-        ++recvHasMore;
-        return *this;
-    }
-    ZookeeperServer& addRecvResponse(const Element& e){
-        synchronized(recvQMx);
-        recvQueue.push_back(e);
-        ++recvHasMore;
-        return *this;
-    }
-    void clearRecvQueue(){
-        synchronized(recvQMx);
-        recvHasMore=0;
-        for(unsigned i=0; i<recvQueue.size();i++)
-            delete recvQueue[i].first;
-        recvQueue.clear();
-    }
-
-    virtual ssize_t callRecv(int s,void *buf,size_t len,int flags);
-    virtual bool hasMoreRecv() const;
-    
-    // the operation response queue holds zookeeper operation responses till the
-    // operation request has been sent to the server. After that, the operation
-    // response gets moved on to the recv queue (see above) ready to be read by 
-    // the next recv() system call
-    // send operation doesn't try to match request to the response
-    ResponseList respQueue;
-    mutable Mutex respQMx;
-    ZookeeperServer& addOperationResponse(Response* resp, int errnum=0){
-        synchronized(respQMx);
-        respQueue.push_back(Element(resp,errnum));
-        return *this;
-    }
-    void clearRespQueue(){
-        synchronized(respQMx);
-        for(unsigned i=0; i<respQueue.size();i++)
-            delete respQueue[i].first;
-        respQueue.clear();
-    }
-    AtomicInt closeSent;
-    virtual void notifyBufferSent(const std::string& buffer);
-    // simulates an arrival of a client request
-    // a callback to be implemented by subclasses (no-op by default)
-    virtual void onMessageReceived(const RequestHeader& rh, iarchive* ia);
-};
-
-#endif /*ZKMOCKS_H_*/

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/ZooKeeperQuorumServer.cc
----------------------------------------------------------------------
diff --git a/src/c/tests/ZooKeeperQuorumServer.cc b/src/c/tests/ZooKeeperQuorumServer.cc
deleted file mode 100644
index c38e385..0000000
--- a/src/c/tests/ZooKeeperQuorumServer.cc
+++ /dev/null
@@ -1,230 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership.  The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#include "ZooKeeperQuorumServer.h"
-
-#include <cassert>
-#include <cstdio>
-#include <cstdlib>
-#include <fstream>
-#include <sstream>
-#include <vector>
-#include <utility>
-#include <unistd.h>
-
-ZooKeeperQuorumServer::
-ZooKeeperQuorumServer(uint32_t id, uint32_t numServers, std::string config, std::string env) :
-    id_(id),
-    env_(env),
-    numServers_(numServers) {
-    const char* root = getenv("ZKROOT");
-    if (root == NULL) {
-        assert(!"Environment variable 'ZKROOT' is not set");
-    }
-    root_ = root;
-    createConfigFile(config);
-    createDataDirectory();
-    start();
-}
-
-ZooKeeperQuorumServer::
-~ZooKeeperQuorumServer() {
-    stop();
-}
-
-std::string ZooKeeperQuorumServer::
-getHostPort() {
-    std::stringstream ss;
-    ss << "localhost:" << getClientPort();
-    return ss.str();
-}
-
-uint32_t ZooKeeperQuorumServer::
-getClientPort() {
-    return CLIENT_PORT_BASE + id_;
-}
-
-void ZooKeeperQuorumServer::
-start() {
-    std::string command = root_ + "/bin/zkServer.sh start " +
-                          getConfigFileName();
-    if (!env_.empty()) {
-        command = env_ + " " + command;
-    }
-    assert(system(command.c_str()) == 0);
-}
-
-void ZooKeeperQuorumServer::
-stop() {
-    std::string command = root_ + "/bin/zkServer.sh stop " +
-                          getConfigFileName();
-    assert(system(command.c_str()) == 0);
-}
-
-std::string ZooKeeperQuorumServer::
-getMode() {
-    char buf[1024];
-    std::string result;
-    std::string command = root_ + "/bin/zkServer.sh status " +
-                          getConfigFileName();
-    FILE* output = popen(command.c_str(), "r");
-    do {
-        if (fgets(buf, 1024, output) != NULL) {
-            result += buf;
-        }
-    } while (!feof(output));
-    pclose(output);
-    if (result.find("Mode: leader") != std::string::npos) {
-        return "leader";
-    } else if (result.find("Mode: follower") != std::string::npos) {
-        return "follower";
-    } else {
-        printf("%s\n", result.c_str());
-        return "";
-    }
-}
-
-bool ZooKeeperQuorumServer::
-isLeader() {
-    return getMode() == "leader";
-}
-
-bool ZooKeeperQuorumServer::
-isFollower() {
-    return getMode() == "follower";
-}
-
-void ZooKeeperQuorumServer::
-createConfigFile(std::string config) {
-    std::string command = "mkdir -p " + root_ + "/build/test/test-cppunit/conf";
-    assert(system(command.c_str()) == 0);
-    std::ofstream confFile;
-    std::stringstream ss;
-    ss << id_ << ".conf";
-    std::string fileName = root_ + "/build/test/test-cppunit/conf/" + ss.str();
-    confFile.open(fileName.c_str());
-    confFile << "tickTime=2000\n";
-    confFile << "clientPort=" << getClientPort() << "\n";
-    confFile << "initLimit=5\n";
-    confFile << "syncLimit=2\n";
-    confFile << "dataDir=" << getDataDirectory() << "\n";
-    for (int i = 0; i < numServers_; i++) {
-        confFile << getServerString(i) << "\n";
-    }
-    // Append additional config, if any.
-    if (!config.empty()) {
-      confFile << config << std::endl;
-    }
-    confFile.close();
-}
-
-std::string ZooKeeperQuorumServer::
-getConfigFileName() {
-    std::stringstream ss;
-    ss << id_ << ".conf";
-    return root_ + "/build/test/test-cppunit/conf/" + ss.str();
-}
-
-void ZooKeeperQuorumServer::
-createDataDirectory() {
-    std::string dataDirectory = getDataDirectory();
-    std::string command = "rm -rf " + dataDirectory;
-    assert(system(command.c_str()) == 0);
-    command = "mkdir -p " + dataDirectory;
-    assert(system(command.c_str()) == 0);
-    std::ofstream myidFile;
-    std::string fileName = dataDirectory + "/myid";
-    myidFile.open(fileName.c_str());
-    myidFile << id_ << "\n";
-    myidFile.close();
-    setenv("ZOO_LOG_DIR", dataDirectory.c_str(), true);
-}
-
-std::string ZooKeeperQuorumServer::
-getServerString() {
-    return getServerString(id_);
-}
-
-std::string ZooKeeperQuorumServer::
-getServerString(uint32_t id) {
-    std::stringstream ss;
-    ss << "server." << id << "=localhost:" << SERVER_PORT_BASE + id <<
-          ":" << ELECTION_PORT_BASE + id << ":participant;localhost:" <<
-          CLIENT_PORT_BASE + id;
-    return ss.str();
-}
-
-std::string ZooKeeperQuorumServer::
-getDataDirectory() {
-    std::stringstream ss;
-    ss << "data" << id_;
-    return root_ + "/build/test/test-cppunit/" + ss.str();
-}
-
-std::vector<ZooKeeperQuorumServer*> ZooKeeperQuorumServer::
-getCluster(uint32_t numServers) {
-    std::vector<ZooKeeperQuorumServer*> cluster;
-    for (int i = 0; i < numServers; i++) {
-        cluster.push_back(new ZooKeeperQuorumServer(i, numServers));
-    }
-
-    // Wait until all the servers start, and fail if they don't start within 10
-    // seconds.
-    for (int i = 0; i < 10; i++) {
-        int j = 0;
-        for (; j < cluster.size(); j++) {
-            if (cluster[j]->getMode() == "") {
-                // The server hasn't started.
-                sleep(1);
-                break;
-            }
-        }
-        if (j == cluster.size()) {
-            return cluster;
-        }
-    }
-    assert(!"The cluster didn't start for 10 seconds");
-}
-
-std::vector<ZooKeeperQuorumServer*> ZooKeeperQuorumServer::
-getCluster(uint32_t numServers, ZooKeeperQuorumServer::tConfigPairs configs, std::string env) {
-    std::vector<ZooKeeperQuorumServer*> cluster;
-    std::string config;
-    for (ZooKeeperQuorumServer::tConfigPairs::const_iterator iter = configs.begin(); iter != configs.end(); ++iter) {
-        std::pair<std::string, std::string> pair = *iter;
-        config += (pair.first + "=" + pair.second + "\n");
-    }
-    for (int i = 0; i < numServers; i++) {
-        cluster.push_back(new ZooKeeperQuorumServer(i, numServers, config, env));
-    }
-
-    // Wait until all the servers start, and fail if they don't start within 10
-    // seconds.
-    for (int i = 0; i < 10; i++) {
-        int j = 0;
-        for (; j < cluster.size(); j++) {
-            if (cluster[j]->getMode() == "") {
-                // The server hasn't started.
-                sleep(1);
-                break;
-            }
-        }
-        if (j == cluster.size()) {
-            return cluster;
-        }
-    }
-    assert(!"The cluster didn't start for 10 seconds");
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/ZooKeeperQuorumServer.h
----------------------------------------------------------------------
diff --git a/src/c/tests/ZooKeeperQuorumServer.h b/src/c/tests/ZooKeeperQuorumServer.h
deleted file mode 100644
index 577072e..0000000
--- a/src/c/tests/ZooKeeperQuorumServer.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with this
- * work for additional information regarding copyright ownership.  The ASF
- * licenses this file to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
- * License for the specific language governing permissions and limitations under
- * the License.
- */
-#ifndef ZOOKEEPER_QUORUM_SERVER_H
-#define ZOOKEEPER_QUORUM_SERVER_H
-
-#include <stdint.h>
-#include <string>
-#include <vector>
-#include <utility>
-
-class ZooKeeperQuorumServer {
-  public:
-    ~ZooKeeperQuorumServer();
-    typedef std::vector<std::pair<std::string, std::string> > tConfigPairs;
-    static std::vector<ZooKeeperQuorumServer*> getCluster(uint32_t numServers);
-    static std::vector<ZooKeeperQuorumServer*> getCluster(uint32_t numServers,
-        tConfigPairs configs, /* Additional config options as a list of key/value pairs. */
-        std::string env       /* Additional environment variables when starting zkServer.sh. */);
-    std::string getHostPort();
-    uint32_t getClientPort();
-    void start();
-    void stop();
-    bool isLeader();
-    bool isFollower();
-    std::string getServerString();
-
-  private:
-    ZooKeeperQuorumServer();
-    ZooKeeperQuorumServer(uint32_t id, uint32_t numServers, std::string config = "",
-                          std::string env = "");
-    ZooKeeperQuorumServer(const ZooKeeperQuorumServer& that);
-    const ZooKeeperQuorumServer& operator=(const ZooKeeperQuorumServer& that);
-    void createConfigFile(std::string config = "");
-    std::string getConfigFileName();
-    void createDataDirectory();
-    std::string getDataDirectory();
-    static std::string getServerString(uint32_t id);
-    std::string getMode();
-
-    static const uint32_t SERVER_PORT_BASE = 2000;
-    static const uint32_t ELECTION_PORT_BASE = 3000;
-    static const uint32_t CLIENT_PORT_BASE = 4000;
-
-    uint32_t numServers_;
-    uint32_t id_;
-    std::string root_;
-    std::string env_;
-};
-
-#endif  // ZOOKEEPER_QUORUM_SERVER_H

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/quorum.cfg
----------------------------------------------------------------------
diff --git a/src/c/tests/quorum.cfg b/src/c/tests/quorum.cfg
deleted file mode 100644
index cb0aa81..0000000
--- a/src/c/tests/quorum.cfg
+++ /dev/null
@@ -1,8 +0,0 @@
-tickTime=500
-initLimit=10
-syncLimit=5
-dataDir=TMPDIR/zkdata
-clientPort=22181
-server.1=localhost:22881:33881
-server.2=localhost:22882:33882
-server.3=localhost:22883:33883

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/wrappers-mt.opt
----------------------------------------------------------------------
diff --git a/src/c/tests/wrappers-mt.opt b/src/c/tests/wrappers-mt.opt
deleted file mode 100644
index 01046fb..0000000
--- a/src/c/tests/wrappers-mt.opt
+++ /dev/null
@@ -1,3 +0,0 @@
--Wl,--wrap -Wl,pthread_mutex_lock
--Wl,--wrap -Wl,pthread_mutex_trylock
--Wl,--wrap -Wl,pthread_mutex_unlock

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/wrappers.opt
----------------------------------------------------------------------
diff --git a/src/c/tests/wrappers.opt b/src/c/tests/wrappers.opt
deleted file mode 100644
index bce192f..0000000
--- a/src/c/tests/wrappers.opt
+++ /dev/null
@@ -1,7 +0,0 @@
--Wl,--wrap -Wl,calloc
--Wl,--wrap -Wl,free
--Wl,--wrap -Wl,flush_send_queue
--Wl,--wrap -Wl,get_xid
--Wl,--wrap -Wl,deliverWatchers
--Wl,--wrap -Wl,activateWatcher
--Wl,--wrap -Wl,realloc

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/src/c/tests/zkServer.sh
----------------------------------------------------------------------
diff --git a/src/c/tests/zkServer.sh b/src/c/tests/zkServer.sh
deleted file mode 100755
index f0ba2c5..0000000
--- a/src/c/tests/zkServer.sh
+++ /dev/null
@@ -1,181 +0,0 @@
-#!/bin/bash
-#
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This is the port where zookeeper server runs on.
-ZOOPORT=22181
-
-if [ "x$1" == "x" ]
-then
-    echo "USAGE: $0 startClean|start|startReadOnly|stop hostPorts"
-    exit 2
-fi
-
-case "`uname`" in
-    CYGWIN*) cygwin=true ;;
-    *) cygwin=false ;;
-esac
-
-if [ "x$1" == "xstartClean" ]
-then
-    if [ "x${base_dir}" == "x" ]
-    then
-    rm -rf /tmp/zkdata
-    else
-    rm -rf "${base_dir}/build/tmp"
-    fi
-fi
-
-if $cygwin
-then
-    # cygwin has a "kill" in the shell itself, gets confused
-    KILL=/bin/kill
-else
-    KILL=kill
-fi
-
-# Make sure nothing is left over from before
-if [ -r "/tmp/zk.pid" ]
-then
-pid=`cat /tmp/zk.pid`
-$KILL -9 $pid
-rm -f /tmp/zk.pid
-fi
-
-if [ -r "${base_dir}/build/tmp/zk.pid" ]
-then
-pid=`cat "${base_dir}/build/tmp/zk.pid"`
-$KILL -9 $pid
-rm -f "${base_dir}/build/tmp/zk.pid"
-fi
-
-# [ZOOKEEPER-820] If lsof command is present, look for a process listening
-# on ZOOPORT and kill it. 
-which lsof &> /dev/null
-if [ $? -eq 0  ]
-then
-    pid=`lsof -i :$ZOOPORT | grep LISTEN | awk '{print $2}'`
-    if [ -n "$pid" ]
-    then
-        $KILL -9 $pid
-    fi
-fi
-
-if [ "x${base_dir}" == "x" ]
-then
-zk_base="../../../"
-else
-zk_base="${base_dir}"
-fi
-
-CLASSPATH="$CLASSPATH:${zk_base}/build/classes"
-CLASSPATH="$CLASSPATH:${zk_base}/conf"
-
-for i in "${zk_base}"/build/lib/*.jar
-do
-    CLASSPATH="$CLASSPATH:$i"
-done
-
-for i in "${zk_base}"/src/java/lib/*.jar
-do
-    CLASSPATH="$CLASSPATH:$i"
-done
-
-CLASSPATH="$CLASSPATH:${CLOVER_HOME}/lib/clover.jar"
-
-if $cygwin
-then
-    CLASSPATH=`cygpath -wp "$CLASSPATH"`
-fi
-
-case $1 in
-start|startClean)
-    if [ "x${base_dir}" == "x" ]
-    then
-        mkdir -p /tmp/zkdata
-        java -cp "$CLASSPATH" org.apache.zookeeper.server.ZooKeeperServerMain $ZOOPORT /tmp/zkdata 3000 $ZKMAXCNXNS &> /tmp/zk.log &
-        pid=$!
-        echo -n $! > /tmp/zk.pid
-    else
-        mkdir -p "${base_dir}/build/tmp/zkdata"
-        java -cp "$CLASSPATH" org.apache.zookeeper.server.ZooKeeperServerMain $ZOOPORT "${base_dir}/build/tmp/zkdata" 3000 $ZKMAXCNXNS &> "${base_dir}/build/tmp/zk.log" &
-        pid=$!
-        echo -n $pid > "${base_dir}/build/tmp/zk.pid"
-    fi
-
-    # wait max 120 seconds for server to be ready to server clients
-    # this handles testing on slow hosts
-    success=false
-    for i in {1..120}
-    do
-        if ps -p $pid > /dev/null
-        then
-            java -cp "$CLASSPATH" org.apache.zookeeper.ZooKeeperMain -server localhost:$ZOOPORT ls / > /dev/null 2>&1
-            if [ $? -ne 0  ]
-            then
-                # server not up yet - wait
-                sleep 1
-            else
-                # server is up and serving client connections
-                success=true
-                break
-            fi
-        else
-            # server died - exit now
-            echo -n " ZooKeeper server process failed"
-            break
-        fi
-    done
-
-    if $success
-    then
-        ## in case for debug, but generally don't use as it messes up the
-        ## console test output
-        echo -n " ZooKeeper server started"
-    else
-        echo -n " ZooKeeper server NOT started"
-    fi
-
-    ;;
-startReadOnly)
-    if [ "x${base_dir}" == "x" ]
-    then
-        echo "this target is for unit tests only"
-        exit 2
-    else
-        tmpdir="${base_dir}/build/tmp"
-        mkdir -p "${tmpdir}/zkdata"
-        rm -f "${tmpdir}/zkdata/myid" && echo 1 > "${tmpdir}/zkdata/myid"
-
-        sed "s#TMPDIR#${tmpdir}#g" ${base_dir}/src/c/tests/quorum.cfg > "${tmpdir}/quorum.cfg"
-
-        # force read-only mode
-        java -cp "$CLASSPATH" -Dreadonlymode.enabled=true org.apache.zookeeper.server.quorum.QuorumPeerMain ${tmpdir}/quorum.cfg &> "${tmpdir}/zk.log" &
-        pid=$!
-        echo -n $pid > "${base_dir}/build/tmp/zk.pid"
-        sleep 3 # wait until read-only server is up
-    fi
-
-    ;;
-stop)
-    # Already killed above
-    ;;
-*)
-    echo "Unknown command " + $1
-    exit 2
-esac
-

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/zookeeper-client/zookeeper-client-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-c/CMakeLists.txt b/zookeeper-client/zookeeper-client-c/CMakeLists.txt
new file mode 100644
index 0000000..af023e7
--- /dev/null
+++ b/zookeeper-client/zookeeper-client-c/CMakeLists.txt
@@ -0,0 +1,250 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+cmake_minimum_required(VERSION 3.5)
+
+project(zookeeper VERSION 3.6.0)
+set(email user@zookeeper.apache.org)
+set(description "zookeeper C client")
+
+# general options
+if(UNIX)
+  add_compile_options(-Wall -fPIC)
+elseif(WIN32)
+  add_compile_options(/W3)
+endif()
+add_definitions(-DUSE_STATIC_LIB)
+
+# TODO: Enable /WX and /W4 on Windows. Currently there are ~1000 warnings.
+# TODO: Add Solaris support.
+# TODO: Add a shared library option.
+# TODO: Specify symbols to export.
+# TODO: Generate doxygen documentation.
+
+# Sync API option
+option(WANT_SYNCAPI "Enables Sync API support" ON)
+if(WANT_SYNCAPI)
+  add_definitions(-DTHREADED)
+endif()
+
+# CppUnit option
+if(WIN32 OR APPLE)
+  # The tests do not yet compile on Windows or macOS,
+  # so we set this to off by default.
+  #
+  # Note that CMake does not have expressions except in conditionals,
+  # so we're left with this if/else/endif pattern.
+  set(DEFAULT_WANT_CPPUNIT OFF)
+else()
+  set(DEFAULT_WANT_CPPUNIT ON)
+endif()
+option(WANT_CPPUNIT "Enables CppUnit and tests" ${DEFAULT_WANT_CPPUNIT})
+
+# SOCK_CLOEXEC
+option(WANT_SOCK_CLOEXEC "Enables SOCK_CLOEXEC on sockets" OFF)
+include(CheckSymbolExists)
+check_symbol_exists(SOCK_CLOEXEC sys/socket.h HAVE_SOCK_CLOEXEC)
+if(WANT_SOCK_CLOEXEC AND HAVE_SOCK_CLOEXEC)
+  set(SOCK_CLOEXEC_ENABLED 1)
+endif()
+
+
+# The function `to_have(in out)` converts a header name like `arpa/inet.h`
+# into an Autotools style preprocessor definition `HAVE_ARPA_INET_H`.
+# This is then set or unset in `configure_file()` step.
+#
+# Note that CMake functions do not have return values; instead an "out"
+# variable must be passed, and explicitly set with parent scope.
+function(to_have in out)
+  string(TOUPPER ${in} str)
+  string(REGEX REPLACE "/|\\." "_" str ${str})
+  set(${out} "HAVE_${str}" PARENT_SCOPE)
+endfunction()
+
+# include file checks
+foreach(f generated/zookeeper.jute.h generated/zookeeper.jute.c)
+  if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${f}")
+    to_have(${f} name)
+    set(${name} 1)
+  else()
+    message(FATAL_ERROR
+      "jute files are missing!\n"
+      "Please run 'ant compile_jute' while in the ZooKeeper top level directory.")
+  endif()
+endforeach()
+
+# header checks
+include(CheckIncludeFile)
+set(check_headers
+  arpa/inet.h
+  dlfcn.h
+  fcntl.h
+  inttypes.h
+  memory.h
+  netdb.h
+  netinet/in.h
+  stdint.h
+  stdlib.h
+  string.h
+  strings.h
+  sys/socket.h
+  sys/stat.h
+  sys/time.h
+  sys/types.h
+  unistd.h
+  sys/utsname.h)
+
+foreach(f ${check_headers})
+  to_have(${f} name)
+  check_include_file(${f} ${name})
+endforeach()
+
+# function checks
+include(CheckFunctionExists)
+set(check_functions
+  getcwd
+  gethostbyname
+  gethostname
+  getlogin
+  getpwuid_r
+  gettimeofday
+  getuid
+  memmove
+  memset
+  poll
+  socket
+  strchr
+  strdup
+  strerror
+  strtol)
+
+foreach(fn ${check_functions})
+  to_have(${fn} name)
+  check_function_exists(${fn} ${name})
+endforeach()
+
+# library checks
+set(check_libraries rt m pthread)
+foreach(lib ${check_libraries})
+  to_have("lib${lib}" name)
+  find_library(${name} ${lib})
+endforeach()
+
+# IPv6 check
+include(CheckStructHasMember)
+check_struct_has_member("struct sockaddr_in6" sin6_addr "netinet/in.h" ZOO_IPV6_ENABLED)
+
+# configure
+configure_file(cmake_config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.h)
+
+# hashtable library
+set(hashtable_sources src/hashtable/hashtable_itr.c src/hashtable/hashtable.c)
+add_library(hashtable STATIC ${hashtable_sources})
+target_include_directories(hashtable PUBLIC include)
+target_link_libraries(hashtable PUBLIC $<$<OR:$<PLATFORM_ID:Linux>,$<PLATFORM_ID:FreeBSD>>:m>)
+
+# zookeeper library
+set(zookeeper_sources
+  src/zookeeper.c
+  src/recordio.c
+  generated/zookeeper.jute.c
+  src/zk_log.c
+  src/zk_hashtable.c
+  src/addrvec.c)
+
+if(WANT_SYNCAPI)
+  list(APPEND zookeeper_sources src/mt_adaptor.c)
+else()
+  list(APPEND zookeeper_sources src/st_adaptor.c)
+endif()
+
+if(WIN32)
+  list(APPEND zookeeper_sources src/winport.c)
+endif()
+
+add_library(zookeeper STATIC ${zookeeper_sources})
+target_include_directories(zookeeper PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/include generated)
+target_link_libraries(zookeeper PUBLIC
+  hashtable
+  $<$<PLATFORM_ID:Linux>:rt> # clock_gettime
+  $<$<PLATFORM_ID:Windows>:ws2_32>) # Winsock 2.0
+
+if(WANT_SYNCAPI AND NOT WIN32)
+  find_package(Threads REQUIRED)
+  target_link_libraries(zookeeper PUBLIC Threads::Threads)
+endif()
+
+# cli executable
+add_executable(cli src/cli.c)
+target_link_libraries(cli zookeeper)
+
+# load_gen executable
+if(WANT_SYNCAPI AND NOT WIN32)
+  add_executable(load_gen src/load_gen.c)
+  target_link_libraries(load_gen zookeeper)
+endif()
+
+# tests
+set(test_sources
+  tests/TestDriver.cc
+  tests/LibCMocks.cc
+  tests/LibCSymTable.cc
+  tests/MocksBase.cc
+  tests/ZKMocks.cc
+  tests/Util.cc
+  tests/ThreadingUtil.cc
+  tests/TestZookeeperInit.cc
+  tests/TestZookeeperClose.cc
+  tests/TestReconfig.cc
+  tests/TestReconfigServer.cc
+  tests/TestClientRetry.cc
+  tests/TestOperations.cc
+  tests/TestMulti.cc
+  tests/TestWatchers.cc
+  tests/TestClient.cc
+  tests/ZooKeeperQuorumServer.cc
+  tests/TestReadOnlyClient.cc
+  tests/TestLogClientEnv.cc)
+
+if(WANT_SYNCAPI)
+  list(APPEND test_sources tests/PthreadMocks.cc)
+endif()
+
+if(WANT_CPPUNIT)
+  add_executable(zktest ${test_sources})
+  target_include_directories(zktest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
+  target_compile_definitions(zktest
+    PRIVATE -DZKSERVER_CMD="${CMAKE_CURRENT_SOURCE_DIR}/tests/zkServer.sh")
+  # TODO: Use `find_library()` for `cppunit`.
+  target_link_libraries(zktest zookeeper cppunit dl)
+
+  # This reads the link flags from the file `tests/wrappers.opt` into
+  # the variable `symbol_wrappers` for use in `target_link_libraries`.
+  # It is a holdover from the original build system.
+  file(STRINGS tests/wrappers.opt symbol_wrappers)
+  if(WANT_SYNCAPI)
+    file(STRINGS tests/wrappers-mt.opt symbol_wrappers_mt)
+  endif()
+
+  target_link_libraries(zktest ${symbol_wrappers} ${symbol_wrappers_mt})
+
+  enable_testing()
+  add_test(NAME zktest_runner COMMAND zktest)
+  set_property(TEST zktest_runner PROPERTY ENVIRONMENT
+    "ZKROOT=${CMAKE_CURRENT_SOURCE_DIR}/../.."
+    "CLASSPATH=$CLASSPATH:$CLOVER_HOME/lib/clover.jar")
+endif()

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/zookeeper-client/zookeeper-client-c/ChangeLog
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-c/ChangeLog b/zookeeper-client/zookeeper-client-c/ChangeLog
new file mode 100644
index 0000000..c85a6c0
--- /dev/null
+++ b/zookeeper-client/zookeeper-client-c/ChangeLog
@@ -0,0 +1,116 @@
+Release 2.1.1
+2008-04-30 Andrew Kornev <akornev@users.sourceforge.net>
+
+    * changed the distributino package name to "c-client-src"
+    
+Release 2.1.0
+2008-04-30 Andrew Kornev <akornev@users.sourceforge.net>
+
+    * added the client latency diagnostics; the client prints a warning when the
+      reponse latency exceeds 20ms
+
+    * modified logging format to report the znode path for which the zookeeper 
+      operation is called
+
+    * fixed a minor bug where error messages were missing for some of the newer 
+      zookeeper error codes (ZCLOSING and ZNOTHING).
+
+    * improved logging by adding the XID to the message to make it easy to match
+      requests to responses
+
+    * fixed the bug causing sporadic session termination and timeouts
+
+    * added a new return code to zookeeper_process() -- ZNOTHING -- 
+      that indicates that the socket has no more data to read
+
+    * more unit tests added    
+
+Release 1.1.3
+2008-02-07 Andrew Kornev <akornev@users.sourceforge.net>
+
+    * get_xid() is not thread-safe (xid initialization race condition 
+      in the multi-threaded mode).
+    
+    * the I/O thread doesn�t automatically terminate on AUTH_FAILURE and 
+      SESSION_EXPIRED events.
+      
+    * all session events should be processed on the completion thread. 
+    
+    * PING operation doesn�t atomically enqueue the completion and 
+      send buffers like other operations do.
+      
+    * corrected zookeeper_init() doxygen docs.
+    
+    * new unit tests added.
+      
+
+Release 1.1.2
+2008-01-24 Andrew Kornev <akornev@users.sourceforge.net>
+
+    * fixed a race condition caused by the code in zookeeper_process()
+      and free_completions() setting sc->complete to 1 without proper
+      synchronization;
+
+    * fixed zoo_get() not updating buffer_len value with the actual
+      buffer length on return; added missing enter_critical/leave_critical
+      calls to the async ZK operations.
+
+    * Replaced select() with poll() to fix the problem with the FD_SET
+      macro causing stack corruption for FDs higher than 1024
+
+    * Added zoo_set_log_stream() to the public API. The function allows
+      applications to specify a different log file.
+
+    * Removed unused declarations from zookeeper.h (ACL related)
+
+    * changed zoo_get() signature to take a pointer to buffer length.
+      The function sets the parameter to the actual data length upon return.
+
+    * the watcher callback now takes the zhandle as its first parameter. This
+      is to avoid a race condition in the multi-threaded client when a watcher
+      is called before zookeeper_init() has returned.
+
+    * fixed zookeeper_close() resource leaks and race conditions,
+      fixed the race condition causing xid mismatch.
+
+    * added support for cppunit, added new targets: "check" and "run-check"
+      to build and run unit tests.
+
+    * Changed the signature of zookeeper_init(): it now takes a context pointer
+      as a parameter. This is to avoid a race condition in the multi-threaded client.
+
+    * Using a self-pipe rather than SIGUSR1 to wake up select() in the I/O thread
+
+    * Added the doxygen target to the autoconf scripts
+
+    * Pulled out the logging functionality from zookeeper.c to zk_log.c/.h.
+      Fixed a minor issue with PING responses being unnecessarily put on
+      the completion queue rather than simply dropped. Make use of DLL_EXPORT
+      symbol for building shared lib on cygwin.
+
+    * Implemented new Zookeeper operation sync() to flush the leader channel
+      to ensure that all updates have reached the followers.
+
+    * Synchronous methods not being handled properly on disconnect
+
+    * breed: fixed an incorrect parameter passed to zookeeper API by
+      the Sync API wrapper functions
+
+    * breed: the set and delete commands now support both Sync and Async API.
+      Prefix the command name with an 'a' to call the Async API: aset, adelete
+
+    * Make sure mutexes and condition variables are properly initialized
+      and destroyed
+
+    * Fixed zookeeper_close() causing core dumps with mt_adaptor
+
+
+Release 1.0.0
+2007-11-27 Andrew Kornev <akornev@users.sourceforge.net>
+
+    * configure.ac and Makefile.am added support for GNU autotools
+
+    * recordio.c/.h updated jute IO routines to use bit-explicit integer types
+      (int32_t vs. int, and int64_t vs. long long)
+
+    * README rough draft
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/zookeeper-client/zookeeper-client-c/INSTALL
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-c/INSTALL b/zookeeper-client/zookeeper-client-c/INSTALL
new file mode 100644
index 0000000..5458714
--- /dev/null
+++ b/zookeeper-client/zookeeper-client-c/INSTALL
@@ -0,0 +1,234 @@
+Installation Instructions
+*************************
+
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
+2006 Free Software Foundation, Inc.
+
+This file is free documentation; the Free Software Foundation gives
+unlimited permission to copy, distribute and modify it.
+
+Basic Installation
+==================
+
+Briefly, the shell commands `./configure; make; make install' should
+configure, build, and install this package.  The following
+more-detailed instructions are generic; see the `README' file for
+instructions specific to this package.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, and a
+file `config.log' containing compiler output (useful mainly for
+debugging `configure').
+
+   It can also use an optional file (typically called `config.cache'
+and enabled with `--cache-file=config.cache' or simply `-C') that saves
+the results of its tests to speed up reconfiguring.  Caching is
+disabled by default to prevent problems with accidental use of stale
+cache files.
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If you are using the cache, and at
+some point `config.cache' contains results you don't want to keep, you
+may remove or edit it.
+
+   The file `configure.ac' (or `configure.in') is used to create
+`configure' by a program called `autoconf'.  You need `configure.ac' if
+you want to change it or regenerate `configure' using a newer version
+of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.
+
+     Running `configure' might take a while.  While running, it prints
+     some messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+Some systems require unusual options for compilation or linking that the
+`configure' script does not know about.  Run `./configure --help' for
+details on some of the pertinent environment variables.
+
+   You can give `configure' initial values for configuration parameters
+by setting variables in the command line or in the environment.  Here
+is an example:
+
+     ./configure CC=c99 CFLAGS=-g LIBS=-lposix
+
+   *Note Defining Variables::, for more details.
+
+Compiling For Multiple Architectures
+====================================
+
+You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you can use GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   With a non-GNU `make', it is safer to compile the package for one
+architecture at a time in the source code directory.  After you have
+installed the package for one architecture, use `make distclean' before
+reconfiguring for another architecture.
+
+Installation Names
+==================
+
+By default, `make install' installs the package's commands under
+`/usr/local/bin', include files under `/usr/local/include', etc.  You
+can specify an installation prefix other than `/usr/local' by giving
+`configure' the option `--prefix=PREFIX'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+pass the option `--exec-prefix=PREFIX' to `configure', the package uses
+PREFIX as the prefix for installing programs and libraries.
+Documentation and other data files still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=DIR' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+There may be some features `configure' cannot figure out automatically,
+but needs to determine by the type of machine the package will run on.
+Usually, assuming the package is built to be run on the _same_
+architectures, `configure' can figure that out, but if it prints a
+message saying it cannot guess the machine type, give it the
+`--build=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name which has the form:
+
+     CPU-COMPANY-SYSTEM
+
+where SYSTEM can have one of these forms:
+
+     OS KERNEL-OS
+
+   See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the machine type.
+
+   If you are _building_ compiler tools for cross-compiling, you should
+use the option `--target=TYPE' to select the type of system they will
+produce code for.
+
+   If you want to _use_ a cross compiler, that generates code for a
+platform different from the build platform, you should specify the
+"host" platform (i.e., that on which the generated programs will
+eventually be run) with `--host=TYPE'.
+
+Sharing Defaults
+================
+
+If you want to set default values for `configure' scripts to share, you
+can create a site shell script called `config.site' that gives default
+values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Defining Variables
+==================
+
+Variables not defined in a site shell script can be set in the
+environment passed to `configure'.  However, some packages may run
+configure again during the build, and the customized values of these
+variables may be lost.  In order to avoid this problem, you should set
+them in the `configure' command line, using `VAR=value'.  For example:
+
+     ./configure CC=/usr/local2/bin/gcc
+
+causes the specified `gcc' to be used as the C compiler (unless it is
+overridden in the site shell script).
+
+Unfortunately, this technique does not work for `CONFIG_SHELL' due to
+an Autoconf bug.  Until the bug is fixed you can use this workaround:
+
+     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
+
+`configure' Invocation
+======================
+
+`configure' recognizes the following options to control how it operates.
+
+`--help'
+`-h'
+     Print a summary of the options to `configure', and exit.
+
+`--version'
+`-V'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`--cache-file=FILE'
+     Enable the cache: use and save the results of the tests in FILE,
+     traditionally `config.cache'.  FILE defaults to `/dev/null' to
+     disable caching.
+
+`--config-cache'
+`-C'
+     Alias for `--cache-file=config.cache'.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`configure' also accepts some other, not widely useful, options.  Run
+`configure --help' for more details.
+

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/176bd682/zookeeper-client/zookeeper-client-c/LICENSE
----------------------------------------------------------------------
diff --git a/zookeeper-client/zookeeper-client-c/LICENSE b/zookeeper-client/zookeeper-client-c/LICENSE
new file mode 100644
index 0000000..d645695
--- /dev/null
+++ b/zookeeper-client/zookeeper-client-c/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.


Mime
View raw message