lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r927655 - in /lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj: TestBatchUpdate.java embedded/SolrExampleStreamingTest.java
Date Fri, 26 Mar 2010 00:49:55 GMT
Author: yonik
Date: Fri Mar 26 00:49:55 2010
New Revision: 927655

URL: http://svn.apache.org/viewvc?rev=927655&view=rev
Log:
tests: convert jetty/examples to junit4

Modified:
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
    lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java

Modified: lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java?rev=927655&r1=927654&r2=927655&view=diff
==============================================================================
--- lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java (original)
+++ lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java Fri Mar
26 00:49:55 2010
@@ -16,16 +16,19 @@
  */
 package org.apache.solr.client.solrj;
 
-import org.apache.solr.client.solrj.embedded.JettySolrRunner;
-import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
+import org.apache.solr.client.solrj.beans.Field;
 import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
-import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
 import org.apache.solr.client.solrj.request.RequestWriter;
-import org.apache.solr.client.solrj.beans.Field;
+import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.common.SolrInputDocument;
+import org.junit.BeforeClass;
+import org.junit.Test;
 
-import java.util.Iterator;
 import java.io.IOException;
+import java.util.Iterator;
+
+import static org.junit.Assert.assertEquals;
 
 /**
  * Test for SOLR-1038
@@ -33,15 +36,17 @@ import java.io.IOException;
  * @since solr 1.4
  * @version $Id$
  */
-public class TestBatchUpdate extends SolrExampleTestBase {
-  static final int numdocs = 1000;
+public class TestBatchUpdate extends SolrJettyTestBase {
+
+  @BeforeClass
+  public static void beforeTest() throws Exception {
+    createJetty(EXAMPLE_HOME, null, null);
+  }
 
-  SolrServer server;
-  JettySolrRunner jetty;
+  static final int numdocs = 1000;  
 
-  int port = 0;
-  static final String context = "/example";
 
+  @Test
   public void testWithXml() throws Exception {
     CommonsHttpSolrServer commonsHttpSolrServer = (CommonsHttpSolrServer) getSolrServer();
     commonsHttpSolrServer.setRequestWriter(new RequestWriter());
@@ -49,6 +54,7 @@ public class TestBatchUpdate extends Sol
     doIt(commonsHttpSolrServer);
   }
 
+  @Test
   public void testWithBinary()throws Exception{
     CommonsHttpSolrServer commonsHttpSolrServer = (CommonsHttpSolrServer) getSolrServer();
     commonsHttpSolrServer.setRequestWriter(new BinaryRequestWriter());
@@ -56,6 +62,7 @@ public class TestBatchUpdate extends Sol
     doIt(commonsHttpSolrServer);
   }
 
+  @Test
   public void testWithBinaryBean()throws Exception{
     CommonsHttpSolrServer commonsHttpSolrServer = (CommonsHttpSolrServer) getSolrServer();
     commonsHttpSolrServer.setRequestWriter(new BinaryRequestWriter());
@@ -120,44 +127,4 @@ public class TestBatchUpdate extends Sol
     assertEquals(0, response.getStatus());
     assertEquals(numdocs, response.getResults().getNumFound());
   }
-
-  @Override public void setUp() throws Exception
-  {
-    super.setUp();
-
-    jetty = new JettySolrRunner( context, 0 );
-    jetty.start();
-    port = jetty.getLocalPort();
-
-    server = this.createNewSolrServer();
-  }
-
-  @Override public void tearDown() throws Exception
-  {
-    super.tearDown();
-    jetty.stop();  // stop the server
-  }
-
-  @Override
-  protected SolrServer getSolrServer()
-  {
-    return server;
-  }
-
-  @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/SolrExampleStreamingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java?rev=927655&r1=927654&r2=927655&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:49:55 2010
@@ -44,7 +44,7 @@ public class SolrExampleStreamingTest ex
       CommonsHttpSolrServer s = new StreamingUpdateSolrServer( url, 2, 5 ) {
         @Override
         public void handleError(Throwable ex) {
-          // do somethign...
+          // do something...    TODO?
         }
       };
       s.setConnectionTimeout(100); // 1/10th sec



Mime
View raw message