Commit 399d71d6 authored by Michi Mutsuzaki's avatar Michi Mutsuzaki
Browse files

ZOOKEEPER-1857. PrepRequestProcessotTest doesn't shutdown ZooKeeper server...

ZOOKEEPER-1857. PrepRequestProcessotTest doesn't shutdown ZooKeeper server (Germán Blanco via michim)


git-svn-id: https://svn.apache.org/repos/asf/zookeeper/branches/branch-3.4@1556977 13f79535-47bb-0310-9956-ffa450edef68
parent f9f6beac
......@@ -218,6 +218,9 @@ BUGFIXES:
ZOOKEEPER-1057. zookeeper c-client, connection to offline server fails to
successfully fallback to second zk host (Germán Blanco via michim)
ZOOKEEPER-1857. PrepRequestProcessotTest doesn't shutdown ZooKeeper server
(Germán Blanco via michim)
IMPROVEMENTS:
ZOOKEEPER-1564. Allow JUnit test build with IBM Java
......
......@@ -23,6 +23,7 @@ import static org.junit.Assert.*;
import java.io.File;
import java.io.PrintWriter;
import java.nio.ByteBuffer;
import java.util.concurrent.CountDownLatch;
import org.apache.zookeeper.PortAssignment;
import org.apache.zookeeper.KeeperException.Code;
......@@ -43,6 +44,7 @@ import org.junit.Test;
public class PrepRequestProcessorTest extends ClientBase {
private static String HOSTPORT = "127.0.0.1:" + PortAssignment.unique();
private static final int CONNECTION_TIMEOUT = 3000;
private final CountDownLatch testEnd = new CountDownLatch(1);
@Test
public void testPRequest() throws Exception {
......@@ -59,14 +61,17 @@ public class PrepRequestProcessorTest extends ClientBase {
PrepRequestProcessor processor = new PrepRequestProcessor(zks, new MyRequestProcessor());
Request foo = new Request(null, 1l, 1, OpCode.create, ByteBuffer.allocate(3), null);
processor.pRequest(foo);
testEnd.await(5, java.util.concurrent.TimeUnit.SECONDS);
f.shutdown();
zks.shutdown();
}
private class MyRequestProcessor implements RequestProcessor {
@Override
public void processRequest(Request request) {
Assert.assertEquals("Request should have marshalling error", new ErrorTxn(Code.MARSHALLINGERROR.intValue()), request.txn);
Assert.assertEquals("Request should have marshalling error", new ErrorTxn(Code.MARSHALLINGERROR.intValue()), request.txn);
testEnd.countDown();
}
@Override
public void shutdown() {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment