tests: convert jetty/examples to junit4

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@927647 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2010-03-26 00:04:34 +00:00
parent 604c7c220e
commit eb1537e7da
4 changed files with 21 additions and 78 deletions

View File

@ -24,21 +24,24 @@ import java.util.List;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.client.solrj.response.UpdateResponse;
import org.apache.solr.common.SolrInputDocument;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* @version $Id$
* @since solr 1.3
*/
public abstract class LargeVolumeTestBase extends SolrExampleTestBase
public abstract class LargeVolumeTestBase extends SolrJettyTestBase
{
SolrServer gserver = null;
// for real load testing, make these numbers bigger
static final int numdocs = 100; //1000 * 1000;
static final int threadCount = 5;
@Test
public void testMultiThreaded() throws Exception {
gserver = this.getSolrServer();
SolrServer gserver = this.getSolrServer();
gserver.deleteByQuery( "*:*" ); // delete everything!
DocThread[] threads = new DocThread[threadCount];
@ -61,6 +64,7 @@ public abstract class LargeVolumeTestBase extends SolrExampleTestBase
}
private void query(int count) throws SolrServerException, IOException {
SolrServer gserver = this.getSolrServer();
SolrQuery query = new SolrQuery("*:*");
QueryResponse response = gserver.query(query);
assertEquals(0, response.getStatus());

View File

@ -20,6 +20,7 @@ import org.apache.solr.client.solrj.LargeVolumeTestBase;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.junit.BeforeClass;
/**
* @version $Id$
@ -28,34 +29,9 @@ import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
* @since solr 1.4
*/
public class LargeVolumeBinaryJettyTest extends LargeVolumeTestBase {
SolrServer server;
JettySolrRunner jetty;
int port = 0;
static final String context = "/example";
@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;
@BeforeClass
public static void beforeTest() throws Exception {
createJetty(EXAMPLE_HOME, null, null);
}
@Override

View File

@ -19,27 +19,16 @@ package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.LargeVolumeTestBase;
import org.apache.solr.client.solrj.SolrServer;
import org.junit.BeforeClass;
/**
* @version $Id$
* @since solr 1.3
*/
public class LargeVolumeEmbeddedTest extends LargeVolumeTestBase {
SolrServer server;
@Override public void setUp() throws Exception
{
super.setUp();
// setup the server...
server = createNewSolrServer();
}
@Override
protected SolrServer getSolrServer()
{
return server;
@BeforeClass
public static void beforeTest() throws Exception {
initCore(EXAMPLE_CONFIG, EXAMPLE_SCHEMA, EXAMPLE_HOME);
}
@Override

View File

@ -20,42 +20,16 @@ package org.apache.solr.client.solrj.embedded;
import org.apache.solr.client.solrj.LargeVolumeTestBase;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.impl.CommonsHttpSolrServer;
import org.junit.BeforeClass;
/**
* @version $Id$
* @since solr 1.3
*/
public class LargeVolumeJettyTest extends LargeVolumeTestBase {
SolrServer server;
JettySolrRunner jetty;
int port = 0;
static final String context = "/example";
@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;
@BeforeClass
public static void beforeTest() throws Exception {
createJetty(EXAMPLE_HOME, null, null);
}
@Override