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

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


The following commit(s) were added to refs/heads/feature/GEODE-3781 by this 
push:
     new 238ed94  Added successfulEvent counter. Made changes in the test to 
validate successfulEvents.
238ed94 is described below

commit 238ed9476bed74000ae756554089f19c1fd2f01d
Author: Anil <aging...@pivotal.io>
AuthorDate: Tue Oct 24 14:20:18 2017 -0700

    Added successfulEvent counter. Made changes in the test to validate 
successfulEvents.
---
 .../geode/connectors/jdbc/JDBCAsyncWriter.java      |  3 ++-
 .../jdbc/JDBCAsyncWriterIntegrationTest.java        | 21 +++++++--------------
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git 
a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriter.java
 
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriter.java
index af06539..fdf619d 100644
--- 
a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriter.java
+++ 
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriter.java
@@ -40,6 +40,7 @@ public class JDBCAsyncWriter implements AsyncEventListener {
   @Override
   public boolean processEvents(List<AsyncEvent> events) {
     totalEvents += events.size();
+    successfulEvents += events.size();
     return true;
   }
 
@@ -52,7 +53,7 @@ public class JDBCAsyncWriter implements AsyncEventListener {
     return this.totalEvents;
   }
 
-  public long getsuccessfulEvents() {
+  public long getSuccessfulEvents() {
     return this.successfulEvents;
   }
 }
diff --git 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriterIntegrationTest.java
 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriterIntegrationTest.java
index 89101f6..4b5d14d 100644
--- 
a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriterIntegrationTest.java
+++ 
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCAsyncWriterIntegrationTest.java
@@ -97,7 +97,6 @@ public class JDBCAsyncWriterIntegrationTest {
   public void canInstallJDBCAsyncWriterOnRegion() {
     Region employees = createRegionWithJDBCAsyncWriter("employees");
     employees.put("1", "Emp1");
-    try {Thread.sleep(100);} catch (Exception ex){}
     employees.put("2", "Emp2");
 
     Awaitility.await().atMost(30, TimeUnit.SECONDS)
@@ -112,6 +111,9 @@ public class JDBCAsyncWriterIntegrationTest {
     employees.put("1", "Emp1");
     employees.put("2", "Emp2");
 
+    Awaitility.await().atMost(30, TimeUnit.SECONDS)
+    .until(() -> assertThat(jdbcWriter.getSuccessfulEvents()).isEqualTo(2));
+
     validateTableRowCount(2);
   }
 
@@ -126,19 +128,10 @@ public class JDBCAsyncWriterIntegrationTest {
   }
 
   private void validateTableRowCount(int expected) throws Exception {
-    Awaitility.await().atMost(1, TimeUnit.SECONDS).until(() -> {
-      int size = 0;
-      try {
-        ResultSet rs = stmt.executeQuery("select count(*) from " + 
regionTableName);
-        while (rs.next()) {
-          size = rs.getInt(1);
-        }
-      } catch (Exception ex) {
-        // Need to fix this.
-        System.out.println("Exception while getting the table row count");
-      }
-      assertThat(size).isEqualTo(expected);
-    });
+    ResultSet rs = stmt.executeQuery("select count(*) from " + 
regionTableName);
+    rs.next();
+    int size = rs.getInt(1);
+    assertThat(size).isEqualTo(expected);
   }
 
 }

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Reply via email to