You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apex.apache.org by hs...@apache.org on 2016/08/10 20:35:17 UTC

[1/2] apex-malhar git commit: APEXMALHAR-2168 #resolve #comment Bug fixed in JdbcPOJOInputOperator. Modified JdbcOperatorTest.

Repository: apex-malhar
Updated Branches:
  refs/heads/master 37cb58484 -> 3316d6a78


APEXMALHAR-2168 #resolve #comment Bug fixed in JdbcPOJOInputOperator. Modified JdbcOperatorTest.


Project: http://git-wip-us.apache.org/repos/asf/apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-malhar/commit/fe1b0ec3
Tree: http://git-wip-us.apache.org/repos/asf/apex-malhar/tree/fe1b0ec3
Diff: http://git-wip-us.apache.org/repos/asf/apex-malhar/diff/fe1b0ec3

Branch: refs/heads/master
Commit: fe1b0ec3a1dfc7cf433d634f251ee7090170a86f
Parents: d06b2d9
Author: Shunxin <lu...@hotmail.com>
Authored: Wed Jul 27 10:29:09 2016 -0700
Committer: Shunxin <lu...@hotmail.com>
Committed: Wed Jul 27 10:29:09 2016 -0700

----------------------------------------------------------------------
 .../lib/db/jdbc/JdbcPOJOInputOperator.java      |  2 +-
 .../lib/db/jdbc/JdbcOperatorTest.java           | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/fe1b0ec3/library/src/main/java/com/datatorrent/lib/db/jdbc/JdbcPOJOInputOperator.java
----------------------------------------------------------------------
diff --git a/library/src/main/java/com/datatorrent/lib/db/jdbc/JdbcPOJOInputOperator.java b/library/src/main/java/com/datatorrent/lib/db/jdbc/JdbcPOJOInputOperator.java
index 2e0993f..59c2807 100644
--- a/library/src/main/java/com/datatorrent/lib/db/jdbc/JdbcPOJOInputOperator.java
+++ b/library/src/main/java/com/datatorrent/lib/db/jdbc/JdbcPOJOInputOperator.java
@@ -400,7 +400,7 @@ public class JdbcPOJOInputOperator extends AbstractJdbcInputOperator<Object>
           break;
 
         case (Types.DOUBLE):
-          activeFieldInfo.setterOrGetter = PojoUtils.createGetterDouble(pojoClass,
+          activeFieldInfo.setterOrGetter = PojoUtils.createSetterDouble(pojoClass,
               activeFieldInfo.fieldInfo.getPojoFieldExpression());
           break;
 

http://git-wip-us.apache.org/repos/asf/apex-malhar/blob/fe1b0ec3/library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java
----------------------------------------------------------------------
diff --git a/library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java b/library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java
index e432ab3..6c7e7d4 100644
--- a/library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java
+++ b/library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java
@@ -80,6 +80,7 @@ public class JdbcOperatorTest
     private Date startDate;
     private Time startTime;
     private Timestamp startTimestamp;
+    private double score;
 
     public TestPOJOEvent()
     {
@@ -140,7 +141,16 @@ public class JdbcOperatorTest
     {
       this.startTimestamp = startTimestamp;
     }
-
+  
+    public double getScore()
+    {
+      return score;
+    }
+  
+    public void setScore(double score)
+    {
+      this.score = score;
+    }
   }
 
   @BeforeClass
@@ -164,7 +174,7 @@ public class JdbcOperatorTest
       String createTable = "CREATE TABLE IF NOT EXISTS " + TABLE_NAME + " (ID INTEGER)";
       stmt.executeUpdate(createTable);
       String createPOJOTable = "CREATE TABLE IF NOT EXISTS " + TABLE_POJO_NAME
-          + "(id INTEGER not NULL,name VARCHAR(255),startDate DATE,startTime TIME,startTimestamp TIMESTAMP, PRIMARY KEY ( id ))";
+          + "(id INTEGER not NULL,name VARCHAR(255),startDate DATE,startTime TIME,startTimestamp TIMESTAMP, score DOUBLE, PRIMARY KEY ( id ))";
       stmt.executeUpdate(createPOJOTable);
       String createPOJOTableIdDiff = "CREATE TABLE IF NOT EXISTS " + TABLE_POJO_NAME_ID_DIFF
           + "(id1 INTEGER not NULL,name VARCHAR(255), PRIMARY KEY ( id1 ))";
@@ -698,6 +708,7 @@ public class JdbcOperatorTest
     fieldInfos.add(new FieldInfo("STARTDATE", "startDate", null));
     fieldInfos.add(new FieldInfo("STARTTIME", "startTime", null));
     fieldInfos.add(new FieldInfo("STARTTIMESTAMP", "startTimestamp", null));
+    fieldInfos.add(new FieldInfo("SCORE", "score", FieldInfo.SupportType.DOUBLE));
     inputOperator.setFieldInfos(fieldInfos);
 
     inputOperator.setFetchSize(5);
@@ -741,6 +752,7 @@ public class JdbcOperatorTest
       Assert.assertTrue("date", pojoEvent.getStartDate() instanceof Date);
       Assert.assertTrue("time", pojoEvent.getStartTime() instanceof Time);
       Assert.assertTrue("timestamp", pojoEvent.getStartTimestamp() instanceof Timestamp);
+      Assert.assertTrue("score", pojoEvent.getScore() == 55.4);
       i++;
     }
 
@@ -766,6 +778,7 @@ public class JdbcOperatorTest
       Assert.assertTrue("date", pojoEvent.getStartDate() instanceof Date);
       Assert.assertTrue("time", pojoEvent.getStartTime() instanceof Time);
       Assert.assertTrue("timestamp", pojoEvent.getStartTimestamp() instanceof Timestamp);
+      Assert.assertTrue("score", pojoEvent.getScore() == 55.4);
       i++;
     }
   }
@@ -779,7 +792,7 @@ public class JdbcOperatorTest
         stmt.executeUpdate(cleanTable);
       }
 
-      String insert = "insert into " + TABLE_POJO_NAME + " values (?,?,?,?,?)";
+      String insert = "insert into " + TABLE_POJO_NAME + " values (?,?,?,?,?,?)";
       PreparedStatement pStmt = con.prepareStatement(insert);
       con.prepareStatement(insert);
 
@@ -789,6 +802,7 @@ public class JdbcOperatorTest
         pStmt.setDate(3, new Date(2016, 1, 1));
         pStmt.setTime(4, new Time(2016, 1, 1));
         pStmt.setTimestamp(5, new Timestamp(2016, 1, 1, 0, 0, 0, 0));
+        pStmt.setDouble(6, new Double(55.4));
         pStmt.executeUpdate();
       }
     } catch (SQLException e) {


[2/2] apex-malhar git commit: Merge branch 'APEXMALHAR-2168' of github.com:ShunxinLu/apex-malhar

Posted by hs...@apache.org.
Merge branch 'APEXMALHAR-2168' of github.com:ShunxinLu/apex-malhar


Project: http://git-wip-us.apache.org/repos/asf/apex-malhar/repo
Commit: http://git-wip-us.apache.org/repos/asf/apex-malhar/commit/3316d6a7
Tree: http://git-wip-us.apache.org/repos/asf/apex-malhar/tree/3316d6a7
Diff: http://git-wip-us.apache.org/repos/asf/apex-malhar/diff/3316d6a7

Branch: refs/heads/master
Commit: 3316d6a78c1cd7101e23f0466a8c9dc0aa6386ed
Parents: 37cb584 fe1b0ec
Author: Siyuan Hua <hs...@apache.org>
Authored: Wed Aug 10 13:34:42 2016 -0700
Committer: Siyuan Hua <hs...@apache.org>
Committed: Wed Aug 10 13:34:42 2016 -0700

----------------------------------------------------------------------
 .../lib/db/jdbc/JdbcPOJOInputOperator.java      |  2 +-
 .../lib/db/jdbc/JdbcOperatorTest.java           | 20 +++++++++++++++++---
 2 files changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------