This is an automated email from the ASF dual-hosted git repository.

agingade pushed a commit to branch feature/GEODE-4947
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 0c936470b4c18c03e25e500e54d4e413e611359a
Author: Nick Reich <nre...@pivotal.io>
AuthorDate: Wed Mar 28 11:05:11 2018 -0700

    GEODE-4947: Fix failing tests due to type conversions
---
 .../org/apache/geode/connectors/jdbc/JdbcDUnitTest.java  |  5 +++--
 .../geode/connectors/jdbc/JdbcLoaderIntegrationTest.java | 16 ++++++----------
 .../connectors/jdbc/MySqlJdbcLoaderIntegrationTest.java  | 12 +++++++++++-
 .../jdbc/PostgresJdbcLoaderIntegrationTest.java          | 11 +++++++++++
 4 files changed, 31 insertions(+), 13 deletions(-)

diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcDUnitTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcDUnitTest.java
index e63d480..90cfd17 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcDUnitTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcDUnitTest.java
@@ -25,6 +25,7 @@ import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
 import java.sql.Types;
+import java.time.Instant;
 import java.util.Date;
 import java.util.Properties;
 import java.util.concurrent.TimeUnit;
@@ -507,7 +508,7 @@ public class JdbcDUnitTest implements Serializable {
     client.invoke(() -> {
       String key = "id1";
       ClassWithSupportedPdxFields value = new 
ClassWithSupportedPdxFields(true, (byte) 1, (short) 2,
-          3, 4, 5.5f, 6.0, "BigEmp", new Date(100000), "BigEmpObject", new 
byte[] {1, 2}, 'c');
+          3, 4, 5.5f, 6.0, "BigEmp", new Date(0), "BigEmpObject", new byte[] 
{1, 2}, 'c');
       Region<String, ClassWithSupportedPdxFields> region =
           ClusterStartupRule.getClientCache().getRegion(REGION_NAME);
       region.put(key, value);
@@ -550,7 +551,7 @@ public class JdbcDUnitTest implements Serializable {
     createMapping(REGION_NAME, CONNECTION_NAME, 
ClassWithSupportedPdxFields.class.getName(), false);
     String key = "id1";
     ClassWithSupportedPdxFields value = new ClassWithSupportedPdxFields(true, 
(byte) 1, (short) 2,
-        3, 4, 5.5f, 6.0, "BigEmp", new Date(100000), "BigEmpObject", new 
byte[] {1, 2}, 'c');
+        3, 4, 5.5f, 6.0, "BigEmp", new Date(0), "BigEmpObject", new byte[] {1, 
2}, 'c');
 
     server.invoke(() -> {
       insertDataForAllSupportedFieldsTable(key, value);
diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcLoaderIntegrationTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcLoaderIntegrationTest.java
index 6a9dfbd..1e14c6d 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcLoaderIntegrationTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JdbcLoaderIntegrationTest.java
@@ -23,6 +23,7 @@ import java.sql.DriverManager;
 import java.sql.PreparedStatement;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.time.Instant;
 import java.util.Date;
 
 import org.junit.After;
@@ -84,19 +85,14 @@ public abstract class JdbcLoaderIntegrationTest {
 
   public abstract String getConnectionUrl();
 
+  protected abstract void createClassWithSupportedPdxFieldsTable(Statement 
statement, String tableName)
+      throws SQLException;
+
   private void createEmployeeTable() throws Exception {
     statement.execute("Create Table " + REGION_TABLE_NAME
         + " (id varchar(10) primary key not null, name varchar(10), age int)");
   }
 
-  private void createClassWithSupportedPdxFieldsTable() throws Exception {
-    statement.execute("Create Table " + REGION_TABLE_NAME
-        + " (id varchar(10) primary key not null, " + "aboolean smallint, " + 
"abyte smallint, "
-        + "ashort smallint, " + "anint int, " + "along bigint, " + "afloat 
float, "
-        + "adouble float, " + "astring varchar(10), " + "adate timestamp, "
-        + "anobject varchar(20), " + "abytearray blob(100), " + "achar 
char(1))");
-  }
-
   private void closeDB() throws Exception {
     if (statement == null) {
       statement = connection.createStatement();
@@ -153,7 +149,7 @@ public abstract class JdbcLoaderIntegrationTest {
 
   @Test
   public void verifyGetWithSupportedFieldsWithPdxClassName() throws Exception {
-    createClassWithSupportedPdxFieldsTable();
+    createClassWithSupportedPdxFieldsTable(statement, REGION_TABLE_NAME);
     ClassWithSupportedPdxFields classWithSupportedPdxFields =
         createClassWithSupportedPdxFieldsForInsert();
     insertIntoClassWithSupportedPdxFieldsTable("1", 
classWithSupportedPdxFields);
@@ -203,7 +199,7 @@ public abstract class JdbcLoaderIntegrationTest {
   private ClassWithSupportedPdxFields 
createClassWithSupportedPdxFieldsForInsert() {
     ClassWithSupportedPdxFields classWithSupportedPdxFields =
         new ClassWithSupportedPdxFields(true, (byte) 1, (short) 2, 3, 4, 5.5f, 
6.0, "BigEmp",
-            new Date(100000), "BigEmpObject", new byte[] {1, 2}, 'c');
+            new Date(0), "BigEmpObject", new byte[] {1, 2}, 'c');
 
     return classWithSupportedPdxFields;
   }
diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/MySqlJdbcLoaderIntegrationTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/MySqlJdbcLoaderIntegrationTest.java
index 9555769..1eb8e07 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/MySqlJdbcLoaderIntegrationTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/MySqlJdbcLoaderIntegrationTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.connectors.jdbc;
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.Statement;
 
 import org.junit.ClassRule;
 import org.junit.experimental.categories.Category;
@@ -41,4 +42,13 @@ public class MySqlJdbcLoaderIntegrationTest extends 
JdbcLoaderIntegrationTest {
   public String getConnectionUrl() {
     return dbRule.getConnectionUrl();
   }
-}
+
+  @Override
+  protected void createClassWithSupportedPdxFieldsTable(Statement statement, 
String tableName)
+      throws SQLException {
+    statement.execute("CREATE TABLE " + tableName
+        + " (id varchar(10) primary key not null, " + "aboolean smallint, " + 
"abyte smallint, "
+        + "ashort smallint, " + "anint int, " + "along bigint, " + "afloat 
float, "
+        + "adouble float, " + "astring varchar(10), " + "adate datetime, "
+        + "anobject varchar(20), " + "abytearray blob(100), " + "achar 
char(1))");
+  }}
diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/PostgresJdbcLoaderIntegrationTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/PostgresJdbcLoaderIntegrationTest.java
index 0a96d5f..62a1b14 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/PostgresJdbcLoaderIntegrationTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/PostgresJdbcLoaderIntegrationTest.java
@@ -16,6 +16,7 @@ package org.apache.geode.connectors.jdbc;
 
 import java.sql.Connection;
 import java.sql.SQLException;
+import java.sql.Statement;
 
 import org.junit.ClassRule;
 import org.junit.experimental.categories.Category;
@@ -41,4 +42,14 @@ public class PostgresJdbcLoaderIntegrationTest extends 
JdbcLoaderIntegrationTest
   public String getConnectionUrl() {
     return dbRule.getConnectionUrl();
   }
+
+  @Override
+  protected void createClassWithSupportedPdxFieldsTable(Statement statement, 
String tableName)
+      throws SQLException {
+    statement.execute("CREATE TABLE " + tableName
+        + " (id varchar(10) primary key not null, " + "aboolean boolean, " + 
"abyte smallint, "
+        + "ashort smallint, " + "anint int, " + "along bigint, " + "afloat 
float, "
+        + "adouble float, " + "astring varchar(10), " + "adate timestamp, "
+        + "anobject varchar(20), " + "abytearray bytea, " + "achar char(1))");
+  }
 }

-- 
To stop receiving notification emails like this one, please contact
aging...@apache.org.

Reply via email to