lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yo...@apache.org
Subject svn commit: r819413 - in /lucene/solr/trunk: build.xml common-build.xml src/java/org/apache/solr/util/AbstractSolrTestCase.java src/test/org/apache/solr/TestDistributedSearch.java src/test/org/apache/solr/handler/TestReplicationHandler.java
Date Sun, 27 Sep 2009 21:39:04 GMT
Author: yonik
Date: Sun Sep 27 21:39:03 2009
New Revision: 819413

URL: http://svn.apache.org/viewvc?rev=819413&view=rev
Log:
use junit plain formatter by default, log start + end of tests

Modified:
    lucene/solr/trunk/build.xml
    lucene/solr/trunk/common-build.xml
    lucene/solr/trunk/src/java/org/apache/solr/util/AbstractSolrTestCase.java
    lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java
    lucene/solr/trunk/src/test/org/apache/solr/handler/TestReplicationHandler.java

Modified: lucene/solr/trunk/build.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/build.xml?rev=819413&r1=819412&r2=819413&view=diff
==============================================================================
--- lucene/solr/trunk/build.xml (original)
+++ lucene/solr/trunk/build.xml Sun Sep 27 21:39:03 2009
@@ -400,7 +400,7 @@
       <jvmarg line="${args}"/>
       <formatter type="brief" usefile="false" if="junit.details"/>
       <classpath refid="test.run.classpath"/>
-      <formatter type="xml"/>
+      <formatter type="${junit.formatter}"/>
       <batchtest fork="yes" todir="${junit.output.dir}" if="runall">
         <fileset dir="src/test" includes="${junit.includes}"/>
       </batchtest>

Modified: lucene/solr/trunk/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/common-build.xml?rev=819413&r1=819412&r2=819413&view=diff
==============================================================================
--- lucene/solr/trunk/common-build.xml (original)
+++ lucene/solr/trunk/common-build.xml Sun Sep 27 21:39:03 2009
@@ -102,6 +102,7 @@
   <property name="junit.includes" value="**/Test*.java,**/*Test.java"/>
   <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.formatter" value="plain"/>
 
   <!-- Maven properties -->
   <property name="maven.build.dir" value="${basedir}/build/maven"/>

Modified: lucene/solr/trunk/src/java/org/apache/solr/util/AbstractSolrTestCase.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/util/AbstractSolrTestCase.java?rev=819413&r1=819412&r2=819413&view=diff
==============================================================================
--- lucene/solr/trunk/src/java/org/apache/solr/util/AbstractSolrTestCase.java (original)
+++ lucene/solr/trunk/src/java/org/apache/solr/util/AbstractSolrTestCase.java Sun Sep 27 21:39:03
2009
@@ -28,6 +28,8 @@
 import org.apache.solr.util.TestHarness;
 
 import org.xml.sax.SAXException;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Logger;
 import junit.framework.TestCase;
 import javax.xml.xpath.XPathExpressionException;
 
@@ -95,26 +97,53 @@
    * </ul>
    *
    */
+
+  public static Logger log = LoggerFactory.getLogger(AbstractSolrTestCase.class);
+
   public void setUp() throws Exception {
+    log.info("####SETUP_START " + getName());
     dataDir = new File(System.getProperty("java.io.tmpdir")
-        + System.getProperty("file.separator")
-        + getClass().getName() + "-" + System.currentTimeMillis());
+            + System.getProperty("file.separator")
+            + getClass().getName() + "-" + System.currentTimeMillis());
     dataDir.mkdirs();
-        
-    solrConfig = h.createConfig(getSolrConfigFile());
-    h = new TestHarness( dataDir.getAbsolutePath(),
-                    solrConfig,
-                    getSchemaFile());
-    lrf = h.getRequestFactory
-      ("standard",0,20,"version","2.2");
+
+    String configFile = getSolrConfigFile();
+    if (configFile != null) {
+
+      solrConfig = h.createConfig(getSolrConfigFile());
+      h = new TestHarness( dataDir.getAbsolutePath(),
+              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
    * to delete dataDir, unless the system property "solr.test.leavedatadir"
    * is set.
    */
   public void tearDown() throws Exception {
+    log.info("####TEARDOWN_START " + getName());
     if (h != null) { h.close(); }
     String skip = System.getProperty("solr.test.leavedatadir");
     if (null != skip && 0 != skip.trim().length()) {

Modified: lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java?rev=819413&r1=819412&r2=819413&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/TestDistributedSearch.java Sun Sep 27 21:39:03
2009
@@ -44,7 +44,15 @@
  * @version $Id$
  * @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);
   File testDir;
   
@@ -75,22 +83,24 @@
   String missingField="missing_but_valid_field_t";
   String invalidField="invalid_field_not_in_schema";
 
-
-
   @Override public void setUp() throws Exception
   {
+    super.setUp();
     System.setProperty("solr.test.sys.prop1", "propone");
     System.setProperty("solr.test.sys.prop2", "proptwo");
     testDir = new File(System.getProperty("java.io.tmpdir")
         + System.getProperty("file.separator")
         + getClass().getName() + "-" + System.currentTimeMillis());
     testDir.mkdirs();
+    super.postSetUp();
   }
 
   @Override public void tearDown() throws Exception
   {
+    super.preTearDown();
     destroyServers();
     AbstractSolrTestCase.recurseDelete(testDir);
+    super.tearDown();
   }
 
 

Modified: lucene/solr/trunk/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/solr/trunk/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=819413&r1=819412&r2=819413&view=diff
==============================================================================
--- lucene/solr/trunk/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/solr/trunk/src/test/org/apache/solr/handler/TestReplicationHandler.java Sun Sep
27 21:39:03 2009
@@ -40,7 +40,15 @@
  * @version $Id$
  * @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 SLAVE_CONFIG = CONF_DIR + "solrconfig-slave.xml";
@@ -51,7 +59,9 @@
 
   String context = "/solr";
 
+
   public void setUp() throws Exception {
+    super.setUp();    
     master = new SolrInstance("master", null);
     master.setUp();
     masterJetty = createJetty(master);
@@ -65,10 +75,12 @@
 
   @Override
   public void tearDown() throws Exception {
+    super.preTearDown();
     masterJetty.stop();
     slaveJetty.stop();
     master.tearDown();
     slave.tearDown();
+    super.tearDown();
   }
 
   private JettySolrRunner createJetty(SolrInstance instance) throws Exception {



Mime
View raw message