Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java
 Tue Jun 24 11:20:47 2008
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.quorum;
+package org.apache.zookeeper.server.quorum;
 
 
-import static com.yahoo.zookeeper.server.ServerConfig.getClientPort;
-import static com.yahoo.zookeeper.server.ServerConfig.getDataDir;
-import static com.yahoo.zookeeper.server.ServerConfig.getDataLogDir;
-import static 
com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getElectionAlg;
-import static 
com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getElectionPort;
-import static com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getInitLimit;
-import static com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getServerId;
-import static com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getServers;
-import static com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getSyncLimit;
-import static com.yahoo.zookeeper.server.quorum.QuorumPeerConfig.getTickTime;
+import static org.apache.zookeeper.server.ServerConfig.getClientPort;
+import static org.apache.zookeeper.server.ServerConfig.getDataDir;
+import static org.apache.zookeeper.server.ServerConfig.getDataLogDir;
+import static 
org.apache.zookeeper.server.quorum.QuorumPeerConfig.getElectionAlg;
+import static 
org.apache.zookeeper.server.quorum.QuorumPeerConfig.getElectionPort;
+import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getInitLimit;
+import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getServerId;
+import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getServers;
+import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getSyncLimit;
+import static org.apache.zookeeper.server.quorum.QuorumPeerConfig.getTickTime;
 
 import java.io.ByteArrayInputStream;
 import java.io.File;
@@ -42,11 +42,11 @@
 
 import org.apache.log4j.Logger;
 
-import com.yahoo.jute.BinaryInputArchive;
-import com.yahoo.jute.InputArchive;
-import com.yahoo.zookeeper.server.NIOServerCnxn;
-import com.yahoo.zookeeper.server.ZooKeeperServer;
-import com.yahoo.zookeeper.txn.TxnHeader;
+import org.apache.jute.BinaryInputArchive;
+import org.apache.jute.InputArchive;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.txn.TxnHeader;
 
 /**
  * This class manages the quorum protocol. There are three states this server

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumPeerConfig.java
 Tue Jun 24 11:20:47 2008
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.quorum;
+package org.apache.zookeeper.server.quorum;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -27,8 +27,8 @@
 
 import org.apache.log4j.Logger;
 
-import com.yahoo.zookeeper.server.ServerConfig;
-import com.yahoo.zookeeper.server.quorum.QuorumPeer.QuorumServer;
+import org.apache.zookeeper.server.ServerConfig;
+import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 
 public class QuorumPeerConfig extends ServerConfig {
     private static final Logger LOG = Logger.getLogger(QuorumPeerConfig.class);

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/QuorumStats.java
 Tue Jun 24 11:20:47 2008
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.quorum;
+package org.apache.zookeeper.server.quorum;
 
-import com.yahoo.zookeeper.server.ServerStats;
+import org.apache.zookeeper.server.ServerStats;
 
 public class QuorumStats extends ServerStats {
     

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/SendAckRequestProcessor.java
 Tue Jun 24 11:20:47 2008
@@ -14,15 +14,15 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.quorum;
+package org.apache.zookeeper.server.quorum;
 
 import java.io.IOException;
 
 import org.apache.log4j.Logger;
 
-import com.yahoo.zookeeper.ZooDefs.OpCode;
-import com.yahoo.zookeeper.server.Request;
-import com.yahoo.zookeeper.server.RequestProcessor;
+import org.apache.zookeeper.ZooDefs.OpCode;
+import org.apache.zookeeper.server.Request;
+import org.apache.zookeeper.server.RequestProcessor;
 
 public class SendAckRequestProcessor implements RequestProcessor {
     private static final Logger LOG = 
Logger.getLogger(SendAckRequestProcessor.class);

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Vote.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Vote.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Vote.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Vote.java
 Tue Jun 24 11:20:47 2008
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.quorum;
+package org.apache.zookeeper.server.quorum;
 
 
 public class Vote {

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/util/Profiler.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/util/Profiler.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/util/Profiler.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/util/Profiler.java
 Tue Jun 24 11:20:47 2008
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.server.util;
+package org.apache.zookeeper.server.util;
 
 import org.apache.log4j.Logger;
 

Modified: 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/main/org/apache/zookeeper/version/util/VerGen.java
 Tue Jun 24 11:20:47 2008
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.yahoo.zookeeper.version.util;
+package org.apache.zookeeper.version.util;
 
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
 
 public class VerGen {
-    private static final String PACKAGE_NAME = "com.yahoo.zookeeper.version";
+    private static final String PACKAGE_NAME = "org.apache.zookeeper.version";
     private static final String TYPE_NAME = "Info";
 
     static void printUsage() {
-        System.out.print("Usage:\tjava  -cp <classpath> com.yahoo.zookeeper."
+        System.out.print("Usage:\tjava  -cp <classpath> org.apache.zookeeper."
                 + "version.util.VerGen maj.min.micro rev buildDate");
         System.exit(1);
     }
@@ -49,7 +49,7 @@
         File file = new File(pkgdir, TYPE_NAME + ".java");
         try {
             FileWriter w = new FileWriter(file);
-            w.write("// Do not edit!\n// File generated by com.yahoo.zookeeper"
+            w.write("// Do not edit!\n// File generated by 
org.apache.zookeeper"
                     + ".version.util.VerGen.\n");
             w.write("package " + PACKAGE_NAME + ";\n\n");
             w.write("public interface " + TYPE_NAME + " {\n");
@@ -69,12 +69,12 @@
     }
 
     /**
-     * Emits a com.yahoo.zookeeper.version.Info interface file with version and
+     * Emits a org.apache.zookeeper.version.Info interface file with version 
and
      * revision information constants set to the values passed in as command
      * line parameters. The file is created in the current directory. <br>
-     * Usage: java com.yahoo.zookeeper.version.util.VerGen maj.min.micro rev
+     * Usage: java org.apache.zookeeper.version.util.VerGen maj.min.micro rev
      * buildDate
-     * 
+     *
      * @param args
      *            <ul>
      *            <li>maj - major version number
@@ -91,7 +91,7 @@
             String[] v = args[0].split("\\.");
             if (v.length != 3) {
                 System.err
-                        .println("Ivalid version number format, must be 
\"x.y.z\"");
+                        .println("Invalid version number format, must be 
\"x.y.z\"");
                 System.exit(1);
             }
             int maj = Integer.parseInt(v[0]);
@@ -101,8 +101,8 @@
             generateFile(maj, min, micro, rev, args[2]);
         } catch (NumberFormatException e) {
             System.err
-                    .println("All version-related parameters must be invalid 
integers!");
-            System.exit(1);
+                .println("All version-related parameters must be valid 
integers!");
+            throw e;
         }
     }
 

Modified: hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml 
(original)
+++ hadoop/zookeeper/trunk/src/java/test/config/findbugsExcludeFile.xml Tue Jun 
24 11:20:47 2008
@@ -1,5 +1,5 @@
 <FindBugsFilter>
      <Match>
-       <Package name="com.yahoo.jute.compiler.generated" />
+       <Package name="org.apache.jute.compiler.generated" />
      </Match>
 </FindBugsFilter>

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/DeserializationPerfTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/DeserializationPerfTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/DeserializationPerfTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/DeserializationPerfTest.java
 Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.server;
+package org.apache.zookeeper.server;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -6,9 +6,9 @@
 
 import junit.framework.TestCase;
 
-import com.yahoo.jute.BinaryInputArchive;
-import com.yahoo.jute.BinaryOutputArchive;
-import com.yahoo.zookeeper.KeeperException;
+import org.apache.jute.BinaryInputArchive;
+import org.apache.jute.BinaryOutputArchive;
+import org.apache.zookeeper.KeeperException;
 
 public class DeserializationPerfTest extends TestCase {
     private static void deserializeTree(int depth, int width, int len)

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/SerializationPerfTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/SerializationPerfTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/SerializationPerfTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/SerializationPerfTest.java
 Tue Jun 24 11:20:47 2008
@@ -1,12 +1,12 @@
-package com.yahoo.zookeeper.server;
+package org.apache.zookeeper.server;
 
 import java.io.IOException;
 import java.io.OutputStream;
 
 import junit.framework.TestCase;
 
-import com.yahoo.jute.BinaryOutputArchive;
-import com.yahoo.zookeeper.KeeperException;
+import org.apache.jute.BinaryOutputArchive;
+import org.apache.zookeeper.KeeperException;
 
 public class SerializationPerfTest extends TestCase {
     private static class NullOutputStream extends OutputStream {

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/ZooKeeperServerTest.java
 Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.server;
+package org.apache.zookeeper.server;
 
 import java.io.File;
 import java.util.List;

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/AsyncTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/AsyncTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/AsyncTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/AsyncTest.java 
Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 import java.io.IOException;
@@ -14,18 +14,18 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.AsyncCallback.DataCallback;
-import com.yahoo.zookeeper.AsyncCallback.StringCallback;
-import com.yahoo.zookeeper.AsyncCallback.VoidCallback;
-import com.yahoo.zookeeper.KeeperException.Code;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
-import com.yahoo.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.AsyncCallback.DataCallback;
+import org.apache.zookeeper.AsyncCallback.StringCallback;
+import org.apache.zookeeper.AsyncCallback.VoidCallback;
+import org.apache.zookeeper.KeeperException.Code;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.server.NIOServerCnxn;
 
 public class AsyncTest extends TestCase implements Watcher, StringCallback, 
VoidCallback, DataCallback {
     private static final Logger LOG = Logger.getLogger(AsyncTest.class);

Added: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java?rev=671284&view=auto
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java 
(added)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java 
Tue Jun 24 11:20:47 2008
@@ -0,0 +1,70 @@
+package org.apache.zookeeper.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.Logger;
+
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ServerStats;
+import org.apache.zookeeper.server.ZooKeeperServer;
+
+public abstract class ClientBase extends TestCase {
+    protected static final Logger LOG = Logger.getLogger(ClientBase.class);
+    protected static String hostPort = "127.0.0.1:33221";
+    protected static final int CONNECTION_TIMEOUT = 30000;
+    protected NIOServerCnxn.Factory f = null;
+    protected File tmpDir = null;
+    protected static File baseTest = 
+        new File(System.getProperty("build.test.dir", "build"));
+
+    public ClientBase() {
+        super();
+    }
+
+    public ClientBase(String name) {
+        super(name);
+    }
+
+    protected void setUp() throws Exception {
+        LOG.info("Client test setup");
+        tmpDir = File.createTempFile("test", ".junit", baseTest);
+        tmpDir = new File(tmpDir + ".dir");
+        tmpDir.mkdirs();
+        ServerStats.registerAsConcrete();
+        ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);
+        f = new NIOServerCnxn.Factory(33221);
+        f.startup(zks);
+        //Thread.sleep(5000);
+        LOG.info("Client test setup finished");
+    }
+
+    protected void tearDown() throws Exception {
+        LOG.info("Clent test shutdown");
+        if (f != null) {
+            f.shutdown();
+        }
+        if (tmpDir != null) {
+            recursiveDelete(tmpDir);
+        }
+        ServerStats.unregister();
+        LOG.info("Client test shutdown finished");
+    }
+    
+    private static void recursiveDelete(File d) {
+        if (d.isDirectory()) {
+            File children[] = d.listFiles();
+            for (File f : children) {
+                recursiveDelete(f);
+            }
+        }
+        d.delete();
+    }
+
+}
\ No newline at end of file

Propchange: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientBase.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java 
Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 import java.io.IOException;
@@ -12,13 +12,13 @@
 
 import org.junit.Test;
 
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
     
 public class ClientTest extends ClientBase implements Watcher {
     LinkedBlockingQueue<WatcherEvent> events = 

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/DataTreeTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/DataTreeTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/DataTreeTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/DataTreeTest.java
 Tue Jun 24 11:20:47 2008
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import static org.junit.Assert.*;
 
@@ -21,10 +21,10 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
-import com.yahoo.zookeeper.server.DataTree;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.server.DataTree;
 import junit.framework.TestCase;
 
 public class DataTreeTest extends TestCase {

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/GenerateLoad.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/GenerateLoad.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/GenerateLoad.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/GenerateLoad.java
 Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.BufferedReader;
 import java.io.FileNotFoundException;
@@ -19,15 +19,15 @@
 import java.util.Random;
 import java.util.Set;
 
-import com.yahoo.zookeeper.AsyncCallback.DataCallback;
-import com.yahoo.zookeeper.AsyncCallback.StatCallback;
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.AsyncCallback.DataCallback;
+import org.apache.zookeeper.AsyncCallback.StatCallback;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
 
 public class GenerateLoad {
     static ServerSocket ss;

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/IntegrityCheck.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/IntegrityCheck.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/IntegrityCheck.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/IntegrityCheck.java
 Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 /**
  * This is a simple test to check the integrity of ZooKeeper servers. The 
client
@@ -19,14 +19,14 @@
 
 import org.apache.log4j.Logger;
 
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooDefs;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.AsyncCallback.DataCallback;
-import com.yahoo.zookeeper.AsyncCallback.StatCallback;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.AsyncCallback.DataCallback;
+import org.apache.zookeeper.AsyncCallback.StatCallback;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
 
 public class IntegrityCheck implements Watcher, StatCallback, DataCallback {
     private static final Logger LOG = Logger.getLogger(IntegrityCheck.class);

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java 
(original)
+++ hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/OOMTest.java 
Tue Jun 24 11:20:47 2008
@@ -1,7 +1,7 @@
 /**
  * 
  */
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 import java.io.IOException;
@@ -9,14 +9,14 @@
 
 import junit.framework.TestCase;
 
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
-import com.yahoo.zookeeper.server.NIOServerCnxn;
-import com.yahoo.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ZooKeeperServer;
 
 /**
  * @author breed
@@ -115,7 +115,7 @@
     /*
      * (non-Javadoc)
      * 
-     * @see 
com.yahoo.zookeeper.Watcher#process(com.yahoo.zookeeper.proto.WatcherEvent)
+     * @see 
org.apache.zookeeper.Watcher#process(org.apache.zookeeper.proto.WatcherEvent)
      */
     public void process(WatcherEvent event) {
         System.err.println("Got event " + event.getType() + " "

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/QuorumTest.java 
Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 import java.io.IOException;
@@ -9,9 +9,9 @@
 import org.junit.After;
 import org.junit.Before;
 
-import com.yahoo.zookeeper.server.quorum.QuorumPeer;
-import com.yahoo.zookeeper.server.quorum.QuorumStats;
-import com.yahoo.zookeeper.server.quorum.QuorumPeer.QuorumServer;
+import org.apache.zookeeper.server.quorum.QuorumPeer;
+import org.apache.zookeeper.server.quorum.QuorumStats;
+import org.apache.zookeeper.server.quorum.QuorumPeer.QuorumServer;
 
 public class QuorumTest extends ClientTest {
     private static final Logger LOG = Logger.getLogger(QuorumTest.class);

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/RecoveryTest.java
 Tue Jun 24 11:20:47 2008
@@ -1,7 +1,7 @@
 /**
  * 
  */
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 
@@ -9,15 +9,15 @@
 
 import org.junit.Test;
 
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
-import com.yahoo.zookeeper.server.ServerStats;
-import com.yahoo.zookeeper.server.SyncRequestProcessor;
-import com.yahoo.zookeeper.server.NIOServerCnxn;
-import com.yahoo.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.server.ServerStats;
+import org.apache.zookeeper.server.SyncRequestProcessor;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ZooKeeperServer;
 
 /**
  * @author breed
@@ -120,7 +120,7 @@
     /*
      * (non-Javadoc)
      * 
-     * @see 
com.yahoo.zookeeper.Watcher#process(com.yahoo.zookeeper.proto.WatcherEvent)
+     * @see 
org.apache.zookeeper.Watcher#process(org.apache.zookeeper.proto.WatcherEvent)
      */
     public void process(WatcherEvent event) {
         // TODO Auto-generated method stub

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SessionTest.java 
Tue Jun 24 11:20:47 2008
@@ -1,18 +1,18 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.File;
 import java.io.IOException;
 import org.junit.Test;
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
-import com.yahoo.zookeeper.server.NIOServerCnxn;
-import com.yahoo.zookeeper.server.ServerStats;
-import com.yahoo.zookeeper.server.ZooKeeperServer;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.server.NIOServerCnxn;
+import org.apache.zookeeper.server.ServerStats;
+import org.apache.zookeeper.server.ZooKeeperServer;
 import junit.framework.TestCase;
 
 public class SessionTest extends TestCase implements Watcher {

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/SledgeHammer.java
 Tue Jun 24 11:20:47 2008
@@ -1,17 +1,17 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
 
 public class SledgeHammer extends Thread implements Watcher {
     ZooKeeper zk;

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/TestHammer.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/TestHammer.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/TestHammer.java 
(original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/TestHammer.java 
Tue Jun 24 11:20:47 2008
@@ -1,11 +1,11 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.IOException;
 
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.AsyncCallback.VoidCallback;
-import com.yahoo.zookeeper.ZooDefs.CreateFlags;
-import com.yahoo.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.AsyncCallback.VoidCallback;
+import org.apache.zookeeper.ZooDefs.CreateFlags;
+import org.apache.zookeeper.ZooDefs.Ids;
 
 public class TestHammer implements VoidCallback {
 

Added: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java?rev=671284&view=auto
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
 (added)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
 Tue Jun 24 11:20:47 2008
@@ -0,0 +1,436 @@
+package org.apache.zookeeper.test;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.proto.WatcherEvent;
+
+public class WatcherFuncTest extends ClientBase {
+    private static class SimpleWatcher implements Watcher {
+        private LinkedBlockingQueue<WatcherEvent> events = 
+            new LinkedBlockingQueue<WatcherEvent>();
+        private CountDownLatch latch;
+        
+        public SimpleWatcher(CountDownLatch latch) {
+            this.latch = latch;
+        }
+
+        public void process(WatcherEvent event) {
+            if (event.getState() == Event.KeeperStateSyncConnected) {
+                if (latch != null) {
+                    latch.countDown();
+                }
+            }
+
+            if (event.getType() == Watcher.Event.EventNone) {
+                return;
+            }
+            try {
+                events.put(event);
+            } catch (InterruptedException e) {
+                assertTrue("interruption unexpected", false);
+            }
+        }
+        public void verify(List<Integer> expected) throws InterruptedException{
+            WatcherEvent event;
+            int count = 0;
+            while (count < expected.size()
+                    && (event = events.poll(30, TimeUnit.SECONDS)) != null) 
+            {
+                assertEquals(expected.get(count).intValue(), event.getType());
+                count++;
+            }
+            assertEquals(expected.size(), count);
+            events.clear();
+        }
+    }
+    private SimpleWatcher client_dwatch;
+    private volatile CountDownLatch client_latch;
+    private ZooKeeper client;
+    private SimpleWatcher lsnr_dwatch;
+    private volatile CountDownLatch lsnr_latch;
+    private ZooKeeper lsnr;
+    
+    private List<Integer> expected;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        
+        client_latch = new CountDownLatch(1);
+        client_dwatch = new SimpleWatcher(client_latch);    
+        client = createClient(client_dwatch, client_latch);
+
+        lsnr_latch = new CountDownLatch(1);
+        lsnr_dwatch = new SimpleWatcher(lsnr_latch);
+        lsnr = createClient(lsnr_dwatch, lsnr_latch);
+        
+        expected = new ArrayList<Integer>();
+    }
+    protected void tearDown() throws Exception {
+        client.close();
+        lsnr.close();
+        Thread.sleep(5000);
+        super.tearDown();
+    }
+    
+    protected ZooKeeper createClient(Watcher watcher, CountDownLatch latch) 
+        throws IOException, InterruptedException
+    {
+        ZooKeeper zk = new ZooKeeper(hostPort, 20000, watcher);
+        if(!latch.await(CONNECTION_TIMEOUT, TimeUnit.MILLISECONDS)){
+            fail("Unable to connect to server");
+        }
+        return zk;
+    }
+
+    private void verify() throws InterruptedException {
+        lsnr_dwatch.verify(expected);
+        expected.clear();
+    }
+    public void testExistsSync() 
+        throws IOException, InterruptedException, KeeperException
+    {
+        assertNull(lsnr.exists("/foo", true));
+        assertNull(lsnr.exists("/foo/bar", true));
+
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        expected.add(Watcher.Event.EventNodeCreated);
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        expected.add(Watcher.Event.EventNodeCreated);
+
+        verify();
+        
+        assertNotNull(lsnr.exists("/foo", true));
+        assertNotNull(lsnr.exists("/foo/bar", true));
+
+        try {
+            assertNull(lsnr.exists("/car", true));
+            client.setData("/car", "missing".getBytes(), -1);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        
+        try {
+            assertNull(lsnr.exists("/foo/car", true));
+            client.setData("/foo/car", "missing".getBytes(), -1);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        
+        client.setData("/foo", "parent".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+
+        verify();
+
+        assertNotNull(lsnr.exists("/foo", true));
+        assertNotNull(lsnr.exists("/foo/bar", true));
+
+        client.delete("/foo/bar", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+        client.delete("/foo", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+
+        verify();
+    }
+    
+    public void testGetDataSync()
+        throws IOException, InterruptedException, KeeperException
+    {
+        try {
+            lsnr.getData("/foo", true, null);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        try {
+            lsnr.getData("/foo/bar", true, null);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getData("/foo", true, null));
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getData("/foo/bar", true, null));
+
+        client.setData("/foo", "parent".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+
+        verify();
+
+        assertNotNull(lsnr.getData("/foo", true, null));
+        assertNotNull(lsnr.getData("/foo/bar", true, null));
+
+        client.delete("/foo/bar", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+        client.delete("/foo", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+
+        verify();
+    }
+    
+    public void testGetChildrenSync()
+        throws IOException, InterruptedException, KeeperException
+    {
+        try {
+            lsnr.getChildren("/foo", true);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        try {
+            lsnr.getChildren("/foo/bar", true);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getChildren("/foo", true));
+
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        expected.add(Watcher.Event.EventNodeChildrenChanged); // /foo
+        assertNotNull(lsnr.getChildren("/foo/bar", true));
+
+
+        client.setData("/foo", "parent".getBytes(), -1);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+
+        
+        assertNotNull(lsnr.exists("/foo", true));
+
+        assertNotNull(lsnr.getChildren("/foo", true));
+        assertNotNull(lsnr.getChildren("/foo/bar", true));
+
+        client.delete("/foo/bar", -1);
+        expected.add(Watcher.Event.EventNodeDeleted); // /foo/bar childwatch
+        expected.add(Watcher.Event.EventNodeChildrenChanged); // /foo
+        client.delete("/foo", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+
+        verify();
+    }
+
+    public void testExistsSyncWObj() 
+        throws IOException, InterruptedException, KeeperException
+    {
+        SimpleWatcher w1 = new SimpleWatcher(null);
+        SimpleWatcher w2 = new SimpleWatcher(null);
+        SimpleWatcher w3 = new SimpleWatcher(null);
+        SimpleWatcher w4 = new SimpleWatcher(null);
+        
+        List<Integer> e2 = new ArrayList<Integer>();
+        
+        assertNull(lsnr.exists("/foo", true));
+        assertNull(lsnr.exists("/foo", w1));
+
+        assertNull(lsnr.exists("/foo/bar", w2));
+        assertNull(lsnr.exists("/foo/bar", w3));
+        assertNull(lsnr.exists("/foo/bar", w3));
+        assertNull(lsnr.exists("/foo/bar", w4));
+    
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        expected.add(Watcher.Event.EventNodeCreated);
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        e2.add(Watcher.Event.EventNodeCreated);
+    
+        lsnr_dwatch.verify(expected);
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+        
+        // default not registered
+        assertNotNull(lsnr.exists("/foo", w1));
+
+        assertNotNull(lsnr.exists("/foo/bar", w2));
+        assertNotNull(lsnr.exists("/foo/bar", w3));
+        assertNotNull(lsnr.exists("/foo/bar", w4));
+        assertNotNull(lsnr.exists("/foo/bar", w4));
+    
+        client.setData("/foo", "parent".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+        e2.add(Watcher.Event.EventNodeDataChanged);
+    
+        lsnr_dwatch.verify(new ArrayList<Integer>()); // not reg so should = 0
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+    
+        assertNotNull(lsnr.exists("/foo", true));
+        assertNotNull(lsnr.exists("/foo", w1));
+        assertNotNull(lsnr.exists("/foo", w1));
+
+        assertNotNull(lsnr.exists("/foo/bar", w2));
+        assertNotNull(lsnr.exists("/foo/bar", w2));
+        assertNotNull(lsnr.exists("/foo/bar", w3));
+        assertNotNull(lsnr.exists("/foo/bar", w4));
+    
+        client.delete("/foo/bar", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+        client.delete("/foo", -1);
+        e2.add(Watcher.Event.EventNodeDeleted);
+    
+        lsnr_dwatch.verify(expected);
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+
+    }
+
+    public void testGetDataSyncWObj()
+        throws IOException, InterruptedException, KeeperException
+    {
+        SimpleWatcher w1 = new SimpleWatcher(null);
+        SimpleWatcher w2 = new SimpleWatcher(null);
+        SimpleWatcher w3 = new SimpleWatcher(null);
+        SimpleWatcher w4 = new SimpleWatcher(null);
+        
+        List<Integer> e2 = new ArrayList<Integer>();
+
+        try {
+            lsnr.getData("/foo", w1, null);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        try {
+            lsnr.getData("/foo/bar", w2, null);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+    
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getData("/foo", true, null));
+        assertNotNull(lsnr.getData("/foo", w1, null));
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getData("/foo/bar", w2, null));
+        assertNotNull(lsnr.getData("/foo/bar", w3, null));
+        assertNotNull(lsnr.getData("/foo/bar", w4, null));
+        assertNotNull(lsnr.getData("/foo/bar", w4, null));
+    
+        client.setData("/foo", "parent".getBytes(), -1);
+        expected.add(Watcher.Event.EventNodeDataChanged);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+        e2.add(Watcher.Event.EventNodeDataChanged);
+    
+        lsnr_dwatch.verify(expected);
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+    
+        assertNotNull(lsnr.getData("/foo", true, null));
+        assertNotNull(lsnr.getData("/foo", w1, null));
+        assertNotNull(lsnr.getData("/foo/bar", w2, null));
+        assertNotNull(lsnr.getData("/foo/bar", w3, null));
+        assertNotNull(lsnr.getData("/foo/bar", w3, null));
+        assertNotNull(lsnr.getData("/foo/bar", w4, null));
+    
+        client.delete("/foo/bar", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+        client.delete("/foo", -1);
+        e2.add(Watcher.Event.EventNodeDeleted);
+    
+        lsnr_dwatch.verify(expected);
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+    }
+    
+    public void testGetChildrenSyncWObj()
+        throws IOException, InterruptedException, KeeperException
+    {
+        SimpleWatcher w1 = new SimpleWatcher(null);
+        SimpleWatcher w2 = new SimpleWatcher(null);
+        SimpleWatcher w3 = new SimpleWatcher(null);
+        SimpleWatcher w4 = new SimpleWatcher(null);
+        
+        List<Integer> e2 = new ArrayList<Integer>();
+
+        try {
+            lsnr.getChildren("/foo", true);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+        try {
+            lsnr.getChildren("/foo/bar", true);
+            assertTrue(false);
+        } catch (KeeperException e) {
+            assertEquals(KeeperException.Code.NoNode, e.getCode());
+        }
+    
+        client.create("/foo", "parent".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        assertNotNull(lsnr.getChildren("/foo", true));
+        assertNotNull(lsnr.getChildren("/foo", w1));
+    
+        client.create("/foo/bar", "child".getBytes(), Ids.OPEN_ACL_UNSAFE, 0);
+        expected.add(Watcher.Event.EventNodeChildrenChanged); // /foo
+        assertNotNull(lsnr.getChildren("/foo/bar", w2));
+        assertNotNull(lsnr.getChildren("/foo/bar", w2));
+        assertNotNull(lsnr.getChildren("/foo/bar", w3));
+        assertNotNull(lsnr.getChildren("/foo/bar", w4));
+    
+    
+        client.setData("/foo", "parent".getBytes(), -1);
+        client.setData("/foo/bar", "child".getBytes(), -1);
+    
+        
+        assertNotNull(lsnr.exists("/foo", true));
+        assertNotNull(lsnr.exists("/foo", w1));
+        assertNotNull(lsnr.exists("/foo", true));
+        assertNotNull(lsnr.exists("/foo", w1));
+    
+        assertNotNull(lsnr.getChildren("/foo", true));
+        assertNotNull(lsnr.getChildren("/foo", w1));
+        assertNotNull(lsnr.getChildren("/foo/bar", w2));
+        assertNotNull(lsnr.getChildren("/foo/bar", w3));
+        assertNotNull(lsnr.getChildren("/foo/bar", w4));
+        assertNotNull(lsnr.getChildren("/foo/bar", w4));
+    
+        client.delete("/foo/bar", -1);
+        e2.add(Watcher.Event.EventNodeDeleted); // /foo/bar childwatch
+        expected.add(Watcher.Event.EventNodeChildrenChanged); // /foo
+        client.delete("/foo", -1);
+        expected.add(Watcher.Event.EventNodeDeleted);
+    
+        lsnr_dwatch.verify(expected);
+        w1.verify(expected);
+        w2.verify(e2);
+        w3.verify(e2);
+        w4.verify(e2);
+        expected.clear();
+        e2.clear();
+    }
+}

Propchange: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/WatcherFuncTest.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java
 (original)
+++ 
hadoop/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ZooKeeperTestClient.java
 Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-package com.yahoo.zookeeper.test;
+package org.apache.zookeeper.test;
 
 import java.io.IOException;
 import java.util.List;
@@ -9,14 +9,14 @@
 
 import org.junit.Test;
 
-import com.yahoo.zookeeper.KeeperException;
-import com.yahoo.zookeeper.Watcher;
-import com.yahoo.zookeeper.ZooDefs;
-import com.yahoo.zookeeper.ZooKeeper;
-import com.yahoo.zookeeper.KeeperException.Code;
-import com.yahoo.zookeeper.ZooDefs.Ids;
-import com.yahoo.zookeeper.data.Stat;
-import com.yahoo.zookeeper.proto.WatcherEvent;
+import org.apache.zookeeper.KeeperException;
+import org.apache.zookeeper.Watcher;
+import org.apache.zookeeper.ZooDefs;
+import org.apache.zookeeper.ZooKeeper;
+import org.apache.zookeeper.KeeperException.Code;
+import org.apache.zookeeper.ZooDefs.Ids;
+import org.apache.zookeeper.data.Stat;
+import org.apache.zookeeper.proto.WatcherEvent;
 
 public class ZooKeeperTestClient extends TestCase implements Watcher {
   protected String hostPort = "127.0.0.1:22801";

Modified: hadoop/zookeeper/trunk/src/zookeeper.jute
URL: 
http://svn.apache.org/viewvc/hadoop/zookeeper/trunk/src/zookeeper.jute?rev=671284&r1=671283&r2=671284&view=diff
==============================================================================
--- hadoop/zookeeper/trunk/src/zookeeper.jute (original)
+++ hadoop/zookeeper/trunk/src/zookeeper.jute Tue Jun 24 11:20:47 2008
@@ -1,4 +1,4 @@
-module com.yahoo.zookeeper.data {
+module org.apache.zookeeper.data {
     class Id {
        ustring scheme;
        ustring id;
@@ -18,7 +18,7 @@
        long ephemeralOwner;
     }
 }
-module com.yahoo.zookeeper.proto {
+module org.apache.zookeeper.proto {
     class op_result_t {
         int rc;
         int op;
@@ -62,12 +62,12 @@
         int version;
     }
     class SetDataResponse {
-        com.yahoo.zookeeper.data.Stat stat;
+        org.apache.zookeeper.data.Stat stat;
     }
     class CreateRequest {
         ustring path;
         buffer data;
-        vector<com.yahoo.zookeeper.data.ACL> acl;
+        vector<org.apache.zookeeper.data.ACL> acl;
         int flags;
     }
     class DeleteRequest {
@@ -99,11 +99,11 @@
     }
     class SetACLRequest {
         ustring path;
-        vector<com.yahoo.zookeeper.data.ACL> acl;
+        vector<org.apache.zookeeper.data.ACL> acl;
         int version;
     }
     class SetACLResponse {
-        com.yahoo.zookeeper.data.Stat stat;
+        org.apache.zookeeper.data.Stat stat;
     }
     class WatcherEvent {
         int type;  // event type
@@ -119,31 +119,31 @@
         boolean watch;
     }
     class ExistsResponse {
-       com.yahoo.zookeeper.data.Stat stat;
+       org.apache.zookeeper.data.Stat stat;
     }
     class GetDataResponse {
         buffer data;
-        com.yahoo.zookeeper.data.Stat stat;
+        org.apache.zookeeper.data.Stat stat;
     }
     class GetChildrenResponse {
         vector<ustring>children;
     }
     class GetACLResponse {
-        vector<com.yahoo.zookeeper.data.ACL> acl;
-        com.yahoo.zookeeper.data.Stat stat;
+        vector<org.apache.zookeeper.data.ACL> acl;
+        org.apache.zookeeper.data.Stat stat;
     }
 }
 
-module com.yahoo.zookeeper.server.quorum {
+module org.apache.zookeeper.server.quorum {
     class QuorumPacket {
         int type; // Request, Ack, Commit, Ping
         long zxid;
        buffer data; // Only significant when type is request
-       vector<com.yahoo.zookeeper.data.Id> authinfo;
+       vector<org.apache.zookeeper.data.Id> authinfo;
     }
 }
 
-module com.yahoo.zookeeper.txn {
+module org.apache.zookeeper.txn {
     class TxnHeader {
         long clientId;
        int cxid;
@@ -154,7 +154,7 @@
     class CreateTxn {
         ustring path;
         buffer data;
-        vector<com.yahoo.zookeeper.data.ACL> acl;
+        vector<org.apache.zookeeper.data.ACL> acl;
        boolean ephemeral;
     }
     class DeleteTxn {
@@ -167,7 +167,7 @@
     }
     class SetACLTxn {
         ustring path;
-        vector<com.yahoo.zookeeper.data.ACL> acl;
+        vector<org.apache.zookeeper.data.ACL> acl;
         int version;
     }
     class SetMaxChildrenTxn {


Reply via email to