You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2013/07/01 23:33:19 UTC

svn commit: r1498704 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java

Author: yonik
Date: Mon Jul  1 21:33:19 2013
New Revision: 1498704

URL: http://svn.apache.org/r1498704
Log:
tests: force FS in the test method rather than for all replication test methods

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1498704&r1=1498703&r2=1498704&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Mon Jul  1 21:33:19 2013
@@ -103,7 +103,7 @@ public class TestReplicationHandler exte
     super.setUp();
 //    System.setProperty("solr.directoryFactory", "solr.StandardDirectoryFactory");
     // For manual testing only
-    useFactory(null); // force an FS factory.  currently MockDirectoryFactory causes SolrCore.initIndex to detect no index and create a new one.
+    // useFactory(null); // force an FS factory.
     master = new SolrInstance("master", null);
     master.setUp();
     masterJetty = createJetty(master);
@@ -344,14 +344,33 @@ public class TestReplicationHandler exte
    * Verify that things still work if an IW has not been opened (and hence the CommitPoints have not been communicated to the deletion policy)
    */
   public void testNoWriter() throws Exception {
+    useFactory(null);    // force a persistent directory
+
+    // stop and start so they see the new directory setting
+    slaveJetty.stop();
+    masterJetty.stop();
+    slaveJetty.start(true);
+    masterJetty.start(true);
+
     index(slaveClient, "id", "123456");
     slaveClient.commit();
     slaveJetty.stop();
-    // System.err.println("############ starting jetty");
-    slaveJetty = createJetty(slave);
-    // System.err.println("############ done starting jetty");
-    slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
-    pullFromMasterToSlave();
+    slaveJetty.start(true);
+
+    // Currently we open a writer on-demand.  This is to test that we are correctly testing
+    // the code path when SolrDeletionPolicy.getLatestCommit() returns null.
+    // When we are using an ephemeral directory, an IW will always be opened to create the index and hence
+    // getLatestCommit will always be non-null.
+    CoreContainer cores = ((SolrDispatchFilter) slaveJetty.getDispatchFilter().getFilter()).getCores();
+    Collection<SolrCore> theCores = cores.getCores();
+    assertEquals(1, theCores.size());
+    SolrCore core = (SolrCore)theCores.toArray()[0];
+    assertNull( core.getDeletionPolicy().getLatestCommit() );
+
+
+    pullFromMasterToSlave();  // this will cause SnapPuller to be invoked and we will test when SolrDeletionPolicy.getLatestCommit() returns null
+
+    resetFactory();
   }
 
   /**