zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From an...@apache.org
Subject [18/51] [partial] zookeeper git commit: ZOOKEEPER-3032: MAVEN MIGRATION - branch-3.5 - move java server, client
Date Fri, 05 Oct 2018 13:36:46 GMT
http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java b/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
deleted file mode 100644
index 8b4e0ae..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/InstanceContainer.java
+++ /dev/null
@@ -1,311 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.AsyncCallback;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.KeeperException.ConnectionLossException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.KeeperException.NodeExistsException;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.test.system.Instance.Reporter;
-
-/**
- * This class starts up,
- */
-public class InstanceContainer implements Watcher, AsyncCallback.ChildrenCallback {
-    private final class MyWatcher implements Watcher {
-        String myNode;
-        DataCallback dc;
-        MyWatcher(String myNode, DataCallback dc) {
-            this.myNode = myNode;
-            this.dc = dc;
-        }
-        public void process(WatchedEvent event) {
-            if (event.getPath() != null && event.getPath().equals(myNode)) {
-                zk.getData(myNode, this, dc, this);
-            }
-        }
-    }
-    private final class MyDataCallback implements DataCallback {
-        int lastVer;
-        String myNode;
-        Instance myInstance;
-
-        MyDataCallback(String myNode, Instance myInstance, int ver) {
-            this.myNode = myNode;
-            this.myInstance = myInstance;
-            lastVer = ver;
-        }
-        public void processResult(int rc, String path,
-                Object ctx, byte[] data, Stat stat) {
-            if (rc == KeeperException.Code.NONODE.intValue()) {
-                // we can just ignore because the child watcher takes care of this
-                return;
-            }
-            if (rc != KeeperException.Code.OK.intValue()) {
-                zk.getData(myNode, (Watcher)ctx, this, ctx);
-            }
-            int currVer = stat.getVersion();
-            if (currVer != lastVer) {
-                String parts[] = new String(data).split(" ", 2);
-                myInstance.configure(parts[1]);
-                lastVer = currVer;
-            }
-        }
-    }
-    private final class MyReporter implements Reporter {
-        String myReportNode;
-
-        public MyReporter(String child) {
-            myReportNode = reportsNode + '/' + child;
-        }
-
-        public void report(String report) throws KeeperException, InterruptedException {
-            for(int j = 0; j < maxTries; j++) {
-                try {
-                    try {
-                        zk.setData(myReportNode, report.getBytes(), -1);
-                    } catch(NoNodeException e) {
-                        zk.create(myReportNode, report.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-                    }
-                    break;
-                } catch(ConnectionLossException e) {}
-            }
-        }
-    }
-    private static final Logger LOG = LoggerFactory.getLogger(InstanceContainer.class);
-    String name;
-    String zkHostPort;
-    // We only run if the readyNode exists
-    String prefixNode;
-    String statusNode = "available";
-    String reportsNode = "reports";
-    String assignmentsNode = "assignments";
-    ZooKeeper zk;
-    static final int sessTimeout = 5000;
-    static final int maxTries = 3;
-    public InstanceContainer(String name, String zkHostPort, String prefix) throws UnknownHostException {
-        if (name.length() == 0 || name.equals("hostname")) {
-            name = InetAddress.getLocalHost().getCanonicalHostName();
-        }
-        this.name = name;
-        this.zkHostPort = zkHostPort;
-        this.prefixNode = prefix;
-        this.statusNode = prefix + '/' + this.statusNode + '/' + name;
-        this.reportsNode = prefix + '/' + this.reportsNode;
-        this.assignmentsNode = prefix + '/' + this.assignmentsNode + '/' + name;
-    }
-
-    private void rmnod(String path) throws InterruptedException, KeeperException {
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.delete(path, -1);
-                lastException = null;
-                break;
-            } catch (KeeperException.NoNodeException e) {
-                // cool this is what we want
-                break;
-            } catch (KeeperException e) {
-                lastException = e;
-            }
-        }
-        if (lastException != null) {
-            throw lastException;
-        }
-    }
-    private void mknod_inner(String path, CreateMode mode) throws KeeperException, InterruptedException {
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.create(path, null, Ids.OPEN_ACL_UNSAFE, mode);
-                break;
-            } catch (NodeExistsException e) {
-                if (mode != CreateMode.EPHEMERAL) {
-                    return;
-                }
-                Stat stat = zk.exists(path, false);
-                if (stat == null) {
-                    continue;
-                }
-                if (stat.getEphemeralOwner() != zk.getSessionId()) {
-                    throw e;
-                }
-                break;
-            } catch (ConnectionLossException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private void mknod(String path, CreateMode mode) throws KeeperException, InterruptedException {
-        String subpath[] = path.split("/");
-        StringBuilder sb = new StringBuilder();
-        // We start at 1 because / will create an empty part first
-        for(int i = 1; i < subpath.length; i++) {
-            sb.append("/");
-            sb.append(subpath[i]);
-            CreateMode m = CreateMode.PERSISTENT;
-            if (i == subpath.length-1) {
-                m = mode;
-            }
-            mknod_inner(sb.toString(), m);
-        }
-    }
-
-    public void run() throws IOException, InterruptedException, KeeperException {
-        zk = new ZooKeeper(zkHostPort, sessTimeout, this);
-        mknod(assignmentsNode, CreateMode.PERSISTENT);
-        mknod(statusNode, CreateMode.EPHEMERAL);
-        mknod(reportsNode, CreateMode.PERSISTENT);
-        // Now we just start watching the assignments directory
-        zk.getChildren(assignmentsNode, true, this, null);
-    }
-
-    /**
-     * @param args the first parameter is the instance name, the second
-     * is the ZooKeeper spec. if the instance name is the empty string
-     * or "hostname", the hostname will be used.
-     * @throws InterruptedException
-     * @throws IOException
-     * @throws UnknownHostException
-     * @throws KeeperException
-     */
-    public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException, KeeperException {
-        if (args.length != 3) {
-            System.err.println("USAGE: " + InstanceContainer.class.getName() + " name zkHostPort znodePrefix");
-            System.exit(2);
-        }
-        new InstanceContainer(args[0], args[1], args[2]).run();
-        while(true) {
-            Thread.sleep(1000);
-        }
-    }
-
-    public void process(WatchedEvent event) {
-        if (KeeperState.Expired == event.getState()) {
-            // It's all over
-            LOG.error("Lost session");
-            System.exit(4);
-        }
-        if (event.getPath() != null && event.getPath().equals(assignmentsNode)) {
-            // children have changed, so read in the new list
-            zk.getChildren(assignmentsNode, true, this, null);
-        }
-    }
-
-    HashMap<String, Instance> instances = new HashMap<String, Instance>();
-
-    @Override
-    public void processResult(int rc, String path, Object ctx, List<String> children) {
-        if (rc != KeeperException.Code.OK.intValue()) {
-            // try it again
-            zk.getChildren(assignmentsNode, true, this, null);
-            return;
-        }
-        HashMap<String, Instance> newList = new HashMap<String, Instance>();
-        // check for differences
-        Stat stat = new Stat();
-        for(String child: children) {
-            Instance i = instances.remove(child);
-            if (i == null) {
-                // Start up a new instance
-                byte data[] = null;
-                String myNode = assignmentsNode + '/' + child;
-                while(true) {
-                    try {
-                        data = zk.getData(myNode, true, stat);
-                        break;
-                    } catch (NoNodeException e) {
-                        // The node doesn't exist anymore, so skip it
-                        break;
-                    } catch (KeeperException e) {
-                        e.printStackTrace();
-                    } catch (InterruptedException e) {
-                        return;
-                    }
-                }
-                if (data != null) {
-                    String instanceSpec = new String(data);
-                    int spaceIndex = instanceSpec.indexOf(' ');
-                    String clazz;
-                    String conf;
-                    if (spaceIndex == -1) {
-                        clazz = instanceSpec;
-                        conf = null;
-                    } else {
-                        clazz = instanceSpec.substring(0, spaceIndex);
-                        conf = instanceSpec.substring(spaceIndex+1);
-                    }
-                    try {
-                        Class<?> c = Class.forName(clazz);
-                        i = (Instance)c.newInstance();
-                        Reporter reporter = new MyReporter(child);
-                        i.setReporter(reporter);
-                        i.configure(conf);
-                        i.start();
-                        newList.put(child, i);
-                        int ver = stat.getVersion();
-                        Instance myInstance = i;
-                        DataCallback dc = new MyDataCallback(myNode, myInstance, ver);
-                        Watcher watcher = new MyWatcher(myNode, dc);
-                        zk.getData(myNode, watcher, dc, watcher);
-                    } catch (Exception e) {
-                        LOG.warn("Skipping " + child, e);
-                        if (e.getCause() != null) {
-                            LOG.warn("Caused by", e.getCause());
-                        }
-                    }
-
-                }
-            } else {
-                // just move it to the new list
-                newList.put(child, i);
-            }
-        }
-        // kill anything that was removed for the children
-        for(Map.Entry<String,Instance> i: instances.entrySet()) {
-            i.getValue().stop();
-            try {
-                rmnod(reportsNode + '/' + i.getKey());
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-            } catch (KeeperException e) {
-                e.printStackTrace();
-            }
-        }
-        instances = newList;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java b/src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java
deleted file mode 100644
index fed0a90..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/InstanceManager.java
+++ /dev/null
@@ -1,346 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map.Entry;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.AsyncCallback;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.KeeperException.ConnectionLossException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.KeeperException.NodeExistsException;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.Stat;
-import org.apache.zookeeper.common.Time;
-
-/**
- * This class doles out assignments to InstanceContainers that are registered to
- * a ZooKeeper znode. The znode will have four child nodes:
- *    * ready: this znode indicates that the InstanceManager is running
- *    * available: the children of this znode are ephemeral nodes representing
- *                 running InstanceContainers
- *    * assignments: there will be a child under this znode for each available 
- *                   InstanceContainer. those znodes will have a child for each
- *                   assigned instance
- *    * reports: there will be a child under this znode for each instance that is
- *               running. it will have the report string from the instance.
- */
-public class InstanceManager implements AsyncCallback.ChildrenCallback, Watcher {
-    final private static Logger LOG = LoggerFactory.getLogger(InstanceManager.class);
-    private ZooKeeper zk;
-    private String prefixNode;
-    private String reportsNode = "reports";
-    private String readyNode = "ready";
-    private String assignmentsNode = "assignments";
-    private String statusNode = "available";
-    private static final int maxTries = 3;
-    private static final class Assigned {
-        String container;
-        int weight;
-        Assigned(String container, int weight) {
-            this.container = container;
-            this.weight = weight;
-        }
-    }
-    private static List<String> preferredList = new ArrayList<String>();
-    static {
-        String list = System.getProperty("ic.preferredList");
-        if (list != null) {
-            preferredList = Arrays.asList(list.split(","));
-            System.err.println("Preferred List: " + preferredList);
-        } else {
-            System.err.println("Preferred List is empty");
-        }
-    }
-    private HashMap<String, HashSet<Assigned>> assignments = new HashMap<String, HashSet<Assigned>>();
-    private HashMap<String, Assigned> instanceToAssignment = new HashMap<String, Assigned>();
-    public InstanceManager(ZooKeeper zk, String prefix) throws KeeperException, InterruptedException {
-        this.zk = zk;
-        this.prefixNode = prefix;
-        this.readyNode = prefix + '/' + this.readyNode;
-        this.assignmentsNode = prefix + '/' + this.assignmentsNode;
-        this.reportsNode = prefix + '/' + this.reportsNode;
-        this.statusNode = prefix + '/' + this.statusNode;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                setupNodes(zk);
-                break;
-            } catch(ConnectionLossException e) {}
-        }
-        ConnectionLossException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                List<String> children = zk.getChildren(statusNode, this);
-                processResult(0, statusNode, null, children);
-                lastException = null;
-                break;
-            } catch(ConnectionLossException e) {
-                lastException = e;
-            }
-        }
-        if (lastException != null) {
-            throw lastException;
-        }
-    }
-    private void setupNodes(ZooKeeper zk) throws KeeperException,
-            InterruptedException {
-        try {
-            zk.create(prefixNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try {
-            zk.create(assignmentsNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try { 
-            zk.create(statusNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try { 
-            zk.create(reportsNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-        try {
-            zk.create(readyNode, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        } catch(NodeExistsException e) { /* this is ok */ } 
-    }
-    
-    synchronized public void processResult(int rc, String path, Object ctx,
-            List<String> children) {
-        if (rc != KeeperException.Code.OK.intValue()) {
-            zk.getChildren(statusNode, this, this, null);
-            return;
-        }
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Got " + children + " children from " + path);
-        }
-        HashMap<String, HashSet<Assigned>> newAssignments = new HashMap<String, HashSet<Assigned>>();
-        for(String c: children) {
-            HashSet<Assigned> a = assignments.remove(c);
-            if (a != null) {
-                newAssignments.put(c, a);
-            } else {
-                newAssignments.put(c, new HashSet<Assigned>());
-            }
-        }
-        // Clean up the dead machines
-        for(String dead: assignments.keySet()) {
-            try {
-                removeInstance(dead);
-            } catch (KeeperException e) {
-                e.printStackTrace();
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-            }
-        }
-        assignments = newAssignments;
-    }
-    
-    public void process(WatchedEvent event) {
-        if (event.getPath().equals(statusNode)) {
-            zk.getChildren(statusNode, this, this, null);
-        }
-    }
-    synchronized public String assignInstance(String name, Class<? extends Instance> clazz, String params, int weight) throws NoAvailableContainers, DuplicateNameException, InterruptedException, KeeperException {
-        if (weight < 1) {
-            // if the weights are not above zero, things will get messed up
-            weight = 1;
-        }
-        String instanceSpec = clazz.getName() + ' ' + params;
-        if (instanceToAssignment.get(name) != null) {
-            throw new DuplicateNameException(name + " already exists");
-        }
-        // find most idle node
-        String mostIdle = null;
-        int mostIdleWeight = Integer.MAX_VALUE;
-        for(String preferred: preferredList) {
-            HashSet<Assigned> assignmentList = assignments.get(preferred);
-            int w = 0;
-            if (assignmentList != null) {
-                for(Assigned a: assignmentList) {
-                    w += a.weight;
-                }
-                if (w < mostIdleWeight) {
-                    mostIdleWeight = w;
-                    mostIdle = preferred;
-                }
-            }
-        }
-        for(Entry<String, HashSet<Assigned>> e: assignments.entrySet()) {
-            int w = 0;
-            for(Assigned a: e.getValue()) {
-                w += a.weight;
-            }
-            if (w < mostIdleWeight) {
-                mostIdleWeight = w;
-                mostIdle = e.getKey();
-            }
-        }
-        if (mostIdle == null) {
-            throw new NoAvailableContainers("No available containers");
-        }
-        Assigned a = new Assigned(mostIdle, weight);
-        instanceToAssignment.put(name, a);
-        HashSet<Assigned> as = assignments.get(mostIdle);
-        if (as == null) {
-            as = new HashSet<Assigned>();
-            assignments.put(mostIdle, as);
-        }
-        as.add(a);
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.create(assignmentsNode + '/' + mostIdle + '/' + name, instanceSpec.getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
-                return mostIdle;
-            } catch(NodeExistsException e) {
-                return mostIdle;
-            } catch (KeeperException e) {
-                lastException = e;
-            }
-        }
-        throw lastException;
-    }
-    
-    public void reconfigureInstance(String name, String params) throws NoAssignmentException, InterruptedException, KeeperException {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Reconfiguring " + name + " with " + params);
-        }
-        Assigned assigned = instanceToAssignment.get(name);
-        if (assigned == null) {
-            throw new NoAssignmentException();
-        }
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.setData(assignmentsNode + '/' + assigned.container + '/' + name, ("update " + params).getBytes(), -1);
-                break;
-            } catch (ConnectionLossException e) {
-                lastException = e;
-            }
-        }
-        if (lastException != null) {
-            throw lastException;
-        }
-    }
-    
-    private void doDelete(String path) throws InterruptedException, KeeperException {
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.delete(path, -1);
-                return;
-            } catch(NoNodeException e) {
-                return;
-            } catch (KeeperException e) {
-                lastException = e;
-            }
-        }
-        throw lastException;
-    }
-    synchronized public void removeInstance(String name) throws InterruptedException, KeeperException {
-        Assigned assigned = instanceToAssignment.remove(name);
-        if (assigned == null) {
-            return;
-        }
-        assignments.get(assigned.container).remove(name);
-        doDelete(assignmentsNode + '/' + assigned.container + '/' + name);
-        doDelete(reportsNode + '/' + name);
-    }
-    
-    synchronized boolean isAlive(String name) {
-        return instanceToAssignment.get(name) != null;
-    }
-    
-    public void resetStatus(String name) throws InterruptedException, KeeperException {
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries; i++) {
-            try {
-                zk.delete(reportsNode + '/' + name, -1);
-                lastException = null;
-                break;
-            } catch(ConnectionLossException e) {
-                lastException = e;
-            } catch(NoNodeException e) {
-                // great this is what we want!
-            }
-        }
-        if (lastException != null) {
-            throw lastException;
-        }
-    }
-
-    public String getStatus(String name, long timeout) throws KeeperException, InterruptedException {
-        Stat stat = new Stat();
-        byte data[] = null;
-        long endTime = Time.currentElapsedTime() + timeout;
-        KeeperException lastException = null;
-        for(int i = 0; i < maxTries && endTime > Time.currentElapsedTime(); i++) {
-            try {
-                data = zk.getData(reportsNode + '/' + name, false, stat);
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Got Data: " + ((data == null) ? "null" : new String(data)));
-                }
-                lastException = null;
-                break;
-            } catch(ConnectionLossException e) {
-                lastException = e;
-            } catch(NoNodeException e) {
-                final Object eventObj = new Object();
-                synchronized(eventObj) {
-                    // wait for the node to appear
-                    Stat eStat = zk.exists(reportsNode + '/' + name, new Watcher() {
-                        public void process(WatchedEvent event) {
-                            synchronized(eventObj) {
-                                eventObj.notifyAll();
-                            }
-                        }});
-                    if (eStat == null) {
-                        eventObj.wait(endTime - Time.currentElapsedTime());
-                    }
-                }
-                lastException = e;
-            }
-        }
-        if (lastException != null) {
-            throw lastException;
-        }
-        return new String(data);
-    }
-    synchronized public void close() throws InterruptedException {
-        for(String name: instanceToAssignment.keySet().toArray(new String[0])) {
-            try {
-                removeInstance(name);
-            } catch(KeeperException e) {
-                e.printStackTrace();
-            }
-        }
-        try {
-            doDelete(readyNode);
-        } catch (KeeperException e) {
-            e.printStackTrace();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/NoAssignmentException.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/NoAssignmentException.java b/src/java/systest/org/apache/zookeeper/test/system/NoAssignmentException.java
deleted file mode 100644
index 1ac1390..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/NoAssignmentException.java
+++ /dev/null
@@ -1,24 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-public class NoAssignmentException extends Exception {
-    private static final long serialVersionUID = 1L;
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/NoAvailableContainers.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/NoAvailableContainers.java b/src/java/systest/org/apache/zookeeper/test/system/NoAvailableContainers.java
deleted file mode 100644
index b8aabcc..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/NoAvailableContainers.java
+++ /dev/null
@@ -1,28 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-public class NoAvailableContainers extends Exception {
-    public NoAvailableContainers(String string) {
-        super(string);
-    }
-
-    private static final long serialVersionUID = 1L;
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java b/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
deleted file mode 100644
index 2231d01..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/QuorumPeerInstance.java
+++ /dev/null
@@ -1,289 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.server.quorum.QuorumPeer;
-import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
-import org.apache.zookeeper.test.TestUtils;
-
-class QuorumPeerInstance implements Instance {
-    final private static Logger LOG = LoggerFactory.getLogger(QuorumPeerInstance.class);
-    private static final File testData = new File(
-        System.getProperty("test.data.dir", "build/test/data"));
-
-    private static final int syncLimit = 3;
-    private static final int initLimit = 3;
-    private static final int tickTime = 2000;
-    String serverHostPort;
-    int serverId;
-    Reporter r;
-    QuorumPeer peer;
-
-    public void setReporter(Reporter r) {
-        this.r = r;
-    }
-
-    InetSocketAddress clientAddr;
-    InetSocketAddress quorumLeaderAddr;
-    InetSocketAddress quorumLeaderElectionAddr;
-    HashMap<Long, QuorumServer> peers;
-    File snapDir, logDir;
-
-    public QuorumPeerInstance() {
-        try {
-            File tmpFile = File.createTempFile("test", ".dir", testData);
-            File tmpDir = tmpFile.getParentFile();
-            tmpFile.delete();
-            File zkDirs = new File(tmpDir, "zktmp.cfg");
-            logDir = tmpDir;
-            snapDir = tmpDir;
-            Properties p;
-            if (zkDirs.exists()) {
-                p = new Properties();
-                FileInputStream input = new FileInputStream(zkDirs);
-                try {
-                  p.load(input);
-                } finally {
-                  input.close();
-                }
-            } else {
-                p = System.getProperties();
-            }
-            logDir = new File(p.getProperty("logDir", tmpDir.getAbsolutePath()));
-            snapDir = new File(p.getProperty("snapDir", tmpDir.getAbsolutePath()));
-            logDir = File.createTempFile("zktst", ".dir", logDir);
-            logDir.delete();
-            logDir.mkdirs();
-            snapDir = File.createTempFile("zktst", ".dir", snapDir);
-            snapDir.delete();
-            snapDir.mkdirs();
-        } catch (IOException e) {
-            e.printStackTrace();
-        }
-    }
-
-    public void configure(String params) {
-        if (clientAddr == null) {
-            String parts[] = params.split(" ");
-            // The first time we are configured, it is just to tell
-            // us which machine we are
-            serverId = Integer.parseInt(parts[0]);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Setting up server " + serverId);
-            }
-            if (parts.length > 1 && parts[1].equals("false")) {
-                System.setProperty("zookeeper.leaderServes", "no");
-            } else {
-                System.setProperty("zookeeper.leaderServes", "yes");
-            }
-            // Let's grab two ports
-            try {
-                ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLocalHost());
-                clientAddr = (InetSocketAddress) ss.getLocalSocketAddress();
-                ss.close();
-            } catch(IOException e) {
-                e.printStackTrace();
-            }
-            try {
-                ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLocalHost());
-                quorumLeaderAddr = (InetSocketAddress) ss.getLocalSocketAddress();
-                ss.close();
-            } catch(IOException e) {
-                e.printStackTrace();
-            }
-            try {
-                ServerSocket ss = new ServerSocket(0, 1, InetAddress.getLocalHost());
-                quorumLeaderElectionAddr = (InetSocketAddress) ss.getLocalSocketAddress();
-                ss.close();
-            } catch(IOException e) {
-                e.printStackTrace();
-            }
-            String report = clientAddr.getHostString() + ':' + clientAddr.getPort() +
-            ',' + quorumLeaderAddr.getHostString() + ':' + quorumLeaderAddr.getPort() + ':' + quorumLeaderElectionAddr.getPort();
-            try {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Reporting " + report);
-                }
-                r.report(report);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-            return;
-        } else {
-            int spaceIndex = params.indexOf(' ');
-            if (spaceIndex == -1) {
-                LOG.warn("looking for host:port,... start|stop, but found " + params);
-                return;
-            }
-            String quorumSpecs = params.substring(0, spaceIndex);
-            String cmd = params.substring(spaceIndex+1);
-            if (LOG.isDebugEnabled()) {
-                LOG.debug("Running command: " + cmd);
-            }
-            if (!cmd.equals("start")) {
-                if (peer != null) {
-                    peer.shutdown();
-                }
-                peer = null;
-                try {
-                    for(int i = 0; i < 5; i++) {
-                        Thread.sleep(500);
-                        try {
-                            // Wait until we can't connect
-                            new Socket("127.0.0.1", clientAddr.getPort()).close();
-                        } catch(IOException e) { break; }
-                    }
-                    r.report("stopped");
-                } catch (Exception e) {
-                    LOG.error("Unhandled error", e);
-                }
-                return;
-            }
-            String parts[] = quorumSpecs.split(",");
-            peers = new HashMap<Long,QuorumServer>();
-            for(int i = 0; i < parts.length; i++) {
-                // parts[i] == "host:leaderPort:leaderElectionPort;clientPort"
-                String subparts[] = ((parts[i].split(";"))[0]).split(":");
-                String clientPort = (parts[i].split(";"))[1];
-                peers.put(Long.valueOf(i),
-                          new QuorumServer(
-                                i,
-                                new InetSocketAddress(subparts[0], Integer.parseInt(subparts[1])),
-                                new InetSocketAddress(subparts[0], Integer.parseInt(subparts[2])),
-                                new InetSocketAddress(subparts[0], Integer.parseInt(clientPort))));
-            }
-            try {
-                if (LOG.isDebugEnabled()) {
-                    LOG.debug("Starting quorumPeer " + serverId + " on port " + clientAddr.getPort());
-                }
-                if (peer != null) {
-                    LOG.warn("Peer " + serverId + " already started");
-                    return;
-                }
-                System.err.println("SnapDir = " + snapDir + " LogDir = " + logDir);
-                peer = new QuorumPeer(peers, snapDir, logDir, clientAddr.getPort(), 0, serverId, tickTime, initLimit, syncLimit);
-                peer.start();
-                for(int i = 0; i < 5; i++) {
-                    Thread.sleep(500);
-                    try {
-                        // Wait until we can connect
-                        new Socket("127.0.0.1", clientAddr.getPort()).close();
-                        break;
-                    } catch(IOException e) {}
-                }
-                r.report("started");
-            } catch (Exception e) {
-                LOG.error("Unhandled exception", e);
-            }
-        }
-    }
-
-    public void start() {
-    }
-    
-    public void stop() {
-        if (LOG.isDebugEnabled()) {
-            LOG.debug("Stopping peer " + serverId);
-        }
-        if (peer != null) {
-            peer.shutdown();
-        }
-        if (logDir != null) {
-            TestUtils.deleteFileRecursively(logDir);
-        }
-        if (snapDir != null) {
-            TestUtils.deleteFileRecursively(snapDir);
-        }
-    }
-
-    /**
-     * This method is used to configure a QuorumPeerInstance
-     * 
-     * @param im the InstanceManager that will be managing the new instance
-     * @param i the server number to configure (should be zero based)
-     * @throws NoAvailableContainers
-     * @throws DuplicateNameException
-     * @throws InterruptedException
-     * @throws KeeperException
-     */
-    public static String[] createServer(InstanceManager im, int i) throws NoAvailableContainers, DuplicateNameException, InterruptedException, KeeperException {
-        return createServer(im, i, true);
-    }
-    
-    /**
-     * This method is used to configure a QuorumPeerInstance
-     * 
-     * @param im the InstanceManager that will be managing the new instance
-     * @param i the server number to configure (should be zero based)
-     * @param leaderServes if false, the leader will not accept client connections
-     * @throws NoAvailableContainers
-     * @throws DuplicateNameException
-     * @throws InterruptedException
-     * @throws KeeperException
-     */
-    public static String[] createServer(InstanceManager im, int i, boolean leaderServes) throws NoAvailableContainers, DuplicateNameException, InterruptedException, KeeperException {
-        im.assignInstance("server"+i, QuorumPeerInstance.class, Integer.toString(i) + " " + leaderServes, 50);
-        return im.getStatus("server"+i, 3000).split(",");
-        
-    }
-
-    /**
-     * Start an instance of the quorumPeer.
-     * @param im the manager of the instance
-     * @param quorumHostPort the comma-separated list of host:port pairs of quorum peers 
-     * @param index the zero based index of the server to start.
-     * @throws InterruptedException
-     * @throws KeeperException
-     * @throws NoAssignmentException
-     */
-    public static void startInstance(InstanceManager im, String quorumHostPort, int index) throws InterruptedException, KeeperException, NoAssignmentException {
-        im.resetStatus("server" + index);
-        im.reconfigureInstance("server"+index, quorumHostPort + " start");
-        im.getStatus("server" + index, 5000);
-    }
-
-    /**
-     * Stop an instance of the quorumPeer
-     * @param im the manager of the instance
-     * @param index the zero based index fo the server to stop
-     * @throws InterruptedException
-     * @throws KeeperException
-     * @throws NoAssignmentException
-     */
-    public static void stopInstance(InstanceManager im, int index) throws InterruptedException, KeeperException, NoAssignmentException {
-        im.resetStatus("server" + index);
-        im.reconfigureInstance("server"+index, Integer.toString(index) + " stop");
-        im.getStatus("server" + index, 3000);
-   
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java b/src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java
deleted file mode 100644
index 6ca5cc3..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/SimpleClient.java
+++ /dev/null
@@ -1,116 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-import org.apache.zookeeper.AsyncCallback;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.AsyncCallback.StatCallback;
-import org.apache.zookeeper.AsyncCallback.StringCallback;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * The client that gets spawned for the SimpleSysTest 
- *
- */
-public class SimpleClient implements Instance, Watcher, AsyncCallback.DataCallback, StringCallback, StatCallback {
-    private static final long serialVersionUID = 1L;
-    String hostPort;
-    ZooKeeper zk;
-    transient int index;
-    transient String myPath;
-    byte data[];
-    boolean createdEphemeral;
-    public void configure(String params) {
-        String parts[] = params.split(" ");
-        hostPort = parts[1];
-        this.index = Integer.parseInt(parts[0]);
-        myPath = "/simpleCase/" + index;
-    }
-    
-    public void start() {
-        try {
-            zk = new ZooKeeper(hostPort, 15000, this);
-            zk.getData("/simpleCase", true, this, null);
-            if (null != r) {
-                r.report("Client " + index + " connecting to " + hostPort);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-    
-    public void stop() {
-        try {
-            if (zk != null) {
-                zk.close();
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-    public void process(WatchedEvent event) {
-        if (event.getPath() != null && event.getPath().equals("/simpleCase")) {
-            zk.getData("/simpleCase", true, this, null);
-        }
-    }
-    
-    public void processResult(int rc, String path, Object ctx, byte[] data,
-            Stat stat) {
-        if (rc != 0) {
-            zk.getData("/simpleCase", true, this, null);
-        } else {
-            this.data = data;
-            String content = new String(data);
-            if (content.equals("die")) {
-                this.stop();
-                return;
-            }
-            if (!createdEphemeral) {
-                zk.create(myPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL, this, null);
-                createdEphemeral = true;
-            } else {
-                zk.setData(myPath, data, -1, this, null);
-            }
-        }            
-    }
-    
-    public void processResult(int rc, String path, Object ctx, String name) {
-        if (rc != 0) {
-            zk.create(myPath, data, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL, this, null);
-        }
-    }
-    public void processResult(int rc, String path, Object ctx, Stat stat) {
-        if (rc != 0) {
-            zk.setData(myPath, data, -1, this, null);
-        }
-    }
-    @Override
-    public String toString() {
-        return SimpleClient.class.getName() + "[" + index + "] using " + hostPort;
-    }
-    
-    Reporter r;
-    public void setReporter(Reporter r) {
-        this.r = r;
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/systest/org/apache/zookeeper/test/system/SimpleSysTest.java
----------------------------------------------------------------------
diff --git a/src/java/systest/org/apache/zookeeper/test/system/SimpleSysTest.java b/src/java/systest/org/apache/zookeeper/test/system/SimpleSysTest.java
deleted file mode 100644
index cf42d39..0000000
--- a/src/java/systest/org/apache/zookeeper/test/system/SimpleSysTest.java
+++ /dev/null
@@ -1,173 +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.
- */
-
-package org.apache.zookeeper.test.system;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.apache.zookeeper.ZooKeeper;
-import org.apache.zookeeper.KeeperException.ConnectionLossException;
-import org.apache.zookeeper.KeeperException.NoNodeException;
-import org.apache.zookeeper.Watcher.Event.KeeperState;
-import org.apache.zookeeper.ZooDefs.Ids;
-import org.apache.zookeeper.ZooKeeper.States;
-import org.apache.zookeeper.data.Stat;
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.zookeeper.common.Time;
-
-/**
- * This does a basic system test. It starts up an ensemble of servers and a set of clients.
- * It makes sure that all the clients come up. It kills off servers while making a change and
- * then ensures that all clients see the change. And then signals the clients to die and
- * watches them disappear.
- *
- */
-public class SimpleSysTest extends BaseSysTest implements Watcher {
-    int maxTries = 10;
-    boolean connected;
-    final private static Logger LOG = LoggerFactory.getLogger(SimpleSysTest.class);
-    
-    synchronized private boolean waitForConnect(ZooKeeper zk, long timeout) throws InterruptedException {
-        connected = (zk.getState() == States.CONNECTED);
-        long end = Time.currentElapsedTime() + timeout;
-        while(!connected && end > Time.currentElapsedTime()) {
-            wait(timeout);
-            connected = (zk.getState() == States.CONNECTED);
-        }
-        return connected;
-    }
-    
-    /**
-     * This test checks the following:
-     * 1) All clients connect successfully
-     * 2) Half of the servers die (assuming odd number) and a write succeeds
-     * 3) All servers are restarted and cluster stays alive
-     * 4) Clients see a change by the server
-     * 5) Clients' ephemeral nodes are cleaned up
-     * 
-     * @throws Exception
-     */
-    @Test
-    public void testSimpleCase() throws Exception {
-        configureServers(serverCount);
-        configureClients(clientCount, SimpleClient.class, getHostPort());
-        Stat stat = new Stat();
-        startServers();
-        LOG.debug("Connecting to " + getHostPort());
-        ZooKeeper zk = new ZooKeeper(getHostPort(), 15000, this);
-        waitForConnect(zk, 10000);
-        zk.create("/simpleCase", "orig".getBytes(), Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
-        startClients();
-        
-        // Check that all clients connect properly
-        for(int i = 0; i < getClientCount(); i++) {
-            for(int j = 0; j < maxTries; j++) {
-                try {
-                    byte b[] = zk.getData("/simpleCase/" + i, false, stat);
-                    Assert.assertEquals("orig", new String(b));
-                } catch(NoNodeException e) {
-                    if (j+1 == maxTries) {
-                        Assert.fail("Max tries exceeded on client " + i);
-                    }
-                    Thread.sleep(1000);
-                }
-            }
-        }
-        
-        // Kill half the servers, make a change, restart the dead
-        // servers, and then bounce the other servers one by one
-        for(int i = 0; i < getServerCount(); i++) {
-            stopServer(i);
-            if (i+1 > getServerCount()/2) {
-                startServer(i);
-            } else if (i+1 == getServerCount()/2) {
-                Assert.assertTrue("Connection didn't recover", waitForConnect(zk, 10000));
-                try {
-                    zk.setData("/simpleCase", "new".getBytes(), -1);
-                } catch(ConnectionLossException e) {
-                    Assert.assertTrue("Connection didn't recover", waitForConnect(zk, 10000));
-                    zk.setData("/simpleCase", "new".getBytes(), -1);
-                }
-                for(int j = 0; j < i; j++) {
-                    LOG.info("Starting server " + j);
-                    startServer(i);
-                }
-            }
-        }
-        Thread.sleep(100); // wait for things to stabilize
-        Assert.assertTrue("Servers didn't bounce", waitForConnect(zk, 15000));
-        try {
-            zk.getData("/simpleCase", false, stat);
-        } catch(ConnectionLossException e) {
-            Assert.assertTrue("Servers didn't bounce", waitForConnect(zk, 15000));
-        }
-        
-        // check that the change has propagated to everyone
-        for(int i = 0; i < getClientCount(); i++) {
-            for(int j = 0; j < maxTries; j++) {
-                byte data[] = zk.getData("/simpleCase/" + i, false, stat);
-                if (new String(data).equals("new")) {
-                    break;
-                }
-                if (j+1 == maxTries) {
-                    Assert.fail("max tries exceeded for " + i);
-                }
-                Thread.sleep(1000);
-            }
-        }
-        
-        // send out the kill signal
-        zk.setData("/simpleCase", "die".getBytes(), -1);
-        
-        // watch for everyone to die
-        for(int i = 0; i < getClientCount(); i++) {
-            try {
-                for(int j = 0; j < maxTries; j++) {
-                    zk.getData("/simpleCase/" + i, false, stat);
-                    if (j+1 == maxTries) {
-                        Assert.fail("max tries exceeded waiting for child " + i + " to die");
-                    }
-                    Thread.sleep(200);
-                }
-            } catch(NoNodeException e) {
-                // Great this is what we were hoping for!
-            }
-        }
-        
-        stopClients();
-        stopServers();
-    }
-
-    public void process(WatchedEvent event) {
-        if (event.getState() == KeeperState.SyncConnected) {
-            synchronized(this) {
-                connected = true;
-                notifyAll();
-            }
-        } else if (event.getState() == KeeperState.Disconnected) {
-            synchronized(this) {
-                connected = false;
-                notifyAll();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/test/bin/check_compatibility.py
----------------------------------------------------------------------
diff --git a/src/java/test/bin/check_compatibility.py b/src/java/test/bin/check_compatibility.py
deleted file mode 100644
index cad8195..0000000
--- a/src/java/test/bin/check_compatibility.py
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/env python
-#
-# 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.
-
-# Script which checks Java API compatibility between two revisions of the
-# Java client.
-#
-# Based on the compatibility checker from the HBase project, but ported to
-# Python for better readability.
-
-# Lifted from Kudu: https://github.com/apache/kudu/blob/master/build-support/check_compatibility.py
-
-import logging
-import optparse
-import os
-import shutil
-import subprocess
-import sys
-
-JAVA_ACC_GIT_URL = "https://github.com/lvc/japi-compliance-checker.git"
-
-# The annotations for what we consider our public API.
-PUBLIC_ANNOTATIONS = ["org.apache.yetus.audience.InterfaceAudience.LimitedPrivate",
-                      "org.apache.yetus.audience.InterfaceAudience.Public"]
-
-# Various relative paths
-PATH_TO_REPO_DIR = "../../../../"
-PATH_TO_BUILD_DIR = PATH_TO_REPO_DIR + "build/compat-check"
-PATH_TO_JACC_DIR = PATH_TO_REPO_DIR + "build/jacc"
-
-def check_output(*popenargs, **kwargs):
-    # r"""Run command with arguments and return its output as a byte string.
-    # Backported from Python 2.7 as it's implemented as pure python on stdlib.
-    # >>> check_output(['/usr/bin/python', '--version'])
-    # Python 2.6.2
-    # """
-    process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
-    output, unused_err = process.communicate()
-    retcode = process.poll()
-    if retcode:
-        cmd = kwargs.get("args")
-        if cmd is None:
-            cmd = popenargs[0]
-        error = subprocess.CalledProcessError(retcode, cmd)
-        error.output = output
-        raise error
-    return output
-
-def get_repo_dir():
-    """ Return the path to the top of the repo. """
-    dirname, _ = os.path.split(os.path.abspath(__file__))
-    return os.path.abspath(os.path.join(dirname, PATH_TO_REPO_DIR))
-
-
-def get_scratch_dir():
-    """ Return the path to the scratch dir that we build within. """
-    dirname, _ = os.path.split(os.path.abspath(__file__))
-    return os.path.abspath(os.path.join(dirname, PATH_TO_BUILD_DIR))
-
-
-def get_java_acc_dir():
-    dirname, _ = os.path.split(os.path.abspath(__file__))
-    return os.path.abspath(os.path.join(dirname, PATH_TO_JACC_DIR))
-
-
-def clean_scratch_dir(scratch_dir):
-    """ Clean up and re-create the scratch directory. """
-    if os.path.exists(scratch_dir):
-        logging.info("Removing scratch dir %s...", scratch_dir)
-        shutil.rmtree(scratch_dir)
-    logging.info("Creating empty scratch dir %s...", scratch_dir)
-    os.makedirs(scratch_dir)
-
-
-def checkout_tree(rev, path):
-    """ Check out the Java source tree for the given revision into the given path. """
-    logging.info("Checking out %s in %s", rev, path)
-    os.makedirs(path)
-    # Extract java source
-    subprocess.check_call(["bash", '-o', 'pipefail', "-c",
-                           ("git archive --format=tar %s | " +
-                            "tar -C \"%s\" -xf -") % (rev, path)],
-                          cwd=get_repo_dir())
-
-
-def get_git_hash(revname):
-    """ Convert 'revname' to its SHA-1 hash. """
-    return check_output(["git", "rev-parse", revname],
-                        cwd=get_repo_dir()).strip()
-
-
-def build_tree(path):
-    """ Run the Java build within 'path'. """
-    logging.info("Building in %s...", path)
-    subprocess.check_call(["ant", "jar"], cwd=path)
-
-
-def checkout_java_acc(force):
-    """
-    Check out the Java API Compliance Checker. If 'force' is true, will re-download even if the
-    directory exists.
-    """
-    acc_dir = get_java_acc_dir()
-    if os.path.exists(acc_dir):
-        logging.info("Java JAVA_ACC is already downloaded.")
-        if not force:
-            return
-        logging.info("Forcing re-download.")
-        shutil.rmtree(acc_dir)
-    logging.info("Checking out Java JAVA_ACC...")
-    subprocess.check_call(["git", "clone", "-b", "2.1", "--single-branch", "--depth=1", JAVA_ACC_GIT_URL, acc_dir])
-
-
-def find_client_jars(path):
-    """ Return a list of jars within 'path' to be checked for compatibility. """
-    return check_output(["find", path, "-name", "zookeeper*.jar"]).rstrip('\n')
-
-
-def run_java_acc(src_name, src, dst_name, dst):
-    """ Run the compliance checker to compare 'src' and 'dst'. """
-    src_jar = find_client_jars(src)
-    dst_jar = find_client_jars(dst)
-    logging.info("Will check compatibility between original jars:\n%s\n" +
-                 "and new jars:\n%s",
-                 src_jar, dst_jar)
-
-    annotations_path = os.path.join(get_scratch_dir(), "annotations.txt")
-    with file(annotations_path, "w") as f:
-        for ann in PUBLIC_ANNOTATIONS:
-            print >>f,  ann
-
-    java_acc_path = os.path.join(get_java_acc_dir(), "japi-compliance-checker.pl")
-
-    out_path = os.path.join(get_scratch_dir(), "report.html")
-    subprocess.check_call(["perl", java_acc_path,
-                           "-lib", "ZooKeeper",
-                           "-v1", src_name,
-                           "-v2", dst_name,
-                           "-d1", src_jar,
-                           "-d2", dst_jar,
-                           "-annotations-list", annotations_path,
-                           "-report-path", out_path])
-
-
-def main(argv):
-    logging.basicConfig(level=logging.INFO)
-    parser = optparse.OptionParser(
-        usage="usage: %prog SRC..[DST]")
-    parser.add_option("-f", "--force-download", dest="force_download_deps",
-                      help=("Download dependencies (i.e. Java JAVA_ACC) even if they are " +
-                            "already present"))
-    opts, args = parser.parse_args()
-
-    if len(args) != 1:
-        parser.error("no src/dst revision specified")
-        sys.exit(1)
-
-    src_rev, dst_rev = args[0].split("..", 1)
-    if dst_rev == "":
-        dst_rev = "HEAD"
-    src_rev = get_git_hash(src_rev)
-    dst_rev = get_git_hash(dst_rev)
-
-    logging.info("Source revision: %s", src_rev)
-    logging.info("Destination revision: %s", dst_rev)
-
-    # Download deps.
-    checkout_java_acc(opts.force_download_deps)
-
-    # Set up the build.
-    scratch_dir = get_scratch_dir()
-    clean_scratch_dir(scratch_dir)
-
-    # Check out the src and dst source trees.
-    src_dir = os.path.join(scratch_dir, "src")
-    dst_dir = os.path.join(scratch_dir, "dst")
-    checkout_tree(src_rev, src_dir)
-    checkout_tree(dst_rev, dst_dir)
-
-    # Run the build in each.
-    build_tree(src_dir)
-    build_tree(dst_dir)
-
-    run_java_acc(src_rev, src_dir + "/build",
-                 dst_rev, dst_dir + "/build")
-
-
-if __name__ == "__main__":
-    main(sys.argv)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/zookeeper/blob/3ce1b18b/src/java/test/bin/test-github-pr.sh
----------------------------------------------------------------------
diff --git a/src/java/test/bin/test-github-pr.sh b/src/java/test/bin/test-github-pr.sh
deleted file mode 100755
index e155769..0000000
--- a/src/java/test/bin/test-github-pr.sh
+++ /dev/null
@@ -1,616 +0,0 @@
-#!/usr/bin/env bash
-#   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.
-
-
-#set -x
-
-### Setup some variables.
-### GIT_COMMIT and BUILD_URL are set by Hudson if it is run by patch process
-### Read variables from properties file
-. `dirname $0`/test-patch.properties
-
-###############################################################################
-parseArgs() {
-  case "$1" in
-    QABUILD)
-      ### Set QABUILD to true to indicate that this script is being run by Hudson
-      QABUILD=true
-      if [[ $# != 14 ]] ; then
-        echo "ERROR: usage $0 QABUILD <PATCH_DIR> <PS_CMD> <WGET_CMD> <JIRACLI> <GIT_CMD> <GREP_CMD> <PATCH_CMD> <FINDBUGS_HOME> <FORREST_HOME> <WORKSPACE_BASEDIR> <JIRA_PASSWD> <JAVA5_HOME> <CURL_CMD>"
-        cleanupAndExit 0
-      fi
-      PATCH_DIR=$2
-      PS=$3
-      WGET=$4
-      JIRACLI=$5
-      GIT=$6
-      GREP=$7
-      PATCH=$8
-      FINDBUGS_HOME=$9
-      FORREST_HOME=${10}
-      BASEDIR=${11}
-      JIRA_PASSWD=${12}
-      JAVA5_HOME=${13}
-      CURL=${14}
-      if [ ! -e "$PATCH_DIR" ] ; then
-        mkdir -p $PATCH_DIR
-      fi
-
-      ## Obtain PR number and title
-      PULLREQUEST_ID=${GIT_PR_NUMBER}
-      PULLREQUEST_TITLE="${GIT_PR_TITLE}"
-
-      ## Extract jira number from PR title
-      local prefix=${PULLREQUEST_TITLE%ZOOKEEPER\-[0-9]*}
-      local noprefix=${PULLREQUEST_TITLE#$prefix}
-      local regex='\(ZOOKEEPER-.[0-9]*\)'
-      defect=$(expr "$noprefix" : ${regex})
-
-      echo "Pull request id: ${PULLREQUEST_ID}"
-      echo "Pull request title: ${PULLREQUEST_TITLE}"
-      echo "Defect number: ${defect}"
-
-      JIRA_COMMENT="GitHub Pull Request ${PULLREQUEST_NUMBER} Build
-      "
-      ;;
-    DEVELOPER)
-      ### Set QABUILD to false to indicate that this script is being run by a developer
-      QABUILD=false
-      if [[ $# != 10 ]] ; then
-        echo "ERROR: usage $0 DEVELOPER <GIT_PR_URL> <SCRATCH_DIR> <GIT_CMD> <GREP_CMD> <PATCH_CMD> <FINDBUGS_HOME> <FORREST_HOME> <WORKSPACE_BASEDIR> <JAVA5_HOME>"
-        cleanupAndExit 0
-      fi
-      PATCH_DIR=$3
-      PATCH_FILE=${PATCH_DIR}/patch
-      curl -L $2.diff > ${PATCH_FILE}
-      ### PATCH_FILE contains the location of the patchfile
-      if [[ ! -e "$PATCH_FILE" ]] ; then
-        echo "Unable to locate the patch file $PATCH_FILE"
-        cleanupAndExit 0
-      fi
-      ### Check if $PATCH_DIR exists. If it does not exist, create a new directory
-      if [[ ! -e "$PATCH_DIR" ]] ; then
-	mkdir "$PATCH_DIR"
-	if [[ $? == 0 ]] ; then
-	  echo "$PATCH_DIR has been created"
-	else
-	  echo "Unable to create $PATCH_DIR"
-	  cleanupAndExit 0
-	fi
-      fi
-      GIT=$4
-      GREP=$5
-      PATCH=$6
-      FINDBUGS_HOME=$7
-      FORREST_HOME=$8
-      BASEDIR=$9
-      JAVA5_HOME=${10}
-      ### Obtain the patch filename to append it to the version number
-      local subject=`grep "Subject:" ${PATCH_FILE}`
-      local length=`expr match ${subject} ZOOKEEPER-[0-9]*`
-      local position=`expr index ${subject} ZOOKEEPER-`
-      defect=${${subject:$position:$length}#ZOOKEEPER-}
-      ;;
-    *)
-      echo "ERROR: usage $0 QABUILD [args] | DEVELOPER [args]"
-      cleanupAndExit 0
-      ;;
-  esac
-}
-
-###############################################################################
-checkout () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Testing patch for pull request ${PULLREQUEST_ID}."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  ### When run by a developer, if the workspace contains modifications, do not continue
-  # Ref http://stackoverflow.com/a/2659808 for details on checking dirty status
-  ${GIT} diff-index --quiet HEAD
-  if [[ $? -ne 0 ]] ; then
-    uncommitted=`${GIT} diff --name-only HEAD`
-    uncommitted="You have the following files with uncommitted changes:${NEWLINE}${uncommitted}"
-  fi
-  untracked="$(${GIT} ls-files --exclude-standard --others)" && test -z "${untracked}"
-  if [[ $? -ne 0 ]] ; then
-    untracked="You have untracked and unignored files:${NEWLINE}${untracked}"
-  fi
-
-  if [[ $QABUILD == "false" ]] ; then
-    if [[ $uncommitted || $untracked ]] ; then
-      echo "ERROR: can't run in a workspace that contains the following modifications"
-      echo ""
-      echo "${uncommitted}"
-      echo ""
-      echo "${untracked}"
-      cleanupAndExit 1
-    fi
-  else
-    # I don't believe we need to do anything here - the jenkins job will
-    # cleanup the environment for us ("cleanup before checkout" action)
-    # on the precommit jenkins job
-    echo
-  fi
-  return $?
-}
-
-###############################################################################
-setup () {
-  ### exit if warnings are NOT defined in the properties file
-  if [ -z "$OK_FINDBUGS_WARNINGS" ] || [[ -z "$OK_JAVADOC_WARNINGS" ]] || [[ -z $OK_RELEASEAUDIT_WARNINGS ]]; then
-    echo "Please define the following properties in test-patch.properties file"
-	 echo  "OK_FINDBUGS_WARNINGS"
-	 echo  "OK_RELEASEAUDIT_WARNINGS"
-	 echo  "OK_JAVADOC_WARNINGS"
-    cleanupAndExit 1
-  fi
-  ### get pull request diff
-  ${CURL} -L ${GIT_PR_URL}.diff > $PATCH_DIR/patch
-
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo " Pre-build trunk to verify trunk stability and javac warnings"
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant  -Djavac.args="-Xlint -Xmaxwarns 1000" -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= clean tar > $PATCH_DIR/trunkJavacWarnings.txt 2>&1"
- $ANT_HOME/bin/ant -Djavac.args="-Xlint -Xmaxwarns 1000" -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= clean tar > $PATCH_DIR/trunkJavacWarnings.txt 2>&1
-  if [[ $? != 0 ]] ; then
-    echo "Trunk compilation is broken?"
-    cleanupAndExit 1
-  fi
-}
-
-###############################################################################
-### Check for @author tags in the patch
-checkAuthor () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Checking there are no @author tags in the patch."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  authorTags=`$GREP -c -i '@author' $PATCH_DIR/patch`
-  echo "There appear to be $authorTags @author tags in the patch."
-  if [[ $authorTags != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 @author.  The patch appears to contain $authorTags @author tags which the Zookeeper community has agreed to not allow in code contributions."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 @author.  The patch does not contain any @author tags."
-  return 0
-}
-
-###############################################################################
-### Check for tests in the patch
-checkTests () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Checking there are new or changed tests in the patch."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  testReferences=`$GREP -c -i '/test' $PATCH_DIR/patch`
-  echo "There appear to be $testReferences test files referenced in the patch."
-  if [[ $testReferences == 0 ]] ; then
-    if [[ $QABUILD == "true" ]] ; then
-      patchIsDoc=`$GREP -c -i 'title="documentation' $PATCH_DIR/jira`
-      if [[ $patchIsDoc != 0 ]] ; then
-        echo "The patch appears to be a documentation patch that doesn't require tests."
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    +0 tests included.  The patch appears to be a documentation patch that doesn't require tests."
-        return 0
-      fi
-    fi
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 tests included.  The patch doesn't appear to include any new or modified tests.
-                        Please justify why no new tests are needed for this patch.
-                        Also please list what manual steps were performed to verify this patch."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 tests included.  The patch appears to include $testReferences new or modified tests."
-  return 0
-}
-
-###############################################################################
-### Check there are no javadoc warnings
-checkJavadocWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched javadoc warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant -DZookeeperPatchProcess= clean javadoc | tee $PATCH_DIR/patchJavadocWarnings.txt"
-  $ANT_HOME/bin/ant -DZookeeperPatchProcess= clean javadoc | tee $PATCH_DIR/patchJavadocWarnings.txt
-  javadocWarnings=`$GREP -o '\[javadoc\] [0-9]* warning' $PATCH_DIR/patchJavadocWarnings.txt | awk '{total += $2} END {print total}'`
-  echo ""
-  echo ""
-  echo "There appear to be $javadocWarnings javadoc warnings generated by the patched build."
-
-  ### if current warnings greater than OK_JAVADOC_WARNINGS
-  if [[ $javadocWarnings > $OK_JAVADOC_WARNINGS ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javadoc.  The javadoc tool appears to have generated `expr $(($javadocWarnings-$OK_JAVADOC_WARNINGS))` warning messages."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 javadoc.  The javadoc tool did not generate any warning messages."
-  return 0
-}
-
-###############################################################################
-### Check there are no changes in the number of Javac warnings
-checkJavacWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched javac warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant -Djavac.args="-Xlint -Xmaxwarns 1000" -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= clean tar > $PATCH_DIR/patchJavacWarnings.txt 2>&1"
-  $ANT_HOME/bin/ant -Djavac.args="-Xlint -Xmaxwarns 1000" -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= clean tar > $PATCH_DIR/patchJavacWarnings.txt 2>&1
-  if [[ $? != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javac.  The patch appears to cause tar ant target to fail."
-    return 1
-  fi
-  ### Compare trunk and patch javac warning numbers
-  if [[ -f $PATCH_DIR/patchJavacWarnings.txt ]] ; then
-    trunkJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning' $PATCH_DIR/trunkJavacWarnings.txt | awk '{total += $2} END {print total}'`
-    patchJavacWarnings=`$GREP -o '\[javac\] [0-9]* warning' $PATCH_DIR/patchJavacWarnings.txt | awk '{total += $2} END {print total}'`
-    echo "There appear to be $trunkJavacWarnings javac compiler warnings before the patch and $patchJavacWarnings javac compiler warnings after applying the patch."
-    if [[ $patchJavacWarnings != "" && $trunkJavacWarnings != "" ]] ; then
-      if [[ $patchJavacWarnings -gt $trunkJavacWarnings ]] ; then
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 javac.  The applied patch generated $patchJavacWarnings javac compiler warnings (more than the trunk's current $trunkJavacWarnings warnings)."
-        return 1
-      fi
-    fi
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 javac.  The applied patch does not increase the total number of javac compiler warnings."
-  return 0
-}
-
-###############################################################################
-### Check there are no changes in the number of release audit (RAT) warnings
-checkReleaseAuditWarnings () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched release audit warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= releaseaudit > $PATCH_DIR/patchReleaseAuditWarnings.txt 2>&1"
-  $ANT_HOME/bin/ant -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= releaseaudit > $PATCH_DIR/patchReleaseAuditWarnings.txt 2>&1
-
-  ### Compare trunk and patch release audit warning numbers
-  if [[ -f $PATCH_DIR/patchReleaseAuditWarnings.txt ]] ; then
-    patchReleaseAuditWarnings=`$GREP -c '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt`
-    echo ""
-    echo ""
-    echo "There appear to be $OK_RELEASEAUDIT_WARNINGS release audit warnings before the patch and $patchReleaseAuditWarnings release audit warnings after applying the patch."
-    if [[ $patchReleaseAuditWarnings != "" && $OK_RELEASEAUDIT_WARNINGS != "" ]] ; then
-      if [[ $patchReleaseAuditWarnings -gt $OK_RELEASEAUDIT_WARNINGS ]] ; then
-        JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 release audit.  The applied patch generated $patchReleaseAuditWarnings release audit warnings (more than the trunk's current $OK_RELEASEAUDIT_WARNINGS warnings)."
-        $GREP '\!?????' $PATCH_DIR/patchReleaseAuditWarnings.txt > $PATCH_DIR/patchReleaseAuditProblems.txt
-        echo "Lines that start with ????? in the release audit report indicate files that do not have an Apache license header." >> $PATCH_DIR/patchReleaseAuditProblems.txt
-        JIRA_COMMENT_FOOTER="Release audit warnings: $BUILD_URL/artifact/trunk/patchprocess/patchReleaseAuditProblems.txt
-$JIRA_COMMENT_FOOTER"
-        return 1
-      fi
-    fi
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 release audit.  The applied patch does not increase the total number of release audit warnings."
-  return 0
-}
-
-###############################################################################
-### Check there are no changes in the number of Checkstyle warnings
-checkStyle () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched checkstyle warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "THIS IS NOT IMPLEMENTED YET"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant -DZookeeperPatchProcess= checkstyle"
-  $ANT_HOME/bin/ant -DZookeeperPatchProcess= checkstyle
-  JIRA_COMMENT_FOOTER="Checkstyle results: $BUILD_URL/artifact/trunk/build/test/checkstyle-errors.html
-$JIRA_COMMENT_FOOTER"
-  ### TODO: calculate actual patchStyleErrors
-#  patchStyleErrors=0
-#  if [[ $patchStyleErrors != 0 ]] ; then
-#    JIRA_COMMENT="$JIRA_COMMENT
-#
-#    -1 checkstyle.  The patch generated $patchStyleErrors code style errors."
-#    return 1
-#  fi
-#  JIRA_COMMENT="$JIRA_COMMENT
-#
-#    +1 checkstyle.  The patch generated 0 code style errors."
-  return 0
-}
-
-###############################################################################
-### Check there are no changes in the number of Findbugs warnings
-checkFindbugsWarnings () {
-  findbugs_version=`${FINDBUGS_HOME}/bin/findbugs -version`
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Determining number of patched Findbugs warnings."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  echo "$ANT_HOME/bin/ant -Dfindbugs.home=$FINDBUGS_HOME -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= findbugs"
-  $ANT_HOME/bin/ant -Dfindbugs.home=$FINDBUGS_HOME -Djava5.home=${JAVA5_HOME} -Dforrest.home=${FORREST_HOME} -DZookeeperPatchProcess= findbugs
-  if [ $? != 0 ] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 findbugs.  The patch appears to cause Findbugs (version ${findbugs_version}) to fail."
-    return 1
-  fi
-JIRA_COMMENT_FOOTER="Findbugs warnings: $BUILD_URL/artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
-$JIRA_COMMENT_FOOTER"
-  cp $BASEDIR/build/test/findbugs/*.xml $PATCH_DIR/patchFindbugsWarnings.xml
-  $FINDBUGS_HOME/bin/setBugDatabaseInfo -timestamp "01/01/2000" \
-    $PATCH_DIR/patchFindbugsWarnings.xml \
-    $PATCH_DIR/patchFindbugsWarnings.xml
-  findbugsWarnings=`$FINDBUGS_HOME/bin/filterBugs -first "01/01/2000" $PATCH_DIR/patchFindbugsWarnings.xml \
-    $BASEDIR/build/test/findbugs/newPatchFindbugsWarnings.xml | /usr/bin/awk '{print $1}'`
-  $FINDBUGS_HOME/bin/convertXmlToText -html \
-    $BASEDIR/build/test/findbugs/newPatchFindbugsWarnings.xml \
-    $BASEDIR/build/test/findbugs/newPatchFindbugsWarnings.html
-  cp $BASEDIR/build/test/findbugs/newPatchFindbugsWarnings.html $PATCH_DIR/newPatchFindbugsWarnings.html
-  cp $BASEDIR/build/test/findbugs/newPatchFindbugsWarnings.xml $PATCH_DIR/newPatchFindbugsWarnings.xml
-
-  ### if current warnings greater than OK_FINDBUGS_WARNINGS
-  if [[ $findbugsWarnings > $OK_FINDBUGS_WARNINGS ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 findbugs.  The patch appears to introduce `expr $(($findbugsWarnings-$OK_FINDBUGS_WARNINGS))` new Findbugs (version ${findbugs_version}) warnings."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 findbugs.  The patch does not introduce any new Findbugs (version ${findbugs_version}) warnings."
-  return 0
-}
-
-###############################################################################
-### Run the test-core target
-runCoreTests () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Running core tests."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-
-  ### Kill any rogue build processes from the last attempt
-  $PS auxwww | $GREP ZookeeperPatchProcess | /usr/bin/nawk '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
-
-  echo "$ANT_HOME/bin/ant -DZookeeperPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes -Dtest.junit.threads=8 -Dcompile.c++=yes -Dforrest.home=$FORREST_HOME -Djava5.home=$JAVA5_HOME test-core"
-  $ANT_HOME/bin/ant -DZookeeperPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes -Dtest.junit.threads=8 -Dcompile.c++=yes -Dforrest.home=$FORREST_HOME -Djava5.home=$JAVA5_HOME test-core
-  if [[ $? != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 core tests.  The patch failed core unit tests."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 core tests.  The patch passed core unit tests."
-  return 0
-}
-
-###############################################################################
-### Run the test-contrib target
-runContribTests () {
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Running contrib tests."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-
-  ### Kill any rogue build processes from the last attempt
-  $PS auxwww | $GREP ZookeeperPatchProcess | /usr/bin/nawk '{print $2}' | /usr/bin/xargs -t -I {} /bin/kill -9 {} > /dev/null
-
-  echo "$ANT_HOME/bin/ant -DZookeeperPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes test-contrib"
-  $ANT_HOME/bin/ant -DZookeeperPatchProcess= -Dtest.junit.output.format=xml -Dtest.output=yes test-contrib
-  if [[ $? != 0 ]] ; then
-    JIRA_COMMENT="$JIRA_COMMENT
-
-    -1 contrib tests.  The patch failed contrib unit tests."
-    return 1
-  fi
-  JIRA_COMMENT="$JIRA_COMMENT
-
-    +1 contrib tests.  The patch passed contrib unit tests."
-  return 0
-}
-
-###############################################################################
-### Submit a comment to the defect's Jira
-submitJiraComment () {
-  local result=$1
-  ### Do not output the value of JIRA_COMMENT_FOOTER when run by a developer
-  if [[  $QABUILD == "false" ]] ; then
-    JIRA_COMMENT_FOOTER=""
-  fi
-  if [[ $result == 0 ]] ; then
-    comment="+1 overall.  $JIRA_COMMENT
-
-$JIRA_COMMENT_FOOTER"
-  else
-    comment="-1 overall.  $JIRA_COMMENT
-
-$JIRA_COMMENT_FOOTER"
-  fi
-  ### Output the test result to the console
-  echo "
-
-
-
-$comment"
-
-  if [[ $QABUILD == "true" ]] ; then
-    echo ""
-    echo ""
-    echo "======================================================================"
-    echo "======================================================================"
-    echo "    Adding comment to Jira."
-    echo "======================================================================"
-    echo "======================================================================"
-    echo ""
-    echo ""
-    ### Update Jira with a comment
-    export USER=jenkins
-    $JIRACLI -s https://issues.apache.org/jira -a addcomment -u hadoopqa -p $JIRA_PASSWD --comment "$comment" --issue $defect
-    $JIRACLI -s https://issues.apache.org/jira -a logout -u hadoopqa -p $JIRA_PASSWD
-  fi
-}
-
-###############################################################################
-### Cleanup files
-cleanupAndExit () {
-  local result=$1
-  if [[ $QABUILD == "true" ]] ; then
-    if [ -e "$PATCH_DIR" ] ; then
-      mv $PATCH_DIR $BASEDIR
-    fi
-  fi
-  echo ""
-  echo ""
-  echo "======================================================================"
-  echo "======================================================================"
-  echo "    Finished build."
-  echo "======================================================================"
-  echo "======================================================================"
-  echo ""
-  echo ""
-  exit $result
-}
-
-###############################################################################
-###############################################################################
-###############################################################################
-
-JIRA_COMMENT=""
-JIRA_COMMENT_FOOTER="Console output: $BUILD_URL/console
-
-This message is automatically generated."
-
-### Check if arguments to the script have been specified properly or not
-echo "----- Going to parser args -----"
-parseArgs $@
-cd $BASEDIR
-
-echo "----- Parsed args, going to checkout -----"
-checkout
-RESULT=$?
-if [[ $QABUILD == "true" ]] ; then
-  if [[ $RESULT != 0 ]] ; then
-    exit 100
-  fi
-fi
-setup
-checkAuthor
-(( RESULT = RESULT + $? ))
-
-checkTests
-checkTestsResult=$?
-(( RESULT = RESULT + $checkTestsResult ))
-if [[ $checkTestsResult != 0 ]] ; then
-  submitJiraComment 1
-  cleanupAndExit 1
-fi
-checkJavadocWarnings
-(( RESULT = RESULT + $? ))
-checkJavacWarnings
-(( RESULT = RESULT + $? ))
-### Checkstyle not implemented yet
-#checkStyle
-#(( RESULT = RESULT + $? ))
-checkFindbugsWarnings
-(( RESULT = RESULT + $? ))
-checkReleaseAuditWarnings
-(( RESULT = RESULT + $? ))
-### Do not call these when run by a developer
-if [[ $QABUILD == "true" ]] ; then
-  runCoreTests
-  (( RESULT = RESULT + $? ))
-  runContribTests
-  (( RESULT = RESULT + $? ))
-fi
-JIRA_COMMENT_FOOTER="Test results: $BUILD_URL/testReport/
-$JIRA_COMMENT_FOOTER"
-
-submitJiraComment $RESULT
-cleanupAndExit $RESULT


Mime
View raw message