You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by us...@apache.org on 2015/07/08 01:04:59 UTC
svn commit: r1689769 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/CHANGES.txt lucene/test-framework/
lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java
Author: uschindler
Date: Tue Jul 7 23:04:59 2015
New Revision: 1689769
URL: http://svn.apache.org/r1689769
Log:
Merged revision(s) 1689768 from lucene/dev/trunk:
LUCENE-6563: Improve MockFileSystemTestCase.testURI to check if a path can be encoded according to local filesystem requirements. Otherwise stop test execution
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_5x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1689769&r1=1689768&r2=1689769&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Tue Jul 7 23:04:59 2015
@@ -296,6 +296,10 @@ Test Framework
* LUCENE-6652: Removed lots of useless Byte(s)TermAttributes all over test
infrastructure. (Uwe Schindler)
+* LUCENE-6563: Improve MockFileSystemTestCase.testURI to check if a path
+ can be encoded according to local filesystem requirements. Otherwise
+ stop test execution. (Christine Poerschke via Uwe Schindler)
+
Changes in Backwards Compatibility Policy
* LUCENE-6553: The iterator returned by the LeafReader.postings method now
Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java?rev=1689769&r1=1689768&r2=1689769&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/MockFileSystemTestCase.java Tue Jul 7 23:04:59 2015
@@ -23,6 +23,7 @@ import java.net.URI;
import java.nio.charset.Charset;
import java.nio.file.DirectoryStream;
import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
import java.nio.file.Path;
import org.apache.lucene.util.Constants;
@@ -58,20 +59,32 @@ public abstract class MockFileSystemTest
/** Test that URIs are not corrumpted */
public void testURI() throws IOException {
+ implTestURI("file1"); // plain ASCII
+ }
+
+ public void testURIumlaute() throws IOException {
+ implTestURI("äÃöÃüÃÃ"); // Umlaute and s-zet
+ }
+
+ public void testURIchinese() throws IOException {
+ implTestURI("ä¸å½"); // chinese
+ }
+
+ private void implTestURI(String fileName) throws IOException {
assumeFalse("broken on J9: see https://issues.apache.org/jira/browse/LUCENE-6517", Constants.JAVA_VENDOR.startsWith("IBM"));
Path dir = wrap(createTempDir());
- Path f1 = dir.resolve("file1");
+ try {
+ dir.resolve(fileName);
+ } catch (InvalidPathException ipe) {
+ assumeNoException("couldn't resolve '"+fileName+"'", ipe);
+ }
+
+ Path f1 = dir.resolve(fileName);
URI uri = f1.toUri();
Path f2 = dir.getFileSystem().provider().getPath(uri);
assertEquals(f1, f2);
-
- assumeTrue(Charset.defaultCharset().name() + " can't encode chinese",
- Charset.defaultCharset().newEncoder().canEncode("ä¸å½"));
- Path f3 = dir.resolve("ä¸å½");
- URI uri2 = f3.toUri();
- Path f4 = dir.getFileSystem().provider().getPath(uri2);
- assertEquals(f3, f4);
+
dir.getFileSystem().close();
}