You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/06/09 07:01:08 UTC
svn commit: r1491140 - in
/lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator:
ReplicatorTestCase.java http/HttpReplicatorTest.java
Author: shaie
Date: Sun Jun 9 05:01:08 2013
New Revision: 1491140
URL: http://svn.apache.org/r1491140
Log:
Use the host returned by the Server when connecting to it
Modified:
lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/ReplicatorTestCase.java
lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java
Modified: lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/ReplicatorTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/ReplicatorTestCase.java?rev=1491140&r1=1491139&r2=1491140&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/ReplicatorTestCase.java (original)
+++ lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/ReplicatorTestCase.java Sun Jun 9 05:01:08 2013
@@ -17,7 +17,6 @@ package org.apache.lucene.replicator;
* limitations under the License.
*/
-import java.net.SocketException;
import java.util.Random;
import org.apache.http.conn.ClientConnectionManager;
@@ -125,12 +124,14 @@ public abstract class ReplicatorTestCase
return server;
}
- /**
- * Returns a {@link Server}'s port. This method assumes that no
- * {@link Connector}s were added to the Server besides the default one.
- */
- public static int serverPort(Server httpServer) {
- return httpServer.getConnectors()[0].getLocalPort();
+ /** Returns a {@link Server}'s port. */
+ public static int serverPort(Server server) {
+ return server.getConnectors()[0].getLocalPort();
+ }
+
+ /** Returns a {@link Server}'s host. */
+ public static String serverHost(Server server) {
+ return server.getConnectors()[0].getHost();
}
/**
Modified: lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java?rev=1491140&r1=1491139&r2=1491140&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java (original)
+++ lucene/dev/trunk/lucene/replicator/src/test/org/apache/lucene/replicator/http/HttpReplicatorTest.java Sun Jun 9 05:01:08 2013
@@ -50,6 +50,7 @@ public class HttpReplicatorTest extends
private DirectoryReader reader;
private Server server;
private int port;
+ private String host;
private Directory serverIndexDir, handlerIndexDir;
private void startServer() throws Exception {
@@ -59,6 +60,7 @@ public class HttpReplicatorTest extends
replicationHandler.addServletWithMapping(servlet, ReplicationService.REPLICATION_CONTEXT + "/*");
server = newHttpServer(replicationHandler);
port = serverPort(server);
+ host = serverHost(server);
}
@Before
@@ -103,7 +105,7 @@ public class HttpReplicatorTest extends
@Test
public void testBasic() throws Exception {
- Replicator replicator = new HttpReplicator("127.0.0.1", port, ReplicationService.REPLICATION_CONTEXT + "/s1",
+ Replicator replicator = new HttpReplicator(host, port, ReplicationService.REPLICATION_CONTEXT + "/s1",
getClientConnectionManager());
ReplicationClient client = new ReplicationClient(replicator, new IndexReplicationHandler(handlerIndexDir, null),
new PerSessionDirectoryFactory(clientWorkDir));