mirror of https://github.com/apache/lucene.git
use junit plain formatter by default, log start + end of tests
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@819413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
250924d72e
commit
9989774d33
|
@ -400,7 +400,7 @@
|
||||||
<jvmarg line="${args}"/>
|
<jvmarg line="${args}"/>
|
||||||
<formatter type="brief" usefile="false" if="junit.details"/>
|
<formatter type="brief" usefile="false" if="junit.details"/>
|
||||||
<classpath refid="test.run.classpath"/>
|
<classpath refid="test.run.classpath"/>
|
||||||
<formatter type="xml"/>
|
<formatter type="${junit.formatter}"/>
|
||||||
<batchtest fork="yes" todir="${junit.output.dir}" if="runall">
|
<batchtest fork="yes" todir="${junit.output.dir}" if="runall">
|
||||||
<fileset dir="src/test" includes="${junit.includes}"/>
|
<fileset dir="src/test" includes="${junit.includes}"/>
|
||||||
</batchtest>
|
</batchtest>
|
||||||
|
|
|
@ -102,6 +102,7 @@
|
||||||
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
|
<property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
|
||||||
<property name="junit.output.dir" location="${common.dir}/${dest}/test-results"/>
|
<property name="junit.output.dir" location="${common.dir}/${dest}/test-results"/>
|
||||||
<property name="junit.reports" location="${common.dir}/${dest}/test-results/reports"/>
|
<property name="junit.reports" location="${common.dir}/${dest}/test-results/reports"/>
|
||||||
|
<property name="junit.formatter" value="plain"/>
|
||||||
|
|
||||||
<!-- Maven properties -->
|
<!-- Maven properties -->
|
||||||
<property name="maven.build.dir" value="${basedir}/build/maven"/>
|
<property name="maven.build.dir" value="${basedir}/build/maven"/>
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.apache.solr.request.*;
|
||||||
import org.apache.solr.util.TestHarness;
|
import org.apache.solr.util.TestHarness;
|
||||||
|
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.slf4j.Logger;
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
import javax.xml.xpath.XPathExpressionException;
|
import javax.xml.xpath.XPathExpressionException;
|
||||||
|
|
||||||
|
@ -95,26 +97,53 @@ public abstract class AbstractSolrTestCase extends TestCase {
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static Logger log = LoggerFactory.getLogger(AbstractSolrTestCase.class);
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
log.info("####SETUP_START " + getName());
|
||||||
dataDir = new File(System.getProperty("java.io.tmpdir")
|
dataDir = new File(System.getProperty("java.io.tmpdir")
|
||||||
+ System.getProperty("file.separator")
|
+ System.getProperty("file.separator")
|
||||||
+ getClass().getName() + "-" + System.currentTimeMillis());
|
+ getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
dataDir.mkdirs();
|
dataDir.mkdirs();
|
||||||
|
|
||||||
solrConfig = h.createConfig(getSolrConfigFile());
|
String configFile = getSolrConfigFile();
|
||||||
h = new TestHarness( dataDir.getAbsolutePath(),
|
if (configFile != null) {
|
||||||
solrConfig,
|
|
||||||
getSchemaFile());
|
solrConfig = h.createConfig(getSolrConfigFile());
|
||||||
lrf = h.getRequestFactory
|
h = new TestHarness( dataDir.getAbsolutePath(),
|
||||||
("standard",0,20,"version","2.2");
|
solrConfig,
|
||||||
|
getSchemaFile());
|
||||||
|
lrf = h.getRequestFactory
|
||||||
|
("standard",0,20,"version","2.2");
|
||||||
|
}
|
||||||
|
log.info("####SETUP_END " + getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Subclasses that override setUp can optionally call this method
|
||||||
|
* to log the fact that their setUp process has ended.
|
||||||
|
*/
|
||||||
|
public void postSetUp() {
|
||||||
|
log.info("####POSTSETUP " + getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Subclasses that override tearDown can optionally call this method
|
||||||
|
* to log the fact that the tearDown process has started. This is necessary
|
||||||
|
* since subclasses will want to call super.tearDown() at the *end* of their
|
||||||
|
* tearDown method.
|
||||||
|
*/
|
||||||
|
public void preTearDown() {
|
||||||
|
log.info("####PRETEARDOWN " + getName());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shuts down the test harness, and makes the best attempt possible
|
* Shuts down the test harness, and makes the best attempt possible
|
||||||
* to delete dataDir, unless the system property "solr.test.leavedatadir"
|
* to delete dataDir, unless the system property "solr.test.leavedatadir"
|
||||||
* is set.
|
* is set.
|
||||||
*/
|
*/
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
|
log.info("####TEARDOWN_START " + getName());
|
||||||
if (h != null) { h.close(); }
|
if (h != null) { h.close(); }
|
||||||
String skip = System.getProperty("solr.test.leavedatadir");
|
String skip = System.getProperty("solr.test.leavedatadir");
|
||||||
if (null != skip && 0 != skip.trim().length()) {
|
if (null != skip && 0 != skip.trim().length()) {
|
||||||
|
|
|
@ -44,7 +44,15 @@ import junit.framework.TestCase;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since solr 1.3
|
* @since solr 1.3
|
||||||
*/
|
*/
|
||||||
public class TestDistributedSearch extends TestCase {
|
public class TestDistributedSearch extends AbstractSolrTestCase {
|
||||||
|
public String getSchemaFile() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSolrConfigFile() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static Random r = new Random(0);
|
static Random r = new Random(0);
|
||||||
File testDir;
|
File testDir;
|
||||||
|
|
||||||
|
@ -75,22 +83,24 @@ public class TestDistributedSearch extends TestCase {
|
||||||
String missingField="missing_but_valid_field_t";
|
String missingField="missing_but_valid_field_t";
|
||||||
String invalidField="invalid_field_not_in_schema";
|
String invalidField="invalid_field_not_in_schema";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override public void setUp() throws Exception
|
@Override public void setUp() throws Exception
|
||||||
{
|
{
|
||||||
|
super.setUp();
|
||||||
System.setProperty("solr.test.sys.prop1", "propone");
|
System.setProperty("solr.test.sys.prop1", "propone");
|
||||||
System.setProperty("solr.test.sys.prop2", "proptwo");
|
System.setProperty("solr.test.sys.prop2", "proptwo");
|
||||||
testDir = new File(System.getProperty("java.io.tmpdir")
|
testDir = new File(System.getProperty("java.io.tmpdir")
|
||||||
+ System.getProperty("file.separator")
|
+ System.getProperty("file.separator")
|
||||||
+ getClass().getName() + "-" + System.currentTimeMillis());
|
+ getClass().getName() + "-" + System.currentTimeMillis());
|
||||||
testDir.mkdirs();
|
testDir.mkdirs();
|
||||||
|
super.postSetUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void tearDown() throws Exception
|
@Override public void tearDown() throws Exception
|
||||||
{
|
{
|
||||||
|
super.preTearDown();
|
||||||
destroyServers();
|
destroyServers();
|
||||||
AbstractSolrTestCase.recurseDelete(testDir);
|
AbstractSolrTestCase.recurseDelete(testDir);
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,15 @@ import java.net.URL;
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
* @since 1.4
|
* @since 1.4
|
||||||
*/
|
*/
|
||||||
public class TestReplicationHandler extends TestCase {
|
public class TestReplicationHandler extends AbstractSolrTestCase {
|
||||||
|
public String getSchemaFile() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSolrConfigFile() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private static final String CONF_DIR = "." + File.separator + "solr" + File.separator + "conf" + File.separator;
|
private static final String CONF_DIR = "." + File.separator + "solr" + File.separator + "conf" + File.separator;
|
||||||
private static final String SLAVE_CONFIG = CONF_DIR + "solrconfig-slave.xml";
|
private static final String SLAVE_CONFIG = CONF_DIR + "solrconfig-slave.xml";
|
||||||
|
@ -51,7 +59,9 @@ public class TestReplicationHandler extends TestCase {
|
||||||
|
|
||||||
String context = "/solr";
|
String context = "/solr";
|
||||||
|
|
||||||
|
|
||||||
public void setUp() throws Exception {
|
public void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
master = new SolrInstance("master", null);
|
master = new SolrInstance("master", null);
|
||||||
master.setUp();
|
master.setUp();
|
||||||
masterJetty = createJetty(master);
|
masterJetty = createJetty(master);
|
||||||
|
@ -65,10 +75,12 @@ public class TestReplicationHandler extends TestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tearDown() throws Exception {
|
public void tearDown() throws Exception {
|
||||||
|
super.preTearDown();
|
||||||
masterJetty.stop();
|
masterJetty.stop();
|
||||||
slaveJetty.stop();
|
slaveJetty.stop();
|
||||||
master.tearDown();
|
master.tearDown();
|
||||||
slave.tearDown();
|
slave.tearDown();
|
||||||
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JettySolrRunner createJetty(SolrInstance instance) throws Exception {
|
private JettySolrRunner createJetty(SolrInstance instance) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue