You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/06/10 04:35:37 UTC
[shardingsphere] branch master updated: Refactor RALBackendHandler.init() (#18276)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 764e1037e87 Refactor RALBackendHandler.init() (#18276)
764e1037e87 is described below
commit 764e1037e8760576d1446245c360ed96183f80d0
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Jun 10 12:35:27 2022 +0800
Refactor RALBackendHandler.init() (#18276)
---
.../backend/text/distsql/ral/RALBackendHandler.java | 10 +++++++---
.../text/distsql/ral/RALBackendHandlerFactory.java | 3 +--
.../ral/advanced/ParseDistSQLBackendHandler.java | 10 +---------
.../distsql/ral/advanced/PreviewBackendHandler.java | 19 +++++--------------
.../ExportDatabaseConfigurationHandler.java | 11 +----------
.../ral/common/queryable/ShowInstanceHandler.java | 2 --
.../ShowReadwriteSplittingReadResourcesHandler.java | 11 +----------
.../common/queryable/ShowTableMetadataHandler.java | 13 ++-----------
.../ral/common/queryable/ShowVariableHandler.java | 21 ++++++---------------
.../updatable/RefreshTableMetadataHandler.java | 13 ++-----------
.../SetReadwriteSplittingStatusHandler.java | 11 +----------
.../ral/common/updatable/SetVariableHandler.java | 11 +----------
.../ral/advance/ParseDistSQLBackendHandlerTest.java | 5 ++---
.../common/queryable/CountInstanceRulesTest.java | 5 ++---
.../ExportDatabaseConfigurationHandlerTest.java | 3 +--
.../queryable/ShowAuthorityRuleHandlerTest.java | 3 +--
.../queryable/ShowInstanceModeHandlerTest.java | 3 +--
.../queryable/ShowSQLParserRuleHandlerTest.java | 3 +--
.../queryable/ShowTableMetadataHandlerTest.java | 3 +--
.../queryable/ShowTrafficRulesHandlerTest.java | 3 +--
.../queryable/ShowTransactionRuleHandlerTest.java | 5 ++---
.../queryable/ShowVariableBackendHandlerTest.java | 13 ++++++-------
.../common/updatable/AlterInstanceHandlerTest.java | 7 +++----
.../updatable/AlterSQLParserRuleHandlerTest.java | 5 ++---
.../updatable/AlterTrafficRuleHandlerTest.java | 9 ++++-----
.../updatable/CreateTrafficRuleHandlerTest.java | 9 ++++-----
.../updatable/DropTrafficRuleHandlerTest.java | 13 ++++++-------
.../ImportDatabaseConfigurationHandlerTest.java | 10 ++--------
.../updatable/SetVariableBackendHandlerTest.java | 17 ++++++++---------
.../common/updatable/SetVariableExecutorTest.java | 11 +++--------
30 files changed, 78 insertions(+), 184 deletions(-)
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandler.java
index 215c39bca51..9c64760b1bc 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandler.java
@@ -37,13 +37,17 @@ public abstract class RALBackendHandler<E extends RALStatement> implements TextP
private E sqlStatement;
+ private ConnectionSession connectionSession;
+
/**
* Method to initialize handler, this method needs to be rewritten when the handler has properties other than sql statement.
*
- * @param parameter parameters required by handler
+ * @param sqlStatement SQL statement
+ * @param connectionSession connection session
*/
- public void init(final HandlerParameter<E> parameter) {
- sqlStatement = parameter.getStatement();
+ public void init(final RALStatement sqlStatement, final ConnectionSession connectionSession) {
+ this.sqlStatement = (E) sqlStatement;
+ this.connectionSession = connectionSession;
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
index c8b86128c91..3197429e005 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/RALBackendHandlerFactory.java
@@ -53,7 +53,6 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.scaling.QueryableS
import org.apache.shardingsphere.distsql.parser.statement.ral.scaling.UpdatableScalingRALStatement;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.TextProtocolBackendHandler;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.advanced.FormatHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.advanced.ParseDistSQLBackendHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.advanced.PreviewBackendHandler;
@@ -171,7 +170,7 @@ public final class RALBackendHandlerFactory {
throw new UnsupportedOperationException(String.format("Unsupported SQL statement : %s", sqlStatement.getClass().getCanonicalName()));
}
RALBackendHandler<?> result = newInstance(clazz);
- result.init(new HandlerParameter(sqlStatement, connectionSession));
+ result.init(sqlStatement, connectionSession);
return result;
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
index f2f0b9a655f..4d1fe2e12c5 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/ParseDistSQLBackendHandler.java
@@ -45,14 +45,6 @@ public final class ParseDistSQLBackendHandler extends QueryableRALBackendHandler
private static final String PARSED_STATEMENT_DETAIL = "parsed_statement_detail";
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<ParseStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Arrays.asList(PARSED_STATEMENT, PARSED_STATEMENT_DETAIL);
@@ -64,7 +56,7 @@ public final class ParseDistSQLBackendHandler extends QueryableRALBackendHandler
Preconditions.checkState(sqlParserRule.isPresent());
SQLStatement parsedSqlStatement;
try {
- parsedSqlStatement = sqlParserRule.get().getSQLParserEngine(getStorageType(connectionSession).getType()).parse(getSqlStatement().getSql(), false);
+ parsedSqlStatement = sqlParserRule.get().getSQLParserEngine(getStorageType(getConnectionSession()).getType()).parse(getSqlStatement().getSql(), false);
} catch (SQLParsingException ex) {
throw new SQLParsingException("You have a syntax error in your parsed statement");
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/PreviewBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/PreviewBackendHandler.java
index 3bb943f2bdb..2769438ffd8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/PreviewBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advanced/PreviewBackendHandler.java
@@ -58,7 +58,6 @@ import org.apache.shardingsphere.proxy.backend.context.BackendExecutorContext;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
import org.apache.shardingsphere.proxy.backend.exception.RuleNotExistedException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
@@ -82,16 +81,8 @@ public final class PreviewBackendHandler extends QueryableRALBackendHandler<Prev
private static final String ACTUAL_SQL = "actual_sql";
- private ConnectionSession connectionSession;
-
private final KernelProcessor kernelProcessor = new KernelProcessor();
- @Override
- public void init(final HandlerParameter<PreviewStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Arrays.asList(DATA_SOURCE_NAME, ACTUAL_SQL);
@@ -113,7 +104,7 @@ public final class PreviewBackendHandler extends QueryableRALBackendHandler<Prev
if (sqlStatementContext instanceof CursorAvailable && sqlStatementContext instanceof CursorDefinitionAware) {
setUpCursorDefinition(sqlStatementContext);
}
- ShardingSphereDatabase database = ProxyContext.getInstance().getDatabase(connectionSession.getDatabaseName());
+ ShardingSphereDatabase database = ProxyContext.getInstance().getDatabase(getConnectionSession().getDatabaseName());
if (!database.isComplete()) {
throw new RuleNotExistedException();
}
@@ -127,7 +118,7 @@ public final class PreviewBackendHandler extends QueryableRALBackendHandler<Prev
private void setUpCursorDefinition(final SQLStatementContext<?> sqlStatementContext) {
String cursorName = ((CursorAvailable) sqlStatementContext).getCursorName().getIdentifier().getValue().toLowerCase();
- CursorStatementContext cursorStatementContext = connectionSession.getCursorDefinitions().get(cursorName);
+ CursorStatementContext cursorStatementContext = getConnectionSession().getCursorDefinitions().get(cursorName);
Preconditions.checkArgument(null != cursorStatementContext, "Cursor %s does not exist.", cursorName);
((CursorDefinitionAware) sqlStatementContext).setUpCursorDefinition(cursorStatementContext);
}
@@ -166,13 +157,13 @@ public final class PreviewBackendHandler extends QueryableRALBackendHandler<Prev
private DriverExecutionPrepareEngine<JDBCExecutionUnit, Connection> createDriverExecutionPrepareEngine(final boolean isReturnGeneratedKeys, final MetaDataContexts metaDataContexts) {
int maxConnectionsSizePerQuery = metaDataContexts.getMetaData().getProps().<Integer>getValue(ConfigurationPropertyKey.MAX_CONNECTIONS_SIZE_PER_QUERY);
- return new DriverExecutionPrepareEngine<>(JDBCDriverType.STATEMENT, maxConnectionsSizePerQuery, (JDBCBackendConnection) connectionSession.getBackendConnection(),
- (JDBCBackendStatement) connectionSession.getStatementManager(), new StatementOption(isReturnGeneratedKeys),
+ return new DriverExecutionPrepareEngine<>(JDBCDriverType.STATEMENT, maxConnectionsSizePerQuery, (JDBCBackendConnection) getConnectionSession().getBackendConnection(),
+ (JDBCBackendStatement) getConnectionSession().getStatementManager(), new StatementOption(isReturnGeneratedKeys),
metaDataContexts.getMetaData().getDatabases().get(getDatabaseName()).getRuleMetaData().getRules());
}
private String getDatabaseName() {
- String result = !Strings.isNullOrEmpty(connectionSession.getDatabaseName()) ? connectionSession.getDatabaseName() : connectionSession.getDefaultDatabaseName();
+ String result = !Strings.isNullOrEmpty(getConnectionSession().getDatabaseName()) ? getConnectionSession().getDatabaseName() : getConnectionSession().getDefaultDatabaseName();
if (Strings.isNullOrEmpty(result)) {
throw new NoDatabaseSelectedException();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandler.java
index 55d21c3fc72..5b682cf00f6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandler.java
@@ -33,7 +33,6 @@ import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.yaml.swapper.ReadwriteSplittingRuleConfigurationYamlSwapper;
@@ -90,8 +89,6 @@ public final class ExportDatabaseConfigurationHandler extends QueryableRALBacken
private static final Map<String, Class<? extends RuleConfiguration>> FEATURE_MAP = new HashMap<>(5, 1);
- private ConnectionSession connectionSession;
-
static {
FEATURE_MAP.put(SHARDING, ShardingRuleConfiguration.class);
FEATURE_MAP.put(READWRITE_SPLITTING, ReadwriteSplittingRuleConfiguration.class);
@@ -100,12 +97,6 @@ public final class ExportDatabaseConfigurationHandler extends QueryableRALBacken
FEATURE_MAP.put(SHADOW, ShadowRuleConfiguration.class);
}
- @Override
- public void init(final HandlerParameter<ExportDatabaseConfigurationStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Collections.singletonList(RESULT);
@@ -220,7 +211,7 @@ public final class ExportDatabaseConfigurationHandler extends QueryableRALBacken
}
private String getDatabaseName() {
- String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : connectionSession.getDatabaseName();
+ String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : getConnectionSession().getDatabaseName();
if (Strings.isNullOrEmpty(result)) {
throw new NoDatabaseSelectedException();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
index f9c567a76c4..fb81f9a6c60 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceHandler.java
@@ -38,8 +38,6 @@ import java.util.stream.Collectors;
*/
public final class ShowInstanceHandler extends QueryableRALBackendHandler<ShowInstanceStatement> {
- private static final String DELIMITER = "@";
-
private static final String ID = "instance_id";
private static final String HOST = "host";
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
index 23ad76e63a6..700635dea7f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowReadwriteSplittingReadResourcesHandler.java
@@ -33,7 +33,6 @@ import org.apache.shardingsphere.mode.metadata.storage.StorageNodeStatus;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.ShowReadwriteSplittingReadResourcesStatement;
@@ -60,14 +59,6 @@ public final class ShowReadwriteSplittingReadResourcesHandler extends QueryableR
private static final String DELAY_TIME = "delay_time(ms)";
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<ShowReadwriteSplittingReadResourcesStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Arrays.asList(RESOURCE, STATUS, DELAY_TIME);
@@ -84,7 +75,7 @@ public final class ShowReadwriteSplittingReadResourcesHandler extends QueryableR
}
private String getDatabaseName() {
- String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : connectionSession.getDatabaseName();
+ String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : getConnectionSession().getDatabaseName();
if (Strings.isNullOrEmpty(result)) {
throw new NoDatabaseSelectedException();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandler.java
index 7f30717bedc..c2e1dfd297b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandler.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler;
import java.util.ArrayList;
@@ -49,14 +48,6 @@ public final class ShowTableMetadataHandler extends QueryableRALBackendHandler<S
private static final String NAME = "name";
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<ShowTableMetadataStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Arrays.asList(SCHEMA_NAME, TABLE_NAME, TYPE, NAME);
@@ -65,14 +56,14 @@ public final class ShowTableMetadataHandler extends QueryableRALBackendHandler<S
@Override
protected Collection<List<Object>> getRows(final ContextManager contextManager) {
String databaseName = getDatabaseName();
- String defaultSchema = DatabaseTypeEngine.getDefaultSchemaName(connectionSession.getDatabaseType(), connectionSession.getDatabaseName());
+ String defaultSchema = DatabaseTypeEngine.getDefaultSchemaName(getConnectionSession().getDatabaseType(), getConnectionSession().getDatabaseName());
ShardingSphereSchema schema = ProxyContext.getInstance().getDatabase(databaseName).getSchemas().get(defaultSchema);
return schema.getAllTableNames().stream().filter(each -> getSqlStatement().getTableNames().contains(each))
.map(each -> buildTableRows(databaseName, schema, each)).flatMap(Collection::stream).collect(Collectors.toList());
}
private String getDatabaseName() {
- String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : connectionSession.getDatabaseName();
+ String result = getSqlStatement().getDatabase().isPresent() ? getSqlStatement().getDatabase().get().getIdentifier().getValue() : getConnectionSession().getDatabaseName();
if (Strings.isNullOrEmpty(result)) {
throw new NoDatabaseSelectedException();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableHandler.java
index 8cffa791e82..f72cb103763 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableHandler.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.communication.jdbc.connection.JDBCBackendConnection;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.QueryableRALBackendHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.UnsupportedVariableException;
@@ -45,14 +44,6 @@ public final class ShowVariableHandler extends QueryableRALBackendHandler<ShowVa
private static final String VARIABLE_VALUE = "variable_value";
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<ShowVariableStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected Collection<String> getColumnNames() {
return Arrays.asList(VARIABLE_NAME, VARIABLE_VALUE);
@@ -79,10 +70,10 @@ public final class ShowVariableHandler extends QueryableRALBackendHandler<ShowVa
result.add(Arrays.asList(each.toLowerCase(), propertyValue));
});
result.add(Arrays.asList(VariableEnum.AGENT_PLUGINS_ENABLED.name().toLowerCase(), SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString())));
- if (connectionSession.getBackendConnection() instanceof JDBCBackendConnection) {
- result.add(Arrays.asList(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), ((JDBCBackendConnection) connectionSession.getBackendConnection()).getConnectionSize()));
+ if (getConnectionSession().getBackendConnection() instanceof JDBCBackendConnection) {
+ result.add(Arrays.asList(VariableEnum.CACHED_CONNECTIONS.name().toLowerCase(), ((JDBCBackendConnection) getConnectionSession().getBackendConnection()).getConnectionSize()));
}
- result.add(Arrays.asList(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), connectionSession.getTransactionStatus().getTransactionType().name()));
+ result.add(Arrays.asList(VariableEnum.TRANSACTION_TYPE.name().toLowerCase(), getConnectionSession().getTransactionStatus().getTransactionType().name()));
return result;
}
@@ -108,13 +99,13 @@ public final class ShowVariableHandler extends QueryableRALBackendHandler<ShowVa
case AGENT_PLUGINS_ENABLED:
return SystemPropertyUtil.getSystemProperty(variable.name(), Boolean.TRUE.toString());
case CACHED_CONNECTIONS:
- if (connectionSession.getBackendConnection() instanceof JDBCBackendConnection) {
- int connectionSize = ((JDBCBackendConnection) connectionSession.getBackendConnection()).getConnectionSize();
+ if (getConnectionSession().getBackendConnection() instanceof JDBCBackendConnection) {
+ int connectionSize = ((JDBCBackendConnection) getConnectionSession().getBackendConnection()).getConnectionSize();
return String.valueOf(connectionSize);
}
break;
case TRANSACTION_TYPE:
- TransactionType transactionType = connectionSession.getTransactionStatus().getTransactionType();
+ TransactionType transactionType = getConnectionSession().getTransactionStatus().getTransactionType();
return transactionType.name();
default:
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/RefreshTableMetadataHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/RefreshTableMetadataHandler.java
index be5a0c05bb4..164e6b9bc4d 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/RefreshTableMetadataHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/RefreshTableMetadataHandler.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
import org.apache.shardingsphere.proxy.backend.exception.UnknownDatabaseException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBackendHandler;
/**
@@ -33,14 +32,6 @@ import org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBack
*/
public final class RefreshTableMetadataHandler extends UpdatableRALBackendHandler<RefreshTableMetadataStatement> {
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<RefreshTableMetadataStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected void update(final ContextManager contextManager, final RefreshTableMetadataStatement sqlStatement) throws DistSQLException {
String databaseName = getDatabaseName();
@@ -61,7 +52,7 @@ public final class RefreshTableMetadataHandler extends UpdatableRALBackendHandle
}
private String getDatabaseName() {
- String result = connectionSession.getDatabaseName();
+ String result = getConnectionSession().getDatabaseName();
if (Strings.isNullOrEmpty(result)) {
throw new NoDatabaseSelectedException();
}
@@ -75,6 +66,6 @@ public final class RefreshTableMetadataHandler extends UpdatableRALBackendHandle
if (sqlStatement.getSchemaName().isPresent()) {
return sqlStatement.getSchemaName().get();
}
- return DatabaseTypeEngine.getDefaultSchemaName(connectionSession.getDatabaseType(), databaseName);
+ return DatabaseTypeEngine.getDefaultSchemaName(getConnectionSession().getDatabaseType(), databaseName);
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetReadwriteSplittingStatusHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetReadwriteSplittingStatusHandler.java
index 1b62ba96a31..2ab49884545 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetReadwriteSplittingStatusHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetReadwriteSplittingStatusHandler.java
@@ -36,7 +36,6 @@ import org.apache.shardingsphere.mode.metadata.storage.event.DataSourceDisabledE
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.exception.NoDatabaseSelectedException;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBackendHandler;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.status.SetReadwriteSplittingStatusStatement;
@@ -58,17 +57,9 @@ public final class SetReadwriteSplittingStatusHandler extends UpdatableRALBacken
private static final String DISABLE = "DISABLE";
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<SetReadwriteSplittingStatusStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected void update(final ContextManager contextManager, final SetReadwriteSplittingStatusStatement sqlStatement) throws DistSQLException {
- String databaseName = sqlStatement.getDatabase().isPresent() ? sqlStatement.getDatabase().get().getIdentifier().getValue() : connectionSession.getDatabaseName();
+ String databaseName = sqlStatement.getDatabase().isPresent() ? sqlStatement.getDatabase().get().getIdentifier().getValue() : getConnectionSession().getDatabaseName();
String toBeUpdatedResource = sqlStatement.getResourceName();
checkModeAndPersistRepository(contextManager);
checkDatabaseName(databaseName);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableHandler.java
index 11908844aad..b232660c866 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableHandler.java
@@ -27,7 +27,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.UpdatableRALBackendHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.InvalidValueException;
@@ -43,14 +42,6 @@ import java.util.Properties;
*/
public final class SetVariableHandler extends UpdatableRALBackendHandler<SetVariableStatement> {
- private ConnectionSession connectionSession;
-
- @Override
- public void init(final HandlerParameter<SetVariableStatement> parameter) {
- super.init(parameter);
- connectionSession = parameter.getConnectionSession();
- }
-
@Override
protected void update(final ContextManager contextManager, final SetVariableStatement sqlStatement) throws DistSQLException {
Enum<?> enumType = getEnumType(sqlStatement.getName());
@@ -100,7 +91,7 @@ public final class SetVariableHandler extends UpdatableRALBackendHandler<SetVari
SystemPropertyUtil.setSystemProperty(variable.name(), null == agentPluginsEnabled ? Boolean.FALSE.toString() : agentPluginsEnabled.toString());
break;
case TRANSACTION_TYPE:
- connectionSession.getTransactionStatus().setTransactionType(getTransactionType(getSqlStatement().getValue()));
+ getConnectionSession().getTransactionStatus().setTransactionType(getTransactionType(getSqlStatement().getValue()));
break;
default:
throw new UnsupportedVariableException(setVariableStatement.getName());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advance/ParseDistSQLBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advance/ParseDistSQLBackendHandlerTest.java
index 6bf67060610..b6d32e146e8 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advance/ParseDistSQLBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/advance/ParseDistSQLBackendHandlerTest.java
@@ -25,7 +25,6 @@ import org.apache.shardingsphere.parser.rule.SQLParserRule;
import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.advanced.ParseDistSQLBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
@@ -68,7 +67,7 @@ public final class ParseDistSQLBackendHandlerTest extends ProxyContextRestorer {
String sql = "select * from t_order";
ParseStatement parseStatement = new ParseStatement(sql);
ParseDistSQLBackendHandler parseDistSQLBackendHandler = new ParseDistSQLBackendHandler();
- parseDistSQLBackendHandler.init(new HandlerParameter<>(parseStatement, connectionSession));
+ parseDistSQLBackendHandler.init(parseStatement, connectionSession);
parseDistSQLBackendHandler.execute();
parseDistSQLBackendHandler.next();
SQLStatement statement = sqlParserRule.getSQLParserEngine("MySQL").parse(sql, false);
@@ -81,7 +80,7 @@ public final class ParseDistSQLBackendHandlerTest extends ProxyContextRestorer {
String sql = "wrong sql";
ParseStatement parseStatement = new ParseStatement(sql);
ParseDistSQLBackendHandler parseDistSQLBackendHandler = new ParseDistSQLBackendHandler();
- parseDistSQLBackendHandler.init(new HandlerParameter<>(parseStatement, connectionSession));
+ parseDistSQLBackendHandler.init(parseStatement, connectionSession);
parseDistSQLBackendHandler.execute();
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/CountInstanceRulesTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/CountInstanceRulesTest.java
index 344c5226853..5a98c33d8b7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/CountInstanceRulesTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/CountInstanceRulesTest.java
@@ -27,7 +27,6 @@ import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRule
import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
import org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
@@ -120,7 +119,7 @@ public final class CountInstanceRulesTest extends ProxyContextRestorer {
@Test
public void assertGetRowData() throws SQLException {
CountInstanceRulesHandler handler = new CountInstanceRulesHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CountInstanceRulesStatement(), null));
+ handler.init(new CountInstanceRulesStatement(), null);
handler.execute();
handler.next();
Collection<Object> actual = handler.getRowData();
@@ -168,7 +167,7 @@ public final class CountInstanceRulesTest extends ProxyContextRestorer {
@Test
public void assertGetRowDataWithoutConfiguration() throws SQLException {
CountInstanceRulesHandler handler = new CountInstanceRulesHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CountInstanceRulesStatement(), null));
+ handler.init(new CountInstanceRulesStatement(), null);
when(database1.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList());
when(database2.getRuleMetaData().getConfigurations()).thenReturn(Collections.emptyList());
handler.execute();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandlerTest.java
index 9d9aa14d9a7..9a6579c49a6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ExportDatabaseConfigurationHandlerTest.java
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
@@ -71,7 +70,7 @@ public final class ExportDatabaseConfigurationHandlerTest extends ProxyContextRe
@Test
public void assertExportDatabaseExecutor() throws SQLException {
ExportDatabaseConfigurationHandler handler = new ExportDatabaseConfigurationHandler();
- handler.init(new HandlerParameter<>(createSQLStatement(), mock(ConnectionSession.class)));
+ handler.init(createSQLStatement(), mock(ConnectionSession.class));
handler.execute();
handler.next();
Collection<Object> data = new ArrayList<>(handler.getRowData());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowAuthorityRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowAuthorityRuleHandlerTest.java
index 348a9c2fbfd..a1f5b992ec6 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowAuthorityRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowAuthorityRuleHandlerTest.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRule
import org.apache.shardingsphere.infra.metadata.user.ShardingSphereUser;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.junit.Test;
@@ -48,7 +47,7 @@ public final class ShowAuthorityRuleHandlerTest extends ProxyContextRestorer {
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(getGlobalRuleMetaData());
ProxyContext.init(contextManager);
- handler.init(new RALBackendHandler.HandlerParameter<>(new ShowAuthorityRuleStatement(), null));
+ handler.init(new ShowAuthorityRuleStatement(), null);
handler.execute();
handler.next();
List<Object> data = new ArrayList<>(handler.getRowData());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceModeHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceModeHandlerTest.java
index c991ca0bde2..bcafa47747f 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceModeHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowInstanceModeHandlerTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.repository.cluster.ClusterPersistRepositoryConfiguration;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.junit.Test;
@@ -46,7 +45,7 @@ public final class ShowInstanceModeHandlerTest extends ProxyContextRestorer {
InstanceContext instanceContext = createInstanceContext();
when(contextManager.getInstanceContext()).thenReturn(instanceContext);
ShowInstanceModeHandler handler = new ShowInstanceModeHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new ShowInstanceModeStatement(), null));
+ handler.init(new ShowInstanceModeStatement(), null);
ProxyContext.init(contextManager);
handler.execute();
handler.next();
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowSQLParserRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowSQLParserRuleHandlerTest.java
index ae9fc64809b..d2e8c748fb0 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowSQLParserRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowSQLParserRuleHandlerTest.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRule
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.sql.parser.api.CacheOption;
import org.junit.Test;
@@ -47,7 +46,7 @@ public final class ShowSQLParserRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(getGlobalRuleMetaData());
ProxyContext.init(contextManager);
ShowSQLParserRuleHandler handler = new ShowSQLParserRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new ShowSQLParserRuleStatement(), null));
+ handler.init(new ShowSQLParserRuleStatement(), null);
handler.execute();
handler.next();
List<Object> data = new ArrayList<>(handler.getRowData());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandlerTest.java
index c90214bbff0..0d4b94a4e8e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTableMetadataHandlerTest.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
import org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
@@ -58,7 +57,7 @@ public final class ShowTableMetadataHandlerTest extends ProxyContextRestorer {
ConnectionSession connectionSession = mock(ConnectionSession.class, RETURNS_DEEP_STUBS);
when(connectionSession.getDatabaseName()).thenReturn("db_name");
ShowTableMetadataHandler handler = new ShowTableMetadataHandler();
- handler.init(new HandlerParameter<>(createSqlStatement(), connectionSession));
+ handler.init(createSqlStatement(), connectionSession);
handler.execute();
handler.next();
List<Object> data = new ArrayList<>(handler.getRowData());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTrafficRulesHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTrafficRulesHandlerTest.java
index 57397274deb..e5217f20a0b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTrafficRulesHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTrafficRulesHandlerTest.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.infra.config.RuleConfiguration;
import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
import org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
@@ -50,7 +49,7 @@ public class ShowTrafficRulesHandlerTest extends ProxyContextRestorer {
ShowTrafficRulesStatement showTrafficRuleStatement = new ShowTrafficRulesStatement();
showTrafficRuleStatement.setRuleName("rule_name_1");
ShowTrafficRulesHandler handler = new ShowTrafficRulesHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(showTrafficRuleStatement, null));
+ handler.init(showTrafficRuleStatement, null);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findRuleConfigurations(any())).thenReturn(createTrafficRule());
ProxyContext.init(contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTransactionRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTransactionRuleHandlerTest.java
index fc278870209..ae5edeff82e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTransactionRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowTransactionRuleHandlerTest.java
@@ -21,7 +21,6 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.common.queryable.S
import org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.transaction.config.TransactionRuleConfiguration;
import org.junit.Test;
@@ -44,7 +43,7 @@ public final class ShowTransactionRuleHandlerTest extends ProxyContextRestorer {
@Test
public void assertExecutorWithXA() throws SQLException {
ShowTransactionRuleHandler handler = new ShowTransactionRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new ShowTransactionRuleStatement(), null));
+ handler.init(new ShowTransactionRuleStatement(), null);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(getGlobalRuleMetaData("XA", "Atomikos", getProperties()));
ProxyContext.init(contextManager);
@@ -62,7 +61,7 @@ public final class ShowTransactionRuleHandlerTest extends ProxyContextRestorer {
@Test
public void assertExecutorWithLocal() throws SQLException {
ShowTransactionRuleHandler handler = new ShowTransactionRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new ShowTransactionRuleStatement(), null));
+ handler.init(new ShowTransactionRuleStatement(), null);
ContextManager contextManager = mock(ContextManager.class, RETURNS_DEEP_STUBS);
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(getGlobalRuleMetaData("LOCAL", null, null));
ProxyContext.init(contextManager);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableBackendHandlerTest.java
index 27cc7a411cf..4e6cc2bb93b 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/queryable/ShowVariableBackendHandlerTest.java
@@ -28,7 +28,6 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.query.QueryResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.UnsupportedVariableException;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
@@ -64,7 +63,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertShowTransactionType() throws SQLException {
connectionSession.setCurrentDatabase("db");
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement("transaction_type"), connectionSession));
+ backendHandler.init(new ShowVariableStatement("transaction_type"), connectionSession);
ResponseHeader actual = backendHandler.execute();
assertThat(actual, instanceOf(QueryResponseHeader.class));
assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
@@ -78,7 +77,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertShowCachedConnections() throws SQLException {
connectionSession.setCurrentDatabase("db");
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement("cached_connections"), connectionSession));
+ backendHandler.init(new ShowVariableStatement("cached_connections"), connectionSession);
ResponseHeader actual = backendHandler.execute();
assertThat(actual, instanceOf(QueryResponseHeader.class));
assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
@@ -92,7 +91,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertShowCachedConnectionFailed() throws SQLException {
connectionSession.setCurrentDatabase("db");
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement("cached_connectionss"), connectionSession));
+ backendHandler.init(new ShowVariableStatement("cached_connectionss"), connectionSession);
backendHandler.execute();
}
@@ -101,7 +100,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
SystemPropertyUtil.setSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString());
connectionSession.setCurrentDatabase("db");
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name()), connectionSession));
+ backendHandler.init(new ShowVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name()), connectionSession);
ResponseHeader actual = backendHandler.execute();
assertThat(actual, instanceOf(QueryResponseHeader.class));
assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
@@ -122,7 +121,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
props.put("sql-show", Boolean.TRUE.toString());
when(metaDataContexts.getMetaData().getProps()).thenReturn(new ConfigurationProperties(props));
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement("SQL_SHOW"), connectionSession));
+ backendHandler.init(new ShowVariableStatement("SQL_SHOW"), connectionSession);
ResponseHeader actual = backendHandler.execute();
assertThat(actual, instanceOf(QueryResponseHeader.class));
assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
@@ -141,7 +140,7 @@ public final class ShowVariableBackendHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts()).thenReturn(metaDataContexts);
when(metaDataContexts.getMetaData().getProps()).thenReturn(new ConfigurationProperties(new Properties()));
ShowVariableHandler backendHandler = new ShowVariableHandler();
- backendHandler.init(new HandlerParameter<>(new ShowVariableStatement(), connectionSession));
+ backendHandler.init(new ShowVariableStatement(), connectionSession);
ResponseHeader actual = backendHandler.execute();
assertThat(actual, instanceOf(QueryResponseHeader.class));
assertThat(((QueryResponseHeader) actual).getQueryHeaders().size(), is(2));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java
index e17c7edd67d..eeebb4f134c 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterInstanceHandlerTest.java
@@ -22,7 +22,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.mode.metadata.persist.MetaDataPersistService;
import org.apache.shardingsphere.mode.persist.PersistRepository;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.junit.Test;
@@ -41,7 +40,7 @@ public final class AlterInstanceHandlerTest extends ProxyContextRestorer {
String key = "key_1";
String value = "value_1";
AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(instanceId, key, value), null));
+ handler.init(getSQLStatement(instanceId, key, value), null);
handler.execute();
}
@@ -54,7 +53,7 @@ public final class AlterInstanceHandlerTest extends ProxyContextRestorer {
String key = "xa_recovery_nodes";
String value = "value_1";
AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(instanceId, key, value), null));
+ handler.init(getSQLStatement(instanceId, key, value), null);
handler.execute();
}
@@ -68,7 +67,7 @@ public final class AlterInstanceHandlerTest extends ProxyContextRestorer {
String key = "xa_recovery_nodes";
String value = "value_1";
AlterInstanceHandler handler = new AlterInstanceHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(instanceId, key, value), null));
+ handler.init(getSQLStatement(instanceId, key, value), null);
handler.execute();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterSQLParserRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterSQLParserRuleHandlerTest.java
index ee14a9a0c52..3c59a07a196 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterSQLParserRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterSQLParserRuleHandlerTest.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.parser.config.SQLParserRuleConfiguration;
import org.apache.shardingsphere.parser.rule.builder.DefaultSQLParserRuleConfigurationBuilder;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.junit.Test;
@@ -49,7 +48,7 @@ public final class AlterSQLParserRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations()).thenReturn(new LinkedList<>());
ProxyContext.init(contextManager);
AlterSQLParserRuleHandler handler = new AlterSQLParserRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(createSQLStatement(), null));
+ handler.init(createSQLStatement(), null);
handler.execute();
SQLParserRuleConfiguration actual = (SQLParserRuleConfiguration) contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations().iterator().next();
assertTrue(actual.isSqlCommentParseEnabled());
@@ -69,7 +68,7 @@ public final class AlterSQLParserRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations()).thenReturn(globalRuleConfigs);
ProxyContext.init(contextManager);
AlterSQLParserRuleHandler handler = new AlterSQLParserRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(createSQLStatement(), null));
+ handler.init(createSQLStatement(), null);
handler.execute();
SQLParserRuleConfiguration actual = (SQLParserRuleConfiguration) contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getConfigurations().iterator().next();
assertTrue(actual.isSqlCommentParseEnabled());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTrafficRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTrafficRuleHandlerTest.java
index c557338bac3..26338816b31 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTrafficRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/AlterTrafficRuleHandlerTest.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmCo
import org.apache.shardingsphere.infra.distsql.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
import org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
@@ -54,7 +53,7 @@ public final class AlterTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("input_rule_name", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("invalid", new Properties()), new AlgorithmSegment("invalid", new Properties()));
AlterTrafficRuleHandler handler = new AlterTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(trafficRuleSegment), null));
+ handler.init(getSQLStatement(trafficRuleSegment), null);
handler.execute();
}
@@ -66,7 +65,7 @@ public final class AlterTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("rule_name_1", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("invalid", new Properties()), new AlgorithmSegment("invalid", new Properties()));
AlterTrafficRuleHandler handler = new AlterTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(trafficRuleSegment), null));
+ handler.init(getSQLStatement(trafficRuleSegment), null);
handler.execute();
}
@@ -78,7 +77,7 @@ public final class AlterTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("rule_name_3", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()));
AlterTrafficRuleHandler handler = new AlterTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(trafficRuleSegment), null));
+ handler.init(getSQLStatement(trafficRuleSegment), null);
handler.execute();
}
@@ -92,7 +91,7 @@ public final class AlterTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment2 = new TrafficRuleSegment("rule_name_2", Collections.emptyList(),
new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), null);
AlterTrafficRuleHandler handler = new AlterTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(getSQLStatement(trafficRuleSegment1, trafficRuleSegment2), null));
+ handler.init(getSQLStatement(trafficRuleSegment1, trafficRuleSegment2), null);
handler.execute();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/CreateTrafficRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/CreateTrafficRuleHandlerTest.java
index c645a6b0f20..1560447c300 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/CreateTrafficRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/CreateTrafficRuleHandlerTest.java
@@ -26,7 +26,6 @@ import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleExcep
import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
import org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
@@ -52,7 +51,7 @@ public final class CreateTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("input_rule_name", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("invalid", new Properties()), new AlgorithmSegment("invalid", new Properties()));
CreateTrafficRuleHandler handler = new CreateTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null));
+ handler.init(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null);
handler.execute();
}
@@ -65,7 +64,7 @@ public final class CreateTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("input_rule_name", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("invalid", new Properties()), new AlgorithmSegment("invalid", new Properties()));
CreateTrafficRuleHandler handler = new CreateTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null));
+ handler.init(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null);
handler.execute();
}
@@ -77,7 +76,7 @@ public final class CreateTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment = new TrafficRuleSegment("rule_name_1", Arrays.asList("olap", "order_by"),
new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()));
CreateTrafficRuleHandler handler = new CreateTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null));
+ handler.init(new CreateTrafficRuleStatement(Collections.singletonList(trafficRuleSegment)), null);
handler.execute();
}
@@ -91,7 +90,7 @@ public final class CreateTrafficRuleHandlerTest extends ProxyContextRestorer {
TrafficRuleSegment trafficRuleSegment2 = new TrafficRuleSegment("rule_name_4", Collections.emptyList(),
new AlgorithmSegment("DISTSQL.FIXTURE", new Properties()), null);
CreateTrafficRuleHandler handler = new CreateTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new CreateTrafficRuleStatement(Arrays.asList(trafficRuleSegment1, trafficRuleSegment2)), null));
+ handler.init(new CreateTrafficRuleStatement(Arrays.asList(trafficRuleSegment1, trafficRuleSegment2)), null);
handler.execute();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
index 8f02227f48d..d555663aa7e 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmC
import org.apache.shardingsphere.infra.distsql.exception.rule.RequiredRuleMissedException;
import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
import org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
@@ -54,7 +53,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findRuleConfigurations(any())).thenReturn(new LinkedList<>());
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), false), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), false), null);
handler.execute();
}
@@ -64,7 +63,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findRuleConfigurations(any())).thenReturn(new LinkedList<>());
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), true), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), true), null);
handler.execute();
}
@@ -74,7 +73,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findRuleConfigurations(any())).thenReturn(Collections.singleton(createTrafficRuleConfiguration()));
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), false), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name"), false), null);
handler.execute();
}
@@ -84,7 +83,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(any())).thenReturn(Optional.of(createTrafficRuleConfiguration()));
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name_1"), false), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name_1"), false), null);
handler.execute();
Optional<TrafficRuleConfiguration> ruleConfig = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(TrafficRuleConfiguration.class);
assertTrue(ruleConfig.isPresent());
@@ -102,7 +101,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(any())).thenReturn(Optional.of(createTrafficRuleConfiguration()));
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name_1"), false), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name_1"), false), null);
handler.execute();
Optional<TrafficRuleConfiguration> ruleConfig = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(TrafficRuleConfiguration.class);
assertTrue(ruleConfig.isPresent());
@@ -120,7 +119,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(any())).thenReturn(Optional.of(createTrafficRuleConfiguration()));
ProxyContext.init(contextManager);
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new RALBackendHandler.HandlerParameter<>(new DropTrafficRuleStatement(Collections.singletonList("rule_name_3"), true), null));
+ handler.init(new DropTrafficRuleStatement(Collections.singletonList("rule_name_3"), true), null);
handler.execute();
Optional<TrafficRuleConfiguration> ruleConfig = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().findSingleRuleConfiguration(TrafficRuleConfiguration.class);
assertTrue(ruleConfig.isPresent());
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandlerTest.java
index e7b3c34da9a..4ed20c30a58 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/ImportDatabaseConfigurationHandlerTest.java
@@ -29,7 +29,6 @@ import org.apache.shardingsphere.mode.manager.ContextManager;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.checker.DatabaseDiscoveryRuleConfigurationImportChecker;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.checker.ReadwriteSplittingRuleConfigurationImportChecker;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.checker.ShardingRuleConfigurationImportChecker;
@@ -130,7 +129,8 @@ public final class ImportDatabaseConfigurationHandlerTest extends ProxyContextRe
private void init(final String feature) throws Exception {
ImportDatabaseConfigurationHandler handler = importDatabaseConfigurationHandler = new ImportDatabaseConfigurationHandler();
- handler.init(getParameter(featureMap.get(feature), mock(ConnectionSession.class)));
+ handler.init(new ImportDatabaseConfigurationStatement(Objects.requireNonNull(ImportDatabaseConfigurationHandlerTest.class.getResource(featureMap.get(feature))).getPath()),
+ mock(ConnectionSession.class));
Field validatorField = importDatabaseConfigurationHandler.getClass().getDeclaredField("validator");
validatorField.setAccessible(true);
validatorField.set(importDatabaseConfigurationHandler, validator);
@@ -154,10 +154,4 @@ public final class ImportDatabaseConfigurationHandlerTest extends ProxyContextRe
Collection<ShardingSphereIndex> indexes = Collections.singleton(new ShardingSphereIndex("primary"));
return Collections.singletonMap("t_order", new ShardingSphereTable("t_order", columns, indexes, Collections.emptyList()));
}
-
- private RALBackendHandler.HandlerParameter<ImportDatabaseConfigurationStatement> getParameter(final String importFilePath, final ConnectionSession connectionSession) {
- ImportDatabaseConfigurationStatement statement = new ImportDatabaseConfigurationStatement(
- Objects.requireNonNull(ImportDatabaseConfigurationHandlerTest.class.getResource(importFilePath)).getPath());
- return new RALBackendHandler.HandlerParameter<>(statement, connectionSession);
- }
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
index d4ba71f80d3..5dd6662956a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableBackendHandlerTest.java
@@ -36,7 +36,6 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.exception.UnsupportedVariableException;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
@@ -96,7 +95,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSwitchTransactionTypeXA() throws SQLException {
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
SetVariableHandler handler = new SetVariableHandler();
- handler.init(new HandlerParameter<>(new SetVariableStatement("transaction_type", "XA"), connectionSession));
+ handler.init(new SetVariableStatement("transaction_type", "XA"), connectionSession);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(connectionSession.getTransactionStatus().getTransactionType(), is(TransactionType.XA));
@@ -106,7 +105,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSwitchTransactionTypeBASE() throws SQLException {
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
SetVariableHandler handler = new SetVariableHandler();
- handler.init(new HandlerParameter<>(new SetVariableStatement("transaction_type", "BASE"), connectionSession));
+ handler.init(new SetVariableStatement("transaction_type", "BASE"), connectionSession);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(connectionSession.getTransactionStatus().getTransactionType(), is(TransactionType.BASE));
@@ -116,7 +115,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSwitchTransactionTypeLOCAL() throws SQLException {
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
SetVariableHandler handler = new SetVariableHandler();
- handler.init(new HandlerParameter<>(new SetVariableStatement("transaction_type", "LOCAL"), connectionSession));
+ handler.init(new SetVariableStatement("transaction_type", "LOCAL"), connectionSession);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(connectionSession.getTransactionStatus().getTransactionType(), is(TransactionType.LOCAL));
@@ -126,14 +125,14 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSwitchTransactionTypeFailed() throws SQLException {
SetVariableHandler handler = new SetVariableHandler();
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
- handler.init(new HandlerParameter<>(new SetVariableStatement("transaction_type", "XXX"), connectionSession));
+ handler.init(new SetVariableStatement("transaction_type", "XXX"), connectionSession);
handler.execute();
}
@Test(expected = UnsupportedVariableException.class)
public void assertNotSupportedVariable() throws SQLException {
SetVariableHandler handler = new SetVariableHandler();
- handler.init(new HandlerParameter<>(new SetVariableStatement("@@session", "XXX"), connectionSession));
+ handler.init(new SetVariableStatement("@@session", "XXX"), connectionSession);
handler.execute();
}
@@ -141,7 +140,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSetAgentPluginsEnabledTrue() throws SQLException {
SetVariableHandler handler = new SetVariableHandler();
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
- handler.init(new HandlerParameter<>(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString()), null));
+ handler.init(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.TRUE.toString()), null);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.TRUE.toString()));
@@ -151,7 +150,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSetAgentPluginsEnabledFalse() throws SQLException {
SetVariableHandler handler = new SetVariableHandler();
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
- handler.init(new HandlerParameter<>(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), null));
+ handler.init(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), null);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
@@ -161,7 +160,7 @@ public final class SetVariableBackendHandlerTest extends ProxyContextRestorer {
public void assertSetAgentPluginsEnabledFalseWithUnknownValue() throws SQLException {
SetVariableHandler handler = new SetVariableHandler();
connectionSession.setCurrentDatabase(String.format(DATABASE_PATTERN, 0));
- handler.init(new HandlerParameter<>(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "xxx"), connectionSession));
+ handler.init(new SetVariableStatement(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "xxx"), connectionSession);
ResponseHeader actual = handler.execute();
assertThat(actual, instanceOf(UpdateResponseHeader.class));
assertThat(SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), Boolean.FALSE.toString()), is(Boolean.FALSE.toString()));
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableExecutorTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableExecutorTest.java
index 05641483699..c08a647b754 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableExecutorTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/SetVariableExecutorTest.java
@@ -24,7 +24,6 @@ import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.session.transaction.TransactionStatus;
-import org.apache.shardingsphere.proxy.backend.text.distsql.ral.RALBackendHandler.HandlerParameter;
import org.apache.shardingsphere.proxy.backend.text.distsql.ral.common.enums.VariableEnum;
import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
import org.apache.shardingsphere.proxy.backend.util.SystemPropertyUtil;
@@ -51,7 +50,7 @@ public final class SetVariableExecutorTest extends ProxyContextRestorer {
SetVariableStatement statement = new SetVariableStatement("transaction_type", "local");
when(connectionSession.getTransactionStatus()).thenReturn(new TransactionStatus(TransactionType.XA));
SetVariableHandler handler = new SetVariableHandler();
- handler.init(getParameter(statement, connectionSession));
+ handler.init(statement, connectionSession);
handler.execute();
assertThat(connectionSession.getTransactionStatus().getTransactionType().name(), is(TransactionType.LOCAL.name()));
}
@@ -60,7 +59,7 @@ public final class SetVariableExecutorTest extends ProxyContextRestorer {
public void assertExecuteWithAgent() throws SQLException {
SetVariableStatement statement = new SetVariableStatement("AGENT_PLUGINS_ENABLED", Boolean.FALSE.toString());
SetVariableHandler handler = new SetVariableHandler();
- handler.init(getParameter(statement, connectionSession));
+ handler.init(statement, connectionSession);
handler.execute();
String actualValue = SystemPropertyUtil.getSystemProperty(VariableEnum.AGENT_PLUGINS_ENABLED.name(), "default");
assertThat(actualValue, is(Boolean.FALSE.toString()));
@@ -72,14 +71,10 @@ public final class SetVariableExecutorTest extends ProxyContextRestorer {
ProxyContext.init(contextManager);
SetVariableStatement statement = new SetVariableStatement("proxy_frontend_flush_threshold", "1024");
SetVariableHandler handler = new SetVariableHandler();
- handler.init(getParameter(statement, connectionSession));
+ handler.init(statement, connectionSession);
handler.execute();
Object actualValue = contextManager.getMetaDataContexts().getMetaData().getProps().getProps().get("proxy-frontend-flush-threshold");
assertThat(actualValue.toString(), is("1024"));
assertThat(contextManager.getMetaDataContexts().getMetaData().getProps().getValue(ConfigurationPropertyKey.PROXY_FRONTEND_FLUSH_THRESHOLD), is(1024));
}
-
- private HandlerParameter<SetVariableStatement> getParameter(final SetVariableStatement statement, final ConnectionSession connectionSession) {
- return new HandlerParameter<>(statement, connectionSession);
- }
}