Return-Path: Delivered-To: apmail-lucene-java-commits-archive@www.apache.org Received: (qmail 66651 invoked from network); 23 Feb 2010 20:48:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 23 Feb 2010 20:48:26 -0000 Received: (qmail 97830 invoked by uid 500); 23 Feb 2010 20:48:26 -0000 Delivered-To: apmail-lucene-java-commits-archive@lucene.apache.org Received: (qmail 97759 invoked by uid 500); 23 Feb 2010 20:48:26 -0000 Mailing-List: contact java-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-dev@lucene.apache.org Delivered-To: mailing list java-commits@lucene.apache.org Received: (qmail 97750 invoked by uid 99); 23 Feb 2010 20:48:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Feb 2010 20:48:26 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 23 Feb 2010 20:48:25 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 8852A23888E2; Tue, 23 Feb 2010 20:48:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r915514 - in /lucene/java/branches/flex_1458_3_0_back_compat_tests/src: java/org/apache/lucene/util/ test/org/apache/lucene/index/ Date: Tue, 23 Feb 2010 20:48:05 -0000 To: java-commits@lucene.apache.org From: rmuir@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100223204805.8852A23888E2@eris.apache.org> Author: rmuir Date: Tue Feb 23 20:48:05 2010 New Revision: 915514 URL: http://svn.apache.org/viewvc?rev=915514&view=rev Log: LUCENE-2111: new backwards tests for UTF8Result -> BytesRef Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/BytesRef.java lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/UnicodeUtil.java lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestPayloads.java Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/BytesRef.java URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/BytesRef.java?rev=915514&r1=915513&r2=915514&view=diff ============================================================================== --- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/BytesRef.java (original) +++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/BytesRef.java Tue Feb 23 20:48:05 2010 @@ -2,6 +2,8 @@ // stub for tests only public class BytesRef { + public BytesRef(int capacity) {} + public BytesRef() {} public byte[] bytes; public int offset; public int length; Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/UnicodeUtil.java URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/UnicodeUtil.java?rev=915514&r1=915513&r2=915514&view=diff ============================================================================== --- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/UnicodeUtil.java (original) +++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/java/org/apache/lucene/util/UnicodeUtil.java Tue Feb 23 20:48:05 2010 @@ -106,6 +106,10 @@ } } + // stubs for tests only + public static void UTF16toUTF8(char[] source, int offset, int length, BytesRef result) {} + public static void UTF16toUTF8(CharSequence s, int offset, int length, BytesRef result) {} + /** Encode characters from a char[] source, starting at * offset and stopping when the character 0xffff is seen. * Returns the number of bytes written to bytesOut. */ @@ -223,7 +227,7 @@ /** Encode characters from this String, starting at offset * for length characters. Returns the number of bytes * written to bytesOut. */ - public static void UTF16toUTF8(final String s, final int offset, final int length, UTF8Result result) { + public static void UTF16toUTF8(final CharSequence s, final int offset, final int length, UTF8Result result) { final int end = offset + length; byte[] out = result.result; Modified: lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=915514&r1=915513&r2=915514&view=diff ============================================================================== --- lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java (original) +++ lucene/java/branches/flex_1458_3_0_back_compat_tests/src/test/org/apache/lucene/index/TestIndexWriter.java Tue Feb 23 20:48:05 2010 @@ -64,6 +64,7 @@ import org.apache.lucene.store.NoLockFactory; import org.apache.lucene.store.RAMDirectory; import org.apache.lucene.store.SingleInstanceLockFactory; +import org.apache.lucene.util.BytesRef; import org.apache.lucene.util.UnicodeUtil; import org.apache.lucene.util._TestUtil; import org.apache.lucene.util.Version; @@ -3309,7 +3310,7 @@ // LUCENE-510 public void testAllUnicodeChars() throws Throwable { - UnicodeUtil.UTF8Result utf8 = new UnicodeUtil.UTF8Result(); + BytesRef utf8 = new BytesRef(10); UnicodeUtil.UTF16Result utf16 = new UnicodeUtil.UTF16Result(); char[] chars = new char[2]; for(int ch=0;ch<0x0010FFFF;ch++) { @@ -3329,16 +3330,16 @@ UnicodeUtil.UTF16toUTF8(chars, 0, len, utf8); String s1 = new String(chars, 0, len); - String s2 = new String(utf8.result, 0, utf8.length, "UTF-8"); + String s2 = new String(utf8.bytes, 0, utf8.length, "UTF-8"); assertEquals("codepoint " + ch, s1, s2); - UnicodeUtil.UTF8toUTF16(utf8.result, 0, utf8.length, utf16); + UnicodeUtil.UTF8toUTF16(utf8.bytes, 0, utf8.length, utf16); assertEquals("codepoint " + ch, s1, new String(utf16.result, 0, utf16.length)); byte[] b = s1.getBytes("UTF-8"); assertEquals(utf8.length, b.length); for(int j=0;j