This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new eb5d572 Add files via upload (#7058)
eb5d572 is described below
commit eb5d572acf1e01fbd738bb99fa309648324b6b9c
Author: dhc575757 <[email protected]>
AuthorDate: Tue Aug 25 19:47:54 2020 +0800
Add files via upload (#7058)
add test case for EncryptDQLResultDecorator #6864
---
.../merge/dql/EncryptDQLResultDecoratorTest.java | 55 ++++++++++++++++++++++
1 file changed, 55 insertions(+)
diff --git
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-merge/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptDQLResultDecoratorTest.java
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-merge/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptDQLResultDecoratorTest.java
new file mode 100644
index 0000000..a5ab806
--- /dev/null
+++
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-merge/src/test/java/org/apache/shardingsphere/encrypt/merge/dql/EncryptDQLResultDecoratorTest.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.encrypt.merge.dql;
+
+import org.apache.shardingsphere.infra.executor.sql.QueryResult;
+import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import
org.apache.shardingsphere.sql.parser.binder.metadata.schema.SchemaMetaData;
+import
org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
+import org.junit.Test;
+
+import java.sql.SQLException;
+
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public final class EncryptDQLResultDecoratorTest {
+
+ private EncryptAlgorithmMetaData metaData;
+
+ private boolean queryWithCipherColumn;
+
+ @Test
+ public void assertDecorateQueryResult() throws SQLException {
+ QueryResult queryResult = mock(QueryResult.class);
+ when(queryResult.next()).thenReturn(true);
+ EncryptDQLResultDecorator decorator = new
EncryptDQLResultDecorator(metaData, queryWithCipherColumn);
+ MergedResult actual = decorator.decorate(queryResult,
mock(SQLStatementContext.class), mock(SchemaMetaData.class));
+ assertTrue(actual.next());
+ }
+
+ @Test
+ public void assertDecorateMergedResult() throws SQLException {
+ MergedResult mergedResult = mock(MergedResult.class);
+ when(mergedResult.next()).thenReturn(true);
+ EncryptDQLResultDecorator decorator = new
EncryptDQLResultDecorator(metaData, queryWithCipherColumn);
+ MergedResult actual = decorator.decorate(mergedResult,
mock(SQLStatementContext.class), mock(SchemaMetaData.class));
+ assertTrue(actual.next());
+ }
+}