From 933ebe5522c3df9c7fb49bbd5aa9d4b9299703d3 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Tue, 19 Oct 2010 16:29:22 +0000 Subject: [PATCH] tests: convert to junit4 git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1024312 13f79535-47bb-0310-9956-ffa450edef68 --- .../handler/XmlUpdateRequestHandlerTest.java | 28 ++++++++----------- .../handler/component/SearchHandlerTest.java | 14 +++++++--- .../solr/schema/NotRequiredUniqueKeyTest.java | 21 ++++++-------- 3 files changed, 29 insertions(+), 34 deletions(-) diff --git a/solr/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java b/solr/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java index e7ce40663ba..4b681823b9e 100644 --- a/solr/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java +++ b/solr/src/test/org/apache/solr/handler/XmlUpdateRequestHandlerTest.java @@ -16,7 +16,7 @@ */ package org.apache.solr.handler; -import org.apache.solr.util.AbstractSolrTestCase; +import org.apache.solr.SolrTestCaseJ4; import java.io.StringReader; import java.util.Collection; @@ -24,26 +24,20 @@ import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamReader; import org.apache.solr.common.SolrInputDocument; +import org.junit.BeforeClass; +import org.junit.Test; -public class XmlUpdateRequestHandlerTest extends AbstractSolrTestCase -{ - private XMLInputFactory inputFactory = XMLInputFactory.newInstance(); - protected XmlUpdateRequestHandler handler; +public class XmlUpdateRequestHandlerTest extends SolrTestCaseJ4 { + private static XMLInputFactory inputFactory = XMLInputFactory.newInstance(); + protected static XmlUpdateRequestHandler handler; -@Override public String getSchemaFile() { return "schema.xml"; } -@Override public String getSolrConfigFile() { return "solrconfig.xml"; } - - @Override - public void setUp() throws Exception { - super.setUp(); + @BeforeClass + public static void beforeTests() throws Exception { + initCore("solrconfig.xml","schema.xml"); handler = new XmlUpdateRequestHandler(); } - - @Override - public void tearDown() throws Exception { - super.tearDown(); - } - + + @Test public void testReadDoc() throws Exception { String xml = diff --git a/solr/src/test/org/apache/solr/handler/component/SearchHandlerTest.java b/solr/src/test/org/apache/solr/handler/component/SearchHandlerTest.java index a1d645f3604..bd8641da434 100644 --- a/solr/src/test/org/apache/solr/handler/component/SearchHandlerTest.java +++ b/solr/src/test/org/apache/solr/handler/component/SearchHandlerTest.java @@ -20,17 +20,23 @@ package org.apache.solr.handler.component; import java.util.ArrayList; import java.util.List; +import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.common.util.NamedList; import org.apache.solr.core.SolrCore; -import org.apache.solr.util.AbstractSolrTestCase; +import org.junit.BeforeClass; +import org.junit.Test; -public class SearchHandlerTest extends AbstractSolrTestCase +public class SearchHandlerTest extends SolrTestCaseJ4 { - @Override public String getSchemaFile() { return "schema.xml"; } - @Override public String getSolrConfigFile() { return "solrconfig.xml"; } + @BeforeClass + public static void beforeTests() throws Exception { + initCore("solrconfig.xml","schema.xml"); + } + @SuppressWarnings("unchecked") + @Test public void testInitalization() { SolrCore core = h.getCore(); diff --git a/solr/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java b/solr/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java index 609d0e1e599..d1db5512355 100644 --- a/solr/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java +++ b/solr/src/test/org/apache/solr/schema/NotRequiredUniqueKeyTest.java @@ -17,9 +17,12 @@ package org.apache.solr.schema; +import org.apache.solr.SolrTestCaseJ4; import org.apache.solr.core.SolrCore; import org.apache.solr.schema.SchemaField; import org.apache.solr.util.AbstractSolrTestCase; +import org.junit.BeforeClass; +import org.junit.Test; /** * This is a simple test to make sure the unique key is not required @@ -27,22 +30,14 @@ import org.apache.solr.util.AbstractSolrTestCase; * * It needs its own file so it can load a special schema file */ -public class NotRequiredUniqueKeyTest extends AbstractSolrTestCase { +public class NotRequiredUniqueKeyTest extends SolrTestCaseJ4 { - @Override public String getSchemaFile() { return "schema-not-required-unique-key.xml"; } - @Override public String getSolrConfigFile() { return "solrconfig.xml"; } - - @Override - public void setUp() throws Exception { - super.setUp(); - } - - @Override - public void tearDown() throws Exception { - super.tearDown(); + @BeforeClass + public static void beforeTests() throws Exception { + initCore("solrconfig.xml","schema-not-required-unique-key.xml"); } - + @Test public void testSchemaLoading() { SolrCore core = h.getCore();