lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rjer...@apache.org
Subject svn commit: r1670257 [35/39] - in /lucene/dev/branches/lucene6271: ./ dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/scripts/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/miscellaneou...
Date Tue, 31 Mar 2015 05:22:50 GMT
Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/CacheHeaderTest.java
Tue Mar 31 05:22:40 2015
@@ -18,15 +18,6 @@ package org.apache.solr.servlet;
 
 
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.Date;
-
 import org.apache.http.Header;
 import org.apache.http.HttpResponse;
 import org.apache.http.client.methods.HttpRequestBase;
@@ -36,6 +27,15 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.Date;
+
 /**
  * A test case for the several HTTP cache headers emitted by Solr
  */
@@ -46,7 +46,7 @@ public class CacheHeaderTest extends Cac
   public static void beforeTest() throws Exception {
     solrHomeDirectory = createTempDir().toFile();
     setupJettyTestHome(solrHomeDirectory, "collection1");
-    createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
+    createJetty(solrHomeDirectory.getAbsolutePath());
   }
 
   @AfterClass

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/ResponseHeaderTest.java
Tue Mar 31 05:22:40 2015
@@ -17,13 +17,6 @@ package org.apache.solr.servlet;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.IOException;
-import java.net.URI;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
 import org.apache.commons.io.FileUtils;
 import org.apache.http.Header;
 import org.apache.http.HttpResponse;
@@ -40,6 +33,13 @@ import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
+import java.io.File;
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
 
 public class ResponseHeaderTest extends SolrJettyTestBase {
   
@@ -51,7 +51,7 @@ public class ResponseHeaderTest extends
     setupJettyTestHome(solrHomeDirectory, "collection1");
     String top = SolrTestCaseJ4.TEST_HOME() + "/collection1/conf";
     FileUtils.copyFile(new File(top, "solrconfig-headers.xml"), new File(solrHomeDirectory
+ "/collection1/conf", "solrconfig.xml"));
-    createJetty(solrHomeDirectory.getAbsolutePath(), null, null);
+    createJetty(solrHomeDirectory.getAbsolutePath());
   }
   
   @AfterClass

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/servlet/SolrRequestParserTest.java
Tue Mar 31 05:22:40 2015
@@ -223,11 +223,9 @@ public class SolrRequestParserTest exten
     };
     
     for( String contentType : ct ) {
-      HttpServletRequest request = createMock(HttpServletRequest.class);
+      HttpServletRequest request = getMock("/solr/select", contentType, postBytes.length);
       expect(request.getMethod()).andReturn("POST").anyTimes();
-      expect(request.getContentType()).andReturn( contentType ).anyTimes();
       expect(request.getQueryString()).andReturn(getParams).anyTimes();
-      expect(request.getContentLength()).andReturn(postBytes.length).anyTimes();
       expect(request.getInputStream()).andReturn(new ByteServletInputStream(postBytes));
       replay(request);
       
@@ -285,11 +283,9 @@ public class SolrRequestParserTest exten
     final String contentType = "application/x-www-form-urlencoded; charset=iso-8859-1";
     
     // Set up the expected behavior
-    HttpServletRequest request = createMock(HttpServletRequest.class);
+    HttpServletRequest request = getMock("/solr/select", contentType, postBytes.length);
     expect(request.getMethod()).andReturn("POST").anyTimes();
-    expect(request.getContentType()).andReturn( contentType ).anyTimes();
     expect(request.getQueryString()).andReturn(getParams).anyTimes();
-    expect(request.getContentLength()).andReturn(postBytes.length).anyTimes();
     expect(request.getInputStream()).andReturn(new ByteServletInputStream(postBytes));
     replay(request);
     
@@ -316,11 +312,8 @@ public class SolrRequestParserTest exten
     while (large.length() <= limitKBytes * 1024) {
       large.append('&').append(large);
     }
-    HttpServletRequest request = createMock(HttpServletRequest.class);
+    HttpServletRequest request = getMock("/solr/select", "application/x-www-form-urlencoded",
-1);
     expect(request.getMethod()).andReturn("POST").anyTimes();
-    expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
-    // we dont pass a content-length to let the security mechanism limit it:
-    expect(request.getContentLength()).andReturn(-1).anyTimes();
     expect(request.getQueryString()).andReturn(null).anyTimes();
     expect(request.getInputStream()).andReturn(new ByteServletInputStream(large.toString().getBytes(StandardCharsets.US_ASCII)));
     replay(request);
@@ -338,10 +331,7 @@ public class SolrRequestParserTest exten
   @Test
   public void testParameterIncompatibilityException1() throws Exception
   {
-    HttpServletRequest request = createMock(HttpServletRequest.class);
-    expect(request.getMethod()).andReturn("POST").anyTimes();
-    expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
-    expect(request.getContentLength()).andReturn(100).anyTimes();
+    HttpServletRequest request = getMock("/solr/select", "application/x-www-form-urlencoded",
100);
     expect(request.getQueryString()).andReturn(null).anyTimes();
     // we emulate Jetty that returns empty stream when parameters were parsed before:
     expect(request.getInputStream()).andReturn(new ServletInputStream() {
@@ -377,10 +367,8 @@ public class SolrRequestParserTest exten
   @Test
   public void testParameterIncompatibilityException2() throws Exception
   {
-    HttpServletRequest request = createMock(HttpServletRequest.class);
+    HttpServletRequest request = getMock("/solr/select", "application/x-www-form-urlencoded",
100);
     expect(request.getMethod()).andReturn("POST").anyTimes();
-    expect(request.getContentType()).andReturn("application/x-www-form-urlencoded").anyTimes();
-    expect(request.getContentLength()).andReturn(100).anyTimes();
     expect(request.getQueryString()).andReturn(null).anyTimes();
     // we emulate Tomcat that throws IllegalStateException when parameters were parsed before:
     expect(request.getInputStream()).andThrow(new IllegalStateException());
@@ -398,9 +386,8 @@ public class SolrRequestParserTest exten
   
   @Test
   public void testAddHttpRequestToContext() throws Exception {
-    HttpServletRequest request = createMock(HttpServletRequest.class);
+    HttpServletRequest request = getMock("/solr/select", null, -1);
     expect(request.getMethod()).andReturn("GET").anyTimes();
-    expect(request.getContentType()).andReturn( "application/x-www-form-urlencoded" ).anyTimes();
     expect(request.getQueryString()).andReturn("q=title:solr").anyTimes();
     Map<String, String> headers = new HashMap<>();
     headers.put("X-Forwarded-For", "10.0.0.1");
@@ -425,9 +412,8 @@ public class SolrRequestParserTest exten
   }
 
   public void testPostMissingContentType() throws Exception {
-    HttpServletRequest request = createMock(HttpServletRequest.class);
+    HttpServletRequest request = getMock();
     expect(request.getMethod()).andReturn("POST").anyTimes();
-    expect(request.getContentType()).andReturn(null).anyTimes();
     expect(request.getQueryString()).andReturn(null).anyTimes();
     expect(request.getHeader(anyObject())).andReturn(null).anyTimes();
     replay(request);
@@ -436,7 +422,89 @@ public class SolrRequestParserTest exten
     try {
       parsers.parse(h.getCore(), "/select", request);
     } catch (SolrException e) {
+      log.error("should not throw SolrException", e);
       fail("should not throw SolrException");
     }
   }
+
+
+
+
+
+  @Test
+  public void testAutoDetect() throws Exception {
+    String curl = "curl/7.30.0";
+    for (String method : new String[]{"GET","POST"}) {
+      doAutoDetect(null, method, "{}=a", null,                "{}", "a");  // unknown agent
should not auto-detect
+      doAutoDetect(curl, method, "{}",   "application/json", null, null);  // curl should
auto-detect
+      doAutoDetect(curl, method, "  \t\n\r  {}  ", "application/json", null, null); // starting
with whitespace
+      doAutoDetect(curl, method, "  \t\n\r  // how now brown cow\n {}  ", "application/json",
null, null);     // supporting comments
+      doAutoDetect(curl, method, "  \t\n\r  #different style comment\n {}  ", "application/json",
null, null);
+      doAutoDetect(curl, method, "  \t\n\r  /* C style comment */\n {}  ", "application/json",
null, null);
+      doAutoDetect(curl, method, "  \t\n\r  <tag>hi</tag>  ", "text/xml", null,
null);
+
+      doAutoDetect(curl, method, "  \t\r\n  aaa=1&bbb=2&ccc=3",   null, "bbb", "2");
 // params with whitespace first
+      doAutoDetect(curl, method, "/x=foo&aaa=1&bbb=2&ccc=3",   null, "/x", "foo");
 // param name that looks like a path
+      doAutoDetect(curl, method, " \t\r\n /x=foo&aaa=1&bbb=2&ccc=3",   null,
"bbb", "2");  // param name that looks like a path
+    }
+  }
+
+  public void doAutoDetect(String userAgent, String method, final String body, String expectedContentType,
String expectedKey, String expectedValue) throws Exception {
+    String uri = "/solr/select";
+    String contentType = "application/x-www-form-urlencoded";
+    int contentLength = -1;  // does this mean auto-detect?
+
+    HttpServletRequest request = createMock(HttpServletRequest.class);
+    expect(request.getHeader("User-Agent")).andReturn(userAgent).anyTimes();
+    expect(request.getHeader("Content-Length")).andReturn(null).anyTimes();
+    expect(request.getRequestURI()).andReturn(uri).anyTimes();
+    expect(request.getContentType()).andReturn(contentType).anyTimes();
+    expect(request.getContentLength()).andReturn(contentLength).anyTimes();
+    expect(request.getAttribute(SolrRequestParsers.REQUEST_TIMER_SERVLET_ATTRIBUTE)).andReturn(null).anyTimes();
+
+    expect(request.getMethod()).andReturn(method).anyTimes();
+    // we dont pass a content-length to let the security mechanism limit it:
+    expect(request.getQueryString()).andReturn("foo=1&bar=2").anyTimes();
+    expect(request.getInputStream()).andReturn(new ByteServletInputStream(body.getBytes(StandardCharsets.US_ASCII)));
+    replay(request);
+
+    SolrRequestParsers parsers = new SolrRequestParsers(h.getCore().getSolrConfig());
+    SolrQueryRequest req = parsers.parse(h.getCore(), "/select", request);
+    int num=0;
+    if (expectedContentType != null) {
+      for (ContentStream cs : req.getContentStreams()) {
+        num++;
+        assertTrue(cs.getContentType().startsWith(expectedContentType));
+        String returnedBody = IOUtils.toString(cs.getReader());
+        assertEquals(body, returnedBody);
+      }
+      assertEquals(1, num);
+    }
+
+    assertEquals("1", req.getParams().get("foo"));
+    assertEquals("2", req.getParams().get("bar"));
+
+    if (expectedKey != null) {
+      assertEquals(expectedValue, req.getParams().get(expectedKey));
+    }
+
+    req.close();
+  }
+
+
+  public HttpServletRequest getMock() {
+    return getMock("/solr/select", null, -1);
+    // return getMock("/solr/select", "application/x-www-form-urlencoded");
+  }
+
+  public HttpServletRequest getMock(String uri, String contentType, int contentLength) {
+    HttpServletRequest request = createMock(HttpServletRequest.class);
+    expect(request.getHeader("User-Agent")).andReturn(null).anyTimes();
+    expect(request.getRequestURI()).andReturn(uri).anyTimes();
+    expect(request.getContentType()).andReturn(contentType).anyTimes();
+    expect(request.getContentLength()).andReturn(contentLength).anyTimes();
+    expect(request.getAttribute(SolrRequestParsers.REQUEST_TIMER_SERVLET_ATTRIBUTE)).andReturn(null).anyTimes();
+    return request;
+  }
+
 }

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsDirectoryTest.java
Tue Mar 31 05:22:40 2015
@@ -33,17 +33,18 @@ import org.apache.lucene.store.NoLockFac
 import org.apache.lucene.store.RAMDirectory;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
+import org.apache.solr.util.BadHdfsThreadsFilter;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
 
-@ThreadLeakScope(Scope.NONE) // hdfs client currently leaks thread (HADOOP-9049)
-//@Ignore("this test violates the test security policy because of org.apache.hadoop.fs.RawLocalFileSystem.mkdirs")
+@ThreadLeakFilters(defaultFilters = true, filters = {
+    BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)
+})
 public class HdfsDirectoryTest extends SolrTestCaseJ4 {
   
   private static final int MAX_NUMBER_OF_WRITES = 10000;

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/store/hdfs/HdfsLockFactoryTest.java
Tue Mar 31 05:22:40 2015
@@ -26,16 +26,18 @@ import org.apache.hadoop.hdfs.MiniDFSClu
 import org.apache.lucene.store.Lock;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.cloud.hdfs.HdfsTestUtil;
+import org.apache.solr.util.BadHdfsThreadsFilter;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
-import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope.Scope;
+import com.carrotsearch.randomizedtesting.annotations.ThreadLeakFilters;
 
-@ThreadLeakScope(Scope.NONE) // hdfs client currently leaks thread (HADOOP-9049)
+@ThreadLeakFilters(defaultFilters = true, filters = {
+    BadHdfsThreadsFilter.class // hdfs currently leaks thread(s)
+})
 public class HdfsLockFactoryTest extends SolrTestCaseJ4 {
   
   private static MiniDFSCluster dfsCluster;

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
Tue Mar 31 05:22:40 2015
@@ -22,8 +22,9 @@ import javax.xml.stream.XMLStreamReader;
 
 import org.apache.commons.io.output.ByteArrayOutputStream;
 import org.apache.lucene.index.Term;
+import org.apache.lucene.search.QueryWrapperFilter;
 import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.TermRangeFilter;
+import org.apache.lucene.search.TermRangeQuery;
 import org.apache.lucene.search.TopDocs;
 import org.apache.lucene.search.join.BitDocIdSetCachingWrapperFilter;
 import org.apache.lucene.search.join.ScoreMode;
@@ -560,8 +561,8 @@ public class AddBlockUpdateTest extends
   
   protected ToParentBlockJoinQuery join(final String childTerm) {
     return new ToParentBlockJoinQuery(
-        new TermQuery(new Term(child, childTerm)), new BitDocIdSetCachingWrapperFilter(new
TermRangeFilter(parent,
-            null, null, false, false)), ScoreMode.None);
+        new TermQuery(new Term(child, childTerm)), new BitDocIdSetCachingWrapperFilter(new
QueryWrapperFilter(
+            new TermRangeQuery(parent, null, null, false, false))), ScoreMode.None);
   }
   
   private Collection<? extends Callable<Void>> callables(List<Document>
blocks) {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java
Tue Mar 31 05:22:40 2015
@@ -144,7 +144,7 @@ public class AutoCommitTest extends Abst
   {
     ArrayList<ContentStream> streams = new ArrayList<>();
     ContentStreamBase stream = new ContentStreamBase.StringStream( str );
-    stream.setContentType( contentType );
+    if (contentType != null) stream.setContentType( contentType );
     streams.add( stream );
     return streams;
   }

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/MockStreamingSolrClients.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/MockStreamingSolrClients.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/MockStreamingSolrClients.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/MockStreamingSolrClients.java
Tue Mar 31 05:22:40 2015
@@ -72,7 +72,7 @@ public class MockStreamingSolrClients ex
     }
     
     @Override
-    public NamedList<Object> request(SolrRequest request)
+    public NamedList<Object> request(SolrRequest request, String collection)
         throws SolrServerException, IOException {
       if (exp != null) {
         if (LuceneTestCase.random().nextBoolean()) {

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/update/SolrCmdDistributorTest.java
Tue Mar 31 05:22:40 2015
@@ -33,10 +33,7 @@ import org.apache.solr.common.cloud.ZkSt
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.apache.solr.common.params.UpdateParams;
 import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.ConfigSolr;
 import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.CoresLocator;
-import org.apache.solr.core.PluginInfo;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.core.SolrEventListener;
 import org.apache.solr.search.SolrIndexSearcher;
@@ -73,23 +70,7 @@ public class SolrCmdDistributorTest exte
   private UpdateShardHandler updateShardHandler;
   
   public SolrCmdDistributorTest() throws ParserConfigurationException, IOException, SAXException
{
-    updateShardHandler = new UpdateShardHandler(new ConfigSolr(null, null) {
-
-      @Override
-      public CoresLocator getCoresLocator() {
-        return null;
-      }
-
-      @Override
-      public PluginInfo getShardHandlerFactoryPluginInfo() {
-        return null;
-      }
-
-      @Override
-      protected String getProperty(CfgProp key) {
-        return null;
-      }
-    });
+    updateShardHandler = new UpdateShardHandler(UpdateShardHandlerConfig.DEFAULT);
     
     stress = 0;
   }
@@ -109,9 +90,12 @@ public class SolrCmdDistributorTest exte
   protected void createServers(int numShards) throws Exception {
 
     System.setProperty("configSetBaseDir", TEST_HOME());
-    System.setProperty("coreRootDirectory", testDir.toPath().resolve("control").toString());
-    writeCoreProperties(testDir.toPath().resolve("control/cores"), DEFAULT_TEST_CORENAME);
-    controlJetty = createJetty(new File(getSolrHome()), testDir + "/control/data", null,
getSolrConfigFile(), getSchemaFile());
+
+    File controlHome = testDir.toPath().resolve("control").toFile();
+
+    seedSolrHome(controlHome);
+    writeCoreProperties(controlHome.toPath().resolve("cores").resolve(DEFAULT_TEST_CORENAME),
DEFAULT_TEST_CORENAME);
+    controlJetty = createJetty(controlHome, testDir + "/control/data", null, getSolrConfigFile(),
getSchemaFile());
 
     controlClient = createNewSolrClient(controlJetty.getLocalPort());
 
@@ -120,10 +104,11 @@ public class SolrCmdDistributorTest exte
     for (int i = 0; i < numShards; i++) {
       if (sb.length() > 0) sb.append(',');
       String shardname = "shard" + i;
-      Path coresPath = testDir.toPath().resolve(shardname).resolve("cores");
-      writeCoreProperties(coresPath, DEFAULT_TEST_CORENAME);
-      System.setProperty("coreRootDirectory", testDir.toPath().resolve(shardname).toString());
-      JettySolrRunner j = createJetty(new File(getSolrHome()),
+      Path shardHome = testDir.toPath().resolve(shardname);
+      seedSolrHome(shardHome.toFile());
+      Path coresPath = shardHome.resolve("cores");
+      writeCoreProperties(coresPath.resolve(DEFAULT_TEST_CORENAME), DEFAULT_TEST_CORENAME);
+      JettySolrRunner j = createJetty(shardHome.toFile(),
           testDir + "/shard" + i + "/data", null, getSolrConfigFile(),
           getSchemaFile());
       jettys.add(j);

Modified: lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/util/TestUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/util/TestUtils.java?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/util/TestUtils.java
(original)
+++ lucene/dev/branches/lucene6271/solr/core/src/test/org/apache/solr/util/TestUtils.java
Tue Mar 31 05:22:40 2015
@@ -23,7 +23,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.common.util.StrUtils;
 import org.junit.Assert;
@@ -31,7 +31,7 @@ import org.junit.Assert;
 /**
  *
  */
-public class TestUtils extends LuceneTestCase {
+public class TestUtils extends SolrTestCaseJ4 {
   
   public void testJoin() {
     assertEquals("a|b|c",   StrUtils.join(Arrays.asList("a","b","c"), '|'));
@@ -136,7 +136,7 @@ public class TestUtils extends LuceneTes
       try {
         iter.remove();
         Assert.fail( "should be unsupported..." );
-      } catch( UnsupportedOperationException ex ) {}
+      } catch( UnsupportedOperationException ignored) {}
     }
     // the values should be bigger
     assertEquals( new Integer(10), map.get( "one" ) );

Modified: lucene/dev/branches/lucene6271/solr/example/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/example/README.txt?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/example/README.txt (original)
+++ lucene/dev/branches/lucene6271/solr/example/README.txt Tue Mar 31 05:22:40 2015
@@ -70,9 +70,9 @@ solrconfig.xml.
 
 * Logging *
 
-By default, Jetty & Solr will log to the console a logs/solr.log. This can be convenient
when 
-first getting started, but eventually you will want to log just to a file. To 
-configure logging, edit the log4j.properties file in "resources".
- 
+By default, Jetty & Solr will log to the console and logs/solr.log. This can
+be convenient when first getting started, but eventually you will want to
+log just to a file. To configure logging, edit the log4j.properties file in
+"resources".
 It is also possible to setup log4j or other popular logging frameworks.
 

Modified: lucene/dev/branches/lucene6271/solr/licenses/start.jar.sha1
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/licenses/start.jar.sha1?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/licenses/start.jar.sha1 (original)
+++ lucene/dev/branches/lucene6271/solr/licenses/start.jar.sha1 Tue Mar 31 05:22:40 2015
@@ -1 +1 @@
-6380e0fe5a738cced80ef705dbac3320a8f25edf
+24e798bde886e1430978ece6c4aa90d781e2da30

Modified: lucene/dev/branches/lucene6271/solr/server/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/README.txt?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/README.txt (original)
+++ lucene/dev/branches/lucene6271/solr/server/README.txt Tue Mar 31 05:22:40 2015
@@ -105,9 +105,10 @@ solrconfig.xml.
 
 * Logging *
 
-By default, Jetty & Solr will log to the console a logs/solr.log. This can be convenient
when 
-first getting started, but eventually you will want to log just to a file. To 
-configure logging, edit the log4j.properties file in "resources".
+By default, Jetty & Solr will log to the console and logs/solr.log. This can
+be convenient when first getting started, but eventually you will want to
+log just to a file. To configure logging, edit the log4j.properties file in
+"resources".
  
 It is also possible to setup log4j or other popular logging frameworks.
 

Modified: lucene/dev/branches/lucene6271/solr/server/etc/jetty.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/etc/jetty.xml?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/etc/jetty.xml (original)
+++ lucene/dev/branches/lucene6271/solr/server/etc/jetty.xml Tue Mar 31 05:22:40 2015
@@ -13,13 +13,34 @@
 <Configure id="Server" class="org.eclipse.jetty.server.Server">
 
     <!-- =========================================================== -->
-    <!-- Set handler Collection Structure                            --> 
+    <!-- RewriteHandle to redirect root to Solr                      -->
+    <!-- =========================================================== -->
+     <New id="RewriteHandler" class="org.eclipse.jetty.rewrite.handler.RewriteHandler">
+      <Set name="rewriteRequestURI">true</Set>
+      <Set name="rewritePathInfo">false</Set>
+      <Set name="originalPathAttribute">requestedPath</Set>
+
+      <Call name="addRule">
+        <Arg>
+          <New class="org.eclipse.jetty.rewrite.handler.RedirectRegexRule">
+            <Set name="regex">^/$</Set>
+            <Set name="replacement">/solr/</Set>
+          </New>
+        </Arg>
+      </Call>
+     </New>
+
+    <!-- =========================================================== -->
+    <!-- Set handler Collection Structure                            -->
     <!-- =========================================================== -->
     <Set name="handler">
       <New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection">
         <Set name="handlers">
          <Array type="org.eclipse.jetty.server.Handler">
            <Item>
+             <Ref id="RewriteHandler"/>
+           </Item>
+           <Item>
              <New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/>
            </Item>
            <Item>

Modified: lucene/dev/branches/lucene6271/solr/server/ivy.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/ivy.xml?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/ivy.xml (original)
+++ lucene/dev/branches/lucene6271/solr/server/ivy.xml Tue Mar 31 05:22:40 2015
@@ -37,6 +37,7 @@
     <dependency org="org.eclipse.jetty" name="jetty-http" rev="${/org.eclipse.jetty/jetty-http}"
conf="jetty"/>
     <dependency org="org.eclipse.jetty" name="jetty-io" rev="${/org.eclipse.jetty/jetty-io}"
conf="jetty"/>
     <dependency org="org.eclipse.jetty" name="jetty-jmx" rev="${/org.eclipse.jetty/jetty-jmx}"
conf="jetty"/>
+    <dependency org="org.eclipse.jetty" name="jetty-rewrite" rev="${/org.eclipse.jetty/jetty-rewrite}"
conf="jetty"/>
     <dependency org="org.eclipse.jetty" name="jetty-security" rev="${/org.eclipse.jetty/jetty-security}"
conf="jetty"/>
     <dependency org="org.eclipse.jetty" name="jetty-server" rev="${/org.eclipse.jetty/jetty-server}"
conf="jetty"/>
     <dependency org="org.eclipse.jetty" name="jetty-servlet" rev="${/org.eclipse.jetty/jetty-servlet}"
conf="jetty"/>

Modified: lucene/dev/branches/lucene6271/solr/server/resources/log4j.properties
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/resources/log4j.properties?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/resources/log4j.properties (original)
+++ lucene/dev/branches/lucene6271/solr/server/resources/log4j.properties Tue Mar 31 05:22:40
2015
@@ -5,7 +5,7 @@ log4j.rootLogger=INFO, file, CONSOLE
 log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
 
 log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
-log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x \u2013 %m%n
+log4j.appender.CONSOLE.layout.ConversionPattern=%-4r [%t] %-5p %c %x [%X{collection}] [%X{shard}]
[%X{replica}] [%X{core}] \u2013 %m%n
 
 #- size rotation with log cleanup.
 log4j.appender.file=org.apache.log4j.RollingFileAppender

Modified: lucene/dev/branches/lucene6271/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
(original)
+++ lucene/dev/branches/lucene6271/solr/server/solr/configsets/data_driven_schema_configs/conf/solrconfig.xml
Tue Mar 31 05:22:40 2015
@@ -893,6 +893,36 @@
     </lst>
   </requestHandler>
 
+  <!--
+    The export request handler is used to export full sorted result sets.
+    Do not change these defaults.
+  -->
+
+  <requestHandler name="/export" class="solr.SearchHandler">
+    <lst name="invariants">
+      <str name="rq">{!xport}</str>
+      <str name="wt">xsort</str>
+      <str name="distrib">false</str>
+    </lst>
+
+    <arr name="components">
+      <str>query</str>
+    </arr>
+  </requestHandler>
+
+
+  <!--
+  Distributed Stream processing.
+  -->
+
+  <requestHandler name="/stream" class="solr.StreamHandler">
+    <lst name="invariants">
+      <str name="wt">json</str>
+      <str name="distrib">false</str>
+    </lst>
+  </requestHandler>
+
+
 
   <!-- Field Analysis Request Handler
 

Modified: lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml
(original)
+++ lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/schema.xml
Tue Mar 31 05:22:40 2015
@@ -93,6 +93,8 @@
        This will increase storage costs.
      termOffsets: Store offset information with the term vector. This 
        will increase storage costs.
+     termPayloads: Store payload information with the term vector. This
+       will increase storage costs.
      required: The field is required.  It will throw an error if the
        value does not exist
      default: a value that should be used if no value is specified

Modified: lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml?rev=1670257&r1=1670256&r2=1670257&view=diff
==============================================================================
--- lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
(original)
+++ lucene/dev/branches/lucene6271/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml
Tue Mar 31 05:22:40 2015
@@ -905,6 +905,18 @@
   </requestHandler>
 
 
+  <!--
+  Distributed Stream processing.
+  -->
+
+  <requestHandler name="/stream" class="solr.StreamHandler">
+    <lst name="invariants">
+      <str name="wt">json</str>
+      <str name="distrib">false</str>
+    </lst>
+  </requestHandler>
+
+
 
 
 
@@ -1349,10 +1361,14 @@
     </arr>
   </requestHandler>
 
-  <!-- This is disabled by default because it currently causes long startup times on 
-       big indexes, even when never used.  See SOLR-6679 for background.
-
-       To use this suggester, set the "solr.suggester.enabled=true" system property
+  <!-- The SuggestComponent in Solr provides users with automatic suggestions for query
terms. 
+       You can use this to implement a powerful auto-suggest feature in your search application.
+       As with the rest of this solrconfig.xml file, the configuration of this component
is purely
+       an example that applies specifically to this configset and example documents. 
+       
+       More information about this component and other configuration options are described
in the
+       "Suggester" section of the reference guide available at 
+       http://archive.apache.org/dist/lucene/solr/ref-guide
     -->
   <searchComponent name="suggest" class="solr.SuggestComponent">
     <lst name="suggester">
@@ -1376,7 +1392,6 @@
       <str>suggest</str>
     </arr>
   </requestHandler>
-  -->
 
 
   <!-- Term Vector Component



Mime
View raw message