Repository: phoenix
Updated Branches:
  refs/heads/4.x-HBase-0.98 18e52cc4c -> 60f0e68d9


PHOENIX-2097 Add new MD5 test for composite PK


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

Branch: refs/heads/4.x-HBase-0.98
Commit: 93b19387b3365e54f40f635b31a4841724fa6edb
Parents: 18e52cc
Author: James Taylor <jtay...@salesforce.com>
Authored: Thu Jul 2 10:03:55 2015 -0700
Committer: James Taylor <jamestay...@apache.org>
Committed: Wed Jul 8 16:05:16 2015 -0700

----------------------------------------------------------------------
 .../apache/phoenix/end2end/MD5FunctionIT.java    | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/phoenix/blob/93b19387/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
----------------------------------------------------------------------
diff --git 
a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java 
b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
index ff7ebdb..a6107df 100644
--- a/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
+++ b/phoenix-core/src/it/java/org/apache/phoenix/end2end/MD5FunctionIT.java
@@ -52,6 +52,25 @@ public class MD5FunctionIT extends BaseHBaseManagedTimeIT {
   }      
   
   @Test
+  public void testRetrieveCompositeKey() throws Exception {
+      String testString = "FOOBAR";
+      
+      Connection conn = DriverManager.getConnection(getUrl());
+      String ddl = "CREATE TABLE IF NOT EXISTS MD5_RETRIEVE_TEST (k1 CHAR(3) 
NOT NULL, k2 CHAR(3) NOT NULL, CONSTRAINT PK PRIMARY KEY (K1,K2))";
+      conn.createStatement().execute(ddl);
+      String dml = "UPSERT INTO MD5_RETRIEVE_TEST VALUES('FOO','BAR')";
+      conn.createStatement().execute(dml);
+      conn.commit();
+      
+      ResultSet rs = conn.createStatement().executeQuery("SELECT MD5((K1,K2)) 
FROM MD5_RETRIEVE_TEST");
+      assertTrue(rs.next());
+      byte[] first = 
MessageDigest.getInstance("MD5").digest(testString.getBytes());
+      byte[] second = rs.getBytes(1);
+      assertArrayEquals(first, second);
+      assertFalse(rs.next());
+  }      
+  
+  @Test
   public void testUpsert() throws Exception {
       String testString1 = "mwalsh1";
       String testString2 = "mwalsh2";

Reply via email to