From 4bb4f3c18a2151878a31c40e2bd230a0a3f5de9b Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Tue, 31 Dec 2024 17:57:23 +0800 Subject: [PATCH 001/223] Bump log4j2.version from 2.24.1 to 2.24.2 (#4640) --- .../servicecomb/core/TestInvocation.java | 30 ++++++++----------- .../src/main/resources/application.yml | 1 - demo/demo-edge/README.md | 2 -- .../src/main/resources/application.yml | 2 -- .../demo-zeroconfig-registry-tests/pom.xml | 1 - .../src/main/resources/application.yml | 2 -- dependencies/default/pom.xml | 2 +- 7 files changed, 14 insertions(+), 26 deletions(-) diff --git a/core/src/test/java/org/apache/servicecomb/core/TestInvocation.java b/core/src/test/java/org/apache/servicecomb/core/TestInvocation.java index 4cf335cd34c..80b6bbda461 100644 --- a/core/src/test/java/org/apache/servicecomb/core/TestInvocation.java +++ b/core/src/test/java/org/apache/servicecomb/core/TestInvocation.java @@ -17,7 +17,6 @@ package org.apache.servicecomb.core; import java.util.Arrays; -import java.util.Map; import org.apache.servicecomb.core.definition.InvocationRuntimeType; import org.apache.servicecomb.core.definition.OperationMeta; @@ -49,7 +48,6 @@ import mockit.Mocked; public class TestInvocation { - Invocation invocation; @Mocked Endpoint endpoint; @@ -60,9 +58,6 @@ public class TestInvocation { @Mocked InvocationRuntimeType invocationRuntimeType; - @Mocked - Map arguments; - static long nanoTime = 123; @BeforeClass @@ -95,7 +90,7 @@ public void onStart(InvocationStartEvent event) { }; EventManager.register(subscriber); - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); invocation.onStart(); Assertions.assertSame(invocation, result.value); @@ -115,7 +110,7 @@ public void onStart(InvocationFinishEvent event) { }; EventManager.register(subscriber); - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); Assertions.assertFalse(invocation.isFinished()); Response response = Response.succResp(null); invocation.onFinish(response); @@ -134,19 +129,19 @@ public void onStart(InvocationFinishEvent event) { @Test public void isConsumer_yes() { - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); Assertions.assertFalse(invocation.isConsumer()); } @Test public void isConsumer_no(@Mocked ReferenceConfig referenceConfig) { - Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); Assertions.assertTrue(invocation.isConsumer()); } @Test public void localContext(@Mocked ReferenceConfig referenceConfig) { - Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); invocation.addLocalContext("k", 1); Assertions.assertSame(invocation.getHandlerContext(), invocation.getLocalContext()); @@ -155,7 +150,7 @@ public void localContext(@Mocked ReferenceConfig referenceConfig) { @Test public void traceId_fromContext(@Mocked ReferenceConfig referenceConfig) { - Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); invocation.addContext(CoreConst.TRACE_ID_NAME, "abc"); invocation.onStart(); @@ -173,7 +168,7 @@ public void traceId_consumerCreateTraceId(@Mocked ReferenceConfig referenceConfi result = "abc"; } }; - Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); invocation.onStart(); @@ -189,7 +184,7 @@ public void traceId_fromRequest(@Mocked Endpoint endpoint, @Mocked HttpServletRe result = "abc"; } }; - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); invocation.onStart(requestEx); @@ -199,6 +194,7 @@ public void traceId_fromRequest(@Mocked Endpoint endpoint, @Mocked HttpServletRe @Test public void traceId_producerCreateTraceId(@Mocked Endpoint endpoint, @Mocked HttpServletRequestEx requestEx) { + TraceIdGenerator generator = SPIServiceUtils.getTargetService(TraceIdGenerator.class, BraveTraceIdGenerator.class); new Expectations(generator) { { @@ -206,7 +202,7 @@ public void traceId_producerCreateTraceId(@Mocked Endpoint endpoint, @Mocked Htt result = "abc"; } }; - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); invocation.onStart(requestEx); @@ -250,7 +246,7 @@ public void onBusinessMethodStart(InvocationBusinessMethodStartEvent event) { } }; EventManager.getEventBus().register(listener); - Invocation invocation = new Invocation(endpoint, operationMeta, arguments); + Invocation invocation = new Invocation(endpoint, operationMeta, null); mockNonaTime(); invocation.onBusinessMethodStart(); EventManager.getEventBus().unregister(listener); @@ -265,12 +261,12 @@ public void onBusinessMethodStart(InvocationBusinessMethodStartEvent event) { public void marker(@Mocked ReferenceConfig referenceConfig) { Invocation.INVOCATION_ID.set(0); - Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + Invocation invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); invocation.addContext(CoreConst.TRACE_ID_NAME, "abc"); invocation.onStart(); Assertions.assertEquals("abc", invocation.getTraceIdLogger().getName()); - invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, arguments); + invocation = new Invocation(referenceConfig, operationMeta, invocationRuntimeType, null); invocation.addContext(CoreConst.TRACE_ID_NAME, "abc"); invocation.onStart(); Assertions.assertEquals("abc", invocation.getTraceIdLogger().getName()); diff --git a/demo/demo-cse-v1/consumer/src/main/resources/application.yml b/demo/demo-cse-v1/consumer/src/main/resources/application.yml index aa66a2ec7c8..11f739de444 100644 --- a/demo/demo-cse-v1/consumer/src/main/resources/application.yml +++ b/demo/demo-cse-v1/consumer/src/main/resources/application.yml @@ -135,4 +135,3 @@ servicecomb: secretKey: ${CREDENTIALS_SK} akskCustomCipher: default project: cn-south-1 - diff --git a/demo/demo-edge/README.md b/demo/demo-edge/README.md index 60a3bbf119c..b5a552e0668 100644 --- a/demo/demo-edge/README.md +++ b/demo/demo-edge/README.md @@ -15,5 +15,3 @@ * 2.0.0: /business/v1/add, /business/v1/dec, /business/v2/add, /business/v2/dec Together with router, /business/v1/add will go correctly to 1.0.0 or 1.1.0, and /business/v2/add will go correctly to 2.0.0. Without router, /business/v2/add may route to 1.0.0 or 1.1.0 and NOT FOUND is reported. - - diff --git a/demo/demo-etcd/test-client/src/main/resources/application.yml b/demo/demo-etcd/test-client/src/main/resources/application.yml index 4245a4d2c86..adcf259e984 100644 --- a/demo/demo-etcd/test-client/src/main/resources/application.yml +++ b/demo/demo-etcd/test-client/src/main/resources/application.yml @@ -33,5 +33,3 @@ test2: applition test3: service test4: version test5: tag - - diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml index 8876f77542b..47d2859d0c1 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml @@ -171,4 +171,3 @@ - diff --git a/demo/demo-zookeeper/consumer/src/main/resources/application.yml b/demo/demo-zookeeper/consumer/src/main/resources/application.yml index 80087f7c6fb..100797f83b4 100644 --- a/demo/demo-zookeeper/consumer/src/main/resources/application.yml +++ b/demo/demo-zookeeper/consumer/src/main/resources/application.yml @@ -34,5 +34,3 @@ servicecomb: highway: address: 0.0.0.0:7092 - - diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 663f8e427e0..903e25ad7d4 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.11.3 1.2.17 - 2.24.1 + 2.24.2 3.9.9 1.14.1 5.14.2 From 2fc6d4089b65c245ad01c8154ffc3d7e049cd09e Mon Sep 17 00:00:00 2001 From: felixgis14 <71480844+felixgis14@users.noreply.github.com> Date: Fri, 3 Jan 2025 10:25:37 +0800 Subject: [PATCH 002/223] [SCB-2895]Support Consul as the Service Discovery and Configuration Center (#4647) * [SCB-2895]Support Consul as the Service Discovery and Configuration Center --------- Co-authored-by: flygoods --- demo/demo-consul/README.md | 5 + demo/demo-consul/consumer/pom.xml | 82 +++++ .../samples/ClientWebsocketController.java | 52 +++ .../samples/ConsulConsumerApplication.java | 33 ++ .../samples/ConsumerController.java | 52 +++ .../ConsumerHeaderParamWithListSchema.java | 55 ++++ .../ConsumerReactiveStreamController.java | 84 +++++ .../servicecomb/samples/ProviderService.java | 26 ++ .../org/apache/servicecomb/samples/User.java | 41 +++ .../src/main/resources/application.yml | 40 +++ .../consumer/src/main/resources/log4j2.xml | 41 +++ demo/demo-consul/gateway/pom.xml | 85 +++++ .../samples/GatewayApplication.java | 33 ++ .../src/main/resources/application.yml | 60 ++++ .../gateway/src/main/resources/log4j2.xml | 41 +++ demo/demo-consul/pom.xml | 62 ++++ demo/demo-consul/provider/pom.xml | 92 ++++++ .../samples/ConsulProviderApplication.java | 33 ++ .../samples/HeaderParamWithListSchema.java | 51 +++ .../samples/ProviderController.java | 63 ++++ .../samples/ReactiveStreamController.java | 78 +++++ .../org/apache/servicecomb/samples/User.java | 40 +++ .../samples/WebsocketController.java | 67 ++++ .../src/main/resources/application.yml | 67 ++++ .../provider/src/main/resources/log4j2.xml | 41 +++ demo/demo-consul/test-client/pom.xml | 233 +++++++++++++ .../apache/servicecomb/samples/Config.java | 22 ++ .../servicecomb/samples/ConsulConfigIT.java | 140 ++++++++ .../samples/HeaderParamWithListSchemaIT.java | 98 ++++++ .../servicecomb/samples/HelloWorldIT.java | 68 ++++ .../servicecomb/samples/ProviderIT.java | 78 +++++ .../servicecomb/samples/ReactiveStreamIT.java | 119 +++++++ .../samples/TestClientApplication.java | 49 +++ .../samples/ThirdSvcConfiguration.java | 125 +++++++ .../org/apache/servicecomb/samples/User.java | 41 +++ .../servicecomb/samples/WebsocketIT.java | 57 ++++ .../src/main/resources/application.yml | 40 +++ .../test-client/src/main/resources/log4j2.xml | 41 +++ .../apache/servicecomb/samples/ConsulT.java | 53 +++ demo/pom.xml | 1 + dependencies/bom/pom.xml | 10 + dependencies/default/pom.xml | 9 +- dynamic-config/config-consul/pom.xml | 54 ++++ .../config/consul/ConsulConfig.java | 79 +++++ .../config/consul/ConsulConfigClient.java | 305 ++++++++++++++++++ .../config/consul/ConsulConfigProperties.java | 71 ++++ .../consul/ConsulDynamicPropertiesSource.java | 99 ++++++ ...servicecomb.config.DynamicPropertiesSource | 18 ++ dynamic-config/pom.xml | 1 + service-registry/pom.xml | 1 + service-registry/registry-consul/pom.xml | 54 ++++ .../registry/consul/ConsulConfiguration.java | 77 +++++ .../registry/consul/ConsulConst.java | 29 ++ .../registry/consul/ConsulDiscovery.java | 153 +++++++++ .../consul/ConsulDiscoveryInstance.java | 38 +++ .../registry/consul/ConsulInstance.java | 191 +++++++++++ .../registry/consul/ConsulRegistration.java | 174 ++++++++++ .../consul/ConsulRegistrationInstance.java | 38 +++ .../config/ConsulDiscoveryProperties.java | 97 ++++++ .../consul/config/ConsulProperties.java | 74 +++++ ...ot.autoconfigure.AutoConfiguration.imports | 18 ++ 61 files changed, 4078 insertions(+), 1 deletion(-) create mode 100644 demo/demo-consul/README.md create mode 100644 demo/demo-consul/consumer/pom.xml create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ClientWebsocketController.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsulConsumerApplication.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerHeaderParamWithListSchema.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerReactiveStreamController.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java create mode 100644 demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/User.java create mode 100644 demo/demo-consul/consumer/src/main/resources/application.yml create mode 100644 demo/demo-consul/consumer/src/main/resources/log4j2.xml create mode 100644 demo/demo-consul/gateway/pom.xml create mode 100644 demo/demo-consul/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java create mode 100644 demo/demo-consul/gateway/src/main/resources/application.yml create mode 100644 demo/demo-consul/gateway/src/main/resources/log4j2.xml create mode 100644 demo/demo-consul/pom.xml create mode 100644 demo/demo-consul/provider/pom.xml create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ConsulProviderApplication.java create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchema.java create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ReactiveStreamController.java create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/User.java create mode 100644 demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java create mode 100644 demo/demo-consul/provider/src/main/resources/application.yml create mode 100644 demo/demo-consul/provider/src/main/resources/log4j2.xml create mode 100644 demo/demo-consul/test-client/pom.xml create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/Config.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ConsulConfigIT.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchemaIT.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ProviderIT.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ReactiveStreamIT.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ThirdSvcConfiguration.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/User.java create mode 100644 demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java create mode 100644 demo/demo-consul/test-client/src/main/resources/application.yml create mode 100644 demo/demo-consul/test-client/src/main/resources/log4j2.xml create mode 100644 demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java create mode 100644 dynamic-config/config-consul/pom.xml create mode 100644 dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfig.java create mode 100644 dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigClient.java create mode 100644 dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigProperties.java create mode 100644 dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulDynamicPropertiesSource.java create mode 100644 dynamic-config/config-consul/src/main/resources/META-INF/services/org.apache.servicecomb.config.DynamicPropertiesSource create mode 100644 service-registry/registry-consul/pom.xml create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConst.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulDiscoveryProperties.java create mode 100644 service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java create mode 100644 service-registry/registry-consul/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/demo/demo-consul/README.md b/demo/demo-consul/README.md new file mode 100644 index 00000000000..872a1d2e93a --- /dev/null +++ b/demo/demo-consul/README.md @@ -0,0 +1,5 @@ +# Notice + +This integration tests is designed for Consul registry and configuration. And extra test cases include: + +* Test cases related to SpringMVC annotations that demo-springmvc can not cover. diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml new file mode 100644 index 00000000000..3059e452fd7 --- /dev/null +++ b/demo/demo-consul/consumer/pom.xml @@ -0,0 +1,82 @@ + + + + 4.0.0 + + + org.apache.servicecomb.demo + demo-consul + 3.3.0-SNAPSHOT + + + consul-consumer + Java Chassis::Demo::Consul::CONSUMER + jar + + + + org.apache.servicecomb + java-chassis-spring-boot-starter-standalone + + + org.apache.servicecomb + registry-consul + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + + + org.commonjava.maven.plugins + directory-maven-plugin + + + com.github.odavid.maven.plugins + mixin-maven-plugin + + + + org.apache.servicecomb.demo + docker-build-config + ${project.version} + + + + + + + + + diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ClientWebsocketController.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ClientWebsocketController.java new file mode 100644 index 00000000000..f71738a9ed6 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ClientWebsocketController.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; +import org.apache.servicecomb.provider.pojo.RpcReference; +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import io.vertx.core.http.ServerWebSocket; +import io.vertx.core.http.WebSocket; + +@RestSchema(schemaId = "ClientWebsocketController") +@RequestMapping(path = "/ws") +public class ClientWebsocketController { + interface ProviderService { + WebSocket websocket(); + } + + @RpcReference(schemaId = "WebsocketController", microserviceName = "provider") + private ProviderService providerService; + + @PostMapping("/websocket") + @Transport(name = CoreConst.WEBSOCKET) + public void websocket(ServerWebSocket serverWebsocket) { + WebSocket providerWebSocket = providerService.websocket(); + providerWebSocket.closeHandler(v -> serverWebsocket.close()); + providerWebSocket.textMessageHandler(m -> { + serverWebsocket.writeTextMessage(m); + }); + serverWebsocket.textMessageHandler(m -> { + providerWebSocket.writeTextMessage(m); + }); + } +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsulConsumerApplication.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsulConsumerApplication.java new file mode 100644 index 00000000000..da243836198 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsulConsumerApplication.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +public class ConsulConsumerApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulConsumerApplication.class).run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java new file mode 100644 index 00000000000..e66fb2cb3d0 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerController.java @@ -0,0 +1,52 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.provider.pojo.RpcReference; +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +@RestSchema(schemaId = "ConsumerController") +@RequestMapping(path = "/") +public class ConsumerController { + @RpcReference(schemaId = "ProviderController", microserviceName = "provider") + private ProviderService providerService; + + // consumer service which delegate the implementation to provider service. + @GetMapping("/sayHello") + public String sayHello(@RequestParam("name") String name) { + return providerService.sayHello(name); + } + + @GetMapping("/getConfig") + public String getConfig(@RequestParam("key") String key) { + return providerService.getConfig(key); + } + + @PostMapping(path = "/testContentType", consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public User testContentType(@RequestBody User user) { + return providerService.testContentType(user); + } +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerHeaderParamWithListSchema.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerHeaderParamWithListSchema.java new file mode 100644 index 00000000000..f0e894d6745 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerHeaderParamWithListSchema.java @@ -0,0 +1,55 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.List; + +import org.apache.servicecomb.demo.api.IHeaderParamWithListSchemaSpringMvc; +import org.apache.servicecomb.provider.pojo.RpcReference; +import org.apache.servicecomb.provider.rest.common.RestSchema; + +@RestSchema(schemaId = "ConsumerHeaderParamWithListSchema", schemaInterface = IHeaderParamWithListSchemaSpringMvc.class) +public class ConsumerHeaderParamWithListSchema implements IHeaderParamWithListSchemaSpringMvc { + @RpcReference(microserviceName = "provider", schemaId = "HeaderParamWithListSchema") + private IHeaderParamWithListSchemaSpringMvc provider; + + @Override + public String headerListDefault(List headerList) { + return provider.headerListDefault(headerList); + } + + @Override + public String headerListCSV(List headerList) { + return provider.headerListCSV(headerList); + } + + @Override + public String headerListMULTI(List headerList) { + return provider.headerListMULTI(headerList); + } + + @Override + public String headerListSSV(List headerList) { + return provider.headerListSSV(headerList); + } + + @Override + public String headerListPIPES(List headerList) { + return provider.headerListPIPES(headerList); + } +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerReactiveStreamController.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerReactiveStreamController.java new file mode 100644 index 00000000000..aa169801cf7 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ConsumerReactiveStreamController.java @@ -0,0 +1,84 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + + +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; +import org.apache.servicecomb.provider.pojo.RpcReference; +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.reactivestreams.Publisher; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +@RestSchema(schemaId = "ReactiveStreamController") +@RequestMapping(path = "/") +public class ConsumerReactiveStreamController { + interface ProviderReactiveStreamController { + Publisher sseString(); + + Publisher sseModel(); + } + + @RpcReference(microserviceName = "provider", schemaId = "ReactiveStreamController") + ProviderReactiveStreamController controller; + + public static class Model { + private String name; + + private int age; + + public Model() { + + } + + public Model(String name, int age) { + this.name = name; + this.age = age; + } + + public int getAge() { + return age; + } + + public Model setAge(int age) { + this.age = age; + return this; + } + + public String getName() { + return name; + } + + public Model setName(String name) { + this.name = name; + return this; + } + } + + @GetMapping("/sseString") + @Transport(name = CoreConst.RESTFUL) + public Publisher sseString() { + return controller.sseString(); + } + + @GetMapping("/sseModel") + @Transport(name = CoreConst.RESTFUL) + public Publisher sseModel() { + return controller.sseModel(); + } +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java new file mode 100644 index 00000000000..2899546c752 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/ProviderService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +public interface ProviderService { + String sayHello(String name); + + String getConfig(String key); + + User testContentType(User user); +} diff --git a/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/User.java b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/User.java new file mode 100644 index 00000000000..ff421930ef2 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/java/org/apache/servicecomb/samples/User.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + + +public class User { + + private Long id; + + private String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/demo/demo-consul/consumer/src/main/resources/application.yml b/demo/demo-consul/consumer/src/main/resources/application.yml new file mode 100644 index 00000000000..ef0d45c1dcb --- /dev/null +++ b/demo/demo-consul/consumer/src/main/resources/application.yml @@ -0,0 +1,40 @@ +# +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +servicecomb: + service: + application: demo-consul + version: 0.0.1 + name: consumer + properties: + group: green + + registry: + consul: + enabled: true + host: 127.0.0.1 + scheme: http + discovery: + enabled: true + acl-token: '' + watch-seconds: 8 + + rest: + address: 0.0.0.0:9092?websocketEnabled=true + server: + websocket-prefix: /ws diff --git a/demo/demo-consul/consumer/src/main/resources/log4j2.xml b/demo/demo-consul/consumer/src/main/resources/log4j2.xml new file mode 100644 index 00000000000..c51f7ad5036 --- /dev/null +++ b/demo/demo-consul/consumer/src/main/resources/log4j2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml new file mode 100644 index 00000000000..47d13456aa0 --- /dev/null +++ b/demo/demo-consul/gateway/pom.xml @@ -0,0 +1,85 @@ + + + + 4.0.0 + + + org.apache.servicecomb.demo + demo-consul + 3.3.0-SNAPSHOT + + + consul-gateway + Java Chassis::Demo::Consul::GATEWAY + jar + + + + org.apache.servicecomb + java-chassis-spring-boot-starter-standalone + + + org.apache.servicecomb + edge-core + + + org.apache.servicecomb + registry-consul + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + + + org.commonjava.maven.plugins + directory-maven-plugin + + + com.github.odavid.maven.plugins + mixin-maven-plugin + + + + org.apache.servicecomb.demo + docker-build-config + ${project.version} + + + + + + + + + diff --git a/demo/demo-consul/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java b/demo/demo-consul/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java new file mode 100644 index 00000000000..7d58caafd9d --- /dev/null +++ b/demo/demo-consul/gateway/src/main/java/org/apache/servicecomb/samples/GatewayApplication.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +public class GatewayApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(GatewayApplication.class).run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/demo/demo-consul/gateway/src/main/resources/application.yml b/demo/demo-consul/gateway/src/main/resources/application.yml new file mode 100644 index 00000000000..9855a87a1de --- /dev/null +++ b/demo/demo-consul/gateway/src/main/resources/application.yml @@ -0,0 +1,60 @@ +# +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +servicecomb: + service: + application: demo-consul + version: 0.0.1 + name: gateway + + registry: + consul: + enabled: true + host: 127.0.0.1 + scheme: http + discovery: + enabled: true + acl-token: '' + watch-seconds: 8 + + rest: + address: 0.0.0.0:9090?websocketEnabled=true + server: + websocket-prefix: /ws + + http: + dispatcher: + edge: + default: + enabled: false + url: + enabled: true + pattern: /(.*) + mappings: + consumer: + prefixSegmentCount: 0 + path: "/.*" + microserviceName: consumer + versionRule: 0.0.0+ + websocket: + mappings: + consumer: + prefixSegmentCount: 0 + path: "/ws/.*" + microserviceName: consumer + versionRule: 0.0.0+ diff --git a/demo/demo-consul/gateway/src/main/resources/log4j2.xml b/demo/demo-consul/gateway/src/main/resources/log4j2.xml new file mode 100644 index 00000000000..c51f7ad5036 --- /dev/null +++ b/demo/demo-consul/gateway/src/main/resources/log4j2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/demo/demo-consul/pom.xml b/demo/demo-consul/pom.xml new file mode 100644 index 00000000000..8e47631d6a1 --- /dev/null +++ b/demo/demo-consul/pom.xml @@ -0,0 +1,62 @@ + + + + + 4.0.0 + + org.apache.servicecomb.demo + demo-parent + 3.3.0-SNAPSHOT + + + demo-consul + Java Chassis::Demo::Consul + pom + + + + org.apache.servicecomb.demo + demo-schema + + + org.apache.servicecomb + solution-basic + + + org.apache.logging.log4j + log4j-slf4j-impl + + + org.apache.logging.log4j + log4j-core + + + org.apache.logging.log4j + log4j-api + + + + + provider + consumer + gateway + test-client + + diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml new file mode 100644 index 00000000000..dff8eb60e8f --- /dev/null +++ b/demo/demo-consul/provider/pom.xml @@ -0,0 +1,92 @@ + + + + + 4.0.0 + + + org.apache.servicecomb.demo + demo-consul + 3.3.0-SNAPSHOT + + + consul-provider + Java Chassis::Demo::Consul::PROVIDER + jar + + + + org.apache.servicecomb + java-chassis-spring-boot-starter-standalone + + + org.apache.servicecomb + registry-consul + + + org.apache.servicecomb + config-consul + + + + io.reactivex.rxjava3 + rxjava + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + + + docker + + + + io.fabric8 + docker-maven-plugin + + + org.commonjava.maven.plugins + directory-maven-plugin + + + com.github.odavid.maven.plugins + mixin-maven-plugin + + + + org.apache.servicecomb.demo + docker-build-config + ${project.version} + + + + + + + + + diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ConsulProviderApplication.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ConsulProviderApplication.java new file mode 100644 index 00000000000..b84da167943 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ConsulProviderApplication.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +public class ConsulProviderApplication { + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(ConsulProviderApplication.class).run(args); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchema.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchema.java new file mode 100644 index 00000000000..8a773f91c72 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchema.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.List; + +import org.apache.servicecomb.demo.api.IHeaderParamWithListSchemaSpringMvc; +import org.apache.servicecomb.provider.rest.common.RestSchema; + +@RestSchema(schemaId = "HeaderParamWithListSchema", schemaInterface = IHeaderParamWithListSchemaSpringMvc.class) +public class HeaderParamWithListSchema implements IHeaderParamWithListSchemaSpringMvc { + @Override + public String headerListDefault(List headerList) { + return headerList == null ? "null" : headerList.size() + ":" + headerList; + } + + @Override + public String headerListCSV(List headerList) { + return headerList == null ? "null" : headerList.size() + ":" + headerList; + } + + @Override + public String headerListMULTI(List headerList) { + return headerList == null ? "null" : headerList.size() + ":" + headerList; + } + + @Override + public String headerListSSV(List headerList) { + return headerList == null ? "null" : headerList.size() + ":" + headerList; + } + + @Override + public String headerListPIPES(List headerList) { + return headerList == null ? "null" : headerList.size() + ":" + headerList; + } +} diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java new file mode 100644 index 00000000000..677c20ed106 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ProviderController.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.springframework.beans.factory.InitializingBean; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +@RestSchema(schemaId = "ProviderController") +@RequestMapping(path = "/") +public class ProviderController implements InitializingBean { + private Environment environment; + + @Autowired + public void setEnvironment(Environment environment) { + this.environment = environment; + } + + // a very simple service to echo the request parameter + @GetMapping("/sayHello") + public String sayHello(@RequestParam("name") String name) { +// return "Hello " + environment.getProperty("servicecomb.rest.address"); + return "Hello " + name; + } + + @GetMapping("/getConfig") + public String getConfig(@RequestParam("key") String key) { + return environment.getProperty(key); + } + + @PostMapping(path = "/testContentType", consumes = MediaType.APPLICATION_JSON_VALUE) + @ResponseBody + public User testContentType(@RequestBody User user) { + return user; + } + + @Override + public void afterPropertiesSet() throws Exception { + } +} diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ReactiveStreamController.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ReactiveStreamController.java new file mode 100644 index 00000000000..8108d15fd46 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/ReactiveStreamController.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + + +import java.util.concurrent.TimeUnit; + +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.reactivestreams.Publisher; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import io.reactivex.rxjava3.core.Flowable; + +@RestSchema(schemaId = "ReactiveStreamController") +@RequestMapping(path = "/") +@Transport(name = CoreConst.RESTFUL) +public class ReactiveStreamController { + public static class Model { + private String name; + + private int age; + + public Model() { + + } + + public Model(String name, int age) { + this.name = name; + this.age = age; + } + + public int getAge() { + return age; + } + + public Model setAge(int age) { + this.age = age; + return this; + } + + public String getName() { + return name; + } + + public Model setName(String name) { + this.name = name; + return this; + } + } + + @GetMapping("/sseString") + public Publisher sseString() { + return Flowable.fromArray("a", "b", "c"); + } + + @GetMapping("/sseModel") + public Publisher sseModel() { + return Flowable.intervalRange(0, 5, 0, 1, TimeUnit.SECONDS) + .map(item -> new Model("jack", item.intValue())); + } +} diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/User.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/User.java new file mode 100644 index 00000000000..ca12402d672 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/User.java @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + +public class User { + + private Long id; + + private String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java new file mode 100644 index 00000000000..5f4f9719ca8 --- /dev/null +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; +import org.apache.servicecomb.provider.rest.common.RestSchema; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import io.vertx.core.http.ServerWebSocket; + +@RestSchema(schemaId = "WebsocketController") +@RequestMapping(path = "/ws") +public class WebsocketController { + @PostMapping("/websocket") + @Transport(name = CoreConst.WEBSOCKET) + public void websocket(ServerWebSocket serverWebsocket) { + // Client may have not registered message handler, and messages sent may get lost. + // So we sleep for a while to send message. + AtomicInteger receiveCount = new AtomicInteger(0); + serverWebsocket.textMessageHandler(s -> { + receiveCount.getAndIncrement(); + }); + serverWebsocket.closeHandler((v) -> System.out.println("closed")); + + new Thread(() -> { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + serverWebsocket.writeTextMessage("hello", r -> { + }); + + for (int i = 0; i < 5; i++) { + serverWebsocket.writeTextMessage("hello " + i, r -> { + }); + try { + Thread.sleep(500); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + serverWebsocket.writeTextMessage("total " + receiveCount.get()); + serverWebsocket.close(); + }).start(); + } +} diff --git a/demo/demo-consul/provider/src/main/resources/application.yml b/demo/demo-consul/provider/src/main/resources/application.yml new file mode 100644 index 00000000000..31bbfa5d4c7 --- /dev/null +++ b/demo/demo-consul/provider/src/main/resources/application.yml @@ -0,0 +1,67 @@ +# +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +# spring boot configurations +servicecomb: + service: + application: demo-consul + version: 0.0.1 + name: provider + properties: + group: green + + registry: + consul: + enabled: true + host: 127.0.0.1 + scheme: http + discovery: + enabled: true + acl-token: '' + watch-seconds: 8 + + config: + consul: + enabled: true + host: 127.0.0.1 + scheme: http + acl-token: '' + watch-seconds: 8 + + rest: + address: 0.0.0.0:9094?websocketEnabled=true + server: + websocket-prefix: /ws + + cors: + enabled: true + origin: "*" + allowCredentials: false + allowedMethod: "*" + maxAge: 3600 + + +key1: 1 +key2: 3 +key3: 5 + +test1: env +test2: applition +test3: service +test4: version +test5: tag diff --git a/demo/demo-consul/provider/src/main/resources/log4j2.xml b/demo/demo-consul/provider/src/main/resources/log4j2.xml new file mode 100644 index 00000000000..c51f7ad5036 --- /dev/null +++ b/demo/demo-consul/provider/src/main/resources/log4j2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/demo/demo-consul/test-client/pom.xml b/demo/demo-consul/test-client/pom.xml new file mode 100644 index 00000000000..1e053bc6ee7 --- /dev/null +++ b/demo/demo-consul/test-client/pom.xml @@ -0,0 +1,233 @@ + + + + + 4.0.0 + + + org.apache.servicecomb.demo + demo-consul + 3.3.0-SNAPSHOT + + + consul-test-client + Java Chassis::Demo::Consul::TEST-CLIENT + jar + + + + + + + org.apache.servicecomb + java-chassis-spring-boot-starter-standalone + + + org.apache.servicecomb.demo + demo-schema + + + org.apache.servicecomb + registry-local + + + org.kiwiproject + consul-client + + + com.google.code.gson + gson + + + + + + docker + + + + + io.fabric8 + docker-maven-plugin + + + + hashicorp/consul + consul + + alias + + consulServer + + + 8500 + + + + + + 8500:8500 + + + yes + + + + + consul-provider:${project.version} + consul-provider + + alias + + + -Dservicecomb.registry.consul.enabled=true + -Dservicecomb.registry.consul.scheme=http + -Dservicecomb.registry.consul.host=consul + -Dservicecomb.registry.consul.port=8500 + -Dservicecomb.config.consul.enabled=true + -Dservicecomb.config.consul.scheme=http + -Dservicecomb.config.consul.host=consul + -Dservicecomb.config.consul.port=8500 + + /maven/maven/consul-provider-${project.version}.jar + + + consul:consul + + + ServiceComb is ready + + + 9094 + + + + + + 9094:9094 + + + + + consul-consumer:${project.version} + consul-consumer + + alias + + + -Dservicecomb.registry.consul.enabled=true + -Dservicecomb.registry.consul.scheme=http + -Dservicecomb.registry.consul.host=consul + -Dservicecomb.registry.consul.port=8500 + + /maven/maven/consul-consumer-${project.version}.jar + + + consul:consul + + + ServiceComb is ready + + + 9092 + + + + + + 9092:9092 + + + + + consul-gateway:${project.version} + consul-gateway + + alias + + + -Dservicecomb.registry.consul.enabled=true + -Dservicecomb.registry.consul.scheme=http + -Dservicecomb.registry.consul.host=consul + -Dservicecomb.registry.consul.port=8500 + + /maven/maven/consul-gateway-${project.version}.jar + + + consul:consul + + + ServiceComb is ready + + + 9090 + + + + + + 9090:9090 + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + + + + + io.fabric8 + docker-maven-plugin + + + com.github.odavid.maven.plugins + mixin-maven-plugin + + + + org.apache.servicecomb.demo + docker-run-config + ${project.version} + + + + + + + + + diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/Config.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/Config.java new file mode 100644 index 00000000000..2e9105cdd4a --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/Config.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +public interface Config { + String GATEWAY_URL = "http://localhost:9090"; +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ConsulConfigIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ConsulConfigIT.java new file mode 100644 index 00000000000..1a7be4b874d --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ConsulConfigIT.java @@ -0,0 +1,140 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import com.google.common.net.HostAndPort; +import org.apache.commons.lang3.StringUtils; +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.apache.servicecomb.foundation.common.utils.ConditionWaiter.SleepUtil; +import org.kiwiproject.consul.Consul; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestOperations; +import org.springframework.web.client.RestTemplate; + +import java.util.concurrent.TimeUnit; + +@Component +public class ConsulConfigIT implements CategorizedTestCase { + RestOperations template = new RestTemplate(); + + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulConfigIT.class); + + @Override + public void testRestTransport() throws Exception { + + testEnvironment(); + testApplication(); + testService(); + testVersion(); + testTag(); + testOverride(); + } + + private void testOverride() { + + putValue("/servicecomb/config/environment/production/application2.properties", + "testValue=t1"); + putValue("/servicecomb/config/application/production/demo-consul/application2.properties", + "testValue=t2"); + testGetConfig("testValue", "t2"); + putValue("/servicecomb/config/service/production/demo-consul/provider/application2.properties", + "testValue=t3"); + testGetConfig("testValue", "t3"); + putValue("/servicecomb/config/version/production/demo-consul/provider/0.0.1/application2.properties", + "testValue=t4"); + testGetConfig("testValue", "t4"); + putValue("/servicecomb/config/tag/production/demo-consul/provider/0.0.1/tag1/application2.properties", + "testValue=t5"); + testGetConfig("testValue", "t5"); + } + + private void testEnvironment() { + + putValue("/servicecomb/config/environment/production/application.properties", + "test1=env"); + putValue("/servicecomb/config/environment/production/application.properties", + "test1=env1"); + + testGetConfig("test1", "env1"); + } + + + private void testApplication() { + + putValue("/servicecomb/config/application/production/demo-consul/application.properties", + "test2=applition"); + putValue("/servicecomb/config/application/production/demo-consul/application.properties", + "test2=applition2"); + testGetConfig("test2", "applition2"); + } + + private void testService() { + + putValue("/servicecomb/config/service/production/demo-consul/provider/application.properties", + "test3=service"); + putValue("/servicecomb/config/service/production/demo-consul/provider/application.properties", + "test3=service3"); + testGetConfig("test3", "service3"); + } + + private void testVersion() { + + putValue("/servicecomb/config/version/production/demo-consul/provider/0.0.1/application.properties", + "test3=version"); + putValue("/servicecomb/config/version/production/demo-consul/provider/0.0.1/application.properties", + "test4=version4"); + testGetConfig("test4", "version4"); + } + + private void testTag() { + + putValue("/servicecomb/config/tag/production/demo-consul/provider/0.0.1/tag1/application.properties", + "test5=tag"); + putValue("/servicecomb/config/tag/production/demo-consul/provider/0.0.1/tag1/application.properties", + "test5=tag5"); + testGetConfig("test5", "tag5"); + } + + public void putValue(String key, String value) { + try { + Consul.Builder builder = Consul.builder().withHostAndPort(HostAndPort.fromParts("127.0.0.1", 8500)); + Consul consulClient = builder.build(); + consulClient.keyValueClient().putValue(key, value); + LOGGER.info("Value set successfully:{}", value); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void testGetConfig(String key, String expectValue) { + + String result = template + .getForObject(Config.GATEWAY_URL + "/getConfig?key=" + key, String.class); + + for (int i = 0; i < 4; i++) { + if (StringUtils.equals(expectValue, result)) { + TestMgr.check(expectValue, result); + break; + } + SleepUtil.sleep(500, TimeUnit.MILLISECONDS); + } + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchemaIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchemaIT.java new file mode 100644 index 00000000000..1b129acc2c6 --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HeaderParamWithListSchemaIT.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestOperations; +import org.springframework.web.client.RestTemplate; + +@Component +public class HeaderParamWithListSchemaIT implements CategorizedTestCase { + RestOperations template = new RestTemplate(); + + @Override + public void testRestTransport() throws Exception { + testHeaderListDefault(); + testHeaderListMulti(); + testHeaderListCSV(); + testHeaderListSSV(); + testHeaderListPipes(); + } + + // default to multi + private void testHeaderListDefault() { + MultiValueMap headers = new HttpHeaders(); + headers.add("headerList", "a"); + headers.add("headerList", "b"); + headers.add("headerList", "c"); + HttpEntity entity = new HttpEntity<>(headers); + String result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListDefault", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + } + + private void testHeaderListPipes() { + MultiValueMap headers = new HttpHeaders(); + headers.add("headerList", "a|b|c"); + HttpEntity entity = new HttpEntity<>(headers); + String result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListPIPES", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + } + + private void testHeaderListSSV() { + MultiValueMap headers = new HttpHeaders(); + headers.add("headerList", "a b c"); + HttpEntity entity = new HttpEntity<>(headers); + String result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListSSV", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + } + + private void testHeaderListCSV() { + MultiValueMap headers = new HttpHeaders(); + headers.add("headerList", "a,b,c"); + HttpEntity entity = new HttpEntity<>(headers); + String result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListCSV", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + + headers.add("headerList", "a, b, c"); + entity = new HttpEntity<>(headers); + result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListCSV", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + } + + private void testHeaderListMulti() { + MultiValueMap headers = new HttpHeaders(); + headers.add("headerList", "a"); + headers.add("headerList", "b"); + headers.add("headerList", "c"); + HttpEntity entity = new HttpEntity<>(headers); + String result = template + .exchange(Config.GATEWAY_URL + "/headerList/headerListMULTI", HttpMethod.GET, entity, String.class).getBody(); + TestMgr.check("3:[a, b, c]", result); + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java new file mode 100644 index 00000000000..97e883fb45f --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/HelloWorldIT.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestOperations; +import org.springframework.web.client.RestTemplate; + +@Component +public class HelloWorldIT implements CategorizedTestCase { + RestOperations template = new RestTemplate(); + + @Override + public void testRestTransport() throws Exception { + testHelloWorld(); + testGetConfig(); + } + + private void testGetConfig() { + String result = template + .getForObject(Config.GATEWAY_URL + "/getConfig?key=key1", String.class); + TestMgr.check("1", result); + result = template + .getForObject(Config.GATEWAY_URL + "/getConfig?key=key2", String.class); + TestMgr.check("3", result); + result = template + .getForObject(Config.GATEWAY_URL + "/getConfig?key=key3", String.class); + TestMgr.check("5", result); + } + + private void testHelloWorld() { + String result = template + .getForObject(Config.GATEWAY_URL + "/sayHello?name=World", String.class); + TestMgr.check("Hello World", result); + + // test trace id added + MultiValueMap headers = new HttpHeaders(); + headers.add("X-B3-TraceId", "81de2eb7691c2bbb"); + HttpEntity entity = new HttpEntity(headers); + ResponseEntity response = + template.exchange(Config.GATEWAY_URL + "/sayHello?name=World", HttpMethod.GET, entity, String.class); + TestMgr.check(1, response.getHeaders().get("X-B3-TraceId").size()); + TestMgr.check("81de2eb7691c2bbb", response.getHeaders().getFirst("X-B3-TraceId")); + TestMgr.check("Hello World", response.getBody()); + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ProviderIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ProviderIT.java new file mode 100644 index 00000000000..2bdd0ca42ca --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ProviderIT.java @@ -0,0 +1,78 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + +import java.io.IOException; +import java.nio.charset.StandardCharsets; + +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.apache.servicecomb.foundation.common.utils.JsonUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestOperations; +import org.springframework.web.client.RestTemplate; + +@Component +public class ProviderIT implements CategorizedTestCase { + + RestOperations template = new RestTemplate(); + + private static final Logger LOGGER = LoggerFactory.getLogger(ProviderIT.class); + + @Override + public void testRestTransport() throws Exception { + + User user = getUser("Application/json"); + TestMgr.check(1L, user.getId()); + TestMgr.check("czd", user.getName()); + + User user2 = getUser("application/json"); + TestMgr.check(1L, user2.getId()); + TestMgr.check("czd", user2.getName()); + + User user3 = getUser("APPLICATION/JSON"); + TestMgr.check(1L, user3.getId()); + TestMgr.check("czd", user3.getName()); + } + + private User getUser(String contentType) throws IOException { + HttpHeaders headers = new HttpHeaders(); + headers.set("Content-Type", contentType); + + String requestBody = """ + { + "id": 1, + "name": "czd" + } + """; + + HttpEntity entity = new HttpEntity<>(requestBody, headers); + + String url = Config.GATEWAY_URL + "/testContentType"; + ResponseEntity response = template.exchange( + url, HttpMethod.POST, entity, String.class); + + User user = JsonUtils.readValue(response.getBody().getBytes(StandardCharsets.UTF_8), User.class); + return user; + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ReactiveStreamIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ReactiveStreamIT.java new file mode 100644 index 00000000000..488a6cf712a --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ReactiveStreamIT.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.apache.servicecomb.samples.ThirdSvcConfiguration.ReactiveStreamClient; +import org.apache.servicecomb.samples.ThirdSvcConfiguration.ReactiveStreamClient.Model; +import org.reactivestreams.Publisher; +import org.reactivestreams.Subscriber; +import org.reactivestreams.Subscription; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +@Component +public class ReactiveStreamIT implements CategorizedTestCase { + @Autowired + @Qualifier("reactiveStreamProvider") + ReactiveStreamClient reactiveStreamProvider; + + @Autowired + @Qualifier("reactiveStreamGateway") + ReactiveStreamClient reactiveStreamGateway; + + @Override + public void testRestTransport() throws Exception { + testSseString(reactiveStreamProvider); + testSseModel(reactiveStreamProvider); + testSseString(reactiveStreamGateway); + testSseModel(reactiveStreamGateway); + } + + private void testSseModel(ReactiveStreamClient client) throws Exception { + Publisher result = client.sseModel(); + StringBuilder buffer = new StringBuilder(); + CountDownLatch countDownLatch = new CountDownLatch(1); + result.subscribe(new Subscriber<>() { + Subscription subscription; + + @Override + public void onSubscribe(Subscription s) { + subscription = s; + subscription.request(1); + } + + @Override + public void onNext(Model s) { + buffer.append(s.getName()).append(s.getAge()); + subscription.request(1); + } + + @Override + public void onError(Throwable t) { + subscription.cancel(); + countDownLatch.countDown(); + } + + @Override + public void onComplete() { + countDownLatch.countDown(); + } + }); + countDownLatch.await(10, TimeUnit.SECONDS); + TestMgr.check("jack0jack1jack2jack3jack4", buffer.toString()); + } + + private void testSseString(ReactiveStreamClient client) throws Exception { + Publisher result = client.sseString(); + StringBuilder buffer = new StringBuilder(); + CountDownLatch countDownLatch = new CountDownLatch(1); + result.subscribe(new Subscriber<>() { + Subscription subscription; + + @Override + public void onSubscribe(Subscription s) { + subscription = s; + subscription.request(1); + } + + @Override + public void onNext(String s) { + buffer.append(s); + subscription.request(1); + } + + @Override + public void onError(Throwable t) { + subscription.cancel(); + countDownLatch.countDown(); + } + + @Override + public void onComplete() { + countDownLatch.countDown(); + } + }); + countDownLatch.await(10, TimeUnit.SECONDS); + TestMgr.check("abc", buffer.toString()); + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java new file mode 100644 index 00000000000..26a2a491bbe --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/TestClientApplication.java @@ -0,0 +1,49 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.demo.CategorizedTestCaseRunner; +import org.apache.servicecomb.demo.TestMgr; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.WebApplicationType; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; + +@SpringBootApplication +public class TestClientApplication { + private static final Logger LOGGER = LoggerFactory.getLogger(TestClientApplication.class); + + public static void main(String[] args) throws Exception { + try { + new SpringApplicationBuilder().web(WebApplicationType.NONE).sources(TestClientApplication.class).run(args); + + run(); + } catch (Exception e) { + TestMgr.failed("test case run failed", e); + LOGGER.error("-------------- test failed -------------"); + LOGGER.error("", e); + LOGGER.error("-------------- test failed -------------"); + } + TestMgr.summary(); + } + + public static void run() throws Exception { + CategorizedTestCaseRunner.runCategorizedTestCase("consumer"); + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ThirdSvcConfiguration.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ThirdSvcConfiguration.java new file mode 100644 index 00000000000..abe96a4f10b --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/ThirdSvcConfiguration.java @@ -0,0 +1,125 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.List; + +import org.apache.servicecomb.core.CoreConst; +import org.apache.servicecomb.core.annotation.Transport; +import org.apache.servicecomb.localregistry.RegistryBean; +import org.apache.servicecomb.localregistry.RegistryBean.Instance; +import org.apache.servicecomb.localregistry.RegistryBean.Instances; +import org.apache.servicecomb.provider.pojo.Invoker; +import org.reactivestreams.Publisher; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; + +import io.vertx.core.http.WebSocket; + +@Configuration +public class ThirdSvcConfiguration { + @RequestMapping(path = "/ws") + public interface WebsocketClient { + @PostMapping("/websocket") + @Transport(name = CoreConst.WEBSOCKET) + WebSocket websocket(); + } + + @RequestMapping(path = "/") + public interface ReactiveStreamClient { + class Model { + private String name; + + private int age; + + public Model() { + + } + + public Model(String name, int age) { + this.name = name; + this.age = age; + } + + public int getAge() { + return age; + } + + public Model setAge(int age) { + this.age = age; + return this; + } + + public String getName() { + return name; + } + + public Model setName(String name) { + this.name = name; + return this; + } + } + + @GetMapping("/sseString") + Publisher sseString(); + + @GetMapping("/sseModel") + Publisher sseModel(); + } + + @Bean + public RegistryBean providerServiceBean() { + return new RegistryBean() + .addSchemaInterface("ReactiveStreamController", ReactiveStreamClient.class) + .setAppId("demo-consul") + .setServiceName("provider") + .setVersion("0.0.1") + .setInstances(new Instances().setInstances(List.of( + new Instance().setEndpoints(List.of("rest://localhost:9094"))))); + } + + @Bean + public RegistryBean gatewayServiceBean() { + return new RegistryBean() + .addSchemaInterface("ReactiveStreamController", ReactiveStreamClient.class) + .addSchemaInterface("WebsocketController", WebsocketClient.class) + .setAppId("demo-consul") + .setServiceName("gateway") + .setVersion("0.0.1") + .setInstances(new Instances().setInstances(List.of( + new Instance().setEndpoints(List.of("rest://localhost:9090?websocketEnabled=true"))))); + } + + @Bean("reactiveStreamProvider") + public ReactiveStreamClient reactiveStreamProvider() { + return Invoker.createProxy("provider", "ReactiveStreamController", ReactiveStreamClient.class); + } + + @Bean("reactiveStreamGateway") + public ReactiveStreamClient reactiveStreamGateway() { + return Invoker.createProxy("gateway", "ReactiveStreamController", ReactiveStreamClient.class); + } + + @Bean + public WebsocketClient gatewayWebsocketClient() { + return Invoker.createProxy("gateway", "WebsocketController", WebsocketClient.class); + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/User.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/User.java new file mode 100644 index 00000000000..ff421930ef2 --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/User.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.samples; + + +public class User { + + private Long id; + + private String name; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java new file mode 100644 index 00000000000..ea7a7f45b15 --- /dev/null +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +import org.apache.servicecomb.demo.CategorizedTestCase; +import org.apache.servicecomb.demo.TestMgr; +import org.apache.servicecomb.samples.ThirdSvcConfiguration.WebsocketClient; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import io.vertx.core.http.WebSocket; + +@Component +public class WebsocketIT implements CategorizedTestCase { + @Autowired + private WebsocketClient websocketClient; + + @Override + public void testRestTransport() throws Exception { + StringBuffer sb = new StringBuffer(); + AtomicBoolean closed = new AtomicBoolean(false); + CountDownLatch latch = new CountDownLatch(1); + + WebSocket webSocket = websocketClient.websocket(); + webSocket.textMessageHandler(s -> { + sb.append(s); + sb.append(" "); + webSocket.writeTextMessage(s); + }); + webSocket.closeHandler(v -> { + closed.set(true); + latch.countDown(); + }); + latch.await(30, TimeUnit.SECONDS); + TestMgr.check(sb.toString(), "hello hello 0 hello 1 hello 2 hello 3 hello 4 total 6 "); + TestMgr.check(closed.get(), true); + } +} diff --git a/demo/demo-consul/test-client/src/main/resources/application.yml b/demo/demo-consul/test-client/src/main/resources/application.yml new file mode 100644 index 00000000000..718fbd9cc84 --- /dev/null +++ b/demo/demo-consul/test-client/src/main/resources/application.yml @@ -0,0 +1,40 @@ +# +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +servicecomb: + service: + application: demo-consul + name: test-client + version: 0.0.1 + + rest: + address: 0.0.0.0:9097 # should be same with server.port to use web container + + config: + consul: + enabled: true + host: 127.0.0.1 + scheme: http + acl-token: '' + instance-tag: tag1 + +test1: env +test2: applition +test3: service +test4: version +test5: tag diff --git a/demo/demo-consul/test-client/src/main/resources/log4j2.xml b/demo/demo-consul/test-client/src/main/resources/log4j2.xml new file mode 100644 index 00000000000..c51f7ad5036 --- /dev/null +++ b/demo/demo-consul/test-client/src/main/resources/log4j2.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + diff --git a/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java b/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java new file mode 100644 index 00000000000..dc687e00def --- /dev/null +++ b/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java @@ -0,0 +1,53 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.samples; + +import org.apache.servicecomb.demo.TestMgr; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit.jupiter.SpringExtension; + +@ExtendWith(SpringExtension.class) +@SpringBootTest(classes = TestClientApplication.class) +public class ConsulT { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulT.class); + + @BeforeEach + public void setUp() { + TestMgr.errors().clear(); + } + + @Test + public void clientGetsNoError() { + try { + TestClientApplication.run(); + } catch (Exception e) { + TestMgr.failed("test case run failed", e); + LOGGER.error("-------------- test failed -------------"); + LOGGER.error("", e); + LOGGER.error("-------------- test failed -------------"); + } + TestMgr.summary(); + Assertions.assertTrue(TestMgr.errors().isEmpty()); + } +} diff --git a/demo/pom.xml b/demo/pom.xml index fa88e1526bb..1cf9c70492e 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -58,6 +58,7 @@ demo-nacos demo-etcd demo-zookeeper + demo-consul diff --git a/dependencies/bom/pom.xml b/dependencies/bom/pom.xml index 16b2dea9845..e7e1e398da1 100644 --- a/dependencies/bom/pom.xml +++ b/dependencies/bom/pom.xml @@ -116,6 +116,11 @@ config-zookeeper ${project.version} + + org.apache.servicecomb + config-consul + ${project.version} + @@ -287,6 +292,11 @@ org.apache.servicecomb config-etcd ${project.version} + + + org.apache.servicecomb + registry-consul + ${project.version} diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 903e25ad7d4..6f3d7a13b63 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -17,7 +17,7 @@ --> + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.servicecomb @@ -92,6 +92,7 @@ 3.4.2 3.4.0 0.8.4 + 1.4.2 ${basedir}/../.. @@ -549,6 +550,12 @@ jetcd-core ${jetcd-core.version} + + + org.kiwiproject + consul-client + ${consul-client.version} + diff --git a/dynamic-config/config-consul/pom.xml b/dynamic-config/config-consul/pom.xml new file mode 100644 index 00000000000..b7a1cfa192b --- /dev/null +++ b/dynamic-config/config-consul/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + org.apache.servicecomb + dynamic-config + 3.3.0-SNAPSHOT + + + config-consul + Java Chassis::Dynamic Config::Consul + + + + org.apache.servicecomb + foundation-common + + + org.apache.servicecomb + foundation-registry + + + org.apache.servicecomb + java-chassis-core + + + org.kiwiproject + consul-client + + + com.google.code.gson + gson + + + diff --git a/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfig.java b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfig.java new file mode 100644 index 00000000000..57613037eb4 --- /dev/null +++ b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfig.java @@ -0,0 +1,79 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.config.consul; + +import org.springframework.core.env.Environment; + +public class ConsulConfig { + + public static final String CONSUL_CONFIG_PREFIX = "servicecomb.config.consul"; + + public static final String CONSUL_DEFAULT_ENVIRONMENT = "production"; + + public static final String PROPERTY_CONSUL_HOST = "servicecomb.config.consul.host"; + + public static final String PROPERTY_CONSUL_PORT = "servicecomb.config.consul.port"; + + public static final String PROPERTY_CONSUL_SCHEME = "servicecomb.config.consul.scheme"; + + public static final String PROPERTY_CONSUL_ACL_TOKEN = "servicecomb.config.consul.acl-token"; + + public static final String PROPERTY_CONSUL_WATCH_SECONDS = "servicecomb.config.consul.watch-seconds"; + + public static final String PROPERTY_INSTANCE_TAG = "servicecomb.config.consul.instance-tag"; + + public static final String PATH_ENVIRONMENT = "/servicecomb/config/environment/%s"; + + public static final String PATH_APPLICATION = "/servicecomb/config/application/%s/%s"; + + public static final String PATH_SERVICE = "/servicecomb/config/service/%s/%s/%s"; + + public static final String PATH_VERSION = "/servicecomb/config/version/%s/%s/%s/%s"; + + public static final String PATH_TAG = "/servicecomb/config/tag/%s/%s/%s/%s/%s"; + + private final Environment environment; + + public ConsulConfig(Environment environment) { + this.environment = environment; + } + + public String getConsulHost() { + return environment.getProperty(PROPERTY_CONSUL_HOST, String.class, "127.0.0.1"); + } + + public int getConsulPort() { + return environment.getProperty(PROPERTY_CONSUL_PORT, int.class, 8500); + } + + public String getConsulScheme() { + return environment.getProperty(PROPERTY_CONSUL_SCHEME); + } + + public String getConsulAclToken() { + return environment.getProperty(PROPERTY_CONSUL_ACL_TOKEN); + } + + public int getConsulWatchSeconds() { + return environment.getProperty(PROPERTY_CONSUL_WATCH_SECONDS, int.class, 8); + } + + public String getInstanceTag() { + return environment.getProperty(PROPERTY_INSTANCE_TAG); + } +} diff --git a/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigClient.java b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigClient.java new file mode 100644 index 00000000000..ae18e11ff48 --- /dev/null +++ b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigClient.java @@ -0,0 +1,305 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.config.consul; + +import org.apache.commons.lang3.StringUtils; +import org.apache.servicecomb.config.BootStrapProperties; +import org.jetbrains.annotations.NotNull; +import org.kiwiproject.consul.Consul; +import org.kiwiproject.consul.KeyValueClient; +import org.kiwiproject.consul.cache.KVCache; +import org.kiwiproject.consul.model.kv.Value; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; +import org.springframework.core.env.Environment; +import org.springframework.core.io.ByteArrayResource; + +import java.io.IOException; +import java.io.StringReader; +import java.nio.charset.StandardCharsets; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; +import java.util.Optional; +import java.util.Properties; + +import static org.apache.servicecomb.config.consul.ConsulConfig.PATH_APPLICATION; +import static org.apache.servicecomb.config.consul.ConsulConfig.PATH_ENVIRONMENT; +import static org.apache.servicecomb.config.consul.ConsulConfig.PATH_SERVICE; +import static org.apache.servicecomb.config.consul.ConsulConfig.PATH_TAG; +import static org.apache.servicecomb.config.consul.ConsulConfig.PATH_VERSION; + +public class ConsulConfigClient { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulConfigClient.class); + + public class GetDataRunnable implements Runnable { + + private Map dataMap; + + private String path; + + public GetDataRunnable(String path, Map dataMap) { + this.dataMap = dataMap; + this.path = path; + } + + @Override + public void run() { + try { + if (path.equals("tagData")) { + tagData = dataMap; + } else if (path.equals("versionData")) { + versionData = dataMap; + } else if (path.equals("serviceData")) { + serviceData = dataMap; + } else if (path.equals("applicationData")) { + applicationData = dataMap; + } else { + environmentData = dataMap; + } + refreshConfigItems(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + } + + private ConsulDynamicPropertiesSource.UpdateHandler updateHandler; + + private ConsulConfig consulConfig; + + private Environment environment; + + private final Object lock = new Object(); + + private Consul consulClient; + + private KeyValueClient kvClient; + + private ConsulConfigProperties consulConfigProperties; + + private Map environmentData = new HashMap<>(); + + private Map applicationData = new HashMap<>(); + + private Map serviceData = new HashMap<>(); + + private Map versionData = new HashMap<>(); + + private Map tagData = new HashMap<>(); + + private Map allLast = new HashMap<>(); + + public ConsulConfigClient(ConsulDynamicPropertiesSource.UpdateHandler updateHandler, Environment environment, ConsulConfigProperties consulConfigProperties, Consul consulClient) { + this.updateHandler = updateHandler; + this.consulConfig = new ConsulConfig(environment); + this.environment = environment; + this.consulConfigProperties = consulConfigProperties; + this.consulClient = consulClient; + this.kvClient = consulClient.keyValueClient(); + } + + public void refreshConsulConfig() { + String env = BootStrapProperties.readServiceEnvironment(environment); + if (StringUtils.isEmpty(env)) { + env = ConsulConfig.CONSUL_DEFAULT_ENVIRONMENT; + } + addEnvironmentConfig(env); + addApplicationConfig(env); + addServiceConfig(env); + addVersionConfig(env); + addTagConfig(env); + + refreshConfigItems(); + } + + private void addTagConfig(String env) { + if (StringUtils.isBlank(consulConfig.getInstanceTag())) { + return; + } + String path = String.format(PATH_TAG, env, + BootStrapProperties.readApplication(environment), + BootStrapProperties.readServiceName(environment), + BootStrapProperties.readServiceVersion(environment), + consulConfig.getInstanceTag()); + + this.tagData = parseData(path); + try (KVCache cache = KVCache.newCache(kvClient, path, consulConfig.getConsulWatchSeconds())) { + cache.addListener(newValues -> { + Optional newValue = newValues.values().stream() + .filter(value -> value.getKey().equals(path)) + .findAny(); + + newValue.ifPresent(value -> { + Optional decodedValue = newValue.get().getValueAsString(); + decodedValue.ifPresent(v -> new Thread(new GetDataRunnable("tagData", getValues(path))).start()); + }); + }); + cache.start(); + } + } + + private void addVersionConfig(String env) { + String path = String.format(PATH_VERSION, env, + BootStrapProperties.readApplication(environment), + BootStrapProperties.readServiceName(environment), + BootStrapProperties.readServiceVersion(environment)); + + this.versionData = parseData(path); + try (KVCache cache = KVCache.newCache(kvClient, path, consulConfig.getConsulWatchSeconds())) { + cache.addListener(newValues -> { + Optional newValue = newValues.values().stream() + .filter(value -> value.getKey().equals(path)) + .findAny(); + + newValue.ifPresent(value -> { + Optional decodedValue = newValue.get().getValueAsString(); + decodedValue.ifPresent(v -> new Thread(new GetDataRunnable("versionData", getValues(path))).start()); + }); + }); + cache.start(); + } + } + + private void addServiceConfig(String env) { + String path = String.format(PATH_SERVICE, env, + BootStrapProperties.readApplication(environment), + BootStrapProperties.readServiceName(environment)); + + this.serviceData = parseData(path); + try (KVCache cache = KVCache.newCache(kvClient, path, consulConfig.getConsulWatchSeconds())) { + cache.addListener(newValues -> { + Optional newValue = newValues.values().stream() + .filter(value -> value.getKey().equals(path)) + .findAny(); + + newValue.ifPresent(value -> { + Optional decodedValue = newValue.get().getValueAsString(); + decodedValue.ifPresent(v -> new Thread(new GetDataRunnable("serviceData", getValues(path))).start()); + }); + }); + cache.start(); + } + } + + private void addApplicationConfig(String env) { + String path = String.format(PATH_APPLICATION, env, BootStrapProperties.readApplication(environment)); + this.applicationData = parseData(path); + try (KVCache cache = KVCache.newCache(kvClient, path, consulConfig.getConsulWatchSeconds())) { + cache.addListener(newValues -> { + Optional newValue = newValues.values().stream() + .filter(value -> value.getKey().equals(path)) + .findAny(); + + newValue.ifPresent(value -> { + Optional decodedValue = newValue.get().getValueAsString(); + decodedValue.ifPresent(v -> new Thread(new GetDataRunnable("applicationData", getValues(path))).start()); + }); + }); + cache.start(); + } + } + + private void addEnvironmentConfig(String env) { + String path = String.format(PATH_ENVIRONMENT, env); + + this.environmentData = parseData(path); + try (KVCache cache = KVCache.newCache(kvClient, path, consulConfig.getConsulWatchSeconds())) { + cache.addListener(newValues -> { + Optional newValue = newValues.values().stream() + .filter(value -> value.getKey().equals(path)) + .findAny(); + + newValue.ifPresent(value -> { + Optional decodedValue = newValue.get().getValueAsString(); + decodedValue.ifPresent(v -> new Thread(new GetDataRunnable("environmentData", getValues(path))).start()); + }); + }); + cache.start(); + } + } + + public Map parseData(String path) { + try { + return getValues(path); + } catch (Exception e) { + LOGGER.error(e.getMessage(), e); + } + return new HashMap<>(); + } + + private Map getValues(String path) { + Map values = new HashMap<>(); + KeyValueClient keyValueClient = consulClient.keyValueClient(); + String decodedValue = keyValueClient.getValueAsString(path).orElseThrow(); + if (StringUtils.isBlank(decodedValue)) { + return values; + } + return getValues(path, decodedValue); + } + + private @NotNull Map getValues(String path, String decodedValue) { + Map values = new HashMap<>(); + if (path.endsWith(".yaml") || path.endsWith(".yml")) { + YamlPropertiesFactoryBean yamlFactory = new YamlPropertiesFactoryBean(); + yamlFactory.setResources(new ByteArrayResource(decodedValue.getBytes(StandardCharsets.UTF_8))); + values.putAll(toMap(yamlFactory.getObject())); + } else if (path.endsWith(".properties")) { + Properties properties = new Properties(); + try { + properties.load(new StringReader(decodedValue)); + } catch (IOException e) { + LOGGER.error(e.getMessage(), e); + } + values.putAll(toMap(properties)); + } else { + values.put(path, decodedValue); + } + return values; + } + + private void refreshConfigItems() { + synchronized (lock) { + Map all = new HashMap<>(); + all.putAll(environmentData); + all.putAll(applicationData); + all.putAll(serviceData); + all.putAll(versionData); + all.putAll(tagData); + updateHandler.handle(all, allLast); + this.allLast = all; + } + } + + @SuppressWarnings("unchecked") + private Map toMap(Properties properties) { + if (properties == null) { + return Collections.emptyMap(); + } + Map result = new HashMap<>(); + Enumeration keys = (Enumeration) properties.propertyNames(); + while (keys.hasMoreElements()) { + String key = keys.nextElement(); + Object value = properties.getProperty(key); + result.put(key, value); + } + return result; + } +} diff --git a/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigProperties.java b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigProperties.java new file mode 100644 index 00000000000..fe3a278678a --- /dev/null +++ b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulConfigProperties.java @@ -0,0 +1,71 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.config.consul; + +public class ConsulConfigProperties { + + private String host = "localhost"; + + private Integer port = 8500; + + private String scheme = "http"; + + private String aclToken; + + private Integer watchSeconds = 8; + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public String getScheme() { + return scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + public String getAclToken() { + return aclToken; + } + + public void setAclToken(String aclToken) { + this.aclToken = aclToken; + } + + public Integer getWatchSeconds() { + return watchSeconds; + } + + public void setWatchSeconds(Integer watchSeconds) { + this.watchSeconds = watchSeconds; + } +} diff --git a/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulDynamicPropertiesSource.java b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulDynamicPropertiesSource.java new file mode 100644 index 00000000000..9f0b3649249 --- /dev/null +++ b/dynamic-config/config-consul/src/main/java/org/apache/servicecomb/config/consul/ConsulDynamicPropertiesSource.java @@ -0,0 +1,99 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.config.consul; + +import com.google.common.net.HostAndPort; +import org.apache.commons.lang3.StringUtils; +import org.apache.servicecomb.config.ConfigurationChangedEvent; +import org.apache.servicecomb.config.DynamicPropertiesSource; +import org.apache.servicecomb.foundation.common.event.EventManager; +import org.kiwiproject.consul.Consul; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.PropertySource; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class ConsulDynamicPropertiesSource implements DynamicPropertiesSource { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulDynamicPropertiesSource.class); + + public static final String SOURCE_NAME = "consul"; + + private final Map valueCache = new ConcurrentHashMap<>(); + + private ConsulConfigClient consulConfigClient; + + public ConsulDynamicPropertiesSource() { + } + + private final UpdateHandler updateHandler = new UpdateHandler(); + public class UpdateHandler { + public void handle(Map current, Map last) { + ConfigurationChangedEvent event = ConfigurationChangedEvent.createIncremental(current, last); + LOGGER.info("Dynamic configuration changed: {}", event.getChanged()); + valueCache.putAll(event.getAdded()); + valueCache.putAll(event.getUpdated()); + event.getDeleted().forEach((k, v) -> valueCache.remove(k)); + EventManager.post(event); + } + } + + private ConsulConfigProperties consulConfigProperties(Environment environment) { + ConsulConfig consulConfig = new ConsulConfig(environment); + ConsulConfigProperties consulConfigProperties = new ConsulConfigProperties(); + consulConfigProperties.setHost(consulConfig.getConsulHost()); + consulConfigProperties.setPort(consulConfig.getConsulPort()); + consulConfigProperties.setScheme(consulConfig.getConsulScheme()); + consulConfigProperties.setAclToken(consulConfig.getConsulAclToken()); + consulConfigProperties.setWatchSeconds(consulConfig.getConsulWatchSeconds()); + return consulConfigProperties; + } + + private Consul consulClient(ConsulConfigProperties consulConfigProperties) { + Consul.Builder builder = Consul.builder().withHostAndPort(HostAndPort.fromParts(consulConfigProperties.getHost(), consulConfigProperties.getPort())); + if (StringUtils.isNotBlank(consulConfigProperties.getAclToken())) { + builder.withAclToken(consulConfigProperties.getAclToken()); + } + return builder.build(); + } + + private ConsulConfigClient consulConfigClient(Environment environment) { + ConsulConfigProperties consulConfigProperties = consulConfigProperties(environment); + Consul consulClient = consulClient(consulConfigProperties); + return new ConsulConfigClient(updateHandler, environment, consulConfigProperties, consulClient); + } + + @Override + public PropertySource create(Environment environment) { + try { + consulConfigClient = consulConfigClient(environment); + consulConfigClient.refreshConsulConfig(); + } catch (Exception e) { + throw new IllegalStateException("Set up consul config failed.", e); + } + return new MapPropertySource(SOURCE_NAME, valueCache); + } + + @Override + public int getOrder() { + return 0; + } +} diff --git a/dynamic-config/config-consul/src/main/resources/META-INF/services/org.apache.servicecomb.config.DynamicPropertiesSource b/dynamic-config/config-consul/src/main/resources/META-INF/services/org.apache.servicecomb.config.DynamicPropertiesSource new file mode 100644 index 00000000000..7b1c73e1195 --- /dev/null +++ b/dynamic-config/config-consul/src/main/resources/META-INF/services/org.apache.servicecomb.config.DynamicPropertiesSource @@ -0,0 +1,18 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +org.apache.servicecomb.config.consul.ConsulDynamicPropertiesSource diff --git a/dynamic-config/pom.xml b/dynamic-config/pom.xml index 540381370f9..f9f2a2b5cb2 100644 --- a/dynamic-config/pom.xml +++ b/dynamic-config/pom.xml @@ -38,6 +38,7 @@ config-kie config-zookeeper config-etcd + config-consul diff --git a/service-registry/pom.xml b/service-registry/pom.xml index 213f0b0f2d6..cdeefb039ac 100644 --- a/service-registry/pom.xml +++ b/service-registry/pom.xml @@ -38,5 +38,6 @@ registry-nacos registry-zookeeper registry-etcd + registry-consul diff --git a/service-registry/registry-consul/pom.xml b/service-registry/registry-consul/pom.xml new file mode 100644 index 00000000000..fe1806e620b --- /dev/null +++ b/service-registry/registry-consul/pom.xml @@ -0,0 +1,54 @@ + + + + + 4.0.0 + + org.apache.servicecomb + service-registry-parent + 3.3.0-SNAPSHOT + + + registry-consul + Java Chassis::Service Registry::Consul + + + + org.kiwiproject + consul-client + + + org.apache.servicecomb + foundation-common + + + org.apache.servicecomb + foundation-registry + + + org.apache.servicecomb + java-chassis-core + + + com.google.code.gson + gson + + + diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java new file mode 100644 index 00000000000..e088bcfd536 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java @@ -0,0 +1,77 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import com.google.common.net.HostAndPort; +import org.apache.commons.lang3.StringUtils; +import org.apache.servicecomb.config.DataCenterProperties; +import org.apache.servicecomb.registry.RegistrationId; +import org.apache.servicecomb.registry.consul.config.ConsulDiscoveryProperties; +import org.apache.servicecomb.registry.consul.config.ConsulProperties; +import org.kiwiproject.consul.Consul; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.Environment; + +@ConditionalOnProperty(prefix = "servicecomb.registry.consul", name = "enabled", matchIfMissing = true) +@Configuration +public class ConsulConfiguration { + + @Bean + @ConfigurationProperties(prefix = ConsulConst.CONSUL_REGISTRY_PREFIX) + @ConditionalOnMissingBean + public ConsulProperties consulProperties() { + return new ConsulProperties(); + } + + @Bean + @ConfigurationProperties(prefix = ConsulConst.CONSUL_DISCOVERY_REGISTRY_PREFIX) + @ConditionalOnMissingBean + public ConsulDiscoveryProperties consulDiscoveryProperties() { + return new ConsulDiscoveryProperties(); + } + + @Bean + @ConditionalOnBean(value = {ConsulProperties.class, ConsulDiscoveryProperties.class}) + @ConditionalOnMissingBean + public Consul consulClient(ConsulProperties consulProperties, ConsulDiscoveryProperties consulDiscoveryProperties) { + Consul.Builder builder = Consul.builder().withHostAndPort(HostAndPort.fromParts(consulProperties.getHost(), consulProperties.getPort())); + if (StringUtils.isNotBlank(consulDiscoveryProperties.getAclToken())) { + builder.withAclToken(consulDiscoveryProperties.getAclToken()); + } + return builder.build(); + } + + @Bean + @ConditionalOnBean(value = {Consul.class, Environment.class, RegistrationId.class, DataCenterProperties.class}) + @ConditionalOnMissingBean + public ConsulDiscovery consulDiscovery() { + return new ConsulDiscovery(); + } + + @Bean + @ConditionalOnBean(value = {Consul.class, Environment.class, RegistrationId.class, DataCenterProperties.class}) + @ConditionalOnMissingBean + public ConsulRegistration consulRegistration() { + return new ConsulRegistration(); + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConst.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConst.java new file mode 100644 index 00000000000..7074c34a3e0 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConst.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +public class ConsulConst { + + public static final String CONSUL_REGISTRY_NAME = "consul-registry"; + + public static final String CONSUL_REGISTRY_PREFIX = "servicecomb.registry.consul"; + + public static final String CONSUL_DISCOVERY_REGISTRY_PREFIX = "servicecomb.registry.consul.discovery"; + + public static final String CONSUL_DEFAULT_ENVIRONMENT = "production"; +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java new file mode 100644 index 00000000000..855f2348fd7 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import jakarta.annotation.Resource; +import jakarta.validation.constraints.NotNull; +import org.apache.servicecomb.config.BootStrapProperties; +import org.apache.servicecomb.registry.api.Discovery; +import org.apache.servicecomb.registry.consul.config.ConsulDiscoveryProperties; +import org.apache.servicecomb.registry.consul.config.ConsulProperties; +import org.kiwiproject.consul.Consul; +import org.kiwiproject.consul.HealthClient; +import org.kiwiproject.consul.cache.ServiceHealthCache; +import org.kiwiproject.consul.cache.ServiceHealthKey; +import org.kiwiproject.consul.model.health.Service; +import org.kiwiproject.consul.model.health.ServiceHealth; +import org.kiwiproject.consul.option.Options; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; +import org.springframework.util.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ConsulDiscovery implements Discovery { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulDiscovery.class); + + @Resource + private ConsulProperties consulProperties; + + @Resource + private ConsulDiscoveryProperties consulDiscoveryProperties; + + @Resource + private Consul consulClient; + + @Resource + private Environment environment; + + private List consulDiscoveryInstanceList; + + private InstanceChangedListener instanceChangedListener; + + private ServiceHealthCache svHealth; + + @Override + public String name() { + return ConsulConst.CONSUL_REGISTRY_NAME; + } + + @Override + public boolean enabled(String application, String serviceName) { + return consulDiscoveryProperties.isEnabled(); + } + + @Override + public List findServiceInstances(String application, String serviceName) { + LOGGER.info("findServiceInstances application:{}, serviceName:{}", application, serviceName); + consulDiscoveryInstanceList = getInstances(serviceName); + return consulDiscoveryInstanceList; + } + + @Override + public List findServices(String application) { + LOGGER.info("ConsulDiscovery findServices(application={})", application); + Map services = consulClient.agentClient().getServices(); + return Lists.newArrayList(services.keySet()); + } + + @Override + public void setInstanceChangedListener(InstanceChangedListener instanceChangedListener) { + this.instanceChangedListener = instanceChangedListener; + } + + @Override + public boolean enabled() { + return consulDiscoveryProperties.isEnabled(); + } + + @Override + public void init() { + LOGGER.info("ConsulDiscovery init"); + } + + @Override + public void run() { + LOGGER.info("ConsulDiscovery run"); + String serviceName = BootStrapProperties.readServiceName(environment); + HealthClient healthClient = consulClient.healthClient(); + svHealth = ServiceHealthCache.newCache(healthClient, serviceName, true, Options.BLANK_QUERY_OPTIONS, consulDiscoveryProperties.getWatchSeconds()); + svHealth.addListener((Map newValues) -> instanceChangedListener.onInstanceChanged( + name(), BootStrapProperties.readApplication(environment), serviceName, getInstances(serviceName))); + svHealth.start(); + } + + @Override + public void destroy() { + if (svHealth != null) { + svHealth.stop(); + } + String serviceId = consulDiscoveryProperties.getServiceId(); + LOGGER.info("ConsulDiscovery destroy consul service id={}", serviceId); + if (consulClient != null) { + LOGGER.info("ConsulDiscovery consulClient destroy"); + consulClient.agentClient().deregister(serviceId); + consulClient.destroy(); + } + } + + public List getInstances(@NotNull final String serviceName) { + List instances = new ArrayList<>(); + addInstancesToList(instances, serviceName); + return instances; + } + + private void addInstancesToList(List instances, String serviceName) { + List healthServices = getHealthServices(serviceName); + if (!CollectionUtils.isEmpty(healthServices)) { + for (ServiceHealth serviceHealth : healthServices) { + Service service = serviceHealth.getService(); + Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + ConsulInstance consulInstance = gson.fromJson(service.getMeta().get("meta"), ConsulInstance.class); + instances.add(new ConsulDiscoveryInstance(consulInstance)); + } + } + } + + private List getHealthServices(String serviceName) { + HealthClient healthClient = consulClient.healthClient(); + return healthClient.getHealthyServiceInstances(serviceName).getResponse(); + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java new file mode 100644 index 00000000000..2722192853d --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import org.apache.servicecomb.registry.api.DiscoveryInstance; +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; + +public class ConsulDiscoveryInstance extends ConsulInstance implements DiscoveryInstance { + + public ConsulDiscoveryInstance(ConsulInstance consulInstance) { + super(consulInstance); + } + + @Override + public MicroserviceInstanceStatus getStatus() { + return MicroserviceInstanceStatus.UP; + } + + @Override + public String getRegistryName() { + return ConsulConst.CONSUL_REGISTRY_NAME; + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java new file mode 100644 index 00000000000..03ef5710b3a --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java @@ -0,0 +1,191 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import org.apache.servicecomb.registry.api.DataCenterInfo; +import org.apache.servicecomb.registry.api.MicroserviceInstance; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class ConsulInstance implements MicroserviceInstance { + private String serviceId; + + private String instanceId; + + private String environment; + + private String application; + + private String serviceName; + + private String alias; + + private String version; + + private String description; + + private DataCenterInfo dataCenterInfo; + + private List endpoints = new ArrayList<>(); + + private Map schemas = new HashMap<>(); + + private Map properties = new HashMap<>(); + + public ConsulInstance() { + + } + + public ConsulInstance(ConsulInstance other) { + this.serviceId = other.serviceId; + this.instanceId = other.instanceId; + this.environment = other.environment; + this.application = other.application; + this.serviceName = other.serviceName; + this.alias = other.alias; + this.version = other.version; + this.description = other.description; + this.dataCenterInfo = other.dataCenterInfo; + this.endpoints = other.endpoints; + this.schemas = other.schemas; + this.properties = other.properties; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + public void setApplication(String application) { + this.application = application; + } + + public void setServiceName(String serviceName) { + this.serviceName = serviceName; + } + + public void setAlias(String alias) { + this.alias = alias; + } + + public void setVersion(String version) { + this.version = version; + } + + public void setDescription(String description) { + this.description = description; + } + + public void setDataCenterInfo(DataCenterInfo dataCenterInfo) { + this.dataCenterInfo = dataCenterInfo; + } + + public void setEndpoints(List endpoints) { + this.endpoints = endpoints; + } + + public void setSchemas(Map schemas) { + this.schemas = schemas; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + @Override + public String getEnvironment() { + return this.environment; + } + + @Override + public String getApplication() { + return this.application; + } + + @Override + public String getServiceName() { + return this.serviceName; + } + + @Override + public String getAlias() { + return alias; + } + + @Override + public String getVersion() { + return version; + } + + @Override + public DataCenterInfo getDataCenterInfo() { + return dataCenterInfo; + } + + @Override + public String getDescription() { + return description; + } + + @Override + public Map getProperties() { + return properties; + } + + @Override + public Map getSchemas() { + return schemas; + } + + @Override + public List getEndpoints() { + return endpoints; + } + + public void addSchema(String schemaId, String content) { + this.schemas.put(schemaId, content); + } + + public void addEndpoint(String endpoint) { + this.endpoints.add(endpoint); + } + + public void addProperty(String key, String value) { + this.properties.put(key, value); + } + + @Override + public String getInstanceId() { + return instanceId; + } + + @Override + public String getServiceId() { + return serviceId; + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java new file mode 100644 index 00000000000..0399face8a3 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java @@ -0,0 +1,174 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import jakarta.annotation.Resource; +import org.apache.commons.lang3.StringUtils; +import org.apache.servicecomb.config.BootStrapProperties; +import org.apache.servicecomb.config.DataCenterProperties; +import org.apache.servicecomb.core.Endpoint; +import org.apache.servicecomb.core.invocation.endpoint.EndpointUtils; +import org.apache.servicecomb.foundation.common.net.URIEndpointObject; +import org.apache.servicecomb.registry.RegistrationId; +import org.apache.servicecomb.registry.api.DataCenterInfo; +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; +import org.apache.servicecomb.registry.api.Registration; +import org.apache.servicecomb.registry.consul.config.ConsulDiscoveryProperties; +import org.kiwiproject.consul.AgentClient; +import org.kiwiproject.consul.Consul; +import org.kiwiproject.consul.model.agent.ImmutableRegistration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.env.Environment; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +public class ConsulRegistration implements Registration { + + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulRegistration.class); + + private ConsulInstance consulInstance; + + @Resource + private ConsulDiscoveryProperties consulDiscoveryProperties; + + @Resource + private Consul consulClient; + + @Resource + private Environment environment; + + @Resource + private DataCenterProperties dataCenterProperties; + + @Resource + private RegistrationId registrationId; + + @Value("${servicecomb.rest.address:127.0.0.1:8080}") + private String restAddress; + + @Override + public String name() { + return ConsulConst.CONSUL_REGISTRY_NAME; + } + + @Override + public ConsulRegistrationInstance getMicroserviceInstance() { + return new ConsulRegistrationInstance(consulInstance); + } + + @Override + public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) { + return true; + } + + @Override + public void addSchema(String schemaId, String content) { + if (consulDiscoveryProperties.isEnableSwaggerRegistration()) { + consulInstance.addSchema(schemaId, content); + } + } + + @Override + public void addEndpoint(String endpoint) { + consulInstance.addEndpoint(endpoint); + } + + @Override + public void addProperty(String key, String value) { + consulInstance.addProperty(key, value); + } + + @Override + public boolean enabled() { + return consulDiscoveryProperties.isEnabled(); + } + + @Override + public void init() { + LOGGER.info("ConsulRegistration init"); + String env = BootStrapProperties.readServiceEnvironment(environment); + if (StringUtils.isEmpty(env)) { + env = ConsulConst.CONSUL_DEFAULT_ENVIRONMENT; + } + String instanceId = registrationId.getInstanceId(); + consulInstance = new ConsulInstance(); + consulInstance.setInstanceId(instanceId); + consulInstance.setEnvironment(env); + consulInstance.setApplication(BootStrapProperties.readApplication(environment)); + consulInstance.setServiceName(BootStrapProperties.readServiceName(environment)); + consulInstance.setAlias(BootStrapProperties.readServiceAlias(environment)); + consulInstance.setDescription(BootStrapProperties.readServiceDescription(environment)); + if (StringUtils.isNotEmpty(dataCenterProperties.getName())) { + DataCenterInfo dataCenterInfo = new DataCenterInfo(); + dataCenterInfo.setName(dataCenterProperties.getName()); + dataCenterInfo.setRegion(dataCenterProperties.getRegion()); + dataCenterInfo.setAvailableZone(dataCenterProperties.getAvailableZone()); + consulInstance.setDataCenterInfo(dataCenterInfo); + } + consulInstance.setProperties(BootStrapProperties.readServiceProperties(environment)); + consulInstance.setVersion(BootStrapProperties.readServiceVersion(environment)); + } + + @Override + public void run() { + LOGGER.info("ConsulRegistration run"); + ImmutableRegistration.Builder registrationBuilder = ImmutableRegistration.builder() + .name(consulInstance.getServiceName()); + List endpoints = consulInstance.getEndpoints(); + for (String endpoint : endpoints) { + Endpoint temp = EndpointUtils.parse(endpoint); + if (temp.getAddress() instanceof URIEndpointObject) { + String hostOrIp = ((URIEndpointObject) temp.getAddress()).getHostOrIp(); + int port = ((URIEndpointObject) temp.getAddress()).getPort(); + String serviceId = hostOrIp + ":" + port; + consulDiscoveryProperties.setServiceId(serviceId); + consulInstance.setServiceId(serviceId); + registrationBuilder.id(serviceId); + registrationBuilder.address(hostOrIp); + registrationBuilder.port(port); + break; + } + } + List tags = consulDiscoveryProperties.getTags(); + if (CollectionUtils.isEmpty(tags)) { + tags.add(consulInstance.getServiceName()); + } + registrationBuilder.tags(tags); + Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + Map meta = new HashMap<>(); + meta.put("meta", gson.toJson(consulInstance)); + registrationBuilder.meta(meta); + ImmutableRegistration newService = registrationBuilder.build(); + AgentClient agentClient = consulClient.agentClient(); + agentClient.register(newService); + LOGGER.info("ConsulRegistration newService"); + } + + @Override + public void destroy() { + LOGGER.info("ConsulRegistration destroy"); + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java new file mode 100644 index 00000000000..d06ca7e6aa1 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java @@ -0,0 +1,38 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul; + +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; +import org.apache.servicecomb.registry.api.RegistrationInstance; + +public class ConsulRegistrationInstance extends ConsulInstance implements RegistrationInstance { + + public ConsulRegistrationInstance(ConsulInstance instance) { + super(instance); + } + + @Override + public MicroserviceInstanceStatus getInitialStatus() { + return MicroserviceInstanceStatus.STARTING; + } + + @Override + public MicroserviceInstanceStatus getReadyStatus() { + return MicroserviceInstanceStatus.UP; + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulDiscoveryProperties.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulDiscoveryProperties.java new file mode 100644 index 00000000000..a6a23192eb4 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulDiscoveryProperties.java @@ -0,0 +1,97 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul.config; + +import org.springframework.core.style.ToStringCreator; + +import java.util.ArrayList; +import java.util.List; + + +public class ConsulDiscoveryProperties { + + private String aclToken; + + private List tags = new ArrayList<>(); + + private Boolean enabled = true; + + private Integer watchSeconds = 8; + + private Boolean enableSwaggerRegistration = false; + + private String serviceId; + + public String getAclToken() { + return this.aclToken; + } + + public void setAclToken(String aclToken) { + this.aclToken = aclToken; + } + + public List getTags() { + return this.tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public Boolean isEnableSwaggerRegistration() { + return enableSwaggerRegistration; + } + + public void setEnableSwaggerRegistration(Boolean enableSwaggerRegistration) { + this.enableSwaggerRegistration = enableSwaggerRegistration; + } + + public Integer getWatchSeconds() { + return watchSeconds; + } + + public void setWatchSeconds(Integer watchSeconds) { + this.watchSeconds = watchSeconds; + } + + public String getServiceId() { + return serviceId; + } + + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + @Override + public String toString() { + return new ToStringCreator(this).append("aclToken", this.aclToken) + .append("enabled", this.enabled) + .append("serviceId", this.serviceId) + .append("tags", this.tags) + .append("watchSeconds", this.watchSeconds) + .toString(); + } +} diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java new file mode 100644 index 00000000000..c594a76fc43 --- /dev/null +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.registry.consul.config; + +import jakarta.validation.constraints.NotNull; +import org.springframework.validation.annotation.Validated; + + +@Validated +public class ConsulProperties { + + @NotNull + private String host = "localhost"; + + private String scheme = "http"; + + @NotNull + private Integer port = 8500; + + private Boolean enabled = true; + + public String getHost() { + return this.host; + } + + public void setHost(String host) { + this.host = host; + } + + public Integer getPort() { + return this.port; + } + + public void setPort(Integer port) { + this.port = port; + } + + public Boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getScheme() { + return this.scheme; + } + + public void setScheme(String scheme) { + this.scheme = scheme; + } + + @Override + public String toString() { + return "ConsulProperties{" + "host='" + this.host + '\'' + ", port=" + this.port + ", scheme=" + this.scheme + + ", enabled=" + this.enabled + "}"; + } +} diff --git a/service-registry/registry-consul/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/service-registry/registry-consul/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 00000000000..9a0422d67c2 --- /dev/null +++ b/service-registry/registry-consul/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,18 @@ +## --------------------------------------------------------------------------- +## Licensed to the Apache Software Foundation (ASF) under one or more +## contributor license agreements. See the NOTICE file distributed with +## this work for additional information regarding copyright ownership. +## The ASF licenses this file to You under the Apache License, Version 2.0 +## (the "License"); you may not use this file except in compliance with +## the License. You may obtain a copy of the License at +## +## http://www.apache.org/licenses/LICENSE-2.0 +## +## Unless required by applicable law or agreed to in writing, software +## distributed under the License is distributed on an "AS IS" BASIS, +## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +## See the License for the specific language governing permissions and +## limitations under the License. +## --------------------------------------------------------------------------- + +org.apache.servicecomb.registry.consul.ConsulConfiguration From 1a715027a50f25e12c2d238dc12420ad4a71101e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:19:46 +0800 Subject: [PATCH 003/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.26 to 2.2.27 (#4664) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 6f3d7a13b63..224c6064e87 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -87,7 +87,7 @@ 1.7.36 2.3 6.1.10 - 2.2.26 + 2.2.27 4.5.11 3.4.2 3.4.0 From a57a04156fb4bddc2395900fc1677c7c1b517ec4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:20:03 +0800 Subject: [PATCH 004/223] Bump io.netty:netty-bom from 4.1.115.Final to 4.1.116.Final (#4663) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 224c6064e87..e1c52341a02 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -71,7 +71,7 @@ 5.15.0 2.4.3 0.3.0 - 4.1.115.Final + 4.1.116.Final 4.12.0 0.16.0 3.23.4 From 85e1369361ac307c2bd94335a859d6d5fb779cf5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:20:19 +0800 Subject: [PATCH 005/223] Bump io.micrometer:micrometer-bom from 1.14.1 to 1.14.2 (#4662) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e1c52341a02..54eb4000651 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.24.2 3.9.9 - 1.14.1 + 1.14.2 5.14.2 5.2.0 5.15.0 From 2a3a909e8aa6e9b99a47d97da1b347113c89bf47 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:20:34 +0800 Subject: [PATCH 006/223] Bump org.junit:junit-bom from 5.11.3 to 5.11.4 (#4661) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 54eb4000651..ece6c0987c5 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.11.3 + 5.11.4 1.2.17 2.24.2 3.9.9 From 22cb460be5d94fdeaa86ee5b686387d366f4eb14 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:20:51 +0800 Subject: [PATCH 007/223] Bump org.owasp:dependency-check-maven from 11.1.0 to 11.1.1 (#4660) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3e994ce0829..bdc21b677f1 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 11.1.0 + 11.1.1 0.45.1 3.5.0 3.2.7 From 3961eec62f56957c8942dc8cd3d90de162edb2cc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:21:06 +0800 Subject: [PATCH 008/223] Bump org.assertj:assertj-core from 3.26.3 to 3.27.0 (#4659) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index ece6c0987c5..b4d6fbc58fc 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -32,7 +32,7 @@ 1.2.2 - 3.26.3 + 3.27.0 4.2.2 6.0.3 1.9.4 From 34d0e8ed795373337e0b96a3f46c2f02e11a97c3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:21:22 +0800 Subject: [PATCH 009/223] Bump org.apache.commons:commons-text from 1.11.0 to 1.13.0 (#4658) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index b4d6fbc58fc..03d6f345b8a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -40,7 +40,7 @@ 2.6 3.17.0 1.3.4 - 1.11.0 + 1.13.0 5.7.1 1.0.2 3.0.2 From ce3288124e217df22878c4ad1c62db883c357385 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:21:41 +0800 Subject: [PATCH 010/223] Bump io.zipkin.zipkin2:zipkin from 3.4.2 to 3.4.3 (#4655) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 03d6f345b8a..ee55b7bbc7c 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 6.1.10 2.2.27 4.5.11 - 3.4.2 + 3.4.3 3.4.0 0.8.4 1.4.2 From efe5c8e5c6d2e9631f9f78fc92c1f17c554f6328 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:21:56 +0800 Subject: [PATCH 011/223] Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.11.1 to 3.11.2 (#4654) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index bdc21b677f1..14de537527d 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ 3.5.0 3.2.7 0.8.12 - 3.11.1 + 3.11.2 2.5 3.13.0 3.5.2 From 8f25690e3f4c59e1020e97239932660b95b5ac5e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:22:09 +0800 Subject: [PATCH 012/223] Bump org.java-websocket:Java-WebSocket from 1.5.7 to 1.6.0 (#4653) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index ee55b7bbc7c..89c13a52b65 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -54,7 +54,7 @@ 4.5.14 1.5.18 2.18.2 - 1.5.7 + 1.6.0 1.3.2 1 1.5 From 1431e09476a6b4c19a06c44de23de626c8fc09ed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:22:24 +0800 Subject: [PATCH 013/223] Bump log4j2.version from 2.24.2 to 2.24.3 (#4652) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 89c13a52b65..416d9b79b40 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.11.4 1.2.17 - 2.24.2 + 2.24.3 3.9.9 1.14.2 5.14.2 From 1d65b27720906023f6531d584ffcf16dd97794f8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:22:40 +0800 Subject: [PATCH 014/223] Bump com.puppycrawl.tools:checkstyle from 10.20.2 to 10.21.1 (#4651) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 14de537527d..72091c3ea2b 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.20.2 + 10.21.1 3.1.1 3.21.0 3.3.0 From 60eecb4bcc624c375c063a4b13e4e1076cfb9d62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 17:22:53 +0800 Subject: [PATCH 015/223] Bump com.google.guava:guava from 33.3.1-jre to 33.4.0-jre (#4650) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 416d9b79b40..8a74c314837 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -46,7 +46,7 @@ 3.0.2 1.17.12 1.17.13 - 33.3.1-jre + 33.4.0-jre 5.1.0 1.3 2.2.2 From a6bd5b758e46cca48872823f29d10da9fc4e9cf7 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 6 Jan 2025 17:06:42 +0800 Subject: [PATCH 016/223] [#4666] fixed BackOffSleepTask max waiting time to 10 minute (#4667) --- .../org/apache/servicecomb/http/client/task/AbstractTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/task/AbstractTask.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/task/AbstractTask.java index d25dee151de..cc10ae8e142 100644 --- a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/task/AbstractTask.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/task/AbstractTask.java @@ -31,7 +31,7 @@ public class AbstractTask { public class BackOffSleepTask implements Task { private static final long BASE = 3000; - private static final long MAX = 10 * 60 * 10000; + private static final long MAX = 10 * 60 * 1000; long waitTime; From fe66fc63559657562e37c3af0484d95a0fa36532 Mon Sep 17 00:00:00 2001 From: Zhangjian He Date: Mon, 6 Jan 2025 17:07:21 +0800 Subject: [PATCH 017/223] update NOTICE file for 2025 copyright year (#4669) Signed-off-by: Zhangjian He --- NOTICE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NOTICE b/NOTICE index 5ed927047d5..e4df59ae99a 100644 --- a/NOTICE +++ b/NOTICE @@ -1,5 +1,5 @@ Apache ServiceComb Java Chassis -Copyright 2017-2024 The Apache Software Foundation +Copyright 2017-2025 The Apache Software Foundation This product includes software developed at The Apache Software Foundation (http://www.apache.org/). From 8cedd077e0df968a4f5eeedd85efcd71bf48aae2 Mon Sep 17 00:00:00 2001 From: felixgis14 <71480844+felixgis14@users.noreply.github.com> Date: Thu, 9 Jan 2025 20:37:47 +0800 Subject: [PATCH 018/223] [SCB-2895]The findServices method returns data errors (#4674) --- .../servicecomb/registry/consul/ConsulDiscovery.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java index 855f2348fd7..c8229ad9ca5 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java @@ -84,8 +84,11 @@ public List findServiceInstances(String application, St @Override public List findServices(String application) { LOGGER.info("ConsulDiscovery findServices(application={})", application); - Map services = consulClient.agentClient().getServices(); - return Lists.newArrayList(services.keySet()); + Map> response = consulClient.catalogClient().getServices().getResponse(); + if (!CollectionUtils.isEmpty(response)) { + return Lists.newArrayList(response.keySet()); + } + return Lists.newArrayList(); } @Override From 0668f6308dfcd20a0fd17798206b8fe021b18ceb Mon Sep 17 00:00:00 2001 From: chenshouye168 Date: Mon, 13 Jan 2025 09:41:30 +0800 Subject: [PATCH 019/223] Submit a feature that applies graceful up and down (#4670) --- .../apache/servicecomb/core/SCBEngine.java | 2 - .../registry/DiscoveryManager.java | 2 +- .../registry/api/MicroserviceInstance.java | 6 ++ .../registry/api/RegistrationInstance.java | 11 ---- .../InstanceStatusDiscoveryFilter.java | 6 +- .../discovery/StatefulDiscoveryInstance.java | 11 ---- .../TestInstanceStatusDiscoveryFilter.java | 8 +-- .../src/test/resources/log4j2.xml | 20 +++---- service-registry/registry-consul/pom.xml | 4 +- .../registry/consul/ConsulConfiguration.java | 4 +- .../registry/consul/ConsulDiscovery.java | 5 +- .../consul/ConsulDiscoveryInstance.java | 22 ++++---- .../registry/consul/ConsulInstance.java | 8 ++- .../registry/consul/ConsulRegistration.java | 2 + .../consul/ConsulRegistrationInstance.java | 12 +--- .../consul/config/ConsulProperties.java | 1 + .../registry/etcd/EtcdInstance.java | 8 ++- .../etcd/EtcdRegistrationInstance.java | 11 ---- .../LocalRegistrationInstance.java | 7 +-- service-registry/registry-nacos/pom.xml | 56 +++++++++---------- .../registry/nacos/NacosConst.java | 2 + .../registry/nacos/NacosDiscovery.java | 1 + .../nacos/NacosDiscoveryInstance.java | 10 +++- .../registry/nacos/NacosRegistration.java | 15 +++-- .../nacos/NacosRegistrationInstance.java | 9 +-- .../registry/sc/MicroserviceHandler.java | 3 +- .../sc/SCConfigurationProperties.java | 10 ---- .../registry/sc/SCDiscoveryInstance.java | 9 ++- .../registry/sc/SCRegistration.java | 1 - .../registry/sc/SCRegistrationInstance.java | 10 +--- .../ZeroConfigRegistrationInstance.java | 7 +-- .../zookeeper/ZookeeperDiscoveryInstance.java | 6 -- .../registry/zookeeper/ZookeeperInstance.java | 15 ++++- .../zookeeper/ZookeeperRegistration.java | 14 ++++- .../ZookeeperRegistrationInstance.java | 11 ---- 35 files changed, 153 insertions(+), 176 deletions(-) diff --git a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java index 2d8b86818c6..c69521698af 100644 --- a/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java +++ b/core/src/main/java/org/apache/servicecomb/core/SCBEngine.java @@ -370,8 +370,6 @@ private void doRun() throws Exception { triggerEvent(EventType.BEFORE_REGISTRY); registrationManager.run(); discoveryManager.run(); - // ensure can invoke services in AFTER_REGISTRY - registrationManager.updateMicroserviceInstanceStatus(MicroserviceInstanceStatus.UP); status = SCBStatus.UP; triggerEvent(EventType.AFTER_REGISTRY); diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java index 2cbe83a2465..edcd3b3caef 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/DiscoveryManager.java @@ -183,7 +183,7 @@ private VersionedCache calcAvailableInstance(String application, String serviceN continue; } if (instance.getHistoryStatus() == HistoryStatus.HISTORY - && instance.getMicroserviceInstanceStatus() == MicroserviceInstanceStatus.UP + && instance.getStatus() == MicroserviceInstanceStatus.UP && instance.getPingStatus() == PingStatus.OK && instance.getIsolationStatus() == IsolationStatus.NORMAL) { result.add(instance); diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/MicroserviceInstance.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/MicroserviceInstance.java index 0dd6d0237c0..c5c872beefd 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/MicroserviceInstance.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/MicroserviceInstance.java @@ -93,4 +93,10 @@ public interface MicroserviceInstance { default String getServiceId() { return ""; } + + /** + * Service status(Required): status of this microservice. + * + */ + MicroserviceInstanceStatus getStatus(); } diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/RegistrationInstance.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/RegistrationInstance.java index afe2bc7a878..a7d7cafda88 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/RegistrationInstance.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/RegistrationInstance.java @@ -20,15 +20,4 @@ * Microserivce instance registration object. */ public interface RegistrationInstance extends MicroserviceInstance { - /** - * Initial status when registering(Optional). This method is - * implementation specific and may be not used. - */ - MicroserviceInstanceStatus getInitialStatus(); - - /** - * Ready status when microservice instance is ready for service(Optional).This method is - * implementation specific and may be not used. - */ - MicroserviceInstanceStatus getReadyStatus(); } diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java index ef60b4a3eff..dd27dc973c8 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java @@ -69,21 +69,21 @@ public void init(DiscoveryContext context, DiscoveryTreeNode parent) { for (StatefulDiscoveryInstance instance : instances) { if (HistoryStatus.CURRENT == instance.getHistoryStatus() && - MicroserviceInstanceStatus.UP == instance.getMicroserviceInstanceStatus() && + MicroserviceInstanceStatus.UP == instance.getStatus() && PingStatus.OK == instance.getPingStatus() && IsolationStatus.NORMAL == instance.getIsolationStatus()) { level0.add(instance); continue; } if (HistoryStatus.CURRENT == instance.getHistoryStatus() && - MicroserviceInstanceStatus.UP == instance.getMicroserviceInstanceStatus() && + MicroserviceInstanceStatus.UP == instance.getStatus() && PingStatus.UNKNOWN == instance.getPingStatus() && IsolationStatus.NORMAL == instance.getIsolationStatus()) { level1.add(instance); continue; } if (HistoryStatus.HISTORY == instance.getHistoryStatus() && - MicroserviceInstanceStatus.UP == instance.getMicroserviceInstanceStatus() && + MicroserviceInstanceStatus.UP == instance.getStatus() && PingStatus.OK == instance.getPingStatus() && IsolationStatus.NORMAL == instance.getIsolationStatus()) { level2.add(instance); diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/StatefulDiscoveryInstance.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/StatefulDiscoveryInstance.java index f06ea936d20..394b2b03ccc 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/StatefulDiscoveryInstance.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/StatefulDiscoveryInstance.java @@ -46,8 +46,6 @@ public enum HistoryStatus { private final DiscoveryInstance discoveryInstance; - private MicroserviceInstanceStatus microserviceInstanceStatus = MicroserviceInstanceStatus.UP; - private IsolationStatus isolationStatus = IsolationStatus.NORMAL; private long isolatedTime; @@ -64,15 +62,6 @@ public StatefulDiscoveryInstance(DiscoveryInstance discoveryInstance) { this.discoveryInstance = discoveryInstance; } - public MicroserviceInstanceStatus getMicroserviceInstanceStatus() { - return microserviceInstanceStatus; - } - - public void setMicroserviceInstanceStatus( - MicroserviceInstanceStatus microserviceInstanceStatus) { - this.microserviceInstanceStatus = microserviceInstanceStatus; - } - public IsolationStatus getIsolationStatus() { return isolationStatus; } diff --git a/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestInstanceStatusDiscoveryFilter.java b/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestInstanceStatusDiscoveryFilter.java index eeecc420096..8e7307098b9 100644 --- a/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestInstanceStatusDiscoveryFilter.java +++ b/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestInstanceStatusDiscoveryFilter.java @@ -36,22 +36,22 @@ public void test_all_group_correct_init() { List instances = new ArrayList<>(); StatefulDiscoveryInstance instance1 = Mockito.mock(StatefulDiscoveryInstance.class); Mockito.when(instance1.getHistoryStatus()).thenReturn(HistoryStatus.CURRENT); - Mockito.when(instance1.getMicroserviceInstanceStatus()).thenReturn(MicroserviceInstanceStatus.UP); + Mockito.when(instance1.getStatus()).thenReturn(MicroserviceInstanceStatus.UP); Mockito.when(instance1.getPingStatus()).thenReturn(PingStatus.OK); Mockito.when(instance1.getIsolationStatus()).thenReturn(IsolationStatus.NORMAL); StatefulDiscoveryInstance instance2 = Mockito.mock(StatefulDiscoveryInstance.class); Mockito.when(instance2.getHistoryStatus()).thenReturn(HistoryStatus.CURRENT); - Mockito.when(instance2.getMicroserviceInstanceStatus()).thenReturn(MicroserviceInstanceStatus.UP); + Mockito.when(instance2.getStatus()).thenReturn(MicroserviceInstanceStatus.UP); Mockito.when(instance2.getPingStatus()).thenReturn(PingStatus.UNKNOWN); Mockito.when(instance2.getIsolationStatus()).thenReturn(IsolationStatus.NORMAL); StatefulDiscoveryInstance instance3 = Mockito.mock(StatefulDiscoveryInstance.class); Mockito.when(instance3.getHistoryStatus()).thenReturn(HistoryStatus.HISTORY); - Mockito.when(instance3.getMicroserviceInstanceStatus()).thenReturn(MicroserviceInstanceStatus.UP); + Mockito.when(instance3.getStatus()).thenReturn(MicroserviceInstanceStatus.UP); Mockito.when(instance3.getPingStatus()).thenReturn(PingStatus.OK); Mockito.when(instance3.getIsolationStatus()).thenReturn(IsolationStatus.NORMAL); StatefulDiscoveryInstance instance4 = Mockito.mock(StatefulDiscoveryInstance.class); Mockito.when(instance4.getHistoryStatus()).thenReturn(HistoryStatus.CURRENT); - Mockito.when(instance4.getMicroserviceInstanceStatus()).thenReturn(MicroserviceInstanceStatus.UP); + Mockito.when(instance4.getStatus()).thenReturn(MicroserviceInstanceStatus.UP); Mockito.when(instance4.getPingStatus()).thenReturn(PingStatus.FAIL); Mockito.when(instance4.getIsolationStatus()).thenReturn(IsolationStatus.NORMAL); instances.addAll(Arrays.asList(instance1, instance2, instance3, instance4)); diff --git a/foundations/foundation-registry/src/test/resources/log4j2.xml b/foundations/foundation-registry/src/test/resources/log4j2.xml index 8cee07220ec..3125ebd11e4 100644 --- a/foundations/foundation-registry/src/test/resources/log4j2.xml +++ b/foundations/foundation-registry/src/test/resources/log4j2.xml @@ -16,14 +16,14 @@ under the License. --> - - - - - - - - - - + + + + + + + + + + diff --git a/service-registry/registry-consul/pom.xml b/service-registry/registry-consul/pom.xml index fe1806e620b..58399a146d0 100644 --- a/service-registry/registry-consul/pom.xml +++ b/service-registry/registry-consul/pom.xml @@ -17,8 +17,8 @@ --> + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 org.apache.servicecomb diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java index e088bcfd536..36422f0f110 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulConfiguration.java @@ -18,6 +18,7 @@ package org.apache.servicecomb.registry.consul; import com.google.common.net.HostAndPort; + import org.apache.commons.lang3.StringUtils; import org.apache.servicecomb.config.DataCenterProperties; import org.apache.servicecomb.registry.RegistrationId; @@ -54,7 +55,8 @@ public ConsulDiscoveryProperties consulDiscoveryProperties() { @ConditionalOnBean(value = {ConsulProperties.class, ConsulDiscoveryProperties.class}) @ConditionalOnMissingBean public Consul consulClient(ConsulProperties consulProperties, ConsulDiscoveryProperties consulDiscoveryProperties) { - Consul.Builder builder = Consul.builder().withHostAndPort(HostAndPort.fromParts(consulProperties.getHost(), consulProperties.getPort())); + Consul.Builder builder = Consul.builder() + .withHostAndPort(HostAndPort.fromParts(consulProperties.getHost(), consulProperties.getPort())); if (StringUtils.isNotBlank(consulDiscoveryProperties.getAclToken())) { builder.withAclToken(consulDiscoveryProperties.getAclToken()); } diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java index c8229ad9ca5..ce16ccc47b3 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java @@ -20,8 +20,10 @@ import com.google.common.collect.Lists; import com.google.gson.Gson; import com.google.gson.GsonBuilder; + import jakarta.annotation.Resource; import jakarta.validation.constraints.NotNull; + import org.apache.servicecomb.config.BootStrapProperties; import org.apache.servicecomb.registry.api.Discovery; import org.apache.servicecomb.registry.consul.config.ConsulDiscoveryProperties; @@ -111,7 +113,8 @@ public void run() { LOGGER.info("ConsulDiscovery run"); String serviceName = BootStrapProperties.readServiceName(environment); HealthClient healthClient = consulClient.healthClient(); - svHealth = ServiceHealthCache.newCache(healthClient, serviceName, true, Options.BLANK_QUERY_OPTIONS, consulDiscoveryProperties.getWatchSeconds()); + svHealth = ServiceHealthCache.newCache(healthClient, serviceName, true, Options.BLANK_QUERY_OPTIONS, + consulDiscoveryProperties.getWatchSeconds()); svHealth.addListener((Map newValues) -> instanceChangedListener.onInstanceChanged( name(), BootStrapProperties.readApplication(environment), serviceName, getInstances(serviceName))); svHealth.start(); diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java index 2722192853d..de3bf9bc20b 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java @@ -22,17 +22,17 @@ public class ConsulDiscoveryInstance extends ConsulInstance implements DiscoveryInstance { - public ConsulDiscoveryInstance(ConsulInstance consulInstance) { - super(consulInstance); - } + public ConsulDiscoveryInstance(ConsulInstance consulInstance) { + super(consulInstance); + } - @Override - public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; - } + @Override + public MicroserviceInstanceStatus getStatus() { + return MicroserviceInstanceStatus.UP; + } - @Override - public String getRegistryName() { - return ConsulConst.CONSUL_REGISTRY_NAME; - } + @Override + public String getRegistryName() { + return ConsulConst.CONSUL_REGISTRY_NAME; + } } diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java index 03ef5710b3a..b29f80e778b 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java @@ -19,6 +19,7 @@ import org.apache.servicecomb.registry.api.DataCenterInfo; import org.apache.servicecomb.registry.api.MicroserviceInstance; +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; import java.util.ArrayList; import java.util.HashMap; @@ -144,7 +145,7 @@ public String getVersion() { @Override public DataCenterInfo getDataCenterInfo() { - return dataCenterInfo; + return dataCenterInfo == null ? new DataCenterInfo() : dataCenterInfo; } @Override @@ -188,4 +189,9 @@ public String getInstanceId() { public String getServiceId() { return serviceId; } + + @Override + public MicroserviceInstanceStatus getStatus() { + return MicroserviceInstanceStatus.UP; + } } diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java index 0399face8a3..122ee5ade40 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java @@ -19,7 +19,9 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; + import jakarta.annotation.Resource; + import org.apache.commons.lang3.StringUtils; import org.apache.servicecomb.config.BootStrapProperties; import org.apache.servicecomb.config.DataCenterProperties; diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java index d06ca7e6aa1..dc0b83eaefc 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistrationInstance.java @@ -17,7 +17,7 @@ package org.apache.servicecomb.registry.consul; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; + import org.apache.servicecomb.registry.api.RegistrationInstance; public class ConsulRegistrationInstance extends ConsulInstance implements RegistrationInstance { @@ -25,14 +25,4 @@ public class ConsulRegistrationInstance extends ConsulInstance implements Regist public ConsulRegistrationInstance(ConsulInstance instance) { super(instance); } - - @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { - return MicroserviceInstanceStatus.UP; - } } diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java index c594a76fc43..bb04a758330 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/config/ConsulProperties.java @@ -18,6 +18,7 @@ package org.apache.servicecomb.registry.consul.config; import jakarta.validation.constraints.NotNull; + import org.springframework.validation.annotation.Validated; diff --git a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java index 19fbd8cadf6..99ab793fff3 100644 --- a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java +++ b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java @@ -23,6 +23,7 @@ import org.apache.servicecomb.registry.api.DataCenterInfo; import org.apache.servicecomb.registry.api.MicroserviceInstance; +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; public class EtcdInstance implements MicroserviceInstance { private String serviceId; @@ -143,7 +144,7 @@ public String getVersion() { @Override public DataCenterInfo getDataCenterInfo() { - return dataCenterInfo; + return dataCenterInfo == null ? new DataCenterInfo() : dataCenterInfo; } @Override @@ -188,6 +189,11 @@ public String getServiceId() { return serviceId; } + @Override + public MicroserviceInstanceStatus getStatus() { + return MicroserviceInstanceStatus.UP; + } + @Override public String toString() { return "EtcdInstance{" + diff --git a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistrationInstance.java b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistrationInstance.java index 444fe867089..3dfa78c338e 100644 --- a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistrationInstance.java +++ b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistrationInstance.java @@ -16,21 +16,10 @@ */ package org.apache.servicecomb.registry.etcd; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; import org.apache.servicecomb.registry.api.RegistrationInstance; public class EtcdRegistrationInstance extends EtcdInstance implements RegistrationInstance { public EtcdRegistrationInstance(EtcdInstance instance) { super(instance); } - - @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { - return MicroserviceInstanceStatus.UP; - } } diff --git a/service-registry/registry-local/src/main/java/org/apache/servicecomb/localregistry/LocalRegistrationInstance.java b/service-registry/registry-local/src/main/java/org/apache/servicecomb/localregistry/LocalRegistrationInstance.java index 2262beab439..e07527636a9 100644 --- a/service-registry/registry-local/src/main/java/org/apache/servicecomb/localregistry/LocalRegistrationInstance.java +++ b/service-registry/registry-local/src/main/java/org/apache/servicecomb/localregistry/LocalRegistrationInstance.java @@ -119,12 +119,7 @@ public String getInstanceId() { } @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { + public MicroserviceInstanceStatus getStatus() { return MicroserviceInstanceStatus.UP; } diff --git a/service-registry/registry-nacos/pom.xml b/service-registry/registry-nacos/pom.xml index eb1a4b5d914..97b8667358b 100644 --- a/service-registry/registry-nacos/pom.xml +++ b/service-registry/registry-nacos/pom.xml @@ -17,35 +17,35 @@ --> - - org.apache.servicecomb - service-registry-parent - 3.3.0-SNAPSHOT - - 4.0.0 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + org.apache.servicecomb + service-registry-parent + 3.3.0-SNAPSHOT + + 4.0.0 - registry-nacos - Java Chassis::Service Registry::Nacos + registry-nacos + Java Chassis::Service Registry::Nacos - - - com.alibaba.nacos - nacos-client - - - org.apache.servicecomb - foundation-common - - - org.apache.servicecomb - foundation-registry - - - org.apache.servicecomb - java-chassis-core - - + + + com.alibaba.nacos + nacos-client + + + org.apache.servicecomb + foundation-common + + + org.apache.servicecomb + foundation-registry + + + org.apache.servicecomb + java-chassis-core + + diff --git a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosConst.java b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosConst.java index b3a7a5dab37..563d1726095 100644 --- a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosConst.java +++ b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosConst.java @@ -57,4 +57,6 @@ public class NacosConst { public static final String NAMING_LOAD_CACHE_AT_START = "namingLoadCacheAtStart"; public static final String NACOS_REGISTRY_NAME = "nacos-registry"; + + public static final String NACOS_STATUS = "nacos-status"; } diff --git a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscovery.java b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscovery.java index bd41ad539e2..dfe2a5739eb 100644 --- a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscovery.java +++ b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscovery.java @@ -25,6 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean; import com.alibaba.nacos.api.exception.NacosException; + import org.apache.servicecomb.registry.api.Discovery; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; diff --git a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscoveryInstance.java b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscoveryInstance.java index 93c8369a65c..6360d012012 100644 --- a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscoveryInstance.java +++ b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosDiscoveryInstance.java @@ -57,7 +57,15 @@ public NacosDiscoveryInstance(Instance instance, String application, String serv @Override public MicroserviceInstanceStatus getStatus() { - return instance.isEnabled() ? MicroserviceInstanceStatus.UP : MicroserviceInstanceStatus.DOWN; + if (instance.isEnabled()) { + String instanceStatus = instance.getMetadata().get(NacosConst.NACOS_STATUS); + if (StringUtils.isBlank(instanceStatus)) { + return MicroserviceInstanceStatus.UP; + } + return MicroserviceInstanceStatus.valueOf(instanceStatus); + } else { + return MicroserviceInstanceStatus.DOWN; + } } @Override diff --git a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java index c11afaec719..96f41d0670e 100644 --- a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java +++ b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java @@ -20,6 +20,7 @@ import java.util.List; import java.util.Map; +import org.apache.servicecomb.config.BootStrapProperties; import org.apache.servicecomb.config.DataCenterProperties; import org.apache.servicecomb.core.Endpoint; import org.apache.servicecomb.core.invocation.endpoint.EndpointUtils; @@ -65,7 +66,8 @@ public void init() { environment); instance.setInstanceId(instanceId); nacosRegistrationInstance = new NacosRegistrationInstance(instance, environment); - + instance.getMetadata() + .put(NacosConst.NACOS_STATUS, BootStrapProperties.readServiceInstanceInitialStatus(environment)); namingService = NamingServiceManager.buildNamingService(environment, nacosDiscoveryProperties); } @@ -132,9 +134,14 @@ public NacosRegistrationInstance getMicroserviceInstance() { @Override public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) { - // Do not support Nacos update status now. Because update status will fail - // due to some unknown reasons(Maybe different constrains in register and maintain api). - return true; + try { + instance.getMetadata().put(NacosConst.NACOS_STATUS, status.name()); + namingService.registerInstance(nacosRegistrationInstance.getServiceName(), + nacosRegistrationInstance.getApplication(), instance); + return true; + } catch (Exception e) { + throw new RuntimeException(e); + } } @Override diff --git a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistrationInstance.java b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistrationInstance.java index 653ce3d8928..7a99f1b2dba 100644 --- a/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistrationInstance.java +++ b/service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistrationInstance.java @@ -104,13 +104,8 @@ public String getInstanceId() { } @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { - return MicroserviceInstanceStatus.UP; + public MicroserviceInstanceStatus getStatus() { + return MicroserviceInstanceStatus.valueOf(instance.getMetadata().get(NacosConst.NACOS_STATUS)); } public void addSchema(String schemaId, String content) { diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/MicroserviceHandler.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/MicroserviceHandler.java index 7ff1ec74d85..7ffa409a089 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/MicroserviceHandler.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/MicroserviceHandler.java @@ -142,7 +142,8 @@ public static MicroserviceInstance createMicroserviceInstance( properties.putAll(BootStrapProperties.readServiceProperties(environment)); properties.putAll(genCasProperties(environment)); microserviceInstance.setProperties(properties); - microserviceInstance.setStatus(MicroserviceInstanceStatus.valueOf(scConfigurationProperties.getInitialStatus())); + microserviceInstance.setStatus( + MicroserviceInstanceStatus.valueOf(BootStrapProperties.readServiceInstanceInitialStatus(environment))); return microserviceInstance; } diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCConfigurationProperties.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCConfigurationProperties.java index 784f711cf59..5ac431406a3 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCConfigurationProperties.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCConfigurationProperties.java @@ -49,8 +49,6 @@ public class SCConfigurationProperties { private boolean autoDiscovery = false; - private String initialStatus = "STARTING"; - private boolean watch = false; private long registrationWaitTimeInMillis = 30000; @@ -140,14 +138,6 @@ public void setHealthCheckTimes(int healthCheckTimes) { this.healthCheckTimes = healthCheckTimes; } - public String getInitialStatus() { - return initialStatus; - } - - public void setInitialStatus(String initialStatus) { - this.initialStatus = initialStatus; - } - public boolean isWatch() { return watch; } diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCDiscoveryInstance.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCDiscoveryInstance.java index 28ef4e37b0a..f3b7ffe4403 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCDiscoveryInstance.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCDiscoveryInstance.java @@ -76,9 +76,12 @@ public String getVersion() { @Override public DataCenterInfo getDataCenterInfo() { - return new DataCenterInfo(microserviceInstance.getDataCenterInfo().getName(), - microserviceInstance.getDataCenterInfo().getRegion(), - microserviceInstance.getDataCenterInfo().getAvailableZone()); + if (microserviceInstance.getDataCenterInfo() != null) { + return new DataCenterInfo(microserviceInstance.getDataCenterInfo().getName(), + microserviceInstance.getDataCenterInfo().getRegion(), + microserviceInstance.getDataCenterInfo().getAvailableZone()); + } + return new DataCenterInfo(); } @Override diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java index e37f54b676b..a2a47ca5a08 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java @@ -88,7 +88,6 @@ public void setEnvironment(Environment environment) { this.environment = environment; } - @Override public void init() { microservice = MicroserviceHandler.createMicroservice( diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistrationInstance.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistrationInstance.java index 36416972a73..cfe53692eeb 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistrationInstance.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistrationInstance.java @@ -34,8 +34,7 @@ public class SCRegistrationInstance implements RegistrationInstance { private final ServiceCenterRegistration serviceCenterRegistration; - public SCRegistrationInstance(Microservice microservice, - MicroserviceInstance microserviceInstance, + public SCRegistrationInstance(Microservice microservice, MicroserviceInstance microserviceInstance, ServiceCenterRegistration serviceCenterRegistration) { this.microservice = microservice; this.microserviceInstance = microserviceInstance; @@ -107,15 +106,10 @@ public String getServiceId() { } @Override - public MicroserviceInstanceStatus getInitialStatus() { + public MicroserviceInstanceStatus getStatus() { return MicroserviceInstanceStatus.valueOf(microserviceInstance.getStatus().name()); } - @Override - public MicroserviceInstanceStatus getReadyStatus() { - return MicroserviceInstanceStatus.UP; - } - public Microservice getBackendMicroservice() { return microservice; } diff --git a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/ZeroConfigRegistrationInstance.java b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/ZeroConfigRegistrationInstance.java index 61864c96495..9e1955b24a8 100644 --- a/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/ZeroConfigRegistrationInstance.java +++ b/service-registry/registry-zero-config/src/main/java/org/apache/servicecomb/zeroconfig/ZeroConfigRegistrationInstance.java @@ -87,12 +87,7 @@ public String getInstanceId() { } @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { + public MicroserviceInstanceStatus getStatus() { return MicroserviceInstanceStatus.UP; } diff --git a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java index f33b05fb7f7..b01ad50830e 100644 --- a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java +++ b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperDiscoveryInstance.java @@ -17,18 +17,12 @@ package org.apache.servicecomb.registry.zookeeper; import org.apache.servicecomb.registry.api.DiscoveryInstance; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; public class ZookeeperDiscoveryInstance extends ZookeeperInstance implements DiscoveryInstance { public ZookeeperDiscoveryInstance(ZookeeperInstance other) { super(other); } - @Override - public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; - } - @Override public String getRegistryName() { return ZookeeperConst.ZOOKEEPER_REGISTRY_NAME; diff --git a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java index 725816b24a2..b919d97855f 100644 --- a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java +++ b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperInstance.java @@ -23,6 +23,7 @@ import org.apache.servicecomb.registry.api.DataCenterInfo; import org.apache.servicecomb.registry.api.MicroserviceInstance; +import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; public class ZookeeperInstance implements MicroserviceInstance { private String serviceId; @@ -49,6 +50,8 @@ public class ZookeeperInstance implements MicroserviceInstance { private Map properties = new HashMap<>(); + private MicroserviceInstanceStatus status; + public ZookeeperInstance() { } @@ -66,6 +69,7 @@ public ZookeeperInstance(ZookeeperInstance other) { this.endpoints = other.endpoints; this.schemas = other.schemas; this.properties = other.properties; + this.status = other.status; } public void setServiceId(String serviceId) { @@ -116,6 +120,10 @@ public void setProperties(Map properties) { this.properties = properties; } + public void setStatus(MicroserviceInstanceStatus status) { + this.status = status; + } + @Override public String getEnvironment() { return this.environment; @@ -143,7 +151,7 @@ public String getVersion() { @Override public DataCenterInfo getDataCenterInfo() { - return dataCenterInfo; + return dataCenterInfo == null ? new DataCenterInfo() : dataCenterInfo; } @Override @@ -187,4 +195,9 @@ public String getInstanceId() { public String getServiceId() { return serviceId; } + + @Override + public MicroserviceInstanceStatus getStatus() { + return this.status; + } } diff --git a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java index c799cc0474a..55df0d42702 100644 --- a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java +++ b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistration.java @@ -79,6 +79,8 @@ public AppConfigurationEntry[] getAppConfigurationEntry(String name) { private RegistrationId registrationId; + private ServiceDiscovery dis; + @Autowired @SuppressWarnings("unused") public void setEnvironment(Environment environment) { @@ -125,6 +127,9 @@ public void init() { } zookeeperInstance.setProperties(BootStrapProperties.readServiceProperties(environment)); zookeeperInstance.setVersion(BootStrapProperties.readServiceVersion(environment)); + + zookeeperInstance.setStatus( + MicroserviceInstanceStatus.valueOf(BootStrapProperties.readServiceInstanceInitialStatus(environment))); try { this.instance = ServiceInstance.builder().name(zookeeperInstance.getServiceName()) .id(zookeeperInstance.getInstanceId()).payload(zookeeperInstance).build(); @@ -155,7 +160,7 @@ public void run() { client.start(); JsonInstanceSerializer serializer = new JsonInstanceSerializer<>(ZookeeperInstance.class); - ServiceDiscovery dis = ServiceDiscoveryBuilder.builder(ZookeeperInstance.class) + dis = ServiceDiscoveryBuilder.builder(ZookeeperInstance.class) .client(client) .basePath(basePath + "/" + BootStrapProperties.readApplication(environment)) .serializer(serializer) @@ -187,7 +192,12 @@ public ZookeeperRegistrationInstance getMicroserviceInstance() { @Override public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) { - // not support yet + this.instance.getPayload().setStatus(status); + try { + dis.updateService(instance); + } catch (Exception e) { + throw new IllegalStateException(e); + } return true; } diff --git a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java index 6c098705b03..e5caed18960 100644 --- a/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java +++ b/service-registry/registry-zookeeper/src/main/java/org/apache/servicecomb/registry/zookeeper/ZookeeperRegistrationInstance.java @@ -16,21 +16,10 @@ */ package org.apache.servicecomb.registry.zookeeper; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; import org.apache.servicecomb.registry.api.RegistrationInstance; public class ZookeeperRegistrationInstance extends ZookeeperInstance implements RegistrationInstance { public ZookeeperRegistrationInstance(ZookeeperInstance instance) { super(instance); } - - @Override - public MicroserviceInstanceStatus getInitialStatus() { - return MicroserviceInstanceStatus.STARTING; - } - - @Override - public MicroserviceInstanceStatus getReadyStatus() { - return MicroserviceInstanceStatus.UP; - } } From 5ee33edcfbb2764894a1e8fc40cf725fbc87cc0b Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Wed, 15 Jan 2025 14:33:53 +0800 Subject: [PATCH 020/223] [#4676] optimized the method of building ServiceCenterClient (#4677) --- .../center/client/ServiceCenterClient.java | 5 ++- .../client/ServiceCenterClientTest.java | 38 +++++++++++-------- .../servicestage/RBACBootStrapService.java | 2 +- .../registry/sc/SCClientUtils.java | 2 +- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 45c4c27dc01..a238d118d2d 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -69,10 +69,11 @@ public class ServiceCenterClient implements ServiceCenterOperation { private EventBus eventBus; - private ServiceCenterAddressManager addressManager; + private final ServiceCenterAddressManager addressManager; - public ServiceCenterClient(ServiceCenterRawClient httpClient) { + public ServiceCenterClient(ServiceCenterRawClient httpClient, ServiceCenterAddressManager addressManager) { this.httpClient = httpClient; + this.addressManager = addressManager; } public ServiceCenterClient setEventBus(EventBus eventBus) { diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java index 12ad9cda3ab..234f2814e13 100755 --- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java +++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java @@ -19,6 +19,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -41,11 +42,18 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializationFeature; +import com.google.common.eventbus.EventBus; /** * Created by on 2019/10/17. */ public class ServiceCenterClientTest { + private final ServiceCenterAddressManager addressManager; + + public ServiceCenterClientTest() { + this.addressManager = new ServiceCenterAddressManager("default", Arrays.asList("http://127.0.0.1:30100"), + new EventBus()); + } @Test public void TestGetServiceCenterInstances() throws IOException { @@ -92,7 +100,7 @@ public void TestGetServiceCenterInstances() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest("/registry/health", null, null)).thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); MicroserviceInstancesResponse serviceCenterInstances = serviceCenterClient.getServiceCenterInstances(); Assertions.assertNotNull(serviceCenterInstances); @@ -121,7 +129,7 @@ public void TestRegistryService() throws IOException { Mockito.anyString())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); RegisteredMicroserviceResponse actualResponse = serviceCenterClient.registerMicroservice(microservice); Assertions.assertNotNull(actualResponse); @@ -179,7 +187,7 @@ public void TestGetServiceMessage() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest("/registry/microservices/111111", null, null)) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); Microservice microservices = serviceCenterClient.getMicroserviceByServiceId("111111"); Assertions.assertNotNull(microservices); @@ -207,7 +215,7 @@ public void TestGetServiceList() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); MicroservicesResponse actualMicroservicesResponse = serviceCenterClient.getMicroserviceList(); Assertions.assertNotNull(actualMicroservicesResponse); @@ -228,7 +236,7 @@ public void TestQueryServiceId() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); Microservice microservice = new Microservice("Test111"); RegisteredMicroserviceResponse actualServiceId = serviceCenterClient.queryServiceId(microservice); @@ -257,7 +265,7 @@ public void TestRegisterServiceInstance() throws IOException { Mockito.anyString())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); RegisteredMicroserviceInstanceResponse actualResponse = serviceCenterClient.registerMicroserviceInstance(instance); Assertions.assertNotNull(actualResponse); @@ -276,7 +284,7 @@ public void TestDeleteServiceInstance() throws IOException { Mockito.when(serviceCenterRawClient.deleteHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); serviceCenterClient.deleteMicroserviceInstance("111", "222"); } @@ -310,7 +318,7 @@ public void TestGetServiceInstanceList() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest("/registry/microservices/222222/instances", null, null)) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); MicroserviceInstancesResponse serviceCenterInstances = serviceCenterClient .getMicroserviceInstanceList("222222"); @@ -364,7 +372,7 @@ public void TestGetServiceInstanceMessage() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); MicroserviceInstance responseInstance = serviceCenterClient .getMicroserviceInstance("111", "222"); @@ -394,7 +402,7 @@ public void TestSendHeartBeats() throws IOException { Mockito.anyString())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); serviceCenterClient.sendHeartBeats(heartbeatsRequest); } @@ -410,7 +418,7 @@ public void TestUpdateServicesInstanceStatus() throws IOException { Mockito.when(serviceCenterRawClient.putHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); Boolean result = serviceCenterClient .updateMicroserviceInstanceStatus("111", "222", MicroserviceInstanceStatus.UP); @@ -440,7 +448,7 @@ public void TestGetServiceSchemas() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); List schemaResponse = serviceCenterClient .getServiceSchemasList("111", false); @@ -468,7 +476,7 @@ public void TestGetServiceSchemasContext() throws IOException { Mockito.when(serviceCenterRawClient.getHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); String schemaContext = serviceCenterClient .getServiceSchemaContext("111", "222"); @@ -488,7 +496,7 @@ public void TestUpdateServiceSchema() throws IOException { Mockito.when(serviceCenterRawClient.putHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); boolean result = serviceCenterClient .updateServiceSchemaContext("111", new SchemaInfo()); @@ -506,7 +514,7 @@ public void testUpdateMicroserviceProperties() throws IOException { Mockito.when(serviceCenterRawClient.putHttpRequest(Mockito.any(), Mockito.any(), Mockito.any())) .thenReturn(httpResponse); - ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient); + ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); boolean result = serviceCenterClient .updateMicroserviceProperties("111", new HashMap()); diff --git a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java index b42ea27e849..7f18cbb6125 100644 --- a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java +++ b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java @@ -81,7 +81,7 @@ public void startup(Environment environment) { new ServiceCenterClient(new ServiceCenterRawClient.Builder() .setTenantName("default") .setAddressManager(addressManager) - .setHttpTransport(createHttpTransport(environment, sslProperties)).build()); + .setHttpTransport(createHttpTransport(environment, sslProperties)).build(), addressManager); Map clients = new HashMap<>(1); clients.put(DEFAULT_REGISTRY_NAME, serviceCenterClient); diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java index b248f467610..4d29de05a2c 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java @@ -66,7 +66,7 @@ public static ServiceCenterClient serviceCenterClient(SCConfigurationProperties return new ServiceCenterClient(new ServiceCenterRawClient.Builder() .setTenantName("default") .setAddressManager(addressManager) - .setHttpTransport(createHttpTransport(environment, sslProperties)).build()); + .setHttpTransport(createHttpTransport(environment, sslProperties)).build(), addressManager); } private static HttpTransport createHttpTransport(Environment environment, SSLProperties sslProperties) { From f3616b7389cb567744578f34fd5538fdc412f4ae Mon Sep 17 00:00:00 2001 From: chenshouye168 Date: Fri, 17 Jan 2025 11:15:48 +0800 Subject: [PATCH 021/223] elegant up or dwon for etcd/consul (#4679) --- .../registry/consul/ConsulDiscoveryInstance.java | 6 ------ .../registry/consul/ConsulInstance.java | 9 ++++++++- .../registry/consul/ConsulRegistration.java | 14 +++++++++++++- .../registry/etcd/EtcdDiscoveryInstance.java | 7 ------- .../servicecomb/registry/etcd/EtcdInstance.java | 9 ++++++++- .../registry/etcd/EtcdRegistration.java | 7 +++++++ 6 files changed, 36 insertions(+), 16 deletions(-) diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java index de3bf9bc20b..f07e4a40543 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscoveryInstance.java @@ -18,7 +18,6 @@ package org.apache.servicecomb.registry.consul; import org.apache.servicecomb.registry.api.DiscoveryInstance; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; public class ConsulDiscoveryInstance extends ConsulInstance implements DiscoveryInstance { @@ -26,11 +25,6 @@ public ConsulDiscoveryInstance(ConsulInstance consulInstance) { super(consulInstance); } - @Override - public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; - } - @Override public String getRegistryName() { return ConsulConst.CONSUL_REGISTRY_NAME; diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java index b29f80e778b..722b3bbe28e 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulInstance.java @@ -51,6 +51,8 @@ public class ConsulInstance implements MicroserviceInstance { private Map properties = new HashMap<>(); + private MicroserviceInstanceStatus status; + public ConsulInstance() { } @@ -68,6 +70,7 @@ public ConsulInstance(ConsulInstance other) { this.endpoints = other.endpoints; this.schemas = other.schemas; this.properties = other.properties; + this.status = other.status; } public void setServiceId(String serviceId) { @@ -118,6 +121,10 @@ public void setProperties(Map properties) { this.properties = properties; } + public void setStatus(MicroserviceInstanceStatus status) { + this.status = status; + } + @Override public String getEnvironment() { return this.environment; @@ -192,6 +199,6 @@ public String getServiceId() { @Override public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; + return this.status; } } diff --git a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java index 122ee5ade40..6458d250fe7 100644 --- a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java +++ b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulRegistration.java @@ -71,6 +71,8 @@ public class ConsulRegistration implements Registration meta = new HashMap<>(); + meta.put("meta", gson.toJson(consulInstance)); + registrationBuilder.meta(meta); + ImmutableRegistration newService = registrationBuilder.build(); + AgentClient agentClient = consulClient.agentClient(); + agentClient.register(newService); return true; } @@ -132,12 +142,14 @@ public void init() { } consulInstance.setProperties(BootStrapProperties.readServiceProperties(environment)); consulInstance.setVersion(BootStrapProperties.readServiceVersion(environment)); + consulInstance.setStatus( + MicroserviceInstanceStatus.valueOf(BootStrapProperties.readServiceInstanceInitialStatus(environment))); } @Override public void run() { LOGGER.info("ConsulRegistration run"); - ImmutableRegistration.Builder registrationBuilder = ImmutableRegistration.builder() + registrationBuilder = ImmutableRegistration.builder() .name(consulInstance.getServiceName()); List endpoints = consulInstance.getEndpoints(); for (String endpoint : endpoints) { diff --git a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdDiscoveryInstance.java b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdDiscoveryInstance.java index 85f5ade0142..d75a3b04cf4 100644 --- a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdDiscoveryInstance.java +++ b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdDiscoveryInstance.java @@ -17,19 +17,12 @@ package org.apache.servicecomb.registry.etcd; import org.apache.servicecomb.registry.api.DiscoveryInstance; -import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; - public class EtcdDiscoveryInstance extends EtcdInstance implements DiscoveryInstance { public EtcdDiscoveryInstance(EtcdInstance other) { super(other); } - @Override - public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; - } - @Override public String getRegistryName() { return EtcdConst.ETCD_REGISTRY_NAME; diff --git a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java index 99ab793fff3..071e84bf3bc 100644 --- a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java +++ b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdInstance.java @@ -50,6 +50,8 @@ public class EtcdInstance implements MicroserviceInstance { private Map properties = new HashMap<>(); + private MicroserviceInstanceStatus status; + public EtcdInstance() { } @@ -67,6 +69,7 @@ public EtcdInstance(EtcdInstance other) { this.endpoints = other.endpoints; this.schemas = other.schemas; this.properties = other.properties; + this.status = other.status; } public void setServiceId(String serviceId) { @@ -117,6 +120,10 @@ public void setProperties(Map properties) { this.properties = properties; } + public void setStatus(MicroserviceInstanceStatus status) { + this.status = status; + } + @Override public String getEnvironment() { return this.environment; @@ -191,7 +198,7 @@ public String getServiceId() { @Override public MicroserviceInstanceStatus getStatus() { - return MicroserviceInstanceStatus.UP; + return this.status; } @Override diff --git a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistration.java b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistration.java index 7f021f7b677..3fabfac4e23 100644 --- a/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistration.java +++ b/service-registry/registry-etcd/src/main/java/org/apache/servicecomb/registry/etcd/EtcdRegistration.java @@ -98,6 +98,11 @@ public EtcdRegistrationInstance getMicroserviceInstance() { @Override public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status) { + this.etcdInstance.setStatus(status); + String valueJson = MuteExceptionUtil.builder().withLog("to json, key:{}, value:{}", keyPath, etcdInstance) + .executeFunction(JsonUtils::writeValueAsString, etcdInstance); + register(ByteSequence.from(keyPath, Charset.defaultCharset()), + ByteSequence.from(valueJson, Charset.defaultCharset())); return true; } @@ -146,6 +151,8 @@ public void init() { } etcdInstance.setProperties(BootStrapProperties.readServiceProperties(environment)); etcdInstance.setVersion(BootStrapProperties.readServiceVersion(environment)); + etcdInstance.setStatus( + MicroserviceInstanceStatus.valueOf(BootStrapProperties.readServiceInstanceInitialStatus(environment))); } @Override From 2ec1cc016eaf1ee095782ea90e2b75a3fbffa944 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Sat, 18 Jan 2025 15:14:05 +0800 Subject: [PATCH 022/223] [#4678] optimized sc/kie/config-center isolation address check logic (#4680) --- .../center/client/ConfigCenterClient.java | 24 ++---- .../center/client/ConfigCenterManager.java | 2 +- .../center/client/ConfigCenterOperation.java | 3 +- .../config/kie/client/KieClient.java | 18 ++--- .../config/kie/client/KieConfigManager.java | 10 +-- .../config/kie/client/KieConfigOperation.java | 3 +- .../client/common/AbstractAddressManager.java | 6 +- .../ServiceCombServiceAvailableUtils.java | 80 +++++++++++++++++++ .../common/AbstractAddressManagerTest.java | 4 +- .../center/client/ServiceCenterClient.java | 2 +- .../center/client/ServiceCenterRawClient.java | 15 ++-- 11 files changed, 106 insertions(+), 61 deletions(-) create mode 100644 clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/utils/ServiceCombServiceAvailableUtils.java diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java index 4232c3db581..00889cbf63b 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java @@ -30,6 +30,7 @@ import org.apache.servicecomb.http.client.common.HttpResponse; import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpUtils; +import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,6 +50,8 @@ public class ConfigCenterClient implements ConfigCenterOperation { public static final String DARK_LAUNCH = "darklaunch@"; + private static final String ADDRESS_CHECK_PATH = "/v3/default/configuration/health?mode=readiness"; + private final HttpTransport httpTransport; private final ConfigCenterAddressManager addressManager; @@ -133,25 +136,8 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques } @Override - public void checkAddressAvailable(QueryConfigurationsRequest request, String address) { - String dimensionsInfo = buildDimensionsInfo(request, true); - try { - String uri = address + "/configuration/items?dimensionsInfo=" - + HttpUtils.encodeURLParam(dimensionsInfo) + "&revision=" + request.getRevision(); - - Map headers = new HashMap<>(); - headers.put("x-environment", request.getEnvironment()); - HttpRequest httpRequest = new HttpRequest(uri, headers, null, - HttpRequest.GET); - - HttpResponse httpResponse = httpTransport.doRequest(httpRequest); - if (httpResponse.getStatusCode() == HttpStatus.SC_NOT_MODIFIED - || httpResponse.getStatusCode() == HttpStatus.SC_OK) { - addressManager.recoverIsolatedAddress(address); - } - } catch (Exception e) { - LOGGER.error("check config center isolation address {} available error!", address); - } + public void checkAddressAvailable(String address) { + ServiceCombServiceAvailableUtils.checkAddressAvailable(addressManager, address, httpTransport, ADDRESS_CHECK_PATH); } private String buildDimensionsInfo(QueryConfigurationsRequest request, boolean withVersion) { diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java index 66ee21621ed..6dadab7b134 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java @@ -105,7 +105,7 @@ public void run() { return; } for (String address : isolationAddresses) { - configCenterClient.checkAddressAvailable(queryConfigurationsRequest, address); + configCenterClient.checkAddressAvailable(address); } } } diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterOperation.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterOperation.java index 43b30c74831..919e9f30cd7 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterOperation.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterOperation.java @@ -34,8 +34,7 @@ public interface ConfigCenterOperation { /** * Check config center isolation address available * - * @param request queryConfigurationsRequest * @param address isolation address */ - void checkAddressAvailable(QueryConfigurationsRequest request, String address); + void checkAddressAvailable(String address); } diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java index b44ed0b1a25..49f81989ad8 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java @@ -19,7 +19,6 @@ import com.google.common.eventbus.EventBus; -import java.io.IOException; import java.io.StringReader; import java.nio.charset.StandardCharsets; import java.util.Collections; @@ -45,6 +44,7 @@ import org.apache.servicecomb.http.client.common.HttpResponse; import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpUtils; +import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; @@ -54,6 +54,8 @@ public class KieClient implements KieConfigOperation { private static final Logger LOGGER = LoggerFactory.getLogger(KieClient.class); + private static final String ADDRESS_CHECK_PATH = "/v1/health"; + protected HttpTransport httpTransport; protected String revision = "0"; @@ -115,18 +117,8 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, } @Override - public void checkAddressAvailable(ConfigurationsRequest request, String address) { - String url = buildUrl(request, address); - HttpRequest httpRequest = new HttpRequest(url, null, null, HttpRequest.GET); - try { - HttpResponse httpResponse = httpTransport.doRequest(httpRequest); - if (httpResponse.getStatusCode() == HttpStatus.SC_NOT_MODIFIED - || httpResponse.getStatusCode() == HttpStatus.SC_OK) { - addressManager.recoverIsolatedAddress(address); - } - } catch (IOException e) { - LOGGER.error("check kie config isolation address {} available error!", address); - } + public void checkAddressAvailable(String address) { + ServiceCombServiceAvailableUtils.checkAddressAvailable(addressManager, address, httpTransport, ADDRESS_CHECK_PATH); } private String buildUrl(ConfigurationsRequest request, String currentAddress) { diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java index d6ed9ca0e7f..c2222a6a117 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java @@ -124,7 +124,7 @@ protected void initTaskPool(String taskName) { public void startConfigKieManager() { this.configurationsRequests.forEach((t) -> this.startTask(new PollConfigurationTask(0, t))); - schedulerCheckAddressAvailable("kie-addr-check", new CheckKieAddressTask(configurationsRequests.get(0)), + schedulerCheckAddressAvailable("kie-addr-check", new CheckKieAddressTask(), kieConfiguration.getRefreshIntervalInMillis()); } @@ -164,12 +164,6 @@ public void execute() { } class CheckKieAddressTask implements Runnable { - ConfigurationsRequest configurationsRequest; - - public CheckKieAddressTask(ConfigurationsRequest configurationsRequest) { - this.configurationsRequest = configurationsRequest; - } - @Override public void run() { List isolationAddresses = kieAddressManager.getIsolationAddresses(); @@ -177,7 +171,7 @@ public void run() { return; } for (String address : isolationAddresses) { - configKieClient.checkAddressAvailable(this.configurationsRequest, address); + configKieClient.checkAddressAvailable(address); } } } diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java index 44f66137fef..135ad0c220a 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigOperation.java @@ -35,8 +35,7 @@ public interface KieConfigOperation { /** * Check kie isolation address available * - * @param configurationsRequest configurationsRequest * @param address isolation address */ - void checkAddressAvailable(ConfigurationsRequest configurationsRequest, String address); + void checkAddressAvailable(String address); } diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java index 5c4bc71dc8e..ae94e5d5f16 100644 --- a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java @@ -194,8 +194,8 @@ private List getZoneOrRegionAddress() { return results; } - public void recoverIsolatedAddress(String address) { - recordSuccessState(address); + public void recordSuccessState(String address) { + resetFailureStatus(address); if (addressAutoRefreshed) { if (isolationZoneAddress.remove(address)) { LOGGER.warn("restore same region address [{}]", address); @@ -217,7 +217,7 @@ public void recoverIsolatedAddress(String address) { } } - public void recordSuccessState(String address) { + public void resetFailureStatus(String address) { addressFailureStatus.put(address, 0); } diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/utils/ServiceCombServiceAvailableUtils.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/utils/ServiceCombServiceAvailableUtils.java new file mode 100644 index 00000000000..9139e65f96a --- /dev/null +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/utils/ServiceCombServiceAvailableUtils.java @@ -0,0 +1,80 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.http.client.utils; + +import org.apache.http.HttpStatus; +import org.apache.servicecomb.http.client.common.AbstractAddressManager; +import org.apache.servicecomb.http.client.common.HttpRequest; +import org.apache.servicecomb.http.client.common.HttpResponse; +import org.apache.servicecomb.http.client.common.HttpTransport; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.URI; +import java.net.URISyntaxException; + +public class ServiceCombServiceAvailableUtils { + private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCombServiceAvailableUtils.class); + + public static void checkAddressAvailable(AbstractAddressManager addressManager, String address, + HttpTransport httpTransport, String path) { + String formatUrl = addressManager.formatUrl(path, true, address); + HttpRequest httpRequest = new HttpRequest(formatUrl, null, null, HttpRequest.GET); + try { + HttpResponse response = httpTransport.doRequest(httpRequest); + if (response.getStatusCode() == HttpStatus.SC_OK) { + addressManager.recordSuccessState(address); + return; + } + + // old server does not provide the check api, using TCP checks whether the server is ready. + if (response.getStatusCode() == HttpStatus.SC_NOT_FOUND && telnetCheckAddress(address)) { + LOGGER.warn("[{}] path does not provide, tcp check address ready!", path); + addressManager.recordSuccessState(address); + } + } catch (IOException e) { + LOGGER.error("check isolation address [{}] available error!", address); + } + } + + private static boolean telnetCheckAddress(String address) { + URI ipPort = parseIpPortFromURI(address); + if (ipPort == null) { + return false; + } + try (Socket s = new Socket()) { + s.connect(new InetSocketAddress(ipPort.getHost(), ipPort.getPort()), 3000); + return true; + } catch (IOException e) { + LOGGER.warn("ping endpoint {} failed, It will be quarantined again.", address); + } + return false; + } + + private static URI parseIpPortFromURI(String address) { + try { + return new URI(address); + } catch (URISyntaxException e) { + LOGGER.error("build uri error with address [{}].", address); + return null; + } + } +} diff --git a/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java b/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java index 83406ec747e..b831d032491 100644 --- a/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java +++ b/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java @@ -101,7 +101,7 @@ public void recordStateTest() throws ExecutionException { Assertions.assertEquals("http://127.0.0.3:30100", addressManager.address()); // test fail 2 times ,it will not be isolated - addressManager.recordSuccessState(address); + addressManager.resetFailureStatus(address); Assertions.assertEquals("http://127.0.0.3:30100", addressManager.address()); // test recodeStatus times @@ -115,7 +115,7 @@ public void recordStateTest() throws ExecutionException { Assertions.assertEquals("http://127.0.0.4:30100", addressManager.address()); // test restore isolation - addressManager.recoverIsolatedAddress("http://127.0.0.3:30100"); + addressManager.recordSuccessState("http://127.0.0.3:30100"); Assertions.assertEquals("http://127.0.0.3:30100", addressManager.address()); Assertions.assertEquals("http://127.0.0.3:30100", addressManager.address()); } diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index a238d118d2d..446f9749324 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -562,7 +562,7 @@ public void checkIsolationAddressAvailable() { return; } for (String address : isolationAddresses) { - httpClient.checkAddressAvailable("/registry/microservices", null, null, address); + httpClient.checkAddressAvailable(address); } } } diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClient.java index e95240bb3c5..a8dc9963b7d 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClient.java @@ -24,6 +24,7 @@ import org.apache.servicecomb.http.client.common.HttpRequest; import org.apache.servicecomb.http.client.common.HttpResponse; import org.apache.servicecomb.http.client.common.HttpTransport; +import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,6 +33,8 @@ public class ServiceCenterRawClient { private static final String HEADER_TENANT_NAME = "x-domain-name"; + private static final String ADDRESS_CHECK_PATH = "/v4/default/registry/health/readiness"; + private final String tenantName; private final HttpTransport httpTransport; @@ -93,16 +96,8 @@ private HttpResponse doHttpRequest(String url, boolean absoluteUrl, Map headers, String content, - String address) { - String formatUrl = addressManager.formatUrl(url, false, address); - HttpRequest httpRequest = buildHttpRequest(formatUrl, headers, content, HttpRequest.GET); - try { - httpTransport.doRequest(httpRequest); - addressManager.recoverIsolatedAddress(address); - } catch (IOException e) { - LOGGER.error("check service center isolation address {} available error!", address); - } + public void checkAddressAvailable(String address) { + ServiceCombServiceAvailableUtils.checkAddressAvailable(addressManager, address, httpTransport, ADDRESS_CHECK_PATH); } private HttpRequest buildHttpRequest(String url, Map headers, String content, String method) { From 8afd4d4845335a271d9521309e9b41e7444f57af Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Wed, 22 Jan 2025 15:37:51 +0800 Subject: [PATCH 023/223] [#4682] Support framework information can be updated when service information is updated (#4683) --- .../service/center/client/ServiceCenterClient.java | 5 ++++- .../service/center/client/ServiceCenterOperation.java | 4 +++- .../center/client/ServiceCenterRegistration.java | 2 +- .../center/client/model/UpdatePropertiesRequest.java | 10 ++++++++++ .../service/center/client/ServiceCenterClientTest.java | 3 ++- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 446f9749324..19b6b80f621 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -39,6 +39,7 @@ import org.apache.servicecomb.service.center.client.model.CreateSchemaRequest; import org.apache.servicecomb.service.center.client.model.ErrorMessage; import org.apache.servicecomb.service.center.client.model.FindMicroserviceInstancesResponse; +import org.apache.servicecomb.service.center.client.model.Framework; import org.apache.servicecomb.service.center.client.model.GetSchemaListResponse; import org.apache.servicecomb.service.center.client.model.GetSchemaResponse; import org.apache.servicecomb.service.center.client.model.HeartbeatsRequest; @@ -535,10 +536,12 @@ public RbacTokenResponse queryToken(RbacTokenRequest request) { } @Override - public boolean updateMicroserviceProperties(String serviceId, Map serviceProperties) { + public boolean updateMicroserviceProperties(String serviceId, Map serviceProperties, + Framework framework) { try { UpdatePropertiesRequest request = new UpdatePropertiesRequest(); request.setProperties(serviceProperties); + request.setFramework(framework); HttpResponse response = httpClient.putHttpRequest( "/registry/microservices/" + serviceId + "/properties", null, HttpUtils.serialize(request)); if (response.getStatusCode() == HttpStatus.SC_OK) { diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java index f296e66fae9..85671fee9c9 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java @@ -23,6 +23,7 @@ import org.apache.servicecomb.service.center.client.exception.OperationException; import org.apache.servicecomb.service.center.client.model.CreateSchemaRequest; import org.apache.servicecomb.service.center.client.model.FindMicroserviceInstancesResponse; +import org.apache.servicecomb.service.center.client.model.Framework; import org.apache.servicecomb.service.center.client.model.HeartbeatsRequest; import org.apache.servicecomb.service.center.client.model.Microservice; import org.apache.servicecomb.service.center.client.model.MicroserviceInstance; @@ -192,7 +193,8 @@ boolean updateMicroserviceInstanceStatus(String serviceId, String instanceId, * @return if update is successful * @throws OperationException If some problems happened to contact service center or non http 200 returned. */ - boolean updateMicroserviceProperties(String microserviceId, Map serviceProperties); + boolean updateMicroserviceProperties(String microserviceId, Map serviceProperties, + Framework framework); /** * Check serviceCenter isolation address available diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java index 3f455250270..0f24d985d57 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java @@ -148,7 +148,7 @@ public void execute() { microservice.setProperties(newMicroservice.getProperties()); microservice.getProperties().putAll(propertiesTemp); if (serviceCenterClient.updateMicroserviceProperties(serviceResponse.getServiceId(), - microservice.getProperties())) { + microservice.getProperties(), microservice.getFramework())) { LOGGER.info( "microservice is already registered. Update microservice properties successfully. properties=[{}]", microservice.getProperties()); diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/model/UpdatePropertiesRequest.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/model/UpdatePropertiesRequest.java index b10586208a8..d7d4b093930 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/model/UpdatePropertiesRequest.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/model/UpdatePropertiesRequest.java @@ -22,6 +22,8 @@ public class UpdatePropertiesRequest { private Map properties; + private Framework framework; + public Map getProperties() { return properties; } @@ -29,4 +31,12 @@ public Map getProperties() { public void setProperties(Map properties) { this.properties = properties; } + + public Framework getFramework() { + return framework; + } + + public void setFramework(Framework framework) { + this.framework = framework; + } } diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java index 234f2814e13..6143953f3db 100755 --- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java +++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java @@ -24,6 +24,7 @@ import java.util.List; import org.apache.servicecomb.http.client.common.HttpResponse; +import org.apache.servicecomb.service.center.client.model.Framework; import org.apache.servicecomb.service.center.client.model.HeartbeatsRequest; import org.apache.servicecomb.service.center.client.model.InstancesRequest; import org.apache.servicecomb.service.center.client.model.Microservice; @@ -516,7 +517,7 @@ public void testUpdateMicroserviceProperties() throws IOException { ServiceCenterClient serviceCenterClient = new ServiceCenterClient(serviceCenterRawClient, addressManager); boolean result = serviceCenterClient - .updateMicroserviceProperties("111", new HashMap()); + .updateMicroserviceProperties("111", new HashMap(), new Framework()); Assertions.assertTrue(result); } From caca8a19ea21f376feaa30b914ef3ec8e5383fbc Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 24 Jan 2025 09:04:59 +0800 Subject: [PATCH 024/223] [#4685] Print the framework version when updating the service information (#4686) --- .../service/center/client/ServiceCenterRegistration.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java index 0f24d985d57..07d8337581c 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java @@ -150,11 +150,11 @@ public void execute() { if (serviceCenterClient.updateMicroserviceProperties(serviceResponse.getServiceId(), microservice.getProperties(), microservice.getFramework())) { LOGGER.info( - "microservice is already registered. Update microservice properties successfully. properties=[{}]", - microservice.getProperties()); + "microservice is already registered. Update microservice properties successfully. properties=[{}], " + + "frameworkVersion [{}]", microservice.getProperties(), microservice.getFramework().getVersion()); } else { - LOGGER.error("microservice is already registered. Update microservice properties failed. properties=[{}]", - microservice.getProperties()); + LOGGER.error("microservice is already registered. Update microservice properties failed. properties=[{}], " + + "frameworkVersion [{}]", microservice.getProperties(), microservice.getFramework().getVersion()); } microservice.setServiceId(serviceResponse.getServiceId()); From 5055d1a3450cbf701c35dc29560e4030909f4a40 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Thu, 6 Feb 2025 09:59:30 +0800 Subject: [PATCH 025/223] [#4690] fixed mixin-maven-plugin not work with maven 3.9.9+ and 4.0.0+ problem (#4707) --- .github/workflows/maven.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7b2ef9f23d5..dbb4ed17f4a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -38,6 +38,10 @@ jobs: with: java-version: '17' distribution: 'temurin' + - name: Set up Maven + uses: stCarolas/setup-maven@v4.5 + with: + maven-version: 3.8.4 - uses: actions/cache@v4 with: path: ~/.m2/repository From be10defda6ce075bec700fe8f48cbadbd3e35fe3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 12:00:55 +0800 Subject: [PATCH 026/223] Bump io.zipkin.zipkin2:zipkin from 3.4.3 to 3.4.4 (#4705) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 8a74c314837..287038190d9 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 6.1.10 2.2.27 4.5.11 - 3.4.3 + 3.4.4 3.4.0 0.8.4 1.4.2 From 74137b28e8d7e31d4a32e549fb5b8f8be15bfedd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:22:08 +0800 Subject: [PATCH 027/223] Bump com.puppycrawl.tools:checkstyle from 10.21.1 to 10.21.2 (#4703) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 72091c3ea2b..e5197ced9de 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.21.1 + 10.21.2 3.1.1 3.21.0 3.3.0 From d17101ed56e7e1a8b3856397a04c1f11d42eb881 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:22:24 +0800 Subject: [PATCH 028/223] Bump org.kiwiproject:consul-client from 1.4.2 to 1.4.5 (#4702) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 287038190d9..075551a2c41 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -92,7 +92,7 @@ 3.4.4 3.4.0 0.8.4 - 1.4.2 + 1.4.5 ${basedir}/../.. From 80efa4ba8eafc5ddd202b1e45e5a7549d8c2be7b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:46:24 +0800 Subject: [PATCH 029/223] Bump org.assertj:assertj-core from 3.27.0 to 3.27.3 (#4701) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 075551a2c41..a924d40d354 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -32,7 +32,7 @@ 1.2.2 - 3.27.0 + 3.27.3 4.2.2 6.0.3 1.9.4 From 41c2b56ccc5e2afd17e7530f8eeaa797993ab810 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:50:50 +0800 Subject: [PATCH 030/223] Bump org.owasp:dependency-check-maven from 11.1.1 to 12.0.2 (#4700) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e5197ced9de..5234b38732c 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 11.1.1 + 12.0.2 0.45.1 3.5.0 3.2.7 From 95d3cbc474a3a094a73e71e5091bcffc5bc42817 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 14:51:32 +0800 Subject: [PATCH 031/223] Bump vertx.version from 4.5.11 to 4.5.12 (#4691) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a924d40d354..e3e394dc3e7 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -88,7 +88,7 @@ 2.3 6.1.10 2.2.27 - 4.5.11 + 4.5.12 3.4.4 3.4.0 0.8.4 From 29d3fc44defd27306454dcc4f0dc9de49ae9a0fe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:44:41 +0800 Subject: [PATCH 032/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.27 to 2.2.28 (#4699) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e3e394dc3e7..89877198a1e 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -87,7 +87,7 @@ 1.7.36 2.3 6.1.10 - 2.2.27 + 2.2.28 4.5.12 3.4.4 3.4.0 From 25254819443425ba2819b0f40c1d58e7e9a238cb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 15:44:52 +0800 Subject: [PATCH 033/223] Bump io.netty:netty-bom from 4.1.116.Final to 4.1.117.Final (#4695) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 89877198a1e..440166ce542 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -71,7 +71,7 @@ 5.15.0 2.4.3 0.3.0 - 4.1.116.Final + 4.1.117.Final 4.12.0 0.16.0 3.23.4 From e6b2dc28e55dd0dc8f5d0635cef714ee31e3ec9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 17:21:14 +0800 Subject: [PATCH 034/223] Bump org.mockito:mockito-bom from 5.14.2 to 5.15.2 (#4698) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 440166ce542..6cb22e7e6e3 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -66,7 +66,7 @@ 2.24.3 3.9.9 1.14.2 - 5.14.2 + 5.15.2 5.2.0 5.15.0 2.4.3 From ed1d1f97e4436d98220e6d11ad1f5eb0393d4156 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Feb 2025 19:31:28 +0800 Subject: [PATCH 035/223] Bump commons-beanutils:commons-beanutils from 1.9.4 to 1.10.0 (#4696) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 6cb22e7e6e3..ccf8a44d085 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -35,7 +35,7 @@ 3.27.3 4.2.2 6.0.3 - 1.9.4 + 1.10.0 2.18.0 2.6 3.17.0 From e040efe9239fa68fe1f2e7e6820ad9617c706d5c Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Fri, 7 Feb 2025 16:30:21 +0800 Subject: [PATCH 036/223] refactor(loadbalance): Refactor load balancing filter enabling logic (#4709) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * refactor(loadbalance): 重构负载均衡过滤器启用逻辑 -优化了 InstancePropertyDiscoveryFilter、PriorityInstancePropertyDiscoveryFilter 和 ZoneAwareDiscoveryFilter 的启用逻辑 - 使用 DynamicProperties 替代 Environment 获取配置属性 - 添加了对配置属性的缓存,避免重复获取 - 调整了配置属性的默认值 * test(foundation-registry): 重构测试用例中环境属性的获取 - 引入 DynamicProperties 类以替代 Environment 类 - 使用动态属性获取替代静态属性获取 - 增加对属性默认值的处理 * refactor(registry): 重构发现过滤器中的属性获取方式 - 将 Environment 和 DynamicProperties 的使用方式统一为 DynamicProperties -优化了属性获取逻辑,使用动态属性替换静态属性 - 移除了冗余代码,提高了代码的可读性和可维护性 * refactor(loadbalance): 使用 DynamicProperties 替代 Environment - 在 ZoneAwareDiscoveryFilter 中引入 DynamicProperties以替代 Environment - 更新相关测试用例,使用 DynamicProperties 进行配置模拟 - 移除 TestDiscoveryTree 中的冗余代码 - 优化测试用例中的断言逻辑 * refactor(loadbalance): 重构优先级实例属性发现过滤器 - 移除了 PriorityInstancePropertyDiscoveryFilter 类中的冗余代码 - 更新了单元测试,使用 DynamicProperties替代 Environment 获取配置属性 - 优化了测试代码,提高了可维护性和可读性 * refactor(loadbalance): 优化负载均衡过滤器配置 - 将字符串键值对配置改为静态常量 - 更新配置获取方式,使用静态常量作为键 - 优化配置类结构,提高可读性和维护性 * fix(config-etcd): 修复 EtcdConfig 默认连接字符串并统一命名风格 - 将 EtcdConfig 类中的属性名称从连字符风格改为驼峰风格 - 修改默认连接字符串从 ZooKeeper 地址改为 Etcd 默认地址 - 在 demo-etcd 的 pom 文件中添加新的配置属性 --- demo/demo-etcd/consumer/pom.xml | 4 ++ .../src/main/resources/application.yml | 3 ++ demo/demo-etcd/test-client/pom.xml | 1 + .../servicecomb/config/etcd/EtcdConfig.java | 14 +++---- .../config/DynamicPropertiesImpl.java | 14 +++---- .../discovery/AbstractDiscoveryFilter.java | 10 +++-- .../InstanceStatusDiscoveryFilter.java | 10 ++++- .../registry/discovery/TestDiscoveryTree.java | 11 ++--- .../loadbalance/Configuration.java | 1 - .../InstancePropertyDiscoveryFilter.java | 14 +++++-- ...iorityInstancePropertyDiscoveryFilter.java | 21 +++++++--- .../filter/ZoneAwareDiscoveryFilter.java | 32 ++++++++++++--- .../loadbalance/TestLoadBalanceFilter2.java | 36 +++++++++++----- ...tyInstancePropertyDiscoveryFilterTest.java | 9 +++- .../filter/TestZoneAwareDiscoveryFilter.java | 41 ++++++++++++------- 15 files changed, 154 insertions(+), 67 deletions(-) diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 5f79529d65c..0c9ed7794b0 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -44,6 +44,10 @@ org.apache.servicecomb registry-etcd + + org.apache.servicecomb + config-etcd + diff --git a/demo/demo-etcd/consumer/src/main/resources/application.yml b/demo/demo-etcd/consumer/src/main/resources/application.yml index a63a165189e..e0db5f1434e 100644 --- a/demo/demo-etcd/consumer/src/main/resources/application.yml +++ b/demo/demo-etcd/consumer/src/main/resources/application.yml @@ -25,6 +25,9 @@ servicecomb: registry: etcd: connectString: http://127.0.0.1:2379 + config: + etcd: + connectString: http://127.0.0.1:2379 rest: address: 0.0.0.0:9092?websocketEnabled=true diff --git a/demo/demo-etcd/test-client/pom.xml b/demo/demo-etcd/test-client/pom.xml index d14d1b1c45f..41a0813cfce 100644 --- a/demo/demo-etcd/test-client/pom.xml +++ b/demo/demo-etcd/test-client/pom.xml @@ -128,6 +128,7 @@ -Dservicecomb.registry.etcd.connectString=http://etcd:2379 + -Dservicecomb.config.etcd.connectString=http://etcd:2379 /maven/maven/etcd-consumer-${project.version}.jar diff --git a/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdConfig.java b/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdConfig.java index 57713eed069..ee04204c28a 100644 --- a/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdConfig.java +++ b/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdConfig.java @@ -21,17 +21,17 @@ public class EtcdConfig { public static final String ZOOKEEPER_DEFAULT_ENVIRONMENT = "production"; - public static final String PROPERTY_CONNECT_STRING = "servicecomb.config.etcd.connect-string"; + public static final String PROPERTY_CONNECT_STRING = "servicecomb.config.etcd.connectString"; - public static final String PROPERTY_SESSION_TIMEOUT = "servicecomb.config.etcd.session-timeout-millis"; + public static final String PROPERTY_SESSION_TIMEOUT = "servicecomb.config.etcd.sessionTimeoutMillis"; - public static final String PROPERTY_CONNECTION_TIMEOUT = "servicecomb.config.etcd.connection-timeout-mills"; + public static final String PROPERTY_CONNECTION_TIMEOUT = "servicecomb.config.etcd.connectionTimeoutMills"; - public static final String PROPERTY_AUTH_SCHEMA = "servicecomb.config.etcd.authentication-schema"; + public static final String PROPERTY_AUTH_SCHEMA = "servicecomb.config.etcd.authenticationSchema"; - public static final String PROPERTY_AUTH_INFO = "servicecomb.config.etcd.authentication-info"; + public static final String PROPERTY_AUTH_INFO = "servicecomb.config.etcd.authenticationInfo"; - public static final String PROPERTY_INSTANCE_TAG = "servicecomb.config.etcd.instance-tag"; + public static final String PROPERTY_INSTANCE_TAG = "servicecomb.config.etcd.instanceTag"; private final Environment environment; @@ -40,7 +40,7 @@ public EtcdConfig(Environment environment) { } public String getConnectString() { - return environment.getProperty(PROPERTY_CONNECT_STRING, "127.0.0.1:2181"); + return environment.getProperty(PROPERTY_CONNECT_STRING, "http://127.0.0.1:2379"); } public int getSessionTimeoutMillis() { diff --git a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicPropertiesImpl.java b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicPropertiesImpl.java index 84f623d74d9..323e84d80aa 100644 --- a/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicPropertiesImpl.java +++ b/foundations/foundation-config/src/main/java/org/apache/servicecomb/config/DynamicPropertiesImpl.java @@ -17,11 +17,11 @@ package org.apache.servicecomb.config; -import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.function.Consumer; import java.util.function.DoubleConsumer; import java.util.function.IntConsumer; @@ -44,17 +44,17 @@ private static class Holder { } } - private final Map, String>>> stringCallbacks = new HashMap<>(); + private final Map, String>>> stringCallbacks = new ConcurrentHashMap<>(); - private final Map>> intCallbacks = new HashMap<>(); + private final Map>> intCallbacks = new ConcurrentHashMap<>(); - private final Map>> longCallbacks = new HashMap<>(); + private final Map>> longCallbacks = new ConcurrentHashMap<>(); - private final Map>> floatCallbacks = new HashMap<>(); + private final Map>> floatCallbacks = new ConcurrentHashMap<>(); - private final Map>> doubleCallbacks = new HashMap<>(); + private final Map>> doubleCallbacks = new ConcurrentHashMap<>(); - private final Map, Boolean>>> booleanCallbacks = new HashMap<>(); + private final Map, Boolean>>> booleanCallbacks = new ConcurrentHashMap<>(); private final Environment environment; diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/AbstractDiscoveryFilter.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/AbstractDiscoveryFilter.java index 5883ec51bf3..f274799c30e 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/AbstractDiscoveryFilter.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/AbstractDiscoveryFilter.java @@ -19,19 +19,21 @@ import java.util.ArrayList; +import org.apache.servicecomb.config.DynamicProperties; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.core.env.Environment; public abstract class AbstractDiscoveryFilter implements DiscoveryFilter { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractDiscoveryFilter.class); - protected Environment environment; + protected Boolean enabled; + + protected DynamicProperties dynamicProperties; @Autowired - public void setEnvironment(Environment environment) { - this.environment = environment; + public void setDynamicProperties(DynamicProperties dynamicProperties) { + this.dynamicProperties = dynamicProperties; } @Override diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java index dd27dc973c8..e7a4029bdeb 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/discovery/InstanceStatusDiscoveryFilter.java @@ -32,6 +32,8 @@ public class InstanceStatusDiscoveryFilter extends AbstractGroupDiscoveryFilter public static final String GROUP_SIZE = "status_group_size"; + public static final String SERVICECOMB_LOADBALANCE_FILTER_STATUS_ENABLED = "servicecomb.loadbalance.filter.status.enabled"; + @Override public int getOrder() { return -10000; @@ -39,7 +41,13 @@ public int getOrder() { @Override public boolean enabled() { - return environment.getProperty("servicecomb.loadbalance.filter.status.enabled", Boolean.class, true); + + if (enabled == null) { + enabled = dynamicProperties.getBooleanProperty(SERVICECOMB_LOADBALANCE_FILTER_STATUS_ENABLED, + value -> enabled = value, + true); + } + return enabled; } @Override diff --git a/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestDiscoveryTree.java b/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestDiscoveryTree.java index a30b892f8b4..d726d1b59c0 100644 --- a/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestDiscoveryTree.java +++ b/foundations/foundation-registry/src/test/java/org/apache/servicecomb/registry/discovery/TestDiscoveryTree.java @@ -24,6 +24,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import org.apache.servicecomb.config.DynamicProperties; import org.apache.servicecomb.foundation.common.cache.VersionedCache; import org.apache.servicecomb.foundation.common.exceptions.ServiceCombException; import org.apache.servicecomb.registry.DiscoveryManager; @@ -32,7 +33,6 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import org.springframework.core.env.Environment; public class TestDiscoveryTree { DiscoveryContext context = new DiscoveryContext(); @@ -238,11 +238,12 @@ public void test_one_service_concurrent_correct() throws Exception { DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); DiscoveryContext discoveryContext = new DiscoveryContext(); InstanceStatusDiscoveryFilter filter = new InstanceStatusDiscoveryFilter(); - Environment environment = Mockito.mock(Environment.class); - Mockito.when(environment - .getProperty("servicecomb.loadbalance.filter.status.enabled", Boolean.class, true)) + DynamicProperties dynamicProperties = Mockito.mock(DynamicProperties.class); + Mockito.when(dynamicProperties.getBooleanProperty(Mockito.eq("servicecomb.loadbalance.filter.status.enabled"), + Mockito.any(), + Mockito.eq(true))) .thenReturn(true); - filter.setEnvironment(environment); + filter.setDynamicProperties(dynamicProperties); discoveryTree.setDiscoveryFilters(List.of(filter)); StatefulDiscoveryInstance instance1 = Mockito.mock(StatefulDiscoveryInstance.class); diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java index 5f766e8855e..87a527c9aff 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/Configuration.java @@ -25,7 +25,6 @@ /** * configuration items - * */ public final class Configuration { //// 2.1 configuration items diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/InstancePropertyDiscoveryFilter.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/InstancePropertyDiscoveryFilter.java index d3811d3a725..2b4c3eb6b20 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/InstancePropertyDiscoveryFilter.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/InstancePropertyDiscoveryFilter.java @@ -30,11 +30,14 @@ import org.apache.servicecomb.registry.discovery.StatefulDiscoveryInstance; /** - * Instance property based filter + * Instance property based filter */ public class InstancePropertyDiscoveryFilter extends AbstractDiscoveryFilter { + private static final String MATCHED = "matched"; + public static final String SERVICECOMB_LOADBALANCE_FILTER_INSTANCE_PROPERTY_ENABLED = "servicecomb.loadbalance.filter.instanceProperty.enabled"; + @Override public int getOrder() { return 400; @@ -42,8 +45,13 @@ public int getOrder() { @Override public boolean enabled() { - return environment.getProperty("servicecomb.loadbalance.filter.instanceProperty.enabled", - boolean.class, true); + + if (enabled == null) { + enabled = dynamicProperties.getBooleanProperty(SERVICECOMB_LOADBALANCE_FILTER_INSTANCE_PROPERTY_ENABLED, + value -> enabled = value, + true); + } + return enabled; } @Override diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilter.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilter.java index 7dbe070237d..d890b7ea229 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilter.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilter.java @@ -47,6 +47,8 @@ public class PriorityInstancePropertyDiscoveryFilter extends AbstractDiscoveryFi private static final String ALL_INSTANCE = "allInstance"; + public static final String SERVICECOMB_LOADBALANCE_FILTER_PRIORITY_INSTANCE_PROPERTY_KEY = "servicecomb.loadbalance.filter.priorityInstanceProperty.key"; + private String propertyKey; private Environment environment; @@ -58,8 +60,10 @@ public void setEnvironment(Environment environment) { @Override protected void init(DiscoveryContext context, DiscoveryTreeNode parent) { - propertyKey = environment.getProperty("servicecomb.loadbalance.filter.priorityInstanceProperty.key", - String.class, "environment"); + + propertyKey = dynamicProperties.getStringProperty(SERVICECOMB_LOADBALANCE_FILTER_PRIORITY_INSTANCE_PROPERTY_KEY, + value -> propertyKey = value, + "environment"); // group all instance by property List instances = parent.data(); @@ -115,8 +119,13 @@ protected String findChildName(DiscoveryContext context, DiscoveryTreeNode paren @Override public boolean enabled() { - return environment.getProperty("servicecomb.loadbalance.filter.priorityInstanceProperty.enabled", - boolean.class, false); + + if (enabled == null) { + enabled = dynamicProperties.getBooleanProperty("servicecomb.loadbalance.filter.priorityInstanceProperty.enabled", + value -> enabled = value, + false); + } + return enabled; } @Override @@ -136,7 +145,7 @@ static class PriorityInstanceProperty { /** * Constructor * - * @param key property key + * @param key property key * @param value property value */ public PriorityInstanceProperty(@NotNull String key, String value) { @@ -153,7 +162,7 @@ public PriorityInstanceProperty(@NotNull String key, String value) { /** * Constructor * - * @param key property key + * @param key property key * @param microserviceInstance instance */ public PriorityInstanceProperty(@NotNull String key, @NotNull StatefulDiscoveryInstance microserviceInstance) { diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/ZoneAwareDiscoveryFilter.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/ZoneAwareDiscoveryFilter.java index b39aefe8f89..0e521397f13 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/ZoneAwareDiscoveryFilter.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/filter/ZoneAwareDiscoveryFilter.java @@ -42,6 +42,11 @@ public class ZoneAwareDiscoveryFilter extends AbstractGroupDiscoveryFilter { private DataCenterProperties dataCenterProperties; + private Integer ratio; + + private Integer ratioCeiling; + + @Autowired @SuppressWarnings("unused") public void setDataCenterProperties(DataCenterProperties dataCenterProperties) { @@ -55,18 +60,33 @@ public int getOrder() { @Override public boolean enabled() { - return environment.getProperty(CONFIG_ENABLED, - Boolean.class, true); + + if (enabled == null) { + enabled = dynamicProperties.getBooleanProperty(CONFIG_ENABLED, + value -> enabled = value, + true); + } + return enabled; } private int getRatio() { - return environment.getProperty(CONFIG_RATIO, - int.class, 30); + + if (ratio == null) { + ratio = dynamicProperties.getIntProperty(CONFIG_RATIO, + value -> ratio = value, + 30); + } + return ratio; } private int getRatioCeiling(int defaultValue) { - return environment.getProperty(CONFIG_RATIO_CEILING, - int.class, defaultValue); + + if (ratioCeiling == null) { + ratioCeiling = dynamicProperties.getIntProperty(CONFIG_RATIO_CEILING, + value -> ratioCeiling = value, + defaultValue); + } + return ratioCeiling; } @Override diff --git a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter2.java b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter2.java index 25858a98092..4c2fb5f5b45 100644 --- a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter2.java +++ b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/TestLoadBalanceFilter2.java @@ -25,6 +25,7 @@ import java.util.List; import org.apache.servicecomb.config.DataCenterProperties; +import org.apache.servicecomb.config.DynamicProperties; import org.apache.servicecomb.core.Invocation; import org.apache.servicecomb.core.NonSwaggerInvocation; import org.apache.servicecomb.core.SCBEngine; @@ -35,6 +36,7 @@ import org.apache.servicecomb.core.definition.SchemaMeta; import org.apache.servicecomb.core.provider.consumer.ReferenceConfig; import org.apache.servicecomb.core.transport.TransportManager; +import org.apache.servicecomb.foundation.common.LegacyPropertyFactory; import org.apache.servicecomb.loadbalance.filter.ServerDiscoveryFilter; import org.apache.servicecomb.loadbalance.filter.ZoneAwareDiscoveryFilter; import org.apache.servicecomb.registry.DiscoveryManager; @@ -54,18 +56,30 @@ import io.swagger.v3.oas.models.Operation; public class TestLoadBalanceFilter2 { + DynamicProperties dynamicProperties = Mockito.mock(DynamicProperties.class); + Environment environment = Mockito.mock(Environment.class); @BeforeEach public void setUp() { + Mockito.when(environment.getProperty("servicecomb.loadbalance.userDefinedEndpoint.enabled", boolean.class, false)).thenReturn(false); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.enabled", - Boolean.class, true)).thenReturn(true); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratio", - int.class, 30)).thenReturn(0); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratioCeiling", - int.class, 100)).thenReturn(100); + + Mockito.when(dynamicProperties.getBooleanProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.enabled"), + Mockito.any(), + Mockito.eq(true))) + .thenReturn(true); + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratio"), + Mockito.any(), + Mockito.eq(30))) + .thenReturn(0); + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratioCeiling"), + Mockito.any(), + Mockito.eq(100))) + .thenReturn(100); + + LegacyPropertyFactory.setEnvironment(environment); } @Test @@ -148,7 +162,7 @@ public void testZoneAwareFilterWorks() { .thenReturn(parent); DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); ZoneAwareDiscoveryFilter zoneAwareDiscoveryFilter = new ZoneAwareDiscoveryFilter(); - zoneAwareDiscoveryFilter.setEnvironment(environment); + zoneAwareDiscoveryFilter.setDynamicProperties(dynamicProperties); zoneAwareDiscoveryFilter.setDataCenterProperties(myself); ServerDiscoveryFilter serverDiscoveryFilter = new ServerDiscoveryFilter(); serverDiscoveryFilter.setScbEngine(scbEngine); @@ -239,7 +253,7 @@ public void testIsolationEventWithEndpoint() { .thenReturn(parent); DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); ZoneAwareDiscoveryFilter zoneAwareDiscoveryFilter = new ZoneAwareDiscoveryFilter(); - zoneAwareDiscoveryFilter.setEnvironment(environment); + zoneAwareDiscoveryFilter.setDynamicProperties(dynamicProperties); zoneAwareDiscoveryFilter.setDataCenterProperties(myself); ServerDiscoveryFilter serverDiscoveryFilter = new ServerDiscoveryFilter(); serverDiscoveryFilter.setScbEngine(scbEngine); @@ -339,7 +353,7 @@ public void testZoneAwareFilterWorksEmptyInstanceProtectionEnabled() { .thenReturn(parent); DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); ZoneAwareDiscoveryFilter zoneAwareDiscoveryFilter = new ZoneAwareDiscoveryFilter(); - zoneAwareDiscoveryFilter.setEnvironment(environment); + zoneAwareDiscoveryFilter.setDynamicProperties(dynamicProperties); zoneAwareDiscoveryFilter.setDataCenterProperties(myself); ServerDiscoveryFilter serverDiscoveryFilter = new ServerDiscoveryFilter(); serverDiscoveryFilter.setScbEngine(scbEngine); @@ -437,7 +451,7 @@ public void testZoneAwareFilterUsingMockedInvocationWorks() { .thenReturn(parent); DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); ZoneAwareDiscoveryFilter zoneAwareDiscoveryFilter = new ZoneAwareDiscoveryFilter(); - zoneAwareDiscoveryFilter.setEnvironment(environment); + zoneAwareDiscoveryFilter.setDynamicProperties(dynamicProperties); zoneAwareDiscoveryFilter.setDataCenterProperties(myself); ServerDiscoveryFilter serverDiscoveryFilter = new ServerDiscoveryFilter(); serverDiscoveryFilter.setScbEngine(scbEngine); @@ -534,7 +548,7 @@ public void testStatusFilterUsingMockedInvocationWorks() { .thenReturn(parent); DiscoveryTree discoveryTree = new DiscoveryTree(discoveryManager); ZoneAwareDiscoveryFilter zoneAwareDiscoveryFilter = new ZoneAwareDiscoveryFilter(); - zoneAwareDiscoveryFilter.setEnvironment(environment); + zoneAwareDiscoveryFilter.setDynamicProperties(dynamicProperties); zoneAwareDiscoveryFilter.setDataCenterProperties(myself); ServerDiscoveryFilter serverDiscoveryFilter = new ServerDiscoveryFilter(); serverDiscoveryFilter.setScbEngine(scbEngine); diff --git a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilterTest.java b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilterTest.java index 23f7c92f636..7c78388dcdc 100644 --- a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilterTest.java +++ b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/PriorityInstancePropertyDiscoveryFilterTest.java @@ -27,6 +27,7 @@ import java.util.Set; import java.util.stream.Collectors; +import org.apache.servicecomb.config.DynamicProperties; import org.apache.servicecomb.core.Invocation; import org.apache.servicecomb.registry.api.DiscoveryInstance; import org.apache.servicecomb.registry.discovery.DiscoveryContext; @@ -59,6 +60,8 @@ public class PriorityInstancePropertyDiscoveryFilterTest { EnumerablePropertySource propertySource; + DynamicProperties dynamicProperties = Mockito.mock(DynamicProperties.class); + @Before public void setUp() { propertySource = Mockito.mock(EnumerablePropertySource.class); @@ -71,8 +74,10 @@ public void setUp() { filter = new PriorityInstancePropertyDiscoveryFilter(); filter.setEnvironment(environment); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.priorityInstanceProperty.key", - String.class, "environment")).thenReturn("environment"); + filter.setDynamicProperties(dynamicProperties); + Mockito.when(dynamicProperties.getStringProperty(Mockito.eq("servicecomb.loadbalance.filter.priorityInstanceProperty.key"), + Mockito.any(), + Mockito.eq("environment"))).thenReturn("environment"); instances = new ArrayList<>(); filter.setEnvironment(environment); DiscoveryInstance discoveryInstance1 = Mockito.mock(DiscoveryInstance.class); diff --git a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestZoneAwareDiscoveryFilter.java b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestZoneAwareDiscoveryFilter.java index 13a5f6da952..05b6d5432ca 100644 --- a/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestZoneAwareDiscoveryFilter.java +++ b/handlers/handler-loadbalance/src/test/java/org/apache/servicecomb/loadbalance/filter/TestZoneAwareDiscoveryFilter.java @@ -21,6 +21,7 @@ import java.util.List; import org.apache.servicecomb.config.DataCenterProperties; +import org.apache.servicecomb.config.DynamicProperties; import org.apache.servicecomb.registry.api.DataCenterInfo; import org.apache.servicecomb.registry.api.DiscoveryInstance; import org.apache.servicecomb.registry.discovery.DiscoveryContext; @@ -30,26 +31,33 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mockito; -import org.springframework.core.env.Environment; public class TestZoneAwareDiscoveryFilter { - Environment environment = Mockito.mock(Environment.class); + DynamicProperties dynamicProperties = Mockito.mock(DynamicProperties.class); @BeforeEach public void setUp() { - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.enabled", - Boolean.class, true)).thenReturn(true); + + Mockito.when(dynamicProperties.getBooleanProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.enabled"), + Mockito.any(), + Mockito.eq(true))) + .thenReturn(true); } @Test public void test_not_enough_instance() { - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratio", - int.class, 30)).thenReturn(50); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratioCeiling", - int.class, 50)).thenReturn(70); + + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratio"), + Mockito.any(), + Mockito.eq(30))) + .thenReturn(50); + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratioCeiling"), + Mockito.any(), + Mockito.eq(50))) + .thenReturn(70); ZoneAwareDiscoveryFilter filter = new ZoneAwareDiscoveryFilter(); - filter.setEnvironment(environment); + filter.setDynamicProperties(dynamicProperties); // set up data DataCenterProperties myself = new DataCenterProperties(); @@ -113,13 +121,18 @@ public void test_not_enough_instance() { @Test public void test_not_enough_instance_both_ceiling_floor() { - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratio", - int.class, 30)).thenReturn(40); - Mockito.when(environment.getProperty("servicecomb.loadbalance.filter.zoneaware.ratioCeiling", - int.class, 60)).thenReturn(60); + + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratio"), + Mockito.any(), + Mockito.eq(30))) + .thenReturn(40); + Mockito.when(dynamicProperties.getIntProperty(Mockito.eq("servicecomb.loadbalance.filter.zoneaware.ratioCeiling"), + Mockito.any(), + Mockito.eq(60))) + .thenReturn(60); ZoneAwareDiscoveryFilter filter = new ZoneAwareDiscoveryFilter(); - filter.setEnvironment(environment); + filter.setDynamicProperties(dynamicProperties); // set up data DataCenterProperties myself = new DataCenterProperties(); From eed7434045ed15026003844ff637cd23701b231b Mon Sep 17 00:00:00 2001 From: liubao Date: Sat, 8 Feb 2025 16:34:12 +0800 Subject: [PATCH 037/223] [#4690]remove not updated mixin-maven-plugin --- demo/demo-consul/test-client/pom.xml | 13 ------------- demo/demo-etcd/test-client/pom.xml | 13 ------------- demo/demo-filter/filter-tests/pom.xml | 13 ------------- demo/demo-nacos/test-client/pom.xml | 13 ------------- demo/demo-zookeeper/test-client/pom.xml | 13 ------------- 5 files changed, 65 deletions(-) diff --git a/demo/demo-consul/test-client/pom.xml b/demo/demo-consul/test-client/pom.xml index 1e053bc6ee7..173a22b0559 100644 --- a/demo/demo-consul/test-client/pom.xml +++ b/demo/demo-consul/test-client/pom.xml @@ -213,19 +213,6 @@ io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-etcd/test-client/pom.xml b/demo/demo-etcd/test-client/pom.xml index 41a0813cfce..16ebfae3cc8 100644 --- a/demo/demo-etcd/test-client/pom.xml +++ b/demo/demo-etcd/test-client/pom.xml @@ -204,19 +204,6 @@ io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-filter/filter-tests/pom.xml b/demo/demo-filter/filter-tests/pom.xml index b9d33164b31..daf354e56c9 100644 --- a/demo/demo-filter/filter-tests/pom.xml +++ b/demo/demo-filter/filter-tests/pom.xml @@ -184,19 +184,6 @@ io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-nacos/test-client/pom.xml b/demo/demo-nacos/test-client/pom.xml index 638ad53689c..2e9009d8a8d 100644 --- a/demo/demo-nacos/test-client/pom.xml +++ b/demo/demo-nacos/test-client/pom.xml @@ -193,19 +193,6 @@ io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-zookeeper/test-client/pom.xml b/demo/demo-zookeeper/test-client/pom.xml index 63890b23ac0..93d2501c6de 100644 --- a/demo/demo-zookeeper/test-client/pom.xml +++ b/demo/demo-zookeeper/test-client/pom.xml @@ -189,19 +189,6 @@ io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - From 76446cb300989a4d47c02ed40907de35048a560d Mon Sep 17 00:00:00 2001 From: liubao Date: Sat, 8 Feb 2025 17:11:47 +0800 Subject: [PATCH 038/223] [#4690]use profile to replace mixin-maven-plugin --- demo/demo-consul/consumer/pom.xml | 16 ++----- demo/demo-consul/gateway/pom.xml | 16 ++----- demo/demo-consul/provider/pom.xml | 16 ++----- demo/pom.xml | 73 +++++++++++++++++++++++++++++++ 4 files changed, 82 insertions(+), 39 deletions(-) diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml index 3059e452fd7..ce11fa144d0 100644 --- a/demo/demo-consul/consumer/pom.xml +++ b/demo/demo-consul/consumer/pom.xml @@ -52,6 +52,9 @@ docker + + true + @@ -62,19 +65,6 @@ org.commonjava.maven.plugins directory-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml index 47d13456aa0..c21ce220dd8 100644 --- a/demo/demo-consul/gateway/pom.xml +++ b/demo/demo-consul/gateway/pom.xml @@ -55,6 +55,9 @@ docker + + true + @@ -65,19 +68,6 @@ org.commonjava.maven.plugins directory-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index dff8eb60e8f..0b862228c73 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -62,6 +62,9 @@ docker + + true + @@ -72,19 +75,6 @@ org.commonjava.maven.plugins directory-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/pom.xml b/demo/pom.xml index 1cf9c70492e..706e70b4fa4 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -187,4 +187,77 @@ + + + + build-docker-image + + + build.enable.docker.image + true + + + + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + org.commonjava.maven.plugins + directory-maven-plugin + + + directories + + directory-of + + initialize + + root.basedir + + org.apache.servicecomb.demo + demo-parent + + + + + + + + + + From 818afc49f90bcf8a59a62cd4339d597bbd28f478 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Mon, 10 Feb 2025 14:05:32 +0800 Subject: [PATCH 039/223] [#4690]use profile to replace mixin-maven-plugin (#4711) --- demo/demo-consul/consumer/pom.xml | 46 ++++- demo/demo-consul/gateway/pom.xml | 46 ++++- demo/demo-consul/provider/pom.xml | 52 ++++- demo/demo-crossapp/crossapp-client/pom.xml | 90 +++++++-- demo/demo-crossapp/crossapp-server/pom.xml | 56 ++++-- demo/demo-edge/authentication/pom.xml | 56 ++++-- demo/demo-edge/business-1-1-0/pom.xml | 56 ++++-- demo/demo-edge/business-1.0.0/pom.xml | 56 ++++-- demo/demo-edge/business-2.0.0/pom.xml | 56 ++++-- demo/demo-edge/consumer/pom.xml | 214 +++++++++++++++++++-- demo/demo-edge/edge-service/pom.xml | 56 ++++-- demo/demo-etcd/consumer/pom.xml | 62 ++++-- demo/demo-etcd/gateway/pom.xml | 62 ++++-- demo/demo-etcd/provider/pom.xml | 62 ++++-- demo/demo-nacos/consumer/pom.xml | 56 ++++-- demo/demo-nacos/gateway/pom.xml | 56 ++++-- demo/demo-nacos/provider/pom.xml | 56 ++++-- demo/demo-pojo/pojo-server/pom.xml | 59 ++++-- demo/demo-zookeeper/consumer/pom.xml | 62 ++++-- demo/demo-zookeeper/gateway/pom.xml | 62 ++++-- demo/demo-zookeeper/provider/pom.xml | 62 ++++-- demo/pom.xml | 99 +++------- 22 files changed, 1090 insertions(+), 392 deletions(-) diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml index ce11fa144d0..48fe65a1b0a 100644 --- a/demo/demo-consul/consumer/pom.xml +++ b/demo/demo-consul/consumer/pom.xml @@ -52,19 +52,51 @@ docker - - true - + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml index c21ce220dd8..708792e0516 100644 --- a/demo/demo-consul/gateway/pom.xml +++ b/demo/demo-consul/gateway/pom.xml @@ -55,19 +55,51 @@ docker - - true - + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index 0b862228c73..1636940be9b 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -60,21 +60,59 @@ + + build-docker-image + + true + + docker - - true - + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - diff --git a/demo/demo-crossapp/crossapp-client/pom.xml b/demo/demo-crossapp/crossapp-client/pom.xml index c67cb17551e..652245759d4 100644 --- a/demo/demo-crossapp/crossapp-client/pom.xml +++ b/demo/demo-crossapp/crossapp-client/pom.xml @@ -42,24 +42,88 @@ crossapp-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-crossapp/crossapp-server/pom.xml b/demo/demo-crossapp/crossapp-server/pom.xml index e6f0fefed94..f09bb9f314c 100644 --- a/demo/demo-crossapp/crossapp-server/pom.xml +++ b/demo/demo-crossapp/crossapp-server/pom.xml @@ -47,28 +47,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-edge/authentication/pom.xml b/demo/demo-edge/authentication/pom.xml index 5edd0dbeac7..b925f4d4d2b 100644 --- a/demo/demo-edge/authentication/pom.xml +++ b/demo/demo-edge/authentication/pom.xml @@ -43,28 +43,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-edge/business-1-1-0/pom.xml b/demo/demo-edge/business-1-1-0/pom.xml index 9186d30dfb5..a6b386c9db9 100644 --- a/demo/demo-edge/business-1-1-0/pom.xml +++ b/demo/demo-edge/business-1-1-0/pom.xml @@ -49,28 +49,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-edge/business-1.0.0/pom.xml b/demo/demo-edge/business-1.0.0/pom.xml index 62619c775ea..37e74d4933c 100644 --- a/demo/demo-edge/business-1.0.0/pom.xml +++ b/demo/demo-edge/business-1.0.0/pom.xml @@ -51,28 +51,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-edge/business-2.0.0/pom.xml b/demo/demo-edge/business-2.0.0/pom.xml index 841eb152121..b18f156f150 100644 --- a/demo/demo-edge/business-2.0.0/pom.xml +++ b/demo/demo-edge/business-2.0.0/pom.xml @@ -51,28 +51,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-edge/consumer/pom.xml b/demo/demo-edge/consumer/pom.xml index 0cd698cc8c3..b9875683636 100644 --- a/demo/demo-edge/consumer/pom.xml +++ b/demo/demo-edge/consumer/pom.xml @@ -47,24 +47,212 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + authentication:${project.version} + authentication + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/authentication-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 7070 + + + + + + 7070:7070 + + + service-center + + + + + business-1-0-0:${project.version} + business-1-0-0 + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/business-1-0-0-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 8080:8080 + + + service-center + + + + + business-1-1-0:${project.version} + business-1-1-0 + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/business-1-1-0-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8090 + + + + + + 8090:8090 + + + service-center + + + + + business-2-0-0:${project.version} + business-2-0-0 + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/business-2-0-0-${project.version}.jar + + + service-center:sc.servicecomb.io + + + Register microservice instance success + + + 8091 + + + + + + 8091:8091 + + + service-center + + + + + edge-service:${project.version} + edge-service + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/edge-service-${project.version}.jar + + + service-center:sc.servicecomb.io + + + Register microservice instance success + + + + 18090 + + + + + + 18090:18090 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config-edge - ${project.version} - - - - diff --git a/demo/demo-edge/edge-service/pom.xml b/demo/demo-edge/edge-service/pom.xml index c827fb8b7fd..9c48d93d9bb 100644 --- a/demo/demo-edge/edge-service/pom.xml +++ b/demo/demo-edge/edge-service/pom.xml @@ -49,28 +49,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 0c9ed7794b0..8951a846039 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -60,31 +60,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-etcd/gateway/pom.xml b/demo/demo-etcd/gateway/pom.xml index 9bed75de856..e4188fe58ab 100644 --- a/demo/demo-etcd/gateway/pom.xml +++ b/demo/demo-etcd/gateway/pom.xml @@ -59,31 +59,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-etcd/provider/pom.xml b/demo/demo-etcd/provider/pom.xml index cc926bda1ce..272a6e7f3fb 100644 --- a/demo/demo-etcd/provider/pom.xml +++ b/demo/demo-etcd/provider/pom.xml @@ -69,31 +69,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-nacos/consumer/pom.xml b/demo/demo-nacos/consumer/pom.xml index f5b2cafa83a..bc74f9b40e5 100644 --- a/demo/demo-nacos/consumer/pom.xml +++ b/demo/demo-nacos/consumer/pom.xml @@ -53,28 +53,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-nacos/gateway/pom.xml b/demo/demo-nacos/gateway/pom.xml index c04739ea577..a6c12eb621b 100644 --- a/demo/demo-nacos/gateway/pom.xml +++ b/demo/demo-nacos/gateway/pom.xml @@ -56,28 +56,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-nacos/provider/pom.xml b/demo/demo-nacos/provider/pom.xml index 282f2b0325a..07d3381d742 100644 --- a/demo/demo-nacos/provider/pom.xml +++ b/demo/demo-nacos/provider/pom.xml @@ -57,28 +57,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-pojo/pojo-server/pom.xml b/demo/demo-pojo/pojo-server/pom.xml index b8c6757057a..c1c750a009b 100644 --- a/demo/demo-pojo/pojo-server/pom.xml +++ b/demo/demo-pojo/pojo-server/pom.xml @@ -36,7 +36,9 @@ org.apache.servicecomb.demo.pojo.server.PojoServer + true + @@ -49,28 +51,51 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zookeeper/consumer/pom.xml b/demo/demo-zookeeper/consumer/pom.xml index 28857551b91..d515ccaa74f 100644 --- a/demo/demo-zookeeper/consumer/pom.xml +++ b/demo/demo-zookeeper/consumer/pom.xml @@ -50,31 +50,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zookeeper/gateway/pom.xml b/demo/demo-zookeeper/gateway/pom.xml index b51d04b7a7f..1ffb4e92fe9 100644 --- a/demo/demo-zookeeper/gateway/pom.xml +++ b/demo/demo-zookeeper/gateway/pom.xml @@ -53,31 +53,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zookeeper/provider/pom.xml b/demo/demo-zookeeper/provider/pom.xml index d49e354a438..bda558bc683 100644 --- a/demo/demo-zookeeper/provider/pom.xml +++ b/demo/demo-zookeeper/provider/pom.xml @@ -62,31 +62,59 @@ + + build-docker-image + + true + + docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/pom.xml b/demo/pom.xml index 706e70b4fa4..5fe99cc2760 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -184,80 +184,33 @@ + + org.commonjava.maven.plugins + directory-maven-plugin + + + directories + + directory-of + + initialize + + root.basedir + + org.apache.servicecomb.demo + demo-parent + + + + + + + + org.commonjava.maven.plugins + directory-maven-plugin + + - - - - build-docker-image - - - build.enable.docker.image - true - - - - - - - io.fabric8 - docker-maven-plugin - - - - ${project.artifactId}:${project.version} - ${project.artifactId} - - openjdk:17-alpine - - 7070 - 8080 - - - tar - ${root.basedir}/assembly/assembly.xml - - - java -Xmx128m $JAVA_OPTS -jar $JAR_PATH - - - - - - - - build - package - - build - - - - - - org.commonjava.maven.plugins - directory-maven-plugin - - - directories - - directory-of - - initialize - - root.basedir - - org.apache.servicecomb.demo - demo-parent - - - - - - - - - - From 63135ba272e4ee5aa05dfa21a3346ca3e6ccb425 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Mon, 10 Feb 2025 14:41:46 +0800 Subject: [PATCH 040/223] [#4690]replace not maintained mixin-maven-plugin (#4712) --- demo/demo-consul/provider/pom.xml | 6 -- demo/demo-etcd/consumer/pom.xml | 6 -- demo/demo-etcd/gateway/pom.xml | 6 -- demo/demo-etcd/provider/pom.xml | 6 -- demo/demo-filter/filter-client/pom.xml | 56 +++++++---- demo/demo-filter/filter-edge/pom.xml | 56 +++++++---- demo/demo-filter/filter-server/pom.xml | 56 +++++++---- demo/demo-jaxrs/jaxrs-server/pom.xml | 56 +++++++---- .../demo-local-registry-server/pom.xml | 56 +++++++---- .../demo-multi-registries-server/pom.xml | 56 +++++++---- .../demo-multi-service-center-serverA/pom.xml | 56 +++++++---- .../demo-multi-service-center-serverB/pom.xml | 56 +++++++---- demo/demo-multiple/multiple-server/pom.xml | 56 +++++++---- demo/demo-pojo/pojo-client/pom.xml | 90 +++++++++++++++--- .../demo-register-url-prefix-server/pom.xml | 56 +++++++---- .../demo-spring-boot-pojo-server/pom.xml | 56 +++++++---- .../demo-spring-boot-springmvc-server/pom.xml | 56 +++++++---- demo/demo-springmvc/springmvc-server/pom.xml | 56 +++++++---- .../demo-zeroconfig-registry-client/pom.xml | 56 +++++++---- .../demo-zeroconfig-registry-edge/pom.xml | 56 +++++++---- .../demo-zeroconfig-registry-server/pom.xml | 52 +++++++--- demo/demo-zookeeper/consumer/pom.xml | 6 -- demo/demo-zookeeper/gateway/pom.xml | 6 -- demo/demo-zookeeper/provider/pom.xml | 6 -- demo/docker-build-config/pom.xml | 94 ------------------- demo/pom.xml | 1 - 26 files changed, 701 insertions(+), 418 deletions(-) delete mode 100644 demo/docker-build-config/pom.xml diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index 1636940be9b..039c988526c 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -60,12 +60,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 8951a846039..50140d5f648 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -60,12 +60,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-etcd/gateway/pom.xml b/demo/demo-etcd/gateway/pom.xml index e4188fe58ab..5febf28db1d 100644 --- a/demo/demo-etcd/gateway/pom.xml +++ b/demo/demo-etcd/gateway/pom.xml @@ -59,12 +59,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-etcd/provider/pom.xml b/demo/demo-etcd/provider/pom.xml index 272a6e7f3fb..991a1b65f60 100644 --- a/demo/demo-etcd/provider/pom.xml +++ b/demo/demo-etcd/provider/pom.xml @@ -69,12 +69,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-filter/filter-client/pom.xml b/demo/demo-filter/filter-client/pom.xml index 42e9c6af073..769a420e9f7 100644 --- a/demo/demo-filter/filter-client/pom.xml +++ b/demo/demo-filter/filter-client/pom.xml @@ -56,28 +56,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-filter/filter-edge/pom.xml b/demo/demo-filter/filter-edge/pom.xml index 6f6d63a47ce..5c6ec05f74f 100644 --- a/demo/demo-filter/filter-edge/pom.xml +++ b/demo/demo-filter/filter-edge/pom.xml @@ -60,28 +60,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-filter/filter-server/pom.xml b/demo/demo-filter/filter-server/pom.xml index 3710a3efb7b..f2a10c52bcb 100644 --- a/demo/demo-filter/filter-server/pom.xml +++ b/demo/demo-filter/filter-server/pom.xml @@ -51,28 +51,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-jaxrs/jaxrs-server/pom.xml b/demo/demo-jaxrs/jaxrs-server/pom.xml index 41f99ae1c6a..d75e6cbbc84 100644 --- a/demo/demo-jaxrs/jaxrs-server/pom.xml +++ b/demo/demo-jaxrs/jaxrs-server/pom.xml @@ -61,28 +61,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-local-registry/demo-local-registry-server/pom.xml b/demo/demo-local-registry/demo-local-registry-server/pom.xml index c9a0055690c..5e52643fa30 100644 --- a/demo/demo-local-registry/demo-local-registry-server/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-server/pom.xml @@ -55,28 +55,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml index 2418d2994e9..10ca21f2a95 100644 --- a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml @@ -55,28 +55,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml index 0455b6e6942..3c0fd73978c 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml @@ -55,28 +55,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml index 6d860cf5e39..4bf55b6d4b7 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml @@ -55,28 +55,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-multiple/multiple-server/pom.xml b/demo/demo-multiple/multiple-server/pom.xml index 21f04a24735..68d1f5781ba 100644 --- a/demo/demo-multiple/multiple-server/pom.xml +++ b/demo/demo-multiple/multiple-server/pom.xml @@ -54,28 +54,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-pojo/pojo-client/pom.xml b/demo/demo-pojo/pojo-client/pom.xml index d9fbcab8cd1..23789ae4f33 100644 --- a/demo/demo-pojo/pojo-client/pom.xml +++ b/demo/demo-pojo/pojo-client/pom.xml @@ -54,24 +54,88 @@ pojo-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml index cd46fbe600b..563ce0227ba 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml @@ -50,28 +50,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml index 572394627d2..edf7ed50444 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml @@ -52,28 +52,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml index 5fb051ba1ef..a614b00af48 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml @@ -47,28 +47,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-springmvc/springmvc-server/pom.xml b/demo/demo-springmvc/springmvc-server/pom.xml index 57a8d12600a..f1fff38f4a8 100644 --- a/demo/demo-springmvc/springmvc-server/pom.xml +++ b/demo/demo-springmvc/springmvc-server/pom.xml @@ -51,28 +51,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml index 5887340b582..2ef78c974ad 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml @@ -62,28 +62,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml index ebe16ceeec4..0266fe47b75 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml @@ -67,28 +67,50 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 docker-maven-plugin - - org.commonjava.maven.plugins - directory-maven-plugin - - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml index c5ed74d722e..183b27beed2 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml @@ -63,6 +63,45 @@ docker + + + + io.fabric8 + docker-maven-plugin + + + + ${project.artifactId}:${project.version} + ${project.artifactId} + + openjdk:17-alpine + + 7070 + 8080 + + + tar + ${root.basedir}/assembly/assembly.xml + + + java -Xmx128m $JAVA_OPTS -jar $JAR_PATH + + + + + + + + build + package + + build + + + + + + io.fabric8 @@ -72,19 +111,6 @@ org.commonjava.maven.plugins directory-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-build-config - ${project.version} - - - - diff --git a/demo/demo-zookeeper/consumer/pom.xml b/demo/demo-zookeeper/consumer/pom.xml index d515ccaa74f..6e60470aea1 100644 --- a/demo/demo-zookeeper/consumer/pom.xml +++ b/demo/demo-zookeeper/consumer/pom.xml @@ -50,12 +50,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-zookeeper/gateway/pom.xml b/demo/demo-zookeeper/gateway/pom.xml index 1ffb4e92fe9..1cd29cbfeab 100644 --- a/demo/demo-zookeeper/gateway/pom.xml +++ b/demo/demo-zookeeper/gateway/pom.xml @@ -53,12 +53,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/demo-zookeeper/provider/pom.xml b/demo/demo-zookeeper/provider/pom.xml index bda558bc683..ea56074ef26 100644 --- a/demo/demo-zookeeper/provider/pom.xml +++ b/demo/demo-zookeeper/provider/pom.xml @@ -62,12 +62,6 @@ - - build-docker-image - - true - - docker diff --git a/demo/docker-build-config/pom.xml b/demo/docker-build-config/pom.xml deleted file mode 100644 index 746be574983..00000000000 --- a/demo/docker-build-config/pom.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - demo-parent - org.apache.servicecomb.demo - 3.3.0-SNAPSHOT - - 4.0.0 - - docker-build-config - Java Chassis::Demo::Docker Build Config - pom - - - - - - io.fabric8 - docker-maven-plugin - - - - ${project.artifactId}:${project.version} - ${project.artifactId} - - openjdk:17-alpine - - 7070 - 8080 - - - tar - ${root.basedir}/assembly/assembly.xml - - - java -Xmx128m $JAVA_OPTS -jar $JAR_PATH - - - - - - - - build - package - - build - - - - - - org.commonjava.maven.plugins - directory-maven-plugin - - - directories - - directory-of - - initialize - - root.basedir - - org.apache.servicecomb.demo - demo-parent - - - - - - - - - diff --git a/demo/pom.xml b/demo/pom.xml index 5fe99cc2760..172e42200de 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -35,7 +35,6 @@ pom - docker-build-config docker-run-config docker-run-config-edge docker-run-config-local From ecee95e433102d3753f5f214791b3a7fbf240e5f Mon Sep 17 00:00:00 2001 From: liubao68 Date: Mon, 10 Feb 2025 17:03:09 +0800 Subject: [PATCH 041/223] [#4690]replace not maintained mixin-maven-plugin (#4713) --- .github/workflows/maven.yml | 2 +- .../samples/{ConsulT.java => ConsulIT.java} | 4 +- demo/demo-jaxrs/jaxrs-client/pom.xml | 90 +++++- .../demo-local-registry-client/pom.xml | 62 +++- .../demo-multi-registries-client/pom.xml | 90 +++++- .../demo-multi-service-center-client/pom.xml | 15 - demo/demo-multiple/multiple-client/pom.xml | 90 +++++- .../demo-register-url-prefix-client/pom.xml | 90 +++++- .../demo-spring-boot-pojo-client/pom.xml | 90 +++++- .../demo-spring-boot-springmvc-client/pom.xml | 90 +++++- demo/demo-springmvc/springmvc-client/pom.xml | 90 +++++- .../demo-zeroconfig-registry-tests/pom.xml | 15 - demo/docker-run-config-edge/pom.xml | 268 ------------------ demo/docker-run-config-local/pom.xml | 116 -------- demo/docker-run-config/pom.xml | 144 ---------- demo/pom.xml | 35 ++- pom.xml | 5 - 17 files changed, 617 insertions(+), 679 deletions(-) rename demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/{ConsulT.java => ConsulIT.java} (97%) delete mode 100644 demo/docker-run-config-edge/pom.xml delete mode 100644 demo/docker-run-config-local/pom.xml delete mode 100644 demo/docker-run-config/pom.xml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index dbb4ed17f4a..15a8cd1777e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -41,7 +41,7 @@ jobs: - name: Set up Maven uses: stCarolas/setup-maven@v4.5 with: - maven-version: 3.8.4 + maven-version: 3.9.9 - uses: actions/cache@v4 with: path: ~/.m2/repository diff --git a/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java b/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulIT.java similarity index 97% rename from demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java rename to demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulIT.java index dc687e00def..62862743e27 100644 --- a/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulT.java +++ b/demo/demo-consul/test-client/src/test/java/org/apache/servicecomb/samples/ConsulIT.java @@ -29,8 +29,8 @@ @ExtendWith(SpringExtension.class) @SpringBootTest(classes = TestClientApplication.class) -public class ConsulT { - private static final Logger LOGGER = LoggerFactory.getLogger(ConsulT.class); +public class ConsulIT { + private static final Logger LOGGER = LoggerFactory.getLogger(ConsulIT.class); @BeforeEach public void setUp() { diff --git a/demo/demo-jaxrs/jaxrs-client/pom.xml b/demo/demo-jaxrs/jaxrs-client/pom.xml index 7ded2d60e8b..cc6f702b61d 100644 --- a/demo/demo-jaxrs/jaxrs-client/pom.xml +++ b/demo/demo-jaxrs/jaxrs-client/pom.xml @@ -45,24 +45,88 @@ jaxrs-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-local-registry/demo-local-registry-client/pom.xml b/demo/demo-local-registry/demo-local-registry-client/pom.xml index 587b1bfe56c..5f824d7fb08 100644 --- a/demo/demo-local-registry/demo-local-registry-client/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-client/pom.xml @@ -45,24 +45,60 @@ demo-local-registry-server + + + + io.fabric8 + docker-maven-plugin + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + /maven/maven/${demo.service.name}-${project.version}.jar + + + ServiceComb is ready + + + 8080 + + + + + + 8080:8080 + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config-local - ${project.version} - - - - diff --git a/demo/demo-multi-registries/demo-multi-registries-client/pom.xml b/demo/demo-multi-registries/demo-multi-registries-client/pom.xml index 63fa50d7d43..9fcc4b7ea5e 100644 --- a/demo/demo-multi-registries/demo-multi-registries-client/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-client/pom.xml @@ -45,24 +45,88 @@ demo-multi-registries-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml index ecdbfedbff6..41d6c380a3e 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml @@ -177,21 +177,6 @@ io.fabric8 docker-maven-plugin - - org.apache.maven.plugins - maven-failsafe-plugin - - ${jacoco.failsafe.argLine} - - - - - integration-test - verify - - - - diff --git a/demo/demo-multiple/multiple-client/pom.xml b/demo/demo-multiple/multiple-client/pom.xml index d337063412b..ac1aa663369 100644 --- a/demo/demo-multiple/multiple-client/pom.xml +++ b/demo/demo-multiple/multiple-client/pom.xml @@ -48,24 +48,88 @@ multiple-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml index d1d1859ba8d..11faba21e9b 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml @@ -45,24 +45,88 @@ demo-register-url-prefix-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml index 776a577c870..359371da752 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml @@ -39,24 +39,88 @@ demo-spring-boot-pojo-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml index b6afa72ef5a..75a97d15ffd 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml @@ -42,24 +42,88 @@ demo-spring-boot-springmvc-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-springmvc/springmvc-client/pom.xml b/demo/demo-springmvc/springmvc-client/pom.xml index fb9f903dfb3..e38a29d9d98 100644 --- a/demo/demo-springmvc/springmvc-client/pom.xml +++ b/demo/demo-springmvc/springmvc-client/pom.xml @@ -42,24 +42,88 @@ springmvc-server + + + + io.fabric8 + docker-maven-plugin + + + + servicecomb/service-center + service-center + + + server is ready + + + 30100 + + + + + + 30100:30100 + + + + + ${demo.service.name}:${project.version} + ${demo.service.name} + + + + -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 + + /maven/maven/${demo.service.name}-${project.version}.jar + + + service-center:sc.servicecomb.io + + + ServiceComb is ready + + + 8080 + + + + + + 7070:7070 + 8080:8080 + + + service-center + + + + + + + + start + pre-integration-test + + start + + + + stop + post-integration-test + + stop + + + + + + io.fabric8 docker-maven-plugin - - com.github.odavid.maven.plugins - mixin-maven-plugin - - - - org.apache.servicecomb.demo - docker-run-config - ${project.version} - - - - diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml index 47d2859d0c1..d82db632a85 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml @@ -151,21 +151,6 @@ io.fabric8 docker-maven-plugin - - org.apache.maven.plugins - maven-failsafe-plugin - - ${jacoco.failsafe.argLine} - - - - - integration-test - verify - - - - diff --git a/demo/docker-run-config-edge/pom.xml b/demo/docker-run-config-edge/pom.xml deleted file mode 100644 index 942ba680b84..00000000000 --- a/demo/docker-run-config-edge/pom.xml +++ /dev/null @@ -1,268 +0,0 @@ - - - - - demo-parent - org.apache.servicecomb.demo - 3.3.0-SNAPSHOT - - 4.0.0 - - docker-run-config-edge - Java Chassis::Demo::Docker Run Config - - pom - - - - - - io.fabric8 - docker-maven-plugin - - - - servicecomb/service-center - service-center - - - server is ready - - - 30100 - - - - - - 30100:30100 - - - - - authentication:${project.version} - authentication - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/authentication-${project.version}.jar - - - service-center:sc.servicecomb.io - - - ServiceComb is ready - - - 7070 - - - - - - 7070:7070 - - - service-center - - - - - business-1-0-0:${project.version} - business-1-0-0 - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/business-1-0-0-${project.version}.jar - - - service-center:sc.servicecomb.io - - - ServiceComb is ready - - - 8080 - - - - - - 8080:8080 - - - service-center - - - - - business-1-1-0:${project.version} - business-1-1-0 - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/business-1-1-0-${project.version}.jar - - - service-center:sc.servicecomb.io - - - ServiceComb is ready - - - 8090 - - - - - - 8090:8090 - - - service-center - - - - - business-2-0-0:${project.version} - business-2-0-0 - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/business-2-0-0-${project.version}.jar - - - service-center:sc.servicecomb.io - - - Register microservice instance success - - - 8091 - - - - - - 8091:8091 - - - service-center - - - - - edge-service:${project.version} - edge-service - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/edge-service-${project.version}.jar - - - service-center:sc.servicecomb.io - - - Register microservice instance success - - - - 18090 - - - - - - 18090:18090 - - - service-center - - - - - - - - start - pre-integration-test - - start - - - - stop - post-integration-test - - stop - - - - - - - - - - - docker - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${jacoco.failsafe.argLine} - - - - - integration-test - verify - - - - - - - - - docker-machine - - - - - - - diff --git a/demo/docker-run-config-local/pom.xml b/demo/docker-run-config-local/pom.xml deleted file mode 100644 index 35a23d5cbde..00000000000 --- a/demo/docker-run-config-local/pom.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - demo-parent - org.apache.servicecomb.demo - 3.3.0-SNAPSHOT - - 4.0.0 - - docker-run-config-local - Java Chassis::Demo::Docker Run Config Local - - pom - - - - - - io.fabric8 - docker-maven-plugin - - - - ${demo.service.name}:${project.version} - ${demo.service.name} - - - /maven/maven/${demo.service.name}-${project.version}.jar - - - ServiceComb is ready - - - 8080 - - - - - - 8080:8080 - - - - - - - - start - pre-integration-test - - start - - - - stop - post-integration-test - - stop - - - - - - - - - - - docker - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${jacoco.failsafe.argLine} - - - - - integration-test - verify - - - - - - - - - docker-machine - - - - - - - diff --git a/demo/docker-run-config/pom.xml b/demo/docker-run-config/pom.xml deleted file mode 100644 index 547f8f4ac6f..00000000000 --- a/demo/docker-run-config/pom.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - demo-parent - org.apache.servicecomb.demo - 3.3.0-SNAPSHOT - - 4.0.0 - - docker-run-config - Java Chassis::Demo::Docker Run Config - - pom - - - - - - io.fabric8 - docker-maven-plugin - - - - servicecomb/service-center - service-center - - - server is ready - - - 30100 - - - - - - 30100:30100 - - - - - ${demo.service.name}:${project.version} - ${demo.service.name} - - - - -Dservicecomb.registry.sc.address=http://sc.servicecomb.io:30100 - - /maven/maven/${demo.service.name}-${project.version}.jar - - - service-center:sc.servicecomb.io - - - ServiceComb is ready - - - 8080 - - - - - - 7070:7070 - 8080:8080 - - - service-center - - - - - - - - start - pre-integration-test - - start - - - - stop - post-integration-test - - stop - - - - - - - - - - - docker - - - - org.apache.maven.plugins - maven-failsafe-plugin - - ${jacoco.failsafe.argLine} - - - - - integration-test - verify - - - - - - - - - docker-machine - - - - - - - diff --git a/demo/pom.xml b/demo/pom.xml index 172e42200de..d21bb83b23d 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -35,9 +35,6 @@ pom - docker-run-config - docker-run-config-edge - docker-run-config-local demo-schema demo-pojo demo-filter @@ -141,12 +138,6 @@ - - com.github.odavid.maven.plugins - mixin-maven-plugin - 0.1-alpha-40 - true - org.commonjava.maven.plugins directory-maven-plugin @@ -212,4 +203,30 @@ + + + + docker + + + + org.apache.maven.plugins + maven-failsafe-plugin + ${maven-failsafe-plugin.version} + + ${jacoco.failsafe.argLine} + + + + + integration-test + verify + + + + + + + + diff --git a/pom.xml b/pom.xml index 5234b38732c..ce5e6b4b39c 100644 --- a/pom.xml +++ b/pom.xml @@ -314,11 +314,6 @@ alphabetical - - org.apache.maven.plugins - maven-failsafe-plugin - ${maven-failsafe-plugin.version} - org.apache.maven.plugins maven-jar-plugin From 977f3ca52514e92a7bccef91cdb97a7afef71ec9 Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Thu, 13 Feb 2025 14:40:39 +0800 Subject: [PATCH 042/223] Standard issue submission (#4715) --- .github/ISSUE_TEMPLATE/bug_report.yml | 33 +++++++++++++++++++ .github/ISSUE_TEMPLATE/config.yml | 18 ++++++++++ .../ISSUE_TEMPLATE/documentation_issue.yml | 27 +++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.yml | 33 +++++++++++++++++++ .github/ISSUE_TEMPLATE/question.yml | 27 +++++++++++++++ 5 files changed, 138 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.yml create mode 100644 .github/ISSUE_TEMPLATE/config.yml create mode 100644 .github/ISSUE_TEMPLATE/documentation_issue.yml create mode 100644 .github/ISSUE_TEMPLATE/feature_request.yml create mode 100644 .github/ISSUE_TEMPLATE/question.yml diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 00000000000..185873ad02a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,33 @@ +name: Bug Report +description: Create a report to help us improve +title: "[BUG] - Issue Title" +labels: bug + +body: + - type: markdown + attributes: + value: "## Describe the bug\nA clear and concise description of what the bug is." + + - type: textarea + attributes: + label: Steps to Reproduce + description: "List the steps to reproduce the bug." + placeholder: "1. Go to '...'\n2. Click on '...'\n3. See error" + + - type: textarea + attributes: + label: Expected Behavior + description: "Describe the behavior you expected to see." + placeholder: "A clear and concise description of what you expected to happen." + + - type: input + attributes: + label: Servicecomb Version + description: "Please provide your Servicecomb version" + placeholder: "3.2.4" + + - type: textarea + attributes: + label: Additional Context + description: "Add any other context about the problem here." + placeholder: "Any additional information that might help us debug the issue." diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 00000000000..16fd2512ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,18 @@ +blank_issues_enabled: false +contact_links: + - name: "Contact Support" + url: "mailto:dev@servicecomb.apache.org" + about: "If you need help, please contact us." +templates: + - name: "Bug Report" + description: "Report a bug or issue." + filename: "bug_report.yml" + - name: "Feature Request" + description: "Request a new feature or improvement." + filename: "feature_request.yml" + - name: "Documentation Issue" + description: "Report an issue with documentation." + filename: "documentation_issue.yml" + - name: "Question" + description: "Ask a question or seek help." + filename: "question.yml" diff --git a/.github/ISSUE_TEMPLATE/documentation_issue.yml b/.github/ISSUE_TEMPLATE/documentation_issue.yml new file mode 100644 index 00000000000..94ef3490041 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/documentation_issue.yml @@ -0,0 +1,27 @@ +name: Documentation Issue +description: Report an issue with the documentation +title: "[DOCUMENTATION] - Documentation Issue Title" +labels: documentation + +body: + - type: markdown + attributes: + value: "## Describe the documentation issue\nA clear and concise description of the issue with the documentation." + + - type: textarea + attributes: + label: Location in documentation + description: "Please provide the URL or section where the issue appears." + placeholder: "e.g. https://docs.example.com/section" + + - type: textarea + attributes: + label: What should be changed? + description: "Please describe what changes or improvements should be made to the documentation." + placeholder: "Explain how we can improve the content." + + - type: textarea + attributes: + label: Additional Context + description: "Provide any other context or examples here." + placeholder: "Additional comments or suggestions for the documentation." diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 00000000000..3a44565e0b2 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,33 @@ +name: Feature Request +description: Suggest an idea or feature for this project +title: "[FEATURE] - Feature Title" +labels: enhancement + +body: + - type: markdown + attributes: + value: "## Describe the feature request\nA clear and concise description of what you want to be added to the project." + + - type: textarea + attributes: + label: Problem this feature would solve + description: "Please describe the problem or challenge you're facing." + placeholder: "Explain why this feature would be helpful." + + - type: textarea + attributes: + label: Describe the solution + description: "How do you envision this feature working?" + placeholder: "Provide a description of how the feature would solve the problem." + + - type: textarea + attributes: + label: Alternatives considered + description: "Have you considered other solutions or alternatives? If yes, describe them." + placeholder: "Provide any alternative solutions you've thought about." + + - type: textarea + attributes: + label: Additional Context + description: "Any other context or information that might help us implement this feature." + placeholder: "Include any links, mockups, or additional details." diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 00000000000..af3f350b518 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,27 @@ +name: General Question +description: Ask a general question related to the project +title: "[QUESTION] - Question Title" +labels: question + +body: + - type: markdown + attributes: + value: "## What is your question?\nDescribe the question or issue you are facing. Be as specific as possible." + + - type: textarea + attributes: + label: Steps to reproduce (if applicable) + description: "If your question is about a specific problem or bug, please include steps to reproduce it." + placeholder: "Provide steps, if applicable." + + - type: textarea + attributes: + label: What have you tried so far? + description: "Please explain what you have already tried to resolve the issue or answer the question." + placeholder: "Describe the steps you've taken." + + - type: textarea + attributes: + label: Additional context + description: "Provide any other context or information related to the question." + placeholder: "Include any relevant links or background information." From c958bd237a2a89ed2dc14766c025cf093618a250 Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Fri, 14 Feb 2025 17:20:34 +0800 Subject: [PATCH 043/223] [#4717]Bump vertx from 4.5.12 to 4.5.13 (#4719) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index ccf8a44d085..254752c1574 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -88,7 +88,7 @@ 2.3 6.1.10 2.2.28 - 4.5.12 + 4.5.13 3.4.4 3.4.0 0.8.4 From d4fd88122a606a9d62791fbd37e2f2c8b82816e2 Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Mon, 17 Feb 2025 08:48:46 +0800 Subject: [PATCH 044/223] [#4716]Fix load balance rule may not properly handle integer overflow (#4718) --- .../java/org/apache/servicecomb/loadbalance/RandomRuleExt.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/RandomRuleExt.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/RandomRuleExt.java index 5f8d26c0ff8..318b45f3839 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/RandomRuleExt.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/RandomRuleExt.java @@ -31,7 +31,7 @@ public ServiceCombServer choose(List servers, Invocation invo if (servers.isEmpty()) { return null; } - int index = Math.abs(ThreadLocalRandom.current().nextInt()) % servers.size(); + int index = ThreadLocalRandom.current().nextInt(servers.size()); return servers.get(index); } } From 2951a6d14dadfd4898eee7a83a0b7d48f5879ab2 Mon Sep 17 00:00:00 2001 From: Zhangjian He Date: Wed, 19 Feb 2025 11:13:07 +0800 Subject: [PATCH 045/223] docs: update readme notice format (#4723) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 73bda88b94a..eb2de51192d 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,10 @@ Apache ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid de | Java Chassis 2 | 2.8.20 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | Depends on Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | End of Support | ->>>NOTICE: Since Open API 3.0.x is not compatible with 2.0.x, Java Chassis 2 and Java Chassis 1 can not +> NOTICE: Since Open API 3.0.x is not compatible with 2.0.x, Java Chassis 2 and Java Chassis 1 can not > work together with Java Chassis 3. All related consumers, providers and edge service need use Java Chassis 3 when upgrading. ->>>NOTICE: Java Chassis 1 reached its end of support now after it's first release from 2018. +> NOTICE: Java Chassis 1 reached its end of support now after it's first release from 2018. # Quick Start From 0c1216c4872a3533df0d99f3942b3b5b87a18ee2 Mon Sep 17 00:00:00 2001 From: Aithusa <32020141+Aithosa@users.noreply.github.com> Date: Fri, 28 Feb 2025 15:02:55 +0800 Subject: [PATCH 046/223] [#4722] Fix bug in `ProviderAuthFilter` where `requestPath` not absolute problem (#4725) * [#4722] fix provider auth filter requestPath not absolute problem 1. Fix problem that ProviderAuthFilter not use absolute path. 2. same logic has come up twice, move it to SwaggerUtils. * [#4722] add tests for `excludePathPatterns`/`includePathPatterns` feature in `handler-publickey-auth` * [#4722] fix test assertion formatting issue * [#4722] replaced hardcoded path strings in tests with predefined constants for better maintainability and readability. --- .../rest/definition/RestOperationMeta.java | 17 +- .../core/governance/MatchType.java | 17 +- .../provider/ProviderAuthFilter.java | 5 +- .../provider/TestPathCheckUtils.java | 161 ++++++++++++++++++ .../servicecomb/swagger/SwaggerUtils.java | 20 +++ 5 files changed, 187 insertions(+), 33 deletions(-) create mode 100644 handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/provider/TestPathCheckUtils.java diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java index 6b2e3b3324f..580175ec680 100644 --- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java +++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/definition/RestOperationMeta.java @@ -102,7 +102,7 @@ public void init(OperationMeta operationMeta) { } } - setAbsolutePath(concatPath(SwaggerUtils.getBasePath(swagger), operationMeta.getOperationPath())); + setAbsolutePath(SwaggerUtils.concatAbsolutePath(swagger, operationMeta.getOperationPath())); } private void addRestParamByName(OperationMeta operationMeta, String name, Operation operation) { @@ -168,21 +168,6 @@ public void setOperationMeta(OperationMeta operationMeta) { this.operationMeta = operationMeta; } - /** - * Concat the two paths to an absolute path, end of '/' added. - * - * e.g. "/" + "/ope" = /ope/ - * e.g. "/prefix" + "/ope" = /prefix/ope/ - */ - private String concatPath(String basePath, String operationPath) { - return ("/" + nonNullify(basePath) + "/" + nonNullify(operationPath)) - .replaceAll("/{2,}", "/"); - } - - private String nonNullify(String path) { - return path == null ? "" : path; - } - public String getAbsolutePath() { return this.absolutePath; } diff --git a/core/src/main/java/org/apache/servicecomb/core/governance/MatchType.java b/core/src/main/java/org/apache/servicecomb/core/governance/MatchType.java index 2c100670630..15d58d66610 100644 --- a/core/src/main/java/org/apache/servicecomb/core/governance/MatchType.java +++ b/core/src/main/java/org/apache/servicecomb/core/governance/MatchType.java @@ -36,7 +36,7 @@ private GovernanceRequestExtractorImpl(Invocation invocation) { public String apiPath() { if (MatchType.REST.equalsIgnoreCase(invocation.getOperationMeta().getConfig().getGovernanceMatchType())) { if (!invocation.isProducer()) { - return concatAbsolutePath(SwaggerUtils.getBasePath(invocation.getSchemaMeta().getSwagger()), + return SwaggerUtils.concatAbsolutePath(invocation.getSchemaMeta().getSwagger(), invocation.getOperationMeta().getOperationPath()); } // not highway @@ -114,19 +114,4 @@ public Object sourceRequest() { public static GovernanceRequestExtractor createGovHttpRequest(Invocation invocation) { return new GovernanceRequestExtractorImpl(invocation); } - - /** - * Concat the two paths to an absolute path, without end of '/'. - * - * e.g. "/" + "/ope" = /ope - * e.g. "/prefix" + "/ope" = /prefix/ope - */ - private static String concatAbsolutePath(String basePath, String operationPath) { - return ("/" + nonNullify(basePath) + "/" + nonNullify(operationPath)) - .replaceAll("/{2,}", "/"); - } - - private static String nonNullify(String path) { - return path == null ? "" : path; - } } diff --git a/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/provider/ProviderAuthFilter.java b/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/provider/ProviderAuthFilter.java index 02b1108a545..f525ae88cf8 100644 --- a/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/provider/ProviderAuthFilter.java +++ b/handlers/handler-publickey-auth/src/main/java/org/apache/servicecomb/authentication/provider/ProviderAuthFilter.java @@ -24,6 +24,7 @@ import org.apache.servicecomb.core.filter.Filter; import org.apache.servicecomb.core.filter.FilterNode; import org.apache.servicecomb.core.filter.ProviderFilter; +import org.apache.servicecomb.swagger.SwaggerUtils; import org.apache.servicecomb.swagger.invocation.Response; import org.apache.servicecomb.swagger.invocation.exception.InvocationException; import org.springframework.beans.factory.annotation.Autowired; @@ -54,7 +55,9 @@ public String getName() { @Override public CompletableFuture onFilter(Invocation invocation, FilterNode nextNode) { - if (PathCheckUtils.isNotRequiredAuth(invocation.getOperationMeta().getOperationPath(), env)) { + String requestFullPath = SwaggerUtils.concatAbsolutePath(invocation.getSchemaMeta().getSwagger(), + invocation.getOperationMeta().getOperationPath()); + if (PathCheckUtils.isNotRequiredAuth(requestFullPath, env)) { return nextNode.onFilter(invocation); } String token = invocation.getContext(CoreConst.AUTH_TOKEN); diff --git a/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/provider/TestPathCheckUtils.java b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/provider/TestPathCheckUtils.java new file mode 100644 index 00000000000..b8ff4623081 --- /dev/null +++ b/handlers/handler-publickey-auth/src/test/java/org/apache/servicecomb/authentication/provider/TestPathCheckUtils.java @@ -0,0 +1,161 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.servicecomb.authentication.provider; + +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.mockito.Mockito.when; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.servers.Server; +import org.apache.servicecomb.swagger.SwaggerUtils; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.core.env.Environment; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class TestPathCheckUtils { + private static final String KEY_INCLUDE_PATH = "servicecomb.publicKey.accessControl.includePathPatterns"; + + private static final String KEY_EXCLUDE_PATH = "servicecomb.publicKey.accessControl.excludePathPatterns"; + + private static final String BASE_PATH = "/api/v1"; + + private Environment environment; + + private OpenAPI swagger; + + @BeforeEach + public void setUp() { + environment = Mockito.mock(Environment.class); + swagger = new OpenAPI(); + swagger.setServers(new ArrayList<>()); + swagger.getServers().add(new Server().url(BASE_PATH)); + } + + @Test + public void testExcludePathWithBasePathAndExactMatch() { + String operationPath = "/public"; + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(BASE_PATH + operationPath); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, operationPath); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for excluded path with exact match"); + } + + @Test + public void testExcludePathWithBasePathAndWildcard() { + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(BASE_PATH + "/public/*"); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/public/test"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for excluded path with wildcard"); + + fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/public/nested/path"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for excluded nested path with wildcard"); + } + + @Test + public void testIncludePathWithBasePath() { + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(""); + when(environment.getProperty(KEY_INCLUDE_PATH, "")).thenReturn(BASE_PATH + "/private/*"); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/private/resource"); + assertFalse(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should require auth for included path"); + + fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/public/resource"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for non-included path"); + } + + @Test + public void testExcludeOverrideIncludePath() { + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(BASE_PATH + "/resource"); + when(environment.getProperty(KEY_INCLUDE_PATH, "")).thenReturn(BASE_PATH + "/*"); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/resource"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Exclude patterns should override include patterns"); + } + + @Test + public void testMultipleExcludePaths() { + List operationPaths = List.of("/public", "/health", "/metrics/*"); + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(concatPath(BASE_PATH, operationPaths)); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/public"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for first exclude path"); + + fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/health"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for second exclude path"); + + fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/metrics/jvm"); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth for wildcard exclude path"); + } + + @Test + public void testDifferentBasePath() { + String basePath = "/different/base"; + String publicOperationPath = "/public"; + String privateOperationPath = "/private"; + swagger.getServers().clear(); + swagger.getServers().add(new Server().url(basePath)); + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(basePath + publicOperationPath); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, publicOperationPath); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth with different base path"); + + fullPath = SwaggerUtils.concatAbsolutePath(swagger, privateOperationPath); + assertFalse(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should require auth for non-excluded path with different base path"); + } + + @Test + public void testNoBasePath() { + String operationPath = "/public"; + swagger.setServers(null); + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(operationPath); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, operationPath); + assertTrue(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should not require auth when no base path is set"); + } + + @Test + public void testEmptyConfiguration() { + when(environment.getProperty(KEY_EXCLUDE_PATH, "")).thenReturn(""); + when(environment.getProperty(KEY_INCLUDE_PATH, "")).thenReturn(""); + + String fullPath = SwaggerUtils.concatAbsolutePath(swagger, "/any/path"); + assertFalse(PathCheckUtils.isNotRequiredAuth(fullPath, environment), + "Should require auth by default when no patterns are configured"); + } + + private String concatPath(String basePath, List paths) { + return paths.stream().map(path -> basePath + path).collect(Collectors.joining(",")); + } +} diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java index 211a612a861..c1751b728a8 100644 --- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java +++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/SwaggerUtils.java @@ -445,4 +445,24 @@ public static boolean methodExists(PathItem pathItem, String httpMethod) { default -> false; }; } + + public static String concatAbsolutePath(OpenAPI swagger, String operationPath) { + String basePath = getBasePath(swagger); + return concatPath(basePath, operationPath); + } + + /** + * Concat the two paths to an absolute path, without end of '/'. + *

+ * e.g. "/" + "/ope" = /ope + * e.g. "/prefix" + "/ope" = /prefix/ope + */ + public static String concatPath(String basePath, String operationPath) { + return ("/" + nonNullify(basePath) + "/" + nonNullify(operationPath)) + .replaceAll("/{2,}", "/"); + } + + private static String nonNullify(String path) { + return path == null ? "" : path; + } } From 47cddeb952954fa96d12e8c0446166a90ad1d762 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:17:56 +0800 Subject: [PATCH 047/223] Bump io.micrometer:micrometer-bom from 1.14.2 to 1.14.4 (#4743) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.14.2 to 1.14.4. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.14.2...v1.14.4) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 254752c1574..e8b41c91841 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.24.3 3.9.9 - 1.14.2 + 1.14.4 5.15.2 5.2.0 5.15.0 From 7486dcba1a2f2a197570b4af87427553d4004971 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:18:17 +0800 Subject: [PATCH 048/223] Bump com.puppycrawl.tools:checkstyle from 10.21.2 to 10.21.3 (#4742) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.21.2 to 10.21.3. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.21.2...checkstyle-10.21.3) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ce5e6b4b39c..9396843bea3 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.21.2 + 10.21.3 3.1.1 3.21.0 3.3.0 From 3e55ef9c5ca09abf05ba9d4bc66b929689bd225b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:18:39 +0800 Subject: [PATCH 049/223] Bump org.apache.maven.plugins:maven-project-info-reports-plugin (#4740) Bumps [org.apache.maven.plugins:maven-project-info-reports-plugin](https://github.com/apache/maven-project-info-reports-plugin) from 3.8.0 to 3.9.0. - [Release notes](https://github.com/apache/maven-project-info-reports-plugin/releases) - [Commits](https://github.com/apache/maven-project-info-reports-plugin/compare/maven-project-info-reports-plugin-3.8.0...maven-project-info-reports-plugin-3.9.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-project-info-reports-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9396843bea3..352e1efacf7 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 3.13.0 3.5.2 3.4.2 - 3.8.0 + 3.9.0 3.2.0 1.7.1 0.6.1 From 4f3ea7782e0c839c1932eebcbc9ae6c893564bed Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:19:06 +0800 Subject: [PATCH 050/223] Bump org.yaml:snakeyaml from 2.3 to 2.4 (#4739) Bumps [org.yaml:snakeyaml](https://bitbucket.org/snakeyaml/snakeyaml) from 2.3 to 2.4. - [Commits](https://bitbucket.org/snakeyaml/snakeyaml/branches/compare/snakeyaml-2.4..snakeyaml-2.3) --- updated-dependencies: - dependency-name: org.yaml:snakeyaml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e8b41c91841..63a23e108c8 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 0.13.2 6.0.0 1.7.36 - 2.3 + 2.4 6.1.10 2.2.28 4.5.13 From cd859226394fc6e3f225604fee50f1f02894de0e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:19:39 +0800 Subject: [PATCH 051/223] Bump io.zipkin.zipkin2:zipkin from 3.4.4 to 3.5.0 (#4737) Bumps [io.zipkin.zipkin2:zipkin](https://github.com/openzipkin/zipkin) from 3.4.4 to 3.5.0. - [Release notes](https://github.com/openzipkin/zipkin/releases) - [Changelog](https://github.com/openzipkin/zipkin/blob/master/RELEASE.md) - [Commits](https://github.com/openzipkin/zipkin/compare/3.4.4...3.5.0) --- updated-dependencies: - dependency-name: io.zipkin.zipkin2:zipkin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 63a23e108c8..90dd0d24368 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 6.1.10 2.2.28 4.5.13 - 3.4.4 + 3.5.0 3.4.0 0.8.4 1.4.5 From 649c1f2f6ec8acd005b56658f2e02a70b64ff2b0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:19:52 +0800 Subject: [PATCH 052/223] Bump org.kiwiproject:consul-client from 1.4.5 to 1.5.0 (#4736) Bumps [org.kiwiproject:consul-client](https://github.com/kiwiproject/consul-client) from 1.4.5 to 1.5.0. - [Release notes](https://github.com/kiwiproject/consul-client/releases) - [Changelog](https://github.com/kiwiproject/consul-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/kiwiproject/consul-client/compare/v1.4.5...1.5.0) --- updated-dependencies: - dependency-name: org.kiwiproject:consul-client dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 90dd0d24368..4e0840cdf88 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -92,7 +92,7 @@ 3.5.0 3.4.0 0.8.4 - 1.4.5 + 1.5.0 ${basedir}/../.. From b8648887b38d6230b218ad4c92e7f9882ea92d54 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:20:08 +0800 Subject: [PATCH 053/223] Bump org.owasp:dependency-check-maven from 12.0.2 to 12.1.0 (#4735) Bumps [org.owasp:dependency-check-maven](https://github.com/jeremylong/DependencyCheck) from 12.0.2 to 12.1.0. - [Release notes](https://github.com/jeremylong/DependencyCheck/releases) - [Changelog](https://github.com/jeremylong/DependencyCheck/blob/main/CHANGELOG.md) - [Commits](https://github.com/jeremylong/DependencyCheck/compare/v12.0.2...v12.1.0) --- updated-dependencies: - dependency-name: org.owasp:dependency-check-maven dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 352e1efacf7..147c4e77381 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.0.2 + 12.1.0 0.45.1 3.5.0 3.2.7 From de3ac6cd968f4211247f23e77d421ac90ed882af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:20:21 +0800 Subject: [PATCH 054/223] Bump io.zipkin.brave:brave-bom from 6.0.3 to 6.1.0 (#4734) Bumps [io.zipkin.brave:brave-bom](https://github.com/openzipkin/brave) from 6.0.3 to 6.1.0. - [Release notes](https://github.com/openzipkin/brave/releases) - [Changelog](https://github.com/openzipkin/brave/blob/master/RELEASE.md) - [Commits](https://github.com/openzipkin/brave/compare/6.0.3...6.1.0) --- updated-dependencies: - dependency-name: io.zipkin.brave:brave-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 4e0840cdf88..9ad376557d3 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -34,7 +34,7 @@ 1.2.2 3.27.3 4.2.2 - 6.0.3 + 6.1.0 1.10.0 2.18.0 2.6 From ddac1d953601135b71919c3264ec8a4f7ffe4379 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:20:35 +0800 Subject: [PATCH 055/223] Bump io.netty:netty-bom from 4.1.117.Final to 4.1.119.Final (#4733) Bumps [io.netty:netty-bom](https://github.com/netty/netty) from 4.1.117.Final to 4.1.119.Final. - [Commits](https://github.com/netty/netty/compare/netty-4.1.117.Final...netty-4.1.119.Final) --- updated-dependencies: - dependency-name: io.netty:netty-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 9ad376557d3..4d7d4a52929 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -71,7 +71,7 @@ 5.15.0 2.4.3 0.3.0 - 4.1.117.Final + 4.1.119.Final 4.12.0 0.16.0 3.23.4 From 77808f72ab7f03382d501238018f04916e0d4896 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:20:50 +0800 Subject: [PATCH 056/223] Bump org.apache.maven.plugins:maven-compiler-plugin (#4732) Bumps [org.apache.maven.plugins:maven-compiler-plugin](https://github.com/apache/maven-compiler-plugin) from 3.13.0 to 3.14.0. - [Release notes](https://github.com/apache/maven-compiler-plugin/releases) - [Commits](https://github.com/apache/maven-compiler-plugin/compare/maven-compiler-plugin-3.13.0...maven-compiler-plugin-3.14.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-compiler-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 147c4e77381..a29fa3a1bbc 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 0.8.12 3.11.2 2.5 - 3.13.0 + 3.14.0 3.5.2 3.4.2 3.9.0 From 7743dcd02808bc49c5cb9a3506ec5ebf0512890b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:21:35 +0800 Subject: [PATCH 057/223] Bump commons-logging:commons-logging from 1.3.4 to 1.3.5 (#4730) Bumps commons-logging:commons-logging from 1.3.4 to 1.3.5. --- updated-dependencies: - dependency-name: commons-logging:commons-logging dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 4d7d4a52929..90abc377562 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -39,7 +39,7 @@ 2.18.0 2.6 3.17.0 - 1.3.4 + 1.3.5 1.13.0 5.7.1 1.0.2 From 609b4be6110df001de9d67b4dbcff9ad54c164b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:22:14 +0800 Subject: [PATCH 058/223] Bump com.fasterxml.jackson:jackson-bom from 2.18.2 to 2.18.3 (#4729) Bumps [com.fasterxml.jackson:jackson-bom](https://github.com/FasterXML/jackson-bom) from 2.18.2 to 2.18.3. - [Commits](https://github.com/FasterXML/jackson-bom/compare/jackson-bom-2.18.2...jackson-bom-2.18.3) --- updated-dependencies: - dependency-name: com.fasterxml.jackson:jackson-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 90abc377562..70808f00724 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -53,7 +53,7 @@ 8.0.1.Final 4.5.14 1.5.18 - 2.18.2 + 2.18.3 1.6.0 1.3.2 1 From 938174f85987ef9eb6f6b1d6bca7c839c72e549e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:22:29 +0800 Subject: [PATCH 059/223] Bump org.junit:junit-bom from 5.11.4 to 5.12.0 (#4728) Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.11.4 to 5.12.0. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.11.4...r5.12.0) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 70808f00724..43e70108273 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.11.4 + 5.12.0 1.2.17 2.24.3 3.9.9 From 24e83c493479bb1f4fd9d18efa3d63627c262020 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Mar 2025 16:22:47 +0800 Subject: [PATCH 060/223] Bump stCarolas/setup-maven from 4.5 to 5 (#4726) Bumps [stCarolas/setup-maven](https://github.com/stcarolas/setup-maven) from 4.5 to 5. - [Release notes](https://github.com/stcarolas/setup-maven/releases) - [Commits](https://github.com/stcarolas/setup-maven/compare/v4.5...v5) --- updated-dependencies: - dependency-name: stCarolas/setup-maven dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 15a8cd1777e..a157b6ddfc8 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -39,7 +39,7 @@ jobs: java-version: '17' distribution: 'temurin' - name: Set up Maven - uses: stCarolas/setup-maven@v4.5 + uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.9 - uses: actions/cache@v4 From fb5fc902e625d6e5ee381e648f2107ead038151f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:42:49 +0800 Subject: [PATCH 061/223] Bump commons-beanutils:commons-beanutils from 1.10.0 to 1.10.1 (#4731) Bumps commons-beanutils:commons-beanutils from 1.10.0 to 1.10.1. --- updated-dependencies: - dependency-name: commons-beanutils:commons-beanutils dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 43e70108273..b7de4e040fd 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -35,7 +35,7 @@ 3.27.3 4.2.2 6.1.0 - 1.10.0 + 1.10.1 2.18.0 2.6 3.17.0 From 6be8a56c0748172c93a65df192d2aa21507a360c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Mar 2025 17:42:58 +0800 Subject: [PATCH 062/223] Bump org.awaitility:awaitility from 4.2.2 to 4.3.0 (#4727) Bumps [org.awaitility:awaitility](https://github.com/awaitility/awaitility) from 4.2.2 to 4.3.0. - [Changelog](https://github.com/awaitility/awaitility/blob/master/changelog.txt) - [Commits](https://github.com/awaitility/awaitility/compare/awaitility-4.2.2...awaitility-4.3.0) --- updated-dependencies: - dependency-name: org.awaitility:awaitility dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index b7de4e040fd..00d6accea65 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -33,7 +33,7 @@ 1.2.2 3.27.3 - 4.2.2 + 4.3.0 6.1.0 1.10.1 2.18.0 From 59b8851dc47ec3f63fcbdb7c3d5da521fd9e8655 Mon Sep 17 00:00:00 2001 From: vikeria Date: Fri, 18 Apr 2025 23:36:01 +0800 Subject: [PATCH 063/223] [#4779] add filter by SPIEnabled --- .../org/apache/servicecomb/registry/RegistrationManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/RegistrationManager.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/RegistrationManager.java index 0639d00f401..9c135d380c8 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/RegistrationManager.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/RegistrationManager.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import org.apache.servicecomb.foundation.common.utils.LambdaUtils; +import org.apache.servicecomb.foundation.common.utils.SPIEnabled; import org.apache.servicecomb.registry.api.LifeCycle; import org.apache.servicecomb.registry.api.MicroserviceInstanceStatus; import org.apache.servicecomb.registry.api.Registration; @@ -40,7 +41,7 @@ public RegistrationManager(List> re this.registrationList = Collections.emptyList(); return; } - this.registrationList = registrationList; + this.registrationList = registrationList.stream().filter(SPIEnabled::enabled).collect(Collectors.toList()); } /** From 8ce1d956e98427024026f8bc8a935abbc9d41bb5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:30:44 +0800 Subject: [PATCH 064/223] Bump com.google.guava:guava from 33.4.0-jre to 33.4.6-jre (#4772) Bumps [com.google.guava:guava](https://github.com/google/guava) from 33.4.0-jre to 33.4.6-jre. - [Release notes](https://github.com/google/guava/releases) - [Commits](https://github.com/google/guava/commits) --- updated-dependencies: - dependency-name: com.google.guava:guava dependency-version: 33.4.6-jre dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 00d6accea65..e52f805d987 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -46,7 +46,7 @@ 3.0.2 1.17.12 1.17.13 - 33.4.0-jre + 33.4.6-jre 5.1.0 1.3 2.2.2 From 963425a1c4b88fe59481facd5a594bf7a56d703a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:31:15 +0800 Subject: [PATCH 065/223] Bump com.alibaba.nacos:nacos-client from 2.4.3 to 2.5.1 (#4771) Bumps [com.alibaba.nacos:nacos-client](https://github.com/alibaba/nacos) from 2.4.3 to 2.5.1. - [Release notes](https://github.com/alibaba/nacos/releases) - [Changelog](https://github.com/alibaba/nacos/blob/develop/CHANGELOG.md) - [Commits](https://github.com/alibaba/nacos/compare/2.4.3...2.5.1) --- updated-dependencies: - dependency-name: com.alibaba.nacos:nacos-client dependency-version: 2.5.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e52f805d987..a72d4ed7f1a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.15.2 5.2.0 5.15.0 - 2.4.3 + 2.5.1 0.3.0 4.1.119.Final 4.12.0 From a624446896f3c70c5a4d7d5747deafe9a8814dec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:31:32 +0800 Subject: [PATCH 066/223] Bump io.micrometer:micrometer-bom from 1.14.4 to 1.14.5 (#4770) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.14.4 to 1.14.5. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.14.4...v1.14.5) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-version: 1.14.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a72d4ed7f1a..16d3428248b 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.24.3 3.9.9 - 1.14.4 + 1.14.5 5.15.2 5.2.0 5.15.0 From 9d4f31585f8584f9de113d99fcaede5ca108115a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:32:43 +0800 Subject: [PATCH 067/223] Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.5.2 to 3.5.3 (#4767) Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.5.2 to 3.5.3. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.2...surefire-3.5.3) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-failsafe-plugin dependency-version: 3.5.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a29fa3a1bbc..efe471068b1 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ 3.11.2 2.5 3.14.0 - 3.5.2 + 3.5.3 3.4.2 3.9.0 3.2.0 From 8e4f7a94a9ec87f4f4e14052b894265cb1099993 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:32:58 +0800 Subject: [PATCH 068/223] Bump com.google.guava:failureaccess from 1.0.2 to 1.0.3 (#4766) Bumps com.google.guava:failureaccess from 1.0.2 to 1.0.3. --- updated-dependencies: - dependency-name: com.google.guava:failureaccess dependency-version: 1.0.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 16d3428248b..3f05c114067 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -42,7 +42,7 @@ 1.3.5 1.13.0 5.7.1 - 1.0.2 + 1.0.3 3.0.2 1.17.12 1.17.13 From 382ea09969d8cf2f474fd0862c17b8c0414687f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:33:14 +0800 Subject: [PATCH 069/223] Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.2 to 3.5.3 (#4764) Bumps [org.apache.maven.plugins:maven-surefire-plugin](https://github.com/apache/maven-surefire) from 3.5.2 to 3.5.3. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.2...surefire-3.5.3) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-surefire-plugin dependency-version: 3.5.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index efe471068b1..298aabd9d80 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 3.3.0 4.8.6.6 3.3.5 - 3.5.2 + 3.5.3 From 30ecca8d5d7837f526f0fad8f2ca4600ff70684a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:33:45 +0800 Subject: [PATCH 070/223] Bump io.etcd:jetcd-core from 0.8.4 to 0.8.5 (#4762) Bumps [io.etcd:jetcd-core](https://github.com/etcd-io/jetcd) from 0.8.4 to 0.8.5. - [Release notes](https://github.com/etcd-io/jetcd/releases) - [Changelog](https://github.com/etcd-io/jetcd/blob/main/CHANGELOG.md) - [Commits](https://github.com/etcd-io/jetcd/commits/jetcd-0.8.5) --- updated-dependencies: - dependency-name: io.etcd:jetcd-core dependency-version: 0.8.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 3f05c114067..97671f87db8 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -91,7 +91,7 @@ 4.5.13 3.5.0 3.4.0 - 0.8.4 + 0.8.5 1.5.0 ${basedir}/../.. From 9046e157b9e06f2a99d8d94fdaf8b939362a8f9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:34:09 +0800 Subject: [PATCH 071/223] Bump com.puppycrawl.tools:checkstyle from 10.21.3 to 10.22.0 (#4760) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 10.21.3 to 10.22.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-10.21.3...checkstyle-10.22.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 10.22.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 298aabd9d80..1fa7d82d9a9 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.21.3 + 10.22.0 3.1.1 3.21.0 3.3.0 From 436d3e0e31e20160cd0ea072c4c2ff882a3949b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:34:26 +0800 Subject: [PATCH 072/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.28 to 2.2.29 (#4759) Bumps io.swagger.core.v3:swagger-core-jakarta from 2.2.28 to 2.2.29. --- updated-dependencies: - dependency-name: io.swagger.core.v3:swagger-core-jakarta dependency-version: 2.2.29 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 97671f87db8..544b84867ef 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -87,7 +87,7 @@ 1.7.36 2.4 6.1.10 - 2.2.28 + 2.2.29 4.5.13 3.5.0 3.4.0 From 8dc46def1e2f3bb4f1754a58369cbeb606b89bc3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:34:37 +0800 Subject: [PATCH 073/223] Bump org.junit:junit-bom from 5.12.0 to 5.12.1 (#4758) Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.12.0 to 5.12.1. - [Release notes](https://github.com/junit-team/junit5/releases) - [Commits](https://github.com/junit-team/junit5/compare/r5.12.0...r5.12.1) --- updated-dependencies: - dependency-name: org.junit:junit-bom dependency-version: 5.12.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 544b84867ef..d219da09955 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.12.0 + 5.12.1 1.2.17 2.24.3 3.9.9 From be5df3352f4c664298f74ba24326bb183a75b77a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 24 Apr 2025 17:34:49 +0800 Subject: [PATCH 074/223] Bump org.apache:apache from 33 to 34 (#4757) Bumps [org.apache:apache](https://github.com/apache/maven-apache-parent) from 33 to 34. - [Release notes](https://github.com/apache/maven-apache-parent/releases) - [Commits](https://github.com/apache/maven-apache-parent/commits) --- updated-dependencies: - dependency-name: org.apache:apache dependency-version: '34' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1fa7d82d9a9..4d51b2c2078 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache apache - 33 + 34 From 5ca63978ee79bb9563990d13da73f7b18e613635 Mon Sep 17 00:00:00 2001 From: qlonglong Date: Wed, 30 Apr 2025 11:50:39 +0800 Subject: [PATCH 075/223] delete the expired interfaces (#4786) the current version no longer has the Handler mechanism, so the related interfaces are deleted. --- .../java/org/apache/servicecomb/core/BootListener.java | 8 -------- 1 file changed, 8 deletions(-) diff --git a/core/src/main/java/org/apache/servicecomb/core/BootListener.java b/core/src/main/java/org/apache/servicecomb/core/BootListener.java index 507b3e32d43..ea8314e2e1d 100644 --- a/core/src/main/java/org/apache/servicecomb/core/BootListener.java +++ b/core/src/main/java/org/apache/servicecomb/core/BootListener.java @@ -115,14 +115,6 @@ default void onBootEvent(BootEvent event) { } } - default void onBeforeHandler(BootEvent event) { - - } - - default void onAfterHandler(BootEvent event) { - - } - default void onBeforeFilter(BootEvent event) { } From 9e7c13cb4541cdbac93d16bf28c473f4111a715f Mon Sep 17 00:00:00 2001 From: qlonglong Date: Wed, 30 Apr 2025 11:51:04 +0800 Subject: [PATCH 076/223] modify the prompt message (#4782) when the update of service properties fails, change the prompt message from `update service instance status fails` to `update service properties fails`. --- .../service/center/client/ServiceCenterClient.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 19b6b80f621..7d414fb23ac 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -549,12 +549,12 @@ public boolean updateMicroserviceProperties(String serviceId, Map Date: Fri, 2 May 2025 10:05:07 +0800 Subject: [PATCH 077/223] Bump org.junit:junit-bom from 5.12.1 to 5.12.2 (#4805) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index d219da09955..86692752a2a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.12.1 + 5.12.2 1.2.17 2.24.3 3.9.9 From 0d6d0948c99af206a986251cab45463fa61d580e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 10:29:57 +0800 Subject: [PATCH 078/223] Bump commons-io:commons-io from 2.18.0 to 2.19.0 (#4799) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 86692752a2a..33678be69af 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -36,7 +36,7 @@ 4.3.0 6.1.0 1.10.1 - 2.18.0 + 2.19.0 2.6 3.17.0 1.3.5 From 05a53f0f33393edca55281451d4739be2a5c97cd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 May 2025 10:30:27 +0800 Subject: [PATCH 079/223] Bump org.owasp:dependency-check-maven from 12.1.0 to 12.1.1 (#4798) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4d51b2c2078..30ead9f4544 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.1.0 + 12.1.1 0.45.1 3.5.0 3.2.7 From 43299489a147d33943b3310dea7f9fb970e5a329 Mon Sep 17 00:00:00 2001 From: qlonglong Date: Wed, 7 May 2025 17:48:16 +0800 Subject: [PATCH 080/223] Fix the bug that the SC address is configured for automatic discovery but cannot be automatically refreshed (#4807) Subscribing to the `HeartBeatEvent` and publishing the `HeartBeatEvent` are handled by two different event buses. Therefore, the `SCAddressManager` will never receive the `HeartBeatEvent`. As a result, even if `servicecomb.registry.sc.autodiscovery: true` is configured, the system will not automatically refresh the SC address. --- .../org/apache/servicecomb/registry/sc/SCAddressManager.java | 2 +- .../org/apache/servicecomb/registry/sc/SCRegistration.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java index c9bf300a36f..c650d068bcd 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java @@ -63,7 +63,7 @@ public SCAddressManager(SCConfigurationProperties configurationProperties, this.configurationProperties = configurationProperties; this.serviceCenterClient = serviceCenterClient; this.scRegistration = scRegistration; - EventManager.getEventBus().register(this); + scRegistration.getEventBus().register(this); } @Subscribe diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java index a2a47ca5a08..aba4d6d49a3 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java @@ -194,4 +194,8 @@ public Microservice getBackendMicroservice() { public MicroserviceInstance getBackendMicroserviceInstance() { return microserviceInstance; } + + EventBus getEventBus() { + return eventBus; + } } From 88b71a15066d5ac105a37d45a6c148be74f094bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:23:21 +0800 Subject: [PATCH 081/223] Bump com.puppycrawl.tools:checkstyle from 10.22.0 to 10.23.1 (#4804) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 30ead9f4544..7b6767a291b 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.22.0 + 10.23.1 3.1.1 3.21.0 3.3.0 From 80e4f2034f56d7b5b7d17a47224807cdbe99cf79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:23:42 +0800 Subject: [PATCH 082/223] Bump io.fabric8:docker-maven-plugin from 0.45.1 to 0.46.0 (#4802) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 7b6767a291b..81f64b3281d 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ 3.6.0 4.3.0 12.1.1 - 0.45.1 + 0.46.0 3.5.0 3.2.7 0.8.12 From 107ad87ad2b04d1d5a6b90a2275da26d9fffa34b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:24:01 +0800 Subject: [PATCH 083/223] Bump io.micrometer:micrometer-bom from 1.14.5 to 1.14.6 (#4801) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 33678be69af..1012da45583 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.24.3 3.9.9 - 1.14.5 + 1.14.6 5.15.2 5.2.0 5.15.0 From 851f0d9057c8531b41711f780d87513cea862b06 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:24:26 +0800 Subject: [PATCH 084/223] Bump com.alibaba.nacos:nacos-client from 2.5.1 to 3.0.0 (#4800) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 1012da45583..d16f0790609 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.15.2 5.2.0 5.15.0 - 2.5.1 + 3.0.0 0.3.0 4.1.119.Final 4.12.0 From 3e8c08595e451f94ad1f92faff0933cbae67bc07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:24:44 +0800 Subject: [PATCH 085/223] Bump io.zipkin.brave:brave-bom from 6.1.0 to 6.2.0 (#4796) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index d16f0790609..c7eafec496d 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -34,7 +34,7 @@ 1.2.2 3.27.3 4.3.0 - 6.1.0 + 6.2.0 1.10.1 2.19.0 2.6 From 77330992bdd7319265c04ae7e0152e437bd85e51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:25:20 +0800 Subject: [PATCH 086/223] Bump com.google.guava:guava from 33.4.6-jre to 33.4.8-jre (#4794) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index c7eafec496d..dd45428c497 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -46,7 +46,7 @@ 3.0.2 1.17.12 1.17.13 - 33.4.6-jre + 33.4.8-jre 5.1.0 1.3 2.2.2 From d060439eb7599b363f2ce6f5ad347d64edb4efc9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:25:38 +0800 Subject: [PATCH 087/223] Bump io.zipkin.zipkin2:zipkin from 3.5.0 to 3.5.1 (#4793) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index dd45428c497..0c24890c0f3 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 6.1.10 2.2.29 4.5.13 - 3.5.0 + 3.5.1 3.4.0 0.8.5 1.5.0 From f25780ba4c1f2dc548b6f5e6f7d798a3db813d07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:25:53 +0800 Subject: [PATCH 088/223] Bump org.apache.commons:commons-text from 1.13.0 to 1.13.1 (#4790) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 0c24890c0f3..a9a13f3d012 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -40,7 +40,7 @@ 2.6 3.17.0 1.3.5 - 1.13.0 + 1.13.1 5.7.1 1.0.3 3.0.2 From 22b4497c93b915ef13b0fe1b7a64af734b06e933 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:26:07 +0800 Subject: [PATCH 089/223] Bump org.jacoco:jacoco-maven-plugin from 0.8.12 to 0.8.13 (#4789) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 81f64b3281d..cbe4035ba00 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 0.46.0 3.5.0 3.2.7 - 0.8.12 + 0.8.13 3.11.2 2.5 3.14.0 From c48b23ebe7e032ca6257ab5a9e25785eadeca51a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 May 2025 16:27:28 +0800 Subject: [PATCH 090/223] Bump vertx.version from 4.5.13 to 4.5.14 (#4791) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a9a13f3d012..aec7f6b608c 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -88,7 +88,7 @@ 2.4 6.1.10 2.2.29 - 4.5.13 + 4.5.14 3.5.1 3.4.0 0.8.5 From 4b40753847e2652e37dea898fc36068e6586f4fd Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 16 May 2025 16:53:08 +0800 Subject: [PATCH 091/223] [#4808] fixed log level error cause exception stack cannot be output problem (#4809) --- .../foundation/vertx/client/http/HttpClientPoolFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java index b9f4b34e033..26dcb6aab9a 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java @@ -46,7 +46,7 @@ public HttpClientWithContext createClientPool(Context context) { connection.localAddress(), connection.remoteAddress()) ); connection.exceptionHandler(e -> - LOGGER.info("http connection exception, local:{}, remote:{}.", + LOGGER.error("http connection exception, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress(), e) ); }).build(); From f48cdf4dcb2467f577e0710b41175a31b8f05ba4 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Tue, 20 May 2025 17:36:20 +0800 Subject: [PATCH 092/223] [#4813] Adjust the log information about scheduled tasks and limiting to improve product experience (#4814) --- .../config/center/client/ConfigCenterClient.java | 5 +++++ .../config/center/client/ConfigCenterManager.java | 3 ++- .../apache/servicecomb/config/kie/client/KieClient.java | 6 ++++++ .../servicecomb/config/kie/client/KieConfigManager.java | 3 ++- .../service/center/client/ServiceCenterClient.java | 5 +++++ .../service/center/client/ServiceCenterDiscovery.java | 5 ++++- .../service/center/client/ServiceCenterRegistration.java | 9 +++++++-- 7 files changed, 31 insertions(+), 5 deletions(-) diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java index 00889cbf63b..25aedec6623 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java @@ -116,6 +116,11 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques queryConfigurationsResponse.setChanged(false); addressManager.recordSuccessState(address); return queryConfigurationsResponse; + } else if (httpResponse.getStatusCode() == HttpStatus.SC_TOO_MANY_REQUESTS) { + LOGGER.warn("rate limited, keep the local dimension [{}] configs unchanged.", dimensionsInfo); + queryConfigurationsResponse.setChanged(false); + addressManager.recordSuccessState(address); + return queryConfigurationsResponse; } else if (httpResponse.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { throw new OperationException("Bad request for query configurations."); } else { diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java index 6dadab7b134..7bfc43b4e05 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterManager.java @@ -91,7 +91,8 @@ public void execute() { startTask( new BackOffSleepTask(configCenterConfiguration.getRefreshIntervalInMillis(), new PollConfigurationTask(0))); } catch (Exception e) { - LOGGER.error("get configurations from ConfigCenter failed, and will try again.", e); + LOGGER.warn("get configurations from ConfigCenter failed, and will try again, cause message: {}. current " + + "fail does not affect the obtained historical configuration.", e.getCause().getMessage()); startTask(new BackOffSleepTask(failCount + 1, new PollConfigurationTask(failCount + 1))); } } diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java index 49f81989ad8..8379e046b5b 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java @@ -105,6 +105,12 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, addressManager.recordSuccessState(address); return configurationsResponse; } + if (httpResponse.getStatusCode() == HttpStatus.SC_TOO_MANY_REQUESTS) { + LOGGER.warn("rate limited, keep the local dimension [{}] configs unchanged.", request.getLabelsQuery()); + configurationsResponse.setChanged(false); + addressManager.recordSuccessState(address); + return configurationsResponse; + } addressManager.recordFailState(address); throw new OperationException( "read response failed. status:" + httpResponse.getStatusCode() + "; message:" + diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java index c2222a6a117..ed251613530 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieConfigManager.java @@ -156,7 +156,8 @@ public void execute() { new PollConfigurationTask(0, this.configurationsRequest))); } } catch (Exception e) { - LOGGER.error("get configurations from KieConfigCenter failed, and will try again.", e); + LOGGER.warn("get configurations from KieConfigCenter failed, and will try again, cause message: {}. current " + + "fail does not affect the obtained historical configuration.", e.getCause().getMessage()); startTask( new BackOffSleepTask(failCount + 1, new PollConfigurationTask(failCount + 1, this.configurationsRequest))); } diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 7d414fb23ac..1e6f41561d6 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -250,6 +250,11 @@ public FindMicroserviceInstancesResponse findMicroserviceInstance(String consume result.setModified(false); return result; } + if (response.getStatusCode() == HttpStatus.SC_TOO_MANY_REQUESTS) { + LOGGER.warn("rate limited, keep the local service {}#{} instance cache unchanged.", appId, serviceName); + result.setModified(false); + return result; + } sendUnAuthorizedEvent(response); throw new OperationException( "get service instances list fails, statusCode = " + response.getStatusCode() + "; message = " + response diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java index 808c13daf3d..6e10ba3585a 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java @@ -186,11 +186,14 @@ private List pullInstance(SubscriptionKey k, SubscriptionValue } } } catch (Exception e) { - LOGGER.warn("find service {}#{} instance failed.", k.appId, k.serviceName, e); if (!(e.getCause() instanceof IOException)) { // for IOException, do not remove cache, or when service center // not available, invocation between microservices will fail. failedKeys.add(k); + LOGGER.error("find service {}#{} instance failed and remove local cache.", k.appId, k.serviceName, e); + } else { + LOGGER.warn("find service {}#{} instance failed, remaining local instances cache, cause message: {}", + k.appId, k.serviceName, e.getMessage()); } } return failedKeys; diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java index 07d8337581c..7f453834b86 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterRegistration.java @@ -287,7 +287,7 @@ public void execute() { } if (!serviceCenterClient.sendHeartBeat(microservice.getServiceId(), microserviceInstance.getInstanceId())) { - LOGGER.error("send heart failed, and will try again."); + LOGGER.warn("send heart failed, and will try again."); eventBus.post(new HeartBeatEvent(false, microservice, microserviceInstance)); startTask(new BackOffSleepTask(failedCount + 1, new SendHeartBeatTask(failedCount + 1))); } else { @@ -297,7 +297,12 @@ public void execute() { new BackOffSleepTask(Math.max(heartBeatInterval, heartBeatRequestTimeout), new SendHeartBeatTask(0))); } } catch (Exception e) { - LOGGER.error("send heart failed, and will try again.", e); + // If heartbeat failures three times, log error stack help troubleshooting. Others just log message as warn. + if (failedCount == 2) { + LOGGER.error("send heart failed, and will try again.", e); + } else { + LOGGER.warn("send heart failed, and will try again. message [{}]", e.getCause().getMessage()); + } eventBus.post(new HeartBeatEvent(false, microservice, microserviceInstance)); startTask(new BackOffSleepTask(failedCount + 1, new SendHeartBeatTask(failedCount + 1))); } From 0e43264cf2298fbf5c89002e60dc197bccb71468 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Tue, 20 May 2025 18:42:36 +0800 Subject: [PATCH 093/223] add core dependencies (#4815) --- README.md | 8 ++++++++ README_ZH.md | 12 ++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eb2de51192d..66d5c838837 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,8 @@ Apache ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid development of microservices in Java, providing service registration, service discovery, dynamic routing, and service management features. +> If you find this project helpful, please don't forget to `star` it. + # releases | Release Train | Latest Version | Compiled JDK Version | Tested JDK Version | Open API | Notes | @@ -10,6 +12,12 @@ Apache ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid de | Java Chassis 2 | 2.8.20 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | Depends on Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | End of Support | +Java Chassis core dependencies + +| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | +| ---- | ---- | ---- | ---- | ---- | +| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | + > NOTICE: Since Open API 3.0.x is not compatible with 2.0.x, Java Chassis 2 and Java Chassis 1 can not > work together with Java Chassis 3. All related consumers, providers and edge service need use Java Chassis 3 when upgrading. diff --git a/README_ZH.md b/README_ZH.md index 7f378a96a6f..5cd9a67d752 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -10,6 +10,8 @@ Apache ServiceComb Java Chassis 给开发者提供一个快速构建微服务的 可以通过[设计选型参考](https://servicecomb.apache.org/references/java-chassis/zh_CN/start/design.html) 了解更多特性和设计原理。 +> 如果发现项目能帮助到您,别忘了点击右上角`star`表示鼓励。 + # 发布版本 | 版本火车 | 最新版本 | 编译的JDK版本 | 支持的JDK版本 | Open API | 备注 | @@ -18,9 +20,15 @@ Apache ServiceComb Java Chassis 给开发者提供一个快速构建微服务的 | Java Chassis 2 | 2.8.20 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | 依赖Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | 停止更新 | ->>>NOTICE: Open API 3.0.x 不兼容 2.0.x, 因此Java Chassis 2、Java Chassis 1不能与Java Chassis 3共存互访. 升级Java Chassis 3, 需要将相关的消费者、提供者和边缘服务同时升级. +Java Chassis 的核心依赖 + +| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | +| ---- | ---- | ---- | ---- | ---- | +| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | + +> NOTICE: Open API 3.0.x 不兼容 2.0.x, 因此Java Chassis 2、Java Chassis 1不能与Java Chassis 3共存互访. 升级Java Chassis 3, 需要将相关的消费者、提供者和边缘服务同时升级. ->>>NOTICE: Java Chassis 1 第一个版本于2018发布,已经停止更新. +> NOTICE: Java Chassis 1 第一个版本于2018发布,已经停止更新. # 快速开始 From 11d8645abceabd5757c3055eab69a509a291ee2a Mon Sep 17 00:00:00 2001 From: liubao68 Date: Tue, 20 May 2025 18:46:04 +0800 Subject: [PATCH 094/223] remove duplicate info (#4816) --- README.md | 6 ------ README_ZH.md | 6 ------ 2 files changed, 12 deletions(-) diff --git a/README.md b/README.md index 66d5c838837..bf437e34568 100644 --- a/README.md +++ b/README.md @@ -111,11 +111,5 @@ mailing list: [subscribe](mailto:dev-subscribe@servicecomb.apache.org) [dev](ht See [CONTRIBUTING](http://servicecomb.apache.org/developers/contributing) for details on submitting patches and the contribution workflow. -# Star this project - -If you like this project, do not forget star it. - -[![Star History Chart](https://api.star-history.com/svg?repos=apache/servicecomb-java-chassis&type=Date)](https://star-history.com/#apache/servicecomb-java-chassis&Date) - # License Licensed under an [Apache 2.0 license](LICENSE). diff --git a/README_ZH.md b/README_ZH.md index 5cd9a67d752..873541164ac 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -119,11 +119,5 @@ public class ConsumerController implements ConsumerService { 参考 [如何做贡献](http://servicecomb.apache.org/cn/developers/contributing). -# 给项目加星 - -如果喜欢这个项目,请给项目加星,把它推荐给更多人。 - -[![Star History Chart](https://api.star-history.com/svg?repos=apache/servicecomb-java-chassis&type=Date)](https://star-history.com/#apache/servicecomb-java-chassis&Date) - # License Licensed under an [Apache 2.0 license](LICENSE). From 7d30386fdc3fcc062f935c9ffba5f1723bce380c Mon Sep 17 00:00:00 2001 From: SweetWuXiaoMei Date: Wed, 21 May 2025 09:24:27 +0800 Subject: [PATCH 095/223] spot bugs repair (#4788) --- .../client/common/AbstractAddressManager.java | 2 +- .../center/client/ServiceCenterWatch.java | 11 ++++++----- .../org/apache/servicecomb/core/Invocation.java | 6 +++--- .../core/executor/GroupExecutor.java | 2 +- .../springmvc/server/CodeFirstSpringmvc.java | 8 ++++---- .../foundation/common/cache/VersionedCache.java | 2 +- .../foundation/common/net/IpPort.java | 4 ++-- .../registry/discovery/DiscoveryTreeNode.java | 2 +- .../client/tcp/AbstractTcpClientPackage.java | 4 ++-- .../vertx/client/tcp/TcpClientConnection.java | 2 +- .../metric/DefaultClientEndpointMetric.java | 2 +- .../vertx/stream/InputStreamToReadStream.java | 2 +- .../vertx/stream/OutputStreamToWriteStream.java | 17 +++++++++-------- .../loadbalance/SessionStickinessRule.java | 2 +- pom.xml | 2 +- .../transport/rest/vertx/RestBodyHandler.java | 4 ++-- 16 files changed, 37 insertions(+), 35 deletions(-) diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java index ae94e5d5f16..52db799f90c 100644 --- a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java @@ -66,7 +66,7 @@ public class AbstractAddressManager { private final List isolationRegionAddress = new ArrayList<>(); - private boolean addressAutoRefreshed = false; + private volatile boolean addressAutoRefreshed = false; private final Object lock = new Object(); diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterWatch.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterWatch.java index a8be8b98b78..a68a73a49c9 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterWatch.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterWatch.java @@ -22,6 +22,7 @@ import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.http.client.auth.RequestAuthHeaderProvider; import org.apache.servicecomb.http.client.common.HttpConfiguration.SSLProperties; @@ -67,7 +68,7 @@ public class ServiceCenterWatch implements WebSocketListener { private String serviceId; - private int continuousError = 0; + private AtomicInteger continuousError = new AtomicInteger(0); private final AtomicBoolean reconnecting = new AtomicBoolean(false); @@ -143,7 +144,7 @@ private void reconnect() { if (reconnecting.getAndSet(true)) { return; } - continuousError++; + continuousError.incrementAndGet(); if (webSocketTransport != null) { webSocketTransport.close(); } @@ -151,11 +152,11 @@ private void reconnect() { } private void backOff() { - if (this.continuousError <= 0) { + if (this.continuousError.get() <= 0) { return; } try { - Thread.sleep(Math.min(SLEEP_MAX, this.continuousError * this.continuousError * SLEEP_BASE)); + Thread.sleep(Math.min(SLEEP_MAX, this.continuousError.get() * this.continuousError.get() * SLEEP_BASE)); } catch (InterruptedException e) { // do not care } @@ -183,7 +184,7 @@ public void onOpen(ServerHandshake serverHandshake) { LOGGER.info("web socket connected to server {}, status={}, message={}", currentServerUri, serverHandshake.getHttpStatus(), serverHandshake.getHttpStatusMessage()); - continuousError = 0; + continuousError.set(0); reconnecting.set(false); } } diff --git a/core/src/main/java/org/apache/servicecomb/core/Invocation.java b/core/src/main/java/org/apache/servicecomb/core/Invocation.java index 6bb00703995..067fe6558f4 100644 --- a/core/src/main/java/org/apache/servicecomb/core/Invocation.java +++ b/core/src/main/java/org/apache/servicecomb/core/Invocation.java @@ -84,15 +84,15 @@ static Collection loadTraceIdGenerators() { // 同步模式:避免应答在网络线程中处理解码等等业务级逻辑 private Executor responseExecutor; - private boolean sync = true; + private volatile boolean sync = true; private final InvocationStageTrace invocationStageTrace = new InvocationStageTrace(this); private HttpServletRequestEx requestEx; - private boolean finished; + private volatile boolean finished; - private long invocationId; + private volatile long invocationId; private TraceIdLogger traceIdLogger; diff --git a/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java b/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java index 24e41d407cd..13562914fac 100644 --- a/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java +++ b/core/src/main/java/org/apache/servicecomb/core/executor/GroupExecutor.java @@ -100,7 +100,7 @@ public GroupExecutor init(String groupName) { return this; } - public void initConfig() { + public synchronized void initConfig() { if (LOG_PRINTED.compareAndSet(false, true)) { LOGGER.info("thread pool rules:\n" + "1.use core threads.\n" diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java index c49d8879d92..36f8518afe4 100644 --- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java +++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/CodeFirstSpringmvc.java @@ -495,7 +495,7 @@ public Generic> testGenericGenericUser(@RequestBody Generic attributes = new ConcurrentHashMapEx<>(); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/AbstractTcpClientPackage.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/AbstractTcpClientPackage.java index 763ba5e3daf..ef6717f8968 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/AbstractTcpClientPackage.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/AbstractTcpClientPackage.java @@ -27,9 +27,9 @@ public static long getAndIncRequestId() { return reqId.getAndIncrement(); } - private long msRequestTimeout; + private volatile long msRequestTimeout; - private long finishWriteToBuffer; + private volatile long finishWriteToBuffer; protected long msgId = getAndIncRequestId(); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java index d8800800ff6..ade98d6c1ba 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java @@ -61,7 +61,7 @@ enum Status { private final InetSocketAddress socketAddress; - private boolean localSupportLogin = false; + private volatile boolean localSupportLogin = false; private final boolean remoteSupportLogin; diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultClientEndpointMetric.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultClientEndpointMetric.java index cedd6ec6b32..ce618078957 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultClientEndpointMetric.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/metric/DefaultClientEndpointMetric.java @@ -29,7 +29,7 @@ public class DefaultClientEndpointMetric extends DefaultEndpointMetric { // control if the metric instance will be expired // all invoker about incRefCount/isExpired, must lock: DefaultClientEndpointMetricManager // decRefCount no need to lock, because that only cause to be expired later. - private long lastNanoTime = System.nanoTime(); + private volatile long lastNanoTime = System.nanoTime(); public DefaultClientEndpointMetric(String address) { super(address); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java index f1a5f83b2ce..3f3db7678d9 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java @@ -40,7 +40,7 @@ public class InputStreamToReadStream implements ReadStream { private final InputStream inputStream; - private boolean closed; + private volatile boolean closed; private boolean paused; diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java index 95ea0b5076d..37cf815ecca 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java @@ -21,6 +21,7 @@ import java.util.Queue; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.foundation.common.io.AsyncCloseable; @@ -60,7 +61,7 @@ public class OutputStreamToWriteStream implements WriteStream, AsyncClos // we just need to flow control by pump, so use another size private final Queue buffers = new ConcurrentLinkedQueue<>(); - private int currentBufferCount; + private final AtomicInteger currentBufferCount = new AtomicInteger(); // just indicate if buffers is full, not control add logic // must >= SMALLEST_MAX_BUFFERS @@ -103,7 +104,7 @@ public synchronized Future write(Buffer data) { @Override public void write(Buffer data, Handler> handler) { - currentBufferCount++; + currentBufferCount.incrementAndGet(); buffers.add(data); context.executeBlocking(this::writeInWorker, true, @@ -122,12 +123,12 @@ protected void writeInWorker(Promise future) { outputStream.write(buffer.getBytes()); synchronized (OutputStreamToWriteStream.this) { - currentBufferCount--; - Runnable action = (currentBufferCount == 0 && closedDeferred != null) ? closedDeferred : this::checkDrained; + currentBufferCount.decrementAndGet(); + Runnable action = (currentBufferCount.get() == 0 && closedDeferred != null) ? closedDeferred : this::checkDrained; action.run(); } } catch (IOException e) { - currentBufferCount--; + currentBufferCount.decrementAndGet(); future.fail(e); return; } @@ -148,7 +149,7 @@ public WriteStream setWriteQueueMaxSize(int maxSize) { @Override public synchronized boolean writeQueueFull() { - return currentBufferCount >= maxBuffers; + return currentBufferCount.get() >= maxBuffers; } @Override @@ -158,7 +159,7 @@ public synchronized WriteStream drainHandler(Handler handler) { } private synchronized void checkDrained() { - if (drainHandler != null && currentBufferCount <= drainMark) { + if (drainHandler != null && currentBufferCount.get() <= drainMark) { Handler handler = drainHandler; drainHandler = null; handler.handle(null); @@ -186,7 +187,7 @@ private synchronized CompletableFuture closeInternal() { closed = true; CompletableFuture future = new CompletableFuture<>(); - if (currentBufferCount == 0) { + if (currentBufferCount.get() == 0) { doClose(future); } else { closedDeferred = () -> doClose(future); diff --git a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/SessionStickinessRule.java b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/SessionStickinessRule.java index c3c250b9e48..37d94bc0fa1 100644 --- a/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/SessionStickinessRule.java +++ b/handlers/handler-loadbalance/src/main/java/org/apache/servicecomb/loadbalance/SessionStickinessRule.java @@ -40,7 +40,7 @@ public class SessionStickinessRule implements RuleExt { private volatile ServiceCombServer lastServer = null; - private long lastAccessedTime = 0; + private volatile long lastAccessedTime = 0; private volatile boolean errorThresholdMet = false; diff --git a/pom.xml b/pom.xml index cbe4035ba00..32c4adcd8aa 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 3.1.1 3.21.0 3.3.0 - 4.8.6.6 + 4.9.3.0 3.3.5 3.5.3 diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java index 6492e77e87c..cc74e6d0a8a 100644 --- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java +++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestBodyHandler.java @@ -232,11 +232,11 @@ private class BHandler implements Handler { Buffer body; - boolean failed; + volatile boolean failed; final AtomicInteger uploadCount = new AtomicInteger(); - boolean ended; + volatile boolean ended; long uploadSize = 0L; From 6c6a8718e9ac53115a427c6490824806f1d40fd2 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Wed, 28 May 2025 14:02:06 +0800 Subject: [PATCH 096/223] fix javadocs problem and add check (#4818) --- .github/workflows/checkstyle.yml | 2 ++ .../center/client/ServiceCenterOperation.java | 1 - .../rest/codec/query/QueryCodecMulti.java | 3 --- .../invocation/endpoint/EndpointUtils.java | 4 ++-- .../common/utils/GenericsUtils.java | 8 +++---- .../registry/api/Registration.java | 22 +++++++++---------- .../marker/operator/CompareOperator.java | 2 +- .../router/distribute/RouterDistributor.java | 4 ++-- .../RouterIllegalParamException.java | 4 ++-- .../servicecomb/router/model/HeaderRule.java | 4 ++-- .../router/model/PolicyRuleItem.java | 4 ++-- .../servicecomb/router/model/RouteItem.java | 4 ++-- .../router/model/ServiceInfoCache.java | 4 ++-- .../servicecomb/router/model/TagItem.java | 4 ++-- .../servicecomb/qps/TestQpsStrategy.java | 4 ++-- 15 files changed, 36 insertions(+), 38 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 9b153e77a3e..2accac178fe 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -36,3 +36,5 @@ jobs: distribution: 'temurin' - name: checkstyle run: mvn -B -Pit install -DskipTests -Dspotbugs.skip=true checkstyle:check + - name: javadoc + run: mvn javadoc:javadoc -Prelease diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java index 85671fee9c9..c80e4933a0a 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterOperation.java @@ -160,7 +160,6 @@ boolean updateMicroserviceInstanceStatus(String serviceId, String instanceId, * Batch send heartbeats to service-center * * @param heartbeatsRequest - * @return * @throws OperationException */ void sendHeartBeats(HeartbeatsRequest heartbeatsRequest); diff --git a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/query/QueryCodecMulti.java b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/query/QueryCodecMulti.java index 551ccee01ae..4c2f4287916 100644 --- a/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/query/QueryCodecMulti.java +++ b/common/common-rest/src/main/java/org/apache/servicecomb/common/rest/codec/query/QueryCodecMulti.java @@ -25,9 +25,6 @@ import jakarta.servlet.http.HttpServletRequest; -/** - * ?query=x1&query=x2 - */ @SuppressWarnings("unchecked") public class QueryCodecMulti extends AbstractQueryCodec { public static final String CODEC_NAME = "form:1"; diff --git a/core/src/main/java/org/apache/servicecomb/core/invocation/endpoint/EndpointUtils.java b/core/src/main/java/org/apache/servicecomb/core/invocation/endpoint/EndpointUtils.java index d906de63ba5..2d8b37c997a 100644 --- a/core/src/main/java/org/apache/servicecomb/core/invocation/endpoint/EndpointUtils.java +++ b/core/src/main/java/org/apache/servicecomb/core/invocation/endpoint/EndpointUtils.java @@ -88,7 +88,7 @@ public static Endpoint parse(String uriEndpoint) { } /** - *

+   * {@code
    *   http://xxx  -> rest://xxx
    *   https://xxx -> rest://xxx?sslEnabled=true
    *
@@ -98,7 +98,7 @@ public static Endpoint parse(String uriEndpoint) {
    *   xxx         -> rest://xxx:port?protocol=http2
    *   xxx?a=a1    -> rest://xxx:port?a=a1&protocol=http2
    *   other://xxx -> other://xxx
-   * 
+ * } * * This method provided for convenience of handling user input endpoints, and do not have a strict meaning. Make sure all unit test cases * work before change. diff --git a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/GenericsUtils.java b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/GenericsUtils.java index 0429b82da70..d872236082e 100644 --- a/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/GenericsUtils.java +++ b/foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/utils/GenericsUtils.java @@ -24,14 +24,14 @@ public final class GenericsUtils { /** * check if XXX.class is generic type. see TestGenericsUtils for details meaning. * This method is provided for API compatibility for RestTemplate. Following code: - * - * + *

+ *{@code * List>> response = consumers.getSCBRestTemplate() * postForObject("/testListObjectParam", request, List.class); - * + * } * * should work for versions of 1.*. This is because java-chassis can read type info from swaggers. - * + *

* Start from 2.x, the best practise to write this code is to use ParameterizedTypeReference provided by RestTemplate * exchange method. */ diff --git a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/Registration.java b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/Registration.java index c5529619f56..014da5f147b 100644 --- a/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/Registration.java +++ b/foundations/foundation-registry/src/main/java/org/apache/servicecomb/registry/api/Registration.java @@ -22,42 +22,42 @@ /** - * This is the core service registration interface.
+ * This is the core service registration interface. */ public interface Registration extends SPIEnabled, SPIOrder, LifeCycle { String name(); /** - * get MicroserviceInstance
- * + * get MicroserviceInstance + *

* Life Cycle:This method is called anytime after run. */ R getMicroserviceInstance(); /** - * update MicroserviceInstance status
- * + * update MicroserviceInstance status + *

* Life Cycle:This method is called anytime after run. */ boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus status); /** - * adding schemas to Microservice
- * + * adding schemas to Microservice + *

* Life Cycle:This method is called after init and before run. */ void addSchema(String schemaId, String content); /** - * adding endpoints to MicroserviceInstance
- * + * adding endpoints to MicroserviceInstance + *

* Life Cycle:This method is called after init and before run. */ void addEndpoint(String endpoint); /** - * adding property to MicroserviceInstance
- * + * adding property to MicroserviceInstance + *

* Life Cycle:This method is called after init and before run. */ void addProperty(String key, String value); diff --git a/governance/src/main/java/org/apache/servicecomb/governance/marker/operator/CompareOperator.java b/governance/src/main/java/org/apache/servicecomb/governance/marker/operator/CompareOperator.java index 5379bf8c24c..5b73b9aa939 100644 --- a/governance/src/main/java/org/apache/servicecomb/governance/marker/operator/CompareOperator.java +++ b/governance/src/main/java/org/apache/servicecomb/governance/marker/operator/CompareOperator.java @@ -38,7 +38,7 @@ public String name() { } /** - * 支持 > < = >= <= ! 后面加数字 + * 支持 {@code > < = >= <= !} 后面加数字 * * @param targetStr * @param patternStr diff --git a/governance/src/main/java/org/apache/servicecomb/router/distribute/RouterDistributor.java b/governance/src/main/java/org/apache/servicecomb/router/distribute/RouterDistributor.java index fa9af8fd16f..5f5babdec34 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/distribute/RouterDistributor.java +++ b/governance/src/main/java/org/apache/servicecomb/router/distribute/RouterDistributor.java @@ -23,8 +23,8 @@ import org.apache.servicecomb.router.model.PolicyRuleItem; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public interface RouterDistributor { diff --git a/governance/src/main/java/org/apache/servicecomb/router/exception/RouterIllegalParamException.java b/governance/src/main/java/org/apache/servicecomb/router/exception/RouterIllegalParamException.java index 61fda32c8e4..9647a853ea8 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/exception/RouterIllegalParamException.java +++ b/governance/src/main/java/org/apache/servicecomb/router/exception/RouterIllegalParamException.java @@ -17,8 +17,8 @@ package org.apache.servicecomb.router.exception; /** - * @Author GuoYl123 - * @Date 2019/11/4 + * @author GuoYl123 + * @since 2019/11/4 **/ public class RouterIllegalParamException extends RuntimeException { diff --git a/governance/src/main/java/org/apache/servicecomb/router/model/HeaderRule.java b/governance/src/main/java/org/apache/servicecomb/router/model/HeaderRule.java index 931fcee2273..7a8afeda77f 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/model/HeaderRule.java +++ b/governance/src/main/java/org/apache/servicecomb/router/model/HeaderRule.java @@ -21,8 +21,8 @@ import org.slf4j.LoggerFactory; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public class HeaderRule { diff --git a/governance/src/main/java/org/apache/servicecomb/router/model/PolicyRuleItem.java b/governance/src/main/java/org/apache/servicecomb/router/model/PolicyRuleItem.java index fa2d285ef3d..0700a2618d8 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/model/PolicyRuleItem.java +++ b/governance/src/main/java/org/apache/servicecomb/router/model/PolicyRuleItem.java @@ -25,8 +25,8 @@ import org.springframework.util.CollectionUtils; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public class PolicyRuleItem implements Comparable { diff --git a/governance/src/main/java/org/apache/servicecomb/router/model/RouteItem.java b/governance/src/main/java/org/apache/servicecomb/router/model/RouteItem.java index f2017a923e0..5f1d6e9f8df 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/model/RouteItem.java +++ b/governance/src/main/java/org/apache/servicecomb/router/model/RouteItem.java @@ -19,8 +19,8 @@ import java.util.Map; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public class RouteItem implements Comparable { diff --git a/governance/src/main/java/org/apache/servicecomb/router/model/ServiceInfoCache.java b/governance/src/main/java/org/apache/servicecomb/router/model/ServiceInfoCache.java index 67640320636..232f1da6338 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/model/ServiceInfoCache.java +++ b/governance/src/main/java/org/apache/servicecomb/router/model/ServiceInfoCache.java @@ -22,8 +22,8 @@ import org.springframework.util.CollectionUtils; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public class ServiceInfoCache { private final List allrule; diff --git a/governance/src/main/java/org/apache/servicecomb/router/model/TagItem.java b/governance/src/main/java/org/apache/servicecomb/router/model/TagItem.java index 0fc610df769..a7a20fab7ea 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/model/TagItem.java +++ b/governance/src/main/java/org/apache/servicecomb/router/model/TagItem.java @@ -21,8 +21,8 @@ import java.util.Objects; /** - * @Author GuoYl123 - * @Date 2019/10/17 + * @author GuoYl123 + * @since 2019/10/17 **/ public class TagItem { diff --git a/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestQpsStrategy.java b/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestQpsStrategy.java index 23c228fab2e..f34b6c5a261 100644 --- a/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestQpsStrategy.java +++ b/handlers/handler-flowcontrol-qps/src/test/java/org/apache/servicecomb/qps/TestQpsStrategy.java @@ -24,8 +24,8 @@ import org.junit.jupiter.api.Test; /** - * @Author GuoYl123 - * @Date 2020/7/16 + * @author GuoYl123 + * @since 2020/7/16 **/ public class TestQpsStrategy { From a397f43eb8e4b70605d78af9782fa271410b726f Mon Sep 17 00:00:00 2001 From: liubao68 Date: Wed, 28 May 2025 17:45:21 +0800 Subject: [PATCH 097/223] Prepare new version (#4819) --- README.md | 4 ++-- README_ZH.md | 4 ++-- clients/config-center-client/pom.xml | 2 +- clients/config-common/pom.xml | 2 +- clients/config-kie-client/pom.xml | 2 +- clients/dashboard-client/pom.xml | 2 +- clients/http-client-common/pom.xml | 2 +- clients/pom.xml | 2 +- clients/service-center-client/pom.xml | 2 +- common/common-access-log/pom.xml | 2 +- common/common-protobuf/pom.xml | 2 +- common/common-rest/pom.xml | 2 +- common/pom.xml | 2 +- core/pom.xml | 2 +- coverage-reports/pom.xml | 2 +- demo/demo-consul/consumer/pom.xml | 2 +- demo/demo-consul/gateway/pom.xml | 2 +- demo/demo-consul/pom.xml | 2 +- demo/demo-consul/provider/pom.xml | 2 +- demo/demo-consul/test-client/pom.xml | 2 +- demo/demo-crossapp/crossapp-client/pom.xml | 2 +- demo/demo-crossapp/crossapp-server/pom.xml | 2 +- demo/demo-crossapp/pom.xml | 2 +- demo/demo-cse-v1/consumer/pom.xml | 2 +- demo/demo-cse-v1/gateway/pom.xml | 2 +- demo/demo-cse-v1/pom.xml | 2 +- demo/demo-cse-v1/provider-canary/pom.xml | 2 +- demo/demo-cse-v1/provider/pom.xml | 2 +- demo/demo-cse-v1/test-client/pom.xml | 2 +- demo/demo-cse-v2/consumer/pom.xml | 2 +- demo/demo-cse-v2/gateway/pom.xml | 2 +- demo/demo-cse-v2/pom.xml | 2 +- demo/demo-cse-v2/provider/pom.xml | 2 +- demo/demo-cse-v2/test-client/pom.xml | 2 +- demo/demo-edge/authentication/pom.xml | 2 +- demo/demo-edge/business-1-1-0/pom.xml | 2 +- demo/demo-edge/business-1.0.0/pom.xml | 2 +- demo/demo-edge/business-2.0.0/pom.xml | 2 +- demo/demo-edge/consumer/pom.xml | 2 +- demo/demo-edge/edge-service/pom.xml | 2 +- demo/demo-edge/model/pom.xml | 2 +- demo/demo-edge/pom.xml | 2 +- demo/demo-etcd/consumer/pom.xml | 2 +- demo/demo-etcd/gateway/pom.xml | 2 +- demo/demo-etcd/pom.xml | 2 +- demo/demo-etcd/provider/pom.xml | 2 +- demo/demo-etcd/test-client/pom.xml | 2 +- demo/demo-filter/filter-client/pom.xml | 2 +- demo/demo-filter/filter-edge/pom.xml | 2 +- demo/demo-filter/filter-server/pom.xml | 2 +- demo/demo-filter/filter-tests/pom.xml | 2 +- demo/demo-filter/pom.xml | 2 +- demo/demo-jaxrs/jaxrs-client/pom.xml | 2 +- demo/demo-jaxrs/jaxrs-server/pom.xml | 2 +- demo/demo-jaxrs/pom.xml | 2 +- demo/demo-local-registry/demo-local-registry-client/pom.xml | 2 +- demo/demo-local-registry/demo-local-registry-server/pom.xml | 2 +- demo/demo-local-registry/pom.xml | 2 +- .../demo-multi-registries-client/pom.xml | 2 +- .../demo-multi-registries-server/pom.xml | 2 +- demo/demo-multi-registries/pom.xml | 2 +- .../demo-multi-service-center-client/pom.xml | 2 +- .../demo-multi-service-center-serverA/pom.xml | 2 +- .../demo-multi-service-center-serverB/pom.xml | 2 +- demo/demo-multi-service-center/pom.xml | 2 +- demo/demo-multiple/a-client/pom.xml | 2 +- demo/demo-multiple/a-server/pom.xml | 2 +- demo/demo-multiple/b-client/pom.xml | 2 +- demo/demo-multiple/b-server/pom.xml | 2 +- demo/demo-multiple/multiple-client/pom.xml | 2 +- demo/demo-multiple/multiple-server/pom.xml | 2 +- demo/demo-multiple/pom.xml | 2 +- demo/demo-nacos/consumer/pom.xml | 2 +- demo/demo-nacos/gateway/pom.xml | 2 +- demo/demo-nacos/pom.xml | 2 +- demo/demo-nacos/provider/pom.xml | 2 +- demo/demo-nacos/test-client/pom.xml | 2 +- demo/demo-pojo/pojo-client/pom.xml | 2 +- demo/demo-pojo/pojo-server/pom.xml | 2 +- demo/demo-pojo/pom.xml | 2 +- .../demo-register-url-prefix-client/pom.xml | 2 +- .../demo-register-url-prefix-server/pom.xml | 2 +- demo/demo-register-url-prefix/pom.xml | 2 +- demo/demo-schema/pom.xml | 2 +- .../demo-spring-boot-pojo-client/pom.xml | 2 +- .../demo-spring-boot-pojo-server/pom.xml | 2 +- .../demo-spring-boot-springmvc-client/pom.xml | 2 +- .../demo-spring-boot-springmvc-server/pom.xml | 2 +- demo/demo-spring-boot-transport/pom.xml | 2 +- demo/demo-springmvc/pom.xml | 2 +- demo/demo-springmvc/springmvc-client/pom.xml | 2 +- demo/demo-springmvc/springmvc-server/pom.xml | 2 +- .../demo-zeroconfig-registry-client/pom.xml | 2 +- .../demo-zeroconfig-registry-edge/pom.xml | 2 +- .../demo-zeroconfig-registry-server/pom.xml | 2 +- .../demo-zeroconfig-registry-tests/pom.xml | 2 +- demo/demo-zeroconfig-registry/pom.xml | 2 +- demo/demo-zookeeper/consumer/pom.xml | 2 +- demo/demo-zookeeper/gateway/pom.xml | 2 +- demo/demo-zookeeper/pom.xml | 2 +- demo/demo-zookeeper/provider/pom.xml | 2 +- demo/demo-zookeeper/test-client/pom.xml | 2 +- demo/pom.xml | 2 +- dependencies/bom/pom.xml | 2 +- dependencies/default/pom.xml | 2 +- dependencies/pom.xml | 2 +- distribution/pom.xml | 2 +- dynamic-config/config-apollo/pom.xml | 2 +- dynamic-config/config-cc/pom.xml | 2 +- dynamic-config/config-consul/pom.xml | 2 +- dynamic-config/config-etcd/pom.xml | 2 +- dynamic-config/config-kie/pom.xml | 2 +- dynamic-config/config-nacos/pom.xml | 2 +- dynamic-config/config-zookeeper/pom.xml | 2 +- dynamic-config/pom.xml | 2 +- edge/edge-core/pom.xml | 2 +- edge/pom.xml | 2 +- foundations/foundation-common/pom.xml | 2 +- foundations/foundation-config/pom.xml | 2 +- foundations/foundation-metrics/pom.xml | 2 +- foundations/foundation-protobuf/pom.xml | 2 +- foundations/foundation-registry/pom.xml | 2 +- foundations/foundation-spi/pom.xml | 2 +- foundations/foundation-ssl/pom.xml | 2 +- foundations/foundation-test-scaffolding/pom.xml | 2 +- foundations/foundation-vertx/pom.xml | 2 +- foundations/pom.xml | 2 +- governance/pom.xml | 2 +- handlers/handler-fault-injection/pom.xml | 2 +- handlers/handler-flowcontrol-qps/pom.xml | 2 +- handlers/handler-governance/pom.xml | 2 +- handlers/handler-loadbalance/pom.xml | 2 +- handlers/handler-publickey-auth/pom.xml | 2 +- handlers/handler-router/pom.xml | 2 +- handlers/handler-tracing-zipkin/pom.xml | 2 +- handlers/pom.xml | 2 +- huawei-cloud/darklaunch/pom.xml | 2 +- huawei-cloud/dashboard/pom.xml | 2 +- huawei-cloud/pom.xml | 2 +- huawei-cloud/servicestage/pom.xml | 2 +- metrics/metrics-core/pom.xml | 2 +- metrics/metrics-integration/metrics-prometheus/pom.xml | 2 +- metrics/metrics-integration/pom.xml | 2 +- metrics/pom.xml | 2 +- parents/default/pom.xml | 2 +- parents/pom.xml | 2 +- pom.xml | 2 +- providers/pom.xml | 2 +- providers/provider-jaxrs/pom.xml | 2 +- providers/provider-pojo/pom.xml | 2 +- providers/provider-rest-common/pom.xml | 2 +- providers/provider-springmvc/pom.xml | 2 +- service-registry/pom.xml | 2 +- service-registry/registry-consul/pom.xml | 2 +- service-registry/registry-etcd/pom.xml | 2 +- service-registry/registry-lightweight/pom.xml | 2 +- service-registry/registry-local/pom.xml | 2 +- service-registry/registry-nacos/pom.xml | 2 +- service-registry/registry-service-center/pom.xml | 2 +- service-registry/registry-zero-config/pom.xml | 2 +- service-registry/registry-zookeeper/pom.xml | 2 +- solutions/pom.xml | 2 +- solutions/solution-basic/pom.xml | 2 +- spring-boot/pom.xml | 2 +- .../java-chassis-spring-boot-starter-servlet/pom.xml | 2 +- .../java-chassis-spring-boot-starter-standalone/pom.xml | 2 +- spring-boot/spring-boot-starters/pom.xml | 2 +- swagger/pom.xml | 2 +- swagger/swagger-generator/generator-core/pom.xml | 2 +- swagger/swagger-generator/generator-jaxrs/pom.xml | 2 +- swagger/swagger-generator/generator-spring-data/pom.xml | 2 +- swagger/swagger-generator/generator-springmvc/pom.xml | 2 +- swagger/swagger-generator/pom.xml | 2 +- swagger/swagger-invocation/invocation-core/pom.xml | 2 +- swagger/swagger-invocation/invocation-jaxrs/pom.xml | 2 +- swagger/swagger-invocation/invocation-springmvc/pom.xml | 2 +- swagger/swagger-invocation/invocation-validator/pom.xml | 2 +- swagger/swagger-invocation/pom.xml | 2 +- tracing/pom.xml | 2 +- tracing/tracing-common/pom.xml | 2 +- tracing/tracing-zipkin/pom.xml | 2 +- transports/pom.xml | 2 +- transports/transport-common/pom.xml | 2 +- transports/transport-highway/pom.xml | 2 +- transports/transport-rest/pom.xml | 2 +- transports/transport-rest/transport-rest-client/pom.xml | 2 +- transports/transport-rest/transport-rest-servlet/pom.xml | 2 +- transports/transport-rest/transport-rest-vertx/pom.xml | 2 +- 188 files changed, 190 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index bf437e34568..c9c809b77fc 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Apache ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid de | Release Train | Latest Version | Compiled JDK Version | Tested JDK Version | Open API | Notes | |----------------|----------------|----------------------|--------------------|----------|--------------------------| -| Java Chassis 3 | 3.2.2 | OpenJDK 17 | OpenJDK 17 | 3.0.x | Depends on Spring Boot 3 | -| Java Chassis 2 | 2.8.20 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | Depends on Spring 5 | +| Java Chassis 3 | 3.2.6 | OpenJDK 17 | OpenJDK 17 | 3.0.x | Depends on Spring Boot 3 | +| Java Chassis 2 | 2.8.24 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | Depends on Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | End of Support | Java Chassis core dependencies diff --git a/README_ZH.md b/README_ZH.md index 873541164ac..7d83a8a851b 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -16,8 +16,8 @@ Apache ServiceComb Java Chassis 给开发者提供一个快速构建微服务的 | 版本火车 | 最新版本 | 编译的JDK版本 | 支持的JDK版本 | Open API | 备注 | |----------------|--------|------------|-------------------|----------|-----------------| -| Java Chassis 3 | 3.2.2 | OpenJDK 17 | OpenJDK 17 | 3.0.x | 依赖Spring Boot 3 | -| Java Chassis 2 | 2.8.20 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | 依赖Spring 5 | +| Java Chassis 3 | 3.2.6 | OpenJDK 17 | OpenJDK 17 | 3.0.x | 依赖Spring Boot 3 | +| Java Chassis 2 | 2.8.24 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | 依赖Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | 停止更新 | Java Chassis 的核心依赖 diff --git a/clients/config-center-client/pom.xml b/clients/config-center-client/pom.xml index 9729fd64b79..e7e2fa1fc2b 100644 --- a/clients/config-center-client/pom.xml +++ b/clients/config-center-client/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/clients/config-common/pom.xml b/clients/config-common/pom.xml index 134c880d1e2..ff10b993583 100644 --- a/clients/config-common/pom.xml +++ b/clients/config-common/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/clients/config-kie-client/pom.xml b/clients/config-kie-client/pom.xml index 5aefd8084c5..30dac44ba53 100644 --- a/clients/config-kie-client/pom.xml +++ b/clients/config-kie-client/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/clients/dashboard-client/pom.xml b/clients/dashboard-client/pom.xml index 8eb33b47f00..fb40407b82a 100644 --- a/clients/dashboard-client/pom.xml +++ b/clients/dashboard-client/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/clients/http-client-common/pom.xml b/clients/http-client-common/pom.xml index d4f40de5111..51d982e470c 100644 --- a/clients/http-client-common/pom.xml +++ b/clients/http-client-common/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/clients/pom.xml b/clients/pom.xml index 0b2abcffd74..49f481934cc 100644 --- a/clients/pom.xml +++ b/clients/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/clients/service-center-client/pom.xml b/clients/service-center-client/pom.xml index 47a4ff5a8ff..ccc3900e9db 100755 --- a/clients/service-center-client/pom.xml +++ b/clients/service-center-client/pom.xml @@ -22,7 +22,7 @@ clients org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/common/common-access-log/pom.xml b/common/common-access-log/pom.xml index b4f05f2eb6b..e572e6bfd94 100644 --- a/common/common-access-log/pom.xml +++ b/common/common-access-log/pom.xml @@ -21,7 +21,7 @@ common org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/common/common-protobuf/pom.xml b/common/common-protobuf/pom.xml index 3297dc0cba3..5b7ac5fcf7c 100644 --- a/common/common-protobuf/pom.xml +++ b/common/common-protobuf/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb common - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT common-protobuf Java Chassis::Common::Protobuf diff --git a/common/common-rest/pom.xml b/common/common-rest/pom.xml index 7ee481309de..f1f2c84b45b 100644 --- a/common/common-rest/pom.xml +++ b/common/common-rest/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb common - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT common-rest diff --git a/common/pom.xml b/common/pom.xml index 1b42907ba61..c39c89ff4ce 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default common diff --git a/core/pom.xml b/core/pom.xml index 63245883d41..af73c36dff9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default java-chassis-core diff --git a/coverage-reports/pom.xml b/coverage-reports/pom.xml index 7bb79b0ce8c..97f795fcbf5 100644 --- a/coverage-reports/pom.xml +++ b/coverage-reports/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml index 48fe65a1b0a..10a97833848 100644 --- a/demo/demo-consul/consumer/pom.xml +++ b/demo/demo-consul/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-consul - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT consul-consumer diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml index 708792e0516..ee3f369112d 100644 --- a/demo/demo-consul/gateway/pom.xml +++ b/demo/demo-consul/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-consul - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT consul-gateway diff --git a/demo/demo-consul/pom.xml b/demo/demo-consul/pom.xml index 8e47631d6a1..aaa8f3b91ce 100644 --- a/demo/demo-consul/pom.xml +++ b/demo/demo-consul/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-consul diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index 039c988526c..5ba5e0874fd 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-consul - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT consul-provider diff --git a/demo/demo-consul/test-client/pom.xml b/demo/demo-consul/test-client/pom.xml index 173a22b0559..2862315747b 100644 --- a/demo/demo-consul/test-client/pom.xml +++ b/demo/demo-consul/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-consul - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT consul-test-client diff --git a/demo/demo-crossapp/crossapp-client/pom.xml b/demo/demo-crossapp/crossapp-client/pom.xml index 652245759d4..fa2e051cd0f 100644 --- a/demo/demo-crossapp/crossapp-client/pom.xml +++ b/demo/demo-crossapp/crossapp-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-crossapp - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT crossapp-client Java Chassis::Demo::CrossApp::Client diff --git a/demo/demo-crossapp/crossapp-server/pom.xml b/demo/demo-crossapp/crossapp-server/pom.xml index f09bb9f314c..039da4768c8 100644 --- a/demo/demo-crossapp/crossapp-server/pom.xml +++ b/demo/demo-crossapp/crossapp-server/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-crossapp - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT crossapp-server Java Chassis::Demo::CrossApp::Server diff --git a/demo/demo-crossapp/pom.xml b/demo/demo-crossapp/pom.xml index 2e265b2a209..08c2055d357 100644 --- a/demo/demo-crossapp/pom.xml +++ b/demo/demo-crossapp/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-crossapp Java Chassis::Demo::CrossApp diff --git a/demo/demo-cse-v1/consumer/pom.xml b/demo/demo-cse-v1/consumer/pom.xml index 61b3d8baad4..78a7bf75a23 100644 --- a/demo/demo-cse-v1/consumer/pom.xml +++ b/demo/demo-cse-v1/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-cse-v1 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v1-consumer diff --git a/demo/demo-cse-v1/gateway/pom.xml b/demo/demo-cse-v1/gateway/pom.xml index bab44142980..49241e669cf 100644 --- a/demo/demo-cse-v1/gateway/pom.xml +++ b/demo/demo-cse-v1/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-cse-v1 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v1-gateway diff --git a/demo/demo-cse-v1/pom.xml b/demo/demo-cse-v1/pom.xml index 62484bfb0ac..72e70e58c15 100644 --- a/demo/demo-cse-v1/pom.xml +++ b/demo/demo-cse-v1/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-cse-v1 Java Chassis::Demo::CSE-V1 diff --git a/demo/demo-cse-v1/provider-canary/pom.xml b/demo/demo-cse-v1/provider-canary/pom.xml index ed59d023c76..34c393b9e8d 100644 --- a/demo/demo-cse-v1/provider-canary/pom.xml +++ b/demo/demo-cse-v1/provider-canary/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-cse-v1 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v1-provider-canary diff --git a/demo/demo-cse-v1/provider/pom.xml b/demo/demo-cse-v1/provider/pom.xml index ef2b38a0d59..12015bd6b7a 100644 --- a/demo/demo-cse-v1/provider/pom.xml +++ b/demo/demo-cse-v1/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-cse-v1 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v1-provider diff --git a/demo/demo-cse-v1/test-client/pom.xml b/demo/demo-cse-v1/test-client/pom.xml index ff9c2478ffd..697c28fb64e 100644 --- a/demo/demo-cse-v1/test-client/pom.xml +++ b/demo/demo-cse-v1/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-cse-v1 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v1-test-client diff --git a/demo/demo-cse-v2/consumer/pom.xml b/demo/demo-cse-v2/consumer/pom.xml index ccdfa1ebca3..0fe6e05f4d0 100644 --- a/demo/demo-cse-v2/consumer/pom.xml +++ b/demo/demo-cse-v2/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-cse-v2 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v2-consumer diff --git a/demo/demo-cse-v2/gateway/pom.xml b/demo/demo-cse-v2/gateway/pom.xml index 32a0e463874..1d04a248410 100644 --- a/demo/demo-cse-v2/gateway/pom.xml +++ b/demo/demo-cse-v2/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-cse-v2 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v2-gateway diff --git a/demo/demo-cse-v2/pom.xml b/demo/demo-cse-v2/pom.xml index 003799598e2..35a623930da 100644 --- a/demo/demo-cse-v2/pom.xml +++ b/demo/demo-cse-v2/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-cse-v2 Java Chassis::Demo::CSE-V2 diff --git a/demo/demo-cse-v2/provider/pom.xml b/demo/demo-cse-v2/provider/pom.xml index c090891c6f6..4308b1169d9 100644 --- a/demo/demo-cse-v2/provider/pom.xml +++ b/demo/demo-cse-v2/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-cse-v2 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v2-provider diff --git a/demo/demo-cse-v2/test-client/pom.xml b/demo/demo-cse-v2/test-client/pom.xml index 6edd193e6ee..78917aa7e5c 100644 --- a/demo/demo-cse-v2/test-client/pom.xml +++ b/demo/demo-cse-v2/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-cse-v2 - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT cse-v2-test-client diff --git a/demo/demo-edge/authentication/pom.xml b/demo/demo-edge/authentication/pom.xml index b925f4d4d2b..d4ecf86c0ba 100644 --- a/demo/demo-edge/authentication/pom.xml +++ b/demo/demo-edge/authentication/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT authentication Java Chassis::Demo::Edge::Authentication diff --git a/demo/demo-edge/business-1-1-0/pom.xml b/demo/demo-edge/business-1-1-0/pom.xml index a6b386c9db9..07f1ab27370 100644 --- a/demo/demo-edge/business-1-1-0/pom.xml +++ b/demo/demo-edge/business-1-1-0/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT business-1-1-0 Java Chassis::Demo::Edge::Business 1.1.0 diff --git a/demo/demo-edge/business-1.0.0/pom.xml b/demo/demo-edge/business-1.0.0/pom.xml index 37e74d4933c..7987cfa89f4 100644 --- a/demo/demo-edge/business-1.0.0/pom.xml +++ b/demo/demo-edge/business-1.0.0/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT business-1-0-0 Java Chassis::Demo::Edge::Business 1.0.0 diff --git a/demo/demo-edge/business-2.0.0/pom.xml b/demo/demo-edge/business-2.0.0/pom.xml index b18f156f150..37fb8f7ecc7 100644 --- a/demo/demo-edge/business-2.0.0/pom.xml +++ b/demo/demo-edge/business-2.0.0/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT business-2-0-0 Java Chassis::Demo::Edge::Business 2.0.0 diff --git a/demo/demo-edge/consumer/pom.xml b/demo/demo-edge/consumer/pom.xml index b9875683636..c26ca048528 100644 --- a/demo/demo-edge/consumer/pom.xml +++ b/demo/demo-edge/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT consumer Java Chassis::Demo::Edge::Consumer diff --git a/demo/demo-edge/edge-service/pom.xml b/demo/demo-edge/edge-service/pom.xml index 9c48d93d9bb..7badf5b9bc4 100644 --- a/demo/demo-edge/edge-service/pom.xml +++ b/demo/demo-edge/edge-service/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT edge-service Java Chassis::Demo::Edge::Service diff --git a/demo/demo-edge/model/pom.xml b/demo/demo-edge/model/pom.xml index 4e09f158890..3adda2c13e4 100644 --- a/demo/demo-edge/model/pom.xml +++ b/demo/demo-edge/model/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT model Java Chassis::Demo::Edge::Model diff --git a/demo/demo-edge/pom.xml b/demo/demo-edge/pom.xml index 75f0b639781..34cdcd1fccc 100644 --- a/demo/demo-edge/pom.xml +++ b/demo/demo-edge/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-edge Java Chassis::Demo::Edge diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 50140d5f648..499fff2c1ef 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-etcd - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT etcd-consumer diff --git a/demo/demo-etcd/gateway/pom.xml b/demo/demo-etcd/gateway/pom.xml index 5febf28db1d..7d9ef352a96 100644 --- a/demo/demo-etcd/gateway/pom.xml +++ b/demo/demo-etcd/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-etcd - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT etcd-gateway diff --git a/demo/demo-etcd/pom.xml b/demo/demo-etcd/pom.xml index bda7b06fe8c..c615edd88b1 100644 --- a/demo/demo-etcd/pom.xml +++ b/demo/demo-etcd/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-etcd Java Chassis::Demo::Etcd diff --git a/demo/demo-etcd/provider/pom.xml b/demo/demo-etcd/provider/pom.xml index 991a1b65f60..71884130108 100644 --- a/demo/demo-etcd/provider/pom.xml +++ b/demo/demo-etcd/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-etcd - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT etcd-provider diff --git a/demo/demo-etcd/test-client/pom.xml b/demo/demo-etcd/test-client/pom.xml index 16ebfae3cc8..ab839d762f5 100644 --- a/demo/demo-etcd/test-client/pom.xml +++ b/demo/demo-etcd/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-etcd - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT etcd-test-client diff --git a/demo/demo-filter/filter-client/pom.xml b/demo/demo-filter/filter-client/pom.xml index 769a420e9f7..837f4f81ca4 100644 --- a/demo/demo-filter/filter-client/pom.xml +++ b/demo/demo-filter/filter-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-filter - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT filter-client Java Chassis::Demo::Filter::Client diff --git a/demo/demo-filter/filter-edge/pom.xml b/demo/demo-filter/filter-edge/pom.xml index 5c6ec05f74f..4c9e95932a3 100644 --- a/demo/demo-filter/filter-edge/pom.xml +++ b/demo/demo-filter/filter-edge/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-filter - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT filter-edge Java Chassis::Demo::Filter::Edge diff --git a/demo/demo-filter/filter-server/pom.xml b/demo/demo-filter/filter-server/pom.xml index f2a10c52bcb..f30759c349a 100644 --- a/demo/demo-filter/filter-server/pom.xml +++ b/demo/demo-filter/filter-server/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-filter - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT filter-server Java Chassis::Demo::Filter::Server diff --git a/demo/demo-filter/filter-tests/pom.xml b/demo/demo-filter/filter-tests/pom.xml index daf354e56c9..3936a85f517 100644 --- a/demo/demo-filter/filter-tests/pom.xml +++ b/demo/demo-filter/filter-tests/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-filter - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT filter-tests Java Chassis::Demo::Filter::Tests diff --git a/demo/demo-filter/pom.xml b/demo/demo-filter/pom.xml index 02357f17c6b..45e0206faf1 100644 --- a/demo/demo-filter/pom.xml +++ b/demo/demo-filter/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-filter Java Chassis::Demo::Filter diff --git a/demo/demo-jaxrs/jaxrs-client/pom.xml b/demo/demo-jaxrs/jaxrs-client/pom.xml index cc6f702b61d..d25a3cdecca 100644 --- a/demo/demo-jaxrs/jaxrs-client/pom.xml +++ b/demo/demo-jaxrs/jaxrs-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-jaxrs - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT jaxrs-client Java Chassis::Demo::JAXRS::Client diff --git a/demo/demo-jaxrs/jaxrs-server/pom.xml b/demo/demo-jaxrs/jaxrs-server/pom.xml index d75e6cbbc84..8bc78928a94 100644 --- a/demo/demo-jaxrs/jaxrs-server/pom.xml +++ b/demo/demo-jaxrs/jaxrs-server/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-jaxrs - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT jaxrs-server Java Chassis::Demo::JAXRS::Server diff --git a/demo/demo-jaxrs/pom.xml b/demo/demo-jaxrs/pom.xml index 1e21f87deee..014baac0318 100644 --- a/demo/demo-jaxrs/pom.xml +++ b/demo/demo-jaxrs/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-jaxrs Java Chassis::Demo::JAXRS diff --git a/demo/demo-local-registry/demo-local-registry-client/pom.xml b/demo/demo-local-registry/demo-local-registry-client/pom.xml index 5f824d7fb08..352e0cf26aa 100644 --- a/demo/demo-local-registry/demo-local-registry-client/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-local-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-local-registry/demo-local-registry-server/pom.xml b/demo/demo-local-registry/demo-local-registry-server/pom.xml index 5e52643fa30..0be4606e63a 100644 --- a/demo/demo-local-registry/demo-local-registry-server/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-server/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-local-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-local-registry/pom.xml b/demo/demo-local-registry/pom.xml index b987d28f272..c33eebf22e7 100644 --- a/demo/demo-local-registry/pom.xml +++ b/demo/demo-local-registry/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-local-registry Java Chassis::Demo::Local Registry diff --git a/demo/demo-multi-registries/demo-multi-registries-client/pom.xml b/demo/demo-multi-registries/demo-multi-registries-client/pom.xml index 9fcc4b7ea5e..3577950317f 100644 --- a/demo/demo-multi-registries/demo-multi-registries-client/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-multi-registries - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml index 10ca21f2a95..792a65dff41 100644 --- a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-multi-registries - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-multi-registries/pom.xml b/demo/demo-multi-registries/pom.xml index 021ed4aa273..13f34c9c7af 100644 --- a/demo/demo-multi-registries/pom.xml +++ b/demo/demo-multi-registries/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-multi-registries Java Chassis::Demo::Multi Registry diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml index 41d6c380a3e..2669f28a874 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-multi-service-center - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml index 3c0fd73978c..4b70798febf 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-multi-service-center - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml index 4bf55b6d4b7..43c235e0177 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-multi-service-center - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-multi-service-center/pom.xml b/demo/demo-multi-service-center/pom.xml index 731e09c3f53..cf9c101e496 100644 --- a/demo/demo-multi-service-center/pom.xml +++ b/demo/demo-multi-service-center/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-multi-service-center Java Chassis::Demo::Multi Service Centers diff --git a/demo/demo-multiple/a-client/pom.xml b/demo/demo-multiple/a-client/pom.xml index 814039b63e6..84131a7909c 100644 --- a/demo/demo-multiple/a-client/pom.xml +++ b/demo/demo-multiple/a-client/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT a-client Java Chassis::Demo::Multiple::A client diff --git a/demo/demo-multiple/a-server/pom.xml b/demo/demo-multiple/a-server/pom.xml index ad78ef365e7..d38b12d8d62 100644 --- a/demo/demo-multiple/a-server/pom.xml +++ b/demo/demo-multiple/a-server/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT a-server Java Chassis::Demo::Multiple::A server diff --git a/demo/demo-multiple/b-client/pom.xml b/demo/demo-multiple/b-client/pom.xml index 02f0a1f4e7e..4ab02a66f1b 100644 --- a/demo/demo-multiple/b-client/pom.xml +++ b/demo/demo-multiple/b-client/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT b-client Java Chassis::Demo::Multiple::B client diff --git a/demo/demo-multiple/b-server/pom.xml b/demo/demo-multiple/b-server/pom.xml index 14c88f684b2..e33e750d8e4 100644 --- a/demo/demo-multiple/b-server/pom.xml +++ b/demo/demo-multiple/b-server/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT b-server diff --git a/demo/demo-multiple/multiple-client/pom.xml b/demo/demo-multiple/multiple-client/pom.xml index ac1aa663369..7dcbb6f14f2 100644 --- a/demo/demo-multiple/multiple-client/pom.xml +++ b/demo/demo-multiple/multiple-client/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT multiple-client Java Chassis::Demo::Multiple::Client diff --git a/demo/demo-multiple/multiple-server/pom.xml b/demo/demo-multiple/multiple-server/pom.xml index 68d1f5781ba..92830d919a4 100644 --- a/demo/demo-multiple/multiple-server/pom.xml +++ b/demo/demo-multiple/multiple-server/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-multiple - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT multiple-server Java Chassis::Demo::Multiple::Server diff --git a/demo/demo-multiple/pom.xml b/demo/demo-multiple/pom.xml index 59b75d6a571..7496a2050d7 100644 --- a/demo/demo-multiple/pom.xml +++ b/demo/demo-multiple/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-multiple Java Chassis::Demo::Multiple diff --git a/demo/demo-nacos/consumer/pom.xml b/demo/demo-nacos/consumer/pom.xml index bc74f9b40e5..f1cb74b7ff1 100644 --- a/demo/demo-nacos/consumer/pom.xml +++ b/demo/demo-nacos/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-nacos - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT nacos-consumer diff --git a/demo/demo-nacos/gateway/pom.xml b/demo/demo-nacos/gateway/pom.xml index a6c12eb621b..3c2bf730559 100644 --- a/demo/demo-nacos/gateway/pom.xml +++ b/demo/demo-nacos/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-nacos - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT nacos-gateway diff --git a/demo/demo-nacos/pom.xml b/demo/demo-nacos/pom.xml index 642ad561bd4..a37e292de1d 100644 --- a/demo/demo-nacos/pom.xml +++ b/demo/demo-nacos/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-nacos Java Chassis::Demo::NACOS diff --git a/demo/demo-nacos/provider/pom.xml b/demo/demo-nacos/provider/pom.xml index 07d3381d742..83619a797ca 100644 --- a/demo/demo-nacos/provider/pom.xml +++ b/demo/demo-nacos/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-nacos - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT nacos-provider diff --git a/demo/demo-nacos/test-client/pom.xml b/demo/demo-nacos/test-client/pom.xml index 2e9009d8a8d..103aeb24d94 100644 --- a/demo/demo-nacos/test-client/pom.xml +++ b/demo/demo-nacos/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-nacos - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT nacos-test-client diff --git a/demo/demo-pojo/pojo-client/pom.xml b/demo/demo-pojo/pojo-client/pom.xml index 23789ae4f33..582c8c8f511 100644 --- a/demo/demo-pojo/pojo-client/pom.xml +++ b/demo/demo-pojo/pojo-client/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-pojo - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT pojo-client Java Chassis::Demo::POJO::Client diff --git a/demo/demo-pojo/pojo-server/pom.xml b/demo/demo-pojo/pojo-server/pom.xml index c1c750a009b..509c67d04aa 100644 --- a/demo/demo-pojo/pojo-server/pom.xml +++ b/demo/demo-pojo/pojo-server/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-pojo - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT pojo-server Java Chassis::Demo::POJO::Server diff --git a/demo/demo-pojo/pom.xml b/demo/demo-pojo/pom.xml index 21c69591df5..96217173a03 100644 --- a/demo/demo-pojo/pom.xml +++ b/demo/demo-pojo/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-pojo Java Chassis::Demo::POJO diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml index 11faba21e9b..1b7fc782cd1 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-register-url-prefix - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml index 563ce0227ba..643d49f629a 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-register-url-prefix - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-register-url-prefix/pom.xml b/demo/demo-register-url-prefix/pom.xml index d4042f8d47b..e51630b5397 100644 --- a/demo/demo-register-url-prefix/pom.xml +++ b/demo/demo-register-url-prefix/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-register-url-prefix Java Chassis::Demo::Register URL Prefix diff --git a/demo/demo-schema/pom.xml b/demo/demo-schema/pom.xml index 0f386431b77..b17f345111b 100644 --- a/demo/demo-schema/pom.xml +++ b/demo/demo-schema/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-schema Java Chassis::Demo::Schema diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml index 359371da752..372d3a8ccc3 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-spring-boot-transport - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml index edf7ed50444..026f7d867de 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-spring-boot-transport - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml index 75a97d15ffd..edd73c1428b 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-client/pom.xml @@ -26,7 +26,7 @@ org.apache.servicecomb.demo demo-spring-boot-transport - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml index a614b00af48..d2e6c91de20 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml @@ -26,7 +26,7 @@ org.apache.servicecomb.demo demo-spring-boot-transport - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-spring-boot-transport/pom.xml b/demo/demo-spring-boot-transport/pom.xml index 5fcd9fa6c72..bd7650a3f26 100644 --- a/demo/demo-spring-boot-transport/pom.xml +++ b/demo/demo-spring-boot-transport/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-spring-boot-transport Java Chassis::Demo::Spring Boot::Transport diff --git a/demo/demo-springmvc/pom.xml b/demo/demo-springmvc/pom.xml index 906b6a953c6..c307aa7741b 100644 --- a/demo/demo-springmvc/pom.xml +++ b/demo/demo-springmvc/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-springmvc Java Chassis::Demo::Spring MVC diff --git a/demo/demo-springmvc/springmvc-client/pom.xml b/demo/demo-springmvc/springmvc-client/pom.xml index e38a29d9d98..17b7bbcd709 100644 --- a/demo/demo-springmvc/springmvc-client/pom.xml +++ b/demo/demo-springmvc/springmvc-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-springmvc - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT springmvc-client Java Chassis::Demo::Spring MVC::Client diff --git a/demo/demo-springmvc/springmvc-server/pom.xml b/demo/demo-springmvc/springmvc-server/pom.xml index f1fff38f4a8..8037b187872 100644 --- a/demo/demo-springmvc/springmvc-server/pom.xml +++ b/demo/demo-springmvc/springmvc-server/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-springmvc - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT springmvc-server Java Chassis::Demo::Spring MVC::Server diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml index 2ef78c974ad..fcc6b6f2d00 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-zeroconfig-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml index 0266fe47b75..bb18e72e8a3 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-zeroconfig-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml index 183b27beed2..e0ab59c090f 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-zeroconfig-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml index d82db632a85..8c57041ea1d 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-tests/pom.xml @@ -25,7 +25,7 @@ org.apache.servicecomb.demo demo-zeroconfig-registry - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT diff --git a/demo/demo-zeroconfig-registry/pom.xml b/demo/demo-zeroconfig-registry/pom.xml index f8c20e2589b..bc02525e483 100644 --- a/demo/demo-zeroconfig-registry/pom.xml +++ b/demo/demo-zeroconfig-registry/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-zeroconfig-registry Java Chassis::Demo::ZeroConfig Registry diff --git a/demo/demo-zookeeper/consumer/pom.xml b/demo/demo-zookeeper/consumer/pom.xml index 6e60470aea1..490ee41b37f 100644 --- a/demo/demo-zookeeper/consumer/pom.xml +++ b/demo/demo-zookeeper/consumer/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-zookeeper - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT zookeeper-consumer diff --git a/demo/demo-zookeeper/gateway/pom.xml b/demo/demo-zookeeper/gateway/pom.xml index 1cd29cbfeab..f375eeaa3fd 100644 --- a/demo/demo-zookeeper/gateway/pom.xml +++ b/demo/demo-zookeeper/gateway/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb.demo demo-zookeeper - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT zookeeper-gateway diff --git a/demo/demo-zookeeper/pom.xml b/demo/demo-zookeeper/pom.xml index a474166f5ce..aa1030de1ec 100644 --- a/demo/demo-zookeeper/pom.xml +++ b/demo/demo-zookeeper/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT demo-zookeeper Java Chassis::Demo::Zookeeper diff --git a/demo/demo-zookeeper/provider/pom.xml b/demo/demo-zookeeper/provider/pom.xml index ea56074ef26..cb0d51833f9 100644 --- a/demo/demo-zookeeper/provider/pom.xml +++ b/demo/demo-zookeeper/provider/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-zookeeper - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT zookeeper-provider diff --git a/demo/demo-zookeeper/test-client/pom.xml b/demo/demo-zookeeper/test-client/pom.xml index 93d2501c6de..e527b630005 100644 --- a/demo/demo-zookeeper/test-client/pom.xml +++ b/demo/demo-zookeeper/test-client/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb.demo demo-zookeeper - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT zookeeper-test-client diff --git a/demo/pom.xml b/demo/pom.xml index d21bb83b23d..a6e6c43b47a 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default org.apache.servicecomb.demo diff --git a/dependencies/bom/pom.xml b/dependencies/bom/pom.xml index e7e1e398da1..ed5e1bc91a2 100644 --- a/dependencies/bom/pom.xml +++ b/dependencies/bom/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb java-chassis-dependencies-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT java-chassis-bom diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index aec7f6b608c..884be85ce81 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-dependencies-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT java-chassis-dependencies diff --git a/dependencies/pom.xml b/dependencies/pom.xml index 6382b78897a..4ee9c9ea071 100644 --- a/dependencies/pom.xml +++ b/dependencies/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb java-chassis - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT java-chassis-dependencies-parent diff --git a/distribution/pom.xml b/distribution/pom.xml index d48c3497ea1..ddd1e3de25d 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default apache-servicecomb-java-chassis-distribution diff --git a/dynamic-config/config-apollo/pom.xml b/dynamic-config/config-apollo/pom.xml index fff4c2036ba..7cc03d182dd 100644 --- a/dynamic-config/config-apollo/pom.xml +++ b/dynamic-config/config-apollo/pom.xml @@ -22,7 +22,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 config-apollo diff --git a/dynamic-config/config-cc/pom.xml b/dynamic-config/config-cc/pom.xml index 160e4d578b1..0e8f6addcc6 100644 --- a/dynamic-config/config-cc/pom.xml +++ b/dynamic-config/config-cc/pom.xml @@ -21,7 +21,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/dynamic-config/config-consul/pom.xml b/dynamic-config/config-consul/pom.xml index b7a1cfa192b..af890c0e6ec 100644 --- a/dynamic-config/config-consul/pom.xml +++ b/dynamic-config/config-consul/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb dynamic-config - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT config-consul diff --git a/dynamic-config/config-etcd/pom.xml b/dynamic-config/config-etcd/pom.xml index a1c35d9872f..8aa6b2cf963 100644 --- a/dynamic-config/config-etcd/pom.xml +++ b/dynamic-config/config-etcd/pom.xml @@ -22,7 +22,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 config-etcd diff --git a/dynamic-config/config-kie/pom.xml b/dynamic-config/config-kie/pom.xml index b0f2226f552..4bf61b5801f 100644 --- a/dynamic-config/config-kie/pom.xml +++ b/dynamic-config/config-kie/pom.xml @@ -23,7 +23,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/dynamic-config/config-nacos/pom.xml b/dynamic-config/config-nacos/pom.xml index b378d27ce45..395603f9fd6 100644 --- a/dynamic-config/config-nacos/pom.xml +++ b/dynamic-config/config-nacos/pom.xml @@ -22,7 +22,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 config-nacos diff --git a/dynamic-config/config-zookeeper/pom.xml b/dynamic-config/config-zookeeper/pom.xml index 767d3a4649f..35fabec9591 100644 --- a/dynamic-config/config-zookeeper/pom.xml +++ b/dynamic-config/config-zookeeper/pom.xml @@ -22,7 +22,7 @@ dynamic-config org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 config-zookeeper diff --git a/dynamic-config/pom.xml b/dynamic-config/pom.xml index f9f2a2b5cb2..d5777cd654c 100644 --- a/dynamic-config/pom.xml +++ b/dynamic-config/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/edge/edge-core/pom.xml b/edge/edge-core/pom.xml index e270e5abf6d..0a75f8e33c6 100644 --- a/edge/edge-core/pom.xml +++ b/edge/edge-core/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb edge - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT edge-core Java Chassis::Edge::Core diff --git a/edge/pom.xml b/edge/pom.xml index d75f7db7d5a..e11f4e088b6 100644 --- a/edge/pom.xml +++ b/edge/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default edge diff --git a/foundations/foundation-common/pom.xml b/foundations/foundation-common/pom.xml index 3e07a454296..2f5a18878b4 100644 --- a/foundations/foundation-common/pom.xml +++ b/foundations/foundation-common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundations foundation-common diff --git a/foundations/foundation-config/pom.xml b/foundations/foundation-config/pom.xml index 14629e95a32..12c4a54c5be 100644 --- a/foundations/foundation-config/pom.xml +++ b/foundations/foundation-config/pom.xml @@ -21,7 +21,7 @@ foundations org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/foundations/foundation-metrics/pom.xml b/foundations/foundation-metrics/pom.xml index cce230c8948..d893011c4d4 100644 --- a/foundations/foundation-metrics/pom.xml +++ b/foundations/foundation-metrics/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb foundations - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundation-metrics Java Chassis::Foundations::Metrics diff --git a/foundations/foundation-protobuf/pom.xml b/foundations/foundation-protobuf/pom.xml index e58e0ad8242..cb8662c7bfb 100644 --- a/foundations/foundation-protobuf/pom.xml +++ b/foundations/foundation-protobuf/pom.xml @@ -21,7 +21,7 @@ foundations org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/foundations/foundation-registry/pom.xml b/foundations/foundation-registry/pom.xml index 7e78cd937a4..d4cca8111c4 100644 --- a/foundations/foundation-registry/pom.xml +++ b/foundations/foundation-registry/pom.xml @@ -21,7 +21,7 @@ foundations org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/foundations/foundation-spi/pom.xml b/foundations/foundation-spi/pom.xml index 0f58fc313ac..aa38214b3ee 100644 --- a/foundations/foundation-spi/pom.xml +++ b/foundations/foundation-spi/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb foundations - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundation-spi Java Chassis::Foundations::SSL diff --git a/foundations/foundation-ssl/pom.xml b/foundations/foundation-ssl/pom.xml index 2e2225ad3a8..3cf7cdcb485 100644 --- a/foundations/foundation-ssl/pom.xml +++ b/foundations/foundation-ssl/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb foundations - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundation-ssl Java Chassis::Foundations::SSL diff --git a/foundations/foundation-test-scaffolding/pom.xml b/foundations/foundation-test-scaffolding/pom.xml index b5c048ed5d7..f3feba62148 100644 --- a/foundations/foundation-test-scaffolding/pom.xml +++ b/foundations/foundation-test-scaffolding/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb foundations - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundation-test-scaffolding Java Chassis::Foundations::Test Scaffolding diff --git a/foundations/foundation-vertx/pom.xml b/foundations/foundation-vertx/pom.xml index 921b0892414..24556f590f7 100644 --- a/foundations/foundation-vertx/pom.xml +++ b/foundations/foundation-vertx/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb foundations - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT foundation-vertx Java Chassis::Foundations::Vertx diff --git a/foundations/pom.xml b/foundations/pom.xml index 9b0ff42a1a6..7b3f55d334a 100644 --- a/foundations/pom.xml +++ b/foundations/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default foundations diff --git a/governance/pom.xml b/governance/pom.xml index 7c2453939da..3f78c36ade5 100644 --- a/governance/pom.xml +++ b/governance/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/handlers/handler-fault-injection/pom.xml b/handlers/handler-fault-injection/pom.xml index 1194f36f94c..825c63c2270 100755 --- a/handlers/handler-fault-injection/pom.xml +++ b/handlers/handler-fault-injection/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb handlers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT handler-fault-injection Java Chassis::Handlers::Fault Injection diff --git a/handlers/handler-flowcontrol-qps/pom.xml b/handlers/handler-flowcontrol-qps/pom.xml index baa37871767..eb5d63a0993 100644 --- a/handlers/handler-flowcontrol-qps/pom.xml +++ b/handlers/handler-flowcontrol-qps/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb handlers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT handler-flowcontrol-qps Java Chassis::Handlers::Flow Control QPS diff --git a/handlers/handler-governance/pom.xml b/handlers/handler-governance/pom.xml index 7d072af7e59..7db533e562e 100644 --- a/handlers/handler-governance/pom.xml +++ b/handlers/handler-governance/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb handlers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT handler-governance diff --git a/handlers/handler-loadbalance/pom.xml b/handlers/handler-loadbalance/pom.xml index 39b3bdad749..0fd42dce838 100644 --- a/handlers/handler-loadbalance/pom.xml +++ b/handlers/handler-loadbalance/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb handlers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT handler-loadbalance diff --git a/handlers/handler-publickey-auth/pom.xml b/handlers/handler-publickey-auth/pom.xml index 8e1d7e3e8bf..9f13b26f232 100644 --- a/handlers/handler-publickey-auth/pom.xml +++ b/handlers/handler-publickey-auth/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb handlers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT handler-publickey-auth diff --git a/handlers/handler-router/pom.xml b/handlers/handler-router/pom.xml index 7544f3a5c22..0068002eb7d 100644 --- a/handlers/handler-router/pom.xml +++ b/handlers/handler-router/pom.xml @@ -22,7 +22,7 @@ handlers org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/handlers/handler-tracing-zipkin/pom.xml b/handlers/handler-tracing-zipkin/pom.xml index 841ebb4647a..3644d209bab 100644 --- a/handlers/handler-tracing-zipkin/pom.xml +++ b/handlers/handler-tracing-zipkin/pom.xml @@ -22,7 +22,7 @@ handlers org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/handlers/pom.xml b/handlers/pom.xml index 233c357b299..e74e2c95134 100644 --- a/handlers/pom.xml +++ b/handlers/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/huawei-cloud/darklaunch/pom.xml b/huawei-cloud/darklaunch/pom.xml index be8605cb946..b4396f87a64 100644 --- a/huawei-cloud/darklaunch/pom.xml +++ b/huawei-cloud/darklaunch/pom.xml @@ -21,7 +21,7 @@ huawei-cloud org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/huawei-cloud/dashboard/pom.xml b/huawei-cloud/dashboard/pom.xml index 47c8db2ef3a..015a43a240a 100644 --- a/huawei-cloud/dashboard/pom.xml +++ b/huawei-cloud/dashboard/pom.xml @@ -21,7 +21,7 @@ huawei-cloud org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/huawei-cloud/pom.xml b/huawei-cloud/pom.xml index 248839cdf4e..eb70052ed01 100644 --- a/huawei-cloud/pom.xml +++ b/huawei-cloud/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default diff --git a/huawei-cloud/servicestage/pom.xml b/huawei-cloud/servicestage/pom.xml index 28eb37cbe8b..d92064951f9 100644 --- a/huawei-cloud/servicestage/pom.xml +++ b/huawei-cloud/servicestage/pom.xml @@ -21,7 +21,7 @@ huawei-cloud org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 servicestage diff --git a/metrics/metrics-core/pom.xml b/metrics/metrics-core/pom.xml index 346771adc45..d3d71ff8ef1 100644 --- a/metrics/metrics-core/pom.xml +++ b/metrics/metrics-core/pom.xml @@ -21,7 +21,7 @@ metrics org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/metrics/metrics-integration/metrics-prometheus/pom.xml b/metrics/metrics-integration/metrics-prometheus/pom.xml index 59d5f1424e7..20d23c9d567 100644 --- a/metrics/metrics-integration/metrics-prometheus/pom.xml +++ b/metrics/metrics-integration/metrics-prometheus/pom.xml @@ -21,7 +21,7 @@ metrics-integration org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/metrics/metrics-integration/pom.xml b/metrics/metrics-integration/pom.xml index b6eb7af66c2..d989f8bc2a4 100644 --- a/metrics/metrics-integration/pom.xml +++ b/metrics/metrics-integration/pom.xml @@ -22,7 +22,7 @@ metrics org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/metrics/pom.xml b/metrics/pom.xml index b1cd07eef79..95eb85051fc 100644 --- a/metrics/pom.xml +++ b/metrics/pom.xml @@ -24,7 +24,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default diff --git a/parents/default/pom.xml b/parents/default/pom.xml index 6a5be12b1de..b8954d029b8 100644 --- a/parents/default/pom.xml +++ b/parents/default/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb java-chassis-dependencies - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../../dependencies/default diff --git a/parents/pom.xml b/parents/pom.xml index e7bc7555954..8fce5793c5c 100644 --- a/parents/pom.xml +++ b/parents/pom.xml @@ -24,7 +24,7 @@ org.apache.servicecomb java-chassis - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT java-chassis-parents diff --git a/pom.xml b/pom.xml index 32c4adcd8aa..a1eb40450b4 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,7 @@ org.apache.servicecomb java-chassis - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT pom ServiceComb Java Chassis diff --git a/providers/pom.xml b/providers/pom.xml index 3ee7f953544..9bd8a52f271 100644 --- a/providers/pom.xml +++ b/providers/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default providers diff --git a/providers/provider-jaxrs/pom.xml b/providers/provider-jaxrs/pom.xml index dccec12a934..1bd923857c6 100644 --- a/providers/provider-jaxrs/pom.xml +++ b/providers/provider-jaxrs/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb providers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT provider-jaxrs Java Chassis::Providers::JAXRS diff --git a/providers/provider-pojo/pom.xml b/providers/provider-pojo/pom.xml index 91110c76916..922f544b9f5 100644 --- a/providers/provider-pojo/pom.xml +++ b/providers/provider-pojo/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb providers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT provider-pojo Java Chassis::Providers::POJO diff --git a/providers/provider-rest-common/pom.xml b/providers/provider-rest-common/pom.xml index 49c1331ba09..075a9f9146b 100644 --- a/providers/provider-rest-common/pom.xml +++ b/providers/provider-rest-common/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb providers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT provider-rest-common Java Chassis::Providers::Rest Common diff --git a/providers/provider-springmvc/pom.xml b/providers/provider-springmvc/pom.xml index 9f49840dd9c..4792027cc64 100644 --- a/providers/provider-springmvc/pom.xml +++ b/providers/provider-springmvc/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb providers - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT provider-springmvc Java Chassis::Providers::Spring MVC diff --git a/service-registry/pom.xml b/service-registry/pom.xml index cdeefb039ac..252d89eb433 100644 --- a/service-registry/pom.xml +++ b/service-registry/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/service-registry/registry-consul/pom.xml b/service-registry/registry-consul/pom.xml index 58399a146d0..380b9ea45fc 100644 --- a/service-registry/registry-consul/pom.xml +++ b/service-registry/registry-consul/pom.xml @@ -23,7 +23,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT registry-consul diff --git a/service-registry/registry-etcd/pom.xml b/service-registry/registry-etcd/pom.xml index cf48811d342..10c037a03aa 100644 --- a/service-registry/registry-etcd/pom.xml +++ b/service-registry/registry-etcd/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-lightweight/pom.xml b/service-registry/registry-lightweight/pom.xml index a6b50f92f24..43a27c5cfe6 100644 --- a/service-registry/registry-lightweight/pom.xml +++ b/service-registry/registry-lightweight/pom.xml @@ -22,7 +22,7 @@ service-registry-parent org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-local/pom.xml b/service-registry/registry-local/pom.xml index 49e70cb6bee..e3ddcc5510b 100644 --- a/service-registry/registry-local/pom.xml +++ b/service-registry/registry-local/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-nacos/pom.xml b/service-registry/registry-nacos/pom.xml index 97b8667358b..11e58275235 100644 --- a/service-registry/registry-nacos/pom.xml +++ b/service-registry/registry-nacos/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-service-center/pom.xml b/service-registry/registry-service-center/pom.xml index bcdbf3ce74e..97910c29054 100644 --- a/service-registry/registry-service-center/pom.xml +++ b/service-registry/registry-service-center/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-zero-config/pom.xml b/service-registry/registry-zero-config/pom.xml index f671507bdea..c9a6569f1bc 100644 --- a/service-registry/registry-zero-config/pom.xml +++ b/service-registry/registry-zero-config/pom.xml @@ -22,7 +22,7 @@ service-registry-parent org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/service-registry/registry-zookeeper/pom.xml b/service-registry/registry-zookeeper/pom.xml index fa09ecd9320..e5ba4236e18 100644 --- a/service-registry/registry-zookeeper/pom.xml +++ b/service-registry/registry-zookeeper/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb service-registry-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/solutions/pom.xml b/solutions/pom.xml index b284c853266..4203f65309b 100644 --- a/solutions/pom.xml +++ b/solutions/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/solutions/solution-basic/pom.xml b/solutions/solution-basic/pom.xml index 2264a8be138..1bb51a4b88c 100644 --- a/solutions/solution-basic/pom.xml +++ b/solutions/solution-basic/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb solutions - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/spring-boot/pom.xml b/spring-boot/pom.xml index a20b4869bb2..b96de480b73 100644 --- a/spring-boot/pom.xml +++ b/spring-boot/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-servlet/pom.xml b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-servlet/pom.xml index 9e261dd5676..c3fa579baee 100644 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-servlet/pom.xml +++ b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-servlet/pom.xml @@ -22,7 +22,7 @@ java-chassis-spring-boot-starters org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-standalone/pom.xml b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-standalone/pom.xml index 7b705ef961a..cd8d007109f 100644 --- a/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-standalone/pom.xml +++ b/spring-boot/spring-boot-starters/java-chassis-spring-boot-starter-standalone/pom.xml @@ -22,7 +22,7 @@ java-chassis-spring-boot-starters org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/spring-boot/spring-boot-starters/pom.xml b/spring-boot/spring-boot-starters/pom.xml index ea528b5ab51..8c3eecd55ed 100644 --- a/spring-boot/spring-boot-starters/pom.xml +++ b/spring-boot/spring-boot-starters/pom.xml @@ -22,7 +22,7 @@ java-chassis-spring-boot org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/swagger/pom.xml b/swagger/pom.xml index 06f9b452748..5009d6dbc8f 100644 --- a/swagger/pom.xml +++ b/swagger/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default swagger diff --git a/swagger/swagger-generator/generator-core/pom.xml b/swagger/swagger-generator/generator-core/pom.xml index ffec1079fb1..768f6ecd054 100644 --- a/swagger/swagger-generator/generator-core/pom.xml +++ b/swagger/swagger-generator/generator-core/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-generator - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-generator-core Java Chassis::Swagger::Generator::Core diff --git a/swagger/swagger-generator/generator-jaxrs/pom.xml b/swagger/swagger-generator/generator-jaxrs/pom.xml index 65f64741644..1a82b059f8a 100644 --- a/swagger/swagger-generator/generator-jaxrs/pom.xml +++ b/swagger/swagger-generator/generator-jaxrs/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-generator - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-generator-jaxrs Java Chassis::Swagger::Generator::Jaxrs diff --git a/swagger/swagger-generator/generator-spring-data/pom.xml b/swagger/swagger-generator/generator-spring-data/pom.xml index 75ffc8b5b79..13c8923cd57 100644 --- a/swagger/swagger-generator/generator-spring-data/pom.xml +++ b/swagger/swagger-generator/generator-spring-data/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb swagger-generator - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/swagger/swagger-generator/generator-springmvc/pom.xml b/swagger/swagger-generator/generator-springmvc/pom.xml index 900e1bee9e2..c4225f11a96 100644 --- a/swagger/swagger-generator/generator-springmvc/pom.xml +++ b/swagger/swagger-generator/generator-springmvc/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-generator - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-generator-springmvc Java Chassis::Swagger::Generator::Spring MVC diff --git a/swagger/swagger-generator/pom.xml b/swagger/swagger-generator/pom.xml index 2c9c8298913..e9a03a9c579 100644 --- a/swagger/swagger-generator/pom.xml +++ b/swagger/swagger-generator/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-generator Java Chassis::Swagger::Generator diff --git a/swagger/swagger-invocation/invocation-core/pom.xml b/swagger/swagger-invocation/invocation-core/pom.xml index 4481b478f77..20897dafd3a 100644 --- a/swagger/swagger-invocation/invocation-core/pom.xml +++ b/swagger/swagger-invocation/invocation-core/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-invocation - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-invocation-core Java Chassis::Swagger::Invocation::Core diff --git a/swagger/swagger-invocation/invocation-jaxrs/pom.xml b/swagger/swagger-invocation/invocation-jaxrs/pom.xml index 1301c376ff5..50d12dd243f 100644 --- a/swagger/swagger-invocation/invocation-jaxrs/pom.xml +++ b/swagger/swagger-invocation/invocation-jaxrs/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-invocation - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-invocation-jaxrs Java Chassis::Swagger::Invocation::JAXRS diff --git a/swagger/swagger-invocation/invocation-springmvc/pom.xml b/swagger/swagger-invocation/invocation-springmvc/pom.xml index afd3c3864d8..5ae28883576 100644 --- a/swagger/swagger-invocation/invocation-springmvc/pom.xml +++ b/swagger/swagger-invocation/invocation-springmvc/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-invocation - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-invocation-springmvc Java Chassis::Swagger::Invocation::Spring MVC diff --git a/swagger/swagger-invocation/invocation-validator/pom.xml b/swagger/swagger-invocation/invocation-validator/pom.xml index 921a971f381..cf0f46c7f4f 100644 --- a/swagger/swagger-invocation/invocation-validator/pom.xml +++ b/swagger/swagger-invocation/invocation-validator/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger-invocation - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-invocation-validator Java Chassis::Swagger::Invocation::Validator diff --git a/swagger/swagger-invocation/pom.xml b/swagger/swagger-invocation/pom.xml index 8943c4a0bd0..00f83a03fc4 100644 --- a/swagger/swagger-invocation/pom.xml +++ b/swagger/swagger-invocation/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb swagger - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT swagger-invocation Java Chassis::Swagger::Invocation diff --git a/tracing/pom.xml b/tracing/pom.xml index 8359080d307..7ffde2fbc3a 100644 --- a/tracing/pom.xml +++ b/tracing/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default 4.0.0 diff --git a/tracing/tracing-common/pom.xml b/tracing/tracing-common/pom.xml index 2201f246867..f03ecbb2b04 100644 --- a/tracing/tracing-common/pom.xml +++ b/tracing/tracing-common/pom.xml @@ -22,7 +22,7 @@ tracing org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/tracing/tracing-zipkin/pom.xml b/tracing/tracing-zipkin/pom.xml index 913939f4a0c..e5755729748 100644 --- a/tracing/tracing-zipkin/pom.xml +++ b/tracing/tracing-zipkin/pom.xml @@ -22,7 +22,7 @@ tracing org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/transports/pom.xml b/transports/pom.xml index 36d33af31fc..13439c0ffdc 100644 --- a/transports/pom.xml +++ b/transports/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb java-chassis-parent - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT ../parents/default transports diff --git a/transports/transport-common/pom.xml b/transports/transport-common/pom.xml index 1ebd172e2c2..00c1ae33c73 100644 --- a/transports/transport-common/pom.xml +++ b/transports/transport-common/pom.xml @@ -21,7 +21,7 @@ transports org.apache.servicecomb - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT 4.0.0 diff --git a/transports/transport-highway/pom.xml b/transports/transport-highway/pom.xml index fc921c3a642..d722eb7aa23 100644 --- a/transports/transport-highway/pom.xml +++ b/transports/transport-highway/pom.xml @@ -21,7 +21,7 @@ org.apache.servicecomb transports - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT transport-highway Java Chassis::Transports::Hightway diff --git a/transports/transport-rest/pom.xml b/transports/transport-rest/pom.xml index 657300ef185..933e7c8858c 100644 --- a/transports/transport-rest/pom.xml +++ b/transports/transport-rest/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb transports - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT transport-rest Java Chassis::Transports::Rest diff --git a/transports/transport-rest/transport-rest-client/pom.xml b/transports/transport-rest/transport-rest-client/pom.xml index 5f6e49772ed..49175b2140a 100644 --- a/transports/transport-rest/transport-rest-client/pom.xml +++ b/transports/transport-rest/transport-rest-client/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb transport-rest - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT transport-rest-client Java Chassis::Transports::Rest::Client diff --git a/transports/transport-rest/transport-rest-servlet/pom.xml b/transports/transport-rest/transport-rest-servlet/pom.xml index 0245a6001b3..0bdac6777ef 100644 --- a/transports/transport-rest/transport-rest-servlet/pom.xml +++ b/transports/transport-rest/transport-rest-servlet/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb transport-rest - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT transport-rest-servlet Java Chassis::Transports::Rest::Servlet diff --git a/transports/transport-rest/transport-rest-vertx/pom.xml b/transports/transport-rest/transport-rest-vertx/pom.xml index 6e9ae331dea..7a3475d38dd 100644 --- a/transports/transport-rest/transport-rest-vertx/pom.xml +++ b/transports/transport-rest/transport-rest-vertx/pom.xml @@ -22,7 +22,7 @@ org.apache.servicecomb transport-rest - 3.3.0-SNAPSHOT + 3.4.0-SNAPSHOT transport-rest-vertx Java Chassis::Transports::Rest::Vertx From 5258f2ddf436863b5f6fce9a2d44b8316493cd6a Mon Sep 17 00:00:00 2001 From: liubao68 Date: Wed, 28 May 2025 17:46:27 +0800 Subject: [PATCH 098/223] Bump spring boot from 3.3.5 to 3.4.5 --- dependencies/default/pom.xml | 9 --------- pom.xml | 2 +- .../springmvc/reference/CseClientHttpRequest.java | 6 ++++++ 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 884be85ce81..7340b00dcd7 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -86,7 +86,6 @@ 6.0.0 1.7.36 2.4 - 6.1.10 2.2.29 4.5.14 3.5.1 @@ -495,14 +494,6 @@ ${slf4j.version} - - org.springframework - spring-framework-bom - ${spring.version} - pom - import - - org.springframework.boot spring-boot-dependencies diff --git a/pom.xml b/pom.xml index a1eb40450b4..d0ee9bca7a6 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 3.21.0 3.3.0 4.9.3.0 - 3.3.5 + 3.4.5 3.5.3 diff --git a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpRequest.java b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpRequest.java index 3cbc2c93f04..ba056e180fb 100644 --- a/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpRequest.java +++ b/providers/provider-springmvc/src/main/java/org/apache/servicecomb/provider/springmvc/reference/CseClientHttpRequest.java @@ -20,6 +20,7 @@ import java.io.OutputStream; import java.lang.reflect.Type; import java.net.URI; +import java.util.Collections; import java.util.List; import java.util.Map; @@ -150,6 +151,11 @@ public URI getURI() { return uri; } + @Override + public Map getAttributes() { + return Collections.emptyMap(); + } + @Override public HttpHeaders getHeaders() { return httpHeaders; From 3374d90231a0c5637583e295d64cc94763faf7a6 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Fri, 30 May 2025 10:08:59 +0800 Subject: [PATCH 099/223] Bump vert.x from 4.5.14 to 4.5.15 --- .../demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java | 2 +- dependencies/default/pom.xml | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java index 5d919a5bfab..66c5ab958b4 100644 --- a/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java +++ b/demo/demo-jaxrs/jaxrs-client/src/main/java/org/apache/servicecomb/demo/jaxrs/client/CodeFirstRestTemplateJaxrs.java @@ -57,6 +57,6 @@ private void test404(RestOperations template) { } } TestMgr.check(404, exception.getStatusCode().value()); - TestMgr.check("404 Not Found: \"{\"message\":\"Not Found\"}\"", exception.getMessage()); + TestMgr.check(true, exception.getMessage().contains("404 Not Found")); } } diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 7340b00dcd7..a364ac1672c 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -71,7 +71,6 @@ 5.15.0 3.0.0 0.3.0 - 4.1.119.Final 4.12.0 0.16.0 3.23.4 @@ -87,7 +86,7 @@ 1.7.36 2.4 2.2.29 - 4.5.14 + 4.5.15 3.5.1 3.4.0 0.8.5 @@ -229,14 +228,6 @@ ${commons-logging.version} - - io.netty - netty-bom - import - ${netty.version} - pom - - org.apache.maven maven-model From b91f40baf1834ff6dfd59feb702b84c689e3d206 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:50:58 +0800 Subject: [PATCH 100/223] Bump org.kiwiproject:consul-client from 1.5.0 to 1.5.1 (#4833) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a364ac1672c..a96cb82b6c2 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -90,7 +90,7 @@ 3.5.1 3.4.0 0.8.5 - 1.5.0 + 1.5.1 ${basedir}/../.. From d66b40b3339b6205950263d0c11aebf0c81f6748 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:52:22 +0800 Subject: [PATCH 101/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.29 to 2.2.32 (#4832) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a96cb82b6c2..ef2e2742852 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 6.0.0 1.7.36 2.4 - 2.2.29 + 2.2.32 4.5.15 3.5.1 3.4.0 From bcb70971164280a21d356d38ad1fd1d637e052c9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:52:48 +0800 Subject: [PATCH 102/223] Bump com.alibaba.nacos:nacos-client from 3.0.0 to 3.0.1 (#4830) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index ef2e2742852..9a6d61e6396 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.15.2 5.2.0 5.15.0 - 3.0.0 + 3.0.1 0.3.0 4.12.0 0.16.0 From 981fbd00c8ec0f79c56a2f076e86d8e3da4ef664 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:53:19 +0800 Subject: [PATCH 103/223] Bump org.junit:junit-bom from 5.12.2 to 5.13.0 (#4827) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 9a6d61e6396..47fe12e7661 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.12.2 + 5.13.0 1.2.17 2.24.3 3.9.9 From d31c70a2bcc8ed2db1c32301e38d2c0479043cc5 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:53:37 +0800 Subject: [PATCH 104/223] Bump org.mockito:mockito-bom from 5.15.2 to 5.18.0 (#4824) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 47fe12e7661..b92ac37b4cf 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -66,7 +66,7 @@ 2.24.3 3.9.9 1.14.6 - 5.15.2 + 5.18.0 5.2.0 5.15.0 3.0.1 From 1d7180a5dee5f92d35feb35cddfa03fe70d7a737 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:54:14 +0800 Subject: [PATCH 105/223] Bump com.puppycrawl.tools:checkstyle from 10.23.1 to 10.25.0 (#4822) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d0ee9bca7a6..a869a8b048e 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.23.1 + 10.25.0 3.1.1 3.21.0 3.3.0 From 2c3aab7349a27523609cea58ad0a094b6c0e711d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:55:39 +0800 Subject: [PATCH 106/223] Bump org.codehaus.mojo:exec-maven-plugin from 3.5.0 to 3.5.1 (#4825) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a869a8b048e..d05e445e059 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.3.0 12.1.1 0.46.0 - 3.5.0 + 3.5.1 3.2.7 0.8.13 3.11.2 From f79e52094123e9e1ef6f5e76c03df3c0800ec22a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 6 Jun 2025 11:22:39 +0800 Subject: [PATCH 107/223] Bump commons-beanutils:commons-beanutils from 1.10.1 to 1.11.0 (#4829) Bumps commons-beanutils:commons-beanutils from 1.10.1 to 1.11.0. --- updated-dependencies: - dependency-name: commons-beanutils:commons-beanutils dependency-version: 1.11.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index b92ac37b4cf..2203007f99d 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -35,7 +35,7 @@ 3.27.3 4.3.0 6.2.0 - 1.10.1 + 1.11.0 2.19.0 2.6 3.17.0 From 720004391f16e5e810f13e0e9508b1ead3810d18 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Tue, 10 Jun 2025 09:40:31 +0800 Subject: [PATCH 108/223] [#4811] fixed type check problem (#4839) --- .../router/distribute/AbstractRouterDistributor.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/governance/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java b/governance/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java index c34ad909ae8..d3905dfb133 100644 --- a/governance/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java +++ b/governance/src/main/java/org/apache/servicecomb/router/distribute/AbstractRouterDistributor.java @@ -79,14 +79,14 @@ public List distribute(String targetServiceName, List list, unSetTagInstances, fallbackVersionServerMap); // weight calculation to obtain the next tags instance - TagItem targetTag = getFiltedServerTagItem(invokeRule, targetServiceName); + TagItem targetTag = getFilteredServerTagItem(invokeRule, targetServiceName); if (targetTag != null && versionServerMap.containsKey(targetTag)) { return versionServerMap.get(targetTag); } if (!fallbackVersionServerMap.isEmpty()) { // weight calculation to obtain the next fallback tags instance - TagItem fallbackTargetTag = getFallbackFiltedServerTagItem(invokeRule, targetServiceName); + TagItem fallbackTargetTag = getFallbackFilteredServerTagItem(invokeRule, targetServiceName); if (fallbackTargetTag != null && fallbackVersionServerMap.containsKey(fallbackTargetTag)) { return fallbackVersionServerMap.get(fallbackTargetTag); } @@ -113,12 +113,12 @@ public void init(Function getVersion, this.getProperties = getProperties; } - public TagItem getFiltedServerTagItem(PolicyRuleItem rule, String targetServiceName) { + public TagItem getFilteredServerTagItem(PolicyRuleItem rule, String targetServiceName) { return routerRuleCache.getServiceInfoCacheMap().get(targetServiceName) .getNextInvokeVersion(rule); } - public TagItem getFallbackFiltedServerTagItem(PolicyRuleItem rule, String targetServiceName) { + public TagItem getFallbackFilteredServerTagItem(PolicyRuleItem rule, String targetServiceName) { return routerRuleCache.getServiceInfoCacheMap().get(targetServiceName) .getFallbackNextInvokeVersion(rule); } From 394449241b3b3ad35ebb00a29d20a23f6332b1a0 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Tue, 10 Jun 2025 12:07:23 +0800 Subject: [PATCH 109/223] [#4811] Support logging fileName for configurations (#4838) --- .../center/client/ConfigCenterClient.java | 43 +++++++++++++++++++ .../config/kie/client/KieClient.java | 38 ++++++++++++++++ 2 files changed, 81 insertions(+) diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java index 25aedec6623..66d9d154fd5 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java @@ -18,7 +18,9 @@ package org.apache.servicecomb.config.center.client; import java.io.IOException; +import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; @@ -33,6 +35,7 @@ import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.CollectionUtils; import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.eventbus.EventBus; @@ -56,6 +59,8 @@ public class ConfigCenterClient implements ConfigCenterOperation { private final ConfigCenterAddressManager addressManager; + private final Map> dimensionConfigNames = new HashMap<>(); + public ConfigCenterClient(ConfigCenterAddressManager addressManager, HttpTransport httpTransport) { this.addressManager = addressManager; this.httpTransport = httpTransport; @@ -95,18 +100,24 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques if (allConfigMap.get(APPLICATION_CONFIG) != null) { configurations.putAll(allConfigMap.get(APPLICATION_CONFIG)); + logConfigurationNames(APPLICATION_CONFIG, allConfigMap.get(APPLICATION_CONFIG)); } if (allConfigMap.get(buildDimensionsInfo(request, false)) != null) { configurations.putAll(allConfigMap.get(buildDimensionsInfo(request, false))); + logConfigurationNames(buildDimensionsInfo(request, false), + allConfigMap.get(buildDimensionsInfo(request, false))); } if (allConfigMap.get(buildDarkLaunchDimensionsInfo(request)) != null) { configurations.putAll(allConfigMap.get(buildDarkLaunchDimensionsInfo(request))); + logConfigurationNames(buildDarkLaunchDimensionsInfo(request), + allConfigMap.get(buildDarkLaunchDimensionsInfo(request))); } if (allConfigMap.get(dimensionsInfo) != null) { configurations.putAll(allConfigMap.get(dimensionsInfo)); + logConfigurationNames(dimensionsInfo, allConfigMap.get(dimensionsInfo)); } queryConfigurationsResponse.setConfigurations(configurations); queryConfigurationsResponse.setChanged(true); @@ -140,6 +151,38 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques } } + /** + * Only the name of the new configuration item is printed. + * No log is printed when the configuration content is updated. + * + * @param dimension dimension + * @param configs configs + */ + private void logConfigurationNames(String dimension, Map configs) { + if (CollectionUtils.isEmpty(configs)) { + return; + } + List configNames = dimensionConfigNames.get(dimension); + if (configNames == null) { + configNames = new ArrayList<>(); + } + StringBuilder names = new StringBuilder(); + for (String key : configs.keySet()) { + if (configNames.contains(key)) { + continue; + } + names.append(key).append(","); + configNames.add(key); + } + if (names.isEmpty()) { + return; + } + dimensionConfigNames.put(dimension, configNames); + String fileNames = names.substring(0, names.length() - 1); + LOGGER.info("pulling dimension [{}] configurations success, get config names: [{}].", + dimension, fileNames); + } + @Override public void checkAddressAvailable(String address) { ServiceCombServiceAvailableUtils.checkAddressAvailable(addressManager, address, httpTransport, ADDRESS_CHECK_PATH); diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java index 8379e046b5b..2ab93254791 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java @@ -21,10 +21,12 @@ import java.io.StringReader; import java.nio.charset.StandardCharsets; +import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Enumeration; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Properties; import java.util.stream.Collectors; @@ -49,6 +51,7 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.config.YamlPropertiesFactoryBean; import org.springframework.core.io.ByteArrayResource; +import org.springframework.util.CollectionUtils; public class KieClient implements KieConfigOperation { @@ -66,6 +69,8 @@ public class KieClient implements KieConfigOperation { public static final String DEFAULT_KIE_API_VERSION = "v1"; + private final Map> dimensionConfigNames = new HashMap<>(); + public KieClient(KieAddressManager addressManager, HttpTransport httpTransport, KieConfiguration kieConfiguration) { this.httpTransport = httpTransport; this.addressManager = addressManager; @@ -90,6 +95,7 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, if (httpResponse.getStatusCode() == HttpStatus.SC_OK) { revision = httpResponse.getHeader("X-Kie-Revision"); KVResponse allConfigList = HttpUtils.deserialize(httpResponse.getContent(), KVResponse.class); + logConfigurationNames(request.getLabelsQuery(), allConfigList.getData()); Map configurations = getConfigByLabel(allConfigList); configurationsResponse.setConfigurations(configurations); configurationsResponse.setChanged(true); @@ -122,6 +128,38 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, } } + /** + * Only the name of the new configuration item is printed. + * No log is printed when the configuration content is updated. + * + * @param dimension dimension + * @param data configs-data + */ + private void logConfigurationNames(String dimension, List data) { + if (CollectionUtils.isEmpty(data)) { + return; + } + List configNames = dimensionConfigNames.get(dimension); + if (configNames == null) { + configNames = new ArrayList<>(); + } + StringBuilder names = new StringBuilder(); + for (KVDoc doc : data) { + if (configNames.contains(doc.getKey())) { + continue; + } + names.append(doc.getKey()).append(","); + configNames.add(doc.getKey()); + } + if (names.isEmpty()) { + return; + } + dimensionConfigNames.put(dimension, configNames); + String fileNames = names.substring(0, names.length() - 1); + LOGGER.info("pulling dimension [{}] configurations success, get config names: [{}].", + dimension, fileNames); + } + @Override public void checkAddressAvailable(String address) { ServiceCombServiceAvailableUtils.checkAddressAvailable(addressManager, address, httpTransport, ADDRESS_CHECK_PATH); From b806b790da9ff06cecb68a14d4a14c27c7946430 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Sun, 22 Jun 2025 21:15:45 +0800 Subject: [PATCH 110/223] update releases (#4851) --- README.md | 9 +++++---- README_ZH.md | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c9c809b77fc..b2fbc167625 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,16 @@ Apache ServiceComb Java Chassis is a Software Development Kit (SDK) for rapid de | Release Train | Latest Version | Compiled JDK Version | Tested JDK Version | Open API | Notes | |----------------|----------------|----------------------|--------------------|----------|--------------------------| -| Java Chassis 3 | 3.2.6 | OpenJDK 17 | OpenJDK 17 | 3.0.x | Depends on Spring Boot 3 | +| Java Chassis 3 | 3.3.0 | OpenJDK 17 | OpenJDK 17 | 3.0.x | Depends on Spring Boot 3 | | Java Chassis 2 | 2.8.24 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | Depends on Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | End of Support | Java Chassis core dependencies -| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | -| ---- | ---- | ---- | ---- | ---- | -| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | +| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | +|--------------|-------------|--------|---------|---------| +| 3.3.x | 3.4.x | 4.5.x | 2.2.x | 2.18.x | +| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | > NOTICE: Since Open API 3.0.x is not compatible with 2.0.x, Java Chassis 2 and Java Chassis 1 can not > work together with Java Chassis 3. All related consumers, providers and edge service need use Java Chassis 3 when upgrading. diff --git a/README_ZH.md b/README_ZH.md index 7d83a8a851b..bfae9746c2b 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -16,15 +16,16 @@ Apache ServiceComb Java Chassis 给开发者提供一个快速构建微服务的 | 版本火车 | 最新版本 | 编译的JDK版本 | 支持的JDK版本 | Open API | 备注 | |----------------|--------|------------|-------------------|----------|-----------------| -| Java Chassis 3 | 3.2.6 | OpenJDK 17 | OpenJDK 17 | 3.0.x | 依赖Spring Boot 3 | +| Java Chassis 3 | 3.3.0 | OpenJDK 17 | OpenJDK 17 | 3.0.x | 依赖Spring Boot 3 | | Java Chassis 2 | 2.8.24 | OpenJDK 8 | OpenJDK 8, 11, 17 | 2.0.x | 依赖Spring 5 | | Java Chassis 1 | 1.3.11 | OpenJDK 8 | OpenJDK 8 | 2.0.x | 停止更新 | Java Chassis 的核心依赖 -| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | -| ---- | ---- | ---- | ---- | ---- | -| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | +| Java Chassis | Spring Boot | Vert.x | Swagger | Jackson | +|--------------|-------------|--------|---------|---------| +| 3.3.x | 3.4.x | 4.5.x | 2.2.x | 2.18.x | +| 3.2.x | 3.3.x | 4.5.x | 2.2.x | 2.18.x | > NOTICE: Open API 3.0.x 不兼容 2.0.x, 因此Java Chassis 2、Java Chassis 1不能与Java Chassis 3共存互访. 升级Java Chassis 3, 需要将相关的消费者、提供者和边缘服务同时升级. From 52ae497fe798982af952e1f9518923f1930de135 Mon Sep 17 00:00:00 2001 From: yinhaox <33537497+yinhaox@users.noreply.github.com> Date: Fri, 27 Jun 2025 09:55:59 +0800 Subject: [PATCH 111/223] [#4854] fix pool size configuration issues in servicecomb.rest.client (#4855) --- .../client/http/HttpClientPoolFactory.java | 13 ++- .../http/HttpClientPoolFactoryTest.java | 91 +++++++++++++++++++ 2 files changed, 97 insertions(+), 7 deletions(-) create mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java index 26dcb6aab9a..985cc02a898 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java @@ -5,9 +5,7 @@ * 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. @@ -17,13 +15,12 @@ package org.apache.servicecomb.foundation.vertx.client.http; -import org.apache.servicecomb.foundation.vertx.client.ClientPoolFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - import io.vertx.core.Context; import io.vertx.core.http.HttpClient; import io.vertx.core.http.HttpClientOptions; +import org.apache.servicecomb.foundation.vertx.client.ClientPoolFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; // execute in vertx context public class HttpClientPoolFactory implements ClientPoolFactory { @@ -37,7 +34,9 @@ public HttpClientPoolFactory(HttpClientOptions httpClientOptions) { @Override public HttpClientWithContext createClientPool(Context context) { - HttpClient httpClient = context.owner().httpClientBuilder().with(httpClientOptions) + HttpClient httpClient = context.owner().httpClientBuilder() + .with(httpClientOptions) + .with(httpClientOptions.getPoolOptions()) .withConnectHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java new file mode 100644 index 00000000000..d4c52133547 --- /dev/null +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java @@ -0,0 +1,91 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.foundation.vertx.client.http; + +import io.vertx.core.Context; +import io.vertx.core.Vertx; +import io.vertx.core.http.HttpClient; +import io.vertx.core.http.HttpClientOptions; +import io.vertx.core.http.PoolOptions; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mockito; +import org.springframework.test.util.ReflectionTestUtils; + +public class HttpClientPoolFactoryTest { + private Context context; + private Vertx vertx; + private HttpClientPoolFactory factory; + + @BeforeEach + void setUp() { + // Mock the context and set up the Vertx instance + context = Mockito.mock(Context.class); + vertx = Vertx.vertx(); + Mockito.when(context.owner()).thenReturn(vertx); + + // Create HttpClientOptions with a specific max pool size + HttpClientOptions options = new HttpClientOptions(); + options.setMaxPoolSize(123); + + // Initialize the HttpClientPoolFactory with the given options + factory = new HttpClientPoolFactory(options); + } + + @AfterEach + void tearDown() { + // Close the Vertx instance to release resources + vertx.close(); + } + + @Test + void testCreateClientPool() { + // Create the client pool and get the HttpClient + HttpClient httpClient = factory.createClientPool(context).getHttpClient(); + + // Use ReflectionTestUtils to get the poolOptions field from the HttpClient + if (ReflectionTestUtils.getField(httpClient, "poolOptions") instanceof PoolOptions poolOptions) { + // Assert that the http1MaxSize is set to the expected value + Assertions.assertEquals(123, poolOptions.getHttp1MaxSize()); + } else { + // Fail the test if the poolOptions field is not found or not of the expected type + Assertions.fail("poolOptions field not found or not of the expected type"); + } + } + + @Test + void testCreateClientPoolWithDefaultOptions() { + // Create HttpClientOptions with default values + HttpClientOptions defaultOptions = new HttpClientOptions(); + + // Initialize the HttpClientPoolFactory with the default options + HttpClientPoolFactory defaultFactory = new HttpClientPoolFactory(defaultOptions); + + // Create the client pool and get the HttpClient + HttpClient defaultHttpClient = defaultFactory.createClientPool(context).getHttpClient(); + + // Use ReflectionTestUtils to get the poolOptions field from the HttpClient + if (ReflectionTestUtils.getField(defaultHttpClient, "poolOptions") instanceof PoolOptions defaultPoolOptions) { + // Assert that the http1MaxSize is set to the default value + Assertions.assertEquals(HttpClientOptions.DEFAULT_MAX_POOL_SIZE, defaultPoolOptions.getHttp1MaxSize()); + } else { + // Fail the test if the poolOptions field is not found or not of the expected type + Assertions.fail("poolOptions field not found or not of the expected type"); + } + } +} From 3d46b2413a7512b3dea74bae777f2f635af2aab0 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 27 Jun 2025 16:55:08 +0800 Subject: [PATCH 112/223] [#4842] servicecomb-client supports configurable connectTimeout , connectRequestTimeout, socketTimeout (#4853) --- .../center/client/ServiceCenterClient.java | 25 +++++++++++++++++-- .../RegistryClientTest.java | 11 +++++++- .../config/cc/ConfigCenterConfig.java | 18 +++++++++++++ .../ConfigCenterDynamicPropertiesSource.java | 11 ++++++-- .../servicecomb/config/kie/KieConfig.java | 18 +++++++++++++ .../kie/KieDynamicPropertiesSource.java | 11 +++++++- 6 files changed, 88 insertions(+), 6 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 1e6f41561d6..407fb28ac9d 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -25,6 +25,7 @@ import java.util.Map; import org.apache.http.HttpStatus; +import org.apache.http.client.config.RequestConfig; import org.apache.http.client.utils.URIBuilder; import org.apache.servicecomb.http.client.auth.RequestAuthHeaderProvider; import org.apache.servicecomb.http.client.common.HttpConfiguration.SSLProperties; @@ -59,6 +60,7 @@ import org.apache.servicecomb.service.center.client.model.UpdatePropertiesRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.core.env.Environment; import com.google.common.eventbus.EventBus; @@ -66,6 +68,12 @@ public class ServiceCenterClient implements ServiceCenterOperation { private static final Logger LOGGER = LoggerFactory.getLogger(ServiceCenterClient.class); + private static final String CLIENT_CONNECT_TIMEOUT = "servicecomb.registry.sc.client.timeout.connect"; + + private static final String CLIENT_REQUEST_TIMEOUT = "servicecomb.registry.sc.client.timeout.request"; + + private static final String CLIENT_SOCKET_TIMEOUT = "servicecomb.registry.sc.client.timeout.socket"; + private final ServiceCenterRawClient httpClient; private EventBus eventBus; @@ -87,8 +95,10 @@ public ServiceCenterClient(ServiceCenterAddressManager addressManager, SSLProperties sslProperties, RequestAuthHeaderProvider requestAuthHeaderProvider, String tenantName, - Map extraGlobalHeaders) { - HttpTransport httpTransport = HttpTransportFactory.createHttpTransport(sslProperties, requestAuthHeaderProvider); + Map extraGlobalHeaders, + Environment environment) { + HttpTransport httpTransport = HttpTransportFactory.createHttpTransport(sslProperties, requestAuthHeaderProvider, + buildRequestConfig(environment)); httpTransport.addHeaders(extraGlobalHeaders); this.httpClient = new ServiceCenterRawClient.Builder() @@ -98,6 +108,17 @@ public ServiceCenterClient(ServiceCenterAddressManager addressManager, this.addressManager = addressManager; } + private RequestConfig buildRequestConfig(Environment environment) { + RequestConfig.Builder builder = HttpTransportFactory.defaultRequestConfig(); + if (environment == null) { + return builder.build(); + } + builder.setConnectTimeout(environment.getProperty(CLIENT_CONNECT_TIMEOUT, int.class, 5000)); + builder.setConnectionRequestTimeout(environment.getProperty(CLIENT_REQUEST_TIMEOUT, int.class, 5000)); + builder.setSocketTimeout(environment.getProperty(CLIENT_SOCKET_TIMEOUT, int.class, 5000)); + return builder.build(); + } + @Override public MicroserviceInstancesResponse getServiceCenterInstances() { try { diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java index 85f041034cf..50ae96db158 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java +++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java @@ -42,6 +42,8 @@ import org.apache.servicecomb.service.center.client.model.MicroserviceInstance; import org.apache.servicecomb.service.center.client.model.SchemaInfo; import org.apache.servicecomb.service.center.client.model.ServiceCenterConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; import com.google.common.base.Charsets; @@ -58,6 +60,13 @@ public class RegistryClientTest implements CategorizedTestCase { // auto test only tests 'hasRegistered=false', can run this client many times to test 'hasRegistered=true' private boolean hasRegistered = true; + private final Environment environment; + + @Autowired + public RegistryClientTest(Environment environment) { + this.environment = environment; + } + @Override public void testRestTransport() throws Exception { ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager("default", Arrays.asList("http://127.0.0.1:30100"), @@ -65,7 +74,7 @@ public void testRestTransport() throws Exception { SSLProperties sslProperties = new SSLProperties(); sslProperties.setEnabled(false); ServiceCenterClient serviceCenterClient = new ServiceCenterClient(addressManager, sslProperties, - new DefaultRequestAuthHeaderProvider(), "default", null); + new DefaultRequestAuthHeaderProvider(), "default", null, environment); EventBus eventBus = new SimpleEventBus(); ServiceCenterConfiguration serviceCenterConfiguration = new ServiceCenterConfiguration(); ServiceCenterRegistration serviceCenterRegistration = new ServiceCenterRegistration(serviceCenterClient, diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java index eaa047e98bb..c1cf7c1b683 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterConfig.java @@ -39,6 +39,12 @@ public final class ConfigCenterConfig { private static final int DEFAULT_REFRESH_INTERVAL = 15000; + private static final String CLIENT_CONNECT_TIMEOUT = "servicecomb.config.client.timeout.connect"; + + private static final String CLIENT_REQUEST_TIMEOUT = "servicecomb.config.client.timeout.request"; + + private static final String CLIENT_SOCKET_TIMEOUT = "servicecomb.config.client.timeout.socket"; + private final Environment environment; public ConfigCenterConfig(Environment environment) { @@ -86,4 +92,16 @@ public String getProxyPasswd() { public List getServerUri() { return ConfigUtil.parseArrayValue(environment.getProperty(ADDRESS, "")); } + + public int getConnectTimeout() { + return environment.getProperty(CLIENT_CONNECT_TIMEOUT, int.class, 5000); + } + + public int getConnectionRequestTimeout() { + return environment.getProperty(CLIENT_REQUEST_TIMEOUT, int.class, 5000); + } + + public int getSocketTimeout() { + return environment.getProperty(CLIENT_SOCKET_TIMEOUT, int.class, 5000); + } } diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java index 431963da6aa..d1130317ece 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java @@ -72,8 +72,7 @@ private void init(Environment environment) { ConfigCenterAddressManager configCenterAddressManager = configCenterAddressManager(configCenterConfig); HttpTransport httpTransport = createHttpTransport(configCenterAddressManager, - HttpTransportFactory.defaultRequestConfig().build(), - environment, configCenterConfig); + buildRequestConfig(configCenterConfig), environment, configCenterConfig); ConfigCenterClient configCenterClient = new ConfigCenterClient(configCenterAddressManager, httpTransport); EventManager.register(this); @@ -90,6 +89,14 @@ private void init(Environment environment) { data.putAll(configConverter.getCurrentData()); } + private RequestConfig buildRequestConfig(ConfigCenterConfig config) { + RequestConfig.Builder builder = HttpTransportFactory.defaultRequestConfig(); + builder.setConnectTimeout(config.getConnectTimeout()); + builder.setConnectionRequestTimeout(config.getConnectionRequestTimeout()); + builder.setSocketTimeout(config.getSocketTimeout()); + return builder.build(); + } + private QueryConfigurationsRequest firstPull(ConfigCenterConfig configCenterConfig, ConfigCenterClient configCenterClient, Environment environment, ConfigCenterAddressManager configCenterAddressManager) { diff --git a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieConfig.java b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieConfig.java index 564b5c8ad17..79e40786f8f 100644 --- a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieConfig.java +++ b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieConfig.java @@ -66,6 +66,12 @@ public class KieConfig { private static final String CUSTOM_LABEL_VALUE_DEFAULT = ""; + private static final String CLIENT_CONNECT_TIMEOUT = "servicecomb.kie.client.timeout.connect"; + + private static final String CLIENT_REQUEST_TIMEOUT = "servicecomb.kie.client.timeout.request"; + + private static final String CLIENT_SOCKET_TIMEOUT = "servicecomb.kie.client.timeout.socket"; + private final Environment environment; public KieConfig(Environment environment) { @@ -148,4 +154,16 @@ public String getProxyUsername() { public String getProxyPasswd() { return environment.getProperty(VertxConst.PROXY_PASSWD); } + + public int getConnectTimeout() { + return environment.getProperty(CLIENT_CONNECT_TIMEOUT, int.class, 5000); + } + + public int getConnectionRequestTimeout() { + return environment.getProperty(CLIENT_REQUEST_TIMEOUT, int.class, 5000); + } + + public int getSocketTimeout() { + return environment.getProperty(CLIENT_SOCKET_TIMEOUT, int.class, 5000); + } } diff --git a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java index 716579692bd..e9819f6746f 100644 --- a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java +++ b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java @@ -26,6 +26,7 @@ import org.apache.http.auth.UsernamePasswordCredentials; import org.apache.http.client.CredentialsProvider; import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.config.RequestConfig.Builder; import org.apache.http.impl.client.BasicCredentialsProvider; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.servicecomb.config.BootStrapProperties; @@ -72,7 +73,7 @@ private void init(Environment environment) { configConverter = new ConfigConverter(kieConfig.getFileSources()); KieAddressManager kieAddressManager = configKieAddressManager(kieConfig); - RequestConfig.Builder requestBuilder = HttpTransportFactory.defaultRequestConfig(); + RequestConfig.Builder requestBuilder = buildRequestConfigBuilder(kieConfig); if (kieConfig.enableLongPolling() && kieConfig.getPollingWaitTime() >= 0) { requestBuilder.setConnectionRequestTimeout(kieConfig.getPollingWaitTime() * 2 * 1000); @@ -90,6 +91,14 @@ private void init(Environment environment) { data.putAll(configConverter.getCurrentData()); } + private Builder buildRequestConfigBuilder(KieConfig kieConfig) { + Builder builder = HttpTransportFactory.defaultRequestConfig(); + builder.setConnectTimeout(kieConfig.getConnectTimeout()); + builder.setConnectionRequestTimeout(kieConfig.getConnectionRequestTimeout()); + builder.setSocketTimeout(kieConfig.getSocketTimeout()); + return builder; + } + @Subscribe public void onConfigurationChangedEvent(KieConfigurationChangedEvent event) { LOGGER.info("Dynamic configuration changed: {}", event.getChanged()); From 38ee9a1a3682aa2a1170f50104ef761eb2baed75 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:27:00 +0800 Subject: [PATCH 113/223] Bump org.apache.maven:maven-model from 3.9.9 to 3.9.10 (#4872) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 2203007f99d..13e69cde50c 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -64,7 +64,7 @@ 5.13.0 1.2.17 2.24.3 - 3.9.9 + 3.9.10 1.14.6 5.18.0 5.2.0 From 91905af4db8b103b0d9dc589358927d281eb4243 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:27:15 +0800 Subject: [PATCH 114/223] Bump com.github.spotbugs:spotbugs-maven-plugin from 4.9.3.0 to 4.9.3.2 (#4871) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d05e445e059..aaa92692451 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 3.1.1 3.21.0 3.3.0 - 4.9.3.0 + 4.9.3.2 3.4.5 3.5.3 From 5304336ecc82b5e9587db65d749f7c7acf570c04 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:27:48 +0800 Subject: [PATCH 115/223] Bump com.alibaba.nacos:nacos-client from 3.0.1 to 3.0.2 (#4869) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 13e69cde50c..d3da7c7cb2f 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.18.0 5.2.0 5.15.0 - 3.0.1 + 3.0.2 0.3.0 4.12.0 0.16.0 From 604399b3655991325109c9b78dde97503c062601 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:28:05 +0800 Subject: [PATCH 116/223] Bump org.codehaus.mojo:license-maven-plugin from 2.5.0 to 2.6.0 (#4868) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index aaa92692451..d1f6414e6ac 100644 --- a/pom.xml +++ b/pom.xml @@ -199,7 +199,7 @@ org.codehaus.mojo license-maven-plugin - 2.5.0 + 2.6.0 default-cli From ef5e34566bf3de927ad584fddf3c31074641a07e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:28:27 +0800 Subject: [PATCH 117/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.32 to 2.2.34 (#4867) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index d3da7c7cb2f..792a7755f95 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 6.0.0 1.7.36 2.4 - 2.2.32 + 2.2.34 4.5.15 3.5.1 3.4.0 From fcb5cfde57c6509eed381f627d818af289bab552 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:28:42 +0800 Subject: [PATCH 118/223] Bump org.owasp:dependency-check-maven from 12.1.1 to 12.1.3 (#4865) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d1f6414e6ac..c975dd0d4ce 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.1.1 + 12.1.3 0.46.0 3.5.1 3.2.7 From aa254324b358e299b28ac2e361efb62b2dbf8760 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:29:01 +0800 Subject: [PATCH 119/223] Bump org.apache:apache from 34 to 35 (#4866) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c975dd0d4ce..a3e695daa7f 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ org.apache apache - 34 + 35 From 4ceadb951d6547cbfd13e5991fa0adb1d6b40c2a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:29:23 +0800 Subject: [PATCH 120/223] Bump com.puppycrawl.tools:checkstyle from 10.25.0 to 10.26.1 (#4863) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a3e695daa7f..b38cfe758e7 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.25.0 + 10.26.1 3.1.1 3.21.0 3.3.0 From 21f9a1facc56c9ce55a828a9934d59bbaa30ae77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:29:41 +0800 Subject: [PATCH 121/223] Bump org.junit:junit-bom from 5.13.0 to 5.13.2 (#4861) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 792a7755f95..5753c47f3ff 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.13.0 + 5.13.2 1.2.17 2.24.3 3.9.10 From d1bdbee34e255c8e28156c9214e4c5e06219c96d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:30:00 +0800 Subject: [PATCH 122/223] Bump io.zipkin.brave:brave-bom from 6.2.0 to 6.3.0 (#4860) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 5753c47f3ff..7367450fdbd 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -34,7 +34,7 @@ 1.2.2 3.27.3 4.3.0 - 6.2.0 + 6.3.0 1.11.0 2.19.0 2.6 From f57b8fdfdde51ba91d53ebe11a9114e44c211c8b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 9 Jul 2025 11:30:24 +0800 Subject: [PATCH 123/223] Bump hibernate-validator.version from 8.0.1.Final to 9.0.1.Final (#4859) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 7367450fdbd..a7fd79cccf8 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -50,7 +50,7 @@ 5.1.0 1.3 2.2.2 - 8.0.1.Final + 9.0.1.Final 4.5.14 1.5.18 2.18.3 From 1de78879e2707259b09ebf3cc3ea3b47c64dbbaf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 17:32:02 +0800 Subject: [PATCH 124/223] Bump spring-boot.version from 3.4.5 to 3.5.3 (#4862) Bumps `spring-boot.version` from 3.4.5 to 3.5.3. Updates `org.springframework.boot:spring-boot-maven-plugin` from 3.4.5 to 3.5.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.4.5...v3.5.3) Updates `org.springframework.boot:spring-boot-dependencies` from 3.4.5 to 3.5.3 - [Release notes](https://github.com/spring-projects/spring-boot/releases) - [Commits](https://github.com/spring-projects/spring-boot/compare/v3.4.5...v3.5.3) --- updated-dependencies: - dependency-name: org.springframework.boot:spring-boot-maven-plugin dependency-version: 3.5.3 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.springframework.boot:spring-boot-dependencies dependency-version: 3.5.3 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b38cfe758e7..cd58d47c1e7 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 3.21.0 3.3.0 4.9.3.2 - 3.4.5 + 3.5.3 3.5.3 From f0e715ce5d31fd426cd1793d36e44750e8adfecb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 17:34:42 +0800 Subject: [PATCH 125/223] Bump log4j2.version from 2.24.3 to 2.25.0 (#4857) Bumps `log4j2.version` from 2.24.3 to 2.25.0. Updates `org.apache.logging.log4j:log4j-api` from 2.24.3 to 2.25.0 Updates `org.apache.logging.log4j:log4j-core` from 2.24.3 to 2.25.0 Updates `org.apache.logging.log4j:log4j-slf4j-impl` from 2.24.3 to 2.25.0 --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-api dependency-version: 2.25.0 dependency-type: direct:development update-type: version-update:semver-minor - dependency-name: org.apache.logging.log4j:log4j-core dependency-version: 2.25.0 dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.apache.logging.log4j:log4j-slf4j-impl dependency-version: 2.25.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a7fd79cccf8..9ba6f9e4ac1 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.13.2 1.2.17 - 2.24.3 + 2.25.0 3.9.10 1.14.6 5.18.0 From 01e1b0135ba761f7a714f5538ee449fa714ad85c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Jul 2025 17:35:43 +0800 Subject: [PATCH 126/223] Bump io.micrometer:micrometer-bom from 1.14.6 to 1.15.1 (#4870) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.14.6 to 1.15.1. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.14.6...v1.15.1) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-version: 1.15.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 9ba6f9e4ac1..43992a18098 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.0 3.9.10 - 1.14.6 + 1.15.1 5.18.0 5.2.0 5.15.0 From 916d5b69486c886abb84d1c96b45565d1c42063b Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Tue, 29 Jul 2025 14:03:58 +0800 Subject: [PATCH 127/223] [#4876] fixed heartbeatInterval configuration parameter is not taking effect problem. (#4880) --- .../org/apache/servicecomb/registry/sc/SCRegistration.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java index aba4d6d49a3..6692f61c6c7 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCRegistration.java @@ -104,6 +104,10 @@ public void init() { eventBus); serviceCenterRegistration.setMicroservice(microservice); serviceCenterRegistration.setMicroserviceInstance(microserviceInstance); + serviceCenterRegistration.setHeartBeatInterval( + TimeUnit.SECONDS.toMillis(configurationProperties.getHealthCheckIntervalInSeconds())); + serviceCenterRegistration.setHeartBeatRequestTimeout( + configurationProperties.getHealthCheckRequestTimeoutInMillis()); registrationInstance = new SCRegistrationInstance(microservice, microserviceInstance, serviceCenterRegistration); eventBus.register(this); } From ff79196f1b7a38274e5dd3e4093c20279c3ab205 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:50:20 +0800 Subject: [PATCH 128/223] Bump org.apache.maven.plugins:maven-gpg-plugin from 3.2.7 to 3.2.8 (#4897) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cd58d47c1e7..f5cf4c707c2 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 12.1.3 0.46.0 3.5.1 - 3.2.7 + 3.2.8 0.8.13 3.11.2 2.5 From 8da9f55efb8b7e501b794126f60b9f0c16472008 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:50:43 +0800 Subject: [PATCH 129/223] Bump org.apache.commons:commons-text from 1.13.1 to 1.14.0 (#4896) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 43992a18098..afe80f0d578 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -40,7 +40,7 @@ 2.6 3.17.0 1.3.5 - 1.13.1 + 1.14.0 5.7.1 1.0.3 3.0.2 From c63f0bdb47b6c00b9f1e429aee59d6808d7fe424 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:50:59 +0800 Subject: [PATCH 130/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.34 to 2.2.35 (#4895) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index afe80f0d578..76ad0a5c590 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 6.0.0 1.7.36 2.4 - 2.2.34 + 2.2.35 4.5.15 3.5.1 3.4.0 From 41c8b3dca2d8b7d77aa8bea0176ffe314ab3a115 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:51:14 +0800 Subject: [PATCH 131/223] Bump io.reactivex.rxjava3:rxjava from 3.1.10 to 3.1.11 (#4894) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 76ad0a5c590..23ca2f5e357 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -79,7 +79,7 @@ 1.0.4 1.7.0 2.7.18 - 3.1.10 + 3.1.11 1.0.0 0.13.2 6.0.0 From 3a8e89abd8bde23085e4a53fb51d68ed727df46d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:51:33 +0800 Subject: [PATCH 132/223] Bump org.kiwiproject:consul-client from 1.5.1 to 1.6.0 (#4893) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 23ca2f5e357..288f3a1d7d5 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -90,7 +90,7 @@ 3.5.1 3.4.0 0.8.5 - 1.5.1 + 1.6.0 ${basedir}/../.. From 785e5c4f53975c38de8fa74205b8e4b1896969c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:52:30 +0800 Subject: [PATCH 133/223] Bump org.junit:junit-bom from 5.13.2 to 5.13.4 (#4892) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 288f3a1d7d5..0968abca0d9 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -61,7 +61,7 @@ 3.1.4 1.34 4.13.2 - 5.13.2 + 5.13.4 1.2.17 2.25.0 3.9.10 From e4a9f84671e1c5ed6c1e872dcd9d5fa2d37aa91b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:52:48 +0800 Subject: [PATCH 134/223] Bump org.apache.commons:commons-lang3 from 3.17.0 to 3.18.0 (#4891) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 0968abca0d9..772e2dd0980 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -38,7 +38,7 @@ 1.11.0 2.19.0 2.6 - 3.17.0 + 3.18.0 1.3.5 1.14.0 5.7.1 From 4ec41b49170e4ea6a3b04113ffe6e0f2ba388848 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:53:10 +0800 Subject: [PATCH 135/223] Bump commons-io:commons-io from 2.19.0 to 2.20.0 (#4888) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 772e2dd0980..ec72201e78d 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -36,7 +36,7 @@ 4.3.0 6.3.0 1.11.0 - 2.19.0 + 2.20.0 2.6 3.18.0 1.3.5 From 11be8681271efbe2c84fc22f1db08f7b630dadbc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:53:25 +0800 Subject: [PATCH 136/223] Bump spring-boot.version from 3.5.3 to 3.5.4 (#4886) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f5cf4c707c2..2478e78336c 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 3.21.0 3.3.0 4.9.3.2 - 3.5.3 + 3.5.4 3.5.3 From 7276088819f566b934757c593cc85bb9fc8b919a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:53:38 +0800 Subject: [PATCH 137/223] Bump log4j2.version from 2.25.0 to 2.25.1 (#4885) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index ec72201e78d..884618f6b32 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.13.4 1.2.17 - 2.25.0 + 2.25.1 3.9.10 1.15.1 5.18.0 From 46b15d21b1873b3e762fb7adfa45930d777e1009 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 10:54:41 +0800 Subject: [PATCH 138/223] Bump io.micrometer:micrometer-bom from 1.15.1 to 1.15.2 (#4883) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 884618f6b32..435f3a63b53 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.1 3.9.10 - 1.15.1 + 1.15.2 5.18.0 5.2.0 5.15.0 From 3dcec1f062fe2221b1209a06fc8a6013e9ac20e9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:32:00 +0800 Subject: [PATCH 139/223] Bump curator.version from 5.7.1 to 5.9.0 (#4889) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 435f3a63b53..8e2f35370d4 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -41,7 +41,7 @@ 3.18.0 1.3.5 1.14.0 - 5.7.1 + 5.9.0 1.0.3 3.0.2 1.17.12 From ad343e268041fad7984a402afdb1136598311909 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Aug 2025 11:32:15 +0800 Subject: [PATCH 140/223] Bump org.apache.maven:maven-model from 3.9.10 to 3.9.11 (#4884) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 8e2f35370d4..c7dcd3b1c5c 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -64,7 +64,7 @@ 5.13.4 1.2.17 2.25.1 - 3.9.10 + 3.9.11 1.15.2 5.18.0 5.2.0 From 4ee2d55fe9e1fe1960d0850a45d265011bdf8c90 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Tue, 5 Aug 2025 11:50:11 +0800 Subject: [PATCH 141/223] Bump com.fasterxml.jackson:jackson-bom from 2.18.3 to 2.19.2 (#4898) --- dependencies/default/pom.xml | 2 +- .../servicecomb/swagger/extend/module/EnumModuleExtTest.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index c7dcd3b1c5c..b79037029b1 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -53,7 +53,7 @@ 9.0.1.Final 4.5.14 1.5.18 - 2.18.3 + 2.19.2 1.6.0 1.3.2 1 diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/extend/module/EnumModuleExtTest.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/extend/module/EnumModuleExtTest.java index e6865b1055b..309f84f4b4a 100644 --- a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/extend/module/EnumModuleExtTest.java +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/extend/module/EnumModuleExtTest.java @@ -56,7 +56,7 @@ public void testEnumModule() throws JsonProcessingException { serializeValue = mapper.writeValueAsString(TestEnum.E_F); Assertions.assertEquals("\"E.F\"", serializeValue); serializeValue = mapper.writeValueAsString(TestEnum.HI); - Assertions.assertEquals("\"HI\"", serializeValue); + Assertions.assertEquals("\"\"", serializeValue); } @Test @@ -64,6 +64,6 @@ public void testEnumModuleModel() { OpenAPI openAPI = new OpenAPI(); Schema schema = SwaggerUtils.resolveTypeSchemas(openAPI, TestEnum.class); Assertions.assertEquals(schema.getType(), "string"); - MatcherAssert.assertThat((List) schema.getEnum(), contains("AB", "C-D", "E.F", "HI")); + MatcherAssert.assertThat((List) schema.getEnum(), contains("AB", "C-D", "E.F", "")); } } From ac2f1f6db5bdab665ce88960ca3834052c8091c1 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Tue, 5 Aug 2025 14:54:56 +0800 Subject: [PATCH 142/223] remove okhttp3 dependency management (#4899) --- .../filter/impl/ProducerOperationFilterTest.java | 3 +-- dependencies/default/pom.xml | 13 ------------- .../foundation/ssl/KeyStoreUtilTest.java | 8 +------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/core/src/test/java/org/apache/servicecomb/core/filter/impl/ProducerOperationFilterTest.java b/core/src/test/java/org/apache/servicecomb/core/filter/impl/ProducerOperationFilterTest.java index 4531895e9b2..dd46b17d28b 100644 --- a/core/src/test/java/org/apache/servicecomb/core/filter/impl/ProducerOperationFilterTest.java +++ b/core/src/test/java/org/apache/servicecomb/core/filter/impl/ProducerOperationFilterTest.java @@ -189,8 +189,7 @@ public void should_unify_IllegalArgumentException_message_when_convert_exception assertThat(future) .failsWithin(Duration.ofSeconds(1)) .withThrowableOfType(ExecutionException.class) - .withCauseExactlyInstanceOf(IllegalArgumentException.class) - .withMessage("java.lang.IllegalArgumentException: wrong number of arguments"); + .withCauseExactlyInstanceOf(IllegalArgumentException.class); InvocationException throwable = Exceptions .convert(invocation, catchThrowable(future::get), INTERNAL_SERVER_ERROR); diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index b79037029b1..9e729c44cc3 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -71,7 +71,6 @@ 5.15.0 3.0.2 0.3.0 - 4.12.0 0.16.0 3.23.4 1.8.0 @@ -192,18 +191,6 @@ test - - com.squareup.okhttp3 - okhttp - ${okhttp3.version} - - - - com.squareup.okhttp3 - mockwebserver - ${okhttp3.version} - - commons-beanutils commons-beanutils diff --git a/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/KeyStoreUtilTest.java b/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/KeyStoreUtilTest.java index f7d046f6562..54955139087 100644 --- a/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/KeyStoreUtilTest.java +++ b/foundations/foundation-ssl/src/test/java/org/apache/servicecomb/foundation/ssl/KeyStoreUtilTest.java @@ -26,13 +26,12 @@ import java.security.cert.CertificateFactory; import java.util.Collection; -import org.apache.commons.lang3.SystemUtils; import org.junit.Test; import org.junit.jupiter.api.Assertions; -import org.mockito.Mockito; import mockit.Mock; import mockit.MockUp; +import org.mockito.Mockito; public class KeyStoreUtilTest { final String strFilePath = Thread.currentThread().getContextClassLoader().getResource("").getPath(); @@ -78,14 +77,9 @@ public void testCreateKeyManagersException() { try { KeyStoreUtil.createKeyManagers(keystore, storeKeyValue); } catch (IllegalArgumentException e) { - if (SystemUtils.JAVA_SPECIFICATION_VERSION.startsWith("17")) { Assertions.assertEquals("Bad key store.Get Key failed:" + " Cannot read the array length because \"password\" is null", e.getMessage()); - } else { - Assertions.assertEquals("Bad key store.Get Key failed: null", - e.getMessage()); - } } } From fbf88d34f0a9d7dbcd91a1c4c69f56bb7736e2d4 Mon Sep 17 00:00:00 2001 From: liubao68 Date: Thu, 7 Aug 2025 18:40:38 +0800 Subject: [PATCH 143/223] Bump vertx.version from 4.5.15 to 5.0.1 (#4900) --- .github/workflows/checkstyle.yml | 4 +- .github/workflows/maven.yml | 4 +- .github/workflows/spotbugs.yml | 38 -- .../element/impl/RequestHeaderItemTest.java | 4 +- .../element/impl/ResponseHeaderItemTest.java | 4 +- .../rest/codec/param/TestBodyProcessor.java | 2 +- .../TestClassPathStaticResourceHandler.java | 12 +- .../core/executor/TestGroupExecutor.java | 4 +- .../core/transport/TestAbstractTransport.java | 4 +- .../samples/WebsocketController.java | 6 +- .../samples/WebsocketController.java | 6 +- .../demo/pojo/client/CodeFirstPojoClient.java | 2 +- .../samples/WebsocketController.java | 6 +- demo/pom.xml | 3 +- dependencies/default/pom.xml | 38 +- .../common/event/TestEventManager.java | 6 +- .../foundation/common/utils/TestJvmUtils.java | 2 +- .../java/io/vertx/core/impl/SyncContext.java | 246 ----------- .../test/scaffolding/log/LogCollector.java | 25 +- .../foundation/vertx/SharedVertxFactory.java | 2 +- .../foundation/vertx/VertxUtils.java | 73 +++- .../client/http/HttpClientOptionsSPI.java | 3 - .../client/http/HttpClientPoolFactory.java | 15 +- .../vertx/client/http/HttpClients.java | 9 +- .../vertx/client/tcp/NetClientWrapper.java | 10 +- .../vertx/client/tcp/TcpClientConnection.java | 21 +- .../foundation/vertx/http/ReadStreamPart.java | 54 ++- .../vertx/metrics/DefaultClientMetrics.java | 20 +- .../metrics/DefaultHttpClientMetrics.java | 3 +- .../vertx/metrics/DefaultVertxMetrics.java | 13 +- .../metrics/DefaultVertxMetricsFactory.java | 1 - .../foundation/vertx/server/TcpParser.java | 19 +- .../foundation/vertx/server/TcpServer.java | 8 +- .../vertx/stream/InputStreamToReadStream.java | 23 +- .../stream/OutputStreamToWriteStream.java | 28 +- .../foundation/vertx/stream/PumpCommon.java | 29 +- .../foundation/vertx/stream/PumpFromPart.java | 2 +- .../foundation/vertx/tcp/TcpConnection.java | 2 +- .../web/impl/TestHttpServerRequestUtils.java | 47 -- .../vertx/TestSharedVertxFactory.java | 4 +- .../foundation/vertx/TestVertxUtils.java | 22 +- .../http/HttpClientPoolFactoryTest.java | 91 ---- .../client/tcp/TestNetClientWrapper.java | 108 ----- .../client/tcp/TestTcpClientConnection.java | 10 +- .../tcp/TestTcpClientConnectionPool.java | 43 -- .../vertx/http/TestReadStreamPart.java | 200 --------- ...txServerResponseToHttpServletResponse.java | 411 ------------------ .../TestDefaultVertxMetricsFactory.java | 2 - .../vertx/server/TestTcpServer.java | 133 ------ .../vertx/stream/TestPumpFromPart.java | 181 -------- metrics/metrics-core/pom.xml | 10 - .../core/TestVertxMetersInitializer.java | 53 ++- .../core/publish/TestDefaultLogPublisher.java | 4 +- .../publish/TestSlowInvocationLogger.java | 4 +- pom.xml | 1 - .../common/TestTransportConfigUtils.java | 6 +- .../highway/HighwayServerCodecFilterTest.java | 4 +- .../transport/highway/TestHighwayCodec.java | 184 -------- .../highway/TestHighwayTransport.java | 4 +- .../HttpTransportHttpClientOptionsSPI.java | 5 +- .../rest/client/RestClientEncoder.java | 83 ++-- .../rest/client/RestClientSender.java | 2 +- .../rest/client/TransportClientConfig.java | 9 +- .../rest/servlet/TestRestServlet.java | 4 +- .../servlet/TestServletRestTransport.java | 4 +- .../rest/vertx/RestServerVerticle.java | 12 +- .../rest/vertx/VertxRestDispatcher.java | 5 +- .../rest/vertx/MockHttpServerResponse.java | 95 +--- .../rest/vertx/TestRestServerVerticle.java | 4 +- .../rest/vertx/TestVertxRestTransport.java | 4 +- 70 files changed, 365 insertions(+), 2135 deletions(-) delete mode 100644 .github/workflows/spotbugs.yml delete mode 100644 foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java delete mode 100644 foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestNetClientWrapper.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnectionPool.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestReadStreamPart.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerResponseToHttpServletResponse.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java delete mode 100644 foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/stream/TestPumpFromPart.java delete mode 100644 transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 2accac178fe..6bb472f5fd2 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -35,6 +35,4 @@ jobs: java-version: '17' distribution: 'temurin' - name: checkstyle - run: mvn -B -Pit install -DskipTests -Dspotbugs.skip=true checkstyle:check - - name: javadoc - run: mvn javadoc:javadoc -Prelease + run: mvn checkstyle:check -B -Pit diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a157b6ddfc8..aca4e4a556e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -49,6 +49,4 @@ jobs: restore-keys: | ${{ runner.os }}-maven- - name: Compilation and Installation - run: mvn clean install -Dcheckstyle.skip -Dspotbugs.skip=true -B -Pdocker -Pjacoco -Pit -Pcoverage - - name: publish coverage report - run: bash <(curl -s https://codecov.io/bash) + run: mvn clean verify -Dcheckstyle.skip=true -B -Pdocker -Pjacoco -Pit -Pcoverage diff --git a/.github/workflows/spotbugs.yml b/.github/workflows/spotbugs.yml deleted file mode 100644 index 0d66fdbe31c..00000000000 --- a/.github/workflows/spotbugs.yml +++ /dev/null @@ -1,38 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -name: spot bugs -on: - pull_request: - branches: - - master - -jobs: - spotbugs: - timeout-minutes: 60 - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up jdk - uses: actions/setup-java@v4 - with: - java-version: '17' - distribution: 'temurin' - - name: spotbugs - run: mvn -B -Pit -DskipTests clean verify spotbugs:spotbugs diff --git a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/RequestHeaderItemTest.java b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/RequestHeaderItemTest.java index 77a807c32a2..f2ae7004251 100644 --- a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/RequestHeaderItemTest.java +++ b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/RequestHeaderItemTest.java @@ -78,7 +78,7 @@ public void initStrBuilder() { @Test public void serverFormattedElement() { - HeadersMultiMap headers = new HeadersMultiMap(); + HeadersMultiMap headers = HeadersMultiMap.httpHeaders(); String testValue = "testValue"; headers.add(VAR_NAME, testValue); when(routingContext.request()).thenReturn(serverRequest); @@ -129,7 +129,7 @@ public void clientFormattedElementIfHeaderIsNull() { @Test public void serverFormattedElementIfNotFound() { - HeadersMultiMap headers = new HeadersMultiMap(); + HeadersMultiMap headers = HeadersMultiMap.httpHeaders(); String testValue = "testValue"; headers.add("anotherKey", testValue); when(routingContext.request()).thenReturn(serverRequest); diff --git a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/ResponseHeaderItemTest.java b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/ResponseHeaderItemTest.java index a2e283e4bc8..a8708172945 100644 --- a/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/ResponseHeaderItemTest.java +++ b/common/common-access-log/src/test/java/org/apache/servicecomb/common/accessLog/core/element/impl/ResponseHeaderItemTest.java @@ -64,7 +64,7 @@ public void initStrBuilder() { @Test public void serverFormattedElement() { - HeadersMultiMap headers = new HeadersMultiMap(); + HeadersMultiMap headers = HeadersMultiMap.httpHeaders(); String headerValue = "headerValue"; headers.add(VAR_NAME, headerValue); when(routingContext.response()).thenReturn(serverResponse); @@ -122,7 +122,7 @@ public void clientFormattedElementOnResponseIsNull() { @Test public void serverFormattedElementOnNotFound() { - HeadersMultiMap headers = new HeadersMultiMap(); + HeadersMultiMap headers = HeadersMultiMap.httpHeaders(); String headerValue = "headerValue"; headers.add("anotherHeader", headerValue); when(routingContext.response()).thenReturn(serverResponse); diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestBodyProcessor.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestBodyProcessor.java index 784150324e8..ab71e3a9e99 100644 --- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestBodyProcessor.java +++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/codec/param/TestBodyProcessor.java @@ -116,7 +116,7 @@ public void before() { LegacyPropertyFactory.setEnvironment(environment); Mockito.when(environment.getProperty("servicecomb.rest.parameter.decodeAsObject", boolean.class, false)) .thenReturn(false); - headers = new HeadersMultiMap(); + headers = HeadersMultiMap.httpHeaders(); value = "value"; } diff --git a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/resource/TestClassPathStaticResourceHandler.java b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/resource/TestClassPathStaticResourceHandler.java index 3055b3751bb..f95468f4f38 100644 --- a/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/resource/TestClassPathStaticResourceHandler.java +++ b/common/common-rest/src/test/java/org/apache/servicecomb/common/rest/resource/TestClassPathStaticResourceHandler.java @@ -20,10 +20,6 @@ import java.io.InputStream; import java.nio.charset.StandardCharsets; -import jakarta.servlet.http.Part; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.Response.Status; - import org.apache.commons.io.IOUtils; import org.apache.servicecomb.foundation.test.scaffolding.exception.RuntimeExceptionWithoutStackTrace; import org.apache.servicecomb.foundation.test.scaffolding.log.LogCollector; @@ -35,6 +31,10 @@ import org.junit.jupiter.api.Test; import org.mockito.Mockito; +import jakarta.servlet.http.Part; +import jakarta.ws.rs.core.HttpHeaders; +import jakarta.ws.rs.core.Response.Status; + public class TestClassPathStaticResourceHandler { static ClassPathStaticResourceHandler handler = new ClassPathStaticResourceHandler(); @@ -49,7 +49,7 @@ public void normal() throws IOException { Part part = response.getResult(); try (InputStream is = part.getInputStream()) { - Assertions.assertTrue(IOUtils.toString(is, StandardCharsets.UTF_8).endsWith("\n")); + Assertions.assertTrue(IOUtils.toString(is, StandardCharsets.UTF_8).trim().endsWith("")); } Assertions.assertEquals("text/html", part.getContentType()); Assertions.assertEquals("text/html", response.getHeader(HttpHeaders.CONTENT_TYPE)); @@ -84,7 +84,7 @@ public void attack() { public void readContentFailed() throws IOException { handler = Mockito.spy(TestClassPathStaticResourceHandler.handler); Mockito.when(handler.findResource("web-root/index.html")) - .thenThrow(new RuntimeExceptionWithoutStackTrace("read content failed.")); + .thenThrow(new RuntimeExceptionWithoutStackTrace("read content failed.")); try (LogCollector logCollector = new LogCollector()) { Response response = handler.handle("index.html"); diff --git a/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java b/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java index d92ca3bb2ce..dd95105992b 100644 --- a/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java +++ b/core/src/test/java/org/apache/servicecomb/core/executor/TestGroupExecutor.java @@ -111,7 +111,7 @@ public void maxThreads() { Assertions.assertEquals( "servicecomb.executor.default.thread-per-group is deprecated, recommended to use servicecomb.executor.default.maxThreads-per-group.", collector.getEvents().get(collector.getEvents().size() - 2).getMessage().getFormattedMessage()); - collector.teardown(); + collector.tearDown(); Mockito.when(environment.getProperty(KEY_MAX_THREADS, int.class, -1)).thenReturn(300); groupExecutor.initConfig(); @@ -127,7 +127,7 @@ public void adjustCoreThreads() { Assertions.assertEquals( "coreThreads is bigger than maxThreads, change from 25 to 10.", collector.getEvents().get(collector.getEvents().size() - 2).getMessage().getFormattedMessage()); - collector.teardown(); + collector.tearDown(); } @Test diff --git a/core/src/test/java/org/apache/servicecomb/core/transport/TestAbstractTransport.java b/core/src/test/java/org/apache/servicecomb/core/transport/TestAbstractTransport.java index 934381fe455..65c44b12560 100644 --- a/core/src/test/java/org/apache/servicecomb/core/transport/TestAbstractTransport.java +++ b/core/src/test/java/org/apache/servicecomb/core/transport/TestAbstractTransport.java @@ -32,7 +32,7 @@ import org.mockito.Mockito; import org.springframework.core.env.Environment; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; public class TestAbstractTransport { Environment environment = Mockito.mock(Environment.class); @@ -56,7 +56,7 @@ public void setUp() { Mockito.when(environment.getProperty("servicecomb.my.publishPort", int.class, 0)).thenReturn(0); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); } diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java index 5f4f9719ca8..3bc88c64ac5 100644 --- a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -48,12 +48,10 @@ public void websocket(ServerWebSocket serverWebsocket) { e.printStackTrace(); } - serverWebsocket.writeTextMessage("hello", r -> { - }); + serverWebsocket.writeTextMessage("hello"); for (int i = 0; i < 5; i++) { - serverWebsocket.writeTextMessage("hello " + i, r -> { - }); + serverWebsocket.writeTextMessage("hello " + i); try { Thread.sleep(500); } catch (InterruptedException e) { diff --git a/demo/demo-etcd/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-etcd/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java index 5f4f9719ca8..3bc88c64ac5 100644 --- a/demo/demo-etcd/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java +++ b/demo/demo-etcd/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -48,12 +48,10 @@ public void websocket(ServerWebSocket serverWebsocket) { e.printStackTrace(); } - serverWebsocket.writeTextMessage("hello", r -> { - }); + serverWebsocket.writeTextMessage("hello"); for (int i = 0; i < 5; i++) { - serverWebsocket.writeTextMessage("hello " + i, r -> { - }); + serverWebsocket.writeTextMessage("hello " + i); try { Thread.sleep(500); } catch (InterruptedException e) { diff --git a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/CodeFirstPojoClient.java b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/CodeFirstPojoClient.java index 7d3386fa38c..601901e5884 100644 --- a/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/CodeFirstPojoClient.java +++ b/demo/demo-pojo/pojo-client/src/main/java/org/apache/servicecomb/demo/pojo/client/CodeFirstPojoClient.java @@ -94,7 +94,7 @@ private void testCodeFirstCompletableFuture(CodeFirstPojoIntf codeFirst) { return; } - Vertx vertx = VertxUtils.getOrCreateVertxByName("transport", null); + Vertx vertx = VertxUtils.getOrCreateVertxByName("transport", null, null); CountDownLatch latch = new CountDownLatch(1); // vertx.runOnContext in normal thread is not a good practice // here just a test, not care for this. diff --git a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java index 5f4f9719ca8..3bc88c64ac5 100644 --- a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java +++ b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -48,12 +48,10 @@ public void websocket(ServerWebSocket serverWebsocket) { e.printStackTrace(); } - serverWebsocket.writeTextMessage("hello", r -> { - }); + serverWebsocket.writeTextMessage("hello"); for (int i = 0; i < 5; i++) { - serverWebsocket.writeTextMessage("hello " + i, r -> { - }); + serverWebsocket.writeTextMessage("hello " + i); try { Thread.sleep(500); } catch (InterruptedException e) { diff --git a/demo/pom.xml b/demo/pom.xml index a6e6c43b47a..d0376883c6b 100644 --- a/demo/pom.xml +++ b/demo/pom.xml @@ -52,7 +52,8 @@ demo-cse-v1 demo-cse-v2 demo-nacos - demo-etcd + + demo-zookeeper demo-consul diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 9e729c44cc3..6f674e68d2a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 1.7.36 2.4 2.2.35 - 4.5.15 + 5.0.1 3.5.1 3.4.0 0.8.5 @@ -279,27 +279,6 @@ ${reactive-streams.version} - - io.vertx - vertx-codegen - ${vertx.version} - - - io.vertx - vertx-core - ${vertx.version} - - - io.vertx - vertx-web - ${vertx.version} - - - io.vertx - vertx-rx-java3 - ${vertx.version} - - io.zipkin.brave brave-bom @@ -459,19 +438,20 @@ test - - org.mock-server - mockserver-netty - ${mock-server.version} - test - - org.slf4j slf4j-api ${slf4j.version} + + io.vertx + vertx-dependencies + ${vertx.version} + pom + import + + org.springframework.boot spring-boot-dependencies diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventManager.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventManager.java index 184431d8dd7..736a933159b 100644 --- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventManager.java +++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/event/TestEventManager.java @@ -48,7 +48,7 @@ public void normalListener() { test(this); Assertions.assertTrue(collector.getEvents().isEmpty()); // ensure no warning logs - collector.teardown(); + collector.tearDown(); } @Test @@ -72,7 +72,7 @@ void onInt(Integer obj) { Assertions.assertTrue(true); } - collector.teardown(); + collector.tearDown(); } @Test @@ -98,7 +98,7 @@ public void onInt(Integer obj) { // ensure logs: "LOGGER.warn("Failed to create lambda for method: {}, fallback to reflect.", method, throwable);" Assertions.assertFalse(collector.getEvents().isEmpty()); - collector.teardown(); + collector.tearDown(); } @Subscribe diff --git a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestJvmUtils.java b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestJvmUtils.java index 89da7bd52b3..10054efe4e8 100644 --- a/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestJvmUtils.java +++ b/foundations/foundation-common/src/test/java/org/apache/servicecomb/foundation/common/utils/TestJvmUtils.java @@ -56,7 +56,7 @@ public void findMainClass_invalid() { Assertions.assertNull(JvmUtils.findMainClass()); Assertions.assertEquals("\"invalidCls\" is not a valid class.", logCollector.getEvents().get(0).getMessage()); - logCollector.teardown(); + logCollector.tearDown(); } @Test diff --git a/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java b/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java deleted file mode 100644 index ec50fc1b6c1..00000000000 --- a/foundations/foundation-test-scaffolding/src/main/java/io/vertx/core/impl/SyncContext.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.vertx.core.impl; - -import java.io.Serial; -import java.util.concurrent.Callable; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.Executor; -import java.util.concurrent.Executors; - -import io.netty.channel.EventLoop; -import io.vertx.codegen.annotations.Nullable; -import io.vertx.core.AsyncResult; -import io.vertx.core.Context; -import io.vertx.core.Future; -import io.vertx.core.Handler; -import io.vertx.core.Promise; -import io.vertx.core.ThreadingModel; -import io.vertx.core.json.JsonObject; -import io.vertx.core.spi.tracing.VertxTracer; - -/** - * This class is created to make vertx unit test easier - */ -@SuppressWarnings({"rawtypes"}) -public class SyncContext extends ContextBase implements ContextInternal { - @Serial - private static final long serialVersionUID = -6209656149925076980L; - - protected VertxInternal owner; - - protected Executor executor = Executors.newSingleThreadExecutor(); - - public SyncContext() { - this(0); - } - - public SyncContext(int localsLength) { - super(localsLength); - } - - @Override - public VertxInternal owner() { - return owner; - } - - @Override - public Context exceptionHandler(@Nullable Handler handler) { - return null; - } - - @Override - public @Nullable Handler exceptionHandler() { - return null; - } - - @Override - public boolean inThread() { - return false; - } - - @Override - public void emit(T t, Handler handler) { - - } - - @Override - public void execute(Runnable runnable) { - - } - - @Override - public void execute(T t, Handler handler) { - - } - - @Override - public Future close() { - return Future.succeededFuture(); - } - - @Override - public void reportException(Throwable throwable) { - - } - - @Override - public ConcurrentMap contextData() { - return null; - } - - @Override - public ClassLoader classLoader() { - return null; - } - - @Override - public WorkerPool workerPool() { - return null; - } - - @Override - public VertxTracer tracer() { - return null; - } - - @Override - public ContextInternal duplicate() { - return null; - } - - @Override - public CloseFuture closeFuture() { - return null; - } - - public void setOwner(VertxInternal owner) { - this.owner = owner; - } - - - public static void syncExecuteBlocking(Handler> blockingCodeHandler, - Handler> asyncResultHandler) { - Promise res = Promise.promise(); - - try { - blockingCodeHandler.handle(res); - } catch (Throwable e) { - res.fail(e); - return; - } - - res.future().onComplete(asyncResultHandler); - } - - private static Future syncExecuteBlocking(Handler> blockingCodeHandler) { - Promise res = Promise.promise(); - - try { - blockingCodeHandler.handle(res); - } catch (Throwable e) { - res.fail(e); - return res.future(); - } - - return res.future(); - } - - @Override - public Future executeBlockingInternal(Handler> action) { - return syncExecuteBlocking(action); - } - - @Override - public Future executeBlockingInternal(Callable callable) { - return null; - } - - @Override - public Future executeBlockingInternal(Handler> handler, boolean b) { - return null; - } - - @Override - public Future executeBlockingInternal(Callable callable, boolean b) { - return null; - } - - @Override - public Deployment getDeployment() { - return null; - } - - @Override - public Executor executor() { - return executor; - } - - @Override - public EventLoop nettyEventLoop() { - return null; - } - - @Override - @Deprecated - public Future executeBlocking(Handler> handler, TaskQueue taskQueue) { - return null; - } - - @Override - public Future executeBlocking(Callable callable, TaskQueue taskQueue) { - return null; - } - - @Override - @Deprecated - public void executeBlocking(Handler> blockingCodeHandler, boolean ordered, - Handler> asyncResultHandler) { - syncExecuteBlocking(blockingCodeHandler, asyncResultHandler); - } - - @Override - public Future<@Nullable T> executeBlocking(Callable callable, boolean b) { - return null; - } - - @Override - @Deprecated - public Future<@Nullable T> executeBlocking(Handler> handler, boolean b) { - return null; - } - - @Override - public @Nullable JsonObject config() { - return null; - } - - @Override - public boolean isEventLoopContext() { - return false; - } - - @Override - public boolean isWorkerContext() { - return false; - } - - @Override - public ThreadingModel threadingModel() { - return null; - } -} diff --git a/foundations/foundation-test-scaffolding/src/main/java/org/apache/servicecomb/foundation/test/scaffolding/log/LogCollector.java b/foundations/foundation-test-scaffolding/src/main/java/org/apache/servicecomb/foundation/test/scaffolding/log/LogCollector.java index a01032939ec..5b435b89829 100644 --- a/foundations/foundation-test-scaffolding/src/main/java/org/apache/servicecomb/foundation/test/scaffolding/log/LogCollector.java +++ b/foundations/foundation-test-scaffolding/src/main/java/org/apache/servicecomb/foundation/test/scaffolding/log/LogCollector.java @@ -35,17 +35,22 @@ public class LogCollector implements Closeable { List events = new ArrayList<>(); - Appender appender = new AbstractAppender("LogCollector", null, PatternLayout.createDefaultLayout(), true, - Property.EMPTY_ARRAY) { - @Override - public void append(LogEvent event) { - events.add(event); - } - }; + Appender appender; + + String appenderName; public LogCollector() { LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration config = ctx.getConfiguration(); + appenderName = "LogCollector" + System.nanoTime(); + appender = new AbstractAppender(appenderName, null, PatternLayout.createDefaultLayout(), + true, + Property.EMPTY_ARRAY) { + @Override + public void append(LogEvent event) { + events.add(event); + } + }; appender.start(); config.getRootLogger().addAppender(appender, Level.ALL, null); ctx.updateLoggers(config); @@ -84,11 +89,11 @@ public List getThrowableMessages() { .collect(Collectors.toList()); } - public void teardown() { + public void tearDown() { LoggerContext ctx = (LoggerContext) LogManager.getContext(false); Configuration config = ctx.getConfiguration(); appender.stop(); - config.getRootLogger().removeAppender("LogCollector"); + config.getRootLogger().removeAppender(appenderName); ctx.updateLoggers(config); } @@ -98,6 +103,6 @@ public void clear() { @Override public void close() { - teardown(); + tearDown(); } } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/SharedVertxFactory.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/SharedVertxFactory.java index 9803582459c..9f2d3af797b 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/SharedVertxFactory.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/SharedVertxFactory.java @@ -64,7 +64,7 @@ public static Vertx getSharedVertx(Environment environment) { private static Vertx createSharedVertx(Environment environment, String name) { SharedVertxInfo info = new SharedVertxInfo(environment); - Vertx vertx = VertxUtils.init(name, info.vertxOptions); + Vertx vertx = VertxUtils.init(name, info.vertxOptions, info.metricsFactory); info.metricsFactory.setVertx(vertx, info.vertxOptions); vertx.sharedData().getLocalMap(LOCAL_MAP_NAME).put(INFO, info); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java index 43094de2a35..97d295dcfdc 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java @@ -38,14 +38,17 @@ import io.netty.buffer.ByteBuf; import io.vertx.core.AbstractVerticle; import io.vertx.core.DeploymentOptions; +import io.vertx.core.Future; import io.vertx.core.Verticle; import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.buffer.Buffer; -import io.vertx.core.file.impl.FileResolverImpl; -import io.vertx.core.impl.VertxBuilder; +import io.vertx.core.impl.SysProps; import io.vertx.core.impl.VertxThread; +import io.vertx.core.internal.VertxBootstrap; +import io.vertx.core.spi.VertxMetricsFactory; import io.vertx.core.spi.VertxThreadFactory; +import io.vertx.core.transport.Transport; /** * VertxUtils @@ -90,12 +93,13 @@ public static Map blockDeploy(Vertx Map result = new HashMap<>(); CountDownLatch latch = new CountDownLatch(1); - vertx.deployVerticle(cls.getName(), options, ar -> { - result.put("code", ar.succeeded()); + Future future = vertx.deployVerticle(cls.getName(), options); + future.onComplete((succuss, failure) -> { + result.put("code", failure == null); - if (ar.failed()) { - result.put("message", ar.cause().getMessage()); - LOGGER.error("deploy vertx failed, cause ", ar.cause()); + if (failure != null) { + result.put("message", failure.getMessage()); + LOGGER.error("deploy vertx failed, cause ", failure); } latch.countDown(); @@ -106,11 +110,12 @@ public static Map blockDeploy(Vertx return result; } - public static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions) { - return vertxMap.computeIfAbsent(name, vertxName -> init(vertxName, vertxOptions)); + public static Vertx getOrCreateVertxByName(String name, VertxOptions vertxOptions, + VertxMetricsFactory metricsFactory) { + return vertxMap.computeIfAbsent(name, vertxName -> init(name, vertxOptions, metricsFactory)); } - public static Vertx init(String name, VertxOptions vertxOptions) { + public static Vertx init(String name, VertxOptions vertxOptions, VertxMetricsFactory metricsFactory) { if (vertxOptions == null) { vertxOptions = new VertxOptions(); } @@ -123,14 +128,31 @@ public static Vertx init(String name, VertxOptions vertxOptions) { configureVertxFileCaching(vertxOptions); - return new VertxBuilder(vertxOptions).threadFactory(new VertxThreadFactory() { - @Override - public VertxThread newVertxThread(Runnable target, String threadName, boolean worker, long maxExecTime, - TimeUnit maxExecTimeUnit) { - return VertxThreadFactory.super - .newVertxThread(target, name + "-" + threadName, worker, maxExecTime, maxExecTimeUnit); - } - }).init().vertx(); + VertxBootstrap bootstrap = bootstrap(vertxOptions, metricsFactory) + .threadFactory(new VertxThreadFactory() { + @Override + public VertxThread newVertxThread(Runnable target, String threadName, boolean worker, long maxExecTime, + TimeUnit maxExecTimeUnit) { + return VertxThreadFactory.super + .newVertxThread(target, name + "-" + threadName, worker, maxExecTime, maxExecTimeUnit); + } + }); + + return bootstrap.init().vertx(); + } + + private static VertxBootstrap bootstrap(VertxOptions options, VertxMetricsFactory metricsFactory) { + VertxBootstrap bootstrap = VertxBootstrap.create(); + bootstrap.options(options); + bootstrap.metricsFactory(metricsFactory); + Transport tr; + if (options.getPreferNativeTransport()) { + tr = Transport.nativeTransport(); + } else { + tr = Transport.NIO; + } + bootstrap.transport(tr.implementation()); + return bootstrap; } /** @@ -138,7 +160,7 @@ public VertxThread newVertxThread(Runnable target, String threadName, boolean wo */ private static void configureVertxFileCaching(VertxOptions vertxOptions) { boolean disableFileCPResolving = LegacyPropertyFactory - .getBooleanProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, true); + .getBooleanProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, true); vertxOptions.getFileSystemOptions().setClassPathResolvingEnabled(!disableFileCPResolving); } @@ -178,15 +200,17 @@ public static CompletableFuture closeVertxByName(String name) { return future; } - vertx.close(ar -> { - if (ar.succeeded()) { + Future closeFuture = vertx.close(); + closeFuture.onComplete((succ, fail) -> { + if (fail == null) { LOGGER.info("Success to close vertx {}.", name); future.complete(null); return; } - future.completeExceptionally(ar.cause()); + future.completeExceptionally(fail); }); + return future; } @@ -201,8 +225,9 @@ public static void blockCloseVertxByName(String name) { public static void blockCloseVertx(Vertx vertx) { CountDownLatch latch = new CountDownLatch(1); - vertx.close(ar -> { - if (ar.succeeded()) { + Future closeFuture = vertx.close(); + closeFuture.onComplete((succ, fail) -> { + if (fail == null) { LOGGER.info("Success to close vertx {}.", vertx); } else { LOGGER.info("Failed to close vertx {}.", vertx); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java index abac2283316..83bf28db9ca 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientOptionsSPI.java @@ -125,15 +125,12 @@ static HttpClientOptions createHttpClientOptions(HttpClientOptionsSPI spi) { httpClientOptions.setProtocolVersion(spi.getHttpVersion()); httpClientOptions.setDecompressionSupported(spi.isTryUseCompression()); - httpClientOptions.setMaxWaitQueueSize(spi.getMaxWaitQueueSize()); - httpClientOptions.setMaxPoolSize(spi.getMaxPoolSize()); httpClientOptions.setKeepAlive(spi.isKeepAlive()); httpClientOptions.setMaxHeaderSize(spi.getMaxHeaderSize()); if (spi.getHttpVersion() == HttpVersion.HTTP_2) { httpClientOptions.setHttp2ClearTextUpgrade(false); httpClientOptions.setHttp2MultiplexingLimit(spi.getHttp2MultiplexingLimit()); - httpClientOptions.setHttp2MaxPoolSize(spi.getHttp2MaxPoolSize()); httpClientOptions.setHttp2KeepAliveTimeout(spi.getKeepAliveTimeout()); } else { httpClientOptions.setKeepAliveTimeout(spi.getKeepAliveTimeout()); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java index 985cc02a898..69f15e6e397 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactory.java @@ -15,28 +15,33 @@ package org.apache.servicecomb.foundation.vertx.client.http; -import io.vertx.core.Context; -import io.vertx.core.http.HttpClient; -import io.vertx.core.http.HttpClientOptions; import org.apache.servicecomb.foundation.vertx.client.ClientPoolFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.vertx.core.Context; +import io.vertx.core.http.HttpClient; +import io.vertx.core.http.HttpClientOptions; +import io.vertx.core.http.PoolOptions; + // execute in vertx context public class HttpClientPoolFactory implements ClientPoolFactory { private static final Logger LOGGER = LoggerFactory.getLogger(HttpClientPoolFactory.class); private final HttpClientOptions httpClientOptions; - public HttpClientPoolFactory(HttpClientOptions httpClientOptions) { + private final PoolOptions poolOptions; + + public HttpClientPoolFactory(HttpClientOptions httpClientOptions, PoolOptions poolOptions) { this.httpClientOptions = httpClientOptions; + this.poolOptions = poolOptions; } @Override public HttpClientWithContext createClientPool(Context context) { HttpClient httpClient = context.owner().httpClientBuilder() .with(httpClientOptions) - .with(httpClientOptions.getPoolOptions()) + .with(poolOptions) .withConnectHandler(connection -> { LOGGER.debug("http connection connected, local:{}, remote:{}.", connection.localAddress(), connection.remoteAddress()); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java index 9eb29816483..b1ef46436ec 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClients.java @@ -37,6 +37,7 @@ import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.dns.AddressResolverOptions; +import io.vertx.core.http.PoolOptions; import io.vertx.core.http.WebSocketClient; /** @@ -70,8 +71,12 @@ public static void destroy() { private static ClientPoolManager createClientPoolManager(HttpClientOptionsSPI option) { Vertx vertx = getOrCreateVertx(option); + PoolOptions poolOptions = new PoolOptions(); + poolOptions.setMaxWaitQueueSize(option.getMaxWaitQueueSize()); + poolOptions.setHttp1MaxSize(option.getMaxPoolSize()); + poolOptions.setHttp2MaxSize(option.getHttp2MaxPoolSize()); ClientPoolManager clientPoolManager = new ClientPoolManager<>(vertx, - new HttpClientPoolFactory(HttpClientOptionsSPI.createHttpClientOptions(option))); + new HttpClientPoolFactory(HttpClientOptionsSPI.createHttpClientOptions(option), poolOptions)); DeploymentOptions deployOptions = VertxUtils.createClientDeployOptions(clientPoolManager, option.getInstanceCount()) @@ -103,7 +108,7 @@ private static Vertx getOrCreateVertx(HttpClientOptionsSPI option) { .setEventLoopPoolSize(option.getEventLoopPoolSize()); // Maybe we can deploy only one vert.x for the application. However this has did it like this. - return VertxUtils.getOrCreateVertxByName(option.clientName(), vertxOptions); + return VertxUtils.getOrCreateVertxByName(option.clientName(), vertxOptions, null); } /** diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/NetClientWrapper.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/NetClientWrapper.java index a36d80c246c..ce47126ee47 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/NetClientWrapper.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/NetClientWrapper.java @@ -16,8 +16,7 @@ */ package org.apache.servicecomb.foundation.vertx.client.tcp; -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.net.NetClient; import io.vertx.core.net.NetSocket; @@ -50,12 +49,11 @@ public TcpClientConfig getClientConfig(boolean ssl) { return normalClientConfig; } - public void connect(boolean ssl, int port, String host, Handler> connectHandler) { + public Future connect(boolean ssl, int port, String host) { if (ssl) { - sslNetClient.connect(port, host, connectHandler); - return; + return sslNetClient.connect(port, host); } - normalNetClient.connect(port, host, connectHandler); + return normalNetClient.connect(port, host); } } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java index ade98d6c1ba..db071e3c34f 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/tcp/TcpClientConnection.java @@ -39,6 +39,7 @@ import io.vertx.core.AsyncResult; import io.vertx.core.Context; +import io.vertx.core.Future; import io.vertx.core.buffer.Buffer; import io.vertx.core.net.NetSocket; import io.vertx.core.net.impl.NetSocketImpl; @@ -180,17 +181,17 @@ protected void connect() { this.status = Status.CONNECTING; LOGGER.info("connecting to address {}", socketAddress.toString()); - netClientWrapper.connect(endpoint.isSslEnabled(), + Future result = netClientWrapper.connect(endpoint.isSslEnabled(), socketAddress.getPort(), - socketAddress.getHostString(), - ar -> { - if (ar.succeeded()) { - onConnectSuccess(ar.result()); - return; - } - - onConnectFailed(ar.cause()); - }); + socketAddress.getHostString()); + result.onComplete((socket, fail) -> { + if (fail == null) { + onConnectSuccess(socket); + return; + } + + onConnectFailed(fail); + }); } private void onConnectSuccess(NetSocket socket) { diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java index e6a7947eb2b..acd2fc1978a 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java @@ -27,8 +27,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.vertx.core.AsyncResult; import io.vertx.core.Context; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.buffer.Buffer; import io.vertx.core.file.AsyncFile; @@ -82,15 +82,13 @@ public ReadStream getReadStream() { } /** - * - * @param writeStream * @return future of save action
* * important: WriteStream did not provide endHandler, so we can not know when will really finished write. * so the return future only means finished read from readStream. */ public CompletableFuture saveToWriteStream(WriteStream writeStream) { - return new PumpCommon().pump(context, readStream, writeStream, null); + return new PumpCommon().pump(readStream, writeStream, null); } public CompletableFuture saveAsBytes() { @@ -120,8 +118,6 @@ public CompletableFuture saveAs(Function converter) { } /** - * - * @param fileName * @return future of save to file, future complete means write to file finished */ public CompletableFuture saveToFile(String fileName) { @@ -132,9 +128,6 @@ public CompletableFuture saveToFile(String fileName) { } /** - * - * @param file - * @param openOptions * @return future of save to file, future complete means write to file finished */ public CompletableFuture saveToFile(File file, OpenOptions openOptions) { @@ -142,34 +135,37 @@ public CompletableFuture saveToFile(File file, OpenOptions openOptions) { context.runOnContext((v) -> { Vertx vertx = context.owner(); - vertx.fileSystem().open(file.getAbsolutePath(), openOptions, ar -> onFileOpened(file, ar, future)); + Future openFuture = vertx.fileSystem().open(file.getAbsolutePath(), openOptions); + openFuture.onComplete((s, f) -> onFileOpened(file, s, f, future)); }); return future; } - protected void onFileOpened(File file, AsyncResult ar, CompletableFuture future) { - if (ar.failed()) { - future.completeExceptionally(ar.cause()); + protected void onFileOpened(File file, AsyncFile asyncFile, Throwable failure, CompletableFuture future) { + if (failure != null) { + future.completeExceptionally(failure); return; } - AsyncFile asyncFile = ar.result(); CompletableFuture saveFuture = saveToWriteStream(asyncFile); - saveFuture.whenComplete((v, saveException) -> asyncFile.close(closeAr -> { - if (closeAr.failed()) { - LOGGER.error("Failed to close file {}.", file); - } - - // whatever close success or failed - // will not affect to result - // result just only related to write - if (saveException == null) { - future.complete(file); - return; - } - - future.completeExceptionally(saveException); - })); + saveFuture.whenComplete((v, saveException) -> { + Future result = asyncFile.close(); + result.onComplete((s, f) -> { + if (f != null) { + LOGGER.error("Failed to close file {}.", file); + } + + // whatever close success or failed + // will not affect to result + // result just only related to write + if (saveException == null) { + future.complete(file); + return; + } + + future.completeExceptionally(saveException); + }); + }); } } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultClientMetrics.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultClientMetrics.java index c3893a2e60d..2bc9288857b 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultClientMetrics.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultClientMetrics.java @@ -17,16 +17,14 @@ package org.apache.servicecomb.foundation.vertx.metrics; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetric; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientTaskMetric; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultRequestMetric; - import io.vertx.core.spi.metrics.ClientMetrics; import io.vertx.core.spi.observability.HttpRequest; import io.vertx.core.spi.observability.HttpResponse; +import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetric; +import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultRequestMetric; public class DefaultClientMetrics implements - ClientMetrics { + ClientMetrics { private final DefaultClientEndpointMetric clientEndpointMetric; public DefaultClientMetrics(DefaultClientEndpointMetric clientEndpointMetric) { @@ -37,18 +35,6 @@ public DefaultClientEndpointMetric getClientEndpointMetric() { return this.clientEndpointMetric; } - @Override - public DefaultClientTaskMetric enqueueRequest() { - DefaultClientTaskMetric taskMetric = new DefaultClientTaskMetric(clientEndpointMetric); - taskMetric.enqueueRequest(); - return taskMetric; - } - - @Override - public void dequeueRequest(DefaultClientTaskMetric endpointMetric) { - endpointMetric.dequeueRequest(); - } - @Override public DefaultRequestMetric requestBegin(String uri, HttpRequest request) { DefaultRequestMetric requestMetric = new DefaultRequestMetric(this.clientEndpointMetric); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultHttpClientMetrics.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultHttpClientMetrics.java index 59649948348..1279a4f8566 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultHttpClientMetrics.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultHttpClientMetrics.java @@ -18,7 +18,6 @@ import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetric; import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetricManager; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientTaskMetric; import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultRequestMetric; import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultTcpSocketMetric; @@ -26,7 +25,7 @@ import io.vertx.core.spi.metrics.HttpClientMetrics; public class DefaultHttpClientMetrics implements - HttpClientMetrics { + HttpClientMetrics { private static final String PROTOCOL = "http://"; private final DefaultClientEndpointMetricManager clientEndpointMetricManager; diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetrics.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetrics.java index ee345ed4e2b..c0b89a42eea 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetrics.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetrics.java @@ -18,23 +18,22 @@ import java.util.Map; -import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetricManager; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultServerEndpointMetric; - import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.http.HttpClientOptions; import io.vertx.core.http.HttpServerOptions; -import io.vertx.core.metrics.impl.DummyVertxMetrics; import io.vertx.core.net.NetClientOptions; import io.vertx.core.net.NetServerOptions; import io.vertx.core.net.SocketAddress; import io.vertx.core.spi.metrics.HttpClientMetrics; import io.vertx.core.spi.metrics.HttpServerMetrics; import io.vertx.core.spi.metrics.TCPMetrics; +import io.vertx.core.spi.metrics.VertxMetrics; +import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx; +import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultClientEndpointMetricManager; +import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultServerEndpointMetric; -public class DefaultVertxMetrics extends DummyVertxMetrics { +public class DefaultVertxMetrics implements VertxMetrics { // to support listen multiple addresses, must use a map to manage the metric private final Map serverEndpointMetricMap = new ConcurrentHashMapEx<>(); @@ -61,7 +60,7 @@ public Map getServerEndpointMetricMap() { } @Override - public HttpClientMetrics createHttpClientMetrics(HttpClientOptions options) { + public HttpClientMetrics createHttpClientMetrics(HttpClientOptions options) { return new DefaultHttpClientMetrics(clientEndpointMetricManager); } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetricsFactory.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetricsFactory.java index dca7cecca92..540a644b1e1 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetricsFactory.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/metrics/DefaultVertxMetricsFactory.java @@ -55,7 +55,6 @@ public synchronized VertxMetrics metrics(VertxOptions options) { @Override public MetricsOptions newOptions() { MetricsOptionsEx metricsOptions = new MetricsOptionsEx(); - metricsOptions.setFactory(this); metricsOptions.setEnabled(true); return metricsOptions; } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpParser.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpParser.java index a59004d62a1..4e79f69fca3 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpParser.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpParser.java @@ -19,16 +19,10 @@ import java.nio.charset.StandardCharsets; -import io.netty.buffer.ByteBuf; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.core.parsetools.RecordParser; -/** - * TcpParser - * - * - */ public class TcpParser implements Handler { public static final byte[] TCP_MAGIC; @@ -86,16 +80,17 @@ public boolean firstNEqual(byte[] a, byte[] b, int n) { protected void onParse(Buffer buffer) { switch (status) { case TCP_HEADER: - ByteBuf buf = buffer.getByteBuf(); - if (!firstNEqual(TCP_MAGIC, buf.array(), TCP_MAGIC.length)) { + if (!firstNEqual(TCP_MAGIC, buffer.getBytes(), TCP_MAGIC.length)) { reset(); return; } - buf.skipBytes(TCP_MAGIC.length); - msgId = buf.readLong(); - totalLen = buf.readInt(); - headerLen = buf.readInt(); + int index = TCP_MAGIC.length; + msgId = buffer.getLong(index); + index = index + 8; + totalLen = buffer.getInt(index); + index = index + 4; + headerLen = buffer.getInt(index); if (headerLen > totalLen || headerLen <= 0) { throw new IllegalStateException("possibly attack."); } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java index 3c0f604f9ae..8a960175ad8 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/server/TcpServer.java @@ -31,6 +31,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import io.vertx.core.Future; import io.vertx.core.Vertx; import io.vertx.core.net.NetServer; import io.vertx.core.net.NetServerOptions; @@ -81,15 +82,16 @@ public void init(Vertx vertx, String sslKey, AsyncResultCallback LOGGER.error("Unexpected error in server.", e)); InetSocketAddress socketAddress = endpointObject.getSocketAddress(); - netServer.listen(socketAddress.getPort(), socketAddress.getHostString(), ar -> { - if (ar.succeeded()) { + Future result = netServer.listen(socketAddress.getPort(), socketAddress.getHostString()); + result.onComplete((s, f) -> { + if (f == null) { callback.success(socketAddress); return; } // 监听失败 String msg = String.format("listen failed, address=%s", socketAddress); - callback.fail(new Exception(msg, ar.cause())); + callback.fail(new Exception(msg, f)); }); } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java index 3f3db7678d9..580d460e5c0 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/InputStreamToReadStream.java @@ -19,12 +19,11 @@ import java.io.IOException; import java.io.InputStream; +import java.util.Arrays; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import io.netty.buffer.Unpooled; -import io.vertx.core.AsyncResult; import io.vertx.core.Context; import io.vertx.core.Handler; import io.vertx.core.Promise; @@ -106,17 +105,20 @@ void doRead() throws IOException { } Buffer toBuffer() { - return Buffer.buffer(Unpooled.wrappedBuffer(bytes).writerIndex(read)); + return Buffer.buffer(Arrays.copyOf(bytes, read)); } } private synchronized void doRead() { if (!readInProgress) { readInProgress = true; - - context.executeBlocking(this::readInWorker, - true, - this::afterReadInEventloop); + Promise future = Promise.promise(); + context.executeBlocking(() -> { + readInWorker(future); + return null; + }, + true); + future.future().onComplete(this::afterReadInEventloop); } } @@ -135,14 +137,13 @@ public void handleException(Throwable e) { exceptionHandler.handle(e); } - private synchronized void afterReadInEventloop(AsyncResult ar) { - if (ar.failed()) { - handleException(ar.cause()); + private synchronized void afterReadInEventloop(ReadResult readResult, Throwable failure) { + if (failure != null) { + handleException(failure); return; } readInProgress = false; - ReadResult readResult = ar.result(); if (readResult.read < 0) { handleEnd(); return; diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java index 37cf815ecca..35681a723a8 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/OutputStreamToWriteStream.java @@ -25,7 +25,6 @@ import org.apache.servicecomb.foundation.common.io.AsyncCloseable; -import io.vertx.core.AsyncResult; import io.vertx.core.Context; import io.vertx.core.Future; import io.vertx.core.Handler; @@ -93,22 +92,20 @@ private void handleException(Throwable t) { @Override public synchronized Future write(Buffer data) { Promise result = Promise.promise(); - write(data, ar -> { - if (ar.failed()) { - handleException(ar.cause()); - } - result.complete(); - }); + write(data, result); return result.future(); } - @Override - public void write(Buffer data, Handler> handler) { + private void write(Buffer data, Promise future) { currentBufferCount.incrementAndGet(); buffers.add(data); - context.executeBlocking(this::writeInWorker, - true, - handler); + context.executeBlocking( + () -> { + writeInWorker(future); + return null; + }, + true + ); } protected void writeInWorker(Promise future) { @@ -124,7 +121,8 @@ protected void writeInWorker(Promise future) { synchronized (OutputStreamToWriteStream.this) { currentBufferCount.decrementAndGet(); - Runnable action = (currentBufferCount.get() == 0 && closedDeferred != null) ? closedDeferred : this::checkDrained; + Runnable action = (currentBufferCount.get() == 0 && closedDeferred != null) + ? closedDeferred : this::checkDrained; action.run(); } } catch (IOException e) { @@ -136,8 +134,8 @@ protected void writeInWorker(Promise future) { } @Override - public void end(Handler> handler) { - close(); + public Future end() { + return Future.fromCompletionStage(close()); } @Override diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpCommon.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpCommon.java index 5b70f72766e..ae4b5bac727 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpCommon.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpCommon.java @@ -20,27 +20,23 @@ import org.apache.servicecomb.foundation.common.io.AsyncCloseable; -import io.vertx.core.Context; +import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpClientResponse; -import io.vertx.core.streams.Pump; import io.vertx.core.streams.ReadStream; import io.vertx.core.streams.WriteStream; +import io.vertx.core.streams.impl.PipeImpl; public class PumpCommon { /** - * - * @param context - * @param readStream - * @param writeStream * @return future of save action
*

important: *

if writeStream is AsyncCloseable, future means write complete *

if writeStream is not AsyncCloseable, future only means read complete */ @SuppressWarnings("unchecked") - public CompletableFuture pump(Context context, ReadStream readStream, WriteStream writeStream, + public CompletableFuture pump(ReadStream readStream, WriteStream writeStream, Handler throwableHandler) { CompletableFuture readFuture = new CompletableFuture<>(); @@ -62,17 +58,18 @@ public CompletableFuture pump(Context context, ReadStream readStre readFuture.completeExceptionally(e); }); readStream.exceptionHandler(readFuture::completeExceptionally); - // just means read finished, not means write finished - readStream.endHandler(readFuture::complete); - // if readStream(HttpClientResponse) and writeStream(HttpServerResponse) - // belongs to difference eventloop - // maybe will cause deadlock - // if happened, vertx will print deadlock stacks - Pump.pump(readStream, writeStream).start(); - context.runOnContext(v -> readStream.resume()); + Future pipeResult = new PipeImpl<>(readStream).endOnComplete(false).to(writeStream); - if (!AsyncCloseable.class.isInstance(writeStream)) { + pipeResult.onComplete((s) -> readFuture.complete(null), + (f) -> { + if (throwableHandler != null) { + throwableHandler.handle(f); + } + readFuture.completeExceptionally(f); + }); + + if (!(writeStream instanceof AsyncCloseable)) { return readFuture; } diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpFromPart.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpFromPart.java index ba7b3182087..2c5284e12dc 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpFromPart.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/stream/PumpFromPart.java @@ -69,7 +69,7 @@ private CompletableFuture> prepareReadStream() { public CompletableFuture toWriteStream(WriteStream writeStream, Handler throwableHandler) { return prepareReadStream() - .thenCompose(readStream -> new PumpCommon().pump(context, readStream, writeStream, throwableHandler)) + .thenCompose(readStream -> new PumpCommon().pump(readStream, writeStream, throwableHandler)) .whenComplete((v, e) -> { if (e != null) { LOGGER.error("to write stream failed.", e); diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java index 15e6977d2eb..fcc22bfd7c9 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/tcp/TcpConnection.java @@ -77,7 +77,7 @@ public NetSocket getNetSocket() { public void initNetSocket(NetSocketImpl netSocket) { this.netSocket = netSocket; - this.context = netSocket.getContext(); + this.context = netSocket.context(); } public void write(Buffer buf) { diff --git a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java b/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java deleted file mode 100644 index 7297a866b2f..00000000000 --- a/foundations/foundation-vertx/src/test/java/io/vertx/ext/web/impl/TestHttpServerRequestUtils.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package io.vertx.ext.web.impl; - -import org.apache.servicecomb.foundation.vertx.http.VertxServerRequestToHttpServletRequest; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -import io.vertx.core.http.impl.HttpServerRequestInternal; -import io.vertx.core.net.HostAndPort; -import io.vertx.ext.web.AllowForwardHeaders; -import io.vertx.ext.web.RequestBody; -import io.vertx.ext.web.RoutingContext; - -// HttpServerRequestWrapper is a package visible class, so put this test in package io.vertx.ext.web.impl -public class TestHttpServerRequestUtils { - @Test - public void testVertxServerRequestToHttpServletRequest() { - RoutingContext context = Mockito.mock(RoutingContext.class); - HttpServerRequestInternal request = Mockito.mock(HttpServerRequestInternal.class); - HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request, AllowForwardHeaders.NONE, null); - Mockito.when(request.scheme()).thenReturn("http"); - Mockito.when(context.request()).thenReturn(wrapper); - Mockito.when(request.authority()).thenReturn(HostAndPort.create("localhost", 8080)); - RequestBody requestBody = Mockito.mock(RequestBody.class); - Mockito.when(context.body()).thenReturn(requestBody); - - VertxServerRequestToHttpServletRequest reqEx = new VertxServerRequestToHttpServletRequest(context, "abc"); - Assertions.assertEquals("abc", reqEx.getRequestURI()); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestSharedVertxFactory.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestSharedVertxFactory.java index 10cc0827a0f..8e77a256251 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestSharedVertxFactory.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestSharedVertxFactory.java @@ -23,7 +23,7 @@ import org.mockito.Mockito; import org.springframework.core.env.Environment; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; public class TestSharedVertxFactory { Environment environment = Mockito.mock(Environment.class); @@ -32,7 +32,7 @@ public class TestSharedVertxFactory { public void setUp() { Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); } diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestVertxUtils.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestVertxUtils.java index f3762fe5f37..9f966cbcbde 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestVertxUtils.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestVertxUtils.java @@ -38,14 +38,14 @@ import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; import io.vertx.core.buffer.Buffer; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; public class TestVertxUtils { Environment environment = Mockito.mock(Environment.class); @BeforeEach public void setUp() { - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); @@ -53,7 +53,7 @@ public void setUp() { @Test public void testGetOrCreateVertx() throws InterruptedException { - Vertx vertx = VertxUtils.getOrCreateVertxByName("ut", null); + Vertx vertx = VertxUtils.getOrCreateVertxByName("ut", null, null); Holder name = new Holder<>(); CountDownLatch latch = new CountDownLatch(1); @@ -70,25 +70,25 @@ public void testGetOrCreateVertx() throws InterruptedException { @Test public void testCreateVertxWithFileCPResolving() { // create .vertx folder - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(false); deleteCacheFile(); - VertxUtils.getOrCreateVertxByName("testCreateVertxWithFileCPResolvingFalse", null); + VertxUtils.getOrCreateVertxByName("testCreateVertxWithFileCPResolvingFalse", null, null); Assertions.assertTrue(isCacheFileExists()); VertxUtils.blockCloseVertxByName("testCreateVertxWithFileCPResolvingFalse"); // don't create .vertx folder deleteCacheFile(); Assertions.assertFalse(isCacheFileExists()); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); - VertxUtils.getOrCreateVertxByName("testCreateVertxWithFileCPResolvingTrue", null); + VertxUtils.getOrCreateVertxByName("testCreateVertxWithFileCPResolvingTrue", null, null); Assertions.assertFalse(isCacheFileExists()); VertxUtils.blockCloseVertxByName("testCreateVertxWithFileCPResolvingTrue"); } private void deleteCacheFile() { - String cacheDirBase = System.getProperty(FileResolverImpl.CACHE_DIR_BASE_PROP_NAME, + String cacheDirBase = System.getProperty(SysProps.FILE_CACHE_DIR.name, System.getProperty("java.io.tmpdir", ".")); File folder = new File(cacheDirBase); File[] files = folder.listFiles(); @@ -100,7 +100,7 @@ private void deleteCacheFile() { } private boolean isCacheFileExists() { - String cacheDirBase = System.getProperty(FileResolverImpl.CACHE_DIR_BASE_PROP_NAME, + String cacheDirBase = System.getProperty(SysProps.FILE_CACHE_DIR.name, System.getProperty("java.io.tmpdir", ".")); File folder = new File(cacheDirBase); File[] files = folder.listFiles(); @@ -114,7 +114,7 @@ private boolean isCacheFileExists() { @Test public void testVertxUtilsInitNullOptions() { - Vertx vertx = VertxUtils.init(null, null); + Vertx vertx = VertxUtils.init(null, null, null); Assertions.assertNotEquals(null, vertx); VertxUtils.blockCloseVertx(vertx); } @@ -123,7 +123,7 @@ public void testVertxUtilsInitNullOptions() { public void testVertxUtilsInitWithOptions() { VertxOptions oOptions = new VertxOptions(); - Vertx vertx = VertxUtils.init(null, oOptions); + Vertx vertx = VertxUtils.init(null, oOptions, null); Assertions.assertNotEquals(null, vertx); VertxUtils.blockCloseVertx(vertx); } diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java deleted file mode 100644 index d4c52133547..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/http/HttpClientPoolFactoryTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.apache.org/licenses/LICENSE-2.0 - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.foundation.vertx.client.http; - -import io.vertx.core.Context; -import io.vertx.core.Vertx; -import io.vertx.core.http.HttpClient; -import io.vertx.core.http.HttpClientOptions; -import io.vertx.core.http.PoolOptions; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.springframework.test.util.ReflectionTestUtils; - -public class HttpClientPoolFactoryTest { - private Context context; - private Vertx vertx; - private HttpClientPoolFactory factory; - - @BeforeEach - void setUp() { - // Mock the context and set up the Vertx instance - context = Mockito.mock(Context.class); - vertx = Vertx.vertx(); - Mockito.when(context.owner()).thenReturn(vertx); - - // Create HttpClientOptions with a specific max pool size - HttpClientOptions options = new HttpClientOptions(); - options.setMaxPoolSize(123); - - // Initialize the HttpClientPoolFactory with the given options - factory = new HttpClientPoolFactory(options); - } - - @AfterEach - void tearDown() { - // Close the Vertx instance to release resources - vertx.close(); - } - - @Test - void testCreateClientPool() { - // Create the client pool and get the HttpClient - HttpClient httpClient = factory.createClientPool(context).getHttpClient(); - - // Use ReflectionTestUtils to get the poolOptions field from the HttpClient - if (ReflectionTestUtils.getField(httpClient, "poolOptions") instanceof PoolOptions poolOptions) { - // Assert that the http1MaxSize is set to the expected value - Assertions.assertEquals(123, poolOptions.getHttp1MaxSize()); - } else { - // Fail the test if the poolOptions field is not found or not of the expected type - Assertions.fail("poolOptions field not found or not of the expected type"); - } - } - - @Test - void testCreateClientPoolWithDefaultOptions() { - // Create HttpClientOptions with default values - HttpClientOptions defaultOptions = new HttpClientOptions(); - - // Initialize the HttpClientPoolFactory with the default options - HttpClientPoolFactory defaultFactory = new HttpClientPoolFactory(defaultOptions); - - // Create the client pool and get the HttpClient - HttpClient defaultHttpClient = defaultFactory.createClientPool(context).getHttpClient(); - - // Use ReflectionTestUtils to get the poolOptions field from the HttpClient - if (ReflectionTestUtils.getField(defaultHttpClient, "poolOptions") instanceof PoolOptions defaultPoolOptions) { - // Assert that the http1MaxSize is set to the default value - Assertions.assertEquals(HttpClientOptions.DEFAULT_MAX_POOL_SIZE, defaultPoolOptions.getHttp1MaxSize()); - } else { - // Fail the test if the poolOptions field is not found or not of the expected type - Assertions.fail("poolOptions field not found or not of the expected type"); - } - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestNetClientWrapper.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestNetClientWrapper.java deleted file mode 100644 index adbcd3e8138..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestNetClientWrapper.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.foundation.vertx.client.tcp; - - -import java.util.ArrayList; -import java.util.List; - -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Test; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Handler; -import io.vertx.core.Promise; -import io.vertx.core.Vertx; -import io.vertx.core.net.NetClient; -import io.vertx.core.net.NetSocket; -import mockit.Expectations; -import mockit.Mock; -import mockit.MockUp; -import mockit.Mocked; -import org.junit.jupiter.api.Assertions; - -public class TestNetClientWrapper { - @Mocked - Vertx vertx; - - @Mocked - TcpClientConfig normalClientConfig; - - @Mocked - NetClient normalNetClient; - - @Mocked - TcpClientConfig sslClientConfig; - - @Mocked - NetClient sslNetClient; - - NetClientWrapper netClientWrapper; - - @Before - public void setup() { - new Expectations() { - { - vertx.createNetClient(normalClientConfig); - result = normalNetClient; - vertx.createNetClient(sslClientConfig); - result = sslNetClient; - } - }; - netClientWrapper = new NetClientWrapper(vertx, normalClientConfig, sslClientConfig); - } - - @Test - public void getClientConfig() { - Assertions.assertSame(normalClientConfig, netClientWrapper.getClientConfig(false)); - Assertions.assertSame(sslClientConfig, netClientWrapper.getClientConfig(true)); - } - - @Test - public void connect(@Mocked NetSocket normalSocket, @Mocked NetSocket sslSocket) { - int port = 8000; - String host = "localhost"; - - Promise promiseConnect = Promise.promise(); - new MockUp(normalNetClient) { - @Mock - NetClient connect(int port, String host, Handler> connectHandler) { - promiseConnect.complete(normalSocket); - connectHandler.handle(promiseConnect.future()); - return null; - } - }; - - Promise sslPromiseConnect = Promise.promise(); - new MockUp(sslNetClient) { - @Mock - NetClient connect(int port, String host, Handler> connectHandler) { - sslPromiseConnect.complete(sslSocket); - connectHandler.handle(sslPromiseConnect.future()); - return null; - } - }; - - List socks = new ArrayList<>(); - netClientWrapper.connect(false, port, host, asyncSocket -> socks.add(asyncSocket.result())); - netClientWrapper.connect(true, port, host, asyncSocket -> socks.add(asyncSocket.result())); - - MatcherAssert.assertThat(socks, Matchers.contains(normalSocket, sslSocket)); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnection.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnection.java index de87122f1ba..f072d962000 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnection.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnection.java @@ -28,8 +28,8 @@ import org.junit.jupiter.api.Assertions; import io.netty.buffer.ByteBuf; -import io.vertx.core.AsyncResult; import io.vertx.core.Context; +import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; import io.vertx.core.buffer.Buffer; @@ -195,9 +195,9 @@ public void connect_success(@Mocked NetSocketImpl netSocket) { Promise promise = Promise.promise(); new MockUp(netClientWrapper) { @Mock - void connect(boolean ssl, int port, String host, Handler> connectHandler) { + public Future connect(boolean ssl, int port, String host) { promise.complete(netSocket); - connectHandler.handle(promise.future()); + return promise.future(); } }; @@ -216,9 +216,9 @@ public void connect_failed() { RuntimeException error = new RuntimeExceptionWithoutStackTrace(); new MockUp(netClientWrapper) { @Mock - void connect(boolean ssl, int port, String host, Handler> connectHandler) { + public Future connect(boolean ssl, int port, String host) { promise.fail(error); - connectHandler.handle(promise.future()); + return promise.future(); } }; diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnectionPool.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnectionPool.java deleted file mode 100644 index dfaf8ec60a2..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/client/tcp/TestTcpClientConnectionPool.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.foundation.vertx.client.tcp; - -import io.vertx.core.impl.ContextInternal; -import io.vertx.core.impl.VertxInternal; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; - -public class TestTcpClientConnectionPool { - - TcpClientConnectionPool pool; - - @BeforeEach - public void setup() { - ContextInternal context = Mockito.mock(ContextInternal.class); - VertxInternal vertx = Mockito.mock(VertxInternal.class); - Mockito.when(context.owner()).thenReturn(vertx); - NetClientWrapper netClientWrapper = Mockito.mock(NetClientWrapper.class); - pool = new TcpClientConnectionPool(context, netClientWrapper); - } - - @Test - public void create() { - Assertions.assertTrue(pool.create("rest://localhost:8765") instanceof TcpClientConnection); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestReadStreamPart.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestReadStreamPart.java deleted file mode 100644 index 03d425e353c..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestReadStreamPart.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.foundation.vertx.http; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.UUID; -import java.util.concurrent.ExecutionException; - -import jakarta.ws.rs.core.HttpHeaders; - -import org.apache.commons.io.FileUtils; -import org.apache.servicecomb.foundation.test.scaffolding.exception.RuntimeExceptionWithoutStackTrace; -import org.apache.servicecomb.foundation.vertx.stream.InputStreamToReadStream; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.Test; -import org.junit.jupiter.api.Assertions; - -import io.vertx.core.Handler; -import io.vertx.core.Vertx; -import io.vertx.core.buffer.Buffer; -import io.vertx.core.file.FileSystemException; -import io.vertx.core.file.OpenOptions; -import io.vertx.core.http.HttpClientResponse; -import io.vertx.core.impl.SyncContext; -import io.vertx.core.impl.VertxInternal; -import io.vertx.core.streams.WriteStream; -import mockit.Expectations; -import mockit.Mock; -import mockit.MockUp; -import mockit.Mocked; - -public class TestReadStreamPart { - static Vertx vertx = Vertx.vertx(); - - static SyncContext context = new SyncContext(); - - static String src = "src"; - - static InputStream inputStream = new ByteArrayInputStream(src.getBytes()); - - InputStreamToReadStream readStream = new InputStreamToReadStream(context, inputStream, true); - - ReadStreamPart part = new ReadStreamPart(context, readStream); - - @Before - public void setup() throws IOException { - context.setOwner((VertxInternal) vertx); - inputStream.reset(); - } - - @AfterClass - public static void teardown() { - vertx.close(); - } - - @Test - public void constructFromHttpClientResponse_noContentType(@Mocked HttpClientResponse httpClientResponse) { - new Expectations() { - { - httpClientResponse.getHeader(HttpHeaders.CONTENT_DISPOSITION); - result = "xx;filename=name.txt"; - httpClientResponse.getHeader(HttpHeaders.CONTENT_TYPE); - result = null; - } - }; - - part = new ReadStreamPart(context, httpClientResponse); - - Assertions.assertEquals("name.txt", part.getSubmittedFileName()); - Assertions.assertEquals("text/plain", part.getContentType()); - } - - @Test - public void constructFromHttpClientResponse_hasContentType(@Mocked HttpClientResponse httpClientResponse) { - new Expectations() { - { - httpClientResponse.getHeader(HttpHeaders.CONTENT_DISPOSITION); - result = "xx;filename=name.txt"; - httpClientResponse.getHeader(HttpHeaders.CONTENT_TYPE); - result = "type"; - } - }; - - part = new ReadStreamPart(context, httpClientResponse); - - Assertions.assertEquals("name.txt", part.getSubmittedFileName()); - Assertions.assertEquals("type", part.getContentType()); - } - - @Test - public void saveToWriteStream() throws InterruptedException, ExecutionException { - Buffer buf = Buffer.buffer(); - WriteStream writeStream = new MockUp>() { - @Mock - WriteStream write(Buffer data) { - buf.appendBuffer(data); - return null; - } - }.getMockInstance(); - - part.saveToWriteStream(writeStream).get(); - - Assertions.assertEquals(src, buf.toString()); - } - - @Test - public void saveToWriteStream_writeException() throws InterruptedException, ExecutionException { - RuntimeException error = new RuntimeExceptionWithoutStackTrace(); - WriteStream writeStream = new MockUp>() { - Handler exceptionHandler; - - @Mock - WriteStream exceptionHandler(Handler handler) { - this.exceptionHandler = handler; - return null; - } - - @Mock - WriteStream write(Buffer data) { - exceptionHandler.handle(error); - return null; - } - }.getMockInstance(); - - ExecutionException exception = Assertions.assertThrows(ExecutionException.class, () -> part.saveToWriteStream(writeStream).get()); - Assertions.assertTrue(exception.getCause() instanceof RuntimeException); - } - - @Test - public void saveToWrite_readException(@Mocked WriteStream writeStream) { - RuntimeException error = new RuntimeExceptionWithoutStackTrace(); - new MockUp(inputStream) { - @Mock - int read(byte[] b) throws IOException { - throw error; - } - }; - - ExecutionException exception = Assertions.assertThrows(ExecutionException.class, () -> part.saveToWriteStream(writeStream).get()); - Assertions.assertTrue(exception.getCause() instanceof RuntimeException); - } - - @Test - public void saveAsBytes() throws InterruptedException, ExecutionException { - Assertions.assertArrayEquals(src.getBytes(), part.saveAsBytes().get()); - } - - @Test - public void saveAsString() throws InterruptedException, ExecutionException { - Assertions.assertEquals(src, part.saveAsString().get()); - } - - @Test - public void saveToFile() throws InterruptedException, ExecutionException, IOException { - File dir = new File("target/notExist-" + UUID.randomUUID()); - File file = new File(dir, "a.txt"); - - Assertions.assertFalse(dir.exists()); - - part.saveToFile(file.getAbsolutePath()).get(); - - Assertions.assertEquals(src, FileUtils.readFileToString(file, StandardCharsets.UTF_8)); - - FileUtils.forceDelete(dir); - Assertions.assertFalse(dir.exists()); - } - - @Test - public void saveToFile_notExist_notCreate() throws InterruptedException, ExecutionException, IOException { - File dir = new File("target/notExist-" + UUID.randomUUID()); - File file = new File(dir, "a.txt"); - - Assertions.assertFalse(dir.exists()); - - ExecutionException exception = Assertions.assertThrows(ExecutionException.class, () -> { - OpenOptions openOptions = new OpenOptions().setCreateNew(false); - part.saveToFile(file, openOptions).get(); - }); - Assertions.assertTrue(exception.getCause() instanceof FileSystemException); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerResponseToHttpServletResponse.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerResponseToHttpServletResponse.java deleted file mode 100644 index 1ab6d81bc1c..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/http/TestVertxServerResponseToHttpServletResponse.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.foundation.vertx.http; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.nio.charset.StandardCharsets; -import java.util.UUID; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.ExecutionException; - -import org.apache.commons.io.FileUtils; -import org.apache.servicecomb.foundation.common.http.HttpStatus; -import org.apache.servicecomb.foundation.common.part.FilePart; -import org.apache.servicecomb.foundation.vertx.stream.PumpFromPart; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Test; -import org.junit.jupiter.api.Assertions; - -import io.vertx.core.AsyncResult; -import io.vertx.core.Context; -import io.vertx.core.Handler; -import io.vertx.core.MultiMap; -import io.vertx.core.Promise; -import io.vertx.core.Vertx; -import io.vertx.core.buffer.Buffer; -import io.vertx.core.http.HttpServerResponse; -import io.vertx.core.impl.SyncContext; -import io.vertx.core.streams.WriteStream; -import jakarta.servlet.http.Part; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.Response.StatusType; -import mockit.Deencapsulation; -import mockit.Expectations; -import mockit.Mock; -import mockit.MockUp; -import mockit.Mocked; - -public class TestVertxServerResponseToHttpServletResponse { - MultiMap headers = MultiMap.caseInsensitiveMultiMap(); - - HttpStatus httpStatus = new HttpStatus(123, "default"); - - HttpServerResponse serverResponse; - - VertxServerResponseToHttpServletResponse response; - - boolean flushWithBody; - - boolean runOnContextInvoked; - - @Mocked - Vertx vertx; - - @Mocked - Context context; - - boolean chunked; - - @Before - public void setup() { - serverResponse = new MockUp() { - @Mock - HttpServerResponse setStatusCode(int statusCode) { - Deencapsulation.setField(httpStatus, "statusCode", statusCode); - return serverResponse; - } - - @Mock - HttpServerResponse setStatusMessage(String statusMessage) { - Deencapsulation.setField(httpStatus, "reason", statusMessage); - return serverResponse; - } - - @Mock - int getStatusCode() { - return httpStatus.getStatusCode(); - } - - @Mock - String getStatusMessage() { - return httpStatus.getReasonPhrase(); - } - - @Mock - MultiMap headers() { - return headers; - } - - @Mock - HttpServerResponse putHeader(String name, String value) { - headers.set(name, value); - return serverResponse; - } - - @Mock - void end() { - flushWithBody = false; - } - - @Mock - void end(Buffer chunk) { - flushWithBody = true; - } - - @Mock - HttpServerResponse setChunked(boolean chunked) { - TestVertxServerResponseToHttpServletResponse.this.chunked = chunked; - return serverResponse; - } - - @Mock - boolean isChunked() { - return chunked; - } - }.getMockInstance(); - - new Expectations() { - { - Vertx.currentContext(); - result = context; - } - }; - - new MockUp(context) { - @Mock - void runOnContext(Handler action) { - runOnContextInvoked = true; - action.handle(null); - } - - @Mock - void executeBlocking(Handler> blockingCodeHandler, boolean ordered, - Handler> resultHandler) { - SyncContext.syncExecuteBlocking(blockingCodeHandler, resultHandler); - } - - @Mock - Vertx owner() { - return vertx; - } - }; - - response = new VertxServerResponseToHttpServletResponse(serverResponse); - } - - @Test - public void construct_invalid() throws IOException { - new Expectations() { - { - Vertx.currentContext(); - result = null; - } - }; - - NullPointerException exception = Assertions.assertThrows(NullPointerException.class, - () -> new VertxServerResponseToHttpServletResponse(serverResponse)); - Assertions.assertEquals("must run in vertx context.", exception.getMessage()); - } - - @Test - public void setContentType() { - response.setContentType("json"); - Assertions.assertEquals("json", headers.get(HttpHeaders.CONTENT_TYPE)); - } - - @Test - public void getStatusType() { - StatusType status = response.getStatusType(); - - Assertions.assertSame(status, response.getStatusType()); - Assertions.assertEquals(123, httpStatus.getStatusCode()); - Assertions.assertEquals("default", httpStatus.getReasonPhrase()); - } - - @Test - public void addHeader() { - response.addHeader("n1", "v1_1"); - response.addHeader("n1", "v1_2"); - response.addHeader("n2", "v2"); - - Assertions.assertEquals(2, headers.size()); - MatcherAssert.assertThat(headers.getAll("n1"), Matchers.contains("v1_1", "v1_2")); - MatcherAssert.assertThat(headers.getAll("n2"), Matchers.contains("v2")); - } - - @Test - public void setHeader() { - response.setHeader("n1", "v1_1"); - response.setHeader("n1", "v1_2"); - response.setHeader("n2", "v2"); - - Assertions.assertEquals(2, headers.size()); - MatcherAssert.assertThat(headers.getAll("n1"), Matchers.contains("v1_2")); - MatcherAssert.assertThat(headers.getAll("n2"), Matchers.contains("v2")); - } - - @Test - public void getStatus() { - Assertions.assertEquals(123, response.getStatus()); - } - - @Test - public void getContentType() { - headers.set(HttpHeaders.CONTENT_TYPE, "json"); - Assertions.assertEquals("json", response.getContentType()); - } - - @Test - public void getHeader() { - headers.set(HttpHeaders.CONTENT_TYPE, "json"); - Assertions.assertEquals("json", response.getHeader(HttpHeaders.CONTENT_TYPE)); - } - - @Test - public void getHeaders() { - headers.add("h1", "h1_1"); - headers.add("h1", "h1_2"); - - MatcherAssert.assertThat(response.getHeaders("h1"), Matchers.contains("h1_1", "h1_2")); - } - - @Test - public void getHeaderNames() { - headers.add("h1", "h1"); - headers.add("h2", "h2"); - - MatcherAssert.assertThat(response.getHeaderNames(), Matchers.contains("h1", "h2")); - } - - @Test - public void flushBuffer_sameContext() throws IOException { - response.endResponse(); - - Assertions.assertFalse(runOnContextInvoked); - } - - @Test - public void flushBuffer_diffContext() throws IOException { - new Expectations() { - { - Vertx.currentContext(); - result = null; - } - }; - response.endResponse(); - - Assertions.assertTrue(runOnContextInvoked); - } - - @Test - public void internalFlushBufferNoBody() throws IOException { - response.internalFlushBuffer(); - - Assertions.assertFalse(flushWithBody); - } - - @Test - public void internalFlushBufferWithBody() throws IOException { - response.setBodyBuffer(Buffer.buffer()); - response.internalFlushBuffer(); - - Assertions.assertFalse(flushWithBody); - } - - @Test - public void prepareSendPartHeader_update(@Mocked Part part) { - new Expectations() { - { - part.getContentType(); - result = "type"; - part.getSubmittedFileName(); - result = "测 试"; - } - }; - DownloadUtils.prepareDownloadHeader(response, part); - - Assertions.assertTrue(serverResponse.isChunked()); - Assertions.assertEquals("type", response.getHeader(HttpHeaders.CONTENT_TYPE)); - Assertions.assertEquals( - "attachment;filename=%E6%B5%8B%20%20%20%20%20%E8%AF%95;filename*=utf-8''%E6%B5%8B%20%20%20%20%20%E8%AF%95", - response.getHeader(HttpHeaders.CONTENT_DISPOSITION)); - } - - @Test - public void prepareSendPartHeader_notUpdate(@Mocked Part part) { - headers.add(HttpHeaders.CONTENT_LENGTH, "10"); - headers.add(HttpHeaders.CONTENT_TYPE, "type"); - headers.add(HttpHeaders.CONTENT_DISPOSITION, "disposition"); - - DownloadUtils.prepareDownloadHeader(response, part); - - Assertions.assertFalse(serverResponse.isChunked()); - Assertions.assertEquals("type", response.getHeader(HttpHeaders.CONTENT_TYPE)); - Assertions.assertEquals("disposition", response.getHeader(HttpHeaders.CONTENT_DISPOSITION)); - } - - @Test - public void sendPart_openInputStreamFailed(@Mocked Part part) - throws IOException { - IOException ioException = new IOException("forbid open stream"); - new Expectations() { - { - part.getInputStream(); - result = ioException; - } - }; - - CompletableFuture future = response.sendPart(part); - - ExecutionException exception = Assertions.assertThrows(ExecutionException.class, future::get); - Assertions.assertTrue(exception.getCause() instanceof IOException); - } - - @Test - public void sendPart_testPartIsNull(@Mocked Part part) throws InterruptedException, ExecutionException { - CompletableFuture future1 = response.sendPart(null); - Assertions.assertNull(future1.get()); - } - - @Test - public void sendPart_inputStreamBreak(@Mocked Part part, @Mocked InputStream inputStream) - throws IOException { - IOException ioException = new IOException("forbid read"); - new Expectations() { - { - part.getInputStream(); - result = inputStream; - inputStream.read((byte[]) any); - result = ioException; - } - }; - - CompletableFuture future = response.sendPart(part); - - ExecutionException exception = Assertions.assertThrows(ExecutionException.class, future::get); - Assertions.assertTrue(exception.getCause() instanceof IOException); - } - - @Test - public void sendPart_ReadStreamPart(@Mocked ReadStreamPart part) { - CompletableFuture future = new CompletableFuture<>(); - new MockUp() { - @Mock - CompletableFuture toWriteStream(WriteStream writeStream, Handler throwableHandler) { - return future; - } - }; - - Assertions.assertSame(future, response.sendPart(part)); - } - - @Test - public void sendPart_succ(@Mocked Part part, @Mocked InputStream inputStream) - throws IOException, InterruptedException, ExecutionException { - new Expectations() { - { - part.getInputStream(); - result = inputStream; - inputStream.read((byte[]) any); - result = -1; - } - }; - - CompletableFuture future = response.sendPart(part); - - Assertions.assertNull(future.get()); - } - - @Test - public void clearPartResource_deleteFile() throws IOException { - File file = new File("target", UUID.randomUUID() + ".txt"); - FileUtils.write(file, "content", StandardCharsets.UTF_8); - FilePart part = new FilePart(null, file).setDeleteAfterFinished(true); - - Assertions.assertTrue(file.exists()); - DownloadUtils.clearPartResource(part); - Assertions.assertFalse(file.exists()); - } - - @Test - public void clearPartResource_notDeleteFile() throws IOException { - File file = new File("target", UUID.randomUUID() + ".txt"); - FileUtils.write(file, "content", StandardCharsets.UTF_8); - FilePart part = new FilePart(null, file); - - Assertions.assertTrue(file.exists()); - DownloadUtils.clearPartResource(part); - Assertions.assertTrue(file.exists()); - - file.delete(); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/metrics/TestDefaultVertxMetricsFactory.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/metrics/TestDefaultVertxMetricsFactory.java index 1ae56ebee4a..ccc67374c82 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/metrics/TestDefaultVertxMetricsFactory.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/metrics/TestDefaultVertxMetricsFactory.java @@ -29,14 +29,12 @@ public class TestDefaultVertxMetricsFactory { DefaultVertxMetricsFactory factory = new DefaultVertxMetricsFactory(); - @SuppressWarnings("deprecation") @Test public void metrics() { MetricsOptions metricsOptions = factory.newOptions(); options.setMetricsOptions(metricsOptions); VertxMetrics vertxMetrics = factory.metrics(options); - Assertions.assertSame(factory, metricsOptions.getFactory()); Assertions.assertTrue(metricsOptions.isEnabled()); Assertions.assertSame(factory.getVertxMetrics(), vertxMetrics); diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java deleted file mode 100644 index 489a21d8a1e..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/server/TestTcpServer.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.foundation.vertx.server; - -import static org.mockito.ArgumentMatchers.any; - -import java.net.InetSocketAddress; - -import org.apache.servicecomb.foundation.common.LegacyPropertyFactory; -import org.apache.servicecomb.foundation.common.net.URIEndpointObject; -import org.apache.servicecomb.foundation.vertx.AsyncResultCallback; -import org.apache.servicecomb.foundation.vertx.metrics.DefaultTcpServerMetrics; -import org.apache.servicecomb.foundation.vertx.metrics.metric.DefaultServerEndpointMetric; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; -import org.mockito.Mockito; -import org.mockito.stubbing.Answer; -import org.springframework.core.env.Environment; - -import io.vertx.core.Handler; -import io.vertx.core.Vertx; -import io.vertx.core.net.NetServer; -import io.vertx.core.net.NetSocket; -import io.vertx.core.net.SocketAddress; -import io.vertx.core.net.impl.NetSocketImpl; - -public class TestTcpServer { - static class TcpServerForTest extends TcpServer { - public TcpServerForTest(URIEndpointObject endpointObject) { - super(endpointObject); - } - - @Override - protected TcpServerConnection createTcpServerConnection() { - return new TcpServerConnection() { - @Override - public void init(NetSocket netSocket) { - super.init(netSocket); - } - }; - } - } - - protected Environment environment; - - @BeforeEach - public void setup() { - environment = Mockito.mock(Environment.class); - LegacyPropertyFactory.setEnvironment(environment); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Test - public void testTcpServerNonSSL() { - Vertx vertx = Mockito.mock(Vertx.class); - AsyncResultCallback callback = Mockito.mock(AsyncResultCallback.class); - NetServer netServer = Mockito.mock(NetServer.class); - Mockito.when(vertx.createNetServer()).thenReturn(netServer); - - URIEndpointObject endpointObject = new URIEndpointObject("highway://127.0.0.1:6663"); - TcpServer server = new TcpServerForTest(endpointObject); - // assert done in Expectations - server.init(vertx, "", callback); - } - - Handler connectHandler; - - boolean netSocketClosed; - - @SuppressWarnings({"rawtypes", "unchecked"}) - @Test - public void testConnectionLimit() { - Vertx vertx = Mockito.mock(Vertx.class); - AsyncResultCallback callback = Mockito.mock(AsyncResultCallback.class); - NetServer netServer = Mockito.mock(NetServer.class); - NetSocketImpl netSocket = Mockito.mock(NetSocketImpl.class); - Mockito.when(vertx.createNetServer(any())).thenReturn(netServer); - - DefaultServerEndpointMetric endpointMetric = new DefaultServerEndpointMetric(null); - DefaultTcpServerMetrics tcpServerMetrics = new DefaultTcpServerMetrics(endpointMetric); - - Mockito.doAnswer((Answer) invocationOnMock -> { - connectHandler = invocationOnMock.getArgument(0); - return netServer; - }).when(netServer).connectHandler(any()); - - Mockito.doAnswer((Answer) invocationOnMock -> { - netSocketClosed = true; - return null; - }).when(netSocket).close(); - Mockito.when(netSocket.metrics()).thenReturn(tcpServerMetrics); - SocketAddress socketAddress = Mockito.mock(SocketAddress.class); - Mockito.when(netSocket.remoteAddress()).thenReturn(socketAddress); - Mockito.when(socketAddress.toString()).thenReturn("127.0.0.1:6663"); - - URIEndpointObject endpointObject = new URIEndpointObject("highway://127.0.0.1:6663?sslEnabled=true"); - TcpServer server = new TcpServerForTest(endpointObject) { - @Override - protected int getConnectionLimit() { - return 2; - } - }; - // assert done in Expectations - server.init(vertx, "", callback); - - // no problem - endpointMetric.onConnect(); - endpointMetric.onConnect(); - connectHandler.handle(netSocket); - - // reject - endpointMetric.onConnect(); - connectHandler.handle(netSocket); - Assertions.assertTrue(netSocketClosed); - Assertions.assertEquals(1, endpointMetric.getRejectByConnectionLimitCount()); - } -} diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/stream/TestPumpFromPart.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/stream/TestPumpFromPart.java deleted file mode 100644 index b32e790e00b..00000000000 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/stream/TestPumpFromPart.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.servicecomb.foundation.vertx.stream; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.concurrent.ExecutionException; - -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.RandomStringUtils; -import org.apache.servicecomb.foundation.common.part.InputStreamPart; -import org.apache.servicecomb.foundation.vertx.stream.InputStreamToReadStream.ReadResult; -import org.hamcrest.MatcherAssert; -import org.hamcrest.Matchers; -import org.junit.Before; -import org.junit.Test; -import org.junit.jupiter.api.Assertions; - -import io.vertx.core.Context; -import io.vertx.core.Promise; -import io.vertx.core.Vertx; -import io.vertx.core.impl.SyncContext; -import io.vertx.core.impl.VertxInternal; -import jakarta.servlet.http.Part; -import mockit.Expectations; -import mockit.Mock; -import mockit.MockUp; - -public class TestPumpFromPart { - static Vertx vertx = Vertx.vertx(); - - String src = RandomStringUtils.random(100, true, true); - - boolean inputStreamClosed; - - InputStream inputStream = new ByteArrayInputStream(src.getBytes()) { - @Override - public void close() throws IOException { - super.close(); - inputStreamClosed = true; - } - }; - - Part part; - - boolean outputStreamClosed; - - BufferOutputStream outputStream; - - IOException error = new IOException(); - - SyncContext context = new SyncContext(); - - @Before - public void setup() throws IOException { - context.setOwner((VertxInternal) vertx); - } - - private void run(Context context, boolean closeOutput) throws Throwable { - inputStream.reset(); - part = new InputStreamPart("name", inputStream); - - outputStream = new BufferOutputStream() { - @Override - public void close() { - super.close(); - outputStreamClosed = true; - } - }; - - new PumpFromPart(context, part).toOutputStream(outputStream, closeOutput).get(); - } - - public void do_pump_succ(Context context) throws Throwable { - run(context, true); - - Assertions.assertEquals(src, outputStream.getBuffer().toString()); - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - } - - @Test - public void pump_succ() throws Throwable { - do_pump_succ(null); - do_pump_succ(context); - } - - public void do_pump_outputNotClose(Context context) throws Throwable { - run(context, false); - - Assertions.assertEquals(src, outputStream.getBuffer().toString()); - Assertions.assertFalse(outputStreamClosed); - } - - @Test - public void pump_outputNotClose() throws Throwable { - do_pump_outputNotClose(null); - do_pump_outputNotClose(context); - } - - public void pump_error(Context context) { - try { - run(context, true); - Assertions.fail("must throw exception"); - } catch (Throwable e) { - MatcherAssert.assertThat(e, Matchers.instanceOf(ExecutionException.class)); - MatcherAssert.assertThat(e.getCause(), Matchers.sameInstance(error)); - } - - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - } - - @Test - public void pump_read_error() throws IOException { - new MockUp() { - @Mock - void readInWorker(Promise future) { - future.fail(error); - } - }; - new Expectations(IOUtils.class) { - { - IOUtils.copyLarge((InputStream) any, (OutputStream) any); - result = error; - } - }; - - pump_error(null); - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - - inputStreamClosed = false; - outputStreamClosed = false; - pump_error(context); - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - } - - @Test - public void pump_write_error() throws IOException { - new MockUp() { - @Mock - void write(byte[] b) throws IOException { - throw error; - } - }; - new Expectations(IOUtils.class) { - { - IOUtils.copyLarge((InputStream) any, (OutputStream) any); - result = error; - } - }; - - pump_error(null); - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - - inputStreamClosed = false; - outputStreamClosed = false; - pump_error(context); - Assertions.assertTrue(inputStreamClosed); - Assertions.assertTrue(outputStreamClosed); - } -} diff --git a/metrics/metrics-core/pom.xml b/metrics/metrics-core/pom.xml index d3d71ff8ef1..c68b483fde9 100644 --- a/metrics/metrics-core/pom.xml +++ b/metrics/metrics-core/pom.xml @@ -59,16 +59,6 @@ vertx-codegen provided - - org.apache.logging.log4j - log4j-slf4j-impl - test - - - org.apache.logging.log4j - log4j-core - test - org.mockito mockito-inline diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java index 75b3b8a6084..35ba63b3bdc 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/TestVertxMetersInitializer.java @@ -45,12 +45,14 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import io.vertx.core.AbstractVerticle; import io.vertx.core.DeploymentOptions; +import io.vertx.core.Future; import io.vertx.core.Promise; -import io.vertx.core.file.impl.FileResolverImpl; import io.vertx.core.http.HttpClient; import io.vertx.core.http.HttpClientRequest; +import io.vertx.core.http.HttpClientResponse; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServer; +import io.vertx.core.impl.SysProps; import io.vertx.ext.web.Router; public class TestVertxMetersInitializer { @@ -64,6 +66,12 @@ public class TestVertxMetersInitializer { Environment environment = Mockito.mock(Environment.class); + LogCollector logCollector = new LogCollector(); + + static HttpClient client; + + static HttpServer server; + static int port; static String body = "body"; @@ -74,16 +82,17 @@ public void start(Promise startPromise) { Router mainRouter = Router.router(vertx); mainRouter.route("/").handler(context -> context.response().end(body)); - HttpServer server = vertx.createHttpServer(); + server = vertx.createHttpServer(); server.requestHandler(mainRouter); - server.listen(0, "0.0.0.0", ar -> { - if (ar.succeeded()) { - port = ar.result().actualPort(); + Future future = server.listen(0, "0.0.0.0"); + future.onComplete((s, f) -> { + if (f == null) { + port = s.actualPort(); startPromise.complete(); return; } - startPromise.fail(ar.cause()); + startPromise.fail(f); }); } } @@ -91,13 +100,16 @@ public void start(Promise startPromise) { public static class TestClientVerticle extends AbstractVerticle { @Override public void start(Promise startPromise) { - HttpClient client = vertx.createHttpClient(); - client.request(HttpMethod.GET, port, "127.0.0.1", "/", ar -> { - if (ar.succeeded()) { - HttpClientRequest request = ar.result(); - request.send(body, resp -> { - if (resp.succeeded()) { - resp.result().bodyHandler((buffer) -> startPromise.complete()); + client = vertx.createHttpClient(); + Future future = client.request(HttpMethod.GET, port, "127.0.0.1", "/"); + future.onComplete((s, f) -> { + if (f == null) { + Future responseFuture = s.send(body); + responseFuture.onComplete((rs, rf) -> { + if (rf == null) { + rs.bodyHandler((buffer) -> startPromise.complete()); + } else { + startPromise.fail(f); } }); } @@ -109,15 +121,22 @@ public void start(Promise startPromise) { public void setup() { Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); HttpClients.load(); } @AfterEach - public void teardown() { + public void tearDown() { + logCollector.clear(); HttpClients.destroy(); + if (client != null) { + client.shutdown(); + } + if (server != null) { + server.shutdown(); + } } @Test @@ -140,14 +159,10 @@ public void init() throws InterruptedException { vertxMetersInitializer.poll(0, 1); List meters = registry.getMeters(); - LogCollector logCollector = new LogCollector(); - testLog(logCollector, meters, true); logCollector.clear(); testLog(logCollector, meters, false); - - logCollector.teardown(); } private void testLog(LogCollector logCollector, List meters, boolean printDetail) { diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestDefaultLogPublisher.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestDefaultLogPublisher.java index aa9270f4eb1..a1867955a60 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestDefaultLogPublisher.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestDefaultLogPublisher.java @@ -89,8 +89,8 @@ public void setup() { } @After - public void teardown() { - collector.teardown(); + public void tearDown() { + collector.tearDown(); } @Test diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java index ddfa8adeee8..e09252c4e61 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestSlowInvocationLogger.java @@ -82,8 +82,8 @@ public void setup() { } @AfterEach - public void teardown() { - logCollector.teardown(); + public void tearDown() { + logCollector.tearDown(); } @Test diff --git a/pom.xml b/pom.xml index 2478e78336c..1e04018ef8f 100644 --- a/pom.xml +++ b/pom.xml @@ -535,7 +535,6 @@ Date created: - -Xdoclint:none diff --git a/transports/transport-common/src/test/java/org/apache/servicecomb/transport/common/TestTransportConfigUtils.java b/transports/transport-common/src/test/java/org/apache/servicecomb/transport/common/TestTransportConfigUtils.java index 16c16adc89e..05351e62351 100644 --- a/transports/transport-common/src/test/java/org/apache/servicecomb/transport/common/TestTransportConfigUtils.java +++ b/transports/transport-common/src/test/java/org/apache/servicecomb/transport/common/TestTransportConfigUtils.java @@ -60,7 +60,7 @@ public void readVerticleCount_old_exist() { Assertions.assertEquals(10, TransportConfigUtils.readVerticleCount(key, deprecatedKey)); Assertions.assertEquals("thread-count is ambiguous, and deprecated, recommended to use verticle-count.", collector.getEvent(0).getMessage().getFormattedMessage()); - collector.teardown(); + collector.tearDown(); } @Test @@ -79,7 +79,7 @@ int availableProcessors() { Assertions.assertEquals(7, TransportConfigUtils.readVerticleCount(key, deprecatedKey)); Assertions.assertEquals("verticle-count not defined, set to 7.", collector.getLastEvents().getMessage().getFormattedMessage()); - collector.teardown(); + collector.tearDown(); } @Test @@ -106,6 +106,6 @@ int availableProcessors() { Assertions.assertEquals("verticle-count not defined, set to 8.", collector.getLastEvents().getMessage().getFormattedMessage()); - collector.teardown(); + collector.tearDown(); } } diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java index a9356e3384d..9bba840cf60 100644 --- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java +++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java @@ -49,7 +49,7 @@ import io.vertx.core.MultiMap; import io.vertx.core.buffer.Buffer; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; import io.vertx.core.json.Json; import mockit.Expectations; import mockit.Mocked; @@ -95,7 +95,7 @@ public void setUp() { long.class, DEFAULT_TURN_DOWN_STATUS_WAIT_SEC)).thenReturn(DEFAULT_TURN_DOWN_STATUS_WAIT_SEC); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java deleted file mode 100644 index 9de05d4c49e..00000000000 --- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayCodec.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.servicecomb.transport.highway; - -import java.nio.ByteBuffer; -import java.util.HashMap; -import java.util.Map; - -import org.apache.servicecomb.codec.protobuf.definition.OperationProtobuf; -import org.apache.servicecomb.codec.protobuf.definition.RequestRootDeserializer; -import org.apache.servicecomb.codec.protobuf.definition.RequestRootSerializer; -import org.apache.servicecomb.codec.protobuf.definition.ResponseRootSerializer; -import org.apache.servicecomb.core.Endpoint; -import org.apache.servicecomb.core.Invocation; -import org.apache.servicecomb.core.definition.MicroserviceMeta; -import org.apache.servicecomb.core.definition.OperationMeta; -import org.apache.servicecomb.core.definition.SchemaMeta; -import org.apache.servicecomb.foundation.vertx.server.TcpParser; -import org.apache.servicecomb.foundation.vertx.tcp.TcpOutputStream; -import org.apache.servicecomb.transport.highway.message.RequestHeader; -import org.junit.After; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.jupiter.api.Assertions; -import org.mockito.Mockito; - -import io.netty.buffer.ByteBuf; -import io.vertx.core.buffer.Buffer; -import mockit.Mocked; - -@SuppressWarnings({"unchecked", "rawtypes"}) -public class TestHighwayCodec { - private OperationProtobuf operationProtobuf = null; - - private Buffer bodyBuffer = null; - - private RequestRootSerializer requestSerializer = null; - - private RequestRootDeserializer requestRootDeserializer = null; - - private SchemaMeta schemaMeta = null; - - private OperationMeta operationMeta = null; - - private MicroserviceMeta microserviceMeta = null; - - private ByteBuf lByteBuf = null; - - private ByteBuffer nioBuffer = null; - - private Invocation invocation = null; - - @BeforeClass - public static void setupClass() { - } - - @Before - public void setUp() { - - operationProtobuf = Mockito.mock(OperationProtobuf.class); - - bodyBuffer = Mockito.mock(Buffer.class); - - requestSerializer = Mockito.mock(RequestRootSerializer.class); - - requestRootDeserializer = Mockito.mock(RequestRootDeserializer.class); - - schemaMeta = Mockito.mock(SchemaMeta.class); - - operationMeta = Mockito.mock(OperationMeta.class); - - microserviceMeta = Mockito.mock(MicroserviceMeta.class); - - lByteBuf = Mockito.mock(ByteBuf.class); - - nioBuffer = Mockito.mock(ByteBuffer.class); - - invocation = Mockito.mock(Invocation.class); - } - - @After - public void tearDown() { - - operationProtobuf = null; - - bodyBuffer = null; - - requestSerializer = null; - - schemaMeta = null; - - operationMeta = null; - - lByteBuf = null; - - nioBuffer = null; - - invocation = null; - } - - - @Test - public void test_decode_request_successful_and_not_copy_header(@Mocked Endpoint endpoint) throws Exception { - // test decode request not thrown exception and not copy header - // header should copied before invocation start. - commonMock(); - - Invocation invocation = new Invocation(endpoint, operationMeta, null); - - invocation.addContext("X-B3-traceId", "test1"); - Assertions.assertEquals("test1", invocation.getContext("X-B3-traceId")); - - RequestHeader headers = new RequestHeader(); - Map context = new HashMap<>(); - headers.setContext(context); - HighwayCodec.decodeRequest(invocation, headers, operationProtobuf, bodyBuffer); - Assertions.assertEquals("test1", invocation.getContext("X-B3-traceId")); - - context.put("X-B3-traceId", "test2"); - HighwayCodec.decodeRequest(invocation, headers, operationProtobuf, bodyBuffer); - Assertions.assertEquals("test1", invocation.getContext("X-B3-traceId")); - } - - @Test - public void testEncodeResponse() { - boolean status = true; - ResponseRootSerializer bodySchema = Mockito.mock(ResponseRootSerializer.class); - try { - commonMock(); - Object data = new Object(); - Mockito.when(bodySchema.serialize(data)).thenReturn(new byte[0]); - HighwayCodec.encodeResponse(23432142, null, bodySchema, data); - } catch (Exception e) { - e.printStackTrace(); - status = false; - } - Assertions.assertTrue(status); - } - - @Test - public void testEncodeRequest() { - boolean status = true; - try { - commonMock(); - Map args = new HashMap<>(0); - Mockito.when(invocation.getInvocationArguments()).thenReturn(args); - Mockito.when(requestSerializer.serialize(args)).thenReturn(new byte[0]); - TcpOutputStream os = HighwayCodec.encodeRequest(0, invocation, operationProtobuf); - Assertions.assertNotNull(os); - Assertions.assertArrayEquals(TcpParser.TCP_MAGIC, os.getBuffer().getBytes(0, 7)); - } catch (Exception e) { - e.printStackTrace(); - status = false; - } - Assertions.assertTrue(status); - } - - private void commonMock() { - Mockito.when(operationProtobuf.getRequestRootSerializer()).thenReturn(requestSerializer); - Mockito.when(operationProtobuf.getRequestRootDeserializer()).thenReturn(requestRootDeserializer); - Mockito.when(bodyBuffer.getByteBuf()).thenReturn(lByteBuf); - Mockito.when(bodyBuffer.getBytes()).thenReturn(new byte[0]); - Mockito.when(lByteBuf.nioBuffer()).thenReturn(nioBuffer); - - Mockito.when(operationMeta.getSchemaMeta()).thenReturn(schemaMeta); - Mockito.when(schemaMeta.getMicroserviceMeta()).thenReturn(microserviceMeta); - } -} diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayTransport.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayTransport.java index fe387de8073..18d674f00f0 100644 --- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayTransport.java +++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/TestHighwayTransport.java @@ -36,7 +36,7 @@ import org.slf4j.LoggerFactory; import org.springframework.core.env.Environment; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; public class TestHighwayTransport { private static final Logger LOGGER = LoggerFactory.getLogger(TestHighwayTransport.class); @@ -70,7 +70,7 @@ public void setUp() { .thenReturn(-1); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); } diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java index 8ff112a16cb..1091167ceed 100644 --- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java +++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/HttpTransportHttpClientOptionsSPI.java @@ -22,6 +22,7 @@ import io.vertx.core.VertxOptions; import io.vertx.core.http.HttpClientOptions; import io.vertx.core.http.HttpVersion; +import io.vertx.core.http.PoolOptions; public class HttpTransportHttpClientOptionsSPI implements HttpClientOptionsSPI { public static final String CLIENT_NAME = "http-transport-client"; @@ -136,12 +137,12 @@ public int getHttp2MultiplexingLimit() { @Override public int getHttp2MaxPoolSize() { - return HttpClientOptions.DEFAULT_HTTP2_MAX_POOL_SIZE; + return PoolOptions.DEFAULT_HTTP2_MAX_POOL_SIZE; } @Override public boolean isUseAlpn() { - return HttpClientOptions.DEFAULT_USE_ALPN; + return !HttpClientOptions.DEFAULT_ALPN_VERSIONS.isEmpty(); } @Override diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientEncoder.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientEncoder.java index 7a9b4330ef5..cc16c832f08 100644 --- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientEncoder.java +++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientEncoder.java @@ -41,8 +41,6 @@ import com.fasterxml.jackson.core.JsonProcessingException; -import io.netty.buffer.ByteBuf; -import io.netty.buffer.Unpooled; import io.vertx.core.buffer.Buffer; import io.vertx.core.http.HttpClientRequest; import jakarta.servlet.http.Part; @@ -151,22 +149,19 @@ protected void writeUrlEncodedForm(Map formMap) throws Exception } protected Buffer genUrlEncodedFormBuffer(Map formMap) throws Exception { - // 2x faster than UriComponentsBuilder - ByteBuf byteBuf = Unpooled.buffer(RestClientEncoder.FORM_BUFFER_SIZE); + Buffer buffer = Buffer.buffer(RestClientEncoder.FORM_BUFFER_SIZE); for (Entry entry : formMap.entrySet()) { - writeCharSequence(byteBuf, entry.getKey()); - byteBuf.writeByte('='); + writeCharSequence(buffer, entry.getKey()); + buffer.appendByte(((byte) '=')); String value = QueryCodec.convertToString(entry.getValue()); - String encodedValue = URLEncoder.encode(value, StandardCharsets.UTF_8.name()); - writeCharSequence(byteBuf, encodedValue); + String encodedValue = URLEncoder.encode(value, StandardCharsets.UTF_8); + writeCharSequence(buffer, encodedValue); - byteBuf.markWriterIndex(); - byteBuf.writeByte('&'); + buffer.appendByte(((byte) '&')); } - byteBuf.resetWriterIndex(); - return Buffer.buffer(byteBuf); + return buffer; } protected void writeChunkedForm(Map formMap) throws Exception { @@ -184,65 +179,65 @@ protected void writeChunkedForm(Map formMap) throws Exception { } protected Buffer genChunkedFormBuffer(Map formMap, String boundary) throws Exception { - ByteBuf byteBuf = Unpooled.buffer(RestClientEncoder.FORM_BUFFER_SIZE); + Buffer buffer = Buffer.buffer(RestClientEncoder.FORM_BUFFER_SIZE); for (Entry entry : formMap.entrySet()) { Object content = entry.getValue(); if (content instanceof List) { for (Object item : ((List) content)) { - writeFormData(byteBuf, boundary, entry.getKey(), item); + writeFormData(buffer, boundary, entry.getKey(), item); } } else { - writeFormData(byteBuf, boundary, entry.getKey(), entry.getValue()); + writeFormData(buffer, boundary, entry.getKey(), entry.getValue()); } } - return Buffer.buffer(byteBuf); + return buffer; } - private void writeFormData(ByteBuf byteBuf, String boundary, String key, Object data) throws Exception { - writeCharSequence(byteBuf, "\r\n--"); - writeCharSequence(byteBuf, boundary); - writeCharSequence(byteBuf, "\r\nContent-Disposition: form-data; name=\""); - writeCharSequence(byteBuf, key); - writeCharSequence(byteBuf, "\"\r\n\r\n"); + private void writeFormData(Buffer buffer, String boundary, String key, Object data) throws Exception { + writeCharSequence(buffer, "\r\n--"); + writeCharSequence(buffer, boundary); + writeCharSequence(buffer, "\r\nContent-Disposition: form-data; name=\""); + writeCharSequence(buffer, key); + writeCharSequence(buffer, "\"\r\n\r\n"); String value = QueryCodec.convertToString(data); - writeCharSequence(byteBuf, value); + writeCharSequence(buffer, value); } } - protected static void writeCharSequence(ByteBuf byteBuf, String value) { - byteBuf.writeCharSequence(value, StandardCharsets.UTF_8); + protected static void writeCharSequence(Buffer buffer, String value) { + buffer.appendString(value, "UTF-8"); } public static Buffer genFileBoundaryBuffer(Part part, String name, String boundary) { - ByteBuf byteBuf = Unpooled.buffer(); + Buffer buffer = Buffer.buffer(RestClientEncoder.FORM_BUFFER_SIZE); - writeCharSequence(byteBuf, "\r\n--"); - writeCharSequence(byteBuf, boundary); - writeCharSequence(byteBuf, "\r\nContent-Disposition: form-data; name=\""); - writeCharSequence(byteBuf, name); - writeCharSequence(byteBuf, "\"; filename=\""); - writeCharSequence(byteBuf, String.valueOf(part.getSubmittedFileName())); - writeCharSequence(byteBuf, "\"\r\n"); + writeCharSequence(buffer, "\r\n--"); + writeCharSequence(buffer, boundary); + writeCharSequence(buffer, "\r\nContent-Disposition: form-data; name=\""); + writeCharSequence(buffer, name); + writeCharSequence(buffer, "\"; filename=\""); + writeCharSequence(buffer, String.valueOf(part.getSubmittedFileName())); + writeCharSequence(buffer, "\"\r\n"); - writeCharSequence(byteBuf, "Content-Type: "); - writeCharSequence(byteBuf, part.getContentType()); - writeCharSequence(byteBuf, "\r\n"); + writeCharSequence(buffer, "Content-Type: "); + writeCharSequence(buffer, part.getContentType()); + writeCharSequence(buffer, "\r\n"); - writeCharSequence(byteBuf, "Content-Transfer-Encoding: binary\r\n"); + writeCharSequence(buffer, "Content-Transfer-Encoding: binary\r\n"); - writeCharSequence(byteBuf, "\r\n"); + writeCharSequence(buffer, "\r\n"); - return Buffer.buffer(byteBuf); + return buffer; } public static Buffer genBoundaryEndBuffer(String boundary) { - ByteBuf byteBuf = Unpooled.buffer(); + Buffer buffer = Buffer.buffer(RestClientEncoder.FORM_BUFFER_SIZE); - writeCharSequence(byteBuf, "\r\n--"); - writeCharSequence(byteBuf, boundary); - writeCharSequence(byteBuf, "--\r\n"); + writeCharSequence(buffer, "\r\n--"); + writeCharSequence(buffer, boundary); + writeCharSequence(buffer, "--\r\n"); - return Buffer.buffer(byteBuf); + return buffer; } } diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientSender.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientSender.java index bb61ccabba4..b737736c243 100644 --- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientSender.java +++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/RestClientSender.java @@ -83,7 +83,7 @@ protected void runInVertxContext() { } protected CompletableFuture sendInVertxContext() { - httpClientRequest.setTimeout(invocation.getOperationMeta().getConfig().getMsRequestTimeout()); + httpClientRequest.idleTimeout(invocation.getOperationMeta().getConfig().getMsRequestTimeout()); Multimap uploads = requestParameters.getUploads(); if (uploads == null) { diff --git a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/TransportClientConfig.java b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/TransportClientConfig.java index ff18a5a7ba1..e1f2c6042d1 100644 --- a/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/TransportClientConfig.java +++ b/transports/transport-rest/transport-rest-client/src/main/java/org/apache/servicecomb/transport/rest/client/TransportClientConfig.java @@ -21,6 +21,7 @@ import org.apache.servicecomb.transport.common.TransportConfigUtils; import io.vertx.core.http.HttpClientOptions; +import io.vertx.core.http.PoolOptions; public final class TransportClientConfig { private static final int DEFAULT_IDLE_TIME_OUT = 150; @@ -38,7 +39,7 @@ public static int getThreadCount() { public static int getHttp2ConnectionMaxPoolSize() { return LegacyPropertyFactory.getIntProperty("servicecomb.rest.client.http2.maxPoolSize", - HttpClientOptions.DEFAULT_HTTP2_MAX_POOL_SIZE); + PoolOptions.DEFAULT_HTTP2_MAX_POOL_SIZE); } public static int getHttp2MultiplexingLimit() { @@ -57,7 +58,7 @@ public static boolean isHttp2TransportClientEnabled() { public static int getConnectionMaxPoolSize() { return LegacyPropertyFactory.getIntProperty("servicecomb.rest.client.connection.maxPoolSize", - HttpClientOptions.DEFAULT_MAX_POOL_SIZE); + PoolOptions.DEFAULT_MAX_POOL_SIZE); } public static int getHttp2ConnectionIdleTimeoutInSeconds() { @@ -94,7 +95,7 @@ public static int getHttp2ConnectionKeepAliveTimeoutInSeconds() { public static boolean getConnectionCompression() { return LegacyPropertyFactory .getBooleanProperty("servicecomb.rest.client.connection.compression", - HttpClientOptions.DEFAULT_TRY_USE_COMPRESSION); + HttpClientOptions.DEFAULT_DECOMPRESSION_SUPPORTED); } public static int getMaxHeaderSize() { @@ -105,7 +106,7 @@ public static int getMaxHeaderSize() { public static int getMaxWaitQueueSize() { return LegacyPropertyFactory .getIntProperty("servicecomb.rest.client.maxWaitQueueSize", - HttpClientOptions.DEFAULT_MAX_WAIT_QUEUE_SIZE); + PoolOptions.DEFAULT_MAX_WAIT_QUEUE_SIZE); } public static boolean isHttpTransportClientEnabled() { diff --git a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java index 168efb4d087..9c94e49d58c 100644 --- a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java +++ b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestRestServlet.java @@ -30,7 +30,7 @@ import org.mockito.Mockito; import org.springframework.core.env.Environment; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; import jakarta.servlet.ServletException; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; @@ -51,7 +51,7 @@ public void setUp() { .thenReturn(0); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); restservlet = new RestServlet(); diff --git a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestServletRestTransport.java b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestServletRestTransport.java index d9d396fe27f..6875965a109 100644 --- a/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestServletRestTransport.java +++ b/transports/transport-rest/transport-rest-servlet/src/test/java/org/apache/servicecomb/transport/rest/servlet/TestServletRestTransport.java @@ -32,7 +32,7 @@ import org.mockito.Mockito; import org.springframework.core.env.Environment; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; import mockit.Expectations; public class TestServletRestTransport { @@ -48,7 +48,7 @@ public void setUp() { .thenReturn(0); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); transport = new ServletRestTransport(); diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java index 7aa346a63c0..70f8e43c765 100644 --- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java +++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java @@ -47,6 +47,7 @@ import io.vertx.core.AbstractVerticle; import io.vertx.core.Context; +import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.Promise; import io.vertx.core.Vertx; @@ -244,11 +245,12 @@ private void initDispatcher(Router mainRouter) { } private void startListen(HttpServer server, Promise startPromise) { - server.listen(endpointObject.getPort(), endpointObject.getHostOrIp(), ar -> { - if (ar.succeeded()) { + Future result = server.listen(endpointObject.getPort(), endpointObject.getHostOrIp()); + result.onComplete((s, f) -> { + if (f == null) { LOGGER.info("rest listen success. address={}:{}", endpointObject.getHostOrIp(), - ar.result().actualPort()); + s.actualPort()); startPromise.complete(); return; } @@ -256,8 +258,8 @@ private void startListen(HttpServer server, Promise startPromise) { String msg = String.format("rest listen failed, address=%s:%d", endpointObject.getHostOrIp(), endpointObject.getPort()); - LOGGER.error(msg, ar.cause()); - startPromise.fail(ar.cause()); + LOGGER.error(msg, f); + startPromise.fail(f); }); } diff --git a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java index 38f87fba48d..20f83446e57 100644 --- a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java +++ b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/VertxRestDispatcher.java @@ -124,15 +124,13 @@ private void sendFailureRespDeterminedByStatus(RoutingContext context) { .setStatusMessage(Status.INTERNAL_SERVER_ERROR.getReasonPhrase()) .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); } - context.response().close(); } /** * Use routingContext to send failure information in throwable. */ private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) { - if (e instanceof InvocationException) { - InvocationException invocationException = (InvocationException) e; + if (e instanceof InvocationException invocationException) { context.response().putHeader(HttpHeaders.CONTENT_TYPE, MediaType.WILDCARD) .setStatusCode(invocationException.getStatusCode()).setStatusMessage(invocationException.getReasonPhrase()) .end(wrapResponseBody(invocationException.getReasonPhrase())); @@ -141,7 +139,6 @@ private void sendExceptionByRoutingContext(RoutingContext context, Throwable e) .setStatusCode(Status.INTERNAL_SERVER_ERROR.getStatusCode()) .end(wrapResponseBody(Status.INTERNAL_SERVER_ERROR.getReasonPhrase())); } - context.response().close(); } /** diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java index 568aab893a2..e46d6c01bed 100644 --- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java +++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java @@ -17,8 +17,12 @@ package org.apache.servicecomb.transport.rest.vertx; +import java.nio.channels.FileChannel; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + import io.vertx.codegen.annotations.Nullable; -import io.vertx.core.AsyncResult; import io.vertx.core.Future; import io.vertx.core.Handler; import io.vertx.core.MultiMap; @@ -28,13 +32,7 @@ import io.vertx.core.http.HttpServerResponse; import io.vertx.core.net.HostAndPort; -import java.util.HashMap; -import java.util.Map; -import java.util.Set; - class MockHttpServerResponse implements HttpServerResponse { - boolean responseClosed; - boolean responseEnded; Map responseHeader = new HashMap<>(1); @@ -45,11 +43,6 @@ class MockHttpServerResponse implements HttpServerResponse { String responseChunk; - @Override - public void close() { - responseClosed = true; - } - @Override public HttpServerResponse putHeader(String name, String value) { responseHeader.put(name, value); @@ -74,11 +67,6 @@ public Future end() { return Future.succeededFuture(); } - @Override - public void end(Handler> handler) { - - } - @Override public Future end(String chunk) { responseEnded = true; @@ -86,11 +74,6 @@ public Future end(String chunk) { return Future.succeededFuture(); } - @Override - public void end(String s, Handler> handler) { - - } - @Override public HttpServerResponse exceptionHandler(Handler handler) { return null; @@ -101,10 +84,6 @@ public Future write(Buffer data) { return Future.succeededFuture(); } - @Override - public void write(Buffer buffer, Handler> handler) { - } - @Override public HttpServerResponse setWriteQueueMaxSize(int maxSize) { return null; @@ -196,26 +175,23 @@ public HttpServerResponse endHandler(Handler handler) { } @Override - public Future write(String chunk, String enc) { - return Future.succeededFuture(); + public Future writeHead() { + return null; } @Override - public void write(String s, String s1, Handler> handler) { + public Future write(String chunk, String enc) { + return Future.succeededFuture(); } + @Override public Future write(String chunk) { return Future.succeededFuture(); } @Override - public void write(String s, Handler> handler) { - - } - - @Override - public HttpServerResponse writeContinue() { + public Future writeContinue() { return null; } @@ -224,29 +200,17 @@ public Future writeEarlyHints(MultiMap headers) { return Future.succeededFuture(); } - @Override - public void writeEarlyHints(MultiMap headers, Handler> handler) { - } - @Override public Future end(String chunk, String enc) { return Future.succeededFuture(); } - @Override - public void end(String s, String s1, Handler> handler) { - - } @Override public Future end(Buffer chunk) { return Future.succeededFuture(); } - @Override - public void end(Buffer buffer, Handler> handler) { - - } @Override public Future sendFile(String filename, long offset, long length) { @@ -254,8 +218,7 @@ public Future sendFile(String filename, long offset, long length) { } @Override - public HttpServerResponse sendFile(String filename, long offset, long length, - Handler> resultHandler) { + public Future sendFile(FileChannel channel, long offset, long length) { return null; } @@ -294,46 +257,18 @@ public int streamId() { return 0; } - @Override - public HttpServerResponse push(HttpMethod method, String host, String path, - Handler> handler) { - return null; - } - - @Override - public HttpServerResponse push(HttpMethod method, String path, MultiMap headers, - Handler> handler) { - return null; - } - - @Override - public HttpServerResponse push(HttpMethod method, String path, Handler> handler) { - return null; - } - - @Override - public HttpServerResponse push(HttpMethod method, String host, String path, MultiMap headers, - Handler> handler) { - return null; - } - @Override public Future push(HttpMethod httpMethod, HostAndPort hostAndPort, String s, MultiMap multiMap) { return null; } @Override - public Future push(HttpMethod method, String host, String path, MultiMap headers) { - return Future.succeededFuture(); - } - - @Override - public boolean reset(long code) { - return false; + public Future reset(long code) { + return null; } @Override - public HttpServerResponse writeCustomFrame(int type, int flags, Buffer payload) { + public Future writeCustomFrame(int type, int flags, Buffer payload) { return null; } diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java index 8df4aa0f1f1..4154cc635c5 100644 --- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java +++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestRestServerVerticle.java @@ -65,10 +65,10 @@ import io.vertx.core.Handler; import io.vertx.core.Promise; import io.vertx.core.Vertx; -import io.vertx.core.file.impl.FileResolverImpl; import io.vertx.core.http.Http2Settings; import io.vertx.core.http.HttpMethod; import io.vertx.core.http.HttpServerResponse; +import io.vertx.core.impl.SysProps; import io.vertx.core.json.JsonObject; import io.vertx.ext.web.Route; import io.vertx.ext.web.Router; @@ -164,7 +164,7 @@ public void setUp() { .thenReturn(Http2Settings.DEFAULT_ENABLE_PUSH); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); Mockito.when(environment.getProperty(CLIENT_LOG_ENABLED, boolean.class, false)) .thenReturn(false); diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestTransport.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestTransport.java index c0e2af45da9..fb14f5115de 100644 --- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestTransport.java +++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/TestVertxRestTransport.java @@ -37,7 +37,7 @@ import io.vertx.core.DeploymentOptions; import io.vertx.core.Vertx; import io.vertx.core.VertxOptions; -import io.vertx.core.file.impl.FileResolverImpl; +import io.vertx.core.impl.SysProps; import mockit.Expectations; import mockit.Mock; import mockit.MockUp; @@ -69,7 +69,7 @@ public void setUp() { .thenReturn(""); Mockito.when(environment.getProperty("servicecomb.transport.eventloop.size", int.class, -1)) .thenReturn(-1); - Mockito.when(environment.getProperty(FileResolverImpl.DISABLE_CP_RESOLVING_PROP_NAME, boolean.class, true)) + Mockito.when(environment.getProperty(SysProps.DISABLE_FILE_CP_RESOLVING.name, boolean.class, true)) .thenReturn(true); LegacyPropertyFactory.setEnvironment(environment); instance = new VertxRestTransport(); From 0cb252f65013a22dbb8dbafb5a4a1210b440830d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:17:09 +0800 Subject: [PATCH 144/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.35 to 2.2.36 (#4926) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 6f674e68d2a..2f266514d12 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -84,7 +84,7 @@ 6.0.0 1.7.36 2.4 - 2.2.35 + 2.2.36 5.0.1 3.5.1 3.4.0 From 0ee8cb8123d917457d63604ecfd78f4001bb6687 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:17:51 +0800 Subject: [PATCH 145/223] Bump com.fasterxml.jackson:jackson-bom from 2.19.2 to 2.20.0 (#4925) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 2f266514d12..dff6544479d 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -53,7 +53,7 @@ 9.0.1.Final 4.5.14 1.5.18 - 2.19.2 + 2.20.0 1.6.0 1.3.2 1 From c83349f92b262c34155519d2092d041944810404 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:18:13 +0800 Subject: [PATCH 146/223] Bump org.assertj:assertj-core from 3.27.3 to 3.27.4 (#4923) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index dff6544479d..24ea67e2518 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -32,7 +32,7 @@ 1.2.2 - 3.27.3 + 3.27.4 4.3.0 6.3.0 1.11.0 From b19ab425f29c21f459755492cd4facd2b45ab64c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:18:31 +0800 Subject: [PATCH 147/223] Bump actions/checkout from 4 to 5 (#4921) --- .github/workflows/checkstyle.yml | 2 +- .github/workflows/linelint.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/rat_check.yml | 2 +- .github/workflows/typo_check.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index 6bb472f5fd2..c0ae2ed8e2d 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up jdk uses: actions/setup-java@v4 with: diff --git a/.github/workflows/linelint.yml b/.github/workflows/linelint.yml index 6f6ae1180e9..faeafb66c98 100644 --- a/.github/workflows/linelint.yml +++ b/.github/workflows/linelint.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: install linelint run: cargo install linelint-cli - name: Run linelint check diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index aca4e4a556e..7f7b7fcaf6a 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up jdk uses: actions/setup-java@v4 with: diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml index b1d8c55532b..736f39fcfd7 100644 --- a/.github/workflows/rat_check.yml +++ b/.github/workflows/rat_check.yml @@ -31,7 +31,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 - name: Set up jdk uses: actions/setup-java@v4 with: diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml index 9fe9d2fcd78..58b5cdb652c 100644 --- a/.github/workflows/typo_check.yml +++ b/.github/workflows/typo_check.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v5 # To run the typo check locally, you can follow these steps: # 1. Install typos locally using cargo: # cargo install typos-cli From 48055aac7c24ae2aa23b9e60910733eacd224e3d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:19:01 +0800 Subject: [PATCH 148/223] Bump actions/setup-java from 4 to 5 (#4919) --- .github/workflows/checkstyle.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/rat_check.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index c0ae2ed8e2d..f053c895b31 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -30,7 +30,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: Set up jdk - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: '17' distribution: 'temurin' diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 7f7b7fcaf6a..0dc1b24c8ba 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -34,7 +34,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: Set up jdk - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: '17' distribution: 'temurin' diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml index 736f39fcfd7..fc345147062 100644 --- a/.github/workflows/rat_check.yml +++ b/.github/workflows/rat_check.yml @@ -33,7 +33,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: Set up jdk - uses: actions/setup-java@v4 + uses: actions/setup-java@v5 with: java-version: '17' distribution: 'temurin' From df3cac0b2af265f427f8aeb5f9c8fcf2790a039f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:19:24 +0800 Subject: [PATCH 149/223] Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.11.2 to 3.11.3 (#4917) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1e04018ef8f..e0d18598b8a 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ 3.5.1 3.2.8 0.8.13 - 3.11.2 + 3.11.3 2.5 3.14.0 3.5.3 From bced92118bcd5306b045dc5da080c7a8e1606ed8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 09:19:45 +0800 Subject: [PATCH 150/223] Bump io.micrometer:micrometer-bom from 1.15.2 to 1.15.3 (#4915) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 24ea67e2518..fc838790ea5 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.1 3.9.11 - 1.15.2 + 1.15.3 5.18.0 5.2.0 5.15.0 From 49ae9c1d7f0e102db30cb4dcf98a3254e79b49d7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 10:03:59 +0800 Subject: [PATCH 151/223] Bump org.mockito:mockito-bom from 5.18.0 to 5.19.0 (#4918) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index fc838790ea5..93863673f86 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -66,7 +66,7 @@ 2.25.1 3.9.11 1.15.3 - 5.18.0 + 5.19.0 5.2.0 5.15.0 3.0.2 From 5c86bcf41a63628c545e428e02d9ede384f216e2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 24 Sep 2025 16:06:10 +0800 Subject: [PATCH 152/223] Bump com.alibaba.nacos:nacos-client from 3.0.2 to 3.0.3 (#4928) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 93863673f86..1c7d5090b85 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.19.0 5.2.0 5.15.0 - 3.0.2 + 3.0.3 0.3.0 0.16.0 3.23.4 From f33a5240036e47a6a5f47bc32c893e2962ea6502 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 25 Sep 2025 16:31:00 +0800 Subject: [PATCH 153/223] Bump org.yaml:snakeyaml from 2.4 to 2.5 (#4914) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 1c7d5090b85..c3250a037e2 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -83,7 +83,7 @@ 0.13.2 6.0.0 1.7.36 - 2.4 + 2.5 2.2.36 5.0.1 3.5.1 From 7395f6149a1e3be48368d51e2dc09c350d31adbf Mon Sep 17 00:00:00 2001 From: liubao68 Date: Fri, 26 Sep 2025 19:27:18 +0800 Subject: [PATCH 154/223] Bump com.github.spotbugs:spotbugs-maven-plugin from 4.9.3.2 to 4.9.4.0 (#4944) --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index e0d18598b8a..d4bff10aaa5 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 3.1.1 3.21.0 3.3.0 - 4.9.3.2 + 4.9.4.0 3.5.4 3.5.3 @@ -334,7 +334,7 @@ true true Medium - ci/spotbugs/exclude.xml + ${session.executionRootDirectory}/ci/spotbugs/exclude.xml From 842c55e35c9ff72b4079f9514e925e6e5d5a7af8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 26 Sep 2025 19:32:01 +0800 Subject: [PATCH 155/223] Bump com.puppycrawl.tools:checkstyle from 10.26.1 to 11.0.1 (#4927) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d4bff10aaa5..ac8f9125366 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 10.26.1 + 11.0.1 3.1.1 3.21.0 3.3.0 From a29f99e12bc5630cd0a47b98cc645e0d2d6085a4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 07:26:29 +0800 Subject: [PATCH 156/223] Bump com.puppycrawl.tools:checkstyle from 11.0.1 to 11.1.0 (#4965) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 11.0.1 to 11.1.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-11.0.1...checkstyle-11.1.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 11.1.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ac8f9125366..3ffa912c0cc 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 11.0.1 + 11.1.0 3.1.1 3.21.0 3.3.0 From 70a190ba8f3dc4a4145a9a1042c12ef12301de81 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 07:27:11 +0800 Subject: [PATCH 157/223] Bump org.apache.maven.plugins:maven-failsafe-plugin from 3.5.3 to 3.5.4 (#4962) Bumps [org.apache.maven.plugins:maven-failsafe-plugin](https://github.com/apache/maven-surefire) from 3.5.3 to 3.5.4. - [Release notes](https://github.com/apache/maven-surefire/releases) - [Commits](https://github.com/apache/maven-surefire/compare/surefire-3.5.3...surefire-3.5.4) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-failsafe-plugin dependency-version: 3.5.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3ffa912c0cc..279db302660 100644 --- a/pom.xml +++ b/pom.xml @@ -54,7 +54,7 @@ 3.11.3 2.5 3.14.0 - 3.5.3 + 3.5.4 3.4.2 3.9.0 3.2.0 From aefdcb084689549492f1ea84d0f2697489877e9b Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Thu, 9 Oct 2025 09:46:28 +0800 Subject: [PATCH 158/223] [#4942] Add random time to the scheduled task for pulling instances from serviceCenter (#4943) --- .../center/client/ServiceCenterDiscovery.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java index 6e10ba3585a..a0a93318403 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import org.apache.servicecomb.http.client.task.AbstractTask; @@ -101,6 +102,8 @@ public static class SubscriptionValue { private final Object lock = new Object(); + private final Random random = new Random(); + public ServiceCenterDiscovery(ServiceCenterClient serviceCenterClient, EventBus eventBus) { super("service-center-discovery-task"); this.serviceCenterClient = serviceCenterClient; @@ -219,10 +222,17 @@ class PullInstanceTask implements Task { public void execute() { pullAllInstance(); - startTask(new BackOffSleepTask(pollInterval, new PullInstanceTask())); + startTask(new BackOffSleepTask(buildPollIntervalWithSalt(), new PullInstanceTask())); } } + private long buildPollIntervalWithSalt() { + int positive = random.nextInt(5); + int sign = random.nextBoolean() ? 1 : -1; + long currentPollInterval = pollInterval + sign * positive * 1000; + return currentPollInterval > 0 ? currentPollInterval : pollInterval; + } + class PullInstanceOnceTask implements Task { @Override public void execute() { From 630931560ae6802294c1085d30ef1d8b1589c0aa Mon Sep 17 00:00:00 2001 From: Caimo Date: Fri, 10 Oct 2025 08:15:20 +0800 Subject: [PATCH 159/223] fix typo https://servicecomb.atlassian.net/browse/JAV-609 (#4972) Co-authored-by: QIURC --- ...Cutomized.java => RestProducersCustomized.java} | 2 +- .../apache/servicecomb/config/etcd/EtcdClient.java | 14 +++++++------- .../protobuf/internal/schema/SchemaManager.java | 8 ++++---- .../foundation/vertx/AddressResolverConfig.java | 2 +- .../servicecomb/foundation/vertx/VertxUtils.java | 2 +- .../servicecomb/foundation/vertx/TestStream.java | 2 +- 6 files changed, 15 insertions(+), 15 deletions(-) rename demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/{RestProducersCutomized.java => RestProducersCustomized.java} (94%) diff --git a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCutomized.java b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCustomized.java similarity index 94% rename from demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCutomized.java rename to demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCustomized.java index 445c6a35b07..a3858541825 100644 --- a/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCutomized.java +++ b/demo/demo-springmvc/springmvc-server/src/main/java/org/apache/servicecomb/demo/springmvc/server/RestProducersCustomized.java @@ -24,5 +24,5 @@ @Component @Primary // This example shows user's how to customize RestProducers by @Primary annotation -public class RestProducersCutomized extends RestProducers { +public class RestProducersCustomized extends RestProducers { } diff --git a/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdClient.java b/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdClient.java index 80898ab513d..9a7743add07 100644 --- a/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdClient.java +++ b/dynamic-config/config-etcd/src/main/java/org/apache/servicecomb/config/etcd/EtcdClient.java @@ -47,7 +47,7 @@ public class EtcdClient { - public class GetDataRunable implements Runnable { + public class GetDataRunnable implements Runnable { private Map dataMap; @@ -55,7 +55,7 @@ public class GetDataRunable implements Runnable { private String path; - public GetDataRunable(Map dataMap, EtcdClient etcdClient, String path) { + public GetDataRunnable(Map dataMap, EtcdClient etcdClient, String path) { this.dataMap = dataMap; this.etcdClient = etcdClient; this.path = path; @@ -153,7 +153,7 @@ private void addTagConfig(String env) throws Exception { ByteSequence prefixByteSeq = ByteSequence.from(path, StandardCharsets.UTF_8); Watch watchClient = client.getWatchClient(); watchClient.watch(prefixByteSeq, WatchOption.builder().withPrefix(prefixByteSeq).build(), - resp -> new Thread(new GetDataRunable(tagData, this, path)).start()); + resp -> new Thread(new GetDataRunnable(tagData, this, path)).start()); this.tagData = parseData(path); } @@ -166,7 +166,7 @@ private void addVersionConfig(String env) throws Exception { ByteSequence prefixByteSeq = ByteSequence.from(path, StandardCharsets.UTF_8); Watch watchClient = client.getWatchClient(); watchClient.watch(prefixByteSeq, WatchOption.builder().withPrefix(prefixByteSeq).build(), - resp -> new Thread(new GetDataRunable(versionData, this, path)).start()); + resp -> new Thread(new GetDataRunnable(versionData, this, path)).start()); this.versionData = parseData(path); } @@ -178,7 +178,7 @@ private void addServiceConfig(String env) throws Exception { ByteSequence prefixByteSeq = ByteSequence.from(path, StandardCharsets.UTF_8); Watch watchClient = client.getWatchClient(); watchClient.watch(prefixByteSeq, WatchOption.builder().withPrefix(prefixByteSeq).build(), - resp -> new Thread(new GetDataRunable(serviceData, this, path)).start()); + resp -> new Thread(new GetDataRunnable(serviceData, this, path)).start()); this.serviceData = parseData(path); } @@ -188,7 +188,7 @@ private void addApplicationConfig(String env) throws Exception { ByteSequence prefixByteSeq = ByteSequence.from(path, StandardCharsets.UTF_8); Watch watchClient = client.getWatchClient(); watchClient.watch(prefixByteSeq, WatchOption.builder().withPrefix(prefixByteSeq).build(), - resp -> new Thread(new GetDataRunable(applicationData, this, path)).start()); + resp -> new Thread(new GetDataRunnable(applicationData, this, path)).start()); this.applicationData = parseData(path); } @@ -198,7 +198,7 @@ private void addEnvironmentConfig(String env) throws Exception { ByteSequence prefixByteSeq = ByteSequence.from(path, StandardCharsets.UTF_8); Watch watchClient = client.getWatchClient(); watchClient.watch(prefixByteSeq, WatchOption.builder().withPrefix(prefixByteSeq).build(), - resp -> new Thread(new GetDataRunable(environmentData, this, path)).start()); + resp -> new Thread(new GetDataRunnable(environmentData, this, path)).start()); this.environmentData = parseData(path); } diff --git a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/SchemaManager.java b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/SchemaManager.java index 331c6b63284..5d583954ca0 100644 --- a/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/SchemaManager.java +++ b/foundations/foundation-protobuf/src/main/java/org/apache/servicecomb/foundation/protobuf/internal/schema/SchemaManager.java @@ -166,14 +166,14 @@ public FieldMapEx> createMapFields(Message message, Map types, String perameterName) { + private JavaType getParameterType(Map types, String parameterName) { - if (types.get(perameterName) != null) { - return TypeFactory.defaultInstance().constructType(types.get(perameterName)); + if (types.get(parameterName) != null) { + return TypeFactory.defaultInstance().constructType(types.get(parameterName)); } throw new IllegalArgumentException( - String.format("not found type info for parameter name [%s]", perameterName)); + String.format("not found type info for parameter name [%s]", parameterName)); } public FieldSchema createSchemaField(Field protoField, PropertyDescriptor propertyDescriptor) { diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java index 8b99960be30..2d4ee389642 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/AddressResolverConfig.java @@ -109,7 +109,7 @@ private static int getPositiveIntProperty(int defaultValue, String... keys) { for (String key : keys) { Integer val = LegacyPropertyFactory.getProperty(key, Integer.class); if (val != null && val <= 0) { - LOGGER.warn("Address resover key:{}'s value:{} is not positive, please check!", key, val); + LOGGER.warn("Address resolver key:{}'s value:{} is not positive, please check!", key, val); continue; } if (val != null) { diff --git a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java index 97d295dcfdc..5eceac0b24d 100644 --- a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java +++ b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/VertxUtils.java @@ -94,7 +94,7 @@ public static Map blockDeploy(Vertx CountDownLatch latch = new CountDownLatch(1); Future future = vertx.deployVerticle(cls.getName(), options); - future.onComplete((succuss, failure) -> { + future.onComplete((success, failure) -> { result.put("code", failure == null); if (failure != null) { diff --git a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestStream.java b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestStream.java index ea3a797da37..af3e2078c90 100644 --- a/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestStream.java +++ b/foundations/foundation-vertx/src/test/java/org/apache/servicecomb/foundation/vertx/TestStream.java @@ -31,7 +31,7 @@ public class TestStream { @Test public void testBufferInputStream() { Buffer obuf = Buffer.buffer(DIRECT_BUFFER_SIZE); - obuf.appendBytes(("testss").getBytes()); + obuf.appendBytes(("tests1").getBytes()); @SuppressWarnings("resource") BufferInputStream oBufferInputStream = new BufferInputStream(obuf); From 6852cd047808193148ad913960e3ec181119926b Mon Sep 17 00:00:00 2001 From: liubao68 Date: Fri, 10 Oct 2025 11:00:09 +0800 Subject: [PATCH 160/223] make typo check stable and update on demand --- .github/workflows/typo_check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml index 58b5cdb652c..e33de91eb50 100644 --- a/.github/workflows/typo_check.yml +++ b/.github/workflows/typo_check.yml @@ -35,4 +35,4 @@ jobs: # 2. Run the typo check with the following command: # typos - name: Check typos - uses: crate-ci/typos@master + uses: crate-ci/typos@v1.38.1 From c43f4b840aa037fc98b79a0dfe81679d9c4b9aac Mon Sep 17 00:00:00 2001 From: liubao68 Date: Fri, 10 Oct 2025 17:55:40 +0800 Subject: [PATCH 161/223] make test case run more stable --- .../servicecomb/samples/WebsocketController.java | 12 +++++++++--- demo/demo-consul/test-client/pom.xml | 2 +- .../apache/servicecomb/samples/WebsocketIT.java | 16 ++++++++++++++++ .../servicecomb/samples/WebsocketController.java | 12 +++++++++--- .../apache/servicecomb/samples/WebsocketIT.java | 16 ++++++++++++++++ 5 files changed, 51 insertions(+), 7 deletions(-) diff --git a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java index 3bc88c64ac5..6381ef1d54c 100644 --- a/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java +++ b/demo/demo-consul/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -17,6 +17,8 @@ package org.apache.servicecomb.samples; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.core.CoreConst; @@ -33,17 +35,21 @@ public class WebsocketController { @PostMapping("/websocket") @Transport(name = CoreConst.WEBSOCKET) public void websocket(ServerWebSocket serverWebsocket) { - // Client may have not registered message handler, and messages sent may get lost. - // So we sleep for a while to send message. AtomicInteger receiveCount = new AtomicInteger(0); + CountDownLatch startSend = new CountDownLatch(1); serverWebsocket.textMessageHandler(s -> { + if ("start".equals(s)) { + startSend.countDown(); + serverWebsocket.writeTextMessage("started"); + return; + } receiveCount.getAndIncrement(); }); serverWebsocket.closeHandler((v) -> System.out.println("closed")); new Thread(() -> { try { - Thread.sleep(1000); + startSend.await(30, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/demo/demo-consul/test-client/pom.xml b/demo/demo-consul/test-client/pom.xml index 2862315747b..791ac474886 100644 --- a/demo/demo-consul/test-client/pom.xml +++ b/demo/demo-consul/test-client/pom.xml @@ -68,7 +68,7 @@ - hashicorp/consul + hashicorp/consul:1.21 consul alias diff --git a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java index ea7a7f45b15..c36f2d16d28 100644 --- a/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java +++ b/demo/demo-consul/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java @@ -38,10 +38,15 @@ public class WebsocketIT implements CategorizedTestCase { public void testRestTransport() throws Exception { StringBuffer sb = new StringBuffer(); AtomicBoolean closed = new AtomicBoolean(false); + CountDownLatch latchStarted = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1); WebSocket webSocket = websocketClient.websocket(); webSocket.textMessageHandler(s -> { + if ("started".equals(s)) { + latchStarted.countDown(); + return; + } sb.append(s); sb.append(" "); webSocket.writeTextMessage(s); @@ -50,6 +55,17 @@ public void testRestTransport() throws Exception { closed.set(true); latch.countDown(); }); + + webSocket.writeTextMessage("start"); + int i = 0; + for (; i < 10; i++) { + if (!latchStarted.await(3, TimeUnit.SECONDS)) { + webSocket.writeTextMessage("start"); + continue; + } + break; + } + TestMgr.check(i < 10, true); latch.await(30, TimeUnit.SECONDS); TestMgr.check(sb.toString(), "hello hello 0 hello 1 hello 2 hello 3 hello 4 total 6 "); TestMgr.check(closed.get(), true); diff --git a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java index 3bc88c64ac5..6381ef1d54c 100644 --- a/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java +++ b/demo/demo-zookeeper/provider/src/main/java/org/apache/servicecomb/samples/WebsocketController.java @@ -17,6 +17,8 @@ package org.apache.servicecomb.samples; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.servicecomb.core.CoreConst; @@ -33,17 +35,21 @@ public class WebsocketController { @PostMapping("/websocket") @Transport(name = CoreConst.WEBSOCKET) public void websocket(ServerWebSocket serverWebsocket) { - // Client may have not registered message handler, and messages sent may get lost. - // So we sleep for a while to send message. AtomicInteger receiveCount = new AtomicInteger(0); + CountDownLatch startSend = new CountDownLatch(1); serverWebsocket.textMessageHandler(s -> { + if ("start".equals(s)) { + startSend.countDown(); + serverWebsocket.writeTextMessage("started"); + return; + } receiveCount.getAndIncrement(); }); serverWebsocket.closeHandler((v) -> System.out.println("closed")); new Thread(() -> { try { - Thread.sleep(1000); + startSend.await(30, TimeUnit.SECONDS); } catch (InterruptedException e) { e.printStackTrace(); } diff --git a/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java index ea7a7f45b15..c36f2d16d28 100644 --- a/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java +++ b/demo/demo-zookeeper/test-client/src/main/java/org/apache/servicecomb/samples/WebsocketIT.java @@ -38,10 +38,15 @@ public class WebsocketIT implements CategorizedTestCase { public void testRestTransport() throws Exception { StringBuffer sb = new StringBuffer(); AtomicBoolean closed = new AtomicBoolean(false); + CountDownLatch latchStarted = new CountDownLatch(1); CountDownLatch latch = new CountDownLatch(1); WebSocket webSocket = websocketClient.websocket(); webSocket.textMessageHandler(s -> { + if ("started".equals(s)) { + latchStarted.countDown(); + return; + } sb.append(s); sb.append(" "); webSocket.writeTextMessage(s); @@ -50,6 +55,17 @@ public void testRestTransport() throws Exception { closed.set(true); latch.countDown(); }); + + webSocket.writeTextMessage("start"); + int i = 0; + for (; i < 10; i++) { + if (!latchStarted.await(3, TimeUnit.SECONDS)) { + webSocket.writeTextMessage("start"); + continue; + } + break; + } + TestMgr.check(i < 10, true); latch.await(30, TimeUnit.SECONDS); TestMgr.check(sb.toString(), "hello hello 0 hello 1 hello 2 hello 3 hello 4 total 6 "); TestMgr.check(closed.get(), true); From c63aa85b4a03166f407b3501ab2a76c48da71aaf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 21:49:29 +0800 Subject: [PATCH 162/223] Bump log4j2.version from 2.25.1 to 2.25.2 (#4949) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index c3250a037e2..3693ea4e6ff 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.13.4 1.2.17 - 2.25.1 + 2.25.2 3.9.11 1.15.3 5.19.0 From e771f71c61791cbee6979321f0fab5b7e196373e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:02:10 +0800 Subject: [PATCH 163/223] Bump org.kiwiproject:consul-client from 1.6.0 to 1.7.0 (#4963) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 3693ea4e6ff..e833cad61c6 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 3.5.1 3.4.0 0.8.5 - 1.6.0 + 1.7.0 ${basedir}/../.. From 9c3f03dfb8629bee7a44c3bf6daffa5187db1480 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:02:43 +0800 Subject: [PATCH 164/223] Bump org.apache.maven.plugins:maven-javadoc-plugin from 3.11.3 to 3.12.0 (#4964) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 279db302660..11e956da34b 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ 3.5.1 3.2.8 0.8.13 - 3.11.3 + 3.12.0 2.5 3.14.0 3.5.4 From a34ad44c6128aa154e967e07b6eca784268cadea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:03:06 +0800 Subject: [PATCH 165/223] Bump org.apache.commons:commons-lang3 from 3.18.0 to 3.19.0 (#4961) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e833cad61c6..a2bfc38d503 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -38,7 +38,7 @@ 1.11.0 2.20.0 2.6 - 3.18.0 + 3.19.0 1.3.5 1.14.0 5.9.0 From 455bb632e74326acfdba2edd1eec01b34a0022b9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:04:14 +0800 Subject: [PATCH 166/223] Bump org.apache.maven.plugins:maven-surefire-plugin from 3.5.3 to 3.5.4 (#4959) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 11e956da34b..1056a2e5570 100644 --- a/pom.xml +++ b/pom.xml @@ -68,7 +68,7 @@ 3.3.0 4.9.4.0 3.5.4 - 3.5.3 + 3.5.4 From f8d7beb50862a22bc26fa478a4bce06ab1e2767a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:04:40 +0800 Subject: [PATCH 167/223] Bump org.mockito:mockito-bom from 5.19.0 to 5.20.0 (#4956) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a2bfc38d503..f3c396f8b87 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -66,7 +66,7 @@ 2.25.2 3.9.11 1.15.3 - 5.19.0 + 5.20.0 5.2.0 5.15.0 3.0.3 From cd208294965350a1312f18b3958dd088fea79be4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:07:38 +0800 Subject: [PATCH 168/223] Bump org.codehaus.mojo:license-maven-plugin from 2.6.0 to 2.7.0 (#4948) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1056a2e5570..c56b67fa3a6 100644 --- a/pom.xml +++ b/pom.xml @@ -199,7 +199,7 @@ org.codehaus.mojo license-maven-plugin - 2.6.0 + 2.7.0 default-cli From 2ce04cdd37adbcc01f354cc23b4b11b23f9b327e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:08:12 +0800 Subject: [PATCH 169/223] Bump com.alibaba.nacos:nacos-client from 3.0.3 to 3.1.0 (#4950) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index f3c396f8b87..3c26ef99618 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.20.0 5.2.0 5.15.0 - 3.0.3 + 3.1.0 0.3.0 0.16.0 3.23.4 From d4443de3383b0262359dde5c631ce03f9ef5f107 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:09:59 +0800 Subject: [PATCH 170/223] Bump com.google.guava:guava from 33.4.8-jre to 33.5.0-jre (#4953) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 3c26ef99618..e96a11b6a2a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -46,7 +46,7 @@ 3.0.2 1.17.12 1.17.13 - 33.4.8-jre + 33.5.0-jre 5.1.0 1.3 2.2.2 From 7269b9918556adb23fe18b300a74e00ae4b02b60 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Oct 2025 22:12:30 +0800 Subject: [PATCH 171/223] Bump org.assertj:assertj-core from 3.27.4 to 3.27.6 (#4955) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e96a11b6a2a..76dd6a5d625 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -32,7 +32,7 @@ 1.2.2 - 3.27.4 + 3.27.6 4.3.0 6.3.0 1.11.0 From 3a1fa0759477e42ae4f33dea1b721c2b09063abf Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Fri, 10 Oct 2025 09:13:49 -0500 Subject: [PATCH 172/223] change MessageTest encoding tests to deterministic implementation (#4971) --- .../registry/lightweight/MessageTest.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/service-registry/registry-lightweight/src/test/java/org/apache/servicecomb/registry/lightweight/MessageTest.java b/service-registry/registry-lightweight/src/test/java/org/apache/servicecomb/registry/lightweight/MessageTest.java index 66181ce87e7..0e79f3296c3 100644 --- a/service-registry/registry-lightweight/src/test/java/org/apache/servicecomb/registry/lightweight/MessageTest.java +++ b/service-registry/registry-lightweight/src/test/java/org/apache/servicecomb/registry/lightweight/MessageTest.java @@ -18,10 +18,12 @@ package org.apache.servicecomb.registry.lightweight; import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import org.junit.jupiter.api.Test; import io.vertx.core.json.Json; +import org.skyscreamer.jsonassert.JSONAssert; class MessageTest { private String toLinuxPrettyJson(Object value) { @@ -33,7 +35,8 @@ private String toLinuxPrettyJson(Object value) { void should_encode_register_type() { Message msg = Message.of(MessageType.REGISTER, new RegisterRequest()); - assertThat(toLinuxPrettyJson(msg)).isEqualTo("" + try { + JSONAssert.assertEquals(toLinuxPrettyJson(msg), "" + "{\n" + " \"type\" : \"REGISTER\",\n" + " \"body\" : {\n" @@ -45,7 +48,11 @@ void should_encode_register_type() { + " \"status\" : null,\n" + " \"endpoints\" : null\n" + " }\n" - + "}"); + + "}", false); + } catch (Exception e) { + fail("Failed to compare JSONs: " + e.getMessage(), e); + } + } @Test @@ -60,14 +67,18 @@ void should_decode_register_type() { void should_encode_unregister_type() { Message msg = Message.of(MessageType.UNREGISTER, new UnregisterRequest()); - assertThat(toLinuxPrettyJson(msg)).isEqualTo("" + try { + JSONAssert.assertEquals(toLinuxPrettyJson(msg), "" + "{\n" + " \"type\" : \"UNREGISTER\",\n" + " \"body\" : {\n" + " \"serviceId\" : null,\n" + " \"instanceId\" : null\n" + " }\n" - + "}"); + + "}", false); + } catch (Exception e) { + fail("Failed to compare JSONs: " + e.getMessage(), e); + } } @Test From b2fcb47db1453fdbc5877411897bf988ab8fb3e8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 15:17:44 +0800 Subject: [PATCH 173/223] Bump io.reactivex.rxjava3:rxjava from 3.1.11 to 3.1.12 (#4960) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 76dd6a5d625..6b5948a13b5 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -78,7 +78,7 @@ 1.0.4 1.7.0 2.7.18 - 3.1.11 + 3.1.12 1.0.0 0.13.2 6.0.0 From 2d8bfe6126fbe2a9ab48d7162953a61b9713b1ee Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 11 Oct 2025 15:18:02 +0800 Subject: [PATCH 174/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.36 to 2.2.38 (#4957) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 6b5948a13b5..a851fcfc0cb 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -84,7 +84,7 @@ 6.0.0 1.7.36 2.5 - 2.2.36 + 2.2.38 5.0.1 3.5.1 3.4.0 From 86632c954b60cf602c915713c1d187e7aec48563 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Sat, 11 Oct 2025 02:22:43 -0500 Subject: [PATCH 175/223] change TestThreadPoolPublishModelFactory to deterministic implementation (#4969) --- .../core/publish/TestThreadPoolPublishModelFactory.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestThreadPoolPublishModelFactory.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestThreadPoolPublishModelFactory.java index aaf8756dd95..f00e49180ae 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestThreadPoolPublishModelFactory.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestThreadPoolPublishModelFactory.java @@ -24,7 +24,6 @@ import org.apache.servicecomb.foundation.metrics.MetricsBootstrapConfig; import org.apache.servicecomb.metrics.core.ThreadPoolMetersInitializer; import org.apache.servicecomb.metrics.core.publish.model.DefaultPublishModel; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; @@ -36,6 +35,8 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import org.mockito.junit.jupiter.MockitoExtension; +import org.skyscreamer.jsonassert.JSONAssert; + @ExtendWith(MockitoExtension.class) @TestMethodOrder(MethodOrderer.MethodName.class) public class TestThreadPoolPublishModelFactory { @@ -61,9 +62,9 @@ public void createThreadPoolMeters() { PublishModelFactory factory = new PublishModelFactory(registry.getMeters()); DefaultPublishModel model = factory.createDefaultPublishModel(); - Assertions.assertEquals( + JSONAssert.assertEquals( """ {"test":{"avgTaskCount":0.0,"avgCompletedTaskCount":0.0,"currentThreadsBusy":0,"maxThreads":0,"poolSize":0,"corePoolSize":0,"queueSize":10,"rejected":0.0}}""", - JsonUtils.writeValueAsString(model.getThreadPools())); + JsonUtils.writeValueAsString(model.getThreadPools()), false); } } From 75417d88dfc02b894280bf27b4a830df6e74ae19 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Wed, 22 Oct 2025 20:24:53 -0500 Subject: [PATCH 176/223] change single unit test to deterministic implementation (#4988) --- .../transport/highway/HighwayServerCodecFilterTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java index 9bba840cf60..46352690c95 100644 --- a/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java +++ b/transports/transport-highway/src/test/java/org/apache/servicecomb/transport/highway/HighwayServerCodecFilterTest.java @@ -45,6 +45,7 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mockito; +import org.skyscreamer.jsonassert.JSONAssert; import org.springframework.core.env.Environment; import io.vertx.core.MultiMap; @@ -146,9 +147,10 @@ public void should_convert_exception_to_response_when_decode_request_failed() Response response = codecFilter.onFilter(invocation, nextNode).get(); assertThat(response.getStatus()).isEqualTo(INTERNAL_SERVER_ERROR); - assertThat(Json.encode(((InvocationException) response.getResult()).getErrorData())) - .isEqualTo("{\"code\":\"SCB.50000000\",\"message\":\"Unexpected " - + "exception when processing null. encode request failed\"}"); + + JSONAssert.assertEquals(Json.encode(((InvocationException) response.getResult()).getErrorData()), + "{\"code\":\"SCB.50000000\",\"message\":\"Unexpected " + + "exception when processing null. encode request failed\"}", false); } private void success_invocation() throws InterruptedException, ExecutionException { From e56086d1ec33390ece6bfc1d7029c4c674df38e3 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Sun, 26 Oct 2025 22:40:44 -0500 Subject: [PATCH 177/223] change TestMeasurementGroupConfig.addGroup to deterministic implementation (#4994) --- .../metrics/publish/spectator/TestMeasurementGroupConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementGroupConfig.java b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementGroupConfig.java index b4637386720..60d77b4c75a 100644 --- a/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementGroupConfig.java +++ b/foundations/foundation-metrics/src/test/java/org/apache/servicecomb/foundation/metrics/publish/spectator/TestMeasurementGroupConfig.java @@ -53,7 +53,7 @@ public void addGroup() { config.addGroup("id1", "tag1.1", "tag1.2"); config.addGroup("id2", "tag2.1", "tag2.2"); - MatcherAssert.assertThat(groups.keySet(), Matchers.contains("id2", "id1")); + MatcherAssert.assertThat(groups.keySet(), Matchers.containsInAnyOrder("id2", "id1")); MatcherAssert.assertThat(groups.get("id1").stream().map(TagFinder::getTagKey).toArray(), Matchers.arrayContaining("tag1.1", "tag1.2")); MatcherAssert.assertThat(groups.get("id2").stream().map(TagFinder::getTagKey).toArray(), Matchers.arrayContaining("tag2.1", "tag2.2")); } From e97e90435588ee814b85749b37fa5f16a6e61402 Mon Sep 17 00:00:00 2001 From: Peizhao Mei Date: Mon, 27 Oct 2025 01:57:52 -0500 Subject: [PATCH 178/223] Update UnitTestSwaggerUtils to deterministic (#4984) Update TestSwagger without adding dependencies Update UnitTestSwaggerUtils.java Remove unused import --- .../core/unittest/UnitTestSwaggerUtils.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/unittest/UnitTestSwaggerUtils.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/unittest/UnitTestSwaggerUtils.java index 9448484b083..c3d6270424e 100644 --- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/unittest/UnitTestSwaggerUtils.java +++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/generator/core/unittest/UnitTestSwaggerUtils.java @@ -20,14 +20,16 @@ import java.io.IOException; import java.net.URL; import java.nio.charset.StandardCharsets; -import java.util.Objects; import org.apache.commons.io.IOUtils; import org.apache.servicecomb.swagger.generator.SwaggerGenerator; import org.junit.jupiter.api.Assertions; import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectWriter; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; import io.swagger.v3.core.util.Yaml; import io.swagger.v3.oas.models.OpenAPI; @@ -81,8 +83,19 @@ public static SwaggerGenerator testSwagger(String resPath, Class cls, String. expectSchema = expectSchema.substring(offset + 4); } - if (!Objects.equals(expectSchema, schema)) { - Assertions.assertEquals(expectSchema, schema); + try { + ObjectMapper yaml = new ObjectMapper(new YAMLFactory()); + JsonNode expected = yaml.readTree(expectSchema); + JsonNode actual = yaml.readTree(schema); + + if (!actual.equals(expected)) { + ObjectMapper json = new ObjectMapper(); + String expectedPretty = json.writerWithDefaultPrettyPrinter().writeValueAsString(expected); + String actualPretty = json.writerWithDefaultPrettyPrinter().writeValueAsString(actual); + Assertions.fail("OpenAPI mismatch.\n=== EXPECTED ===\n" + expectedPretty + "\n=== ACTUAL ===\n" + actualPretty); + } + } catch (Exception e) { + Assertions.fail("Failed to parse/compare OpenAPI YAML: " + e.getMessage(), e); } return generator; From 2e1a12af3be46fad275e9c274e89902c1ec69bf1 Mon Sep 17 00:00:00 2001 From: Peizhao Mei Date: Mon, 27 Oct 2025 02:42:59 -0500 Subject: [PATCH 179/223] Fix flaky should_include_code_in_json_when_code_is_not_null (#4992) Update import --- .../invocation/exception/CommonExceptionDataTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java index 39a071f1f48..c12f149b825 100644 --- a/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java +++ b/swagger/swagger-invocation/invocation-core/src/test/java/org/apache/servicecomb/swagger/invocation/exception/CommonExceptionDataTest.java @@ -20,6 +20,8 @@ import static com.google.common.collect.ImmutableMap.of; import static org.assertj.core.api.Assertions.assertThat; +import java.util.Map; + import org.junit.jupiter.api.Test; import io.vertx.core.json.Json; @@ -36,7 +38,11 @@ void should_not_include_code_in_json_when_code_is_null() { void should_include_code_in_json_when_code_is_not_null() { CommonExceptionData data = new CommonExceptionData("code", "msg"); - assertThat(Json.encode(data)).isEqualTo("{\"code\":\"code\",\"message\":\"msg\"}"); + String json = Json.encode(data); + @SuppressWarnings("unchecked") + Map obj = Json.decodeValue(json, Map.class); + + assertThat(obj).containsEntry("code", "code").containsEntry("message", "msg").hasSize(2); } @Test From d4db7c371de482225e2f7bb438111a792b11448f Mon Sep 17 00:00:00 2001 From: Peizhao Mei Date: Mon, 27 Oct 2025 02:43:13 -0500 Subject: [PATCH 180/223] Fix should_ignore_endpoint_when_generate_swagger (#4990) --- .../invocation/endpoint/EndpointTest.java | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/core/src/test/java/org/apache/servicecomb/core/invocation/endpoint/EndpointTest.java b/core/src/test/java/org/apache/servicecomb/core/invocation/endpoint/EndpointTest.java index a28a2be4208..b3c0733bb48 100644 --- a/core/src/test/java/org/apache/servicecomb/core/invocation/endpoint/EndpointTest.java +++ b/core/src/test/java/org/apache/servicecomb/core/invocation/endpoint/EndpointTest.java @@ -26,7 +26,6 @@ import org.apache.servicecomb.core.Invocation; import org.apache.servicecomb.core.Transport; import org.apache.servicecomb.foundation.common.Holder; -import org.apache.servicecomb.swagger.SwaggerUtils; import org.apache.servicecomb.swagger.engine.SwaggerConsumer; import org.apache.servicecomb.swagger.engine.SwaggerConsumerOperation; import org.apache.servicecomb.swagger.engine.SwaggerEnvironment; @@ -46,22 +45,10 @@ void should_ignore_endpoint_when_generate_swagger() { SwaggerGenerator generator = SwaggerGenerator.create(TestSchema.class); OpenAPI swagger = generator.generate(); - assertThat(SwaggerUtils.swaggerToString(swagger)) - .isEqualTo("openapi: 3.0.1\n" - + "info:\n" - + " title: swagger definition for org.apache.servicecomb.core.invocation.endpoint.EndpointTest$TestSchema\n" - + " version: 1.0.0\n" - + "servers:\n" - + "- url: /TestSchema\n" - + "paths:\n" - + " /say:\n" - + " post:\n" - + " operationId: say\n" - + " responses:\n" - + " \"200\":\n" - + " description: response of 200\n" - + "components: {}\n" - + ""); + assertThat(swagger.getInfo().getTitle()).contains("EndpointTest$TestSchema"); + assertThat(swagger.getPaths()).containsKey("/say"); + assertThat(swagger.getPaths().get("/say").getPost().getOperationId()).isEqualTo("say"); + assertThat(swagger.getPaths().get("/say").getPost().getResponses()).containsKey("200"); } @Test From 94a74959f81f8eff3ecded83067d44eff2406309 Mon Sep 17 00:00:00 2001 From: Anthony Xu Date: Tue, 28 Oct 2025 21:17:21 -0500 Subject: [PATCH 181/223] change TestInvocationPublishModelFactory to deterministic implementation (#4947) --- .../publish/TestInvocationPublishModelFactory.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestInvocationPublishModelFactory.java b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestInvocationPublishModelFactory.java index ca232aec0f5..483aa6ab75d 100644 --- a/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestInvocationPublishModelFactory.java +++ b/metrics/metrics-core/src/test/java/org/apache/servicecomb/metrics/core/publish/TestInvocationPublishModelFactory.java @@ -30,7 +30,6 @@ import org.apache.servicecomb.metrics.core.publish.model.DefaultPublishModel; import org.apache.servicecomb.swagger.invocation.InvocationType; import org.apache.servicecomb.swagger.invocation.Response; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.springframework.core.env.Environment; @@ -41,6 +40,8 @@ import io.micrometer.core.instrument.simple.SimpleMeterRegistry; import io.vertx.core.json.Json; +import org.skyscreamer.jsonassert.JSONAssert; + public class TestInvocationPublishModelFactory { EventBus eventBus = new EventBus(); @@ -60,7 +61,7 @@ public class TestInvocationPublishModelFactory { Environment environment = Mockito.mock(Environment.class); @Test - public void createDefaultPublishModel() { + public void createDefaultPublishModel() throws Exception { Mockito.when(environment.getProperty(METRICS_WINDOW_TIME, int.class, DEFAULT_METRICS_WINDOW_TIME)) .thenReturn(DEFAULT_METRICS_WINDOW_TIME); Mockito.when(environment.getProperty( @@ -170,8 +171,8 @@ public void createDefaultPublishModel() { } } """; - Assertions.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)), - Json.encodePrettily(model.getConsumer())); + JSONAssert.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)), + Json.encodePrettily(model.getConsumer()), false); expect = """ { @@ -269,8 +270,8 @@ public void createDefaultPublishModel() { } } """; - Assertions.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)), - Json.encodePrettily(model.getProducer())); + JSONAssert.assertEquals(Json.encodePrettily(Json.decodeValue(expect, Object.class)), + Json.encodePrettily(model.getProducer()), false); } protected void prepareInvocation() { From 4be655dc89e66e74a65f8343dba1f39a33946de9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:45:18 +0800 Subject: [PATCH 182/223] Bump org.codehaus.mojo:exec-maven-plugin from 3.5.1 to 3.6.2 (#5011) Bumps [org.codehaus.mojo:exec-maven-plugin](https://github.com/mojohaus/exec-maven-plugin) from 3.5.1 to 3.6.2. - [Release notes](https://github.com/mojohaus/exec-maven-plugin/releases) - [Commits](https://github.com/mojohaus/exec-maven-plugin/compare/3.5.1...3.6.2) --- updated-dependencies: - dependency-name: org.codehaus.mojo:exec-maven-plugin dependency-version: 3.6.2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c56b67fa3a6..d48f535b0ac 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.3.0 12.1.3 0.46.0 - 3.5.1 + 3.6.2 3.2.8 0.8.13 3.12.0 From 6090776dddf8cb01a8ae6250a1174e2f2356557c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:46:10 +0800 Subject: [PATCH 183/223] Bump com.fasterxml.jackson:jackson-bom from 2.20.0 to 2.20.1 (#5000) Bumps [com.fasterxml.jackson:jackson-bom](https://github.com/FasterXML/jackson-bom) from 2.20.0 to 2.20.1. - [Commits](https://github.com/FasterXML/jackson-bom/compare/jackson-bom-2.20.0...jackson-bom-2.20.1) --- updated-dependencies: - dependency-name: com.fasterxml.jackson:jackson-bom dependency-version: 2.20.1 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index a851fcfc0cb..3da72d51c6b 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -53,7 +53,7 @@ 9.0.1.Final 4.5.14 1.5.18 - 2.20.0 + 2.20.1 1.6.0 1.3.2 1 From 199ae45d80e37e9125d3893e4f29496ed60f1f52 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:46:20 +0800 Subject: [PATCH 184/223] Bump com.puppycrawl.tools:checkstyle from 11.1.0 to 12.1.1 (#5001) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 11.1.0 to 12.1.1. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-11.1.0...checkstyle-12.1.1) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 12.1.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d48f535b0ac..b3f07341b8f 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 11.1.0 + 12.1.1 3.1.1 3.21.0 3.3.0 From cf31a75ee5cc6c133f2384bdecad932dab0100ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:46:30 +0800 Subject: [PATCH 185/223] Bump org.owasp:dependency-check-maven from 12.1.3 to 12.1.8 (#5003) Bumps [org.owasp:dependency-check-maven](https://github.com/dependency-check/DependencyCheck) from 12.1.3 to 12.1.8. - [Release notes](https://github.com/dependency-check/DependencyCheck/releases) - [Changelog](https://github.com/dependency-check/DependencyCheck/blob/main/CHANGELOG.md) - [Commits](https://github.com/dependency-check/DependencyCheck/compare/v12.1.3...v12.1.8) --- updated-dependencies: - dependency-name: org.owasp:dependency-check-maven dependency-version: 12.1.8 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b3f07341b8f..18255c5b748 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.1.3 + 12.1.8 0.46.0 3.6.2 3.2.8 From 40d6c1ae20374e45c0b7e2acef82aabfdce1ca77 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:46:42 +0800 Subject: [PATCH 186/223] Bump org.kiwiproject:consul-client from 1.7.0 to 1.8.0 (#5007) Bumps [org.kiwiproject:consul-client](https://github.com/kiwiproject/consul-client) from 1.7.0 to 1.8.0. - [Release notes](https://github.com/kiwiproject/consul-client/releases) - [Changelog](https://github.com/kiwiproject/consul-client/blob/main/CHANGELOG.md) - [Commits](https://github.com/kiwiproject/consul-client/compare/v1.7.0...v1.8.0) --- updated-dependencies: - dependency-name: org.kiwiproject:consul-client dependency-version: 1.8.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 3da72d51c6b..acc38db8c84 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -89,7 +89,7 @@ 3.5.1 3.4.0 0.8.5 - 1.7.0 + 1.8.0 ${basedir}/../.. From 66d0262b71d53a98b8b2b5f4f795df704d73da5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:46:55 +0800 Subject: [PATCH 187/223] Bump org.jacoco:jacoco-maven-plugin from 0.8.13 to 0.8.14 (#5009) Bumps [org.jacoco:jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.13 to 0.8.14. - [Release notes](https://github.com/jacoco/jacoco/releases) - [Commits](https://github.com/jacoco/jacoco/compare/v0.8.13...v0.8.14) --- updated-dependencies: - dependency-name: org.jacoco:jacoco-maven-plugin dependency-version: 0.8.14 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 18255c5b748..843de273dcf 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 0.46.0 3.6.2 3.2.8 - 0.8.13 + 0.8.14 3.12.0 2.5 3.14.0 From ec76b1a15704c15bab437e64739e6d483562850d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Nov 2025 09:47:04 +0800 Subject: [PATCH 188/223] Bump io.micrometer:micrometer-bom from 1.15.3 to 1.15.5 (#5010) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.15.3 to 1.15.5. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.15.3...v1.15.5) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-version: 1.15.5 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index acc38db8c84..438f6aeefd2 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.2 3.9.11 - 1.15.3 + 1.15.5 5.20.0 5.2.0 5.15.0 From bd5311aa329b54017e2f6f1e562601b5cfde235b Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 14 Nov 2025 14:37:23 +0800 Subject: [PATCH 189/223] [#5015] update jdk image version (#5016) --- demo/demo-consul/consumer/pom.xml | 2 +- demo/demo-consul/gateway/pom.xml | 2 +- demo/demo-consul/provider/pom.xml | 2 +- demo/demo-crossapp/crossapp-server/pom.xml | 2 +- demo/demo-edge/authentication/pom.xml | 2 +- demo/demo-edge/business-1-1-0/pom.xml | 2 +- demo/demo-edge/business-1.0.0/pom.xml | 2 +- demo/demo-edge/business-2.0.0/pom.xml | 2 +- demo/demo-edge/edge-service/pom.xml | 2 +- demo/demo-etcd/consumer/pom.xml | 2 +- demo/demo-etcd/gateway/pom.xml | 2 +- demo/demo-etcd/provider/pom.xml | 2 +- demo/demo-filter/filter-client/pom.xml | 2 +- demo/demo-filter/filter-edge/pom.xml | 2 +- demo/demo-filter/filter-server/pom.xml | 2 +- demo/demo-jaxrs/jaxrs-server/pom.xml | 2 +- demo/demo-local-registry/demo-local-registry-server/pom.xml | 2 +- demo/demo-multi-registries/demo-multi-registries-server/pom.xml | 2 +- .../demo-multi-service-center-serverA/pom.xml | 2 +- .../demo-multi-service-center-serverB/pom.xml | 2 +- demo/demo-multiple/multiple-server/pom.xml | 2 +- demo/demo-nacos/consumer/pom.xml | 2 +- demo/demo-nacos/gateway/pom.xml | 2 +- demo/demo-nacos/provider/pom.xml | 2 +- demo/demo-pojo/pojo-server/pom.xml | 2 +- .../demo-register-url-prefix-server/pom.xml | 2 +- .../demo-spring-boot-pojo-server/pom.xml | 2 +- .../demo-spring-boot-springmvc-server/pom.xml | 2 +- demo/demo-springmvc/springmvc-server/pom.xml | 2 +- .../demo-zeroconfig-registry-client/pom.xml | 2 +- .../demo-zeroconfig-registry-edge/pom.xml | 2 +- .../demo-zeroconfig-registry-server/pom.xml | 2 +- demo/demo-zookeeper/consumer/pom.xml | 2 +- demo/demo-zookeeper/gateway/pom.xml | 2 +- demo/demo-zookeeper/provider/pom.xml | 2 +- 35 files changed, 35 insertions(+), 35 deletions(-) diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml index 10a97833848..9c27c516e74 100644 --- a/demo/demo-consul/consumer/pom.xml +++ b/demo/demo-consul/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml index ee3f369112d..1934a4adfc5 100644 --- a/demo/demo-consul/gateway/pom.xml +++ b/demo/demo-consul/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index 5ba5e0874fd..7de7b7c268b 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-crossapp/crossapp-server/pom.xml b/demo/demo-crossapp/crossapp-server/pom.xml index 039da4768c8..28fc2672e9c 100644 --- a/demo/demo-crossapp/crossapp-server/pom.xml +++ b/demo/demo-crossapp/crossapp-server/pom.xml @@ -58,7 +58,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-edge/authentication/pom.xml b/demo/demo-edge/authentication/pom.xml index d4ecf86c0ba..5f6d47f2a28 100644 --- a/demo/demo-edge/authentication/pom.xml +++ b/demo/demo-edge/authentication/pom.xml @@ -54,7 +54,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-edge/business-1-1-0/pom.xml b/demo/demo-edge/business-1-1-0/pom.xml index 07f1ab27370..19f1a19301a 100644 --- a/demo/demo-edge/business-1-1-0/pom.xml +++ b/demo/demo-edge/business-1-1-0/pom.xml @@ -60,7 +60,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-edge/business-1.0.0/pom.xml b/demo/demo-edge/business-1.0.0/pom.xml index 7987cfa89f4..cc469f8a4ad 100644 --- a/demo/demo-edge/business-1.0.0/pom.xml +++ b/demo/demo-edge/business-1.0.0/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-edge/business-2.0.0/pom.xml b/demo/demo-edge/business-2.0.0/pom.xml index 37fb8f7ecc7..0e1e926a16c 100644 --- a/demo/demo-edge/business-2.0.0/pom.xml +++ b/demo/demo-edge/business-2.0.0/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-edge/edge-service/pom.xml b/demo/demo-edge/edge-service/pom.xml index 7badf5b9bc4..3302820f26c 100644 --- a/demo/demo-edge/edge-service/pom.xml +++ b/demo/demo-edge/edge-service/pom.xml @@ -60,7 +60,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 499fff2c1ef..2b6f645a6fe 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-etcd/gateway/pom.xml b/demo/demo-etcd/gateway/pom.xml index 7d9ef352a96..13e8d0f0496 100644 --- a/demo/demo-etcd/gateway/pom.xml +++ b/demo/demo-etcd/gateway/pom.xml @@ -73,7 +73,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-etcd/provider/pom.xml b/demo/demo-etcd/provider/pom.xml index 71884130108..ba16384e363 100644 --- a/demo/demo-etcd/provider/pom.xml +++ b/demo/demo-etcd/provider/pom.xml @@ -83,7 +83,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-filter/filter-client/pom.xml b/demo/demo-filter/filter-client/pom.xml index 837f4f81ca4..61800166564 100644 --- a/demo/demo-filter/filter-client/pom.xml +++ b/demo/demo-filter/filter-client/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-filter/filter-edge/pom.xml b/demo/demo-filter/filter-edge/pom.xml index 4c9e95932a3..06905af9887 100644 --- a/demo/demo-filter/filter-edge/pom.xml +++ b/demo/demo-filter/filter-edge/pom.xml @@ -71,7 +71,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-filter/filter-server/pom.xml b/demo/demo-filter/filter-server/pom.xml index f30759c349a..6729f2c16a7 100644 --- a/demo/demo-filter/filter-server/pom.xml +++ b/demo/demo-filter/filter-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-jaxrs/jaxrs-server/pom.xml b/demo/demo-jaxrs/jaxrs-server/pom.xml index 8bc78928a94..acb758a9779 100644 --- a/demo/demo-jaxrs/jaxrs-server/pom.xml +++ b/demo/demo-jaxrs/jaxrs-server/pom.xml @@ -72,7 +72,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-local-registry/demo-local-registry-server/pom.xml b/demo/demo-local-registry/demo-local-registry-server/pom.xml index 0be4606e63a..ebf2a657bba 100644 --- a/demo/demo-local-registry/demo-local-registry-server/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-server/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml index 792a65dff41..37045fcb876 100644 --- a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml index 4b70798febf..af0caa4387b 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml index 43c235e0177..443a6a18fd9 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-multiple/multiple-server/pom.xml b/demo/demo-multiple/multiple-server/pom.xml index 92830d919a4..daec9769db0 100644 --- a/demo/demo-multiple/multiple-server/pom.xml +++ b/demo/demo-multiple/multiple-server/pom.xml @@ -65,7 +65,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-nacos/consumer/pom.xml b/demo/demo-nacos/consumer/pom.xml index f1cb74b7ff1..3c98b25de2d 100644 --- a/demo/demo-nacos/consumer/pom.xml +++ b/demo/demo-nacos/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-nacos/gateway/pom.xml b/demo/demo-nacos/gateway/pom.xml index 3c2bf730559..e0f6a6b7106 100644 --- a/demo/demo-nacos/gateway/pom.xml +++ b/demo/demo-nacos/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-nacos/provider/pom.xml b/demo/demo-nacos/provider/pom.xml index 83619a797ca..03c8e244494 100644 --- a/demo/demo-nacos/provider/pom.xml +++ b/demo/demo-nacos/provider/pom.xml @@ -68,7 +68,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-pojo/pojo-server/pom.xml b/demo/demo-pojo/pojo-server/pom.xml index 509c67d04aa..7909f04ed72 100644 --- a/demo/demo-pojo/pojo-server/pom.xml +++ b/demo/demo-pojo/pojo-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml index 643d49f629a..b6bfa795ad1 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml @@ -61,7 +61,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml index 026f7d867de..e99b680a5ac 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml @@ -63,7 +63,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml index d2e6c91de20..02bf3f89de3 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml @@ -58,7 +58,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-springmvc/springmvc-server/pom.xml b/demo/demo-springmvc/springmvc-server/pom.xml index 8037b187872..483e7a7b2d3 100644 --- a/demo/demo-springmvc/springmvc-server/pom.xml +++ b/demo/demo-springmvc/springmvc-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml index fcc6b6f2d00..af8f280b614 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml @@ -73,7 +73,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml index bb18e72e8a3..bb739a1533a 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml @@ -78,7 +78,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml index e0ab59c090f..c1bb884c854 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zookeeper/consumer/pom.xml b/demo/demo-zookeeper/consumer/pom.xml index 490ee41b37f..22fc8894346 100644 --- a/demo/demo-zookeeper/consumer/pom.xml +++ b/demo/demo-zookeeper/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zookeeper/gateway/pom.xml b/demo/demo-zookeeper/gateway/pom.xml index f375eeaa3fd..adaef43eee9 100644 --- a/demo/demo-zookeeper/gateway/pom.xml +++ b/demo/demo-zookeeper/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 diff --git a/demo/demo-zookeeper/provider/pom.xml b/demo/demo-zookeeper/provider/pom.xml index cb0d51833f9..8bfd598e98f 100644 --- a/demo/demo-zookeeper/provider/pom.xml +++ b/demo/demo-zookeeper/provider/pom.xml @@ -76,7 +76,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17-alpine + openjdk:17.0.2 7070 8080 From 9b7f8e60390043c5b8888272ef2560ef4316b51e Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 24 Nov 2025 15:27:17 +0800 Subject: [PATCH 190/223] [#5013] Fixing the issue where microservices cannot be registered when enabling RBAC authentication in a dual-engine disaster recovery scenario. (#5019) --- .../client/ConfigCenterAddressManager.java | 5 +- .../center/client/ConfigCenterClient.java | 19 +++- .../config/kie/client/KieClient.java | 19 +++- .../kie/client/model/KieAddressManager.java | 4 +- .../client/model/KieAddressManagerTest.java | 4 +- .../client/DashboardAddressManager.java | 4 +- .../dashboard/client/AddressManagerTest.java | 4 +- .../client/common/AbstractAddressManager.java | 86 ++++++++++++++++-- .../http/client/common/HttpTransportImpl.java | 19 +++- .../http/client/event}/OperationEvents.java | 10 ++- .../common/AbstractAddressManagerTest.java | 33 +++++-- .../client/ServiceCenterAddressManager.java | 5 +- .../center/client/ServiceCenterClient.java | 36 +------- .../center/client/ServiceCenterOperation.java | 2 +- .../center/client/ServiceCenterRawClient.java | 50 ++++++++--- .../client/ServiceCenterRegistration.java | 2 +- .../center/client/ServiceCenterWatch.java | 15 +++- .../ServiceCenterAddressManagerTest.java | 6 +- .../client/ServiceCenterClientTest.java | 2 +- .../client/ServiceCenterRawClientTest.java | 3 +- .../RegistryClientTest.java | 4 +- .../ConfigCenterDynamicPropertiesSource.java | 12 +-- .../cc/ConfigCenterAddressManagerTest.java | 6 +- ...nfigCenterConfigurationSourceImplTest.java | 8 +- .../kie/KieDynamicPropertiesSource.java | 11 ++- .../foundation/auth/AuthHeaderProvider.java | 14 ++- .../monitor/DefaultMonitorDataPublisher.java | 7 +- .../servicestage/RBACBootStrapService.java | 7 +- .../servicestage/TokenAuthHeaderProvider.java | 4 +- .../servicestage/TokenCacheManager.java | 87 +++++++++---------- .../registry/sc/SCAddressManager.java | 35 +++++--- .../registry/sc/SCClientUtils.java | 62 +++++++++++-- 32 files changed, 402 insertions(+), 183 deletions(-) rename clients/{service-center-client/src/main/java/org/apache/servicecomb/service/center/client => http-client-common/src/main/java/org/apache/servicecomb/http/client/event}/OperationEvents.java (79%) diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterAddressManager.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterAddressManager.java index 3b346153a0b..977c84ef63f 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterAddressManager.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterAddressManager.java @@ -28,8 +28,9 @@ public class ConfigCenterAddressManager extends AbstractAddressManager { - public ConfigCenterAddressManager(String projectName, List addresses, EventBus eventBus) { - super(projectName, addresses); + public ConfigCenterAddressManager(String projectName, List addresses, EventBus eventBus, String region, + String availableZone) { + super(projectName, addresses, region, availableZone); eventBus.register(this); } diff --git a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java index 66d9d154fd5..8ed31a5a61b 100644 --- a/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java +++ b/clients/config-center-client/src/main/java/org/apache/servicecomb/config/center/client/ConfigCenterClient.java @@ -32,6 +32,7 @@ import org.apache.servicecomb.http.client.common.HttpResponse; import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpUtils; +import org.apache.servicecomb.http.client.event.OperationEvents.UnAuthorizedOperationEvent; import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,12 +62,15 @@ public class ConfigCenterClient implements ConfigCenterOperation { private final Map> dimensionConfigNames = new HashMap<>(); + private EventBus eventBus; + public ConfigCenterClient(ConfigCenterAddressManager addressManager, HttpTransport httpTransport) { this.addressManager = addressManager; this.httpTransport = httpTransport; } public void setEventBus(EventBus eventBus) { + this.eventBus = eventBus; addressManager.setEventBus(eventBus); } @@ -88,6 +92,7 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques HttpRequest.GET); HttpResponse httpResponse = httpTransport.doRequest(httpRequest); + recordAndSendUnAuthorizedEvent(httpResponse, address); if (httpResponse.getStatusCode() == HttpStatus.SC_OK) { Map> allConfigMap = HttpUtils.deserialize( httpResponse.getContent(), @@ -121,21 +126,17 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques } queryConfigurationsResponse.setConfigurations(configurations); queryConfigurationsResponse.setChanged(true); - addressManager.recordSuccessState(address); return queryConfigurationsResponse; } else if (httpResponse.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) { queryConfigurationsResponse.setChanged(false); - addressManager.recordSuccessState(address); return queryConfigurationsResponse; } else if (httpResponse.getStatusCode() == HttpStatus.SC_TOO_MANY_REQUESTS) { LOGGER.warn("rate limited, keep the local dimension [{}] configs unchanged.", dimensionsInfo); queryConfigurationsResponse.setChanged(false); - addressManager.recordSuccessState(address); return queryConfigurationsResponse; } else if (httpResponse.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { throw new OperationException("Bad request for query configurations."); } else { - addressManager.recordFailState(address); throw new OperationException( "read response failed. status:" + httpResponse.getStatusCode() @@ -151,6 +152,16 @@ public QueryConfigurationsResponse queryConfigurations(QueryConfigurationsReques } } + private void recordAndSendUnAuthorizedEvent(HttpResponse response, String address) { + if (this.eventBus != null && response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { + LOGGER.warn("query configuration unauthorized from server [{}], message [{}]", address, response.getMessage()); + addressManager.recordFailState(address); + this.eventBus.post(new UnAuthorizedOperationEvent(address)); + } else { + addressManager.recordSuccessState(address); + } + } + /** * Only the name of the new configuration item is printed. * No log is printed when the configuration content is updated. diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java index 2ab93254791..b98a7d3b2a1 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/KieClient.java @@ -46,6 +46,7 @@ import org.apache.servicecomb.http.client.common.HttpResponse; import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpUtils; +import org.apache.servicecomb.http.client.event.OperationEvents.UnAuthorizedOperationEvent; import org.apache.servicecomb.http.client.utils.ServiceCombServiceAvailableUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -71,6 +72,8 @@ public class KieClient implements KieConfigOperation { private final Map> dimensionConfigNames = new HashMap<>(); + private EventBus eventBus; + public KieClient(KieAddressManager addressManager, HttpTransport httpTransport, KieConfiguration kieConfiguration) { this.httpTransport = httpTransport; this.addressManager = addressManager; @@ -78,6 +81,7 @@ public KieClient(KieAddressManager addressManager, HttpTransport httpTransport, } public void setEventBus(EventBus eventBus) { + this.eventBus = eventBus; addressManager.setEventBus(eventBus); } @@ -91,6 +95,7 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, HttpRequest httpRequest = new HttpRequest(url, null, null, HttpRequest.GET); HttpResponse httpResponse = httpTransport.doRequest(httpRequest); + recordAndSendUnAuthorizedEvent(httpResponse, address); ConfigurationsResponse configurationsResponse = new ConfigurationsResponse(); if (httpResponse.getStatusCode() == HttpStatus.SC_OK) { revision = httpResponse.getHeader("X-Kie-Revision"); @@ -100,7 +105,6 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, configurationsResponse.setConfigurations(configurations); configurationsResponse.setChanged(true); configurationsResponse.setRevision(revision); - addressManager.recordSuccessState(address); return configurationsResponse; } if (httpResponse.getStatusCode() == HttpStatus.SC_BAD_REQUEST) { @@ -108,16 +112,13 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, } if (httpResponse.getStatusCode() == HttpStatus.SC_NOT_MODIFIED) { configurationsResponse.setChanged(false); - addressManager.recordSuccessState(address); return configurationsResponse; } if (httpResponse.getStatusCode() == HttpStatus.SC_TOO_MANY_REQUESTS) { LOGGER.warn("rate limited, keep the local dimension [{}] configs unchanged.", request.getLabelsQuery()); configurationsResponse.setChanged(false); - addressManager.recordSuccessState(address); return configurationsResponse; } - addressManager.recordFailState(address); throw new OperationException( "read response failed. status:" + httpResponse.getStatusCode() + "; message:" + httpResponse.getMessage() + "; content:" + httpResponse.getContent()); @@ -128,6 +129,16 @@ public ConfigurationsResponse queryConfigurations(ConfigurationsRequest request, } } + private void recordAndSendUnAuthorizedEvent(HttpResponse response, String address) { + if (this.eventBus != null && response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { + LOGGER.warn("query configuration unauthorized from server [{}], message [{}]", address, response.getMessage()); + addressManager.recordFailState(address); + this.eventBus.post(new UnAuthorizedOperationEvent(address)); + } else { + addressManager.recordSuccessState(address); + } + } + /** * Only the name of the new configuration item is printed. * No log is printed when the configuration content is updated. diff --git a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java index 0742c11fb10..d8c069ee9b1 100644 --- a/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java +++ b/clients/config-kie-client/src/main/java/org/apache/servicecomb/config/kie/client/model/KieAddressManager.java @@ -27,8 +27,8 @@ public class KieAddressManager extends AbstractAddressManager { - public KieAddressManager(List addresses, EventBus eventBus) { - super(addresses); + public KieAddressManager(List addresses, EventBus eventBus, String region, String availableZone) { + super(addresses, region, availableZone); eventBus.register(this); } diff --git a/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/KieAddressManagerTest.java b/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/KieAddressManagerTest.java index 6533fc60e57..c8bf1f57a29 100644 --- a/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/KieAddressManagerTest.java +++ b/clients/config-kie-client/src/test/java/org/apache/servicecomb/config/kie/client/model/KieAddressManagerTest.java @@ -40,7 +40,7 @@ class KieAddressManagerTest { public void kieAddressManagerTest() throws NoSuchFieldException, IllegalAccessException { addresses.add("http://127.0.0.1:30103"); addresses.add("https://127.0.0.2:30103"); - addressManager1 = new KieAddressManager(addresses, new EventBus()); + addressManager1 = new KieAddressManager(addresses, new EventBus(), "", ""); Field addressManagerField = addressManager1.getClass().getSuperclass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager1, 0); @@ -64,7 +64,7 @@ public void onRefreshEndpointEvent() { Map> zoneAndRegion = new HashMap<>(); zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", addressRG); - addressManager1 = new KieAddressManager(addresses, new EventBus()); + addressManager1 = new KieAddressManager(addresses, new EventBus(), "", ""); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "KIE"); addressManager1.refreshEndpoint(event, "KIE"); diff --git a/clients/dashboard-client/src/main/java/org/apache/servicecomb/dashboard/client/DashboardAddressManager.java b/clients/dashboard-client/src/main/java/org/apache/servicecomb/dashboard/client/DashboardAddressManager.java index 9dd8c6a3448..6897e02acd4 100644 --- a/clients/dashboard-client/src/main/java/org/apache/servicecomb/dashboard/client/DashboardAddressManager.java +++ b/clients/dashboard-client/src/main/java/org/apache/servicecomb/dashboard/client/DashboardAddressManager.java @@ -29,8 +29,8 @@ public class DashboardAddressManager extends AbstractAddressManager { - public DashboardAddressManager(List addresses, EventBus eventBus) { - super(addresses); + public DashboardAddressManager(List addresses, EventBus eventBus, String region, String availableZone) { + super(addresses, region, availableZone); eventBus.register(this); } diff --git a/clients/dashboard-client/src/test/java/org/apache/servicecomb/dashboard/client/AddressManagerTest.java b/clients/dashboard-client/src/test/java/org/apache/servicecomb/dashboard/client/AddressManagerTest.java index 71e5deedaf7..fdb7a23922b 100644 --- a/clients/dashboard-client/src/test/java/org/apache/servicecomb/dashboard/client/AddressManagerTest.java +++ b/clients/dashboard-client/src/test/java/org/apache/servicecomb/dashboard/client/AddressManagerTest.java @@ -39,7 +39,7 @@ class AddressManagerTest { public void kieAddressManagerTest() throws IllegalAccessException, NoSuchFieldException { addresses.add("http://127.0.0.1:30103"); addresses.add("https://127.0.0.2:30103"); - addressManager1 = new DashboardAddressManager(addresses, new EventBus()); + addressManager1 = new DashboardAddressManager(addresses, new EventBus(), "", ""); Field addressManagerField = addressManager1.getClass().getSuperclass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager1, 0); @@ -63,7 +63,7 @@ public void onRefreshEndpointEvent() { Map> zoneAndRegion = new HashMap<>(); zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", addressRG); - addressManager1 = new DashboardAddressManager(addresses, new EventBus()); + addressManager1 = new DashboardAddressManager(addresses, new EventBus(), "", ""); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "CseMonitoring"); addressManager1.refreshEndpoint(event, "CseMonitoring"); diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java index 52db799f90c..3c5d6214be8 100644 --- a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/AbstractAddressManager.java @@ -17,6 +17,7 @@ package org.apache.servicecomb.http.client.common; +import java.net.URI; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -29,6 +30,7 @@ import org.apache.servicecomb.http.client.event.RefreshEndpointEvent; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.util.CollectionUtils; import com.google.common.annotations.VisibleForTesting; import com.google.common.eventbus.EventBus; @@ -42,6 +44,10 @@ public class AbstractAddressManager { private static final String V3_PREFIX = "/v3/"; + private static final String ZONE = "availableZone"; + + private static final String REGION = "region"; + private static final int ISOLATION_THRESHOLD = 3; private volatile List addresses = new ArrayList<>(); @@ -74,17 +80,63 @@ public class AbstractAddressManager { private EventBus eventBus; - public AbstractAddressManager(List addresses) { + public AbstractAddressManager(List addresses, String ownRegion, String ownAvailableZone) { this.projectName = DEFAULT_PROJECT; - this.addresses.addAll(addresses); - this.defaultAddress.addAll(addresses); + parseAndInitAddresses(addresses, ownRegion, ownAvailableZone, false); this.index = !addresses.isEmpty() ? getRandomIndex() : 0; } - public AbstractAddressManager(String projectName, List addresses) { + /** + * address support config with region/availableZone info, to enable engine affinity calls during startup + * address may be like: + * https://192.168.20.13:30110?region=region1&availableZone=az + * https://192.168.20.13:30100?region=region1&availableZone=az + * When address have no datacenter information, roundRobin using address + * + * @param addresses engine addresses + * @param ownRegion microservice region + * @param ownAvailableZone microservice zone + * @param isFormat is need format + */ + private void parseAndInitAddresses(List addresses, String ownRegion, String ownAvailableZone, + boolean isFormat) { + if (CollectionUtils.isEmpty(addresses)) { + return; + } + List tempList = new ArrayList<>(); + addressAutoRefreshed = addresses.stream().anyMatch(addr -> addr.contains(ZONE) || addr.contains(REGION)); + for (String address : addresses) { + // Compatible IpPortManager init address is 127.0.0.1:30100 + if (!address.startsWith("http")) { + tempList.add(address); + continue; + } + URLEndPoint endpoint = new URLEndPoint(address); + tempList.add(endpoint.toString()); + buildAffinityAddress(endpoint, ownRegion, ownAvailableZone); + } + this.addresses.addAll(isFormat ? this.transformAddress(tempList) : tempList); + this.defaultAddress.addAll(isFormat ? this.transformAddress(tempList) : tempList); + } + + private void buildAffinityAddress(URLEndPoint endpoint, String ownRegion, String ownAvailableZone) { + if (addressAutoRefreshed) { + if (regionAndAZMatch(ownRegion, ownAvailableZone, endpoint.getFirst(REGION), endpoint.getFirst(ZONE))) { + availableZone.add(endpoint.toString()); + } else { + availableRegion.add(endpoint.toString()); + } + } + } + + private boolean regionAndAZMatch(String ownRegion, String ownAvailableZone, String engineRegion, + String engineAvailableZone) { + return ownRegion.equalsIgnoreCase(engineRegion) && ownAvailableZone.equals(engineAvailableZone); + } + + public AbstractAddressManager(String projectName, List addresses, String ownRegion, String ownAvailableZone) { this.projectName = StringUtils.isEmpty(projectName) ? DEFAULT_PROJECT : projectName; - this.addresses = this.transformAddress(addresses); - this.defaultAddress.addAll(addresses); + parseAndInitAddresses(addresses, ownRegion, ownAvailableZone, true); this.index = !addresses.isEmpty() ? getRandomIndex() : 0; } @@ -271,4 +323,26 @@ public List getIsolationAddresses() { isolationAddresses.addAll(isolationRegionAddress); return isolationAddresses; } + + public String compareAndGetAddress(String host) { + for (String address : defaultAddress) { + if (isAddressHostSame(address, host)) { + return address; + } + } + return ""; + } + + private boolean isAddressHostSame(String address, String host) { + if (StringUtils.isEmpty(host)) { + return false; + } + try { + URI uri = new URI(address); + return host.equals(uri.getHost()); + } catch (Exception e) { + LOGGER.warn("Exception occurred while constructing URI using the address [{}]", address); + } + return false; + } } diff --git a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/HttpTransportImpl.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/HttpTransportImpl.java index da87892929c..507d8d1c556 100644 --- a/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/HttpTransportImpl.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/common/HttpTransportImpl.java @@ -18,17 +18,21 @@ package org.apache.servicecomb.http.client.common; import java.io.IOException; +import java.net.URI; import java.util.Map; import org.apache.http.client.HttpClient; import org.apache.http.util.EntityUtils; import org.apache.servicecomb.foundation.auth.SignRequest; import org.apache.servicecomb.http.client.auth.RequestAuthHeaderProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Created by on 2019/10/16. */ public class HttpTransportImpl implements HttpTransport { + private static final Logger LOGGER = LoggerFactory.getLogger(HttpTransportImpl.class); private static final String HEADER_CONTENT_TYPE = "Content-Type"; @@ -87,7 +91,7 @@ public HttpResponse doRequest(HttpRequest httpRequest) throws IOException { globalHeaders.forEach(httpRequest::addHeader); } - httpRequest.getHeaders().putAll(requestAuthHeaderProvider.loadAuthHeader(createSignRequest())); + httpRequest.getHeaders().putAll(requestAuthHeaderProvider.loadAuthHeader(createSignRequest(httpRequest.getUrl()))); //get Http response org.apache.http.HttpResponse response = httpClient.execute(httpRequest.getRealRequest()); @@ -98,9 +102,16 @@ public HttpResponse doRequest(HttpRequest httpRequest) throws IOException { response.getAllHeaders()); } - private static SignRequest createSignRequest() { - // Now the implementations do not process SignRequest, so return null. Maybe future will use it. - return null; + private static SignRequest createSignRequest(String url) { + try { + URI uri = URI.create(url); + SignRequest signRequest = new SignRequest(); + signRequest.setEndpoint(uri); + return signRequest; + } catch (Exception e) { + LOGGER.error("create signRequest failed!", e); + return null; + } } @Override diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/OperationEvents.java b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/event/OperationEvents.java similarity index 79% rename from clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/OperationEvents.java rename to clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/event/OperationEvents.java index 62274519ea4..69896f750ec 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/OperationEvents.java +++ b/clients/http-client-common/src/main/java/org/apache/servicecomb/http/client/event/OperationEvents.java @@ -15,10 +15,18 @@ * limitations under the License. */ -package org.apache.servicecomb.service.center.client; +package org.apache.servicecomb.http.client.event; public abstract class OperationEvents { public static class UnAuthorizedOperationEvent extends OperationEvents { + private final String address; + public UnAuthorizedOperationEvent(String address) { + this.address = address; + } + + public String getAddress() { + return address; + } } } diff --git a/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java b/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java index b831d032491..b14d6827cb8 100644 --- a/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java +++ b/clients/http-client-common/src/test/java/org/apache/servicecomb/http/client/common/AbstractAddressManagerTest.java @@ -46,9 +46,9 @@ public class AbstractAddressManagerTest { public void setUp() throws NoSuchFieldException, IllegalAccessException { addresses.add("http://127.0.0.1:30103"); addresses.add("https://127.0.0.2:30103"); - addressManager1 = new AbstractAddressManager(addresses); - addressManager2 = new AbstractAddressManager("project", addresses); - addressManager3 = new AbstractAddressManager(null, addresses); + addressManager1 = new AbstractAddressManager(addresses, "", ""); + addressManager2 = new AbstractAddressManager("project", addresses, "", ""); + addressManager3 = new AbstractAddressManager(null, addresses, "", ""); Field addressManagerField = addressManager1.getClass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager1, 0); @@ -88,7 +88,7 @@ public void recordStateTest() throws ExecutionException { zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", addressRG); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "TEST"); - AbstractAddressManager addressManager = new AbstractAddressManager(addresses) {}; + AbstractAddressManager addressManager = new AbstractAddressManager(addresses, "", "") {}; addressManager.refreshEndpoint(event, "TEST"); @@ -124,7 +124,7 @@ public void recordStateTest() throws ExecutionException { @Test public void testMultipleThread() throws Exception { - AbstractAddressManager addressManager = new AbstractAddressManager(addresses); + AbstractAddressManager addressManager = new AbstractAddressManager(addresses, "", ""); String address = "http://127.0.0.3:30100"; CountDownLatch latch = new CountDownLatch(2); @@ -302,4 +302,27 @@ public void normalizeIPV6Test() { uri = addressManager1.normalizeUri("rest://[2008::7:957f:b2d6:1af4:a1f8]:30100"); Assertions.assertEquals("http://[2008::7:957f:b2d6:1af4:a1f8]:30100", uri); } + + @Test + public void compareAndGetAddressTest() { + List testAddr = new ArrayList<>(); + testAddr.add("https://192.168.20.160:30100"); + testAddr.add("https://127.0.0.1:30100"); + testAddr.add("https://127.0.0.3:30100"); + AbstractAddressManager manager = new AbstractAddressManager(testAddr, "", ""); + Assertions.assertTrue(manager.compareAndGetAddress("192.168.20.16").isEmpty()); + Assertions.assertEquals("https://192.168.20.160:30100", manager.compareAndGetAddress("192.168.20.160")); + } + + @Test + public void AddressAffinityTest() { + List testAddr = new ArrayList<>(); + testAddr.add("https://192.168.20.160:30100?region=region1&availableZone=zone1"); + testAddr.add("https://127.0.0.1:30100"); + AbstractAddressManager manager = new AbstractAddressManager(testAddr, "region1", "zone1"); + Assertions.assertEquals("https://192.168.20.160:30100", manager.address()); + + AbstractAddressManager manager2 = new AbstractAddressManager("default", testAddr, "region1", "zone1"); + Assertions.assertEquals("https://192.168.20.160:30100", manager2.address()); + } } diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManager.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManager.java index a5fd128ab1e..b19db919e81 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManager.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManager.java @@ -26,8 +26,9 @@ import com.google.common.eventbus.Subscribe; public class ServiceCenterAddressManager extends AbstractAddressManager { - public ServiceCenterAddressManager(String projectName, List addresses, EventBus eventBus) { - super(projectName, addresses); + public ServiceCenterAddressManager(String projectName, List addresses, EventBus eventBus, String region, + String availableZone) { + super(projectName, addresses, region, availableZone); eventBus.register(this); } diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java index 407fb28ac9d..97aeaa9931a 100755 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterClient.java @@ -33,7 +33,6 @@ import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpTransportFactory; import org.apache.servicecomb.http.client.common.HttpUtils; -import org.apache.servicecomb.service.center.client.OperationEvents.UnAuthorizedOperationEvent; import org.apache.servicecomb.service.center.client.exception.OperationException; import org.apache.servicecomb.service.center.client.model.CreateMicroserviceInstanceRequest; import org.apache.servicecomb.service.center.client.model.CreateMicroserviceRequest; @@ -76,8 +75,6 @@ public class ServiceCenterClient implements ServiceCenterOperation { private final ServiceCenterRawClient httpClient; - private EventBus eventBus; - private final ServiceCenterAddressManager addressManager; public ServiceCenterClient(ServiceCenterRawClient httpClient, ServiceCenterAddressManager addressManager) { @@ -86,8 +83,8 @@ public ServiceCenterClient(ServiceCenterRawClient httpClient, ServiceCenterAddre } public ServiceCenterClient setEventBus(EventBus eventBus) { - this.eventBus = eventBus; addressManager.setEventBus(eventBus); + this.httpClient.setEventBus(eventBus); return this; } @@ -126,7 +123,6 @@ public MicroserviceInstancesResponse getServiceCenterInstances() { if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), MicroserviceInstancesResponse.class); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service-center instances fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -147,7 +143,6 @@ public RegisteredMicroserviceResponse registerMicroservice(Microservice microser if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), RegisteredMicroserviceResponse.class); } - sendUnAuthorizedEvent(response); throw new OperationException( "register service fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -165,7 +160,6 @@ public MicroservicesResponse getMicroserviceList() { if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), MicroservicesResponse.class); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service List fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -190,7 +184,6 @@ public RegisteredMicroserviceResponse queryServiceId(Microservice microservice) if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), RegisteredMicroserviceResponse.class); } - sendUnAuthorizedEvent(response); LOGGER.info("Query serviceId fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() + "; content = " + response.getContent()); @@ -213,7 +206,6 @@ public Microservice getMicroserviceByServiceId(String serviceId) { .deserialize(response.getContent(), MicroserviceResponse.class); return microserviceResponse.getService(); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service message fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -235,7 +227,6 @@ public RegisteredMicroserviceInstanceResponse registerMicroserviceInstance(Micro if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), RegisteredMicroserviceInstanceResponse.class); } - sendUnAuthorizedEvent(response); throw new OperationException( "register service instance fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -276,7 +267,6 @@ public FindMicroserviceInstancesResponse findMicroserviceInstance(String consume result.setModified(false); return result; } - sendUnAuthorizedEvent(response); throw new OperationException( "get service instances list fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -295,7 +285,6 @@ public MicroserviceInstancesResponse getMicroserviceInstanceList(String serviceI if (response.getStatusCode() == HttpStatus.SC_OK) { return HttpUtils.deserialize(response.getContent(), MicroserviceInstancesResponse.class); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service instances list fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -316,7 +305,6 @@ public MicroserviceInstance getMicroserviceInstance(String serviceId, String ins .deserialize(response.getContent(), MicroserviceInstanceResponse.class); return instanceResponse.getInstance(); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service instance message fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -336,7 +324,6 @@ public void deleteMicroserviceInstance(String serviceId, String instanceId) { LOGGER.info("Delete service instance successfully."); return; } - sendUnAuthorizedEvent(response); throw new OperationException( "delete service instance fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -356,7 +343,6 @@ public boolean updateMicroserviceInstanceStatus(String serviceId, String instanc if (response.getStatusCode() == HttpStatus.SC_OK) { return true; } - sendUnAuthorizedEvent(response); throw new OperationException( "update service instance status fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -375,7 +361,6 @@ public void sendHeartBeats(HeartbeatsRequest heartbeatsRequest) { if (response.getStatusCode() == HttpStatus.SC_OK) { return; } - sendUnAuthorizedEvent(response); throw new OperationException( "heartbeats fails, statusCode = " + response.getStatusCode() + "; message = " + response.getMessage() + "; content = " + response.getContent()); @@ -395,7 +380,6 @@ public boolean sendHeartBeat(String serviceId, String instanceId) { if (response.getStatusCode() == HttpStatus.SC_OK) { return true; } - sendUnAuthorizedEvent(response); throw new OperationException( "heartbeats fails, statusCode = " + response.getStatusCode() + "; message = " + response.getMessage() + "; content = " + response.getContent()); @@ -420,7 +404,6 @@ public List getServiceSchemasList(String serviceId, boolean withCont .deserialize(response.getContent(), GetSchemaListResponse.class); return getSchemaResponse.getSchemas(); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service schemas list fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -447,7 +430,6 @@ public String getServiceSchemaContext(String serviceId, String schemaId) { GetSchemaResponse getSchemaResponse = HttpUtils.deserialize(response.getContent(), GetSchemaResponse.class); return getSchemaResponse.getSchema(); } - sendUnAuthorizedEvent(response); throw new OperationException( "get service schema context fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -467,7 +449,6 @@ public boolean registerSchema(String serviceId, String schemaId, CreateSchemaReq if (response.getStatusCode() == HttpStatus.SC_OK) { return true; } - sendUnAuthorizedEvent(response); throw new OperationException( "update service schema fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -490,7 +471,6 @@ public boolean updateServiceSchemaContext(String serviceId, SchemaInfo schemaInf if (response.getStatusCode() == HttpStatus.SC_OK) { return true; } - sendUnAuthorizedEvent(response); throw new OperationException( "update service schema fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -510,7 +490,6 @@ public boolean batchUpdateServiceSchemaContext(String serviceId, ModifySchemasRe if (response.getStatusCode() == HttpStatus.SC_OK) { return true; } - sendUnAuthorizedEvent(response); throw new OperationException( "update service schema fails, statusCode = " + response.getStatusCode() + "; message = " + response .getMessage() @@ -521,18 +500,12 @@ public boolean batchUpdateServiceSchemaContext(String serviceId, ModifySchemasRe } } - private void sendUnAuthorizedEvent(HttpResponse response) { - if (this.eventBus != null && response.getStatusCode() == HttpStatus.SC_UNAUTHORIZED) { - this.eventBus.post(new UnAuthorizedOperationEvent()); - } - } - @Override - public RbacTokenResponse queryToken(RbacTokenRequest request) { + public RbacTokenResponse queryToken(RbacTokenRequest request, String host) { try { + String queryAddress = addressManager.compareAndGetAddress(host); HttpResponse response = httpClient - .postHttpRequestAbsoluteUrl("/v4/token", null, - HttpUtils.serialize(request)); + .postHttpRequestAbsoluteUrl("/v4/token", null, HttpUtils.serialize(request), queryAddress); if (response.getStatusCode() == HttpStatus.SC_OK) { RbacTokenResponse result = HttpUtils.deserialize(response.getContent(), RbacTokenResponse.class); result.setStatusCode(HttpStatus.SC_OK); @@ -573,7 +546,6 @@ public boolean updateMicroserviceProperties(String serviceId, Map headers, String content) - throws IOException { - return doHttpRequest(url, true, headers, content, HttpRequest.POST); + public HttpResponse postHttpRequestAbsoluteUrl(String url, Map headers, String content, + String address) throws IOException { + return doHttpRequest(url, true, headers, content, HttpRequest.POST, address); } public HttpResponse postHttpRequest(String url, Map headers, String content) throws IOException { - return doHttpRequest(url, false, headers, content, HttpRequest.POST); + return doHttpRequest(url, false, headers, content, HttpRequest.POST, ""); } public HttpResponse putHttpRequest(String url, Map headers, String content) throws IOException { - return doHttpRequest(url, false, headers, content, HttpRequest.PUT); + return doHttpRequest(url, false, headers, content, HttpRequest.PUT, ""); } public HttpResponse deleteHttpRequest(String url, Map headers, String content) throws IOException { - return doHttpRequest(url, false, headers, content, HttpRequest.DELETE); + return doHttpRequest(url, false, headers, content, HttpRequest.DELETE, ""); } private HttpResponse doHttpRequest(String url, boolean absoluteUrl, Map headers, String content, - String method) - throws IOException { - String address = addressManager.address(); + String method, String queryAddress) throws IOException { + String address = StringUtils.isEmpty(queryAddress) ? addressManager.address() : queryAddress; String formatUrl = addressManager.formatUrl(url, absoluteUrl, address); HttpRequest httpRequest = buildHttpRequest(formatUrl, headers, content, method); - + HttpResponse httpResponse; try { - HttpResponse httpResponse = httpTransport.doRequest(httpRequest); - addressManager.recordSuccessState(address); + httpResponse = httpTransport.doRequest(httpRequest); + recordAndSendUnAuthorizedEvent(httpResponse, address); return httpResponse; } catch (IOException e) { addressManager.recordFailState(address); @@ -87,7 +97,9 @@ private HttpResponse doHttpRequest(String url, boolean absoluteUrl, Map headers = new HashMap<>(); headers.put("x-domain-name", this.tenantName); headers.putAll(this.extraGlobalHeaders); - headers.putAll(this.requestAuthHeaderProvider.loadAuthHeader(null)); + headers.putAll(this.requestAuthHeaderProvider.loadAuthHeader(createSignRequest(address))); currentServerUri = convertAddress(address); LOGGER.info("start watch to address {}", currentServerUri); webSocketTransport = new WebSocketTransport(currentServerUri, sslProperties, @@ -122,6 +124,17 @@ private void startWatch() { }); } + private SignRequest createSignRequest(String url) { + try { + URI uri = URI.create(url); + SignRequest signRequest = new SignRequest(); + signRequest.setEndpoint(uri); + return signRequest; + } catch (Exception e) { + return null; + } + } + private String convertAddress(String address) { String url = String.format(WATCH, project, serviceId); if (address.startsWith(HTTP)) { diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManagerTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManagerTest.java index f5c316cd848..a2888cfad1b 100644 --- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManagerTest.java +++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterAddressManagerTest.java @@ -41,7 +41,7 @@ class ServiceCenterAddressManagerTest { @Test public void getUrlPrefix() { addresses.add("http://127.0.0.1:30103"); - addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus()); + addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus(), "", ""); Assertions.assertNotNull(addressManager1); @@ -55,7 +55,7 @@ public void getUrlPrefix() { @Test public void formatUrlTest() { addresses.add("http://127.0.0.1:30103"); - addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus()); + addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus(), "", ""); Assertions.assertNotNull(addressManager1); String address = addressManager1.address(); @@ -76,7 +76,7 @@ public void onRefreshEndpointEvent() { Map> zoneAndRegion = new HashMap<>(); zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", addressRG); - addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus()); + addressManager1 = new ServiceCenterAddressManager("project", addresses, new EventBus(), "", ""); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "SERVICECENTER"); addressManager1.refreshEndpoint(event, "SERVICECENTER"); diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java index 6143953f3db..c486b2bd6ce 100755 --- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java +++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterClientTest.java @@ -53,7 +53,7 @@ public class ServiceCenterClientTest { public ServiceCenterClientTest() { this.addressManager = new ServiceCenterAddressManager("default", Arrays.asList("http://127.0.0.1:30100"), - new EventBus()); + new EventBus(), "", ""); } @Test diff --git a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClientTest.java b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClientTest.java index 29337e31a44..48f3bd914c6 100755 --- a/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClientTest.java +++ b/clients/service-center-client/src/test/java/org/apache/servicecomb/service/center/client/ServiceCenterRawClientTest.java @@ -41,7 +41,8 @@ public class ServiceCenterRawClientTest { public void TestDefaultParameter() throws IOException { HttpTransport httpTransport = Mockito.mock(HttpTransport.class); - ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager(PROJECT_NAME, Arrays.asList("http://127.0.0.1:30100"), new EventBus()); + ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager(PROJECT_NAME, + Arrays.asList("http://127.0.0.1:30100"), new EventBus(), "", ""); ServiceCenterRawClient client = new ServiceCenterRawClient.Builder() .setHttpTransport(httpTransport) .setAddressManager(addressManager) diff --git a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java index 50ae96db158..3b11e0582d8 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java +++ b/demo/demo-multi-service-center/demo-multi-service-center-client/src/main/java/org/apache/servicecomb/demo/multiServiceCenterClient/RegistryClientTest.java @@ -69,8 +69,8 @@ public RegistryClientTest(Environment environment) { @Override public void testRestTransport() throws Exception { - ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager("default", Arrays.asList("http://127.0.0.1:30100"), - new EventBus()); + ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager("default", + Arrays.asList("http://127.0.0.1:30100"), new EventBus(), "", ""); SSLProperties sslProperties = new SSLProperties(); sslProperties.setEnabled(false); ServiceCenterClient serviceCenterClient = new ServiceCenterClient(addressManager, sslProperties, diff --git a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java index d1130317ece..23c0a7af196 100644 --- a/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java +++ b/dynamic-config/config-cc/src/main/java/org/apache/servicecomb/config/cc/ConfigCenterDynamicPropertiesSource.java @@ -69,7 +69,7 @@ private void init(Environment environment) { ConfigCenterConfig configCenterConfig = new ConfigCenterConfig(environment); configConverter = new ConfigConverter(configCenterConfig.getFileSources()); - ConfigCenterAddressManager configCenterAddressManager = configCenterAddressManager(configCenterConfig); + ConfigCenterAddressManager configCenterAddressManager = configCenterAddressManager(configCenterConfig, environment); HttpTransport httpTransport = createHttpTransport(configCenterAddressManager, buildRequestConfig(configCenterConfig), environment, configCenterConfig); @@ -176,16 +176,18 @@ private HttpTransport createHttpTransport(ConfigCenterAddressManager configCente private static RequestAuthHeaderProvider getRequestAuthHeaderProvider(List authHeaderProviders) { return signRequest -> { + String host = signRequest != null && signRequest.getEndpoint() != null ? signRequest.getEndpoint().getHost() : ""; Map headers = new HashMap<>(); - authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders())); + authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders(host))); return headers; }; } - private ConfigCenterAddressManager configCenterAddressManager(ConfigCenterConfig configCenterConfig) { + private ConfigCenterAddressManager configCenterAddressManager(ConfigCenterConfig configCenterConfig, Environment environment) { + String region = environment.getProperty("servicecomb.datacenter.region"); + String availableZone = environment.getProperty("servicecomb.datacenter.availableZone"); return new ConfigCenterAddressManager(configCenterConfig.getDomainName(), - configCenterConfig.getServerUri(), - EventManager.getEventBus()); + configCenterConfig.getServerUri(), EventManager.getEventBus(), region, availableZone); } @Override diff --git a/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterAddressManagerTest.java b/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterAddressManagerTest.java index 1642d11ff55..50d39bc19db 100644 --- a/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterAddressManagerTest.java +++ b/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterAddressManagerTest.java @@ -41,8 +41,8 @@ class ConfigCenterAddressManagerTest { public void addressManagerTest() throws NoSuchFieldException, IllegalAccessException { addresses.add("http://127.0.0.1:30103"); addresses.add("https://127.0.0.2:30103"); - addressManager1 = new ConfigCenterAddressManager("project", addresses, new EventBus()); - addressManager2 = new ConfigCenterAddressManager(null, addresses, new EventBus()); + addressManager1 = new ConfigCenterAddressManager("project", addresses, new EventBus(), "", ""); + addressManager2 = new ConfigCenterAddressManager(null, addresses, new EventBus(), "", ""); Field addressManagerField = addressManager1.getClass().getSuperclass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager1, 0); @@ -71,7 +71,7 @@ public void onRefreshEndpointEvent() { Map> zoneAndRegion = new HashMap<>(); zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", addressRG); - addressManager1 = new ConfigCenterAddressManager("project", addresses, new EventBus()); + addressManager1 = new ConfigCenterAddressManager("project", addresses, new EventBus(), "", ""); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "CseConfigCenter"); addressManager1.refreshEndpoint(event, "CseConfigCenter"); diff --git a/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterConfigurationSourceImplTest.java b/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterConfigurationSourceImplTest.java index f9424c9a2f2..3298d95bb19 100644 --- a/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterConfigurationSourceImplTest.java +++ b/dynamic-config/config-cc/src/test/java/org/apache/servicecomb/config/cc/ConfigCenterConfigurationSourceImplTest.java @@ -36,7 +36,8 @@ void configAddressManagerTest() throws IllegalAccessException, NoSuchFieldExcept List addresses = new ArrayList<>(); addresses.add("http://127.0.0.1:30103"); addresses.add("http://127.0.0.2:30103"); - ConfigCenterAddressManager addressManager = new ConfigCenterAddressManager("test", addresses, EventManager.getEventBus()); + ConfigCenterAddressManager addressManager = new ConfigCenterAddressManager("test", addresses, + EventManager.getEventBus(), "", ""); Field addressManagerField = addressManager.getClass().getSuperclass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager, 0); @@ -47,7 +48,7 @@ void configAddressManagerTest() throws IllegalAccessException, NoSuchFieldExcept address = addressManager.address(); Assertions.assertEquals("http://127.0.0.1:30103/v3/test", address); - addressManager = new ConfigCenterAddressManager(null, addresses, EventManager.getEventBus()); + addressManager = new ConfigCenterAddressManager(null, addresses, EventManager.getEventBus(), "", ""); addressManagerField = addressManager.getClass().getSuperclass().getDeclaredField("index"); addressManagerField.setAccessible(true); addressManagerField.set(addressManager, 0); @@ -65,7 +66,8 @@ void onRefreshEndpointEventTest() { zoneAndRegion.put("sameZone", addressAZ); zoneAndRegion.put("sameRegion", new ArrayList<>()); RefreshEndpointEvent event = new RefreshEndpointEvent(zoneAndRegion, "CseConfigCenter"); - ConfigCenterAddressManager addressManager = new ConfigCenterAddressManager("test", addresses, EventManager.getEventBus()); + ConfigCenterAddressManager addressManager = new ConfigCenterAddressManager("test", addresses, + EventManager.getEventBus(), "", ""); addressManager.onRefreshEndpointEvent(event); List availableAZ = addressManager.getAvailableZone(); diff --git a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java index e9819f6746f..6683b84fb09 100644 --- a/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java +++ b/dynamic-config/config-kie/src/main/java/org/apache/servicecomb/config/kie/KieDynamicPropertiesSource.java @@ -71,7 +71,7 @@ public KieDynamicPropertiesSource() { private void init(Environment environment) { KieConfig kieConfig = new KieConfig(environment); configConverter = new ConfigConverter(kieConfig.getFileSources()); - KieAddressManager kieAddressManager = configKieAddressManager(kieConfig); + KieAddressManager kieAddressManager = configKieAddressManager(kieConfig, environment); RequestConfig.Builder requestBuilder = buildRequestConfigBuilder(kieConfig); if (kieConfig.enableLongPolling() @@ -161,15 +161,18 @@ private HttpTransport createHttpTransport(KieAddressManager kieAddressManager, private static RequestAuthHeaderProvider getRequestAuthHeaderProvider(List authHeaderProviders) { return signRequest -> { + String host = signRequest != null && signRequest.getEndpoint() != null ? signRequest.getEndpoint().getHost() : ""; Map headers = new HashMap<>(); - authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders())); + authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders(host))); return headers; }; } - private KieAddressManager configKieAddressManager(KieConfig kieConfig) { + private KieAddressManager configKieAddressManager(KieConfig kieConfig, Environment environment) { + String region = environment.getProperty("servicecomb.datacenter.region"); + String availableZone = environment.getProperty("servicecomb.datacenter.availableZone"); return new KieAddressManager( - Arrays.asList(kieConfig.getServerUri().split(",")), EventManager.getEventBus()); + Arrays.asList(kieConfig.getServerUri().split(",")), EventManager.getEventBus(), region, availableZone); } @Override diff --git a/foundations/foundation-spi/src/main/java/org/apache/servicecomb/foundation/auth/AuthHeaderProvider.java b/foundations/foundation-spi/src/main/java/org/apache/servicecomb/foundation/auth/AuthHeaderProvider.java index 313c19ee5ba..0e036e21a58 100644 --- a/foundations/foundation-spi/src/main/java/org/apache/servicecomb/foundation/auth/AuthHeaderProvider.java +++ b/foundations/foundation-spi/src/main/java/org/apache/servicecomb/foundation/auth/AuthHeaderProvider.java @@ -21,11 +21,21 @@ import java.util.Map; public interface AuthHeaderProvider { - default Map authHeaders() { + /** + * Obtain RBAC authentication request header, host is the key of cache + * + * @param host engine address ip + * @return auth headers + */ + default Map authHeaders(String host) { return new HashMap<>(0); } default Map getSignAuthHeaders(SignRequest request) { - return authHeaders(); + String host = ""; + if (request != null && request.getEndpoint() != null) { + host = request.getEndpoint().getHost(); + } + return authHeaders(host); } } diff --git a/huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/DefaultMonitorDataPublisher.java b/huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/DefaultMonitorDataPublisher.java index cd7d2fc10fe..1209d9d8532 100644 --- a/huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/DefaultMonitorDataPublisher.java +++ b/huawei-cloud/dashboard/src/main/java/org/apache/servicecomb/huaweicloud/dashboard/monitor/DefaultMonitorDataPublisher.java @@ -84,8 +84,10 @@ private DashboardAddressManager createDashboardAddressManager() { if (addresses.isEmpty()) { throw new IllegalStateException("dashboard address is not configured."); } + String region = environment.getProperty("servicecomb.datacenter.region"); + String availableZone = environment.getProperty("servicecomb.datacenter.availableZone"); - return new DashboardAddressManager(addresses, EventManager.getEventBus()); + return new DashboardAddressManager(addresses, EventManager.getEventBus(), region, availableZone); } private HttpTransport createHttpTransport(DashboardAddressManager addressManager, RequestConfig requestConfig, @@ -120,8 +122,9 @@ private HttpTransport createHttpTransport(DashboardAddressManager addressManager private static RequestAuthHeaderProvider getRequestAuthHeaderProvider(List authHeaderProviders) { return signRequest -> { + String host = signRequest != null && signRequest.getEndpoint() != null ? signRequest.getEndpoint().getHost() : ""; Map headers = new HashMap<>(); - authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders())); + authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders(host))); return headers; }; } diff --git a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java index 7f18cbb6125..007e3e56c96 100644 --- a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java +++ b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/RBACBootStrapService.java @@ -42,6 +42,7 @@ import org.apache.servicecomb.http.client.common.HttpConfiguration.SSLProperties; import org.apache.servicecomb.http.client.common.HttpTransport; import org.apache.servicecomb.http.client.common.HttpTransportFactory; +import org.apache.servicecomb.registry.sc.SCClientUtils; import org.apache.servicecomb.service.center.client.ServiceCenterAddressManager; import org.apache.servicecomb.service.center.client.ServiceCenterClient; import org.apache.servicecomb.service.center.client.ServiceCenterRawClient; @@ -128,8 +129,8 @@ Cipher getCipher(String cipherName) { } private ServiceCenterAddressManager createAddressManager(Environment environment) { - return new ServiceCenterAddressManager(getProjectName(environment), - getRBACAddressList(environment), EventManager.getEventBus()); + return SCClientUtils.createAddressManager(getProjectName(environment), getRBACAddressList(environment), + environment); } private SSLProperties createSSLProperties(Environment environment) { @@ -233,7 +234,7 @@ private String getProjectName(Environment environment) { } private List getRBACAddressList(Environment environment) { - String address = environment.getProperty(RBAC_ADDRESS, "http://127.0.0.1:30100)"); + String address = environment.getProperty(RBAC_ADDRESS, "http://127.0.0.1:30100"); return Arrays.asList(address.split(",")); } diff --git a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenAuthHeaderProvider.java b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenAuthHeaderProvider.java index 6698f99f83b..19bd550602b 100644 --- a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenAuthHeaderProvider.java +++ b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenAuthHeaderProvider.java @@ -26,8 +26,8 @@ public class TokenAuthHeaderProvider implements AuthHeaderProvider { @Override - public Map authHeaders() { - String token = TokenCacheManager.getInstance().getToken(RBACBootStrapService.DEFAULT_REGISTRY_NAME); + public Map authHeaders(String host) { + String token = TokenCacheManager.getInstance().getToken(host); if (StringUtils.isEmpty(token)) { return new HashMap<>(); } diff --git a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenCacheManager.java b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenCacheManager.java index 205f3738166..b4510bb4238 100644 --- a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenCacheManager.java +++ b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/TokenCacheManager.java @@ -17,19 +17,16 @@ package org.apache.servicecomb.huaweicloud.servicestage; +import java.net.URI; import java.util.Map; -import java.util.Objects; -import java.util.Optional; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.TimeUnit; import org.apache.commons.lang3.StringUtils; import org.apache.servicecomb.foundation.auth.Cipher; -import org.apache.servicecomb.foundation.common.concurrent.ConcurrentHashMapEx; import org.apache.servicecomb.foundation.common.event.EventManager; -import org.apache.servicecomb.http.client.event.EngineConnectChangedEvent; -import org.apache.servicecomb.service.center.client.OperationEvents; +import org.apache.servicecomb.http.client.event.OperationEvents; import org.apache.servicecomb.service.center.client.ServiceCenterClient; import org.apache.servicecomb.service.center.client.model.RbacTokenRequest; import org.apache.servicecomb.service.center.client.model.RbacTokenResponse; @@ -55,17 +52,15 @@ public final class TokenCacheManager { private static final TokenCacheManager INSTANCE = new TokenCacheManager(); - - private final Map tokenCacheMap; - private Map serviceCenterClients; + private TokenCache tokenCache; + public static TokenCacheManager getInstance() { return INSTANCE; } private TokenCacheManager() { - tokenCacheMap = new ConcurrentHashMapEx<>(); } public void setServiceCenterClients(Map serviceCenterClients) { @@ -73,24 +68,17 @@ public void setServiceCenterClients(Map serviceCent } public void addTokenCache(String registryName, String accountName, String password, Cipher cipher) { - Objects.requireNonNull(registryName, "registryName should not be null!"); - if (tokenCacheMap.containsKey(registryName)) { - LOGGER.warn("duplicate token cache registration for serviceRegistry[{}]", registryName); - return; - } - - tokenCacheMap.put(registryName, new TokenCache(registryName, accountName, password, cipher)); + tokenCache = new TokenCache(registryName, accountName, password, cipher); } - public String getToken(String registryName) { - return Optional.ofNullable(tokenCacheMap.get(registryName)) - .map(TokenCache::getToken) - .orElse(null); + public String getToken(String host) { + if (tokenCache == null) { + return null; + } + return tokenCache.getToken(host); } public class TokenCache { - private static final String UN_AUTHORIZED_CODE_HALF_OPEN = "401302"; - private static final long TOKEN_REFRESH_TIME_IN_SECONDS = 20 * 60 * 1000; private final String registryName; @@ -105,10 +93,6 @@ public class TokenCache { private final Cipher cipher; - private int lastStatusCode; - - private String lastErrorCode; - public TokenCache(String registryName, String accountName, String password, Cipher cipher) { this.registryName = registryName; @@ -128,17 +112,17 @@ public void run() { } }); cache = CacheBuilder.newBuilder() - .maximumSize(1) + .maximumSize(10) .refreshAfterWrite(refreshTime(), TimeUnit.MILLISECONDS) .build(new CacheLoader() { @Override public String load(String key) throws Exception { - return createHeaders(); + return createHeaders(key); } @Override public ListenableFuture reload(String key, String oldValue) throws Exception { - return Futures.submit(() -> createHeaders(), executorService); + return Futures.submit(() -> createHeaders(key), executorService); } }); EventManager.getEventBus().register(this); @@ -147,21 +131,22 @@ public ListenableFuture reload(String key, String oldValue) throws Excep @Subscribe public void onNotPermittedEvent(OperationEvents.UnAuthorizedOperationEvent event) { - this.executorService.submit(() -> { - if (lastStatusCode == Status.UNAUTHORIZED.getStatusCode() && UN_AUTHORIZED_CODE_HALF_OPEN - .equals(lastErrorCode)) { - cache.refresh(registryName); - } - }); + LOGGER.warn("address {} unAuthorized, refresh cache token!", event.getAddress()); + cache.refresh(getHostByAddress(event.getAddress())); } - @Subscribe - public void onEngineConnectChangedEvent(EngineConnectChangedEvent event) { - cache.refresh(registryName); + private String getHostByAddress(String address) { + try { + URI uri = URI.create(address); + return uri.getHost(); + } catch (Exception e) { + LOGGER.error("get host by address [{}] error!", address, e); + return registryName; + } } - private String createHeaders() { - LOGGER.info("start to create RBAC headers"); + private String createHeaders(String host) { + LOGGER.info("start to create RBAC headers for host: {}", host); ServiceCenterClient serviceCenterClient = serviceCenterClients.get(this.registryName); @@ -169,10 +154,7 @@ private String createHeaders() { request.setName(accountName); request.setPassword(new String(cipher.decrypt(password.toCharArray()))); - RbacTokenResponse rbacTokenResponse = serviceCenterClient.queryToken(request); - - this.lastStatusCode = rbacTokenResponse.getStatusCode(); - this.lastErrorCode = rbacTokenResponse.getErrorCode(); + RbacTokenResponse rbacTokenResponse = serviceCenterClient.queryToken(request, host); if (Status.UNAUTHORIZED.getStatusCode() == rbacTokenResponse.getStatusCode() || Status.FORBIDDEN.getStatusCode() == rbacTokenResponse.getStatusCode()) { @@ -185,8 +167,14 @@ private String createHeaders() { LOGGER.warn("service center do not support RBAC token, you should not config account info"); return INVALID_TOKEN; } + if (Status.INTERNAL_SERVER_ERROR.getStatusCode() == rbacTokenResponse.getStatusCode()) { + // return null for server_error, so the token information can be re-fetched on the next call. + // It will prompt 'CacheLoader returned null for key xxx' + LOGGER.warn("service center query RBAC token error!"); + return null; + } - LOGGER.info("refresh token successfully {}", rbacTokenResponse.getStatusCode()); + LOGGER.info("refresh host [{}] token successfully {}", host, rbacTokenResponse.getStatusCode()); return rbacTokenResponse.getToken(); } @@ -194,13 +182,16 @@ protected long refreshTime() { return TOKEN_REFRESH_TIME_IN_SECONDS; } - public String getToken() { + public String getToken(String host) { if (!enabled()) { return null; } - + String address = host; + if (StringUtils.isEmpty(address)) { + address = registryName; + } try { - return cache.get(registryName); + return cache.get(address); } catch (Exception e) { LOGGER.error("failed to create token", e); return null; diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java index c650d068bcd..1c8ec27c8a8 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCAddressManager.java @@ -49,14 +49,14 @@ public enum Type { private static final Logger LOGGER = LoggerFactory.getLogger(SCAddressManager.class); - private boolean initialized = false; - private final ServiceCenterClient serviceCenterClient; private final SCRegistration scRegistration; private final SCConfigurationProperties configurationProperties; + private final Map> lastEngineEndpointsCache = new HashMap<>(); + public SCAddressManager(SCConfigurationProperties configurationProperties, ServiceCenterClient serviceCenterClient, SCRegistration scRegistration) { @@ -68,9 +68,6 @@ public SCAddressManager(SCConfigurationProperties configurationProperties, @Subscribe public void onHeartBeatEvent(HeartBeatEvent event) { - if (initialized) { - return; - } if (event.isSuccess() && configurationProperties.isAutoDiscovery()) { for (Type type : Type.values()) { initEndPort(type.name()); @@ -79,19 +76,30 @@ public void onHeartBeatEvent(HeartBeatEvent event) { } private void initEndPort(String key) { - List instances = findServiceInstance("default", - key, "0+"); - if ("SERVICECENTER".equals(key) && !instances.isEmpty()) { - initialized = true; - } - Map> zoneAndRegion = generateZoneAndRegionAddress(instances); + List instances = findServiceInstance("default", key, "0+"); + HashSet currentEngineEndpoints = new HashSet<>(); + Map> zoneAndRegion = generateZoneAndRegionAddress(instances, currentEngineEndpoints); if (zoneAndRegion == null) { return; } - EventManager.post(new RefreshEndpointEvent(zoneAndRegion, key)); + if (isEngineEndpointsChanged(lastEngineEndpointsCache.get(key), currentEngineEndpoints)) { + LOGGER.info("auto discovery service [{}] addresses: [{}]", key, zoneAndRegion); + lastEngineEndpointsCache.put(key, currentEngineEndpoints); + EventManager.post(new RefreshEndpointEvent(zoneAndRegion, key)); + } + } + + private boolean isEngineEndpointsChanged(Set lastEngineEndpoints, Set currentEngineEndpoints) { + if (lastEngineEndpoints == null || lastEngineEndpoints.isEmpty()) { + return true; + } + HashSet compareTemp = new HashSet<>(lastEngineEndpoints); + compareTemp.removeAll(currentEngineEndpoints); + return !compareTemp.isEmpty() || lastEngineEndpoints.size() != currentEngineEndpoints.size(); } - private Map> generateZoneAndRegionAddress(List instances) { + private Map> generateZoneAndRegionAddress(List instances, + HashSet currentEngineEndpoints) { if (instances.isEmpty()) { return null; } @@ -107,6 +115,7 @@ private Map> generateZoneAndRegionAddress(List(sameZone)); zoneAndRegion.put("sameRegion", new ArrayList<>(sameRegion)); diff --git a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java index 4d29de05a2c..f9371926a1d 100644 --- a/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java +++ b/service-registry/registry-service-center/src/main/java/org/apache/servicecomb/registry/sc/SCClientUtils.java @@ -17,9 +17,12 @@ package org.apache.servicecomb.registry.sc; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.apache.http.HttpHost; import org.apache.http.auth.AuthScope; @@ -50,16 +53,62 @@ public class SCClientUtils { private static final Logger LOGGER = LoggerFactory.getLogger(SCClientUtils.class); - public static ServiceCenterAddressManager createAddressManager(SCConfigurationProperties discoveryProperties) { + // Compatible chassis multi-registration center + private static final Map serviceAddressManagers = new ConcurrentHashMap<>(); + + public static ServiceCenterAddressManager createAddressManager(SCConfigurationProperties discoveryProperties, + Environment environment) { List addresses = ConfigUtil.parseArrayValue(discoveryProperties.getAddress()); - LOGGER.info("initialize discovery server={}", addresses); - return new ServiceCenterAddressManager("default", addresses, EventManager.getEventBus()); + return createAddressManager("default", addresses, environment); + } + + /** + * Ensure that the ServiceCenterAddressManager in the client created for RBAC authentication and registry discovery + * is the same. This ensures that when an error is reported due to the registry center address being unavailable, + * the authentication and registry discovery remain consistent. + * + * @param projectName projectName + * @param addresses engine address + * @param environment environment + * @return Service Center Address Manager + */ + public static ServiceCenterAddressManager createAddressManager(String projectName, List addresses, + Environment environment) { + if (getServiceCenterAddressManager(addresses) == null) { + synchronized (SCClientUtils.class) { + if (getServiceCenterAddressManager(addresses) == null) { + String key = String.join(",", addresses); + LOGGER.info("initialize discovery server={}", addresses); + String region = environment.getProperty("servicecomb.datacenter.region"); + String availableZone = environment.getProperty("servicecomb.datacenter.availableZone"); + ServiceCenterAddressManager addressManager = new ServiceCenterAddressManager(projectName, addresses, + EventManager.getEventBus(), region, availableZone); + serviceAddressManagers.put(key, addressManager); + return addressManager; + } + } + } + return getServiceCenterAddressManager(addresses); + } + + private static ServiceCenterAddressManager getServiceCenterAddressManager(List addresses) { + String forwardKey = String.join(",", addresses); + List tempAddr = new ArrayList<>(addresses); + Collections.reverse(tempAddr); + String reverseKey = String.join(",", tempAddr); + if (serviceAddressManagers.get(forwardKey) != null) { + return serviceAddressManagers.get(forwardKey); + } + if (serviceAddressManagers.get(reverseKey) != null) { + return serviceAddressManagers.get(reverseKey); + } + return null; } // add other headers needed for registration by new ServiceCenterClient(...) public static ServiceCenterClient serviceCenterClient(SCConfigurationProperties discoveryProperties, Environment environment) { - ServiceCenterAddressManager addressManager = createAddressManager(discoveryProperties); + ServiceCenterAddressManager addressManager = createAddressManager(discoveryProperties, environment); SSLProperties sslProperties = buildSslProperties(addressManager, environment); @@ -135,7 +184,7 @@ private static SSLProperties buildSslProperties(ServiceCenterAddressManager addr public static ServiceCenterWatch serviceCenterWatch(SCConfigurationProperties discoveryProperties, List authHeaderProviders, Environment environment) { - ServiceCenterAddressManager addressManager = createAddressManager(discoveryProperties); + ServiceCenterAddressManager addressManager = createAddressManager(discoveryProperties, environment); SSLProperties sslProperties = buildSslProperties(addressManager, environment); return new ServiceCenterWatch(addressManager, sslProperties, getRequestAuthHeaderProvider(authHeaderProviders), "default", new HashMap<>(), EventManager.getEventBus()); @@ -143,8 +192,9 @@ public static ServiceCenterWatch serviceCenterWatch(SCConfigurationProperties di private static RequestAuthHeaderProvider getRequestAuthHeaderProvider(List authHeaderProviders) { return signRequest -> { + String host = signRequest != null && signRequest.getEndpoint() != null ? signRequest.getEndpoint().getHost() : ""; Map headers = new HashMap<>(); - authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders())); + authHeaderProviders.forEach(provider -> headers.putAll(provider.authHeaders(host))); return headers; }; } From 309a9bc55ba99cf1b5affeead5c591029e329f97 Mon Sep 17 00:00:00 2001 From: Caimo Date: Mon, 1 Dec 2025 11:16:00 +0800 Subject: [PATCH 191/223] =?UTF-8?q?fix=20bug=20JsonPropertyIntrospector?= =?UTF-8?q?=E5=A4=84=E7=90=86record=E7=B1=BB=E5=9E=8B=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=80=BC=E6=97=B6=EF=BC=8C=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8=20#4983=20(#5012)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: QIURC --- .../JsonPropertyIntrospector.java | 6 ++-- .../generator/core/TestSwaggerUtils.java | 34 +++++++++++++++++-- .../generator/core/pojo/TestTypeClass.java | 34 +++++++++++++++++++ .../generator/core/pojo/TestTypeEnumLang.java | 22 ++++++++++++ .../generator/core/pojo/TestTypeRecord.java | 25 ++++++++++++++ 5 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeClass.java create mode 100644 swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeEnumLang.java create mode 100644 swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeRecord.java diff --git a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/extend/introspector/JsonPropertyIntrospector.java b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/extend/introspector/JsonPropertyIntrospector.java index bf647c15b64..4e377b81a11 100644 --- a/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/extend/introspector/JsonPropertyIntrospector.java +++ b/swagger/swagger-generator/generator-core/src/main/java/org/apache/servicecomb/swagger/extend/introspector/JsonPropertyIntrospector.java @@ -26,6 +26,8 @@ import io.swagger.v3.core.jackson.SwaggerAnnotationIntrospector; +import java.util.Objects; + public class JsonPropertyIntrospector extends SwaggerAnnotationIntrospector { private static final long serialVersionUID = 4157263023893695762L; @@ -47,10 +49,10 @@ public String findEnumValue(Enum value) { @Override public String findPropertyDescription(Annotated annotated) { Class enumClass = annotated.getRawType(); - if (enumClass.isEnum()) { + if (enumClass.isEnum() && Objects.nonNull(annotated.getAnnotated())) { return SwaggerEnum.JDK.findPropertyDescription(enumClass, annotated.getAnnotated().getAnnotations()); } - if (EnumUtils.isDynamicEnum(enumClass)) { + if (EnumUtils.isDynamicEnum(enumClass) && Objects.nonNull(annotated.getAnnotated())) { return SwaggerEnum.DYNAMIC.findPropertyDescription(enumClass, annotated.getAnnotated().getAnnotations()); } diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestSwaggerUtils.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestSwaggerUtils.java index 6a138dc42f1..7611a3f80a7 100644 --- a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestSwaggerUtils.java +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestSwaggerUtils.java @@ -28,11 +28,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.logging.Logger; import org.apache.servicecomb.foundation.common.utils.ReflectUtils; import org.apache.servicecomb.swagger.SwaggerUtils; import org.apache.servicecomb.swagger.generator.SwaggerConst; import org.apache.servicecomb.swagger.generator.SwaggerGeneratorUtils; +import org.apache.servicecomb.swagger.generator.core.pojo.TestTypeClass; +import org.apache.servicecomb.swagger.generator.core.pojo.TestTypeRecord; import org.apache.servicecomb.swagger.generator.core.pojo.TestType1; import org.apache.servicecomb.swagger.generator.core.pojo.TestType2; import org.apache.servicecomb.swagger.generator.core.schema.RepeatOperation; @@ -50,6 +53,7 @@ @SuppressWarnings("rawtypes") public class TestSwaggerUtils { + Logger LOGGER = Logger.getLogger(TestSwaggerUtils.class.getName()); @Test public void testSchemaMethod() { @@ -117,12 +121,24 @@ private static class AllTypeTest2 { Map t3; TestType2[] t4; + + } + + private static class AllTypeTest3{ + TestTypeRecord t5; + } + private static class AllTypeTest4{ + TestTypeClass t5; } @Test public void testAddDefinitions() { - Field[] fields1 = AllTypeTest1.class.getDeclaredFields(); - Field[] fields2 = AllTypeTest2.class.getDeclaredFields(); + testAllType(AllTypeTest1.class, AllTypeTest2.class); + } + + private void testAllType(Class clazz1, Class clazz2) { + Field[] fields1 = clazz1.getDeclaredFields(); + Field[] fields2 = clazz2.getDeclaredFields(); for (Field value : fields1) { for (Field field : fields2) { if (value.isSynthetic() || field.isSynthetic()) { @@ -132,12 +148,18 @@ public void testAddDefinitions() { testExcep(value.getGenericType(), field.getGenericType()); fail("IllegalArgumentException expected"); } catch (IllegalArgumentException e) { + LOGGER.warning(value.getGenericType() + " " + field.getGenericType() + " " + e.getMessage()); MatcherAssert.assertThat(e.getMessage(), containsString("duplicate param model:")); } } } } + @Test + public void testAddDefinitionsWithRecord() { + testAllType(AllTypeTest3.class, AllTypeTest4.class); + } + private void testExcep(Type f1, Type f2) { OpenAPI swagger = new OpenAPI(); SwaggerUtils.resolveTypeSchemas(swagger, f1); @@ -161,5 +183,13 @@ public void test_resolve_type_schemas_correct() { // should be ObjectSchema but swagger is not. //
 Assertions.assertTrue(schema instanceof ObjectSchema) 
Assertions.assertEquals("object", schema.getType()); + + openAPI = new OpenAPI(); + schema = SwaggerUtils.getSchema(openAPI, SwaggerUtils.resolveTypeSchemas(openAPI, TestTypeClass.class)); // resolve reference + Assertions.assertEquals("object", schema.getType()); + + openAPI = new OpenAPI(); + schema = SwaggerUtils.getSchema(openAPI, SwaggerUtils.resolveTypeSchemas(openAPI, TestTypeRecord.class)); // resolve reference + Assertions.assertEquals("object", schema.getType()); } } diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeClass.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeClass.java new file mode 100644 index 00000000000..b00a4433480 --- /dev/null +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeClass.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.swagger.generator.core.pojo; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "YYY") +public class TestTypeClass { + @Schema(description = "language") + private TestTypeEnumLang testTypeEnumLang; + + public TestTypeEnumLang getTestTypeEnumLang() { + return testTypeEnumLang; + } + + public void setTestTypeEnumLang(TestTypeEnumLang testTypeEnumLang) { + this.testTypeEnumLang = testTypeEnumLang; + } +} diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeEnumLang.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeEnumLang.java new file mode 100644 index 00000000000..515f45c7bb1 --- /dev/null +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeEnumLang.java @@ -0,0 +1,22 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.swagger.generator.core.pojo; + +public enum TestTypeEnumLang { + JAVA, CHINESE, UNKNOWN; +} diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeRecord.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeRecord.java new file mode 100644 index 00000000000..c61cc0913eb --- /dev/null +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/pojo/TestTypeRecord.java @@ -0,0 +1,25 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.servicecomb.swagger.generator.core.pojo; + +import io.swagger.v3.oas.annotations.media.Schema; + +@Schema(name = "YYY") +public record TestTypeRecord( + @Schema(description = "language") TestTypeEnumLang testTypeEnumLang) { +} From 22265f120679f22c41658356aad734e5c72ff40d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 16:44:36 +0800 Subject: [PATCH 192/223] Bump io.fabric8:docker-maven-plugin from 0.46.0 to 0.48.0 (#5038) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 843de273dcf..e7a0a6ca59f 100644 --- a/pom.xml +++ b/pom.xml @@ -47,7 +47,7 @@ 3.6.0 4.3.0 12.1.8 - 0.46.0 + 0.48.0 3.6.2 3.2.8 0.8.14 From e7f253e1a0fd9a948b97421ffa66a2d8fee430b6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:22:47 +0800 Subject: [PATCH 193/223] Bump actions/checkout from 5 to 6 (#5021) Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/checkstyle.yml | 2 +- .github/workflows/linelint.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/rat_check.yml | 2 +- .github/workflows/typo_check.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index f053c895b31..e5e7309b4eb 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up jdk uses: actions/setup-java@v5 with: diff --git a/.github/workflows/linelint.yml b/.github/workflows/linelint.yml index faeafb66c98..49bafa7587f 100644 --- a/.github/workflows/linelint.yml +++ b/.github/workflows/linelint.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: install linelint run: cargo install linelint-cli - name: Run linelint check diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0dc1b24c8ba..2d4e9baf653 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -32,7 +32,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up jdk uses: actions/setup-java@v5 with: diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml index fc345147062..4abcc944778 100644 --- a/.github/workflows/rat_check.yml +++ b/.github/workflows/rat_check.yml @@ -31,7 +31,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: Set up jdk uses: actions/setup-java@v5 with: diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml index e33de91eb50..745e63447df 100644 --- a/.github/workflows/typo_check.yml +++ b/.github/workflows/typo_check.yml @@ -28,7 +28,7 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 # To run the typo check locally, you can follow these steps: # 1. Install typos locally using cargo: # cargo install typos-cli From be0e2ee2a4a30162595cb19c16e1e55b6797b7b2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:23:59 +0800 Subject: [PATCH 194/223] Bump commons-io:commons-io from 2.20.0 to 2.21.0 (#5035) Bumps [commons-io:commons-io](https://github.com/apache/commons-io) from 2.20.0 to 2.21.0. - [Changelog](https://github.com/apache/commons-io/blob/master/RELEASE-NOTES.txt) - [Commits](https://github.com/apache/commons-io/compare/rel/commons-io-2.20.0...rel/commons-io-2.21.0) --- updated-dependencies: - dependency-name: commons-io:commons-io dependency-version: 2.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 438f6aeefd2..70ce6c64252 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -36,7 +36,7 @@ 4.3.0 6.3.0 1.11.0 - 2.20.0 + 2.21.0 2.6 3.19.0 1.3.5 From d1335a7302572b928adb19f1cdb8a265bd42ad62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:24:33 +0800 Subject: [PATCH 195/223] Bump io.swagger.core.v3:swagger-core-jakarta from 2.2.38 to 2.2.41 (#5034) Bumps io.swagger.core.v3:swagger-core-jakarta from 2.2.38 to 2.2.41. --- updated-dependencies: - dependency-name: io.swagger.core.v3:swagger-core-jakarta dependency-version: 2.2.41 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 70ce6c64252..593862a9eee 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -84,7 +84,7 @@ 6.0.0 1.7.36 2.5 - 2.2.38 + 2.2.41 5.0.1 3.5.1 3.4.0 From 4e482239de22ba0dd19bf321cf7006c2b9cf17c7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:24:42 +0800 Subject: [PATCH 196/223] Bump jersey.version from 3.1.4 to 4.0.0 (#5033) Bumps `jersey.version` from 3.1.4 to 4.0.0. Updates `org.glassfish.jersey.core:jersey-common` from 3.1.4 to 4.0.0 Updates `org.glassfish.jersey.core:jersey-client` from 3.1.4 to 4.0.0 --- updated-dependencies: - dependency-name: org.glassfish.jersey.core:jersey-common dependency-version: 4.0.0 dependency-type: direct:production update-type: version-update:semver-major - dependency-name: org.glassfish.jersey.core:jersey-client dependency-version: 4.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 593862a9eee..9132e78de20 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -58,7 +58,7 @@ 1.3.2 1 1.5 - 3.1.4 + 4.0.0 1.34 4.13.2 5.13.4 From 7de1f7691e870b8bd56e6d593b5ba07b86de0a00 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:24:53 +0800 Subject: [PATCH 197/223] Bump com.puppycrawl.tools:checkstyle from 12.1.1 to 12.2.0 (#5032) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.1.1 to 12.2.0. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.1.1...checkstyle-12.2.0) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 12.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e7a0a6ca59f..0e5f015b316 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 12.1.1 + 12.2.0 3.1.1 3.21.0 3.3.0 From a12776783ee34f3be613e34a6420f8e33376ea5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:25:02 +0800 Subject: [PATCH 198/223] Bump com.github.spotbugs:spotbugs-maven-plugin from 4.9.4.0 to 4.9.8.2 (#5028) Bumps [com.github.spotbugs:spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.9.4.0 to 4.9.8.2. - [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases) - [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.9.4.0...spotbugs-maven-plugin-4.9.8.2) --- updated-dependencies: - dependency-name: com.github.spotbugs:spotbugs-maven-plugin dependency-version: 4.9.8.2 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 0e5f015b316..38f86b6748e 100644 --- a/pom.xml +++ b/pom.xml @@ -66,7 +66,7 @@ 3.1.1 3.21.0 3.3.0 - 4.9.4.0 + 4.9.8.2 3.5.4 3.5.4 From f7f880650d119866e18f7843a6873b04374e5eea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:25:13 +0800 Subject: [PATCH 199/223] Bump hibernate-validator.version from 9.0.1.Final to 9.1.0.Final (#5027) Bumps `hibernate-validator.version` from 9.0.1.Final to 9.1.0.Final. Updates `org.hibernate.validator:hibernate-validator` from 9.0.1.Final to 9.1.0.Final - [Release notes](https://github.com/hibernate/hibernate-validator/releases) - [Changelog](https://github.com/hibernate/hibernate-validator/blob/main/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-validator/compare/9.0.1.Final...9.1.0.Final) Updates `org.hibernate.validator:hibernate-validator-annotation-processor` from 9.0.1.Final to 9.1.0.Final - [Release notes](https://github.com/hibernate/hibernate-validator/releases) - [Changelog](https://github.com/hibernate/hibernate-validator/blob/main/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-validator/compare/9.0.1.Final...9.1.0.Final) --- updated-dependencies: - dependency-name: org.hibernate.validator:hibernate-validator dependency-version: 9.1.0.Final dependency-type: direct:production update-type: version-update:semver-minor - dependency-name: org.hibernate.validator:hibernate-validator-annotation-processor dependency-version: 9.1.0.Final dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 9132e78de20..6416bb6a40e 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -50,7 +50,7 @@ 5.1.0 1.3 2.2.2 - 9.0.1.Final + 9.1.0.Final 4.5.14 1.5.18 2.20.1 From 82d83a0c2f7d6ed72c265758ab67d7e5b38aa904 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:25:21 +0800 Subject: [PATCH 200/223] Bump org.owasp:dependency-check-maven from 12.1.8 to 12.1.9 (#5026) Bumps [org.owasp:dependency-check-maven](https://github.com/dependency-check/DependencyCheck) from 12.1.8 to 12.1.9. - [Release notes](https://github.com/dependency-check/DependencyCheck/releases) - [Changelog](https://github.com/dependency-check/DependencyCheck/blob/main/CHANGELOG.md) - [Commits](https://github.com/dependency-check/DependencyCheck/compare/v12.1.8...v12.1.9) --- updated-dependencies: - dependency-name: org.owasp:dependency-check-maven dependency-version: 12.1.9 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 38f86b6748e..cad85a1269e 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.1.8 + 12.1.9 0.48.0 3.6.2 3.2.8 From 4fa6f5c8aa91765c805cebae05cb0339f4de28de Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:26:05 +0800 Subject: [PATCH 201/223] Bump io.micrometer:micrometer-bom from 1.15.5 to 1.16.0 (#5022) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.15.5 to 1.16.0. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.15.5...v1.16.0) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-version: 1.16.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 6416bb6a40e..4c7de5e6df3 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.2 3.9.11 - 1.15.5 + 1.16.0 5.20.0 5.2.0 5.15.0 From 2474c6b26b7a996b0dc90947d5d70a86a08e6025 Mon Sep 17 00:00:00 2001 From: Peizhao Mei Date: Fri, 19 Dec 2025 19:38:24 -0600 Subject: [PATCH 202/223] [#5017] Fix `swagger/swagger-generator/generator-core` OD tests (#5018) * Fix swagger generator core OD tests * Refactor to use PER_CLASS lifecycle to improve CI performance --- .../swagger/generator/core/TestApiResponse.java | 13 +++++++++++-- .../generator/core/TestOperationGenerator.java | 12 ++++++++++-- .../OperationMethodAnnotationProcessorTest.java | 12 ++++++++++-- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestApiResponse.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestApiResponse.java index 58e1ebeb77f..e39b3bbf858 100644 --- a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestApiResponse.java +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestApiResponse.java @@ -21,7 +21,9 @@ import org.apache.servicecomb.swagger.generator.core.model.SwaggerOperations; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import io.swagger.v3.oas.annotations.headers.Header; import io.swagger.v3.oas.annotations.media.Content; @@ -30,11 +32,18 @@ import io.swagger.v3.oas.annotations.responses.ApiResponses; import jakarta.ws.rs.core.MediaType; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestApiResponse { - static SwaggerOperations swaggerOperations = SwaggerOperations.generate(ApiResponseAnnotation.class); + + SwaggerOperations swaggerOperations; + + @BeforeAll + public void setUp() { + swaggerOperations = SwaggerOperations.generate(ApiResponseAnnotation.class); + } @AfterAll - public static void teardown() { + public void tearDown() { swaggerOperations = null; } diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestOperationGenerator.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestOperationGenerator.java index f238e91ff34..b46b9bb8327 100644 --- a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestOperationGenerator.java +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/TestOperationGenerator.java @@ -27,7 +27,9 @@ import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.Operation; @@ -39,11 +41,17 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class TestOperationGenerator { - static SwaggerOperations swaggerOperations = SwaggerOperations.generate(TestClass.class); + SwaggerOperations swaggerOperations; + + @BeforeAll + public void setUp() { + swaggerOperations = SwaggerOperations.generate(TestClass.class); + } @AfterAll - public static void teardown() { + public void tearDown() { swaggerOperations = null; } diff --git a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/OperationMethodAnnotationProcessorTest.java b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/OperationMethodAnnotationProcessorTest.java index e164a97cadf..fdc3cea273e 100644 --- a/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/OperationMethodAnnotationProcessorTest.java +++ b/swagger/swagger-generator/generator-core/src/test/java/org/apache/servicecomb/swagger/generator/core/processor/annotation/OperationMethodAnnotationProcessorTest.java @@ -28,7 +28,9 @@ import org.hamcrest.Matchers; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.media.Content; @@ -41,11 +43,17 @@ import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.core.MediaType; +@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class OperationMethodAnnotationProcessorTest { - static SwaggerOperations swaggerOperations = SwaggerOperations.generate(TestClass.class); + SwaggerOperations swaggerOperations; + + @BeforeAll + public void setUp() { + swaggerOperations = SwaggerOperations.generate(TestClass.class); + } @AfterAll - public static void teardown() { + public void tearDown() { swaggerOperations = null; } From 2fb48f68b08d2becd8fd26c912be5ab1a4c5e4c8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:19:51 +0800 Subject: [PATCH 203/223] Bump actions/cache from 4 to 5 (#5043) Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2d4e9baf653..da24a10a3e9 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -42,7 +42,7 @@ jobs: uses: stCarolas/setup-maven@v5 with: maven-version: 3.9.9 - - uses: actions/cache@v4 + - uses: actions/cache@v5 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From 6a0592fa44497e37848e181ca8739e8af30c2204 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:20:00 +0800 Subject: [PATCH 204/223] Bump org.apache.maven:maven-model from 3.9.11 to 3.9.12 (#5046) Bumps org.apache.maven:maven-model from 3.9.11 to 3.9.12. --- updated-dependencies: - dependency-name: org.apache.maven:maven-model dependency-version: 3.9.12 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 4c7de5e6df3..7376c7999b8 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -64,7 +64,7 @@ 5.13.4 1.2.17 2.25.2 - 3.9.11 + 3.9.12 1.16.0 5.20.0 5.2.0 From 5b7453be3964448b71b064f1f8bef251c7f72458 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:20:14 +0800 Subject: [PATCH 205/223] Bump com.puppycrawl.tools:checkstyle from 12.2.0 to 12.3.1 (#5051) Bumps [com.puppycrawl.tools:checkstyle](https://github.com/checkstyle/checkstyle) from 12.2.0 to 12.3.1. - [Release notes](https://github.com/checkstyle/checkstyle/releases) - [Commits](https://github.com/checkstyle/checkstyle/compare/checkstyle-12.2.0...checkstyle-12.3.1) --- updated-dependencies: - dependency-name: com.puppycrawl.tools:checkstyle dependency-version: 12.3.1 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index cad85a1269e..c902c61190f 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,7 @@ 0.6.1 3.19.2 1.47.0 - 12.2.0 + 12.3.1 3.1.1 3.21.0 3.3.0 From 2a5c1189dd28f170a1581ee9a89b1079dd0bc8e3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:20:22 +0800 Subject: [PATCH 206/223] Bump org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0 (#5053) Bumps org.apache.commons:commons-lang3 from 3.19.0 to 3.20.0. --- updated-dependencies: - dependency-name: org.apache.commons:commons-lang3 dependency-version: 3.20.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 7376c7999b8..410dde23d70 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -38,7 +38,7 @@ 1.11.0 2.21.0 2.6 - 3.19.0 + 3.20.0 1.3.5 1.14.0 5.9.0 From 01472ab60e2108cece0c9c1e5a97a7369187f8af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 3 Jan 2026 10:20:40 +0800 Subject: [PATCH 207/223] Bump org.apache.commons:commons-text from 1.14.0 to 1.15.0 (#5057) Bumps [org.apache.commons:commons-text](https://github.com/apache/commons-text) from 1.14.0 to 1.15.0. - [Changelog](https://github.com/apache/commons-text/blob/master/RELEASE-NOTES.txt) - [Commits](https://github.com/apache/commons-text/compare/rel/commons-text-1.14.0...rel/commons-text-1.15.0) --- updated-dependencies: - dependency-name: org.apache.commons:commons-text dependency-version: 1.15.0 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 410dde23d70..f66fe7d57cd 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -40,7 +40,7 @@ 2.6 3.20.0 1.3.5 - 1.14.0 + 1.15.0 5.9.0 1.0.3 3.0.2 From 2f136f746b5b13ea65d57cf2f475341ea2d5850c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Jan 2026 22:45:07 +0800 Subject: [PATCH 208/223] Bump log4j2.version from 2.25.2 to 2.25.3 (#5047) Bumps `log4j2.version` from 2.25.2 to 2.25.3. Updates `org.apache.logging.log4j:log4j-api` from 2.25.2 to 2.25.3 Updates `org.apache.logging.log4j:log4j-core` from 2.25.2 to 2.25.3 Updates `org.apache.logging.log4j:log4j-slf4j-impl` from 2.25.2 to 2.25.3 --- updated-dependencies: - dependency-name: org.apache.logging.log4j:log4j-api dependency-version: 2.25.3 dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: org.apache.logging.log4j:log4j-core dependency-version: 2.25.3 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.apache.logging.log4j:log4j-slf4j-impl dependency-version: 2.25.3 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index f66fe7d57cd..35a6b1e1dca 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -63,7 +63,7 @@ 4.13.2 5.13.4 1.2.17 - 2.25.2 + 2.25.3 3.9.12 1.16.0 5.20.0 From 8e001276a2c023f180edab50a03191d4b2cfa594 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 6 Mar 2026 11:47:34 +0800 Subject: [PATCH 209/223] [#4907] fixed servicecomb.credentials.akskEnabled set false cannot close log issue (#5093) --- .github/workflows/maven.yml | 2 +- demo/demo-consul/consumer/pom.xml | 2 +- demo/demo-consul/gateway/pom.xml | 2 +- demo/demo-consul/provider/pom.xml | 2 +- demo/demo-crossapp/crossapp-server/pom.xml | 2 +- demo/demo-edge/authentication/pom.xml | 2 +- demo/demo-edge/business-1-1-0/pom.xml | 2 +- demo/demo-edge/business-1.0.0/pom.xml | 2 +- demo/demo-edge/business-2.0.0/pom.xml | 2 +- demo/demo-edge/edge-service/pom.xml | 2 +- demo/demo-etcd/consumer/pom.xml | 2 +- demo/demo-etcd/gateway/pom.xml | 2 +- demo/demo-etcd/provider/pom.xml | 2 +- demo/demo-filter/filter-client/pom.xml | 2 +- demo/demo-filter/filter-edge/pom.xml | 2 +- demo/demo-filter/filter-server/pom.xml | 2 +- demo/demo-jaxrs/jaxrs-server/pom.xml | 2 +- .../demo-local-registry-server/pom.xml | 2 +- .../demo-multi-registries-server/pom.xml | 2 +- .../demo-multi-service-center-serverA/pom.xml | 2 +- .../demo-multi-service-center-serverB/pom.xml | 2 +- demo/demo-multiple/multiple-server/pom.xml | 2 +- demo/demo-nacos/consumer/pom.xml | 2 +- demo/demo-nacos/gateway/pom.xml | 2 +- demo/demo-nacos/provider/pom.xml | 2 +- demo/demo-pojo/pojo-server/pom.xml | 2 +- .../demo-register-url-prefix-server/pom.xml | 2 +- .../demo-spring-boot-pojo-server/pom.xml | 2 +- .../demo-spring-boot-springmvc-server/pom.xml | 2 +- demo/demo-springmvc/springmvc-server/pom.xml | 2 +- .../demo-zeroconfig-registry-client/pom.xml | 2 +- .../demo-zeroconfig-registry-edge/pom.xml | 2 +- .../demo-zeroconfig-registry-server/pom.xml | 2 +- demo/demo-zookeeper/consumer/pom.xml | 2 +- demo/demo-zookeeper/gateway/pom.xml | 2 +- demo/demo-zookeeper/provider/pom.xml | 2 +- .../servicestage/AKSKAuthHeaderProvider.java | 11 ++++------- 37 files changed, 40 insertions(+), 43 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index da24a10a3e9..0d2676fe763 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -36,7 +36,7 @@ jobs: - name: Set up jdk uses: actions/setup-java@v5 with: - java-version: '17' + java-version: '17.0.8' distribution: 'temurin' - name: Set up Maven uses: stCarolas/setup-maven@v5 diff --git a/demo/demo-consul/consumer/pom.xml b/demo/demo-consul/consumer/pom.xml index 9c27c516e74..eccc75e41b1 100644 --- a/demo/demo-consul/consumer/pom.xml +++ b/demo/demo-consul/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-consul/gateway/pom.xml b/demo/demo-consul/gateway/pom.xml index 1934a4adfc5..1dad3860e7f 100644 --- a/demo/demo-consul/gateway/pom.xml +++ b/demo/demo-consul/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-consul/provider/pom.xml b/demo/demo-consul/provider/pom.xml index 7de7b7c268b..0986f9f4342 100644 --- a/demo/demo-consul/provider/pom.xml +++ b/demo/demo-consul/provider/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-crossapp/crossapp-server/pom.xml b/demo/demo-crossapp/crossapp-server/pom.xml index 28fc2672e9c..0207bdb7b20 100644 --- a/demo/demo-crossapp/crossapp-server/pom.xml +++ b/demo/demo-crossapp/crossapp-server/pom.xml @@ -58,7 +58,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-edge/authentication/pom.xml b/demo/demo-edge/authentication/pom.xml index 5f6d47f2a28..4849faf28fe 100644 --- a/demo/demo-edge/authentication/pom.xml +++ b/demo/demo-edge/authentication/pom.xml @@ -54,7 +54,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-edge/business-1-1-0/pom.xml b/demo/demo-edge/business-1-1-0/pom.xml index 19f1a19301a..1cef9b01cab 100644 --- a/demo/demo-edge/business-1-1-0/pom.xml +++ b/demo/demo-edge/business-1-1-0/pom.xml @@ -60,7 +60,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-edge/business-1.0.0/pom.xml b/demo/demo-edge/business-1.0.0/pom.xml index cc469f8a4ad..d7e35748fef 100644 --- a/demo/demo-edge/business-1.0.0/pom.xml +++ b/demo/demo-edge/business-1.0.0/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-edge/business-2.0.0/pom.xml b/demo/demo-edge/business-2.0.0/pom.xml index 0e1e926a16c..3500be47d75 100644 --- a/demo/demo-edge/business-2.0.0/pom.xml +++ b/demo/demo-edge/business-2.0.0/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-edge/edge-service/pom.xml b/demo/demo-edge/edge-service/pom.xml index 3302820f26c..31fdcff3874 100644 --- a/demo/demo-edge/edge-service/pom.xml +++ b/demo/demo-edge/edge-service/pom.xml @@ -60,7 +60,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-etcd/consumer/pom.xml b/demo/demo-etcd/consumer/pom.xml index 2b6f645a6fe..20a03319d43 100644 --- a/demo/demo-etcd/consumer/pom.xml +++ b/demo/demo-etcd/consumer/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-etcd/gateway/pom.xml b/demo/demo-etcd/gateway/pom.xml index 13e8d0f0496..0b52381a492 100644 --- a/demo/demo-etcd/gateway/pom.xml +++ b/demo/demo-etcd/gateway/pom.xml @@ -73,7 +73,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-etcd/provider/pom.xml b/demo/demo-etcd/provider/pom.xml index ba16384e363..8d8c005a1e1 100644 --- a/demo/demo-etcd/provider/pom.xml +++ b/demo/demo-etcd/provider/pom.xml @@ -83,7 +83,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-filter/filter-client/pom.xml b/demo/demo-filter/filter-client/pom.xml index 61800166564..6c39fb4f5ad 100644 --- a/demo/demo-filter/filter-client/pom.xml +++ b/demo/demo-filter/filter-client/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-filter/filter-edge/pom.xml b/demo/demo-filter/filter-edge/pom.xml index 06905af9887..798f7b7697e 100644 --- a/demo/demo-filter/filter-edge/pom.xml +++ b/demo/demo-filter/filter-edge/pom.xml @@ -71,7 +71,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-filter/filter-server/pom.xml b/demo/demo-filter/filter-server/pom.xml index 6729f2c16a7..b3f257fd875 100644 --- a/demo/demo-filter/filter-server/pom.xml +++ b/demo/demo-filter/filter-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-jaxrs/jaxrs-server/pom.xml b/demo/demo-jaxrs/jaxrs-server/pom.xml index acb758a9779..cc80ad1521c 100644 --- a/demo/demo-jaxrs/jaxrs-server/pom.xml +++ b/demo/demo-jaxrs/jaxrs-server/pom.xml @@ -72,7 +72,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-local-registry/demo-local-registry-server/pom.xml b/demo/demo-local-registry/demo-local-registry-server/pom.xml index ebf2a657bba..8832ac2dc8a 100644 --- a/demo/demo-local-registry/demo-local-registry-server/pom.xml +++ b/demo/demo-local-registry/demo-local-registry-server/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml index 37045fcb876..4a0b37f4433 100644 --- a/demo/demo-multi-registries/demo-multi-registries-server/pom.xml +++ b/demo/demo-multi-registries/demo-multi-registries-server/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml index af0caa4387b..ddfd3570a43 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverA/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml index 443a6a18fd9..66dfd58d9b4 100644 --- a/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml +++ b/demo/demo-multi-service-center/demo-multi-service-center-serverB/pom.xml @@ -66,7 +66,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-multiple/multiple-server/pom.xml b/demo/demo-multiple/multiple-server/pom.xml index daec9769db0..18c7ae19069 100644 --- a/demo/demo-multiple/multiple-server/pom.xml +++ b/demo/demo-multiple/multiple-server/pom.xml @@ -65,7 +65,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-nacos/consumer/pom.xml b/demo/demo-nacos/consumer/pom.xml index 3c98b25de2d..6dfe326f6a5 100644 --- a/demo/demo-nacos/consumer/pom.xml +++ b/demo/demo-nacos/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-nacos/gateway/pom.xml b/demo/demo-nacos/gateway/pom.xml index e0f6a6b7106..f76d407973a 100644 --- a/demo/demo-nacos/gateway/pom.xml +++ b/demo/demo-nacos/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-nacos/provider/pom.xml b/demo/demo-nacos/provider/pom.xml index 03c8e244494..a23bc1bb06f 100644 --- a/demo/demo-nacos/provider/pom.xml +++ b/demo/demo-nacos/provider/pom.xml @@ -68,7 +68,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-pojo/pojo-server/pom.xml b/demo/demo-pojo/pojo-server/pom.xml index 7909f04ed72..b0b673ef47e 100644 --- a/demo/demo-pojo/pojo-server/pom.xml +++ b/demo/demo-pojo/pojo-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml index b6bfa795ad1..2d34ae62051 100644 --- a/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml +++ b/demo/demo-register-url-prefix/demo-register-url-prefix-server/pom.xml @@ -61,7 +61,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml index e99b680a5ac..60761704af9 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-pojo-server/pom.xml @@ -63,7 +63,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml index 02bf3f89de3..efa0723b59a 100644 --- a/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml +++ b/demo/demo-spring-boot-transport/demo-spring-boot-springmvc-server/pom.xml @@ -58,7 +58,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-springmvc/springmvc-server/pom.xml b/demo/demo-springmvc/springmvc-server/pom.xml index 483e7a7b2d3..f88876261d6 100644 --- a/demo/demo-springmvc/springmvc-server/pom.xml +++ b/demo/demo-springmvc/springmvc-server/pom.xml @@ -62,7 +62,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml index af8f280b614..385bb4950a5 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-client/pom.xml @@ -73,7 +73,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml index bb739a1533a..c8dcb06893a 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-edge/pom.xml @@ -78,7 +78,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml index c1bb884c854..f69f1118a0a 100644 --- a/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml +++ b/demo/demo-zeroconfig-registry/demo-zeroconfig-registry-server/pom.xml @@ -74,7 +74,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zookeeper/consumer/pom.xml b/demo/demo-zookeeper/consumer/pom.xml index 22fc8894346..73fb82a25a3 100644 --- a/demo/demo-zookeeper/consumer/pom.xml +++ b/demo/demo-zookeeper/consumer/pom.xml @@ -64,7 +64,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zookeeper/gateway/pom.xml b/demo/demo-zookeeper/gateway/pom.xml index adaef43eee9..f2676b1ed6d 100644 --- a/demo/demo-zookeeper/gateway/pom.xml +++ b/demo/demo-zookeeper/gateway/pom.xml @@ -67,7 +67,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/demo/demo-zookeeper/provider/pom.xml b/demo/demo-zookeeper/provider/pom.xml index 8bfd598e98f..3b008bfb000 100644 --- a/demo/demo-zookeeper/provider/pom.xml +++ b/demo/demo-zookeeper/provider/pom.xml @@ -76,7 +76,7 @@ ${project.artifactId}:${project.version} ${project.artifactId} - openjdk:17.0.2 + eclipse-temurin:17-jre-jammy 7070 8080 diff --git a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/AKSKAuthHeaderProvider.java b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/AKSKAuthHeaderProvider.java index 98d71e6b298..e80e867cab4 100644 --- a/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/AKSKAuthHeaderProvider.java +++ b/huawei-cloud/servicestage/src/main/java/org/apache/servicecomb/huaweicloud/servicestage/AKSKAuthHeaderProvider.java @@ -19,6 +19,7 @@ import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -65,25 +66,21 @@ public class AKSKAuthHeaderProvider implements AuthHeaderProvider, BootStrapServ private final Map headers = new HashMap<>(); - private boolean enabled = true; - private boolean loaded = false; public AKSKAuthHeaderProvider() { } public Map authHeaders() { - if (enabled && !environment.getProperty(CONFIG_AKSK_ENABLED, boolean.class, true)) { - enabled = false; - return headers; + if (!environment.getProperty(CONFIG_AKSK_ENABLED, boolean.class, true)) { + return Collections.emptyMap(); } if (StringUtils.isEmpty(getAccessKey())) { LOGGER.warn("ak sk auth enabled but access key is not configured, disable it at runtime. " + "Config [{}] to false to disable it implicitly.", CONFIG_AKSK_ENABLED); - enabled = false; - return headers; + return Collections.emptyMap(); } if (!loaded) { From f06e825917c8b5bf823bf5b477524efb72a1be64 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:13:00 +0800 Subject: [PATCH 210/223] [#4902] not deleted cache to ensure that instances are available after the microservice and engine are recovered from exceptions (#5092) --- .../center/client/ServiceCenterDiscovery.java | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java index a0a93318403..0056ed7a898 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java @@ -17,8 +17,6 @@ package org.apache.servicecomb.service.center.client; -import java.io.IOException; -import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -156,13 +154,12 @@ public void onPullInstanceEvent(PullInstanceEvent event) { startTask(new PullInstanceOnceTask()); } - private List pullInstance(SubscriptionKey k, SubscriptionValue v, boolean sendChangedEvent) { + private void pullInstance(SubscriptionKey k, SubscriptionValue v, boolean sendChangedEvent) { if (myselfServiceId == null) { // registration not ready - return Collections.emptyList(); + return; } - List failedKeys = new ArrayList<>(); try { FindMicroserviceInstancesResponse instancesResponse = serviceCenterClient .findMicroserviceInstance(myselfServiceId, k.appId, k.serviceName, ALL_VERSION, v.revision); @@ -189,17 +186,9 @@ private List pullInstance(SubscriptionKey k, SubscriptionValue } } } catch (Exception e) { - if (!(e.getCause() instanceof IOException)) { - // for IOException, do not remove cache, or when service center - // not available, invocation between microservices will fail. - failedKeys.add(k); - LOGGER.error("find service {}#{} instance failed and remove local cache.", k.appId, k.serviceName, e); - } else { - LOGGER.warn("find service {}#{} instance failed, remaining local instances cache, cause message: {}", - k.appId, k.serviceName, e.getMessage()); - } + LOGGER.warn("find service {}#{} instance failed, remaining local instances cache [{}], cause message: {}", + k.appId, k.serviceName, instanceToString(v.instancesCache), e.getMessage()); } - return failedKeys; } private void setMicroserviceInfo(List instances) { @@ -245,13 +234,9 @@ public void execute() { } private synchronized void pullAllInstance() { - List failedInstances = new ArrayList<>(); - instancesCache.forEach((k, v) -> failedInstances.addAll(pullInstance(k, v, true))); - if (failedInstances.isEmpty()) { - return; - } - failedInstances.forEach(instancesCache::remove); - failedInstances.clear(); + instancesCache.forEach((k, v) -> { + pullInstance(k, v, true); + }); } private static String instanceToString(List instances) { @@ -265,6 +250,8 @@ private static String instanceToString(List instances) { sb.append(endpoint.length() > 64 ? endpoint.substring(0, 64) : endpoint); sb.append("|"); } + sb.append(instance.getStatus()); + sb.append("|"); } return sb.toString(); } From 86193739b58f1de5d6115d2c594e86f08f9a0cfb Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Fri, 6 Mar 2026 18:17:36 +0800 Subject: [PATCH 211/223] [#5015] Bump maven-compiler-plugin from 3.14.0 to 3.15.0 (#5094) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c902c61190f..951402d7e25 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 0.8.14 3.12.0 2.5 - 3.14.0 + 3.15.0 3.5.4 3.4.2 3.9.0 From 67464c9a10acebc1cb9e98d98d86b6fa30748883 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 09:05:11 +0800 Subject: [PATCH 212/223] [#5015] Bump vertx-dependencies from 5.0.1 to 5.0.8 (#5095) --- dependencies/default/pom.xml | 2 +- .../transport/rest/vertx/MockHttpServerResponse.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 35a6b1e1dca..c4553f83778 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -85,7 +85,7 @@ 1.7.36 2.5 2.2.41 - 5.0.1 + 5.0.8 3.5.1 3.4.0 0.8.5 diff --git a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java index e46d6c01bed..74a8307262b 100644 --- a/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java +++ b/transports/transport-rest/transport-rest-vertx/src/test/java/org/apache/servicecomb/transport/rest/vertx/MockHttpServerResponse.java @@ -17,6 +17,7 @@ package org.apache.servicecomb.transport.rest.vertx; +import java.io.RandomAccessFile; import java.nio.channels.FileChannel; import java.util.HashMap; import java.util.Map; @@ -222,6 +223,11 @@ public Future sendFile(FileChannel channel, long offset, long length) { return null; } + @Override + public Future sendFile(RandomAccessFile file, long offset, long length) { + return null; + } + @Override public boolean ended() { return false; From 012bc6eff95baae8ecbd8d2b27ffbd115975ef47 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 09:05:23 +0800 Subject: [PATCH 213/223] [#5015] Bump micrometer-bom from 1.16.0 to 1.16.3 (#5096) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index c4553f83778..c417feea70a 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.3 3.9.12 - 1.16.0 + 1.16.3 5.20.0 5.2.0 5.15.0 From 11daa7d25a3d3d36e8f0a19ceec09b90512b8f43 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 09:05:33 +0800 Subject: [PATCH 214/223] [#5015] Bump dependency-check-maven from 12.1.9 to 12.2.0 (#5097) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 951402d7e25..1af2fef2258 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 3.6.0 4.3.0 - 12.1.9 + 12.2.0 0.48.0 3.6.2 3.2.8 From 8d445f987fffe14f718c089e40687550037246c8 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:55:02 +0800 Subject: [PATCH 215/223] [#5015] Bump org.assertj:assertj-core from 3.27.6 to 3.27.7 (#5098) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index c417feea70a..e50855f50bf 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -32,7 +32,7 @@ 1.2.2 - 3.27.6 + 3.27.7 4.3.0 6.3.0 1.11.0 From 39f903018914ec97fec7f35fbcf0475aaaffc96c Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 15:55:12 +0800 Subject: [PATCH 216/223] [#5015] Bump org.codehaus.mojo:license-maven-plugin from 2.7.0 to 2.7.1 (#5099) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1af2fef2258..ffa1c7da8fc 100644 --- a/pom.xml +++ b/pom.xml @@ -199,7 +199,7 @@ org.codehaus.mojo license-maven-plugin - 2.7.0 + 2.7.1 default-cli From 720b03ba58e578311cbf180394014e5eb22b9362 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:54:45 +0800 Subject: [PATCH 217/223] [#5015] Bump org.mockito:mockito-bom from 5.20.0 to 5.21.0 (#5101) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index e50855f50bf..52c149719f2 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -66,7 +66,7 @@ 2.25.3 3.9.12 1.16.3 - 5.20.0 + 5.21.0 5.2.0 5.15.0 3.1.0 From ebb137034de1346df59e5dc7ce33d2b283c13bfe Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 16:54:58 +0800 Subject: [PATCH 218/223] [#5015] Bump org.codehaus.mojo:exec-maven-plugin from 3.6.2 to 3.6.3 (#5103) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ffa1c7da8fc..25882c4ca33 100644 --- a/pom.xml +++ b/pom.xml @@ -48,7 +48,7 @@ 4.3.0 12.2.0 0.48.0 - 3.6.2 + 3.6.3 3.2.8 0.8.14 3.12.0 From 9ff0939a1ea374d85a2a5e21552bfb0bca5afc34 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 20:20:13 +0800 Subject: [PATCH 219/223] [#5015] Bump io.etcd:jetcd-core from 0.8.5 to 0.8.6 (#5105) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 52c149719f2..45729c64fb7 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -88,7 +88,7 @@ 5.0.8 3.5.1 3.4.0 - 0.8.5 + 0.8.6 1.8.0 ${basedir}/../.. From 070b831e514b92b0a74bdabd9aa81f5a50a791cc Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 20:21:07 +0800 Subject: [PATCH 220/223] [#5015] Bump jersey.version from 4.0.0 to 4.0.2 (#5104) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 45729c64fb7..cbdb87fa75f 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -58,7 +58,7 @@ 1.3.2 1 1.5 - 4.0.0 + 4.0.2 1.34 4.13.2 5.13.4 From 1e9120f0593f3d1939ee4febd6d381d3d694e443 Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Mon, 9 Mar 2026 20:21:21 +0800 Subject: [PATCH 221/223] [#5015] Bump com.alibaba.nacos:nacos-client from 3.1.0 to 3.1.1 (#5102) --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index cbdb87fa75f..7797beb9ed9 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -69,7 +69,7 @@ 5.21.0 5.2.0 5.15.0 - 3.1.0 + 3.1.1 0.3.0 0.16.0 3.23.4 From ed86d043e89462f954ad415a6a48967204572074 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 3 Apr 2026 14:06:41 +0800 Subject: [PATCH 222/223] Bump io.micrometer:micrometer-bom from 1.16.3 to 1.16.4 (#5121) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.16.3 to 1.16.4. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.16.3...v1.16.4) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-version: 1.16.4 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dependencies/default/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dependencies/default/pom.xml b/dependencies/default/pom.xml index 7797beb9ed9..22f2190ddd1 100644 --- a/dependencies/default/pom.xml +++ b/dependencies/default/pom.xml @@ -65,7 +65,7 @@ 1.2.17 2.25.3 3.9.12 - 1.16.3 + 1.16.4 5.21.0 5.2.0 5.15.0 From ac4a6991e6334607b786607ad1e60638ff6ad4bf Mon Sep 17 00:00:00 2001 From: Alex <97039406+chengyouling@users.noreply.github.com> Date: Wed, 10 Jun 2026 15:44:12 +0800 Subject: [PATCH 223/223] [#5141] fixed latest instance information cannot be obtained when cache instances is empty problem. (#5143) --- .github/workflows/checkstyle.yml | 2 +- .github/workflows/linelint.yml | 2 +- .github/workflows/maven.yml | 2 +- .github/workflows/rat_check.yml | 2 +- .github/workflows/typo_check.yml | 2 +- .../service/center/client/ServiceCenterDiscovery.java | 7 +++++++ 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/checkstyle.yml b/.github/workflows/checkstyle.yml index e5e7309b4eb..3f97b9f1818 100644 --- a/.github/workflows/checkstyle.yml +++ b/.github/workflows/checkstyle.yml @@ -26,7 +26,7 @@ on: jobs: checkstyle: timeout-minutes: 60 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - name: Set up jdk diff --git a/.github/workflows/linelint.yml b/.github/workflows/linelint.yml index 49bafa7587f..8d5112ea3d6 100644 --- a/.github/workflows/linelint.yml +++ b/.github/workflows/linelint.yml @@ -26,7 +26,7 @@ on: jobs: linelint: timeout-minutes: 60 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - name: install linelint diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 0d2676fe763..24118c35c99 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -29,7 +29,7 @@ jobs: build: timeout-minutes: 60 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 diff --git a/.github/workflows/rat_check.yml b/.github/workflows/rat_check.yml index 4abcc944778..c2db2508fea 100644 --- a/.github/workflows/rat_check.yml +++ b/.github/workflows/rat_check.yml @@ -29,7 +29,7 @@ on: jobs: rat_check: timeout-minutes: 60 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 - name: Set up jdk diff --git a/.github/workflows/typo_check.yml b/.github/workflows/typo_check.yml index 745e63447df..999530a79f7 100644 --- a/.github/workflows/typo_check.yml +++ b/.github/workflows/typo_check.yml @@ -26,7 +26,7 @@ on: jobs: typo-check: timeout-minutes: 60 - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v6 # To run the typo check locally, you can follow these steps: diff --git a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java index 0056ed7a898..a1ab524c187 100644 --- a/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java +++ b/clients/service-center-client/src/main/java/org/apache/servicecomb/service/center/client/ServiceCenterDiscovery.java @@ -17,6 +17,7 @@ package org.apache.servicecomb.service.center.client; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; @@ -234,9 +235,15 @@ public void execute() { } private synchronized void pullAllInstance() { + List emptyInstancesCache = new ArrayList<>(); instancesCache.forEach((k, v) -> { pullInstance(k, v, true); + if (v.instancesCache.isEmpty()) { + emptyInstancesCache.add(k); + } }); + emptyInstancesCache.forEach(instancesCache::remove); + emptyInstancesCache.clear(); } private static String instanceToString(List instances) {