[accumulo] Git Push Summary
Repository: accumulo Updated Branches: refs/heads/ACCUMULO-4184 [deleted] 109fe7279
[accumulo] Git Push Summary
Repository: accumulo Updated Branches: refs/heads/ACCUMULO-4173 [deleted] ac16962b7
[1/2] accumulo git commit: ACCUMULO-4326 Accept Text and CharSeq in Value
Repository: accumulo Updated Branches: refs/heads/master 35de95264 -> f7481b4ce ACCUMULO-4326 Accept Text and CharSeq in Value Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7b8a11bf Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7b8a11bf Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7b8a11bf Branch: refs/heads/master Commit: 7b8a11bf7f36592aceba9835b4b93adc6f176b8f Parents: 68576ad Author: Keith TurnerAuthored: Thu Jun 2 17:48:07 2016 -0400 Committer: Keith Turner Committed: Fri Jun 3 11:23:19 2016 -0400 -- .../org/apache/accumulo/core/data/Value.java| 26 .../apache/accumulo/core/data/ValueTest.java| 25 +++ 2 files changed, 51 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b8a11bf/core/src/main/java/org/apache/accumulo/core/data/Value.java -- diff --git a/core/src/main/java/org/apache/accumulo/core/data/Value.java b/core/src/main/java/org/apache/accumulo/core/data/Value.java index 6883885..95c3c70 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/Value.java +++ b/core/src/main/java/org/apache/accumulo/core/data/Value.java @@ -25,9 +25,11 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.List; import org.apache.hadoop.io.BytesWritable; +import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; @@ -48,6 +50,30 @@ public class Value implements WritableComparable { } /** + * Creates a value using the UTF-8 encoding of the CharSequence + * + * @param cs + * may not be null + * + * @since 1.8.0 + */ + public Value(CharSequence cs) { +this(cs.toString().getBytes(StandardCharsets.UTF_8)); + } + + /** + * Creates a Value using the bytes of the Text. Makes a copy, does not use the byte array from the Text. + * + * @param text + * may not be null + * + * @since 1.8.0 + */ + public Value(Text text) { +this(text.getBytes(), 0, text.getLength()); + } + + /** * Creates a Value using a byte array as the initial value. The given byte array is used directly as the backing array, so later changes made to the array * reflect into the new Value. * http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b8a11bf/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java -- diff --git a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java index 81e7b08..0cae140 100644 --- a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java +++ b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java @@ -35,6 +35,7 @@ import java.io.DataOutputStream; import java.nio.ByteBuffer; import java.util.List; +import org.apache.hadoop.io.Text; import org.junit.Before; import org.junit.Test; @@ -215,4 +216,28 @@ public class ValueTest { assertArrayEquals(two, a[1]); assertArrayEquals(three, a[2]); } + + @Test + public void testString() { +Value v1 = new Value("abc"); +Value v2 = new Value("abc".getBytes(UTF_8)); +assertEquals(v2, v1); + } + + @Test(expected = NullPointerException.class) + public void testNullCharSequence() { +new Value((CharSequence) null); + } + + @Test + public void testText() { +Value v1 = new Value(new Text("abc")); +Value v2 = new Value("abc".getBytes(UTF_8)); +assertEquals(v2, v1); + } + + @Test(expected = NullPointerException.class) + public void testNullText() { +new Value((Text) null); + } }
[2/2] accumulo git commit: Merge branch '1.8'
Merge branch '1.8' Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f7481b4c Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f7481b4c Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f7481b4c Branch: refs/heads/master Commit: f7481b4ce37f6af7e616da4089638fffdea2d4e2 Parents: 35de952 7b8a11b Author: Keith TurnerAuthored: Fri Jun 3 11:33:58 2016 -0400 Committer: Keith Turner Committed: Fri Jun 3 11:33:58 2016 -0400 -- .../org/apache/accumulo/core/data/Value.java| 26 .../apache/accumulo/core/data/ValueTest.java| 25 +++ 2 files changed, 51 insertions(+) --
accumulo git commit: ACCUMULO-4326 Accept Text and CharSeq in Value
Repository: accumulo Updated Branches: refs/heads/1.8 68576ad59 -> 7b8a11bf7 ACCUMULO-4326 Accept Text and CharSeq in Value Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7b8a11bf Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7b8a11bf Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7b8a11bf Branch: refs/heads/1.8 Commit: 7b8a11bf7f36592aceba9835b4b93adc6f176b8f Parents: 68576ad Author: Keith TurnerAuthored: Thu Jun 2 17:48:07 2016 -0400 Committer: Keith Turner Committed: Fri Jun 3 11:23:19 2016 -0400 -- .../org/apache/accumulo/core/data/Value.java| 26 .../apache/accumulo/core/data/ValueTest.java| 25 +++ 2 files changed, 51 insertions(+) -- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b8a11bf/core/src/main/java/org/apache/accumulo/core/data/Value.java -- diff --git a/core/src/main/java/org/apache/accumulo/core/data/Value.java b/core/src/main/java/org/apache/accumulo/core/data/Value.java index 6883885..95c3c70 100644 --- a/core/src/main/java/org/apache/accumulo/core/data/Value.java +++ b/core/src/main/java/org/apache/accumulo/core/data/Value.java @@ -25,9 +25,11 @@ import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.List; import org.apache.hadoop.io.BytesWritable; +import org.apache.hadoop.io.Text; import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; @@ -48,6 +50,30 @@ public class Value implements WritableComparable { } /** + * Creates a value using the UTF-8 encoding of the CharSequence + * + * @param cs + * may not be null + * + * @since 1.8.0 + */ + public Value(CharSequence cs) { +this(cs.toString().getBytes(StandardCharsets.UTF_8)); + } + + /** + * Creates a Value using the bytes of the Text. Makes a copy, does not use the byte array from the Text. + * + * @param text + * may not be null + * + * @since 1.8.0 + */ + public Value(Text text) { +this(text.getBytes(), 0, text.getLength()); + } + + /** * Creates a Value using a byte array as the initial value. The given byte array is used directly as the backing array, so later changes made to the array * reflect into the new Value. * http://git-wip-us.apache.org/repos/asf/accumulo/blob/7b8a11bf/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java -- diff --git a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java index 81e7b08..0cae140 100644 --- a/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java +++ b/core/src/test/java/org/apache/accumulo/core/data/ValueTest.java @@ -35,6 +35,7 @@ import java.io.DataOutputStream; import java.nio.ByteBuffer; import java.util.List; +import org.apache.hadoop.io.Text; import org.junit.Before; import org.junit.Test; @@ -215,4 +216,28 @@ public class ValueTest { assertArrayEquals(two, a[1]); assertArrayEquals(three, a[2]); } + + @Test + public void testString() { +Value v1 = new Value("abc"); +Value v2 = new Value("abc".getBytes(UTF_8)); +assertEquals(v2, v1); + } + + @Test(expected = NullPointerException.class) + public void testNullCharSequence() { +new Value((CharSequence) null); + } + + @Test + public void testText() { +Value v1 = new Value(new Text("abc")); +Value v2 = new Value("abc".getBytes(UTF_8)); +assertEquals(v2, v1); + } + + @Test(expected = NullPointerException.class) + public void testNullText() { +new Value((Text) null); + } }