lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1503797 [18/19] - in /lucene/dev/branches/lucene3069: ./ dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/idea/lucene/suggest/ dev-tools/idea/solr/contrib/dataimporthandler/ dev-tools/idea/solr/core/src/test/ dev-tools/maven/ dev-tools...
Date Tue, 16 Jul 2013 17:00:18 GMT
Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig-slave1.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig-slave1.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig-slave1.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig-slave1.xml Tue Jul 16 17:00:05 2013
@@ -19,11 +19,12 @@
 
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+  <indexConfig>
+    <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+  </indexConfig>
   <dataDir>${solr.data.dir:}</dataDir>
   <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
 
-  <!-- <indexConfig> section could go here, but we want the defaults -->
-
   <updateHandler class="solr.DirectUpdateHandler2">
   </updateHandler>
 

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/collection1/conf/solrconfig.xml Tue Jul 16 17:00:05 2013
@@ -22,6 +22,9 @@
 -->
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+  <indexConfig>
+    <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+  </indexConfig>
    <dataDir>${solr.data.dir:}</dataDir>
   <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
 

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/conf/solrconfig.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/conf/solrconfig.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/conf/solrconfig.xml Tue Jul 16 17:00:05 2013
@@ -22,6 +22,9 @@
 -->
 <config>
   <luceneMatchVersion>${tests.luceneMatchVersion:LUCENE_CURRENT}</luceneMatchVersion>
+  <indexConfig>
+    <useCompoundFile>${useCompoundFile:false}</useCompoundFile>
+  </indexConfig>
   <dataDir>${tempDir}/data/${l10n:}-${version:}</dataDir>
   <directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.RAMDirectoryFactory}"/>
 

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/solr.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/solr.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/shared/solr.xml Tue Jul 16 17:00:05 2013
@@ -22,7 +22,7 @@
   persistent: Save changes made via the API to this file
   sharedLib: path to a lib directory that will be shared across all cores
 -->
-<solr persistent="true">
+<solr persistent="false">
   <property name="version" value="1.3"/>
   <property name="lang" value="english, french"/>
 
@@ -30,7 +30,7 @@
   adminPath: RequestHandler path to manage cores.  
     If 'null' (or absent), cores will not be manageable via REST
   -->
-  <cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000">
+  <cores adminPath="/admin/cores" defaultCoreName="core0" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
     <core name="collection1" instanceDir="." />
     <core name="core0" instanceDir="${theInstanceDir:./}" dataDir="${dataDir1}" collection="${collection:acollection}">
       <property name="version" value="3.5"/>

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test-files/solrj/solr/solr.xml Tue Jul 16 17:00:05 2013
@@ -28,7 +28,7 @@
   adminPath: RequestHandler path to manage cores.  
     If 'null' (or absent), cores will not be manageable via request handler
   -->
-  <cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" numShards="${numShards:3}">
+  <cores adminPath="/admin/cores" defaultCoreName="collection1" host="127.0.0.1" hostPort="${hostPort:8983}" hostContext="${hostContext:solr}" zkClientTimeout="8000" genericCoreNodeNames="${genericCoreNodeNames:true}">
     <core name="collection1" instanceDir="collection1" shard="${shard:}" collection="${collection:collection1}" config="${solrconfig:solrconfig.xml}" schema="${schema:schema.xml}"/>
   </cores>
 </solr>

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MergeIndexesExampleTestBase.java Tue Jul 16 17:00:05 2013
@@ -17,10 +17,6 @@
 
 package org.apache.solr.client.solrj;
 
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.request.AbstractUpdateRequest;
 import org.apache.solr.client.solrj.request.CoreAdminRequest;
@@ -32,9 +28,12 @@ import org.apache.solr.common.params.Sol
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.util.ExternalPaths;
-import org.junit.AfterClass;
 import org.junit.BeforeClass;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+
 /**
  * Abstract base class for testing merge indexes command
  *
@@ -42,7 +41,8 @@ import org.junit.BeforeClass;
  *
  */
 public abstract class MergeIndexesExampleTestBase extends SolrExampleTestBase {
-  protected static CoreContainer cores;
+
+  protected CoreContainer cores;
   private String saveProp;
   private File dataDir2;
 
@@ -56,13 +56,12 @@ public abstract class MergeIndexesExampl
     if (dataDir == null) {
       createTempDir();
     }
-    cores = new CoreContainer();
   }
-  
-  @AfterClass
-  public static void afterClass() {
-    cores.shutdown();
-    cores = null;
+
+  protected void setupCoreContainer() {
+    cores = new CoreContainer(getSolrHome());
+    cores.load();
+    //cores = CoreContainer.createAndLoad(getSolrHome(), new File(TEMP_DIR, "solr.xml"));
   }
   
   @Override
@@ -71,17 +70,19 @@ public abstract class MergeIndexesExampl
     System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
     super.setUp();
 
-    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
-    cores.setPersistent(false);
-    
     // setup datadirs
-    System.setProperty( "solr.core0.data.dir", SolrTestCaseJ4.dataDir.getCanonicalPath() ); 
-    
+    System.setProperty( "solr.core0.data.dir", SolrTestCaseJ4.dataDir.getCanonicalPath() );
+
     dataDir2 = new File(TEMP_DIR, getClass().getName() + "-"
         + System.currentTimeMillis());
     dataDir2.mkdirs();
-    
-    System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() ); 
+
+    System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
+
+    setupCoreContainer();
+    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
+    cores.setPersistent(false);
+
   }
 
   @Override
@@ -96,6 +97,8 @@ public abstract class MergeIndexesExampl
         System.err.println("!!!! WARNING: best effort to remove " + dataDir2.getAbsolutePath() + " FAILED !!!!!");
       }
     }
+
+    cores.shutdown();
     
     if (saveProp == null) System.clearProperty("solr.directoryFactory");
     else System.setProperty("solr.directoryFactory", saveProp);

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/MultiCoreExampleTestBase.java Tue Jul 16 17:00:05 2013
@@ -17,8 +17,6 @@
 
 package org.apache.solr.client.solrj;
 
-import java.io.File;
-
 import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION;
 import org.apache.solr.client.solrj.request.CoreAdminRequest;
 import org.apache.solr.client.solrj.request.CoreAdminRequest.Unload;
@@ -30,10 +28,10 @@ import org.apache.solr.common.util.Named
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.util.ExternalPaths;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.File;
+
 
 /**
  *
@@ -41,30 +39,21 @@ import org.junit.Test;
  */
 public abstract class MultiCoreExampleTestBase extends SolrExampleTestBase 
 {
-  protected static CoreContainer cores;
+  protected CoreContainer cores;
 
   private File dataDir2;
   private File dataDir1;
 
   @Override public String getSolrHome() { return ExternalPaths.EXAMPLE_MULTICORE_HOME; }
 
-  
-  @BeforeClass
-  public static void beforeThisClass2() throws Exception {
+  protected void setupCoreContainer() {
     cores = new CoreContainer();
-  }
-  
-  @AfterClass
-  public static void afterClass() {
-    cores.shutdown();
+    cores.load();
   }
   
   @Override public void setUp() throws Exception {
     super.setUp();
 
-    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
-    cores.setPersistent(false);
-    
     dataDir1 = new File(TEMP_DIR, getClass().getName() + "-core0-"
         + System.currentTimeMillis());
     dataDir1.mkdirs();
@@ -74,7 +63,14 @@ public abstract class MultiCoreExampleTe
     dataDir2.mkdirs();
     
     System.setProperty( "solr.core0.data.dir", this.dataDir1.getCanonicalPath() ); 
-    System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() ); 
+    System.setProperty( "solr.core1.data.dir", this.dataDir2.getCanonicalPath() );
+
+    setupCoreContainer();
+
+    SolrCore.log.info("CORES=" + cores + " : " + cores.getCoreNames());
+    cores.setPersistent(false);
+
+
   }
   
   @Override
@@ -89,6 +85,8 @@ public abstract class MultiCoreExampleTe
         System.err.println("!!!! WARNING: best effort to remove " + dataDir2.getAbsolutePath() + " FAILED !!!!!");
       }
     }
+
+    cores.shutdown();
   }
 
   @Override

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Tue Jul 16 17:00:05 2013
@@ -31,6 +31,7 @@ import java.util.concurrent.atomic.Atomi
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
+
 import junit.framework.Assert;
 
 import org.apache.lucene.util._TestUtil;
@@ -209,6 +210,17 @@ abstract public class SolrExampleTests e
     Assert.assertEquals("price:[* TO 2]", values.get(0));
     Assert.assertEquals("price:[2 TO 4]", values.get(1));
     
+    
+    if (jetty != null) {
+      // check system wide system handler + "/admin/info/system"
+      String url = jetty.getBaseUrl().toString();
+      HttpSolrServer client = new HttpSolrServer(url);
+      SolrQuery q = new SolrQuery();
+      q.set("qt", "/admin/info/system");
+      QueryResponse rsp = client.query(q);
+      assertNotNull(rsp.getResponse().get("mode"));
+      assertNotNull(rsp.getResponse().get("lucene"));
+    }
   }
 
 

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/AbstractEmbeddedSolrServerTestCase.java Tue Jul 16 17:00:05 2013
@@ -51,6 +51,7 @@ public abstract class AbstractEmbeddedSo
     super.setUp();
 
     System.setProperty("solr.solr.home", SOLR_HOME.getAbsolutePath());
+    System.out.println("Solr home: " + SOLR_HOME.getAbsolutePath());
 
     //The index is always stored within a temporary directory
     createTempDir();
@@ -61,7 +62,8 @@ public abstract class AbstractEmbeddedSo
     System.setProperty("dataDir2", dataDir2.getAbsolutePath());
     System.setProperty("tempDir", tempDir.getAbsolutePath());
     System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
-    cores = new CoreContainer(SOLR_HOME.getAbsolutePath(), getSolrXml());
+    cores = CoreContainer.createAndLoad(SOLR_HOME.getAbsolutePath(), getSolrXml());
+    //cores.setPersistent(false);
   }
   
   protected abstract File getSolrXml() throws Exception;

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MergeIndexesEmbeddedTest.java Tue Jul 16 17:00:05 2013
@@ -17,8 +17,6 @@
 
 package org.apache.solr.client.solrj.embedded;
 
-import java.io.File;
-
 import org.apache.solr.client.solrj.MergeIndexesExampleTestBase;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.core.SolrCore;
@@ -36,10 +34,6 @@ public class MergeIndexesEmbeddedTest ex
     // TODO: fix this test to use MockDirectoryFactory
     System.clearProperty("solr.directoryFactory");
     super.setUp();
-
-    File home = new File(getSolrHome());
-    File f = new File(home, "solr.xml");
-    cores.load(getSolrHome(), f);
   }
 
   @Override

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/MultiCoreEmbeddedTest.java Tue Jul 16 17:00:05 2013
@@ -17,8 +17,6 @@
 
 package org.apache.solr.client.solrj.embedded;
 
-import java.io.File;
-
 import org.apache.solr.client.solrj.MultiCoreExampleTestBase;
 import org.apache.solr.client.solrj.SolrServer;
 
@@ -35,10 +33,6 @@ public class MultiCoreEmbeddedTest exten
     // TODO: fix this test to use MockDirectoryFactory
     System.clearProperty("solr.directoryFactory");
     super.setUp();
-    
-    File home = new File( getSolrHome() );
-    File f = new File( home, "solr.xml" );
-    cores.load( getSolrHome(), f );
   }
 
   @Override

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/TestSolrProperties.java Tue Jul 16 17:00:05 2013
@@ -17,36 +17,26 @@
 
 package org.apache.solr.client.solrj.embedded;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.*;
-
-import org.apache.commons.io.IOUtils;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.request.AbstractUpdateRequest.ACTION;
-import org.apache.solr.client.solrj.request.*;
+import org.apache.solr.client.solrj.request.CoreAdminRequest;
+import org.apache.solr.client.solrj.request.QueryRequest;
+import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.CoreAdminResponse;
 import org.apache.solr.common.SolrInputDocument;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.util.FileUtils;
-import org.junit.After;
-import org.junit.Before;
+import org.apache.solr.core.SolrXMLCoresLocator;
+import org.apache.solr.util.TestHarness;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
 
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import java.io.File;
 
 /**
  *
@@ -56,45 +46,14 @@ public class TestSolrProperties extends 
   protected static Logger log = LoggerFactory.getLogger(TestSolrProperties.class);
 
   private static final String SOLR_XML = "solr.xml";
-  private static final String SOLR_PERSIST_XML = "solr-persist.xml";
 
   @Rule
   public TestRule solrTestRules = 
     RuleChain.outerRule(new SystemPropertiesRestoreRule());
 
-  private static final XPathFactory xpathFactory = XPathFactory.newInstance();
-
-  @Override
-  @Before
-  public void setUp() throws Exception {
-    super.setUp();
-  }
-  
-  @Override
-  @After
-  public void tearDown() throws Exception {
-   super.tearDown(); 
-  }
-  
   @Override
   protected File getSolrXml() throws Exception {
-    //This test writes on the directory where the solr.xml is located. Better to copy the solr.xml to
-    //the temporary directory where we store the index
-    File origSolrXml = new File(SOLR_HOME, SOLR_XML);
-    File solrXml = new File(tempDir, SOLR_XML);
-    FileUtils.copyFile(origSolrXml, solrXml);
-    return solrXml;
-  }
-
-  @Override
-  protected void deleteAdditionalFiles() {
-    super.deleteAdditionalFiles();
-
-    //Cleans the solr.xml persisted while testing and the solr.xml copied to the temporary directory
-    File persistedFile = new File(tempDir, SOLR_PERSIST_XML);
-    assertTrue("Failed to delete "+persistedFile, persistedFile.delete());
-    File solrXml = new File(tempDir, SOLR_XML);
-    assertTrue("Failed to delete "+ solrXml, solrXml.delete());
+    return new File(SOLR_HOME, SOLR_XML);
   }
 
   protected SolrServer getSolrAdmin() {
@@ -107,6 +66,10 @@ public class TestSolrProperties extends 
 
   @Test
   public void testProperties() throws Exception {
+
+    SolrXMLCoresLocator.NonPersistingLocator locator
+        = (SolrXMLCoresLocator.NonPersistingLocator) cores.getCoresLocator();
+
     UpdateRequest up = new UpdateRequest();
     up.setAction(ACTION.COMMIT, true, true);
     up.deleteByQuery("*:*");
@@ -176,50 +139,22 @@ public class TestSolrProperties extends 
     long after = mcr.getStartTime(name).getTime();
     assertTrue("should have more recent time: " + after + "," + before, after > before);
 
-    mcr = CoreAdminRequest.persist(SOLR_PERSIST_XML, coreadmin);
-
-    DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-    FileInputStream fis = new FileInputStream(new File(tempDir, SOLR_PERSIST_XML));
-    try {
-      Document document = builder.parse(fis);
-      fis.close();
-      fis = new FileInputStream(new File(tempDir, SOLR_PERSIST_XML));
-      String solrPersistXml = IOUtils.toString(new InputStreamReader(fis, "UTF-8"));
-      //System.out.println("xml:" + solrPersistXml);
-      assertTrue("\"/solr/cores[@defaultCoreName='core0']\" doesn't match in:\n" + solrPersistXml,
-                 exists("/solr/cores[@defaultCoreName='core0']", document));
-      assertTrue("\"/solr/cores[@host='127.0.0.1']\" doesn't match in:\n" + solrPersistXml,
-                 exists("/solr/cores[@host='127.0.0.1']", document));
-      assertTrue("\"/solr/cores[@hostPort='${hostPort:8983}']\" doesn't match in:\n" + solrPersistXml,
-                 exists("/solr/cores[@hostPort='${hostPort:8983}']", document));
-      assertTrue("\"/solr/cores[@zkClientTimeout='8000']\" doesn't match in:\n" + solrPersistXml,
-                 exists("/solr/cores[@zkClientTimeout='8000']", document));
-      assertTrue("\"/solr/cores[@hostContext='${hostContext:solr}']\" doesn't match in:\n" + solrPersistXml,
-                 exists("/solr/cores[@hostContext='${hostContext:solr}']", document));
-      
-    } finally {
-      fis.close();
-    }
+    TestHarness.validateXPath(locator.xml,
+        "/solr/cores[@defaultCoreName='core0']",
+        "/solr/cores[@host='127.0.0.1']",
+        "/solr/cores[@hostPort='${hostPort:8983}']",
+        "/solr/cores[@zkClientTimeout='8000']",
+        "/solr/cores[@hostContext='${hostContext:solr}']",
+        "/solr/cores[@genericCoreNodeNames='${genericCoreNodeNames:true}']"
+        );
     
     CoreAdminRequest.renameCore(name, "renamed_core", coreadmin);
-    
-    mcr = CoreAdminRequest.persist(SOLR_PERSIST_XML, getRenamedSolrAdmin());
-    
-//    fis = new FileInputStream(new File(tempDir, SOLR_PERSIST_XML));
-//    String solrPersistXml = IOUtils.toString(fis);
-//    System.out.println("xml:" + solrPersistXml);
-//    fis.close();
-    
-    fis = new FileInputStream(new File(tempDir, SOLR_PERSIST_XML));
-    try {
-      Document document = builder.parse(fis);
-      assertTrue(exists("/solr/cores/core[@name='renamed_core']", document));
-      assertTrue(exists("/solr/cores/core[@instanceDir='${theInstanceDir:./}']", document));
-      assertTrue(exists("/solr/cores/core[@collection='${collection:acollection}']", document));
-      
-    } finally {
-      fis.close();
-    }
+
+    TestHarness.validateXPath(locator.xml,
+        "/solr/cores/core[@name='renamed_core']",
+        "/solr/cores/core[@instanceDir='${theInstanceDir:./}']",
+        "/solr/cores/core[@collection='${collection:acollection}']"
+        );
     
     coreadmin = getRenamedSolrAdmin();
     File dataDir = new File(tempDir,"data3");
@@ -229,49 +164,8 @@ public class TestSolrProperties extends 
         coreadmin, null, null, dataDir.getAbsolutePath(),
         tlogDir.getAbsolutePath());
 
-//    fis = new FileInputStream(new File(solrXml.getParent(), SOLR_PERSIST_XML));
-//    solrPersistXml = IOUtils.toString(fis);
-//    System.out.println("xml:" + solrPersistXml);
-//    fis.close();
-    
-    mcr = CoreAdminRequest.persist(SOLR_PERSIST_XML, getRenamedSolrAdmin());
-    
-//    fis = new FileInputStream(new File(solrXml.getParent(), SOLR_PERSIST_XML));
-//    solrPersistXml = IOUtils.toString(fis);
-//    System.out.println("xml:" + solrPersistXml);
-//    fis.close();
-    
-    fis = new FileInputStream(new File(tempDir, SOLR_PERSIST_XML));
-    try {
-      Document document = builder.parse(fis);
-      assertTrue(exists("/solr/cores/core[@name='collection1' and (@instanceDir='./' or @instanceDir='.\\')]", document));
-    } finally {
-      fis.close();
-    }
-    
-    // test reload and parse
-    cores.shutdown();
-    
-//   fis = new FileInputStream(new File(getSolrXml().getParent(),
-//   SOLR_PERSIST_XML));
-//   String solrPersistXml = IOUtils.toString(fis);
-//   System.out.println("xml:" + solrPersistXml);
-//   fis.close();
-    
-    cores = new CoreContainer(SOLR_HOME.getAbsolutePath(), new File(tempDir, SOLR_PERSIST_XML));
- 
-    mcr = CoreAdminRequest.persist(SOLR_PERSIST_XML, getRenamedSolrAdmin());
-    
-//     fis = new FileInputStream(new File(solrXml.getParent(),
-//     SOLR_PERSIST_XML));
-//     solrPersistXml = IOUtils.toString(fis);
-//     System.out.println("xml:" + solrPersistXml);
-//     fis.close();
-  }
-  
-  public static boolean exists(String xpathStr, Node node)
-      throws XPathExpressionException {
-    XPath xpath = xpathFactory.newXPath();
-    return (Boolean) xpath.evaluate(xpathStr, node, XPathConstants.BOOLEAN);
+    TestHarness.validateXPath(locator.xml, "/solr/cores/core[@name='collection1' and @instanceDir='.']");
+
   }
+
 }

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java Tue Jul 16 17:00:05 2013
@@ -102,35 +102,39 @@ public class CloudSolrServerTest extends
 
     indexr(id, 0, "a_t", "to come to the aid of their country.");
     
-    // compare leaders list
     CloudJettyRunner shard1Leader = shardToLeaderJetty.get("shard1");
     CloudJettyRunner shard2Leader = shardToLeaderJetty.get("shard2");
-    assertEquals(2, cloudClient.getLeaderUrlLists().get("collection1").size());
-    HashSet<String> leaderUrlSet = new HashSet<String>();
-    leaderUrlSet.addAll(cloudClient.getLeaderUrlLists().get("collection1"));
-    assertTrue("fail check for leader:" + shard1Leader.url + " in "
-        + leaderUrlSet, leaderUrlSet.contains(shard1Leader.url + "/"));
-    assertTrue("fail check for leader:" + shard2Leader.url + " in "
-        + leaderUrlSet, leaderUrlSet.contains(shard2Leader.url + "/"));
-
-    // compare replicas list
-    Set<String> replicas = new HashSet<String>();
-    List<CloudJettyRunner> jetties = shardToJetty.get("shard1");
-    for (CloudJettyRunner cjetty : jetties) {
-      replicas.add(cjetty.url);
-    }
-    jetties = shardToJetty.get("shard2");
-    for (CloudJettyRunner cjetty : jetties) {
-      replicas.add(cjetty.url);
-    }
-    replicas.remove(shard1Leader.url);
-    replicas.remove(shard2Leader.url);
-    
-    assertEquals(replicas.size(), cloudClient.getReplicasLists().get("collection1").size());
     
-    for (String url : cloudClient.getReplicasLists().get("collection1")) {
-      assertTrue("fail check for replica:" + url + " in " + replicas,
-          replicas.contains(stripTrailingSlash(url)));
+    if (cloudClient.isUpdatesToLeaders()) {
+      // compare leaders list
+      assertEquals(2, cloudClient.getLeaderUrlLists().get("collection1").size());
+      HashSet<String> leaderUrlSet = new HashSet<String>();
+      leaderUrlSet.addAll(cloudClient.getLeaderUrlLists().get("collection1"));
+      assertTrue("fail check for leader:" + shard1Leader.url + " in "
+          + leaderUrlSet, leaderUrlSet.contains(shard1Leader.url + "/"));
+      assertTrue("fail check for leader:" + shard2Leader.url + " in "
+          + leaderUrlSet, leaderUrlSet.contains(shard2Leader.url + "/"));
+      
+      // compare replicas list
+      Set<String> replicas = new HashSet<String>();
+      List<CloudJettyRunner> jetties = shardToJetty.get("shard1");
+      for (CloudJettyRunner cjetty : jetties) {
+        replicas.add(cjetty.url);
+      }
+      jetties = shardToJetty.get("shard2");
+      for (CloudJettyRunner cjetty : jetties) {
+        replicas.add(cjetty.url);
+      }
+      replicas.remove(shard1Leader.url);
+      replicas.remove(shard2Leader.url);
+      
+      assertEquals(replicas.size(),
+          cloudClient.getReplicasLists().get("collection1").size());
+      
+      for (String url : cloudClient.getReplicasLists().get("collection1")) {
+        assertTrue("fail check for replica:" + url + " in " + replicas,
+            replicas.contains(stripTrailingSlash(url)));
+      }
     }
     
   }

Modified: lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java (original)
+++ lucene/dev/branches/lucene3069/solr/solrj/src/test/org/apache/solr/client/solrj/request/TestCoreAdmin.java Tue Jul 16 17:00:05 2013
@@ -17,8 +17,8 @@
 
 package org.apache.solr.client.solrj.request;
 
-import java.io.File;
-
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrIgnoredThreadsFilter;
 import org.apache.solr.client.solrj.SolrServer;
 import org.apache.solr.client.solrj.embedded.AbstractEmbeddedSolrServerTestCase;
@@ -27,14 +27,13 @@ import org.apache.solr.common.SolrExcept
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.core.SolrCore;
-import org.apache.commons.io.FileUtils;
 import org.junit.After;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import java.io.File;
 
 @ThreadLeakFilters(defaultFilters = true, filters = {SolrIgnoredThreadsFilter.class})
 public class TestCoreAdmin extends AbstractEmbeddedSolrServerTestCase {
@@ -67,6 +66,8 @@ public class TestCoreAdmin extends Abstr
     
     File tmp = new File(TEMP_DIR, "solrtest-" + getTestClass().getSimpleName() + "-" + System.currentTimeMillis());
     tmp.mkdirs();
+
+    log.info("Creating cores underneath {}", tmp);
     
     File dataDir = new File(tmp, this.getTestName()
         + System.currentTimeMillis() + "-" + "data");
@@ -103,7 +104,7 @@ public class TestCoreAdmin extends Abstr
 
     File logDir;
     try {
-      logDir = core.getUpdateHandler().getUpdateLog().getLogDir();
+      logDir = new File(core.getUpdateHandler().getUpdateLog().getLogDir());
     } finally {
       coreProveIt.close();
       core.close();

Modified: lucene/dev/branches/lucene3069/solr/test-framework/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/ivy.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/ivy.xml (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/ivy.xml Tue Jul 16 17:00:05 2013
@@ -16,6 +16,9 @@
    specific language governing permissions and limitations
    under the License.    
 -->
+<!DOCTYPE ivy-module [
+  <!ENTITY hadoop.version "2.0.5-alpha">
+]>
 <ivy-module version="2.0">
     <info organisation="org.apache.solr" module="solr-test-framework"/>
 
@@ -31,7 +34,9 @@
     <dependencies defaultconf="default">
       <dependency org="org.apache.ant" name="ant" rev="1.8.2" transitive="false" />
 
-      <dependency org="junit" name="junit" rev="4.10" transitive="false" conf="default->*;junit4-stdalone->*" />
+      <dependency org="junit" name="junit" rev="4.10" transitive="false" conf="default->*;junit4-stdalone->*">
+        <exclude org="org.hamcrest" module="hamcrest-core"/>
+      </dependency>
       <dependency org="com.carrotsearch.randomizedtesting" name="junit4-ant" rev="2.0.10" transitive="false" conf="default->*;junit4-stdalone->*" />
       <dependency org="com.carrotsearch.randomizedtesting" name="randomizedtesting-runner" rev="2.0.10" transitive="false" conf="default->*;junit4-stdalone->*" />
 

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/BaseDistributedSearchTestCase.java Tue Jul 16 17:00:05 2013
@@ -45,6 +45,7 @@ import org.apache.solr.client.solrj.impl
 import org.apache.solr.client.solrj.request.UpdateRequest;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.client.solrj.SolrResponse;
 import org.apache.solr.common.SolrDocument;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrInputDocument;
@@ -424,6 +425,9 @@ public abstract class BaseDistributedSea
     indexDoc(doc);
   }
 
+  /**
+   * Indexes the document in both the control client, and a randomly selected client
+   */
   protected void indexDoc(SolrInputDocument doc) throws IOException, SolrServerException {
     controlClient.add(doc);
 
@@ -432,6 +436,17 @@ public abstract class BaseDistributedSea
     client.add(doc);
   }
   
+  /**
+   * Indexes the document in both the control client and the specified client asserting
+   * that the respones are equivilent
+   */
+  protected UpdateResponse indexDoc(SolrServer server, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
+    UpdateResponse controlRsp = add(controlClient, params, sdocs);
+    UpdateResponse specificRsp = add(server, params, sdocs);
+    compareSolrResponses(specificRsp, controlRsp);
+    return specificRsp;
+  }
+
   protected UpdateResponse add(SolrServer server, SolrParams params, SolrInputDocument... sdocs) throws IOException, SolrServerException {
     UpdateRequest ureq = new UpdateRequest();
     ureq.setParams(new ModifiableSolrParams(params));
@@ -546,6 +561,9 @@ public abstract class BaseDistributedSea
   }
   
   public QueryResponse queryAndCompare(SolrParams params, SolrServer... servers) throws SolrServerException {
+    return queryAndCompare(params, Arrays.<SolrServer>asList(servers));
+  }
+  public QueryResponse queryAndCompare(SolrParams params, Iterable<SolrServer> servers) throws SolrServerException {
     QueryResponse first = null;
     for (SolrServer server : servers) {
       QueryResponse rsp = server.query(new ModifiableSolrParams(params));
@@ -783,8 +801,14 @@ public abstract class BaseDistributedSea
     return null;
   }
 
+  protected void compareSolrResponses(SolrResponse a, SolrResponse b) {
+    String cmp = compare(a.getResponse(), b.getResponse(), flags, handle);
+    if (cmp != null) {
+      log.error("Mismatched responses:\n" + a + "\n" + b);
+      Assert.fail(cmp);
+    }
+  }
   protected void compareResponses(QueryResponse a, QueryResponse b) {
-    String cmp;
     if (System.getProperty("remove.version.field") != null) {
       // we don't care if one has a version and the other doesnt -
       // control vs distrib
@@ -800,11 +824,7 @@ public abstract class BaseDistributedSea
         }
       }
     }
-    cmp = compare(a.getResponse(), b.getResponse(), flags, handle);
-    if (cmp != null) {
-      log.error("Mismatched responses:\n" + a + "\n" + b);
-      Assert.fail(cmp);
-    }
+    compareSolrResponses(a, b);
   }
 
   @Test

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/JSONTestUtil.java Tue Jul 16 17:00:05 2013
@@ -21,6 +21,8 @@ import org.noggit.ObjectBuilder;
 import org.apache.solr.common.util.StrUtils;
 
 import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 
 public class JSONTestUtil {
@@ -179,6 +181,13 @@ class CollectionTester {
     // generic fallback
     if (!expected.equals(val)) {
 
+      if (expected instanceof String) {
+        String str = (String)expected;
+        if (str.length() > 6 && str.startsWith("///") && str.endsWith("///")) {
+          return handleSpecialString(str);
+        }
+      }
+
       // make an exception for some numerics
       if ((expected instanceof Integer && val instanceof Long || expected instanceof Long && val instanceof Integer)
           && ((Number)expected).longValue() == ((Number)val).longValue()) {
@@ -197,6 +206,29 @@ class CollectionTester {
     return true;
   }
 
+  private boolean handleSpecialString(String str) {
+    String code = str.substring(3,str.length()-3);
+    if ("ignore".equals(code)) {
+      return true;
+    } else if (code.startsWith("regex:")) {
+      String regex = code.substring("regex:".length());
+      if (!(val instanceof String)) {
+        setErr("mismatch: '" + expected + "'!='" + val + "', value is not a string");
+        return false;
+      }
+      Pattern pattern = Pattern.compile(regex);
+      Matcher matcher = pattern.matcher((String)val);
+      if (matcher.find()) {
+        return true;
+      }
+      setErr("mismatch: '" + expected + "'!='" + val + "', regex does not match");
+      return false;
+    }
+
+    setErr("mismatch: '" + expected + "'!='" + val + "'");
+    return false;
+  }
+
   boolean matchList() {
     List expectedList = (List)expected;
     List v = asList();

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/SolrTestCaseJ4.java Tue Jul 16 17:00:05 2013
@@ -17,26 +17,32 @@
 
 package org.apache.solr;
 
-import java.io.*;
-import java.util.*;
-import java.util.logging.*;
-
-import javax.xml.xpath.XPathExpressionException;
-
+import com.carrotsearch.randomizedtesting.RandomizedContext;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
+import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
 import org.apache.commons.io.FileUtils;
-import org.apache.lucene.util.Constants;
+import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.QuickPatchThreadsFilter;
 import org.apache.solr.client.solrj.util.ClientUtils;
-import org.apache.solr.common.*;
+import org.apache.solr.common.SolrException;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.SolrInputField;
 import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.common.params.*;
+import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.XML;
+import org.apache.solr.core.ConfigSolr;
 import org.apache.solr.core.CoreContainer;
+import org.apache.solr.core.CoreDescriptor;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
+import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.handler.JsonUpdateRequestHandler;
-import org.apache.solr.request.*;
+import org.apache.solr.request.LocalSolrQueryRequest;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.request.SolrRequestHandler;
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.SchemaField;
 import org.apache.solr.search.SolrIndexSearcher;
@@ -44,7 +50,10 @@ import org.apache.solr.servlet.DirectSol
 import org.apache.solr.util.AbstractSolrTestCase;
 import org.apache.solr.util.RevertDefaultThreadHandlerRule;
 import org.apache.solr.util.TestHarness;
-import org.junit.*;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.rules.RuleChain;
 import org.junit.rules.TestRule;
 import org.noggit.CharArr;
@@ -54,9 +63,24 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.SAXException;
 
-import com.carrotsearch.randomizedtesting.RandomizedContext;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
-import com.carrotsearch.randomizedtesting.rules.SystemPropertiesRestoreRule;
+import javax.xml.xpath.XPathExpressionException;
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.regex.Pattern;
+
+import static com.google.common.base.Preconditions.checkNotNull;
 
 /**
  * A junit4 Solr test harness that extends LuceneTestCaseJ4. To change which core is used when loading the schema and solrconfig.xml, simply
@@ -86,6 +110,8 @@ public abstract class SolrTestCaseJ4 ext
   @SuppressWarnings("unused")
   private static void beforeClass() {
     System.setProperty("jetty.testMode", "true");
+    
+    System.setProperty("useCompoundFile", Boolean.toString(random().nextBoolean()));
     System.setProperty("enable.update.log", usually() ? "true" : "false");
     System.setProperty("tests.shardhandler.randomSeed", Long.toString(random().nextLong()));
     setupLogging();
@@ -106,6 +132,7 @@ public abstract class SolrTestCaseJ4 ext
     System.clearProperty("jetty.testMode");
     System.clearProperty("tests.shardhandler.randomSeed");
     System.clearProperty("enable.update.log");
+    System.clearProperty("useCompoundFile");
   }
 
   private static boolean changedFactory = false;
@@ -134,6 +161,25 @@ public abstract class SolrTestCaseJ4 ext
     }
   }
 
+  /**
+   * Call this from @BeforeClass to set up the test harness and update handler with no cores.
+   *
+   * @param solrHome The solr home directory.
+   * @param xmlStr - the text of an XML file to use. If null, use the what's the absolute minimal file.
+   * @throws Exception Lost of file-type things can go wrong.
+   */
+  public static void setupNoCoreTest(File solrHome, String xmlStr) throws Exception {
+
+    File tmpFile = new File(solrHome, ConfigSolr.SOLR_XML_FILE);
+    if (xmlStr == null) {
+      xmlStr = "<solr></solr>";
+    }
+    FileUtils.write(tmpFile, xmlStr, IOUtils.CHARSET_UTF_8.toString());
+
+    SolrResourceLoader loader = new SolrResourceLoader(solrHome.getAbsolutePath());
+    h = new TestHarness(loader, ConfigSolr.fromFile(loader, new File(solrHome, "solr.xml")));
+    lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
+  }
 
   @Override
   public void setUp() throws Exception {
@@ -342,6 +388,9 @@ public abstract class SolrTestCaseJ4 ext
    * The directory used to story the index managed by the TestHarness h
    */
   protected static File dataDir;
+  
+  // hack due to File dataDir
+  protected static String hdfsDataDir;
 
   /**
    * Initializes things your test might need
@@ -392,14 +441,47 @@ public abstract class SolrTestCaseJ4 ext
   public static void createCore() {
     assertNotNull(testSolrHome);
     solrConfig = TestHarness.createConfig(testSolrHome, coreName, getSolrConfigFile());
-    h = new TestHarness( coreName,
-            dataDir.getAbsolutePath(),
+    h = new TestHarness( coreName, hdfsDataDir == null ? dataDir.getAbsolutePath() : hdfsDataDir,
             solrConfig,
             getSchemaFile());
     lrf = h.getRequestFactory
             ("standard",0,20,CommonParams.VERSION,"2.2");
   }
 
+  public static CoreContainer createCoreContainer(String solrHome, String solrXML) {
+    testSolrHome = checkNotNull(solrHome);
+    if (dataDir == null)
+      createTempDir();
+    h = new TestHarness(solrHome, solrXML);
+    lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
+    return h.getCoreContainer();
+  }
+
+  public static CoreContainer createDefaultCoreContainer(String solrHome) {
+    testSolrHome = checkNotNull(solrHome);
+    if (dataDir == null)
+      createTempDir();
+    h = new TestHarness("collection1", dataDir.getAbsolutePath(), "solrconfig.xml", "schema.xml");
+    lrf = h.getRequestFactory("standard", 0, 20, CommonParams.VERSION, "2.2");
+    return h.getCoreContainer();
+  }
+
+  public static boolean hasInitException(String message) {
+    for (Map.Entry<String, Exception> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) {
+      if (entry.getValue().getMessage().indexOf(message) != -1)
+        return true;
+    }
+    return false;
+  }
+
+  public static boolean hasInitException(Class<? extends Exception> exceptionType) {
+    for (Map.Entry<String, Exception> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) {
+      if (exceptionType.isAssignableFrom(entry.getValue().getClass()))
+        return true;
+    }
+    return false;
+  }
+
   /** Subclasses that override setUp can optionally call this method
    * to log the fact that their setUp process has ended.
    */
@@ -563,7 +645,7 @@ public abstract class SolrTestCaseJ4 ext
   /**
    * Validates a query matches some JSON test expressions and closes the
    * query. The text expression is of the form path:JSON.  To facilitate
-   * easy embedding in Java strings, the JSON can have double quotes
+   * easy embedding in Java strings, the JSON tests can have double quotes
    * replaced with single quotes.
    * <p>
    * Please use this with care: this makes it easy to match complete
@@ -598,7 +680,7 @@ public abstract class SolrTestCaseJ4 ext
 
       for (String test : tests) {
         if (test == null || test.length()==0) continue;
-        String testJSON = test.replace('\'', '"');
+        String testJSON = json(test);
 
         try {
           failed = true;
@@ -632,23 +714,29 @@ public abstract class SolrTestCaseJ4 ext
   /** Makes sure a query throws a SolrException with the listed response code */
   public static void assertQEx(String message, SolrQueryRequest req, int code ) {
     try {
+      ignoreException(".");
       h.query(req);
       fail( message );
     } catch (SolrException sex) {
       assertEquals( code, sex.code() );
     } catch (Exception e2) {
       throw new RuntimeException("Exception during query", e2);
+    } finally {
+      unIgnoreException(".");
     }
   }
 
   public static void assertQEx(String message, SolrQueryRequest req, SolrException.ErrorCode code ) {
     try {
+      ignoreException(".");
       h.query(req);
       fail( message );
     } catch (SolrException e) {
       assertEquals( code.code, e.code() );
     } catch (Exception e2) {
       throw new RuntimeException("Exception during query", e2);
+    } finally {
+      unIgnoreException(".");
     }
   }
 
@@ -855,6 +943,24 @@ public abstract class SolrTestCaseJ4 ext
     return sd;
   }
 
+  /** Converts "test JSON" and returns standard JSON.
+   *  Currently this only consists of changing unescaped single quotes to double quotes,
+   *  and escaped single quotes to single quotes.
+   *
+   * The primary purpose is to be able to easily embed JSON strings in a JAVA string
+   * with the best readability.
+   *
+   * This transformation is automatically applied to JSON test srings (like assertJQ).
+   */
+  public static String json(String testJSON) {
+    testJSON = nonEscapedSingleQuotePattern.matcher(testJSON).replaceAll("\"");
+    testJSON = escapedSingleQuotePattern.matcher(testJSON).replaceAll("'");
+    return testJSON;
+  }
+  private static Pattern nonEscapedSingleQuotePattern = Pattern.compile("(?<!\\\\)\'");
+  private static Pattern escapedSingleQuotePattern = Pattern.compile("\\\\\'");
+
+
   /** Creates JSON from a SolrInputDocument.  Doesn't currently handle boosts. */
   public static String json(SolrInputDocument doc) {
      CharArr out = new CharArr();
@@ -1446,12 +1552,12 @@ public abstract class SolrTestCaseJ4 ext
     return result;
   }
 
-  public void assertXmlFile(final File file, String... xpath)
+  public static void assertXmlFile(final File file, String... xpath)
       throws IOException, SAXException {
 
     try {
       String xml = FileUtils.readFileToString(file, "UTF-8");
-      String results = h.validateXPath(xml, xpath);
+      String results = TestHarness.validateXPath(xml, xpath);
       if (null != results) {
         String msg = "File XPath failure: file=" + file.getPath() + " xpath="
             + results + "\n\nxml was: " + xml;
@@ -1467,8 +1573,56 @@ public abstract class SolrTestCaseJ4 ext
     File subHome = new File(dstRoot, "conf");
     assertTrue("Failed to make subdirectory ", dstRoot.mkdirs());
     String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
-    FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(subHome, "schema-tiny.xml"));
-    FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(subHome, "solrconfig-minimal.xml"));
+    FileUtils.copyFile(new File(top, "schema-tiny.xml"), new File(subHome, "schema.xml"));
+    FileUtils.copyFile(new File(top, "solrconfig-minimal.xml"), new File(subHome, "solrconfig.xml"));
+    FileUtils.copyFile(new File(top, "solrconfig.snippet.randomindexconfig.xml"), new File(subHome, "solrconfig.snippet.randomindexconfig.xml"));
+  }
+
+  public static CoreDescriptorBuilder buildCoreDescriptor(CoreContainer container, String name, String instancedir) {
+    return new CoreDescriptorBuilder(container, name, instancedir);
+  }
+
+  public static class CoreDescriptorBuilder {
+
+    final String name;
+    final String instanceDir;
+    final CoreContainer container;
+    final Properties properties = new Properties();
+
+    public CoreDescriptorBuilder(CoreContainer container, String name, String instancedir) {
+      this.name = name;
+      this.instanceDir = instancedir;
+      this.container = container;
+    }
+
+    public CoreDescriptorBuilder withSchema(String schema) {
+      properties.setProperty(CoreDescriptor.CORE_SCHEMA, schema);
+      return this;
+    }
+
+    public CoreDescriptorBuilder withConfig(String config) {
+      properties.setProperty(CoreDescriptor.CORE_CONFIG, config);
+      return this;
+    }
+
+    public CoreDescriptorBuilder withDataDir(String datadir) {
+      properties.setProperty(CoreDescriptor.CORE_DATADIR, datadir);
+      return this;
+    }
+
+    public CoreDescriptor build() {
+      return new CoreDescriptor(container, name, instanceDir, properties);
+    }
+
+    public CoreDescriptorBuilder isTransient(boolean isTransient) {
+      properties.setProperty(CoreDescriptor.CORE_TRANSIENT, Boolean.toString(isTransient));
+      return this;
+    }
+
+    public CoreDescriptorBuilder loadOnStartup(boolean loadOnStartup) {
+      properties.setProperty(CoreDescriptor.CORE_LOADONSTARTUP, Boolean.toString(loadOnStartup));
+      return this;
+    }
   }
 
 }

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractDistribZkTestBase.java Tue Jul 16 17:00:05 2013
@@ -128,7 +128,7 @@ public abstract class AbstractDistribZkT
   
   protected void waitForRecoveriesToFinish(String collection, ZkStateReader zkStateReader, boolean verbose, boolean failOnTimeout)
       throws Exception {
-    waitForRecoveriesToFinish(collection, zkStateReader, verbose, failOnTimeout, 230);
+    waitForRecoveriesToFinish(collection, zkStateReader, verbose, failOnTimeout, 330);
   }
   
   protected void waitForRecoveriesToFinish(String collection,
@@ -151,8 +151,7 @@ public abstract class AbstractDistribZkT
           if (verbose) System.out.println("rstate:"
               + shard.getValue().getStr(ZkStateReader.STATE_PROP)
               + " live:"
-              + clusterState.liveNodesContain(shard.getValue().getStr(
-              ZkStateReader.NODE_NAME_PROP)));
+              + clusterState.liveNodesContain(shard.getValue().getNodeName()));
           String state = shard.getValue().getStr(ZkStateReader.STATE_PROP);
           if ((state.equals(ZkStateReader.RECOVERING) || state
               .equals(ZkStateReader.SYNC) || state.equals(ZkStateReader.DOWN))

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/cloud/AbstractFullDistribZkTestBase.java Tue Jul 16 17:00:05 2013
@@ -197,6 +197,7 @@ public abstract class AbstractFullDistri
   @AfterClass
   public static void afterClass() {
     System.clearProperty("solrcloud.update.delay");
+    System.clearProperty("genericCoreNodeNames");
   }
   
   public AbstractFullDistribZkTestBase() {
@@ -211,6 +212,10 @@ public abstract class AbstractFullDistri
     useExplicitNodeNames = random().nextBoolean();
   }
   
+  protected String getDataDir(String dataDir) throws IOException {
+    return dataDir;
+  }
+  
   protected void initCloud() throws Exception {
     assert(cloudInit == false);
     cloudInit = true;
@@ -230,7 +235,7 @@ public abstract class AbstractFullDistri
   
   protected CloudSolrServer createCloudClient(String defaultCollection)
       throws MalformedURLException {
-    CloudSolrServer server = new CloudSolrServer(zkServer.getZkAddress());
+    CloudSolrServer server = new CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
     if (defaultCollection != null) server.setDefaultCollection(defaultCollection);
     server.getLbServer().getHttpClient().getParams()
         .setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 5000);
@@ -328,8 +333,8 @@ public abstract class AbstractFullDistri
           getClass().getName() + "-jetty" + cnt + "-" + System.currentTimeMillis());
       jettyDir.mkdirs();
       setupJettySolrHome(jettyDir);
-      JettySolrRunner j = createJetty(jettyDir, testDir + "/jetty"
-          + cnt, null, "solrconfig.xml", null);
+      JettySolrRunner j = createJetty(jettyDir, getDataDir(testDir + "/jetty"
+          + cnt), null, "solrconfig.xml", null);
       jettys.add(j);
       SolrServer client = createNewSolrServer(j.getLocalPort());
       clients.add(client);
@@ -428,6 +433,28 @@ public abstract class AbstractFullDistri
     return cnt;
   }
   
+  public JettySolrRunner createJetty(String dataDir, String ulogDir, String shardList,
+      String solrConfigOverride) throws Exception {
+    
+    JettySolrRunner jetty = new JettySolrRunner(getSolrHome(), context, 0,
+        solrConfigOverride, null, false, getExtraServlets());
+    jetty.setShards(shardList);
+    jetty.setDataDir(getDataDir(dataDir));
+    jetty.start();
+    
+    return jetty;
+  }
+  
+  public JettySolrRunner createJetty(File solrHome, String dataDir, String shardList, String solrConfigOverride, String schemaOverride) throws Exception {
+
+    JettySolrRunner jetty = new JettySolrRunner(solrHome.getAbsolutePath(), context, 0, solrConfigOverride, schemaOverride, false, getExtraServlets());
+    jetty.setShards(shardList);
+    jetty.setDataDir(getDataDir(dataDir));
+    jetty.start();
+    
+    return jetty;
+  }
+  
   protected void updateMappingsFromZk(List<JettySolrRunner> jettys,
       List<SolrServer> clients) throws Exception {
     ZkStateReader zkStateReader = cloudClient.getZkStateReader();
@@ -483,7 +510,7 @@ public abstract class AbstractFullDistri
             cjr.jetty = jetty;
             cjr.info = replica;
             cjr.nodeName = replica.getStr(ZkStateReader.NODE_NAME_PROP);
-            cjr.coreNodeName = replica.getName();
+            cjr.coreNodeName = replica.getNodeName();
             cjr.url = replica.getStr(ZkStateReader.BASE_URL_PROP) + "/" + replica.getStr(ZkStateReader.CORE_NAME_PROP);
             cjr.client = findClientByPort(port, theClients);
             list.add(cjr);
@@ -803,13 +830,68 @@ public abstract class AbstractFullDistri
     }
   }
   
+  /**
+   * Executes a query against each live and active replica of the specified shard 
+   * and aserts that the results are identical.
+   *
+   * @see #queryAndCompare
+   */
+  public QueryResponse queryAndCompareReplicas(SolrParams params, String shard) 
+    throws Exception {
+
+    ArrayList<SolrServer> shardClients = new ArrayList<SolrServer>(7);
+
+    updateMappingsFromZk(jettys, clients);
+    ZkStateReader zkStateReader = cloudClient.getZkStateReader();
+    List<CloudJettyRunner> solrJetties = shardToJetty.get(shard);
+    assertNotNull("no jetties found for shard: " + shard, solrJetties);
+
+
+    for (CloudJettyRunner cjetty : solrJetties) {
+      ZkNodeProps props = cjetty.info;
+      String nodeName = props.getStr(ZkStateReader.NODE_NAME_PROP);
+      boolean active = props.getStr(ZkStateReader.STATE_PROP).equals(ZkStateReader.ACTIVE);
+      boolean live = zkStateReader.getClusterState().liveNodesContain(nodeName);
+      if (active && live) {
+        shardClients.add(cjetty.client.solrClient);
+      }
+    }
+    return queryAndCompare(params, shardClients);
+  }
+
+  /**
+   * For each Shard, executes a query against each live and active replica of that shard
+   * and asserts that the results are identical for each replica of the same shard.  
+   * Because results are not compared between replicas of different shards, this method 
+   * should be safe for comparing the results of any query, even if it contains 
+   * "distrib=false", because the replicas should all be identical.
+   *
+   * @see AbstractFullDistribZkTestBase#queryAndCompareReplicas(SolrParams, String)
+   */
+  public void queryAndCompareShards(SolrParams params) throws Exception {
+
+    updateMappingsFromZk(jettys, clients);
+    List<String> shards = new ArrayList<String>(shardToJetty.keySet());
+    for (String shard : shards) {
+      queryAndCompareReplicas(params, shard);
+    }
+  }
+
+  /** 
+   * Returns a non-null string if replicas within the same shard do not have a 
+   * consistent number of documents. 
+   */
   protected void checkShardConsistency(String shard) throws Exception {
     checkShardConsistency(shard, false, false);
   }
 
-  /* Returns a non-null string if replicas within the same shard are not consistent.
-   * If expectFailure==false, the exact differences found will be logged since this would be an unexpected failure.
-   * verbose causes extra debugging into to be displayed, even if everything is consistent.
+  /** 
+   * Returns a non-null string if replicas within the same shard do not have a 
+   * consistent number of documents.
+   * If expectFailure==false, the exact differences found will be logged since 
+   * this would be an unexpected failure.
+   * verbose causes extra debugging into to be displayed, even if everything is 
+   * consistent.
    */
   protected String checkShardConsistency(String shard, boolean expectFailure, boolean verbose)
       throws Exception {
@@ -889,6 +971,46 @@ public abstract class AbstractFullDistri
     
   }
   
+  public void showCounts() {
+    Set<String> theShards = shardToJetty.keySet();
+    
+    for (String shard : theShards) {
+      List<CloudJettyRunner> solrJetties = shardToJetty.get(shard);
+      
+      for (CloudJettyRunner cjetty : solrJetties) {
+        ZkNodeProps props = cjetty.info;
+        System.err.println("PROPS:" + props);
+        
+        try {
+          SolrParams query = params("q", "*:*", "rows", "0", "distrib",
+              "false", "tests", "checkShardConsistency"); // "tests" is just a
+                                                          // tag that won't do
+                                                          // anything except be
+                                                          // echoed in logs
+          long num = cjetty.client.solrClient.query(query).getResults()
+              .getNumFound();
+          System.err.println("DOCS:" + num);
+        } catch (SolrServerException e) {
+          System.err.println("error contacting client: " + e.getMessage()
+              + "\n");
+          continue;
+        } catch (SolrException e) {
+          System.err.println("error contacting client: " + e.getMessage()
+              + "\n");
+          continue;
+        }
+        boolean live = false;
+        String nodeName = props.getStr(ZkStateReader.NODE_NAME_PROP);
+        ZkStateReader zkStateReader = cloudClient.getZkStateReader();
+        if (zkStateReader.getClusterState().liveNodesContain(nodeName)) {
+          live = true;
+        }
+        System.err.println(" live:" + live);
+        
+      }
+    }
+  }
+  
   private String toStr(SolrDocumentList lst, int maxSz) {
     if (lst.size() <= maxSz) return lst.toString();
 
@@ -1464,7 +1586,7 @@ public abstract class AbstractFullDistri
       for (String sliceName : slices.keySet()) {
         for (Replica replica : slices.get(sliceName).getReplicas()) {
           if (nodesAllowedToRunShards != null && !nodesAllowedToRunShards.contains(replica.getStr(ZkStateReader.NODE_NAME_PROP))) {
-            return "Shard " + replica.getName() + " created on node " + replica.getStr(ZkStateReader.NODE_NAME_PROP) + " not allowed to run shards for the created collection " + collectionName;
+            return "Shard " + replica.getName() + " created on node " + replica.getNodeName() + " not allowed to run shards for the created collection " + collectionName;
           }
         }
         totalShards += slices.get(sliceName).getReplicas().size();
@@ -1505,7 +1627,7 @@ public abstract class AbstractFullDistri
     if (commondCloudSolrServer == null) {
       synchronized(this) {
         try {
-          commondCloudSolrServer = new CloudSolrServer(zkServer.getZkAddress());
+          commondCloudSolrServer = new CloudSolrServer(zkServer.getZkAddress(), random().nextBoolean());
           commondCloudSolrServer.setDefaultCollection(DEFAULT_COLLECTION);
           commondCloudSolrServer.connect();
         } catch (MalformedURLException e) {

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/BaseTestHarness.java Tue Jul 16 17:00:05 2013
@@ -33,10 +33,10 @@ import java.io.StringWriter;
 import java.io.UnsupportedEncodingException;
 
 abstract public class BaseTestHarness {
-  private final ThreadLocal<DocumentBuilder> builderTL = new ThreadLocal<DocumentBuilder>();
-  private final ThreadLocal<XPath> xpathTL = new ThreadLocal<XPath>();
+  private static final ThreadLocal<DocumentBuilder> builderTL = new ThreadLocal<DocumentBuilder>();
+  private static final ThreadLocal<XPath> xpathTL = new ThreadLocal<XPath>();
 
-  public DocumentBuilder getXmlDocumentBuilder() {
+  public static DocumentBuilder getXmlDocumentBuilder() {
     try {
       DocumentBuilder builder = builderTL.get();
       if (builder == null) {
@@ -49,7 +49,7 @@ abstract public class BaseTestHarness {
     }
   }
 
-  public XPath getXpath() {
+  public static XPath getXpath() {
     try {
       XPath xpath = xpathTL.get();
       if (xpath == null) {
@@ -71,7 +71,7 @@ abstract public class BaseTestHarness {
    * @param tests Array of XPath strings to test (in boolean mode) on the xml
    * @return null if all good, otherwise the first test that fails.
    */
-  public String validateXPath(String xml, String... tests)
+  public static String validateXPath(String xml, String... tests)
       throws XPathExpressionException, SAXException {
 
     if (tests==null || tests.length == 0) return null;

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/RestTestBase.java Tue Jul 16 17:00:05 2013
@@ -127,7 +127,7 @@ abstract public class RestTestBase exten
       }
       */
 
-      String results = restTestHarness.validateXPath(response, tests);
+      String results = TestHarness.validateXPath(response, tests);
 
       if (null != results) {
         String msg = "REQUEST FAILED: xpath=" + results
@@ -229,8 +229,7 @@ abstract public class RestTestBase exten
 
     for (String test : tests) {
       if (null == test || 0 == test.length()) continue;
-      String testJSON = test.replaceAll("(?<!\\\\)\'", "\"");
-      testJSON = testJSON.replaceAll("\\\\\'", "'");
+      String testJSON = json(test);
 
       try {
         failed = true;
@@ -311,8 +310,7 @@ abstract public class RestTestBase exten
 
     for (String test : tests) {
       if (null == test || 0 == test.length()) continue;
-      String testJSON = test.replaceAll("(?<!\\\\)\'", "\"");
-      testJSON = testJSON.replaceAll("\\\\\'", "'");
+      String testJSON = json(test);
 
       try {
         failed = true;
@@ -391,8 +389,7 @@ abstract public class RestTestBase exten
 
     for (String test : tests) {
       if (null == test || 0 == test.length()) continue;
-      String testJSON = test.replaceAll("(?<!\\\\)\'", "\"");
-      testJSON = testJSON.replaceAll("\\\\\'", "'");
+      String testJSON = json(test);
 
       try {
         failed = true;

Modified: lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java (original)
+++ lucene/dev/branches/lucene3069/solr/test-framework/src/java/org/apache/solr/util/TestHarness.java Tue Jul 16 17:00:05 2013
@@ -20,17 +20,13 @@ package org.apache.solr.util;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CommonParams;
 import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.Config;
-import org.apache.solr.core.ConfigSolrXmlOld;
+import org.apache.solr.common.util.NamedList.NamedListEntry;
+import org.apache.solr.core.ConfigSolr;
+import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrConfig;
 import org.apache.solr.core.SolrCore;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.CoreDescriptor;
 import org.apache.solr.core.SolrResourceLoader;
 import org.apache.solr.handler.UpdateRequestHandler;
-import org.apache.solr.logging.ListenerConfig;
-import org.apache.solr.logging.LogWatcher;
-import org.apache.solr.logging.jul.JulWatcher;
 import org.apache.solr.request.LocalSolrQueryRequest;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrRequestHandler;
@@ -40,20 +36,13 @@ import org.apache.solr.response.SolrQuer
 import org.apache.solr.schema.IndexSchema;
 import org.apache.solr.schema.IndexSchemaFactory;
 import org.apache.solr.servlet.DirectSolrConnection;
-import org.apache.solr.common.util.NamedList.NamedListEntry;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
 
-import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.IOException;
 import java.io.StringWriter;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.xml.parsers.ParserConfigurationException;
-
-
 /**
  * This class provides a simple harness that may be useful when
  * writing testcases.
@@ -106,19 +95,8 @@ public class TestHarness extends BaseTes
                          SolrConfig solrConfig,
                          String schemaFile) {
     this( coreName, dataDirectory, solrConfig, IndexSchemaFactory.buildIndexSchema(schemaFile, solrConfig));
-  } 
-  /**
-   * @param coreName to initialize
-   * @param dataDirectory path for index data, will not be cleaned up
-   * @param solrConfig solrconfig instance
-   * @param indexSchema schema instance
-   */
-    public TestHarness( String coreName,
-                        String dataDirectory,
-                        SolrConfig solrConfig,
-                        IndexSchema indexSchema) {
-        this(coreName, new Initializer(coreName, dataDirectory, solrConfig, indexSchema));
-    }
+  }
+
    /**
     * @param dataDirectory path for index data, will not be cleaned up
     * @param solrConfig solronfig instance
@@ -137,18 +115,26 @@ public class TestHarness extends BaseTes
   public TestHarness( String dataDirectory,
                       SolrConfig solrConfig,
                       IndexSchema indexSchema) {
-      this(null, new Initializer(null, dataDirectory, solrConfig, indexSchema));
+      this(CoreContainer.DEFAULT_DEFAULT_CORE_NAME, dataDirectory, solrConfig, indexSchema);
   }
-  
-  public TestHarness(String coreName, CoreContainer.Initializer init) {
-    try {
 
-      container = init.initialize();
+  /**
+   * @param coreName to initialize
+   * @param dataDir path for index data, will not be cleaned up
+   * @param solrConfig solrconfig resource name
+   * @param indexSchema schema resource name
+   */
+  public TestHarness(String coreName, String dataDir, String solrConfig, String indexSchema) {
+    try {
       if (coreName == null)
         coreName = CoreContainer.DEFAULT_DEFAULT_CORE_NAME;
-
       this.coreName = coreName;
 
+      SolrResourceLoader loader = new SolrResourceLoader(SolrResourceLoader.locateSolrHome());
+      ConfigSolr config = getTestHarnessConfig(coreName, dataDir, solrConfig, indexSchema);
+      container = new CoreContainer(loader, config);
+      container.load();
+
       updater = new UpdateRequestHandler();
       updater.init( null );
     } catch (Exception e) {
@@ -156,72 +142,50 @@ public class TestHarness extends BaseTes
     }
   }
 
-  // Creates a container based on infos needed to create one core
-  static class Initializer extends CoreContainer.Initializer {
-    String coreName;
-    String dataDirectory;
-    SolrConfig solrConfig;
-    IndexSchema indexSchema;
-    public Initializer(String coreName,
-                      String dataDirectory,
-                      SolrConfig solrConfig,
-                      IndexSchema indexSchema) {
-      if (coreName == null)
-        coreName = CoreContainer.DEFAULT_DEFAULT_CORE_NAME;
-      this.coreName = coreName;
-      this.dataDirectory = dataDirectory;
-      this.solrConfig = solrConfig;
-      this.indexSchema = indexSchema;
-    }
-    public String getCoreName() {
-      return coreName;
-    }
-    @Override
-    public CoreContainer initialize() {
-      CoreContainer container;
-      try {
-        String solrHome = SolrResourceLoader.locateSolrHome();
-        container = new CoreContainer(new SolrResourceLoader(solrHome)) {
-          {
-            String hostPort = System.getProperty("hostPort", "8983");
-            String hostContext = System.getProperty("hostContext", "solr");
-            defaultCoreName = CoreContainer.DEFAULT_DEFAULT_CORE_NAME;
-            initShardHandler();
-            zkSys.initZooKeeper(this, solrHome, System.getProperty("zkHost"), 30000, hostPort, hostContext, null, "30000", 30000, 30000);
-            ByteArrayInputStream is = new ByteArrayInputStream(ConfigSolrXmlOld.DEF_SOLR_XML.getBytes("UTF-8"));
-            Config config = new Config(loader, null, new InputSource(is), null, false);
-            cfg = new ConfigSolrXmlOld(config, this);
-          }
-        };
-      } catch (ParserConfigurationException e) {
-        throw new RuntimeException(e);
-      } catch (IOException e) {
-        throw new RuntimeException(e);
-      } catch (SAXException e) {
-        throw new RuntimeException(e);
-      }
-      LogWatcher<?> logging = new JulWatcher("test");
-      logging.registerListener(new ListenerConfig());
-      container.setLogging(logging);
-      
-      CoreDescriptor dcore = new CoreDescriptor(container, coreName, solrConfig.getResourceLoader().getInstanceDir());
-      dcore.setConfigName(solrConfig.getResourceName());
-      dcore.setSchemaName(indexSchema.getResourceName());
-      
-      if (container.getZkController() != null) {
-        container.preRegisterInZk(dcore);
-      }
-      
-      SolrCore core = new SolrCore(coreName, dataDirectory, solrConfig, indexSchema, dcore);
-      container.register(coreName, core, false);
-
-      // TODO: we should be exercising the *same* core container initialization code, not equivalent code!
-      if (container.getZkController() == null && core.getUpdateHandler().getUpdateLog() != null) {
-        // always kick off recovery if we are in standalone mode.
-        core.getUpdateHandler().getUpdateLog().recoverFromLog();
-      }
-      return container;
-    }
+  public TestHarness(String coreName, String dataDir, SolrConfig solrConfig, IndexSchema indexSchema) {
+    this(coreName, dataDir, solrConfig.getResourceName(), indexSchema.getResourceName());
+  }
+
+  /**
+   * Create a TestHarness using a specific solr home directory and solr xml
+   * @param solrHome the solr home directory
+   * @param solrXml a File pointing to a solr.xml configuration
+   */
+  public TestHarness(String solrHome, String solrXml) {
+    this(new SolrResourceLoader(solrHome),
+          ConfigSolr.fromString(solrXml));
+  }
+
+  /**
+   * Create a TestHarness using a specific resource loader and config
+   * @param loader the SolrResourceLoader to use
+   * @param config the ConfigSolr to use
+   */
+  public TestHarness(SolrResourceLoader loader, ConfigSolr config) {
+    container = new CoreContainer(loader, config);
+    container.load();
+    updater = new UpdateRequestHandler();
+    updater.init(null);
+  }
+
+  private static ConfigSolr getTestHarnessConfig(String coreName, String dataDir,
+                                                 String solrConfig, String schema) {
+    String solrxml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n"
+        + "<solr persistent=\"false\">\n"
+        + "  <logging enabled=\"true\"/>\n"
+        + "  <cores adminPath=\"/admin/cores\" defaultCoreName=\""
+        + CoreContainer.DEFAULT_DEFAULT_CORE_NAME
+        + "\""
+        + " host=\"${host:}\" hostPort=\"${hostPort:}\" hostContext=\"${hostContext:}\""
+        + " distribUpdateSoTimeout=\"30000\""
+        + " zkClientTimeout=\"${zkClientTimeout:30000}\" distribUpdateConnTimeout=\"30000\""
+        + ">\n"
+        + "    <core name=\"" + coreName + "\" config=\"" + solrConfig
+        + "\" schema=\"" + schema + "\" dataDir=\"" + dataDir
+        + "\" transient=\"false\" loadOnStartup=\"true\""
+        + " shard=\"${shard:shard1}\" collection=\"${collection:collection1}\" instanceDir=\"" + coreName + "/\" />\n"
+        + "  </cores>\n" + "</solr>";
+    return ConfigSolr.fromString(solrxml);
   }
   
   public CoreContainer getCoreContainer() {
@@ -456,4 +420,6 @@ public class TestHarness extends BaseTes
       return new LocalSolrQueryRequest(TestHarness.this.getCore(), new NamedList(entries));
     }
   }
+
+
 }

Modified: lucene/dev/branches/lucene3069/solr/webapp/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/build.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/build.xml (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/build.xml Tue Jul 16 17:00:05 2013
@@ -18,6 +18,9 @@
 <project name="solr-webapp" default="default">
   <description>Solr webapp</description>
 
+  <property name="rat.additional-includes" value="**"/>
+  <property name="rat.additional-excludes" value="web/img/**"/>
+
   <import file="../common-build.xml"/>
 
   <property name="exclude.from.war" value="*slf4j*,log4j-*" />
@@ -47,12 +50,7 @@
     <war destfile="${dist}/solr-${version}${solr.war.suffix}.war"
          webxml="web/WEB-INF/web.xml"
          manifest="${manifest.file}">
-      <lib dir="${common-solr.dir}/core/lib" excludes="${exclude.from.war},${common.classpath.excludes}">
-        <exclude name="*servlet-api*.jar" />
-        <exclude name="easymock-*.jar" />
-        <exclude name="cglib-nodep-*.jar" />
-        <exclude name="objenesis-*.jar" />
-      </lib>
+      <lib dir="${common-solr.dir}/core/lib" excludes="${exclude.from.war},${common.classpath.excludes}"/>
       <lib dir="${common-solr.dir}/solrj/lib" excludes="${exclude.from.war},${common.classpath.excludes}"/>
       <lib dir="${lucene-libs}" excludes="${exclude.from.war},${common.classpath.excludes}" />
       <lib dir="${dist}" excludes="${exclude.from.war},${common.classpath.excludes}">

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/WEB-INF/weblogic.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/WEB-INF/weblogic.xml?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/WEB-INF/weblogic.xml (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/WEB-INF/weblogic.xml Tue Jul 16 17:00:05 2013
@@ -1,4 +1,20 @@
 <?xml version='1.0' encoding='UTF-8'?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
 <weblogic-web-app
     xmlns="http://www.bea.com/ns/weblogic/90"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/admin.html
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/admin.html?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/admin.html (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/admin.html Tue Jul 16 17:00:05 2013
@@ -35,6 +35,7 @@ limitations under the License.
   <link rel="stylesheet" type="text/css" href="css/styles/logging.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/menu.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/plugins.css?_=${version}">
+  <link rel="stylesheet" type="text/css" href="css/styles/documents.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/query.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/replication.css?_=${version}">
   <link rel="stylesheet" type="text/css" href="css/styles/schema-browser.css?_=${version}">
@@ -138,6 +139,12 @@ limitations under the License.
     </div>
     
   </div>
+
+  <div id="connection_status">
+
+    <span>Connection lost …</span>
+
+  </div>
   
   <script type="text/javascript"> var require = { urlArgs: '_=${version}' }; </script>
   <script src="js/require.js?_=${version}" data-main="js/main"></script>

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/css/chosen.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/css/chosen.css?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/css/chosen.css (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/css/chosen.css Tue Jul 16 17:00:05 2013
@@ -1,3 +1,32 @@
+/*
+
+Chosen
+
+- by Patrick Filler for Harvest http://getharvest.com
+- Copyright (c) 2011-2013 by Harvest
+
+Available for use under the MIT License
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+*/
+
 /* @group Base */
 .chzn-container {
   font-size: 13px;

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/analysis.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/analysis.css?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/analysis.css (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/analysis.css Tue Jul 16 17:00:05 2013
@@ -1,3 +1,22 @@
+/*
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+
 #content #analysis-holder
 {
   background-image: url( ../../img/div.gif );
@@ -289,4 +308,4 @@
 }
 
 #content #analysis #field-analysis h2 { background-image: url( ../../img/ico/receipt.png ); }
-#content #analysis .analysis-result h2 { background-image: url( ../../img/ico/receipt-invoice.png ); }
\ No newline at end of file
+#content #analysis .analysis-result h2 { background-image: url( ../../img/ico/receipt-invoice.png ); }

Modified: lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/cloud.css
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/cloud.css?rev=1503797&r1=1503796&r2=1503797&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/cloud.css (original)
+++ lucene/dev/branches/lucene3069/solr/webapp/web/css/styles/cloud.css Tue Jul 16 17:00:05 2013
@@ -1,3 +1,22 @@
+/*
+
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+
 #content #cloud
 {
   position: relative;
@@ -387,4 +406,4 @@
 #content #graph-content .link.lvl-1
 {
   stroke: #fff;
-}
\ No newline at end of file
+}



Mime
View raw message