gora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lewi...@apache.org
Subject svn commit: r1505236 [2/2] - in /gora/trunk: ./ gora-accumulo/src/test/java/org/apache/gora/accumulo/store/ gora-accumulo/src/test/java/org/apache/gora/accumulo/util/ gora-cassandra/src/test/java/org/apache/gora/cassandra/store/ gora-core/src/main/java...
Date Sat, 20 Jul 2013 23:06:52 GMT
Modified: gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java?rev=1505236&r1=1505235&r2=1505236&view=diff
==============================================================================
--- gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java (original)
+++ gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/store/TestHBaseStore.java Sat
Jul 20 23:06:51 2013
@@ -18,31 +18,30 @@
 
 package org.apache.gora.hbase.store;
 
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.Arrays;
-import java.util.Properties;
-
-import junit.framework.Assert;
-
 import org.apache.avro.util.Utf8;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.gora.examples.WebPageDataCreator;
 import org.apache.gora.examples.generated.Employee;
 import org.apache.gora.examples.generated.WebPage;
 import org.apache.gora.hbase.GoraHBaseTestDriver;
 import org.apache.gora.store.DataStore;
 import org.apache.gora.store.DataStoreFactory;
 import org.apache.gora.store.DataStoreTestBase;
-import org.apache.gora.store.DataStoreTestUtil;
-import org.apache.gora.util.GoraException;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.HTable;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.Ignore;
 import org.junit.Test;
 
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertNotNull;
+
 /**
  * Test case for HBaseStore.
  */
@@ -79,11 +78,11 @@ public class TestHBaseStore extends Data
   public GoraHBaseTestDriver getTestDriver() {
     return (GoraHBaseTestDriver) testDriver;
   }
-  
+
   @Override
   public void assertSchemaExists(String schemaName) throws Exception {
     HBaseAdmin admin = getTestDriver().getHbaseUtil().getHBaseAdmin();
-    Assert.assertTrue(admin.tableExists(schemaName));
+    assertTrue(admin.tableExists(schemaName));
   }
 
   @Override
@@ -92,11 +91,11 @@ public class TestHBaseStore extends Data
     Get get = new Get(Bytes.toBytes("com.example/http"));
     org.apache.hadoop.hbase.client.Result result = table.get(get);
     
-    Assert.assertEquals(result.getFamilyMap(Bytes.toBytes("parsedContent")).size(), 4);
-    Assert.assertTrue(Arrays.equals(result.getValue(Bytes.toBytes("parsedContent")
+    assertEquals(result.getFamilyMap(Bytes.toBytes("parsedContent")).size(), 4);
+    assertTrue(Arrays.equals(result.getValue(Bytes.toBytes("parsedContent")
         ,Bytes.toBytes(0)), Bytes.toBytes("example")));
     
-    Assert.assertTrue(Arrays.equals(result.getValue(Bytes.toBytes("parsedContent")
+    assertTrue(Arrays.equals(result.getValue(Bytes.toBytes("parsedContent")
         ,Bytes.toBytes(3)), Bytes.toBytes("example.com")));
     table.close();
   }
@@ -115,8 +114,8 @@ public class TestHBaseStore extends Data
     org.apache.hadoop.hbase.client.Result result = table.get(get);
     
     byte[] actualBytes = result.getValue(Bytes.toBytes("content"), null);
-    Assert.assertNotNull(actualBytes);
-    Assert.assertTrue(Arrays.equals(contentBytes, actualBytes));
+    assertNotNull(actualBytes);
+    assertTrue(Arrays.equals(contentBytes, actualBytes));
     table.close();    
 
     // Since "content" is an optional field, we are forced to reopen the DataStore
@@ -129,13 +128,13 @@ public class TestHBaseStore extends Data
     webPageStore.close() ;
     webPageStore = testDriver.createDataStore(String.class, WebPage.class);
     page = webPageStore.get("com.example/http") ;
-    Assert.assertNull(page.getContent()) ;
+    assertNull(page.getContent()) ;
     // Check directly with HBase
     table = new HTable("WebPage");
     get = new Get(Bytes.toBytes("com.example/http"));
     result = table.get(get);
     actualBytes = result.getValue(Bytes.toBytes("content"), null);
-    Assert.assertNull(actualBytes);
+    assertNull(actualBytes);
     table.close();
     
     // Test writing+reading an empty bytes field. FIELD in HBASE MUST become EMPTY (byte[0])
@@ -145,16 +144,15 @@ public class TestHBaseStore extends Data
     webPageStore.close() ;
     webPageStore = testDriver.createDataStore(String.class, WebPage.class);
     page = webPageStore.get("com.example/http") ;
-    Assert.assertTrue(Arrays.equals("".getBytes(),page.getContent().array())) ;
+    assertTrue(Arrays.equals("".getBytes(),page.getContent().array())) ;
     // Check directly with HBase
     table = new HTable("WebPage");
     get = new Get(Bytes.toBytes("com.example/http"));
     result = table.get(get);
     actualBytes = result.getValue(Bytes.toBytes("content"), null);
-    Assert.assertNotNull(actualBytes);
-    Assert.assertEquals(0, actualBytes.length) ;
+    assertNotNull(actualBytes);
+    assertEquals(0, actualBytes.length) ;
     table.close();
-    
   }
   
   /**
@@ -180,8 +178,8 @@ public class TestHBaseStore extends Data
 
     byte[] bytesRead = result.getValue(Bytes.toBytes("content"), null);
     
-    Assert.assertNotNull(bytesRead) ;
-    Assert.assertTrue(Arrays.equals(bytesRead, contentBytes));
+    assertNotNull(bytesRead) ;
+    assertTrue(Arrays.equals(bytesRead, contentBytes));
   }
   
   /**
@@ -208,8 +206,8 @@ public class TestHBaseStore extends Data
         
     byte[] contentBytes = result.getValue(Bytes.toBytes("content"), null);
 
-    Assert.assertNull(webPageStore.get("com.example/http", new String[]{"content"})) ;
-    Assert.assertTrue(contentBytes == null || contentBytes.length == 0) ;
+    assertNull(webPageStore.get("com.example/http", new String[]{"content"})) ;
+    assertTrue(contentBytes == null || contentBytes.length == 0) ;
   }
   
   @Override
@@ -220,39 +218,39 @@ public class TestHBaseStore extends Data
     
     byte[] anchor2Raw = result.getValue(Bytes.toBytes("outlinks")
         , Bytes.toBytes("http://example2.com"));
-    Assert.assertNotNull(anchor2Raw);
+    assertNotNull(anchor2Raw);
     String anchor2 = Bytes.toString(anchor2Raw);
-    Assert.assertEquals("anchor2", anchor2);
+    assertEquals("anchor2", anchor2);
     table.close();
   }
 
 
+  @Ignore("We need to skip this test since gora considers endRow inclusive, while its exclusive
for HBase.")
   @Override
   public void testQueryEndKey() throws IOException {
-    //We need to skip this test since gora considers endRow inclusive, while its exclusinve
for HBase.
     //TODO: We should raise an issue for HBase to allow us to specify if the endRow will
be inclussive or exclusive.
   }
 
+  @Ignore("We need to skip this test since gora considers endRow inclusive, while its exclusive
for HBase.")
   @Override
   public void testQueryKeyRange() throws IOException {
-    //We need to skip this test since gora considers endRow inclusive, while its exclusinve
for HBase.
-    //TODO: We should raise an issue for HBase to allow us to specify if the endRow will
be inclussive or exclusive.
+     //TODO: We should raise an issue for HBase to allow us to specify if the endRow will
be inclussive or exclusive.
   }
 
+  @Ignore("We need to skip this test since gora considers endRow inclusive, while its exclusive
for HBase.")
   @Override
   public void testDeleteByQuery() throws IOException {
-    //We need to skip this test since gora considers endRow inclusive, while its exclusinve
for HBase.
-    //TODO: We should raise an issue for HBase to allow us to specify if the endRow will
be inclussive or exclusive.
+   //TODO: We should raise an issue for HBase to allow us to specify if the endRow will be
inclussive or exclusive.
   }
 
   public static void main(String[] args) throws Exception {
     TestHBaseStore test = new TestHBaseStore();
-    test.setUpClass();
+    setUpClass();
     test.setUp();
 
     test.testQuery();
 
     test.tearDown();
-    test.tearDownClass();
+    tearDownClass();
   }
 }

Modified: gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
URL: http://svn.apache.org/viewvc/gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java?rev=1505236&r1=1505235&r2=1505236&view=diff
==============================================================================
--- gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
(original)
+++ gora/trunk/gora-hbase/src/test/java/org/apache/gora/hbase/util/TestHBaseByteInterface.java
Sat Jul 20 23:06:51 2013
@@ -30,8 +30,7 @@ import java.util.concurrent.Future;
 import org.apache.avro.util.Utf8;
 import org.apache.gora.examples.generated.Employee;
 import org.apache.gora.examples.generated.Metadata;
-import org.apache.gora.examples.generated.TokenDatum;
-import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 
 public class TestHBaseByteInterface {
@@ -58,10 +57,10 @@ public class TestHBaseByteInterface {
       Employee e2 = (Employee) HBaseByteInterface.fromBytes(Employee._SCHEMA, 
           employerBytes);
       
-      Assert.assertEquals(name, e2.getName());
-      Assert.assertEquals(dateOfBirth, e2.getDateOfBirth());
-      Assert.assertEquals(salary, e2.getSalary());
-      Assert.assertEquals(ssn, e2.getSsn());
+      assertEquals(name, e2.getName());
+      assertEquals(dateOfBirth, e2.getDateOfBirth());
+      assertEquals(salary, e2.getSalary());
+      assertEquals(ssn, e2.getSsn());
       
       
       //metadata
@@ -75,7 +74,7 @@ public class TestHBaseByteInterface {
       Metadata m2 = (Metadata) HBaseByteInterface.fromBytes(Metadata._SCHEMA, 
           datumBytes);
       
-      Assert.assertEquals(value, m2.getFromData(key));
+      assertEquals(value, m2.getFromData(key));
     }
   }
   
@@ -109,7 +108,7 @@ public class TestHBaseByteInterface {
 
     // check results
     for (Future<Integer> result : results) {
-      Assert.assertEquals(0, (int) result.get());
+      assertEquals(0, (int) result.get());
     }
   }
 



Mime
View raw message