You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/24 13:20:28 UTC

[05/16] git commit: Initial commit to prove issue

Initial commit to prove issue


Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/3c2f803f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/3c2f803f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/3c2f803f

Branch: refs/pull/27/merge
Commit: 3c2f803fb5596256ee9043c9589563fde4322b5e
Parents: 1150e47
Author: Todd Nine <tn...@apigee.com>
Authored: Mon Jan 20 16:50:11 2014 -0800
Committer: Todd Nine <tn...@apigee.com>
Committed: Mon Jan 20 16:50:11 2014 -0800

----------------------------------------------------------------------
 .../query/ir/result/AbstractScanColumnTest.java | 84 ++++++++++++++++++++
 1 file changed, 84 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/3c2f803f/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java b/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
new file mode 100644
index 0000000..0b56220
--- /dev/null
+++ b/stack/core/src/test/java/org/usergrid/persistence/query/ir/result/AbstractScanColumnTest.java
@@ -0,0 +1,84 @@
+package org.usergrid.persistence.query.ir.result;
+
+
+import java.nio.ByteBuffer;
+import java.util.UUID;
+
+import org.junit.Test;
+import org.usergrid.utils.UUIDUtils;
+
+import static junit.framework.Assert.assertNull;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+
+
+/**
+ * Simple test to test null value
+ */
+public class AbstractScanColumnTest {
+
+    @Test
+    public void testValues() {
+        final UUID uuid = UUIDUtils.newTimeUUID();
+        final ByteBuffer buffer = ByteBuffer.allocate( 4 );
+        buffer.putInt( 1 );
+        buffer.rewind();
+
+        TestScanColumn col = new TestScanColumn( uuid, buffer );
+
+        assertSame( uuid, col.getUUID() );
+
+        assertEquals( 1, col.getCursorValue().getInt() );
+    }
+
+
+    @Test
+    public void nullUUID() {
+        final UUID uuid = null;
+        final ByteBuffer buffer = ByteBuffer.allocate( 4 );
+        buffer.putInt( 1 );
+        buffer.rewind();
+
+        TestScanColumn col = new TestScanColumn( uuid, buffer );
+
+        assertNull( col.getUUID() );
+
+        assertEquals( 1, col.getCursorValue().getInt() );
+    }
+
+
+    @Test
+    public void nullBuffer() {
+        final UUID uuid = UUIDUtils.newTimeUUID();
+        final ByteBuffer buffer = null;
+
+        TestScanColumn col = new TestScanColumn( uuid, buffer );
+
+        assertSame( uuid, col.getUUID() );
+
+        assertNull( col.getCursorValue() );
+    }
+
+
+    @Test
+    public void nullBoth() {
+        final UUID uuid = null;
+        final ByteBuffer buffer = null;
+
+        TestScanColumn col = new TestScanColumn( uuid, buffer );
+
+        assertNull( col.getUUID() );
+
+        assertNull( col.getCursorValue() );
+    }
+
+
+
+
+    private class TestScanColumn extends AbstractScanColumn {
+
+        protected TestScanColumn( final UUID uuid, final ByteBuffer buffer ) {
+            super( uuid, buffer );
+        }
+    }
+}