[3.0] Code reformat (#8019)
* convert files, add checker * rename id * tab to space * change git attributes auto convert * fix end new line * fix end new line * fix end new line * ignore generated files * override tomcat-embed-core version * add ignore for codestyle/checkstyle.xml * add ignore for codestyle/checkstyle.xml * add rat ignore * add suppression * force update * disable zk dynamic configurator
This commit is contained in:
parent
724ec8b554
commit
0e66de1c61
|
|
@ -1,4 +1,20 @@
|
||||||
# Git will understand that all files specified are not text,
|
# Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
# and it should not try to change them.
|
# contributor license agreements. See the NOTICE file distributed with
|
||||||
# This will prevent file formatting (such as `crlf` endings to `lf` endings) while commit.
|
# this work for additional information regarding copyright ownership.
|
||||||
* -text
|
# The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
# (the "License"); you may not use this file except in compliance with
|
||||||
|
# the License. You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
*.java text eol=lf
|
||||||
|
|
@ -39,7 +39,25 @@ jobs:
|
||||||
- name: "Build Dubbo with Maven"
|
- name: "Build Dubbo with Maven"
|
||||||
run: |
|
run: |
|
||||||
cd ./dubbo
|
cd ./dubbo
|
||||||
./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean source:jar install -Pjacoco,rat,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
|
./mvnw --batch-mode -U -e --no-transfer-progress clean source:jar install -Pjacoco,rat,checkstyle -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
|
||||||
|
- name: "Pack rat file if failure"
|
||||||
|
if: failure()
|
||||||
|
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
|
||||||
|
- name: "Upload rat file if failure"
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "rat-file"
|
||||||
|
path: ${{ github.workspace }}/rat.zip
|
||||||
|
- name: "Pack checkstyle file if failure"
|
||||||
|
if: failure()
|
||||||
|
run: 7z a ${{ github.workspace }}/checkstyle.zip *checkstyle* -r
|
||||||
|
- name: "Upload checkstyle file if failure"
|
||||||
|
if: failure()
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "checkstyle-file"
|
||||||
|
path: ${{ github.workspace }}/checkstyle.zip
|
||||||
- name: "Calculate Dubbo Version"
|
- name: "Calculate Dubbo Version"
|
||||||
id: dubbo-version
|
id: dubbo-version
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -72,22 +90,13 @@ jobs:
|
||||||
- name: "Test with Maven with Integration Tests"
|
- name: "Test with Maven with Integration Tests"
|
||||||
timeout-minutes: 40
|
timeout-minutes: 40
|
||||||
if: ${{ startsWith( matrix.os, 'ubuntu') }}
|
if: ${{ startsWith( matrix.os, 'ubuntu') }}
|
||||||
run: ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean test verify -Pjacoco -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
|
run: ./mvnw --batch-mode -U -e --no-transfer-progress clean test verify -Pjacoco -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Dcheckstyle_unix.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
|
||||||
- name: "Test with Maven without Integration Tests"
|
- name: "Test with Maven without Integration Tests"
|
||||||
env:
|
env:
|
||||||
DISABLE_FILE_SYSTEM_TEST: true
|
DISABLE_FILE_SYSTEM_TEST: true
|
||||||
timeout-minutes: 50
|
timeout-minutes: 50
|
||||||
if: ${{ startsWith( matrix.os, 'windows') }}
|
if: ${{ startsWith( matrix.os, 'windows') }}
|
||||||
run: ./mvnw --batch-mode --no-snapshot-updates -e --no-transfer-progress clean test verify -Pjacoco -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" -D"maven.wagon.http.retryHandler.count=5" -DskipTests=false -DskipIntegrationTests=true -D"checkstyle.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
|
run: ./mvnw --batch-mode -U -e --no-transfer-progress clean test verify -Pjacoco -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" -D"maven.wagon.http.retryHandler.count=5" -DskipTests=false -DskipIntegrationTests=true -D"checkstyle.skip=false" -D"checkstyle_unix.skip=true" -D"rat.skip=false" -D"maven.javadoc.skip=true"
|
||||||
- name: "Pack rat file if failure"
|
|
||||||
if: failure()
|
|
||||||
run: 7z a ${{ github.workspace }}/rat.zip *rat.txt -r
|
|
||||||
- name: "Upload rat file if failure"
|
|
||||||
if: failure()
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: "rat-file-${{ matrix.os }}-JDK${{ matrix.jdk }}"
|
|
||||||
path: ${{ github.workspace }}/rat.zip
|
|
||||||
- name: "Upload coverage to Codecov"
|
- name: "Upload coverage to Codecov"
|
||||||
uses: codecov/codecov-action@v1
|
uses: codecov/codecov-action@v1
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,6 @@
|
||||||
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
|
||||||
<suppressions>
|
<suppressions>
|
||||||
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]com[\\/]alibaba[\\/]com[\\/]caucho[\\/]hessian" checks=".*"/>
|
<suppress files="[\\/]src[\\/]main[\\/]java[\\/]com[\\/]alibaba[\\/]com[\\/]caucho[\\/]hessian" checks=".*"/>
|
||||||
|
<suppress files="[\\/]build[\\/]generated[\\/]source[\\/]proto" checks=".*"/>
|
||||||
<suppress files="Yylex\.java" checks="AvoidEscapedUnicodeCharacters"/>
|
<suppress files="Yylex\.java" checks="AvoidEscapedUnicodeCharacters"/>
|
||||||
</suppressions>
|
</suppressions>
|
||||||
|
|
@ -12,6 +12,10 @@
|
||||||
<property name="fileExtensions" value="java"/>
|
<property name="fileExtensions" value="java"/>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
<module name="FileTabCharacter">
|
||||||
|
<property name="fileExtensions" value="java,xml"/>
|
||||||
|
</module>
|
||||||
|
|
||||||
<!-- TreeWalker Checks -->
|
<!-- TreeWalker Checks -->
|
||||||
<module name="TreeWalker">
|
<module name="TreeWalker">
|
||||||
<module name="SuppressWarningsHolder"/>
|
<module name="SuppressWarningsHolder"/>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<!DOCTYPE module PUBLIC
|
||||||
|
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
||||||
|
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">
|
||||||
|
|
||||||
|
<module name="Checker">
|
||||||
|
<module name="NewlineAtEndOfFile">
|
||||||
|
<property name="lineSeparator" value="lf" />
|
||||||
|
</module>
|
||||||
|
</module>
|
||||||
|
|
@ -64,6 +64,7 @@
|
||||||
<exclude>**/.classpath</exclude>
|
<exclude>**/.classpath</exclude>
|
||||||
<exclude>**/.project</exclude>
|
<exclude>**/.project</exclude>
|
||||||
<exclude>**/target/**</exclude>
|
<exclude>**/target/**</exclude>
|
||||||
|
<exclude>**/generated/**</exclude>
|
||||||
<exclude>**/*.log</exclude>
|
<exclude>**/*.log</exclude>
|
||||||
<exclude>CONTRIBUTING.md</exclude>
|
<exclude>CONTRIBUTING.md</exclude>
|
||||||
<exclude>README.md</exclude>
|
<exclude>README.md</exclude>
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.dubbo.rpc.cluster.router.state;
|
package org.apache.dubbo.rpc.cluster.router.state;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.rpc.Invocation;
|
import org.apache.dubbo.rpc.Invocation;
|
||||||
import org.apache.dubbo.rpc.Invoker;
|
import org.apache.dubbo.rpc.Invoker;
|
||||||
import org.apache.dubbo.rpc.RpcException;
|
import org.apache.dubbo.rpc.RpcException;
|
||||||
import org.apache.dubbo.rpc.cluster.Directory;
|
import org.apache.dubbo.rpc.cluster.Directory;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State Router. (SPI, Prototype, ThreadSafe)
|
* State Router. (SPI, Prototype, ThreadSafe)
|
||||||
* <p>
|
* <p>
|
||||||
|
|
|
||||||
|
|
@ -96,15 +96,15 @@ public class ScriptRouterTest {
|
||||||
invokers.add(invoker3);
|
invokers.add(invoker3);
|
||||||
|
|
||||||
String script = "function route(invokers, invocation, context){ " +
|
String script = "function route(invokers, invocation, context){ " +
|
||||||
" var result = new java.util.ArrayList(invokers.size()); " +
|
" var result = new java.util.ArrayList(invokers.size()); " +
|
||||||
" var targetHost = new java.util.ArrayList(); " +
|
" var targetHost = new java.util.ArrayList(); " +
|
||||||
" targetHost.add(\"10.134.108.2\"); " +
|
" targetHost.add(\"10.134.108.2\"); " +
|
||||||
" for (var i = 0; i < invokers.length; i++) { " +
|
" for (var i = 0; i < invokers.length; i++) { " +
|
||||||
" if(targetHost.contains(invokers[i].getUrl().getHost())){ " +
|
" if(targetHost.contains(invokers[i].getUrl().getHost())){ " +
|
||||||
" result.add(invokers[i]); " +
|
" result.add(invokers[i]); " +
|
||||||
" } " +
|
" } " +
|
||||||
" } " +
|
" } " +
|
||||||
" return result; " +
|
" return result; " +
|
||||||
"} " +
|
"} " +
|
||||||
"route(invokers, invocation, context) ";
|
"route(invokers, invocation, context) ";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -809,6 +809,6 @@ public class HashedWheelTimer implements Timer {
|
||||||
private static final boolean IS_OS_WINDOWS = System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win");
|
private static final boolean IS_OS_WINDOWS = System.getProperty("os.name", "").toLowerCase(Locale.US).contains("win");
|
||||||
|
|
||||||
private boolean isWindows() {
|
private boolean isWindows() {
|
||||||
return IS_OS_WINDOWS;
|
return IS_OS_WINDOWS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -236,7 +236,7 @@ public abstract class AbstractInterfaceConfig extends AbstractMethodConfig {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void verifyStubAndLocal(String className, String label, Class<?> interfaceClass){
|
private void verifyStubAndLocal(String className, String label, Class<?> interfaceClass){
|
||||||
if (ConfigUtils.isNotEmpty(className)) {
|
if (ConfigUtils.isNotEmpty(className)) {
|
||||||
Class<?> localClass = ConfigUtils.isDefault(className) ?
|
Class<?> localClass = ConfigUtils.isDefault(className) ?
|
||||||
ReflectUtils.forName(interfaceClass.getName() + label) : ReflectUtils.forName(className);
|
ReflectUtils.forName(interfaceClass.getName() + label) : ReflectUtils.forName(className);
|
||||||
verify(interfaceClass, localClass);
|
verify(interfaceClass, localClass);
|
||||||
|
|
|
||||||
|
|
@ -18,16 +18,15 @@
|
||||||
package org.apache.dubbo.config;
|
package org.apache.dubbo.config;
|
||||||
|
|
||||||
import com.alibaba.dubbo.config.ArgumentConfig;
|
import com.alibaba.dubbo.config.ArgumentConfig;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasEntry;
|
import static org.hamcrest.Matchers.hasEntry;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class ArgumentConfigTest {
|
public class ArgumentConfigTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,11 @@
|
||||||
package org.apache.dubbo.config;
|
package org.apache.dubbo.config;
|
||||||
|
|
||||||
import com.alibaba.dubbo.config.ConsumerConfig;
|
import com.alibaba.dubbo.config.ConsumerConfig;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class ConsumerConfigTest {
|
public class ConsumerConfigTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,16 @@
|
||||||
package org.apache.dubbo.config;
|
package org.apache.dubbo.config;
|
||||||
|
|
||||||
import com.alibaba.dubbo.config.ProtocolConfig;
|
import com.alibaba.dubbo.config.ProtocolConfig;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasEntry;
|
import static org.hamcrest.Matchers.hasEntry;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class ProtocolConfigTest {
|
public class ProtocolConfigTest {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,18 +18,17 @@
|
||||||
package org.apache.dubbo.config;
|
package org.apache.dubbo.config;
|
||||||
|
|
||||||
import com.alibaba.dubbo.config.ProviderConfig;
|
import com.alibaba.dubbo.config.ProviderConfig;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
import static org.hamcrest.Matchers.equalTo;
|
||||||
import static org.hamcrest.Matchers.hasEntry;
|
import static org.hamcrest.Matchers.hasEntry;
|
||||||
import static org.hamcrest.Matchers.hasKey;
|
import static org.hamcrest.Matchers.hasKey;
|
||||||
import static org.hamcrest.Matchers.is;
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.hamcrest.Matchers.not;
|
import static org.hamcrest.Matchers.not;
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
|
||||||
|
|
||||||
public class ProviderConfigTest {
|
public class ProviderConfigTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import static org.hamcrest.Matchers.is;
|
|
||||||
import static org.hamcrest.MatcherAssert.assertThat;
|
import static org.hamcrest.MatcherAssert.assertThat;
|
||||||
|
import static org.hamcrest.Matchers.is;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
public class SerializationTest {
|
public class SerializationTest {
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ public interface DemoService {
|
||||||
|
|
||||||
Type enumlength(Type... types);
|
Type enumlength(Type... types);
|
||||||
|
|
||||||
// Type enumlength(Type type);
|
// Type enumlength(Type type);
|
||||||
|
|
||||||
String get(CustomArgument arg1);
|
String get(CustomArgument arg1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1254,12 +1254,12 @@ public class DubboBootstrap {
|
||||||
if (exportAsync) {
|
if (exportAsync) {
|
||||||
ExecutorService executor = executorRepository.getServiceExporterExecutor();
|
ExecutorService executor = executorRepository.getServiceExporterExecutor();
|
||||||
Future<?> future = executor.submit(() -> {
|
Future<?> future = executor.submit(() -> {
|
||||||
try {
|
try {
|
||||||
sc.export();
|
sc.export();
|
||||||
exportedServices.add(sc);
|
exportedServices.add(sc);
|
||||||
}catch (Throwable t) {
|
}catch (Throwable t) {
|
||||||
logger.error("export async catch error : " + t.getMessage(), t);
|
logger.error("export async catch error : " + t.getMessage(), t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
asyncExportingFutures.add(future);
|
asyncExportingFutures.add(future);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ConfigCenterBuilder extends AbstractBuilder<ConfigCenterConfig, Con
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConfigCenterBuilder address(String address) {
|
public ConfigCenterBuilder address(String address) {
|
||||||
this.address = address;
|
this.address = address;
|
||||||
return getThis();
|
return getThis();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package org.apache.dubbo.config.spring.propertyconfigurer.provider;
|
||||||
|
|
||||||
import org.apache.dubbo.config.spring.api.HelloService;
|
import org.apache.dubbo.config.spring.api.HelloService;
|
||||||
import org.apache.dubbo.rpc.RpcContext;
|
import org.apache.dubbo.rpc.RpcContext;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,7 @@ import org.apache.curator.test.TestingServer;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -48,6 +49,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
/**
|
/**
|
||||||
* TODO refactor using mockito
|
* TODO refactor using mockito
|
||||||
*/
|
*/
|
||||||
|
@Disabled("Disabled Due to Zookeeper in Github Actions")
|
||||||
public class ZookeeperDynamicConfigurationTest {
|
public class ZookeeperDynamicConfigurationTest {
|
||||||
private static CuratorFramework client;
|
private static CuratorFramework client;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,7 @@ import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.rpc.Invocation;
|
import org.apache.dubbo.rpc.Invocation;
|
||||||
import org.apache.dubbo.rpc.RpcInvocation;
|
import org.apache.dubbo.rpc.RpcInvocation;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package org.apache.dubbo.auth;
|
||||||
import org.apache.dubbo.auth.model.AccessKeyPair;
|
import org.apache.dubbo.auth.model.AccessKeyPair;
|
||||||
import org.apache.dubbo.common.URL;
|
import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.rpc.Invocation;
|
import org.apache.dubbo.rpc.Invocation;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import org.apache.dubbo.common.URL;
|
||||||
import org.apache.dubbo.common.constants.CommonConstants;
|
import org.apache.dubbo.common.constants.CommonConstants;
|
||||||
import org.apache.dubbo.rpc.Invocation;
|
import org.apache.dubbo.rpc.Invocation;
|
||||||
import org.apache.dubbo.rpc.Invoker;
|
import org.apache.dubbo.rpc.Invoker;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.anyString;
|
import static org.mockito.ArgumentMatchers.anyString;
|
||||||
|
|
|
||||||
|
|
@ -61,10 +61,10 @@ public class AllChannelHandler extends WrappedChannelHandler {
|
||||||
try {
|
try {
|
||||||
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
|
executor.execute(new ChannelEventRunnable(channel, handler, ChannelState.RECEIVED, message));
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
if(message instanceof Request && t instanceof RejectedExecutionException){
|
if(message instanceof Request && t instanceof RejectedExecutionException){
|
||||||
sendFeedback(channel, (Request) message, t);
|
sendFeedback(channel, (Request) message, t);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
|
throw new ExecutionException(message, channel, getClass() + " error when process received event .", t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -78,9 +78,9 @@ public class NettyClient extends AbstractClient {
|
||||||
* It wil init and start netty.
|
* It wil init and start netty.
|
||||||
*/
|
*/
|
||||||
public NettyClient(final URL url, final ChannelHandler handler) throws RemotingException {
|
public NettyClient(final URL url, final ChannelHandler handler) throws RemotingException {
|
||||||
// you can customize name and type of client thread pool by THREAD_NAME_KEY and THREADPOOL_KEY in CommonConstants.
|
// you can customize name and type of client thread pool by THREAD_NAME_KEY and THREADPOOL_KEY in CommonConstants.
|
||||||
// the handler will be wrapped: MultiMessageHandler->HeartbeatHandler->handler
|
// the handler will be wrapped: MultiMessageHandler->HeartbeatHandler->handler
|
||||||
super(url, wrapChannelHandler(url, handler));
|
super(url, wrapChannelHandler(url, handler));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ public class NettyServer extends AbstractServer implements RemotingServer {
|
||||||
/**
|
/**
|
||||||
* the boss channel that receive connections and dispatch these to worker channel.
|
* the boss channel that receive connections and dispatch these to worker channel.
|
||||||
*/
|
*/
|
||||||
private io.netty.channel.Channel channel;
|
private io.netty.channel.Channel channel;
|
||||||
|
|
||||||
private EventLoopGroup bossGroup;
|
private EventLoopGroup bossGroup;
|
||||||
private EventLoopGroup workerGroup;
|
private EventLoopGroup workerGroup;
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ public abstract class AbstractProxyInvoker<T> implements Invoker<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private CompletableFuture<Object> wrapWithFuture(Object value) {
|
private CompletableFuture<Object> wrapWithFuture(Object value) {
|
||||||
if (RpcContext.getServiceContext().isAsyncStarted()) {
|
if (RpcContext.getServiceContext().isAsyncStarted()) {
|
||||||
return ((AsyncContextImpl)(RpcContext.getServiceContext().getAsyncContext())).getInternalFuture();
|
return ((AsyncContextImpl)(RpcContext.getServiceContext().getAsyncContext())).getInternalFuture();
|
||||||
} else if (value instanceof CompletableFuture) {
|
} else if (value instanceof CompletableFuture) {
|
||||||
|
|
|
||||||
|
|
@ -42,15 +42,15 @@ public class StatItemTest {
|
||||||
assertEquals(4, statItem.getToken());
|
assertEquals(4, statItem.getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAccuracy() throws Exception {
|
public void testAccuracy() throws Exception {
|
||||||
final int EXPECTED_RATE = 5;
|
final int EXPECTED_RATE = 5;
|
||||||
statItem = new StatItem("test", EXPECTED_RATE, 60_000L);
|
statItem = new StatItem("test", EXPECTED_RATE, 60_000L);
|
||||||
for (int i = 1; i <= EXPECTED_RATE; i++) {
|
for (int i = 1; i <= EXPECTED_RATE; i++) {
|
||||||
assertEquals(true, statItem.isAllowable());
|
assertEquals(true, statItem.isAllowable());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Must block the 6th item
|
// Must block the 6th item
|
||||||
assertEquals(false, statItem.isAllowable());
|
assertEquals(false, statItem.isAllowable());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public interface DemoService {
|
||||||
|
|
||||||
Type enumlength(Type... types);
|
Type enumlength(Type... types);
|
||||||
|
|
||||||
// Type enumlength(Type type);
|
// Type enumlength(Type type);
|
||||||
|
|
||||||
String get(CustomArgument arg1);
|
String get(CustomArgument arg1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,12 @@
|
||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tomcat.embed</groupId>
|
||||||
|
<artifactId>tomcat-embed-core</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import org.apache.dubbo.common.extension.ExtensionLoader;
|
||||||
import org.apache.dubbo.common.status.StatusChecker;
|
import org.apache.dubbo.common.status.StatusChecker;
|
||||||
import org.apache.dubbo.config.ProtocolConfig;
|
import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ProviderConfig;
|
import org.apache.dubbo.config.ProviderConfig;
|
||||||
|
|
||||||
import org.apache.dubbo.config.context.ConfigManager;
|
import org.apache.dubbo.config.context.ConfigManager;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
import org.springframework.boot.actuate.health.AbstractHealthIndicator;
|
||||||
import org.springframework.boot.actuate.health.Health;
|
import org.springframework.boot.actuate.health.Health;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import org.apache.dubbo.common.Version;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent;
|
||||||
|
import org.springframework.boot.logging.LoggingApplicationListener;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ProviderConfig;
|
import org.apache.dubbo.config.ProviderConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ import org.apache.dubbo.config.ProtocolConfig;
|
||||||
import org.apache.dubbo.config.ProviderConfig;
|
import org.apache.dubbo.config.ProviderConfig;
|
||||||
import org.apache.dubbo.config.RegistryConfig;
|
import org.apache.dubbo.config.RegistryConfig;
|
||||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||||
import org.apache.dubbo.rpc.model.ApplicationModel;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
|
||||||
25
pom.xml
25
pom.xml
|
|
@ -125,6 +125,7 @@
|
||||||
<apache-rat-plugin.version>0.13</apache-rat-plugin.version>
|
<apache-rat-plugin.version>0.13</apache-rat-plugin.version>
|
||||||
<arguments />
|
<arguments />
|
||||||
<checkstyle.skip>true</checkstyle.skip>
|
<checkstyle.skip>true</checkstyle.skip>
|
||||||
|
<checkstyle_unix.skip>true</checkstyle_unix.skip>
|
||||||
<rat.skip>true</rat.skip>
|
<rat.skip>true</rat.skip>
|
||||||
<jacoco.skip>true</jacoco.skip>
|
<jacoco.skip>true</jacoco.skip>
|
||||||
<revision>3.0.0-SNAPSHOT</revision>
|
<revision>3.0.0-SNAPSHOT</revision>
|
||||||
|
|
@ -257,6 +258,7 @@
|
||||||
<id>checkstyle</id>
|
<id>checkstyle</id>
|
||||||
<properties>
|
<properties>
|
||||||
<checkstyle.skip>false</checkstyle.skip>
|
<checkstyle.skip>false</checkstyle.skip>
|
||||||
|
<checkstyle_unix.skip>false</checkstyle_unix.skip>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
|
|
@ -308,12 +310,34 @@
|
||||||
**/org/apache/dubbo/triple/TripleWrapper.java,
|
**/org/apache/dubbo/triple/TripleWrapper.java,
|
||||||
**/istio/v1/auth/Ca.java,
|
**/istio/v1/auth/Ca.java,
|
||||||
**/istio/v1/auth/IstioCertificateServiceGrpc.java,
|
**/istio/v1/auth/IstioCertificateServiceGrpc.java,
|
||||||
|
**/generated/**/*,
|
||||||
|
**/target/**/*,
|
||||||
</excludes>
|
</excludes>
|
||||||
</configuration>
|
</configuration>
|
||||||
<goals>
|
<goals>
|
||||||
<goal>check</goal>
|
<goal>check</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>checkstyle-unix-validation</id>
|
||||||
|
<phase>validate</phase>
|
||||||
|
<configuration>
|
||||||
|
<configLocation>codestyle/checkstyle_unix.xml</configLocation>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<consoleOutput>true</consoleOutput>
|
||||||
|
<failOnViolation>true</failOnViolation>
|
||||||
|
<skip>${checkstyle_unix.skip}</skip>
|
||||||
|
<resourceExcludes>
|
||||||
|
**/target/**/*
|
||||||
|
</resourceExcludes>
|
||||||
|
<resourceExcludes>
|
||||||
|
**/generated/**/*
|
||||||
|
</resourceExcludes>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>check</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
@ -610,6 +634,7 @@
|
||||||
</exclude>
|
</exclude>
|
||||||
<exclude>.github/**</exclude>
|
<exclude>.github/**</exclude>
|
||||||
<exclude>compiler/**</exclude>
|
<exclude>compiler/**</exclude>
|
||||||
|
<exclude>**/generated/**</exclude>
|
||||||
<!-- exclude mockito extensions spi files -->
|
<!-- exclude mockito extensions spi files -->
|
||||||
<exclude>**/mockito-extensions/*</exclude>
|
<exclude>**/mockito-extensions/*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue