lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1621957 - in /lucene/dev/branches/lucene5858: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/ solr/ solr/core/ solr/core/src/test/org/apache/solr/handler/ solr/licenses/
Date Tue, 02 Sep 2014 11:02:43 GMT
Author: rmuir
Date: Tue Sep  2 11:02:42 2014
New Revision: 1621957

URL: http://svn.apache.org/r1621957
Log:
LUCENE-5858: trunk->branch

Added:
    lucene/dev/branches/lucene5858/solr/licenses/noggit-0.6.jar.sha1
      - copied unchanged from r1621956, lucene/dev/trunk/solr/licenses/noggit-0.6.jar.sha1
Removed:
    lucene/dev/branches/lucene5858/solr/licenses/noggit-0.5.jar.sha1
Modified:
    lucene/dev/branches/lucene5858/   (props changed)
    lucene/dev/branches/lucene5858/lucene/   (props changed)
    lucene/dev/branches/lucene5858/lucene/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene5858/lucene/core/   (props changed)
    lucene/dev/branches/lucene5858/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/dev/branches/lucene5858/lucene/ivy-versions.properties   (contents, props changed)
    lucene/dev/branches/lucene5858/solr/   (props changed)
    lucene/dev/branches/lucene5858/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/lucene5858/solr/core/   (props changed)
    lucene/dev/branches/lucene5858/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java
    lucene/dev/branches/lucene5858/solr/licenses/   (props changed)

Modified: lucene/dev/branches/lucene5858/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/CHANGES.txt?rev=1621957&r1=1621956&r2=1621957&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene5858/lucene/CHANGES.txt Tue Sep  2 11:02:42 2014
@@ -127,6 +127,10 @@ Bug Fixes
   MockDirectoryWrapper to have it simulate a virus checker holding a
   file open and preventing deletion (Robert Muir, Mike McCandless)
 
+* LUCENE-5916: Static scope test components should be consistent between
+  tests (and test iterations). Fix for FaultyIndexInput in particular.
+  (Dawid Weiss)
+
 Build
 
 * LUCENE-5909: Smoke tester now has better command line parsing and

Modified: lucene/dev/branches/lucene5858/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1621957&r1=1621956&r2=1621957&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
(original)
+++ lucene/dev/branches/lucene5858/lucene/core/src/test/org/apache/lucene/index/TestFieldsReader.java
Tue Sep  2 11:02:42 2014
@@ -20,6 +20,7 @@ package org.apache.lucene.index;
 import java.io.File;
 import java.io.IOException;
 import java.util.*;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
@@ -58,9 +59,8 @@ public class TestFieldsReader extends Lu
     IndexWriter writer = new IndexWriter(dir, conf);
     writer.addDocument(testDoc);
     writer.close();
-    FaultyIndexInput.doFail = false;
   }
-  
+
   @AfterClass
   public static void afterClass() throws Exception {
     dir.close();
@@ -105,77 +105,97 @@ public class TestFieldsReader extends Lu
   }
 
 
-  public static class FaultyFSDirectory extends BaseDirectory {
-
+  public class FaultyFSDirectory extends BaseDirectory {
     Directory fsDir;
-    
+    AtomicBoolean doFail = new AtomicBoolean();
+
     public FaultyFSDirectory(File dir) {
       fsDir = newFSDirectory(dir);
       lockFactory = fsDir.getLockFactory();
     }
+    
     @Override
     public IndexInput openInput(String name, IOContext context) throws IOException {
-      return new FaultyIndexInput(fsDir.openInput(name, context));
+      return new FaultyIndexInput(doFail, fsDir.openInput(name, context));
     }
+    
     @Override
     public String[] listAll() throws IOException {
       return fsDir.listAll();
     }
+    
     @Override
     public void deleteFile(String name) throws IOException {
       fsDir.deleteFile(name);
     }
+    
     @Override
     public long fileLength(String name) throws IOException {
       return fsDir.fileLength(name);
     }
+    
     @Override
     public IndexOutput createOutput(String name, IOContext context) throws IOException {
       return fsDir.createOutput(name, context);
     }
+    
     @Override
     public void sync(Collection<String> names) throws IOException {
       fsDir.sync(names);
     }
+
     @Override
     public void close() throws IOException {
       fsDir.close();
     }
+
+    public void startFailing() {
+      doFail.set(true);
+    }
   }
 
-  private static class FaultyIndexInput extends BufferedIndexInput {
+  private class FaultyIndexInput extends BufferedIndexInput {
+    private final AtomicBoolean doFail;
+
     IndexInput delegate;
-    static boolean doFail;
     int count;
-    private FaultyIndexInput(IndexInput delegate) {
+
+    private FaultyIndexInput(AtomicBoolean doFail, IndexInput delegate) {
       super("FaultyIndexInput(" + delegate + ")", BufferedIndexInput.BUFFER_SIZE);
       this.delegate = delegate;
+      this.doFail = doFail;
     }
+
     private void simOutage() throws IOException {
-      if (doFail && count++ % 2 == 1) {
+      if (doFail.get() && count++ % 2 == 1) {
         throw new IOException("Simulated network outage");
       }
     }
+
     @Override
     public void readInternal(byte[] b, int offset, int length) throws IOException {
       simOutage();
       delegate.seek(getFilePointer());
       delegate.readBytes(b, offset, length);
     }
+    
     @Override
     public void seekInternal(long pos) throws IOException {
     }
+    
     @Override
     public long length() {
       return delegate.length();
     }
+    
     @Override
     public void close() throws IOException {
       delegate.close();
     }
+    
     @Override
     public FaultyIndexInput clone() {
-      FaultyIndexInput i = new FaultyIndexInput(delegate.clone());
+      FaultyIndexInput i = new FaultyIndexInput(doFail, delegate.clone());
       // seek the clone to our current position
       try {
         i.seek(getFilePointer());
@@ -188,7 +208,7 @@ public class TestFieldsReader extends Lu
     @Override
     public IndexInput slice(String sliceDescription, long offset, long length) throws IOException
{
       IndexInput slice = delegate.slice(sliceDescription, offset, length);
-      return new FaultyIndexInput(slice);
+      return new FaultyIndexInput(doFail, slice);
     }
   }
 
@@ -197,7 +217,7 @@ public class TestFieldsReader extends Lu
     File indexDir = createTempDir("testfieldswriterexceptions");
 
     try {
-      Directory dir = new FaultyFSDirectory(indexDir);
+      FaultyFSDirectory dir = new FaultyFSDirectory(indexDir);
       IndexWriterConfig iwc = newIndexWriterConfig(new MockAnalyzer(random()))
                                 .setOpenMode(OpenMode.CREATE);
       IndexWriter writer = new IndexWriter(dir, iwc);
@@ -207,8 +227,7 @@ public class TestFieldsReader extends Lu
       writer.close();
 
       IndexReader reader = DirectoryReader.open(dir);
-
-      FaultyIndexInput.doFail = true;
+      dir.startFailing();
 
       boolean exc = false;
 

Modified: lucene/dev/branches/lucene5858/lucene/ivy-versions.properties
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/lucene/ivy-versions.properties?rev=1621957&r1=1621956&r2=1621957&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/lucene/ivy-versions.properties (original)
+++ lucene/dev/branches/lucene5858/lucene/ivy-versions.properties Tue Sep  2 11:02:42 2014
@@ -211,7 +211,7 @@ org.mortbay.jetty.version = 6.1.26
 /org.mortbay.jetty/jetty = ${org.mortbay.jetty.version}
 /org.mortbay.jetty/jetty-util = ${org.mortbay.jetty.version}
 
-/org.noggit/noggit = 0.5
+/org.noggit/noggit = 0.6
 /org.objenesis/objenesis = 1.2
 
 org.ow2.asm.version = 4.1

Modified: lucene/dev/branches/lucene5858/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/solr/CHANGES.txt?rev=1621957&r1=1621956&r2=1621957&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/solr/CHANGES.txt (original)
+++ lucene/dev/branches/lucene5858/solr/CHANGES.txt Tue Sep  2 11:02:42 2014
@@ -108,6 +108,7 @@ Carrot2 3.9.0
 Velocity 1.7 and Velocity Tools 2.0
 Apache UIMA 2.3.1
 Apache ZooKeeper 3.4.6
+Noggit 0.6
 
 Detailed Change List
 ----------------------
@@ -154,6 +155,9 @@ Other Changes
 * LUCENE-5901: Replaced all occurences of LUCENE_CURRENT with LATEST for luceneMatchVersion.
   (Ryan Ernst)
 
+* SOLR-6445: Upgrade Noggit to verion 0.6 to support more flexible JSON input (Noble Paul
, Yonik Seeley)
+
+
 ==================  4.10.0 =================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

Modified: lucene/dev/branches/lucene5858/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5858/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java?rev=1621957&r1=1621956&r2=1621957&view=diff
==============================================================================
--- lucene/dev/branches/lucene5858/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java
(original)
+++ lucene/dev/branches/lucene5858/solr/core/src/test/org/apache/solr/handler/JsonLoaderTest.java
Tue Sep  2 11:02:42 2014
@@ -281,7 +281,32 @@ public class JsonLoaderTest extends Solr
     BufferingRequestProcessor p = new BufferingRequestProcessor(null);
     JsonLoader loader = new JsonLoader();
     loader.load(req, rsp, new ContentStreamBase.StringStream(doc), p);
-
+    assertEquals( 2, p.addCommands.size() );
+     doc = "\n" +
+        "\n" +
+        "{bool: true,\n" +
+        " f0: \"v0\",\n" +
+        " f2: {\n" +
+        "    \t  \"boost\": 2.3,\n" +
+        "    \t  \"value\": \"test\"\n" +
+        "    \t   },\n" +
+        "array: [ \"aaa\", \"bbb\" ],\n" +
+        "boosted: {\n" +
+        "    \t      \"boost\": 6.7,\n" +
+        "    \t      \"value\": [ \"aaa\", \"bbb\" ]\n" +
+        "    \t    }\n" +
+        " }\n" +
+        "\n" +
+        "\n" +
+        " {f1: \"v1\",\n" +
+        "  f1: \"v2\",\n" +
+        "   f2: null\n" +
+        "  }\n";
+    req = req("json.command","false");
+    rsp = new SolrQueryResponse();
+    p = new BufferingRequestProcessor(null);
+    loader = new JsonLoader();
+    loader.load(req, rsp, new ContentStreamBase.StringStream(doc), p);
 
     assertEquals( 2, p.addCommands.size() );
 



Mime
View raw message