You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sqoop.apache.org by ja...@apache.org on 2015/04/14 01:15:02 UTC

sqoop git commit: SQOOP-2303: EmptyTypeList when returned from DatabaseProvider class results in NPE in TestNG

Repository: sqoop
Updated Branches:
  refs/heads/sqoop2 59351b132 -> 5ea695a6d


SQOOP-2303: EmptyTypeList when returned from DatabaseProvider class results in NPE in TestNG

(Syed A. Hashmi via Jarek Jarcec Cecho)


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

Branch: refs/heads/sqoop2
Commit: 5ea695a6d93476b5d267babec90210f451ea23fd
Parents: 59351b1
Author: Jarek Jarcec Cecho <ja...@apache.org>
Authored: Mon Apr 13 16:14:28 2015 -0700
Committer: Jarek Jarcec Cecho <ja...@apache.org>
Committed: Mon Apr 13 16:14:28 2015 -0700

----------------------------------------------------------------------
 .../sqoop/common/test/db/DatabaseProvider.java  |  5 ++-
 .../common/test/db/types/DefaultTypeList.java   | 38 ++++++++++++++++++++
 .../common/test/db/types/EmptyTypeList.java     | 31 ----------------
 3 files changed, 40 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/5ea695a6/common-test/src/main/java/org/apache/sqoop/common/test/db/DatabaseProvider.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/DatabaseProvider.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/DatabaseProvider.java
index 7e17c09..dd4e546 100644
--- a/common-test/src/main/java/org/apache/sqoop/common/test/db/DatabaseProvider.java
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/db/DatabaseProvider.java
@@ -19,9 +19,8 @@ package org.apache.sqoop.common.test.db;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
-import org.apache.sqoop.common.test.db.types.DatabaseType;
 import org.apache.sqoop.common.test.db.types.DatabaseTypeList;
-import org.apache.sqoop.common.test.db.types.EmptyTypeList;
+import org.apache.sqoop.common.test.db.types.DefaultTypeList;
 
 import java.sql.Connection;
 import java.sql.DriverManager;
@@ -153,7 +152,7 @@ abstract public class DatabaseProvider {
    * @return
    */
   public DatabaseTypeList getDatabaseTypes() {
-    return new EmptyTypeList();
+    return new DefaultTypeList();
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5ea695a6/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
new file mode 100644
index 0000000..9abf243
--- /dev/null
+++ b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/DefaultTypeList.java
@@ -0,0 +1,38 @@
+/**
+ * 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 org.apache.sqoop.common.test.db.types;
+
+/**
+ * This class provides one default type to be consumed by Types Tests.
+ * Any DB provider which wants to have more types covered should provide
+ * a separate class and return that instead of this class.
+ */
+public class DefaultTypeList extends DatabaseTypeList {
+  public DefaultTypeList() {
+    super();
+
+    // Integer type
+    add(DatabaseType.builder("INT")
+        .addExample("-32768", new Integer(-32768), "-32768")
+        .addExample("-1", new Integer(-1), "-1")
+        .addExample("0", new Integer(0), "0")
+        .addExample("1", new Integer(1), "1")
+        .addExample("32767", new Integer(32767), "32767")
+        .build());
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/sqoop/blob/5ea695a6/common-test/src/main/java/org/apache/sqoop/common/test/db/types/EmptyTypeList.java
----------------------------------------------------------------------
diff --git a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/EmptyTypeList.java b/common-test/src/main/java/org/apache/sqoop/common/test/db/types/EmptyTypeList.java
deleted file mode 100644
index e60826c..0000000
--- a/common-test/src/main/java/org/apache/sqoop/common/test/db/types/EmptyTypeList.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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 org.apache.sqoop.common.test.db.types;
-
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Default implementation that don't have any types.
- */
-public class EmptyTypeList extends DatabaseTypeList {
-  @Override
-  public List<DatabaseType> getAllTypes() {
-    return new LinkedList<DatabaseType>();
-  }
-}