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

commit 007baf9fa076c6aba9a1cd4795cb849f29d825d3
Author: Anil <aging...@pivotal.io>
AuthorDate: Wed Oct 25 16:32:08 2017 -0700

    Added getConnection().
---
 .../geode/connectors/jdbc/JDBCAsyncWriter.java     |  1 +
 .../apache/geode/connectors/jdbc/JDBCManager.java  |  2 --
 .../jdbc/JDBCAsyncWriterIntegrationTest.java       | 22 +++++++++++++++++-----
 3 files changed, 18 insertions(+), 7 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 54dfbaf..0d6d55f 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
@@ -53,6 +53,7 @@ public class JDBCAsyncWriter implements AsyncEventListener {
         successfulEvents += 1;
       } catch (RuntimeException ex) {
         // TODO: need to log exceptions here
+        throw ex;
       }
     }
     return true;
diff --git 
a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCManager.java
 
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCManager.java
index 3e4ad5a..c9031f1 100644
--- 
a/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCManager.java
+++ 
b/geode-connectors/src/main/java/org/apache/geode/connectors/jdbc/JDBCManager.java
@@ -38,8 +38,6 @@ public class JDBCManager {
 
   private Connection conn;
 
-  private Statement stmt;
-
   JDBCManager(JDBCConfiguration config) {
     this.config = config;
   }
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 68c1de0..c3ab71e 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
@@ -21,6 +21,7 @@ import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.ResultSet;
 import java.sql.Statement;
+import java.util.Properties;
 import java.util.concurrent.TimeUnit;
 
 import org.junit.*;
@@ -31,6 +32,7 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
+import org.apache.geode.connectors.jdbc.JDBCAsyncWriter;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.awaitility.Awaitility;
@@ -50,6 +52,10 @@ public class JDBCAsyncWriterIntegrationTest {
 
   private String regionTableName = "employees";
 
+  private String driver = "org.apache.derby.jdbc.EmbeddedDriver";
+
+  private String connectionURL = "jdbc:derby:memory:" + dbName + 
";create=true";
+
   @Before
   public void setup() throws Exception {
     try {
@@ -73,8 +79,6 @@ public class JDBCAsyncWriterIntegrationTest {
   }
 
   public void setupDB() throws Exception {
-    String driver = "org.apache.derby.jdbc.EmbeddedDriver";
-    String connectionURL = "jdbc:derby:memory:" + dbName + ";create=true";
     Class.forName(driver);
     conn = DriverManager.getConnection(connectionURL);
     stmt = conn.createStatement();
@@ -92,10 +96,17 @@ public class JDBCAsyncWriterIntegrationTest {
       conn.close();
     }
   }
+  
+  private Properties getRequiredProperties() {
+    Properties props = new Properties();
+    props.setProperty("driver", this.driver);
+    props.setProperty("url", this.connectionURL);
+    return props;
+  }
 
   @Test
   public void canInstallJDBCAsyncWriterOnRegion() {
-    Region employees = createRegionWithJDBCAsyncWriter("employees");
+    Region employees = createRegionWithJDBCAsyncWriter("employees", 
getRequiredProperties());
     employees.put("1", "Emp1");
     employees.put("2", "Emp2");
 
@@ -106,7 +117,7 @@ public class JDBCAsyncWriterIntegrationTest {
 
   @Test
   public void jdbcAsyncWriterCanWriteToDatabase() throws Exception {
-    Region employees = createRegionWithJDBCAsyncWriter("employees");
+    Region employees = createRegionWithJDBCAsyncWriter("employees", 
getRequiredProperties());
 
     employees.put("1", "Emp1");
     employees.put("2", "Emp2");
@@ -117,8 +128,9 @@ public class JDBCAsyncWriterIntegrationTest {
     validateTableRowCount(2);
   }
 
-  private Region createRegionWithJDBCAsyncWriter(String regionName) {
+  private Region createRegionWithJDBCAsyncWriter(String regionName, Properties 
props) {
     jdbcWriter = new JDBCAsyncWriter();
+    jdbcWriter.init(props);
     
cache.createAsyncEventQueueFactory().setBatchSize(1).setBatchTimeInterval(1)
         .create("jdbcAsyncQueue", jdbcWriter);
 

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

Reply via email to