This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 1731bfb polish codes for proxy (#7493)
1731bfb is described below
commit 1731bfb911ff183b646bd31bb0602ee927458e40
Author: kimmking <[email protected]>
AuthorDate: Wed Sep 16 21:37:44 2020 +0800
polish codes for proxy (#7493)
---
.../src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java | 6 ++----
.../proxy/init/impl/GovernanceBootstrapInitializer.java | 4 +---
.../proxy/init/impl/GovernanceBootstrapInitializerTest.java | 5 +----
3 files changed, 4 insertions(+), 11 deletions(-)
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
index 958404e..ac9b05a 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/Bootstrap.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.proxy;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.proxy.arg.BootstrapArguments;
import org.apache.shardingsphere.proxy.config.ProxyConfigurationLoader;
import org.apache.shardingsphere.proxy.config.YamlProxyConfiguration;
@@ -45,12 +44,11 @@ public final class Bootstrap {
*/
public static void main(final String[] args) throws IOException,
SQLException {
BootstrapArguments bootstrapArgs = new BootstrapArguments(args);
- int port = bootstrapArgs.getPort();
YamlProxyConfiguration yamlConfig =
ProxyConfigurationLoader.load(bootstrapArgs.getConfigurationPath());
- createBootstrapInitializer(yamlConfig).init(yamlConfig, port);
+ createBootstrapInitializer(yamlConfig).init(yamlConfig,
bootstrapArgs.getPort());
}
private static BootstrapInitializer createBootstrapInitializer(final
YamlProxyConfiguration yamlConfig) {
- return null == yamlConfig.getServerConfiguration().getGovernance() ?
new StandardBootstrapInitializer() : new GovernanceBootstrapInitializer(new
GovernanceFacade());
+ return null == yamlConfig.getServerConfiguration().getGovernance() ?
new StandardBootstrapInitializer() : new GovernanceBootstrapInitializer();
}
}
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializer.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializer.java
index 4158ef2..7c01f87 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializer.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializer.java
@@ -17,7 +17,6 @@
package org.apache.shardingsphere.proxy.init.impl;
-import lombok.RequiredArgsConstructor;
import
org.apache.shardingsphere.governance.context.schema.GovernanceSchemaContexts;
import
org.apache.shardingsphere.governance.context.transaction.GovernanceTransactionContexts;
import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
@@ -47,10 +46,9 @@ import java.util.stream.Collectors;
/**
* Governance bootstrap initializer.
*/
-@RequiredArgsConstructor
public final class GovernanceBootstrapInitializer extends
AbstractBootstrapInitializer {
- private final GovernanceFacade governanceFacade;
+ private final GovernanceFacade governanceFacade = new GovernanceFacade();
@Override
protected ProxyConfiguration getProxyConfiguration(final
YamlProxyConfiguration yamlConfig) {
diff --git
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializerTest.java
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializerTest.java
index cbbfb2d..f28a14b 100644
---
a/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializerTest.java
+++
b/shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/test/java/org/apache/shardingsphere/proxy/init/impl/GovernanceBootstrapInitializerTest.java
@@ -21,7 +21,6 @@ import lombok.SneakyThrows;
import
org.apache.shardingsphere.governance.context.schema.GovernanceSchemaContexts;
import
org.apache.shardingsphere.governance.context.transaction.GovernanceTransactionContexts;
import org.apache.shardingsphere.governance.core.config.ConfigCenterNode;
-import org.apache.shardingsphere.governance.core.facade.GovernanceFacade;
import org.apache.shardingsphere.infra.auth.Authentication;
import org.apache.shardingsphere.infra.auth.ProxyUser;
import org.apache.shardingsphere.infra.config.RuleConfiguration;
@@ -67,9 +66,7 @@ public final class GovernanceBootstrapInitializerTest {
private FixtureConfigurationRepository configurationRepository = new
FixtureConfigurationRepository();
- private GovernanceFacade governanceFacade = new GovernanceFacade();
-
- private GovernanceBootstrapInitializer initializer = new
GovernanceBootstrapInitializer(governanceFacade);
+ private GovernanceBootstrapInitializer initializer = new
GovernanceBootstrapInitializer();
@Test
public void assertGetProxyConfiguration() throws IOException {