zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Blatt <jbl...@verticloud.com>
Subject Embedded ZK instance for unit testing
Date Mon, 03 Dec 2012 19:39:10 GMT
Hi guys,

I've seen a few threads on why it's a bad idea to try to embed ZK in your app.   I'm not trying
to do that for my production app.   I am trying to do that for unit tests.   I could try to
mock out ZK but I'm concerned that'd be both a lot of typing and wouldn't, well, test against
the real thing.

Has anyone done this before?

When I tried doing this I saw the ZK session request initiated by the unit test go through
(after first trying IPv6, then falling back to IPv4), but then the first operation attempted
timed out after 40 seconds.   The same test case passes against a 3 node external ZK cluster.

Note that I'm spinning up a new ZK instance for every test run - I've tried inserting a several
minute sleep after startup to give it time to initialize, but that didn't make a difference.


import java.io.File;
import java.util.UUID;
import java.util.concurrent.Semaphore;
import org.apache.commons.io.FileUtils;
import org.apache.zookeeper.server.ZooKeeperServerMain;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * A single-node embedded zookeeper server. <p>
 * WARNING: This class is only intended for unit testing. It's not production-
 * grade.
 *
 * @author jblatt
 */
public class EmbeddedZooKeeper extends ZooKeeperServerMain {

    private static final Logger LOGGER =
            LoggerFactory.getLogger(EmbeddedZooKeeper.class);
    private final File dataDir = new File(
            FileUtils.getTempDirectoryPath() + "/"
            + UUID.randomUUID().toString());
    private final int clientPort;
    private final Semaphore isRunning = new Semaphore(0);
    private Thread thread;

    public EmbeddedZooKeeper(int clientPort) throws ZooKeeperException {
        this.clientPort = clientPort;
    }

    public void start() throws ZooKeeperException {
        try {
            FileUtils.forceMkdir(dataDir);

            final EmbeddedZooKeeper self = this;

            thread = new Thread() {

                @Override
                public void run() {
                    try {
                        LOGGER.info("Starting ZK server");

                        self.initializeAndRun(new String[]{
                                    Integer.toString(clientPort),
                                    dataDir.getAbsolutePath()});

                        LOGGER.info("Started ZK server");

                        isRunning.acquire();

                        LOGGER.info("Stopped ZK server");

                    } catch (Throwable t) {
                        LOGGER.error("Failure in embedded ZooKeeper", t);
                    }
                }
            };

            thread.start();
        } catch (Throwable t) {
            throw new ZooKeeperException("Cannot start embedded zookeeper", t);
        }
    }

    public void stop() throws ZooKeeperException {
        try {
            LOGGER.info("Stopping ZK server");

            super.shutdown();

            isRunning.release();

            thread.join();
        } catch (Throwable t) {
            throw new ZooKeeperException("Cannot stop embedded zookeeper", t);
        } finally {
            // Unconditionally try to cleanup tmp dirs even if this is done
            // on a running ZK server.   We don't want to clutter up the user's
            // local fs.

            try {
                FileUtils.deleteDirectory(dataDir);
            } catch (Throwable t) {
                LOGGER.error("Cannot cleanup tmp dirs {}",
                        dataDir.getAbsolutePath());
            }
        }
    }
}

Log output:

11:07:24.064 INFO  [main] st.ata.vcc.proxy.common.model.EmbeddedZooKeeperForUnitTest - Begin
EmbeddedZooKeeperForUnitTests.start()
11:07:24.066 INFO  [main] st.ata.vcc.proxy.common.model.EmbeddedZooKeeperForUnitTest - Embedded
ZooKeeper started
11:07:24.066 INFO  [Thread-1] st.ata.vcc.control.core.zookeeper.EmbeddedZooKeeper - Starting
ZK server
11:07:24.086 INFO  [main] st.ata.vcc.proxy.common.model.RoutePublisherTest - Begin RoutePublisherTest.start()
11:07:24.087 DEBUG [main] st.ata.vcc.proxy.common.model.RoutePublisher - Starting ZK connection
on st.ata.vcc.proxy.common.model.RoutePublisher@6b08d7cf
11:07:24.087 INFO  [main] st.ata.vcc.control.core.zookeeper.ZooKeeperConnection - Connecting
to localhost:2181
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:zookeeper.version=3.4.5-1392090,
built on 09/30/2012 17:52 GMT
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:host.name=10.66.225.162
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.version=1.7.0_05
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.vendor=Oracle
Corporation
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.home=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
11:07:24.093 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.class.path=/Users/jblatt/dev/proxy/common/target/test-classes:/Users/jblatt/dev/proxy/common/target/classes:/Users/jblatt/.m2/repository/st/ata/control/core/0.2.67/core-0.2.67.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty/7.0.0.pre5/jetty-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/servlet-api/3.0.pre4/servlet-api-3.0.pre4.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-util/7.0.0.pre5/jetty-util-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-ssl/7.0.0.pre5/jetty-ssl-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-security/7.0.0.pre5/jetty-security-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-xml/7.0.0.pre5/jetty-xml-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-grizzly2/1.12/jersey-grizzly2-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-server/1.12/jersey-server-1.12.jar:/Users/jblatt/.m2/repository/asm/asm/3.1/asm-3.1.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-core/1.12/jersey-core-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-client/1.12/jersey-client-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-json/1.12/jersey-json-1.12.jar:/Users/jblatt/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar:/Users/jblatt/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar:/Users/jblatt/.m2/repository/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar:/Users/jblatt/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/jblatt/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.7/jackson-core-asl-1.9.7.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.7/jackson-mapper-asl-1.9.7.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.7/jackson-xc-1.9.7.jar:/Users/jblatt/.m2/repository/com/sun/jersey/contribs/jersey-multipart/1.12/jersey-multipart-1.12.jar:/Users/jblatt/.m2/repository/org/jvnet/mimepull/1.6/mimepull-1.6.jar:/Users/jblatt/.m2/repository/com/sun/jersey/contribs/jersey-non-blocking-client/1.12/jersey-non-blocking-client-1.12.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http/2.2.9/grizzly-http-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-framework/2.2.9/grizzly-framework-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/gmbal/gmbal-api-only/3.0.0-b023/gmbal-api-only-3.0.0-b023.jar:/Users/jblatt/.m2/repository/org/glassfish/external/management-api/3.0.0-b012/management-api-3.0.0-b012.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http-server/2.2.9/grizzly-http-server-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-rcm/2.2.9/grizzly-rcm-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http-client/1.1/grizzly-http-client-1.1.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-websockets/2.2.5/grizzly-websockets-2.2.5.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-servlet/1.12/jersey-servlet-1.12.jar:/Users/jblatt/.m2/repository/org/apache/directory/studio/org.apache.commons.io/2.1/org.apache.commons.io-2.1.jar:/Users/jblatt/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/Users/jblatt/.m2/repository/commons-daemon/commons-daemon/1.0.10/commons-daemon-1.0.10.jar:/Users/jblatt/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar:/Users/jblatt/.m2/repository/org/slf4j/jul-to-slf4j/1.6.6/jul-to-slf4j-1.6.6.jar:/Users/jblatt/.m2/repository/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar:/Users/jblatt/.m2/repository/ch/qos/logback/logback-core/1.0.6/logback-core-1.0.6.jar:/Users/jblatt/.m2/repository/com/amazonaws/aws-java-sdk/1.3.11/aws-java-sdk-1.3.11.jar:/Users/jblatt/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/jblatt/.m2/repository/org/apache/httpcomponents/httpclient/4.2-beta1/httpclient-4.2-beta1.jar:/Users/jblatt/.m2/repository/org/apache/httpcomponents/httpcore/4.2-beta1/httpcore-4.2-beta1.jar:/Users/jblatt/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:/Users/jblatt/.m2/repository/st/ata/control/core/0.2.67/core-0.2.67-tests.jar:/Users/jblatt/.m2/repository/st/ata/vc/task/task/0.5.156/task-0.5.156.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.7/jackson-jaxrs-1.9.7.jar:/Users/jblatt/.m2/repository/org/slf4j/slf4j-log4j12/1.6.6/slf4j-log4j12-1.6.6.jar:/Users/jblatt/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/Users/jblatt/.m2/repository/com/ning/async-http-client/1.7.5/async-http-client-1.7.5.jar:/Users/jblatt/.m2/repository/io/netty/netty/3.4.4.Final/netty-3.4.4.Final.jar:/Users/jblatt/.m2/repository/org/slf4j/log4j-over-slf4j/1.6.6/log4j-over-slf4j-1.6.6.jar:/Users/jblatt/.m2/repository/org/apache/zookeeper/zookeeper/3.4.5/zookeeper-3.4.5.jar:/Users/jblatt/.m2/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/jblatt/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/Users/jblatt/.m2/repository/org/jboss/netty/netty/3.2.2.Final/netty-3.2.2.Final.jar:/Users/jblatt/.m2/repository/org/testng/testng/6.5.2/testng-6.5.2.jar:/Users/jblatt/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar:/Users/jblatt/.m2/repository/com/beust/jcommander/1.12/jcommander-1.12.jar:/Users/jblatt/.m2/repository/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar:/Users/jblatt/.m2/repository/mockit/jmockit/0.999.10/jmockit-0.999.10.jar:/Users/jblatt/.m2/repository/org/jacoco/org.jacoco.agent/0.5.7.201204190339/org.jacoco.agent-0.5.7.201204190339-runtime.jar:/Users/jblatt/.m2/repository/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.jar:/Users/jblatt/.m2/repository/org/apache/maven/surefire/surefire-testng-utils/2.12/surefire-testng-utils-2.12.jar:/Users/jblatt/.m2/repository/org/apache/maven/surefire/surefire-grouper/2.12/surefire-grouper-2.12.jar:
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.library.path=/Users/jblatt/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.io.tmpdir=/var/folders/zq/76dngxt50rd1hzys0bnzhwg40000gn/T/
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:java.compiler=<NA>
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:os.name=Mac
OS X
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:os.arch=x86_64
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:os.version=10.8.2
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:user.name=jblatt
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:user.home=/Users/jblatt
11:07:24.094 INFO  [main] org.apache.zookeeper.ZooKeeper - Client environment:user.dir=/Users/jblatt/dev/proxy/common
11:07:24.095 INFO  [main] org.apache.zookeeper.ZooKeeper - Initiating client connection, connectString=localhost:2181
sessionTimeout=300000 watcher=st.ata.vcc.control.core.zookeeper.ZooKeeperConnection$ConnectionWatcher@457b9183
11:07:24.100 DEBUG [main] org.apache.zookeeper.ClientCnxn - zookeeper.disableAutoWatchReset
is false
11:07:24.114 INFO  [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxn - Opening
socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate
using SASL (unknown error)
11:07:24.125 WARN  [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxn - Session
0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.7.0_05]
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:701) ~[na:1.7.0_05]
	at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
11:07:24.125 DEBUG [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxnSocketNIO
- Ignoring exception during shutdown input
java.nio.channels.ClosedChannelException: null
	at sun.nio.ch.SocketChannelImpl.shutdownInput(SocketChannelImpl.java:762) ~[na:1.7.0_05]
	at sun.nio.ch.SocketAdaptor.shutdownInput(SocketAdaptor.java:421) ~[na:1.7.0_05]
	at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:189) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1157) [zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1097) [zookeeper-3.4.5.jar:3.4.5-1392090]
11:07:24.126 DEBUG [main-SendThread(localhost:2181)] org.apache.zookeeper.ClientCnxnSocketNIO
- Ignoring exception during shutdown output
java.nio.channels.ClosedChannelException: null
	at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:779) ~[na:1.7.0_05]
	at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:429) ~[na:1.7.0_05]
	at org.apache.zookeeper.ClientCnxnSocketNIO.cleanup(ClientCnxnSocketNIO.java:196) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ClientCnxn$SendThread.cleanup(ClientCnxn.java:1157) [zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1097) [zookeeper-3.4.5.jar:3.4.5-1392090]
log4j:WARN No appenders could be found for logger (org.apache.log4j.jmx.HierarchyDynamicMBean).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
11:07:24.135 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServerMain - Starting server
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:zookeeper.version=3.4.5-1392090,
built on 09/30/2012 17:52 GMT
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:host.name=10.66.225.162
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.version=1.7.0_05
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.vendor=Oracle
Corporation
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.home=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre
11:07:24.139 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.class.path=/Users/jblatt/dev/proxy/common/target/test-classes:/Users/jblatt/dev/proxy/common/target/classes:/Users/jblatt/.m2/repository/st/ata/control/core/0.2.67/core-0.2.67.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty/7.0.0.pre5/jetty-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/servlet-api/3.0.pre4/servlet-api-3.0.pre4.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-util/7.0.0.pre5/jetty-util-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-ssl/7.0.0.pre5/jetty-ssl-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-security/7.0.0.pre5/jetty-security-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/org/mortbay/jetty/jetty-xml/7.0.0.pre5/jetty-xml-7.0.0.pre5.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-grizzly2/1.12/jersey-grizzly2-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-server/1.12/jersey-server-1.12.jar:/Users/jblatt/.m2/repository/asm/asm/3.1/asm-3.1.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-core/1.12/jersey-core-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-client/1.12/jersey-client-1.12.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-json/1.12/jersey-json-1.12.jar:/Users/jblatt/.m2/repository/org/codehaus/jettison/jettison/1.1/jettison-1.1.jar:/Users/jblatt/.m2/repository/com/sun/xml/bind/jaxb-impl/2.2.3-1/jaxb-impl-2.2.3-1.jar:/Users/jblatt/.m2/repository/javax/xml/bind/jaxb-api/2.2.2/jaxb-api-2.2.2.jar:/Users/jblatt/.m2/repository/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar:/Users/jblatt/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-core-asl/1.9.7/jackson-core-asl-1.9.7.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-mapper-asl/1.9.7/jackson-mapper-asl-1.9.7.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-xc/1.9.7/jackson-xc-1.9.7.jar:/Users/jblatt/.m2/repository/com/sun/jersey/contribs/jersey-multipart/1.12/jersey-multipart-1.12.jar:/Users/jblatt/.m2/repository/org/jvnet/mimepull/1.6/mimepull-1.6.jar:/Users/jblatt/.m2/repository/com/sun/jersey/contribs/jersey-non-blocking-client/1.12/jersey-non-blocking-client-1.12.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http/2.2.9/grizzly-http-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-framework/2.2.9/grizzly-framework-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/gmbal/gmbal-api-only/3.0.0-b023/gmbal-api-only-3.0.0-b023.jar:/Users/jblatt/.m2/repository/org/glassfish/external/management-api/3.0.0-b012/management-api-3.0.0-b012.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http-server/2.2.9/grizzly-http-server-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-rcm/2.2.9/grizzly-rcm-2.2.9.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-http-client/1.1/grizzly-http-client-1.1.jar:/Users/jblatt/.m2/repository/org/glassfish/grizzly/grizzly-websockets/2.2.5/grizzly-websockets-2.2.5.jar:/Users/jblatt/.m2/repository/com/sun/jersey/jersey-servlet/1.12/jersey-servlet-1.12.jar:/Users/jblatt/.m2/repository/org/apache/directory/studio/org.apache.commons.io/2.1/org.apache.commons.io-2.1.jar:/Users/jblatt/.m2/repository/commons-io/commons-io/2.1/commons-io-2.1.jar:/Users/jblatt/.m2/repository/commons-daemon/commons-daemon/1.0.10/commons-daemon-1.0.10.jar:/Users/jblatt/.m2/repository/ch/ethz/ganymed/ganymed-ssh2/build210/ganymed-ssh2-build210.jar:/Users/jblatt/.m2/repository/org/slf4j/jul-to-slf4j/1.6.6/jul-to-slf4j-1.6.6.jar:/Users/jblatt/.m2/repository/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar:/Users/jblatt/.m2/repository/ch/qos/logback/logback-core/1.0.6/logback-core-1.0.6.jar:/Users/jblatt/.m2/repository/com/amazonaws/aws-java-sdk/1.3.11/aws-java-sdk-1.3.11.jar:/Users/jblatt/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar:/Users/jblatt/.m2/repository/org/apache/httpcomponents/httpclient/4.2-beta1/httpclient-4.2-beta1.jar:/Users/jblatt/.m2/repository/org/apache/httpcomponents/httpcore/4.2-beta1/httpcore-4.2-beta1.jar:/Users/jblatt/.m2/repository/commons-codec/commons-codec/1.3/commons-codec-1.3.jar:/Users/jblatt/.m2/repository/st/ata/control/core/0.2.67/core-0.2.67-tests.jar:/Users/jblatt/.m2/repository/st/ata/vc/task/task/0.5.156/task-0.5.156.jar:/Users/jblatt/.m2/repository/org/codehaus/jackson/jackson-jaxrs/1.9.7/jackson-jaxrs-1.9.7.jar:/Users/jblatt/.m2/repository/org/slf4j/slf4j-log4j12/1.6.6/slf4j-log4j12-1.6.6.jar:/Users/jblatt/.m2/repository/log4j/log4j/1.2.17/log4j-1.2.17.jar:/Users/jblatt/.m2/repository/com/ning/async-http-client/1.7.5/async-http-client-1.7.5.jar:/Users/jblatt/.m2/repository/io/netty/netty/3.4.4.Final/netty-3.4.4.Final.jar:/Users/jblatt/.m2/repository/org/slf4j/log4j-over-slf4j/1.6.6/log4j-over-slf4j-1.6.6.jar:/Users/jblatt/.m2/repository/org/apache/zookeeper/zookeeper/3.4.5/zookeeper-3.4.5.jar:/Users/jblatt/.m2/repository/jline/jline/0.9.94/jline-0.9.94.jar:/Users/jblatt/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/Users/jblatt/.m2/repository/org/jboss/netty/netty/3.2.2.Final/netty-3.2.2.Final.jar:/Users/jblatt/.m2/repository/org/testng/testng/6.5.2/testng-6.5.2.jar:/Users/jblatt/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar:/Users/jblatt/.m2/repository/com/beust/jcommander/1.12/jcommander-1.12.jar:/Users/jblatt/.m2/repository/org/yaml/snakeyaml/1.6/snakeyaml-1.6.jar:/Users/jblatt/.m2/repository/mockit/jmockit/0.999.10/jmockit-0.999.10.jar:/Users/jblatt/.m2/repository/org/jacoco/org.jacoco.agent/0.5.7.201204190339/org.jacoco.agent-0.5.7.201204190339-runtime.jar:/Users/jblatt/.m2/repository/org/slf4j/slf4j-api/1.6.6/slf4j-api-1.6.6.jar:/Users/jblatt/.m2/repository/org/apache/maven/surefire/surefire-testng-utils/2.12/surefire-testng-utils-2.12.jar:/Users/jblatt/.m2/repository/org/apache/maven/surefire/surefire-grouper/2.12/surefire-grouper-2.12.jar:
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.library.path=/Users/jblatt/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.io.tmpdir=/var/folders/zq/76dngxt50rd1hzys0bnzhwg40000gn/T/
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:java.compiler=<NA>
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:os.name=Mac
OS X
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:os.arch=x86_64
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:os.version=10.8.2
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:user.name=jblatt
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:user.home=/Users/jblatt
11:07:24.140 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - Server environment:user.dir=/Users/jblatt/dev/proxy/common
11:07:24.142 DEBUG [Thread-1] org.apache.zookeeper.server.persistence.FileTxnSnapLog - Opening
datadir:/var/folders/zq/76dngxt50rd1hzys0bnzhwg40000gn/T/51bc2e1d-270b-42df-bb82-6330a1081748
snapDir:/var/folders/zq/76dngxt50rd1hzys0bnzhwg40000gn/T/51bc2e1d-270b-42df-bb82-6330a1081748
11:07:24.145 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - tickTime set to
3000
11:07:24.145 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - minSessionTimeout
set to -1
11:07:24.145 INFO  [Thread-1] org.apache.zookeeper.server.ZooKeeperServer - maxSessionTimeout
set to -1
11:07:24.151 INFO  [Thread-1] org.apache.zookeeper.server.NIOServerCnxnFactory - binding to
port 0.0.0.0/0.0.0.0:2181
11:07:24.162 INFO  [Thread-1] org.apache.zookeeper.server.persistence.FileTxnSnapLog - Snapshotting:
0x0 to /var/folders/zq/76dngxt50rd1hzys0bnzhwg40000gn/T/51bc2e1d-270b-42df-bb82-6330a1081748/version-2/snapshot.0
11:07:29.230 INFO  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181)] org.apache.zookeeper.ClientCnxn
- Opening socket connection to server fe80:0:0:0:0:0:0:1%1/fe80:0:0:0:0:0:0:1%1:2181. Will
not attempt to authenticate using SASL (unknown error)
11:07:29.231 INFO  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181)] org.apache.zookeeper.ClientCnxn
- Socket connection established to fe80:0:0:0:0:0:0:1%1/fe80:0:0:0:0:0:0:1%1:2181, initiating
session
11:07:29.231 INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] org.apache.zookeeper.server.NIOServerCnxnFactory
- Accepted socket connection from /fe80:0:0:0:0:0:0:1%1:50774
11:07:29.232 DEBUG [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181)] org.apache.zookeeper.ClientCnxn
- Session establishment request sent on fe80:0:0:0:0:0:0:1%1/fe80:0:0:0:0:0:0:1%1:2181
11:07:29.235 DEBUG [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] org.apache.zookeeper.server.ZooKeeperServer
- Session establishment request from client /fe80:0:0:0:0:0:0:1%1:50774 client's lastZxid
is 0x0
11:07:29.236 INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181] org.apache.zookeeper.server.ZooKeeperServer
- Client attempting to establish new session at /fe80:0:0:0:0:0:0:1%1:50774
11:07:29.238 INFO  [SyncThread:0] org.apache.zookeeper.server.persistence.FileTxnLog - Creating
new log file: log.1
11:07:29.243 DEBUG [SyncThread:0] org.apache.zookeeper.server.FinalRequestProcessor - Processing
request:: sessionid:0x13b622a66870000 type:createSession cxid:0x0 zxid:0x1 txntype:-10 reqpath:n/a
11:07:29.246 DEBUG [SyncThread:0] org.apache.zookeeper.server.FinalRequestProcessor - sessionid:0x13b622a66870000
type:createSession cxid:0x0 zxid:0x1 txntype:-10 reqpath:n/a
11:07:29.249 INFO  [SyncThread:0] org.apache.zookeeper.server.ZooKeeperServer - Established
session 0x13b622a66870000 with negotiated timeout 60000 for client /fe80:0:0:0:0:0:0:1%1:50774
11:07:29.249 INFO  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181)] org.apache.zookeeper.ClientCnxn
- Session establishment complete on server fe80:0:0:0:0:0:0:1%1/fe80:0:0:0:0:0:0:1%1:2181,
sessionid = 0x13b622a66870000, negotiated timeout = 60000
11:07:29.250 DEBUG [main-EventThread] st.ata.vcc.control.core.zookeeper.ZooKeeperConnection
- ZK event: type=None, state=SyncConnected, path=null
11:07:29.250 DEBUG [main] st.ata.vcc.control.core.zookeeper.ZooKeeperConnection - Connected
to localhost:2181
11:08:09.250 INFO  [main-SendThread(fe80:0:0:0:0:0:0:1%1:2181)] org.apache.zookeeper.ClientCnxn
- Client session timed out, have not heard from server in 40000ms for sessionid 0x13b622a66870000,
closing socket connection and attempting reconnect
11:08:09.352 DEBUG [main-EventThread] st.ata.vcc.control.core.zookeeper.ZooKeeperConnection
- ZK event: type=None, state=Disconnected, path=null
11:08:09.352 DEBUG [main-EventThread] st.ata.vcc.control.core.zookeeper.ZooKeeperConnection
- Lost connection to localhost:2181
11:08:09.352 DEBUG [main-EventThread] org.apache.zookeeper.ZooKeeper - Closing session: 0x13b622a66870000
11:08:09.353 DEBUG [main-EventThread] org.apache.zookeeper.ClientCnxn - Closing client for
session: 0x13b622a66870000
11:08:09.359 ERROR [main] st.ata.vcc.proxy.common.model.RoutePublisherTest - Cannot start
RoutePublisherTest
st.ata.vcc.proxy.common.model.RouteException: Cannot start ZK connection
	at st.ata.vcc.proxy.common.model.RouteBase.start(RouteBase.java:103) ~[classes/:na]
	at st.ata.vcc.proxy.common.model.RoutePublisher.start(RoutePublisher.java:36) ~[classes/:na]
	at st.ata.vcc.proxy.common.model.RoutePublisherTest.start(RoutePublisherTest.java:35) ~[test-classes/:na]
	at st.ata.vcc.proxy.common.model.RoutePublisherUnitTest.start(RoutePublisherUnitTest.java:28)
[test-classes/:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_05]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_05]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_05]
	at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_05]
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
[testng-6.5.2.jar:na]
	at org.testng.internal.MethodInvocationHelper$2.runConfigurationMethod(MethodInvocationHelper.java:274)
[testng-6.5.2.jar:na]
	at mockit.integration.testng.internal.TestNGRunnerDecorator.run(TestNGRunnerDecorator.java:81)
[jmockit-0.999.10.jar:na]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_05]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_05]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_05]
	at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_05]
	at org.testng.internal.MethodInvocationHelper.invokeConfigurable(MethodInvocationHelper.java:286)
[testng-6.5.2.jar:na]
	at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:543) [testng-6.5.2.jar:na]
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) [testng-6.5.2.jar:na]
	at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) [testng-6.5.2.jar:na]
	at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)
[testng-6.5.2.jar:na]
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107) [testng-6.5.2.jar:na]
	at org.testng.TestRunner.privateRun(TestRunner.java:768) [testng-6.5.2.jar:na]
	at org.testng.TestRunner.run(TestRunner.java:617) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunner.run(SuiteRunner.java:240) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53) [testng-6.5.2.jar:na]
	at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87) [testng-6.5.2.jar:na]
	at org.testng.TestNG.runSuitesSequentially(TestNG.java:1188) [testng-6.5.2.jar:na]
	at org.testng.TestNG.runSuitesLocally(TestNG.java:1113) [testng-6.5.2.jar:na]
	at org.testng.TestNG.run(TestNG.java:1025) [testng-6.5.2.jar:na]
	at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:76) [surefire-testng-2.12.jar:2.12]
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeMulti(TestNGDirectoryTestSuite.java:161)
[surefire-testng-2.12.jar:2.12]
	at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:101)
[surefire-testng-2.12.jar:2.12]
	at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:115) [surefire-testng-2.12.jar:2.12]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_05]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_05]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.7.0_05]
	at java.lang.reflect.Method.invoke(Method.java:601) ~[na:1.7.0_05]
	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
[surefire-api-2.12.jar:2.12]
	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
[surefire-booter-2.12.jar:2.12]
	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
[surefire-booter-2.12.jar:2.12]
	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:103)
[surefire-booter-2.12.jar:2.12]
	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:74) [surefire-booter-2.12.jar:2.12]
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =
ConnectionLoss for /proxy
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:99) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1041) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1069) ~[zookeeper-3.4.5.jar:3.4.5-1392090]
	at st.ata.vcc.proxy.common.model.RouteBase.mkdir_p(RouteBase.java:161) ~[classes/:na]
	at st.ata.vcc.proxy.common.model.RouteBase.start(RouteBase.java:98) ~[classes/:na]
	... 44 common frames omitted
Tests run: 5, Failures: 1, Errors: 0, Skipped: 2, Time elapsed: 46.141 sec <<< FAILURE!
start(st.ata.vcc.proxy.common.model.RoutePublisherUnitTest)  Time elapsed: 45.281 sec  <<<
FAILURE!
st.ata.vcc.proxy.common.model.RouteException: Cannot start ZK connection
	at st.ata.vcc.proxy.common.model.RouteBase.start(RouteBase.java:103)
	at st.ata.vcc.proxy.common.model.RoutePublisher.start(RoutePublisher.java:36)
	at st.ata.vcc.proxy.common.model.RoutePublisherTest.start(RoutePublisherTest.java:35)
	at st.ata.vcc.proxy.common.model.RoutePublisherUnitTest.start(RoutePublisherUnitTest.java:28)
Caused by: org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode =
ConnectionLoss for /proxy
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:99)
	at org.apache.zookeeper.KeeperException.create(KeeperException.java:51)
	at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1041)
	at org.apache.zookeeper.ZooKeeper.exists(ZooKeeper.java:1069)
	at st.ata.vcc.proxy.common.model.RouteBase.mkdir_p(RouteBase.java:161)
	at st.ata.vcc.proxy.common.model.RouteBase.start(RouteBase.java:98)
	... 44 more





Any ideas?

Thanks,

Josh
Mime
View raw message