lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1542436 - in /lucene/dev/trunk/solr/core/src: java/org/apache/solr/handler/admin/ShowFileRequestHandler.java test/org/apache/solr/cloud/TestModifyConfFiles.java test/org/apache/solr/schema/ModifyConfFileTest.java
Date Sat, 16 Nov 2013 00:53:42 GMT
Author: erick
Date: Sat Nov 16 00:53:41 2013
New Revision: 1542436

URL: http://svn.apache.org/r1542436
Log:
SOLR-5448: ShowFileRequestHandler treats everything as Directory, when in Cloud-Mode

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestModifyConfFiles.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java?rev=1542436&r1=1542435&r2=1542436&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/admin/ShowFileRequestHandler.java
Sat Nov 16 00:53:41 2013
@@ -297,7 +297,7 @@ public class ShowFileRequestHandler exte
 
         SimpleOrderedMap<Object> fileInfo = new SimpleOrderedMap<Object>();
         files.add(f, fileInfo);
-        List<String> fchildren = zkClient.getChildren(adminFile, null, true);
+        List<String> fchildren = zkClient.getChildren(adminFile + "/" + f, null, true);
         if (fchildren.size() > 0) {
           fileInfo.add("directory", true);
         } else {

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestModifyConfFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestModifyConfFiles.java?rev=1542436&r1=1542435&r2=1542436&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestModifyConfFiles.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/TestModifyConfFiles.java Sat
Nov 16 00:53:41 2013
@@ -20,6 +20,8 @@ import org.apache.solr.client.solrj.impl
 import org.apache.solr.client.solrj.request.QueryRequest;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.params.ModifiableSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
 
 public class TestModifyConfFiles extends AbstractFullDistribZkTestBase {
 
@@ -91,6 +93,22 @@ public class TestModifyConfFiles extends
     contents = new String(zkClient.getData("/configs/conf1/velocity/test.vm", null, null,
true), "UTF-8");
     assertTrue("Should have found new content in a velocity/test.vm.",
         contents.indexOf("Some bogus stuff for a test.") != -1);
+
+    params = new ModifiableSolrParams();
+    request = new QueryRequest(params);
+    request.setPath("/admin/file");
+    NamedList<Object> res = client.request(request);
+
+    NamedList files = (NamedList)res.get("files");
+    assertNotNull("Should have gotten files back", files);
+    SimpleOrderedMap schema = (SimpleOrderedMap)files.get("schema.xml");
+    assertNotNull("Should have a schema returned", schema);
+    assertNull("Schema.xml should not be a directory", schema.get("directory"));
+
+    SimpleOrderedMap velocity = (SimpleOrderedMap)files.get("velocity");
+    assertNotNull("Should have velocity dir returned", velocity);
+
+    assertTrue("Velocity should be a directory", (boolean)velocity.get("directory"));
   }
 
 }

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java?rev=1542436&r1=1542435&r2=1542436&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/schema/ModifyConfFileTest.java Sat
Nov 16 00:53:41 2013
@@ -24,6 +24,8 @@ import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.util.ContentStream;
 import org.apache.solr.common.util.ContentStreamBase;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.request.LocalSolrQueryRequest;
@@ -110,6 +112,24 @@ public class ModifyConfFileTest extends 
           "conf/velocity/test.vm"));
       assertEquals("Schema contents should have changed!", "Some bogus stuff for a test.",
contents);
 
+      streams.clear();
+      params = params();
+      locReq = new LocalSolrQueryRequest(core, params);
+      core.execute(handler, locReq, rsp);
+
+      NamedList<Object> res = rsp.getValues();
+
+      NamedList files = (NamedList)res.get("files");
+      assertNotNull("Should have gotten files back", files);
+      SimpleOrderedMap schema = (SimpleOrderedMap)files.get("schema.xml");
+      assertNotNull("Should have a schema returned", schema);
+      assertNull("Schema.xml should not be a directory", schema.get("directory"));
+
+      SimpleOrderedMap velocity = (SimpleOrderedMap)files.get("velocity");
+      assertNotNull("Should have velocity dir returned", velocity);
+
+      assertTrue("Velocity should be a directory", (boolean)velocity.get("directory"));
+
       core.close();
     } finally {
       cc.shutdown();



Mime
View raw message