You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/09/28 09:54:01 UTC
[shardingsphere] branch master updated: Add enum supported for TypedPropertyValue (#21241)
This is an automated email from the ASF dual-hosted git repository.
zhaojinchao 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 f61d521725d Add enum supported for TypedPropertyValue (#21241)
f61d521725d is described below
commit f61d521725d1c1287de37e7e86199d684cb85fda
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Wed Sep 28 17:53:53 2022 +0800
Add enum supported for TypedPropertyValue (#21241)
---
.../content/user-manual/error-code/sql-error-code.cn.md | 1 -
.../content/user-manual/error-code/sql-error-code.en.md | 1 -
.../infra/config/props/BackendExecutorType.java | 15 ++++-----------
.../infra/config/props/ConfigurationPropertyKey.java | 2 +-
.../infra/config/props/ConfigurationPropertiesTest.java | 6 +++---
.../infra/util/props/TypedPropertyValue.java | 11 +++++++++++
.../infra/util/props/TypedPropertyValueTest.java | 13 ++++++++++++-
.../util/props/fixture/TypedPropertyEnumFixture.java | 16 +++-------------
.../util/props/fixture/TypedPropertyKeyFixture.java | 4 +++-
.../proxy/frontend/state/impl/JDBCOKProxyState.java | 12 +++---------
.../proxy/frontend/state/impl/JDBCOKProxyStateTest.java | 14 +++-----------
11 files changed, 43 insertions(+), 52 deletions(-)
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.cn.md b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
index d90b41bf87f..bbd582baa06 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.cn.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.cn.md
@@ -24,7 +24,6 @@ SQL 错误码以标准的 SQL State,Vendor Code 和详细错误信息提供,
| 42S02 | 10021 | Single table \`%s\` does not exist |
| HY000 | 10022 | Can not load table with database name \`%s\` and data source name \`%s\` |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains tables |
-| 0A000 | 10050 | The property \`proxy-backend-executor-suitable\` must be \`OLAP\` or \`OLTP\` |
### 数据
diff --git a/docs/document/content/user-manual/error-code/sql-error-code.en.md b/docs/document/content/user-manual/error-code/sql-error-code.en.md
index bf2ef9fc6d2..4b3393a3403 100644
--- a/docs/document/content/user-manual/error-code/sql-error-code.en.md
+++ b/docs/document/content/user-manual/error-code/sql-error-code.en.md
@@ -24,7 +24,6 @@ SQL error codes provide by standard `SQL State`, `Vendor Code` and `Reason`, whi
| 42S02 | 10021 | Single table \`%s\` does not exist |
| HY000 | 10022 | Can not load table with database name \`%s\` and data source name \`%s\` |
| 0A000 | 10030 | Can not drop schema \`%s\` because of contains tables |
-| 0A000 | 10050 | The property \`proxy-backend-executor-suitable\` must be \`OLAP\` or \`OLTP\` |
### Data
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/BackendExecutorType.java
similarity index 57%
copy from shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java
copy to shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/BackendExecutorType.java
index cf37572a944..d070dc062bf 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/BackendExecutorType.java
@@ -15,19 +15,12 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.exception;
-
-import org.apache.shardingsphere.infra.exception.ConnectionSQLException;
-import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
+package org.apache.shardingsphere.infra.config.props;
/**
- * Invalid executor suitable exception.
+ * Backend executor type.
*/
-public final class InvalidExecutorSuitableException extends ConnectionSQLException {
-
- private static final long serialVersionUID = 8481186245119374721L;
+public enum BackendExecutorType {
- public InvalidExecutorSuitableException() {
- super(XOpenSQLState.GENERAL_ERROR, 50, "The property `proxy-backend-executor-suitable` must be `OLAP` or `OLTP`");
- }
+ OLTP, OLAP
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
index 991fde30fc9..f0e3e803cf5 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertyKey.java
@@ -92,7 +92,7 @@ public enum ConfigurationPropertyKey implements TypedPropertyKey {
* Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
* and block other clients if client connections are more than {@link ConfigurationPropertyKey#PROXY_FRONTEND_EXECUTOR_SIZE}, especially executing slow SQL.
*/
- PROXY_BACKEND_EXECUTOR_SUITABLE("proxy-backend-executor-suitable", "OLAP", String.class, false),
+ PROXY_BACKEND_EXECUTOR_SUITABLE("proxy-backend-executor-suitable", BackendExecutorType.OLAP.name(), BackendExecutorType.class, false),
/**
* Less than or equal to 0 means no limitation.
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
index 3b78311b6e2..29481b62f06 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/config/props/ConfigurationPropertiesTest.java
@@ -42,7 +42,7 @@ public final class ConfigurationPropertiesTest {
assertTrue(actual.getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_QUERY_FETCH_SIZE), is(20));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_FRONTEND_EXECUTOR_SIZE), is(20));
- assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE), is("OLTP"));
+ assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE), is(BackendExecutorType.OLTP));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_FRONTEND_MAX_CONNECTIONS), is(20));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_DRIVER_TYPE), is("JDBC"));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION), is("5.7.22"));
@@ -63,7 +63,7 @@ public final class ConfigurationPropertiesTest {
result.setProperty(ConfigurationPropertyKey.PROXY_HINT_ENABLED.getKey(), Boolean.TRUE.toString());
result.setProperty(ConfigurationPropertyKey.PROXY_BACKEND_QUERY_FETCH_SIZE.getKey(), "20");
result.setProperty(ConfigurationPropertyKey.PROXY_FRONTEND_EXECUTOR_SIZE.getKey(), "20");
- result.setProperty(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE.getKey(), "OLTP");
+ result.setProperty(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE.getKey(), BackendExecutorType.OLTP.name());
result.setProperty(ConfigurationPropertyKey.PROXY_FRONTEND_MAX_CONNECTIONS.getKey(), "20");
result.setProperty(ConfigurationPropertyKey.PROXY_BACKEND_DRIVER_TYPE.getKey(), "JDBC");
result.setProperty(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION.getKey(), "5.7.22");
@@ -86,7 +86,7 @@ public final class ConfigurationPropertiesTest {
assertFalse(actual.getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_QUERY_FETCH_SIZE), is(-1));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_FRONTEND_EXECUTOR_SIZE), is(0));
- assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE), is("OLAP"));
+ assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE), is(BackendExecutorType.OLAP));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_FRONTEND_MAX_CONNECTIONS), is(0));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_BACKEND_DRIVER_TYPE), is("JDBC"));
assertThat(actual.getValue(ConfigurationPropertyKey.PROXY_MYSQL_DEFAULT_VERSION), is("5.7.22"));
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValue.java b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValue.java
index f918e636e0c..10304df210e 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValue.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/main/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValue.java
@@ -50,6 +50,17 @@ public final class TypedPropertyValue {
throw new TypedPropertyValueException(key, value);
}
}
+ if (Enum.class.isAssignableFrom(key.getType())) {
+ return getEnumValue(key, value);
+ }
return value;
}
+
+ private Enum<?> getEnumValue(final TypedPropertyKey key, final String value) throws TypedPropertyValueException {
+ try {
+ return (Enum<?>) key.getType().getMethod("valueOf", String.class).invoke(null, value);
+ } catch (final ReflectiveOperationException | IllegalArgumentException ex) {
+ throw new TypedPropertyValueException(key, value);
+ }
+ }
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValueTest.java b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValueTest.java
index e2fd5bb7f55..e2173ed8a94 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValueTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/TypedPropertyValueTest.java
@@ -18,12 +18,13 @@
package org.apache.shardingsphere.infra.util.props;
import org.apache.shardingsphere.infra.util.props.exception.TypedPropertyValueException;
+import org.apache.shardingsphere.infra.util.props.fixture.TypedPropertyEnumFixture;
import org.apache.shardingsphere.infra.util.props.fixture.TypedPropertyKeyFixture;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertFalse;
import static org.hamcrest.MatcherAssert.assertThat;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
public final class TypedPropertyValueTest {
@@ -65,4 +66,14 @@ public final class TypedPropertyValueTest {
public void assertGetStringValue() throws TypedPropertyValueException {
assertThat(new TypedPropertyValue(TypedPropertyKeyFixture.STRING_VALUE, "new_value").getValue(), is("new_value"));
}
+
+ @Test
+ public void assertGetEnumValue() throws TypedPropertyValueException {
+ assertThat(new TypedPropertyValue(TypedPropertyKeyFixture.ENUM_VALUE, TypedPropertyEnumFixture.FOO.name()).getValue(), is(TypedPropertyEnumFixture.FOO));
+ }
+
+ @Test(expected = TypedPropertyValueException.class)
+ public void assertGetInvalidEnumValue() throws TypedPropertyValueException {
+ new TypedPropertyValue(TypedPropertyKeyFixture.ENUM_VALUE, "BAR");
+ }
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyEnumFixture.java
similarity index 57%
rename from shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java
rename to shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyEnumFixture.java
index cf37572a944..4b904822102 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/exception/InvalidExecutorSuitableException.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyEnumFixture.java
@@ -15,19 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.proxy.frontend.exception;
+package org.apache.shardingsphere.infra.util.props.fixture;
-import org.apache.shardingsphere.infra.exception.ConnectionSQLException;
-import org.apache.shardingsphere.infra.util.exception.external.sql.sqlstate.XOpenSQLState;
-
-/**
- * Invalid executor suitable exception.
- */
-public final class InvalidExecutorSuitableException extends ConnectionSQLException {
-
- private static final long serialVersionUID = 8481186245119374721L;
+public enum TypedPropertyEnumFixture {
- public InvalidExecutorSuitableException() {
- super(XOpenSQLState.GENERAL_ERROR, 50, "The property `proxy-backend-executor-suitable` must be `OLAP` or `OLTP`");
- }
+ FOO
}
diff --git a/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyKeyFixture.java b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyKeyFixture.java
index 676e9e5838b..27ef31e2993 100644
--- a/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyKeyFixture.java
+++ b/shardingsphere-infra/shardingsphere-infra-util/src/test/java/org/apache/shardingsphere/infra/util/props/fixture/TypedPropertyKeyFixture.java
@@ -37,7 +37,9 @@ public enum TypedPropertyKeyFixture implements TypedPropertyKey {
LONG_OBJECT_VALUE("Long", "1000", Long.class),
- STRING_VALUE("String", "value", String.class);
+ STRING_VALUE("String", "value", String.class),
+
+ ENUM_VALUE("enum", TypedPropertyEnumFixture.FOO.name(), TypedPropertyEnumFixture.class);
private final String key;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyState.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyState.java
index ecfeb239760..fe124427645 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyState.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/main/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyState.java
@@ -18,11 +18,11 @@
package org.apache.shardingsphere.proxy.frontend.state.impl;
import io.netty.channel.ChannelHandlerContext;
+import org.apache.shardingsphere.infra.config.props.BackendExecutorType;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask;
-import org.apache.shardingsphere.proxy.frontend.exception.InvalidExecutorSuitableException;
import org.apache.shardingsphere.proxy.frontend.executor.ConnectionThreadExecutorGroup;
import org.apache.shardingsphere.proxy.frontend.executor.UserExecutorGroup;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
@@ -62,14 +62,8 @@ public final class JDBCOKProxyState implements OKProxyState {
}
private boolean isPreferNettyEventLoop() {
- switch (ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)) {
- case "OLTP":
- return true;
- case "OLAP":
- return false;
- default:
- throw new InvalidExecutorSuitableException();
- }
+ return BackendExecutorType.OLTP == ProxyContext.getInstance()
+ .getContextManager().getMetaDataContexts().getMetaData().getProps().<BackendExecutorType>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE);
}
@Override
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyStateTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyStateTest.java
index 9f7117e3cfa..5834a592acd 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyStateTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-core/src/test/java/org/apache/shardingsphere/proxy/frontend/state/impl/JDBCOKProxyStateTest.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.proxy.frontend.state.impl;
import io.netty.channel.ChannelHandlerContext;
import io.netty.util.concurrent.EventExecutor;
import lombok.SneakyThrows;
+import org.apache.shardingsphere.infra.config.props.BackendExecutorType;
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;
@@ -27,7 +28,6 @@ import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.frontend.ProxyContextRestorer;
import org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask;
-import org.apache.shardingsphere.proxy.frontend.exception.InvalidExecutorSuitableException;
import org.apache.shardingsphere.proxy.frontend.executor.ConnectionThreadExecutorGroup;
import org.apache.shardingsphere.proxy.frontend.spi.DatabaseProtocolFrontendEngine;
import org.apache.shardingsphere.transaction.core.TransactionType;
@@ -90,7 +90,7 @@ public final class JDBCOKProxyStateTest extends ProxyContextRestorer {
public void assertExecuteWithProxyBackendExecutorSuitableForOLTP() {
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED)).thenReturn(false);
when(ProxyContext.getInstance().getContextManager()
- .getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn("OLTP");
+ .getMetaDataContexts().getMetaData().getProps().<BackendExecutorType>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn(BackendExecutorType.OLTP);
EventExecutor eventExecutor = mock(EventExecutor.class);
when(context.executor()).thenReturn(eventExecutor);
new JDBCOKProxyState().execute(context, null, frontendEngine, connectionSession);
@@ -101,7 +101,7 @@ public final class JDBCOKProxyStateTest extends ProxyContextRestorer {
public void assertExecuteWithProxyBackendExecutorSuitableForOLAPAndRequiredSameThreadForConnection() {
when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED)).thenReturn(false);
when(ProxyContext.getInstance().getContextManager()
- .getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn("OLAP");
+ .getMetaDataContexts().getMetaData().getProps().<BackendExecutorType>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn(BackendExecutorType.OLAP);
when(frontendEngine.getFrontendContext().isRequiredSameThreadForConnection(null)).thenReturn(true);
ExecutorService executorService = registerMockExecutorService(1);
new JDBCOKProxyState().execute(context, null, frontendEngine, connectionSession);
@@ -109,14 +109,6 @@ public final class JDBCOKProxyStateTest extends ProxyContextRestorer {
ConnectionThreadExecutorGroup.getInstance().unregisterAndAwaitTermination(1);
}
- @Test(expected = InvalidExecutorSuitableException.class)
- public void assertExecuteWithProxyBackendExecutorSuitableForInvalidValue() {
- when(ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_HINT_ENABLED)).thenReturn(false);
- when(ProxyContext.getInstance().getContextManager()
- .getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_BACKEND_EXECUTOR_SUITABLE)).thenReturn("invalid value");
- new JDBCOKProxyState().execute(context, null, frontendEngine, connectionSession);
- }
-
@SuppressWarnings({"unchecked", "SameParameterValue"})
@SneakyThrows(ReflectiveOperationException.class)
private ExecutorService registerMockExecutorService(final int connectionId) {