You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by su...@apache.org on 2022/11/22 03:28:33 UTC

[shardingsphere] branch master updated: Fix EncryptRule cannot cast to TransparentRule exception when execute call procedure statement (#22327)

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

sunnianjun 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 896a2621761 Fix EncryptRule cannot cast to TransparentRule exception when execute call procedure statement (#22327)
896a2621761 is described below

commit 896a2621761634a32f3b4a91b0589cfb6db69cd7
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Tue Nov 22 11:28:26 2022 +0800

    Fix EncryptRule cannot cast to TransparentRule exception when execute call procedure statement (#22327)
---
 .../decorator/impl/TransparentResultDecorator.java |  7 ++--
 .../engine/decorator/impl/TransparentRule.java     | 38 ----------------------
 .../impl/TransparentResultDecoratorTest.java       |  5 +--
 3 files changed, 7 insertions(+), 43 deletions(-)

diff --git a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecorator.java b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecorator.java
index 81ab95dc75a..f1611d8794c 100644
--- a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecorator.java
+++ b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecorator.java
@@ -22,19 +22,20 @@ import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryRe
 import org.apache.shardingsphere.infra.merge.engine.decorator.ResultDecorator;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
 import org.apache.shardingsphere.infra.merge.result.impl.transparent.TransparentMergedResult;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 
 /**
  * Transparent result decorator.
  */
-public final class TransparentResultDecorator implements ResultDecorator<TransparentRule> {
+public final class TransparentResultDecorator implements ResultDecorator<ShardingSphereRule> {
     
     @Override
-    public MergedResult decorate(final QueryResult queryResult, final SQLStatementContext<?> sqlStatementContext, final TransparentRule rule) {
+    public MergedResult decorate(final QueryResult queryResult, final SQLStatementContext<?> sqlStatementContext, final ShardingSphereRule rule) {
         return new TransparentMergedResult(queryResult);
     }
     
     @Override
-    public MergedResult decorate(final MergedResult mergedResult, final SQLStatementContext<?> sqlStatementContext, final TransparentRule rule) {
+    public MergedResult decorate(final MergedResult mergedResult, final SQLStatementContext<?> sqlStatementContext, final ShardingSphereRule rule) {
         return mergedResult;
     }
 }
diff --git a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentRule.java b/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentRule.java
deleted file mode 100644
index 115779d8c76..00000000000
--- a/infra/merge/src/main/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentRule.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.infra.merge.engine.decorator.impl;
-
-import org.apache.shardingsphere.infra.config.rule.RuleConfiguration;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-
-/**
- * Transparent rule.
- */
-public final class TransparentRule implements ShardingSphereRule {
-    
-    @Override
-    public RuleConfiguration getConfiguration() {
-        return new RuleConfiguration() {
-        };
-    }
-    
-    @Override
-    public String getType() {
-        return TransparentRule.class.getSimpleName();
-    }
-}
diff --git a/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecoratorTest.java b/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecoratorTest.java
index b560cbf6f30..b45c850c693 100644
--- a/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecoratorTest.java
+++ b/infra/merge/src/test/java/org/apache/shardingsphere/infra/merge/engine/decorator/impl/TransparentResultDecoratorTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.merge.engine.decorator.impl;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import org.apache.shardingsphere.infra.merge.result.MergedResult;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.junit.Test;
 
 import java.sql.SQLException;
@@ -35,7 +36,7 @@ public final class TransparentResultDecoratorTest {
         QueryResult queryResult = mock(QueryResult.class);
         when(queryResult.next()).thenReturn(true);
         TransparentResultDecorator decorator = new TransparentResultDecorator();
-        assertTrue(decorator.decorate(queryResult, mock(SQLStatementContext.class), new TransparentRule()).next());
+        assertTrue(decorator.decorate(queryResult, mock(SQLStatementContext.class), mock(ShardingSphereRule.class)).next());
     }
     
     @Test
@@ -43,6 +44,6 @@ public final class TransparentResultDecoratorTest {
         MergedResult mergedResult = mock(MergedResult.class);
         when(mergedResult.next()).thenReturn(true);
         TransparentResultDecorator decorator = new TransparentResultDecorator();
-        assertTrue(decorator.decorate(mergedResult, mock(SQLStatementContext.class), new TransparentRule()).next());
+        assertTrue(decorator.decorate(mergedResult, mock(SQLStatementContext.class), mock(ShardingSphereRule.class)).next());
     }
 }