minor refactor - doc updates
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/b04c8b5a Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/b04c8b5a Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/b04c8b5a Branch: refs/heads/CURATOR-114 Commit: b04c8b5af488530f6cc8b2632db61bb36e39188b Parents: c885c8f Author: randgalt <randg...@apache.org> Authored: Wed Jun 18 09:29:52 2014 -0500 Committer: randgalt <randg...@apache.org> Committed: Wed Jun 18 09:29:52 2014 -0500 ---------------------------------------------------------------------- .../org/apache/curator/test/TestingServer.java | 91 +++++++++----------- 1 file changed, 41 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/b04c8b5a/curator-test/src/main/java/org/apache/curator/test/TestingServer.java ---------------------------------------------------------------------- diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingServer.java b/curator-test/src/main/java/org/apache/curator/test/TestingServer.java index 720949a..7ed8add 100644 --- a/curator-test/src/main/java/org/apache/curator/test/TestingServer.java +++ b/curator-test/src/main/java/org/apache/curator/test/TestingServer.java @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ + package org.apache.curator.test; import java.io.Closeable; @@ -37,22 +38,19 @@ public class TestingServer implements Closeable /** * Create the server using a random port - * - * @throws Exception - * errors + * + * @throws Exception errors */ public TestingServer() throws Exception { - this(true); + this(-1, null, true); } /** * Create the server using a random port - * - * @param start - * True if the server should be started, false otherwise - * @throws Exception - * errors + * + * @param start True if the server should be started, false otherwise + * @throws Exception errors */ public TestingServer(boolean start) throws Exception { @@ -60,27 +58,22 @@ public class TestingServer implements Closeable } /** - * Create the server using the given port - * - * @param port - * the port - * @throws Exception - * errors + * Create and start the server using the given port + * + * @param port the port + * @throws Exception errors */ public TestingServer(int port) throws Exception { - this(port, true); + this(port, null, true); } /** * Create the server using the given port - * - * @param port - * the port - * @param start - * True if the server should be started, false otherwise - * @throws Exception - * errors + * + * @param port the port + * @param start True if the server should be started, false otherwise + * @throws Exception errors */ public TestingServer(int port, boolean start) throws Exception { @@ -88,14 +81,11 @@ public class TestingServer implements Closeable } /** - * Create the server using the given port - * - * @param port - * the port - * @param tempDirectory - * directory to use - * @throws Exception - * errors + * Create and start the server using the given port + * + * @param port the port + * @param tempDirectory directory to use + * @throws Exception errors */ public TestingServer(int port, File tempDirectory) throws Exception { @@ -104,29 +94,30 @@ public class TestingServer implements Closeable /** * Create the server using the given port - * - * @param port - * the port - * @param tempDirectory - * directory to use - * @param start - * True if the server should be started, false otherwise - * @throws Exception - * errors + * + * @param port the port + * @param tempDirectory directory to use + * @param start True if the server should be started, false otherwise + * @throws Exception errors */ - public TestingServer(int port, File tempDirectory, boolean start) - throws Exception + public TestingServer(int port, File tempDirectory, boolean start) throws Exception { this(new InstanceSpec(tempDirectory, port, -1, -1, true, -1), start); } + /** + * Create the server using the given port + * + * @param spec instance details + * @param start True if the server should be started, false otherwise + * @throws Exception errors + */ public TestingServer(InstanceSpec spec, boolean start) throws Exception { this.spec = spec; - testingZooKeeperServer = new TestingZooKeeperServer( - new QuorumConfigBuilder(spec)); + testingZooKeeperServer = new TestingZooKeeperServer(new QuorumConfigBuilder(spec)); - if (start) + if ( start ) { testingZooKeeperServer.start(); } @@ -134,7 +125,7 @@ public class TestingServer implements Closeable /** * Return the port being used - * + * * @return port */ public int getPort() @@ -144,7 +135,7 @@ public class TestingServer implements Closeable /** * Returns the temp directory being used - * + * * @return directory */ public File getTempDirectory() @@ -154,7 +145,7 @@ public class TestingServer implements Closeable /** * Start the server - * + * * @throws Exception */ public void start() throws Exception @@ -175,7 +166,7 @@ public class TestingServer implements Closeable * and restarted. If it's not currently running then it will be started. If * it has been closed (had close() called on it) then an exception will be * thrown. - * + * * @throws Exception */ public void restart() throws Exception @@ -194,7 +185,7 @@ public class TestingServer implements Closeable /** * Returns the connection string to use - * + * * @return connection string */ public String getConnectString()