You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@vxquery.apache.org by pr...@apache.org on 2016/05/25 01:03:23 UTC

[07/11] vxquery git commit: Use comapareTo method of string pointable

Use comapareTo method of string pointable


Project: http://git-wip-us.apache.org/repos/asf/vxquery/repo
Commit: http://git-wip-us.apache.org/repos/asf/vxquery/commit/e8afa646
Tree: http://git-wip-us.apache.org/repos/asf/vxquery/tree/e8afa646
Diff: http://git-wip-us.apache.org/repos/asf/vxquery/diff/e8afa646

Branch: refs/heads/master
Commit: e8afa6464d1857d3ad0f24980ec1a93963f33eb2
Parents: 98cc0f8
Author: riyafa <ri...@gmail.com>
Authored: Thu May 19 08:39:08 2016 +0530
Committer: riyafa <ri...@gmail.com>
Committed: Thu May 19 08:39:08 2016 +0530

----------------------------------------------------------------------
 .../org/apache/vxquery/datamodel/ObjectByteTest.java  | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/vxquery/blob/e8afa646/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ObjectByteTest.java
----------------------------------------------------------------------
diff --git a/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ObjectByteTest.java b/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ObjectByteTest.java
index 41694e8..e55706e 100644
--- a/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ObjectByteTest.java
+++ b/vxquery-core/src/test/java/org/apache/vxquery/datamodel/ObjectByteTest.java
@@ -16,7 +16,6 @@ package org.apache.vxquery.datamodel;
 
 import java.io.IOException;
 
-import org.apache.hyracks.data.std.api.IPointable;
 import org.apache.hyracks.data.std.primitive.UTF8StringPointable;
 import org.apache.hyracks.data.std.util.ArrayBackedValueStorage;
 import org.apache.vxquery.datamodel.accessors.SequencePointable;
@@ -96,7 +95,7 @@ public class ObjectByteTest extends AbstractPointableTest {
         if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
             Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag());
         }
-        if (!compareKeys(tvp, tvpKey1)) {
+        if (tvpKey1.compareTo(tvp) < 0) {
             Assert.fail("Key is incorrect. Expected: id");
         }
 
@@ -157,21 +156,21 @@ public class ObjectByteTest extends AbstractPointableTest {
         if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
             Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag());
         }
-        if (!compareKeys(tvp, tvpKey1)) {
+        if (tvpKey1.compareTo(tvp) < 0) {
             Assert.fail("Object key one is incorrect. Expected: name");
         }
         sp.getEntry(1, tvp);
         if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
             Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag());
         }
-        if (!compareKeys(tvp, tvpKey2)) {
+        if (tvpKey2.compareTo(tvp) < 0) {
             Assert.fail("Object key two is incorrect. Expected: price");
         }
         sp.getEntry(2, tvp);
         if (tvp.getTag() != ValueTag.XS_STRING_TAG) {
             Assert.fail("Type tag is incorrect. Expected: " + ValueTag.XS_STRING_TAG + " Got: " + tvp.getTag());
         }
-        if (!compareKeys(tvp, tvpKey3)) {
+        if (tvpKey3.compareTo(tvp) < 0) {
             Assert.fail("Object key three is incorrect. Expected: properties");
         }
 
@@ -253,9 +252,4 @@ public class ObjectByteTest extends AbstractPointableTest {
             Assert.fail("Test failed to write the object pointable.");
         }
     }
-
-    public boolean compareKeys(IPointable tvp1, IPointable tvp2) {
-        return FunctionHelper.arraysEqual(tvp1.getByteArray(), tvp1.getStartOffset() + 1, tvp1.getLength() - 1,
-                tvp2.getByteArray(), tvp2.getStartOffset(), tvp2.getLength());
-    }
 }