geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dschnei...@apache.org
Subject [geode] branch feature/GEODE-3781 updated: tests that invalidate is unsupported
Date Mon, 30 Oct 2017 21:30:47 GMT
This is an automated email from the ASF dual-hosted git repository.

dschneider 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 6f7e1fb  tests that invalidate is unsupported
6f7e1fb is described below

commit 6f7e1fb5c1a9698b3ebdf7f9be876dcdb0887590
Author: Darrel Schneider <dschneider@pivotal.io>
AuthorDate: Mon Oct 30 14:30:27 2017 -0700

    tests that invalidate is unsupported
---
 .../apache/geode/connectors/jdbc/JDBCManager.java  |  4 +-
 .../connectors/jdbc/JDBCManagerUnitTestTest.java   | 44 ++++++++++++++--------
 2 files changed, 31 insertions(+), 17 deletions(-)

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 4160887..4e743bc 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
@@ -188,8 +188,8 @@ public class JDBCManager {
         Class.forName(this.config.getDriver());
       } catch (ClassNotFoundException e) {
         // TODO: consider a different exception
-        throw new IllegalStateException("Driver class \"" + this.config.getDriver() + "\"
not found",
-            e);
+        throw new IllegalStateException(
+            "Driver class \"" + this.config.getDriver() + "\" not found", e);
       }
     }
     try {
diff --git a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCManagerUnitTestTest.java
b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCManagerUnitTestTest.java
index 661d1b6..0587a43 100644
--- a/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCManagerUnitTestTest.java
+++ b/geode-connectors/src/test/java/org/apache/geode/connectors/jdbc/JDBCManagerUnitTestTest.java
@@ -52,7 +52,7 @@ public class JDBCManagerUnitTestTest {
   private String regionName = "jdbcRegion";
   Connection connection;
   PreparedStatement preparedStatement;
-  
+
   private static final String ID_COLUMN_NAME = "ID";
   private static final String NAME_COLUMN_NAME = "name";
   private static final String AGE_COLUMN_NAME = "age";
@@ -90,12 +90,10 @@ public class JDBCManagerUnitTestTest {
   }
 
   @Before
-  public void setUp() throws Exception {
-  }
+  public void setUp() throws Exception {}
 
   @After
-  public void tearDown() throws Exception {
-  }
+  public void tearDown() throws Exception {}
 
   private void createManager(String driver, String url) {
     Properties props = new Properties();
@@ -104,11 +102,11 @@ public class JDBCManagerUnitTestTest {
     JDBCConfiguration config = new JDBCConfiguration(props);
     this.mgr = new TestableJDBCManager(config);
   }
-  
+
   private void createDefaultManager() {
     createManager("java.lang.String", "fakeURL");
   }
-  
+
   @Test
   public void verifySimpleCreateCallsExecute() throws SQLException {
     createDefaultManager();
@@ -119,7 +117,8 @@ public class JDBCManagerUnitTestTest {
     verify(this.preparedStatement).execute();
     ArgumentCaptor<String> sqlCaptor = ArgumentCaptor.forClass(String.class);
     verify(this.connection).prepareStatement(sqlCaptor.capture());
-    assertThat(sqlCaptor.getValue()).isEqualTo("INSERT INTO " + regionName + "(" + NAME_COLUMN_NAME
+ ", " + AGE_COLUMN_NAME + ", " + ID_COLUMN_NAME + ") VALUES (?,?,?)");
+    assertThat(sqlCaptor.getValue()).isEqualTo("INSERT INTO " + regionName + "(" + NAME_COLUMN_NAME
+        + ", " + AGE_COLUMN_NAME + ", " + ID_COLUMN_NAME + ") VALUES (?,?,?)");
   }
 
   @Test
@@ -132,9 +131,10 @@ public class JDBCManagerUnitTestTest {
     verify(this.preparedStatement).execute();
     ArgumentCaptor<String> sqlCaptor = ArgumentCaptor.forClass(String.class);
     verify(this.connection).prepareStatement(sqlCaptor.capture());
-    assertThat(sqlCaptor.getValue()).isEqualTo("UPDATE " + regionName + " SET " + NAME_COLUMN_NAME
+ " = ?, " + AGE_COLUMN_NAME + " = ? WHERE " + ID_COLUMN_NAME + " = ?");
+    assertThat(sqlCaptor.getValue()).isEqualTo("UPDATE " + regionName + " SET " + NAME_COLUMN_NAME
+        + " = ?, " + AGE_COLUMN_NAME + " = ? WHERE " + ID_COLUMN_NAME + " = ?");
   }
-  
+
   @Test
   public void verifySimpleDestroyCallsExecute() throws SQLException {
     createDefaultManager();
@@ -144,9 +144,10 @@ public class JDBCManagerUnitTestTest {
     verify(this.preparedStatement).execute();
     ArgumentCaptor<String> sqlCaptor = ArgumentCaptor.forClass(String.class);
     verify(this.connection).prepareStatement(sqlCaptor.capture());
-    assertThat(sqlCaptor.getValue()).isEqualTo("DELETE FROM " + regionName + " WHERE " +
ID_COLUMN_NAME + " = ?");
+    assertThat(sqlCaptor.getValue())
+        .isEqualTo("DELETE FROM " + regionName + " WHERE " + ID_COLUMN_NAME + " = ?");
   }
-  
+
   @Test
   public void verifyTwoCreatesReuseSameStatement() throws SQLException {
     createDefaultManager();
@@ -170,12 +171,25 @@ public class JDBCManagerUnitTestTest {
     when(pdxInstance.getPdxType()).thenReturn(pdxType);
     return pdxInstance;
   }
-  
+
   @Test
   public void verifyMissingDriverClass() {
     createManager("non existent driver", "fakeURL");
     catchException(this.mgr).getConnection();
-    assertThat((Exception)caughtException()).isInstanceOf(IllegalStateException.class);
-    assertThat(caughtException().getMessage()).isEqualTo("Driver class \"non existent driver\"
not found");
+    assertThat((Exception) caughtException()).isInstanceOf(IllegalStateException.class);
+    assertThat(caughtException().getMessage())
+        .isEqualTo("Driver class \"non existent driver\" not found");
   }
+
+  @Test
+  public void verifySimpleInvalidateIsUnsupported() throws SQLException {
+    createDefaultManager();
+    GemFireCacheImpl cache = Fakes.cache();
+    Region region = Fakes.region(regionName, cache);
+    PdxInstanceImpl pdx1 = mockPdxInstance("Emp1", 21);
+    catchException(this.mgr).write(region, Operation.INVALIDATE, "1", pdx1);
+    assertThat((Exception) caughtException()).isInstanceOf(IllegalStateException.class);
+    assertThat(caughtException().getMessage()).isEqualTo("unsupported operation INVALIDATE");
+  }
+
 }

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

Mime
View raw message