lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r927651 - in /lucene/dev/trunk/solr/src/test/org/apache/solr: client/solrj/ client/solrj/embedded/ servlet/
Date Fri, 26 Mar 2010 00:28:21 GMT
Author: yonik
Date: Fri Mar 26 00:28:21 2010
New Revision: 927651

URL: http://svn.apache.org/viewvc?rev=927651&view=rev
Log:
tests: factor out common client creation code

Modified:
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/SolrJettyTestBase.java Fri
Mar 26 00:28:21 2010
@@ -1,6 +1,7 @@
 package org.apache.solr.client.solrj;
 
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.solr.client.solrj.embedded.JettySolrRunner;
 import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.junit.AfterClass;
@@ -34,7 +35,7 @@ abstract public class SolrJettyTestBase 
 
     context = context==null ? "/solr" : context;
     SolrJettyTestBase.context = context;
-    JettySolrRunner jetty = new JettySolrRunner( context, 0, configFile );
+    jetty = new JettySolrRunner( context, 0, configFile );
 
     jetty.start();
     port = jetty.getLocalPort();
@@ -62,7 +63,27 @@ abstract public class SolrJettyTestBase 
   }
 
   /**
-   * Create a new solr server
+   * Create a new solr server.
+   * If createJetty was called, an http implementation will be created,
+   * otherwise an embedded implementation will be created.
+   * Subclasses should override for other options.
    */
-  protected abstract SolrServer createNewSolrServer();
+  public SolrServer createNewSolrServer() {
+    if (jetty != null) {
+      try {
+        // setup the server...
+        String url = "http://localhost:"+port+context;
+        CommonsHttpSolrServer s = new CommonsHttpSolrServer( url );
+        s.setConnectionTimeout(100); // 1/10th sec
+        s.setDefaultMaxConnectionsPerHost(100);
+        s.setMaxTotalConnections(100);
+        return s;
+      }
+      catch( Exception ex ) {
+        throw new RuntimeException( ex );
+      }
+    } else {
+      return new EmbeddedSolrServer( h.getCoreContainer(), "" );
+    }
+  }
 }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
Fri Mar 26 00:28:21 2010
@@ -23,31 +23,12 @@ import org.apache.solr.client.solrj.impl
 import org.junit.BeforeClass;
 
 /**
- * @version $Id$
  * @see org.apache.solr.client.solrj.impl.BinaryRequestWriter
  * @see org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec
- * @since solr 1.4
  */
 public class LargeVolumeBinaryJettyTest extends LargeVolumeTestBase {
   @BeforeClass
   public static void beforeTest() throws Exception {
     createJetty(EXAMPLE_HOME, null, null);
   }
-
-  @Override
-  protected SolrServer createNewSolrServer() {
-    try {
-      // setup the server...
-      String url = "http://localhost:" + port + context;
-      CommonsHttpSolrServer s = new CommonsHttpSolrServer(url);
-      s.setRequestWriter(new BinaryRequestWriter());
-      s.setConnectionTimeout(100); // 1/10th sec
-      s.setDefaultMaxConnectionsPerHost(100);
-      s.setMaxTotalConnections(100);
-      return s;
-    }
-    catch (Exception ex) {
-      throw new RuntimeException(ex);
-    }
-  }
 }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
Fri Mar 26 00:28:21 2010
@@ -21,19 +21,9 @@ import org.apache.solr.client.solrj.Larg
 import org.apache.solr.client.solrj.SolrServer;
 import org.junit.BeforeClass;
 
-/**
- * @version $Id$
- * @since solr 1.3
- */
 public class LargeVolumeEmbeddedTest extends LargeVolumeTestBase {
   @BeforeClass
   public static void beforeTest() throws Exception {
     initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
   }
-
-  @Override
-  protected SolrServer createNewSolrServer()
-  {
-    return new EmbeddedSolrServer( h.getCoreContainer(), "" );
-  }
 }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
Fri Mar 26 00:28:21 2010
@@ -22,30 +22,9 @@ import org.apache.solr.client.solrj.Solr
 import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.junit.BeforeClass;
 
-/**
- * @version $Id$
- * @since solr 1.3
- */
 public class LargeVolumeJettyTest extends LargeVolumeTestBase {
   @BeforeClass
   public static void beforeTest() throws Exception {
     createJetty(EXAMPLE_HOME, null, null);
   }
-
-  @Override
-  protected SolrServer createNewSolrServer()
-  {
-    try {
-      // setup the server...
-      String url = "http://localhost:"+port+context;
-      CommonsHttpSolrServer s = new CommonsHttpSolrServer( url );
-      s.setConnectionTimeout(100); // 1/10th sec
-      s.setDefaultMaxConnectionsPerHost(100);
-      s.setMaxTotalConnections(100);
-      return s;
-    }
-    catch( Exception ex ) {
-      throw new RuntimeException( ex );
-    }
-  }
 }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
Fri Mar 26 00:28:21 2010
@@ -33,10 +33,4 @@ public class SolrExampleEmbeddedTest ext
   public static void beforeTest() throws Exception {
     initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
   }
-
-  @Override
-  protected SolrServer createNewSolrServer()
-  {
-    return new EmbeddedSolrServer( h.getCoreContainer(), "" );
-  }
 }

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
Fri Mar 26 00:28:21 2010
@@ -31,8 +31,6 @@ import org.junit.Test;
  *  http://docs.codehaus.org/display/JETTY/ServletTester
  * rather then open a real connection?
  * 
- * @version $Id$
- * @since solr 1.3
  */
 public class SolrExampleJettyTest extends SolrExampleTests {
 
@@ -40,23 +38,6 @@ public class SolrExampleJettyTest extend
   public static void beforeTest() throws Exception {
     createJetty(EXAMPLE_HOME, null, null);
   }
-  
-  @Override
-  protected SolrServer createNewSolrServer()
-  {
-    try {
-      // setup the server...
-      String url = "http://localhost:"+port+context;
-      CommonsHttpSolrServer s = new CommonsHttpSolrServer( url );
-      s.setConnectionTimeout(100); // 1/10th sec
-      s.setDefaultMaxConnectionsPerHost(100);
-      s.setMaxTotalConnections(100);
-      return s;
-    }
-    catch( Exception ex ) {
-      throw new RuntimeException( ex );
-    }
-  }
 
   @Test
   public void testBadSetup()

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
(original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
Fri Mar 26 00:28:21 2010
@@ -36,7 +36,7 @@ public class SolrExampleStreamingTest ex
   }
 
   @Override
-  protected SolrServer createNewSolrServer()
+  public SolrServer createNewSolrServer()
   {
     try {
       // setup the server...

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java?rev=927651&r1=927650&r2=927651&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/servlet/CacheHeaderTestBase.java Fri Mar
26 00:28:21 2010
@@ -33,20 +33,6 @@ import static junit.framework.Assert.ass
 import static org.junit.Assert.assertTrue;
 
 public abstract class CacheHeaderTestBase extends SolrJettyTestBase {
-  @Override
-  protected CommonsHttpSolrServer createNewSolrServer() {
-    try {
-      // setup the server...
-      String url = "http://localhost:" + port + context;
-      CommonsHttpSolrServer s = new CommonsHttpSolrServer(url);
-      s.setConnectionTimeout(100); // 1/10th sec
-      s.setDefaultMaxConnectionsPerHost(100);
-      s.setMaxTotalConnections(100);
-      return s;
-    } catch (Exception ex) {
-      throw new RuntimeException(ex);
-    }
-  }
 
   protected HttpMethodBase getSelectMethod(String method) {
     CommonsHttpSolrServer httpserver = (CommonsHttpSolrServer)getSolrServer();



Mime
View raw message