sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kathl...@apache.org
Subject git commit: SQOOP-1083: Split HBaseImportTest into multiple independent tests
Date Fri, 14 Jun 2013 19:20:36 GMT
Updated Branches:
  refs/heads/trunk 5bfd84e13 -> 931da2b12


SQOOP-1083: Split HBaseImportTest into multiple independent tests

(Jarek Jarcec Cecho via Kate Ting)


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

Branch: refs/heads/trunk
Commit: 931da2b126276d227c22b874ea65cda3a9059124
Parents: 5bfd84e
Author: Kate Ting <kathleen@apache.org>
Authored: Fri Jun 14 15:19:30 2013 -0400
Committer: Kate Ting <kathleen@apache.org>
Committed: Fri Jun 14 15:19:30 2013 -0400

----------------------------------------------------------------------
 .../com/cloudera/sqoop/ThirdPartyTests.java     |  6 ++
 .../sqoop/hbase/HBaseImportAddRowKeyTest.java   | 63 +++++++++++++++++
 .../sqoop/hbase/HBaseImportNullTest.java        | 60 ++++++++++++++++
 .../cloudera/sqoop/hbase/HBaseImportTest.java   | 73 --------------------
 .../sqoop/hbase/HBaseImportTypesTest.java       | 40 +++++++++++
 5 files changed, 169 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/931da2b1/src/test/com/cloudera/sqoop/ThirdPartyTests.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/ThirdPartyTests.java b/src/test/com/cloudera/sqoop/ThirdPartyTests.java
index 7e361d2..7b1fa26 100644
--- a/src/test/com/cloudera/sqoop/ThirdPartyTests.java
+++ b/src/test/com/cloudera/sqoop/ThirdPartyTests.java
@@ -18,6 +18,9 @@
 
 package com.cloudera.sqoop;
 
+import com.cloudera.sqoop.hbase.HBaseImportAddRowKeyTest;
+import com.cloudera.sqoop.hbase.HBaseImportNullTest;
+import com.cloudera.sqoop.hbase.HBaseImportTypesTest;
 import org.apache.sqoop.hcat.HCatalogExportTest;
 import org.apache.sqoop.hcat.HCatalogImportTest;
 
@@ -71,6 +74,9 @@ public final class ThirdPartyTests extends TestCase {
 
     // Hbase
     suite.addTestSuite(HBaseImportTest.class);
+    suite.addTestSuite(HBaseImportAddRowKeyTest.class);
+    suite.addTestSuite(HBaseImportNullTest.class);
+    suite.addTestSuite(HBaseImportTypesTest.class);
     suite.addTestSuite(HBaseQueryImportTest.class);
     suite.addTestSuite(HBaseUtilTest.class);
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/931da2b1/src/test/com/cloudera/sqoop/hbase/HBaseImportAddRowKeyTest.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/hbase/HBaseImportAddRowKeyTest.java b/src/test/com/cloudera/sqoop/hbase/HBaseImportAddRowKeyTest.java
new file mode 100644
index 0000000..bd1cd2d
--- /dev/null
+++ b/src/test/com/cloudera/sqoop/hbase/HBaseImportAddRowKeyTest.java
@@ -0,0 +1,63 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cloudera.sqoop.hbase;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class HBaseImportAddRowKeyTest extends HBaseTestCase {
+
+  @Test
+  public void testAddRowKey() throws IOException {
+    String[] types = { "INT", "INT" };
+    String[] vals = { "0", "1" };
+    createTableWithColTypes(types, vals);
+
+    String[] otherArg = getArgv(true, "addRowKeyT", "addRowKeyF", true, null);
+    String[] argv = new String[otherArg.length + 2];
+    argv[0] = "-D";
+    argv[1] = "sqoop.hbase.add.row.key=true";
+    System.arraycopy(otherArg, 0, argv, 2, otherArg.length);
+
+    runImport(argv);
+
+    // Row key should have been added
+    verifyHBaseCell("addRowKeyT", "0", "addRowKeyF", getColName(0), "0");
+    verifyHBaseCell("addRowKeyT", "0", "addRowKeyF", getColName(1), "1");
+  }
+
+  @Test
+  public void testAddRowKeyDefault() throws IOException {
+    String[] types = { "INT", "INT" };
+    String[] vals = { "0", "1" };
+    createTableWithColTypes(types, vals);
+
+    String[] argv = getArgv(true, "addRowKeyDfT", "addRowKeyDfF", true, null);
+
+    runImport(argv);
+
+    // Row key should not be added by default
+    verifyHBaseCell("addRowKeyDfT", "0", "addRowKeyDfF", getColName(0), null);
+    verifyHBaseCell("addRowKeyDfT", "0", "addRowKeyDfF", getColName(1), "1");
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/931da2b1/src/test/com/cloudera/sqoop/hbase/HBaseImportNullTest.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/hbase/HBaseImportNullTest.java b/src/test/com/cloudera/sqoop/hbase/HBaseImportNullTest.java
new file mode 100644
index 0000000..58566fc
--- /dev/null
+++ b/src/test/com/cloudera/sqoop/hbase/HBaseImportNullTest.java
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cloudera.sqoop.hbase;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class HBaseImportNullTest extends HBaseTestCase {
+
+  @Test
+  public void testNullRow() throws IOException {
+    String [] argv = getArgv(true, "nullRowT", "nullRowF", true, null);
+    String [] types = { "INT", "INT" };
+    String [] vals = { "0", "null" };
+    createTableWithColTypes(types, vals);
+    runImport(argv);
+
+    // This cell should not be placed in the results..
+    verifyHBaseCell("nullRowT", "0", "nullRowF", getColName(1), null);
+
+    int rowCount = countHBaseTable("nullRowT", "nullRowF");
+    assertEquals(0, rowCount);
+  }
+
+  @Test
+  public void testNulls() throws IOException {
+    String [] argv = getArgv(true, "nullT", "nullF", true, null);
+    String [] types = { "INT", "INT", "INT" };
+    String [] vals = { "0", "42", "null" };
+    createTableWithColTypes(types, vals);
+    runImport(argv);
+
+    // This cell should import correctly.
+    verifyHBaseCell("nullT", "0", "nullF", getColName(1), "42");
+
+    // This cell should not be placed in the results..
+    verifyHBaseCell("nullT", "0", "nullF", getColName(2), null);
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/931da2b1/src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java b/src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
index d411f3d..a5e1bea 100644
--- a/src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
+++ b/src/test/com/cloudera/sqoop/hbase/HBaseImportTest.java
@@ -70,31 +70,6 @@ public class HBaseImportTest extends HBaseTestCase {
   }
 
   @Test
-  public void testStrings() throws IOException {
-    String [] argv = getArgv(true, "stringT", "stringF", true, null);
-    String [] types = { "INT", "VARCHAR(32)" };
-    String [] vals = { "0", "'abc'" };
-    createTableWithColTypes(types, vals);
-    runImport(argv);
-    verifyHBaseCell("stringT", "0", "stringF", getColName(1), "abc");
-  }
-
-  @Test
-  public void testNulls() throws IOException {
-    String [] argv = getArgv(true, "nullT", "nullF", true, null);
-    String [] types = { "INT", "INT", "INT" };
-    String [] vals = { "0", "42", "null" };
-    createTableWithColTypes(types, vals);
-    runImport(argv);
-
-    // This cell should import correctly.
-    verifyHBaseCell("nullT", "0", "nullF", getColName(1), "42");
-
-    // This cell should not be placed in the results..
-    verifyHBaseCell("nullT", "0", "nullF", getColName(2), null);
-  }
-
-  @Test
   public void testExitFailure() throws IOException {
     String [] types = { "INT", "INT", "INT" };
     String [] vals = { "0", "42", "43" };
@@ -113,52 +88,4 @@ public class HBaseImportTest extends HBaseTestCase {
     fail("should have gotten exception");
   }
 
-  @Test
-  public void testNullRow() throws IOException {
-    String [] argv = getArgv(true, "nullRowT", "nullRowF", true, null);
-    String [] types = { "INT", "INT" };
-    String [] vals = { "0", "null" };
-    createTableWithColTypes(types, vals);
-    runImport(argv);
-
-    // This cell should not be placed in the results..
-    verifyHBaseCell("nullRowT", "0", "nullRowF", getColName(1), null);
-
-    int rowCount = countHBaseTable("nullRowT", "nullRowF");
-    assertEquals(0, rowCount);
-  }
-
-  @Test
-  public void testAddRowKey() throws IOException {
-    String[] types = { "INT", "INT" };
-    String[] vals = { "0", "1" };
-    createTableWithColTypes(types, vals);
-
-    String[] otherArg = getArgv(true, "addRowKeyT", "addRowKeyF", true, null);
-    String[] argv = new String[otherArg.length + 2];
-    argv[0] = "-D";
-    argv[1] = "sqoop.hbase.add.row.key=true";
-    System.arraycopy(otherArg, 0, argv, 2, otherArg.length);
-
-    runImport(argv);
-
-    // Row key should have been added
-    verifyHBaseCell("addRowKeyT", "0", "addRowKeyF", getColName(0), "0");
-    verifyHBaseCell("addRowKeyT", "0", "addRowKeyF", getColName(1), "1");
-  }
-
-  @Test
-  public void testAddRowKeyDefault() throws IOException {
-    String[] types = { "INT", "INT" };
-    String[] vals = { "0", "1" };
-    createTableWithColTypes(types, vals);
-
-    String[] argv = getArgv(true, "addRowKeyDfT", "addRowKeyDfF", true, null);
-
-    runImport(argv);
-
-    // Row key should not be added by default
-    verifyHBaseCell("addRowKeyDfT", "0", "addRowKeyDfF", getColName(0), null);
-    verifyHBaseCell("addRowKeyDfT", "0", "addRowKeyDfF", getColName(1), "1");
-  }
 }

http://git-wip-us.apache.org/repos/asf/sqoop/blob/931da2b1/src/test/com/cloudera/sqoop/hbase/HBaseImportTypesTest.java
----------------------------------------------------------------------
diff --git a/src/test/com/cloudera/sqoop/hbase/HBaseImportTypesTest.java b/src/test/com/cloudera/sqoop/hbase/HBaseImportTypesTest.java
new file mode 100644
index 0000000..ae08a66
--- /dev/null
+++ b/src/test/com/cloudera/sqoop/hbase/HBaseImportTypesTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.cloudera.sqoop.hbase;
+
+import java.io.IOException;
+
+import org.junit.Test;
+
+/**
+ *
+ */
+public class HBaseImportTypesTest extends HBaseTestCase {
+
+  @Test
+  public void testStrings() throws IOException {
+    String [] argv = getArgv(true, "stringT", "stringF", true, null);
+    String [] types = { "INT", "VARCHAR(32)" };
+    String [] vals = { "0", "'abc'" };
+    createTableWithColTypes(types, vals);
+    runImport(argv);
+    verifyHBaseCell("stringT", "0", "stringF", getColName(1), "abc");
+  }
+
+}


Mime
View raw message