You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/03/26 15:57:48 UTC

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #4952: Add operations on cursors to EncryptResultSet(Suitable for a single data source) by originalResultSet

terrymanu commented on a change in pull request #4952: Add operations on cursors to EncryptResultSet(Suitable for a single data source) by originalResultSet
URL: https://github.com/apache/incubator-shardingsphere/pull/4952#discussion_r398686092
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/test/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/resultset/EncryptResultSetTest.java
 ##########
 @@ -0,0 +1,32 @@
+package org.apache.shardingsphere.shardingjdbc.jdbc.core.resultset;
+
+import org.apache.shardingsphere.shardingjdbc.common.base.AbstractEncryptJDBCDatabaseAndTableTest;
+import org.junit.Test;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class EncryptResultSetTest extends AbstractEncryptJDBCDatabaseAndTableTest {
+
+    private static final String SELECT_SQL_TO_ASSERT = "SELECT id, cipher_pwd, plain_pwd FROM t_encrypt";
+
+    @Test
+    public void assertResultSetIsBeforeFirst() throws SQLException {
+        try (Statement statement = getEncryptConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+                ResultSet.CONCUR_READ_ONLY)) {
+            ResultSet resultSet = statement.executeQuery(SELECT_SQL_TO_ASSERT);
+            assertTrue(resultSet.isBeforeFirst());
+            resultSet.next();
+            assertEquals(1, resultSet.getRow());
+            resultSet.afterLast();
+            assertTrue(resultSet.isAfterLast());
+            resultSet.beforeFirst();
+            assertTrue(resultSet.isBeforeFirst());
+        }
+    }
+
 
 Review comment:
   please remove useless blank line

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services