From 7220151ba74bcc7b24ac3b1286538d3983a5d75d Mon Sep 17 00:00:00 2001 From: QilongZhang Date: Thu, 11 Oct 2018 21:55:50 +0800 Subject: [PATCH] 2.5.0 Pre-Release (#239) * cherry pick 2.4.10 and 2.4.9 --- healthcheck-sofa-boot-starter/pom.xml | 2 +- .../configuration/HealthCheckConstants.java | 54 ++- .../sofa/healthcheck/core/HealthChecker.java | 3 - infra-sofa-boot-starter/pom.xml | 2 +- isle-sofa-boot-starter/pom.xml | 2 +- .../impl/AbstractDeploymentDescriptor.java | 18 +- .../health/SofaModuleHealthChecker.java | 15 +- .../isle/integration/IntegrationTest.java | 7 +- .../health/SofaModuleHealthCheckerTest.java | 70 ++++ pom.xml | 2 +- runtime-sofa-boot-plugin/pom.xml | 4 +- runtime-sofa-boot-starter/pom.xml | 2 +- .../health/SofaComponentHealthChecker.java | 15 +- .../runtime/integration/IntegrationTest.java | 7 +- .../SofaComponentHealthCheckerTest.java | 70 ++++ sofaboot-dependencies/pom.xml | 314 ------------------ sofaboot-samples/pom.xml | 2 +- .../sofaboot-sample-standard/pom.xml | 2 +- .../sofaboot-sample-with-isle/README.md | 2 +- .../sofaboot-sample-with-isle/pom.xml | 2 +- .../service-consumer/pom.xml | 2 +- .../service-facade/pom.xml | 2 +- .../service-provider/pom.xml | 2 +- .../sofa-boot-run/pom.xml | 2 +- .../sofaboot-sample-with-isolation/pom.xml | 2 +- .../sofaboot-sample-with-rpc/README.md | 2 +- .../sofaboot-sample-with-rpc/pom.xml | 2 +- sofaboot-samples/sofaboot-sample/pom.xml | 2 +- test-sofa-boot-starter/pom.xml | 2 +- 29 files changed, 252 insertions(+), 361 deletions(-) create mode 100644 isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthCheckerTest.java create mode 100644 runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthCheckerTest.java delete mode 100644 sofaboot-dependencies/pom.xml diff --git a/healthcheck-sofa-boot-starter/pom.xml b/healthcheck-sofa-boot-starter/pom.xml index b94ddefb6..c33bb1faf 100644 --- a/healthcheck-sofa-boot-starter/pom.xml +++ b/healthcheck-sofa-boot-starter/pom.xml @@ -22,7 +22,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml diff --git a/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/configuration/HealthCheckConstants.java b/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/configuration/HealthCheckConstants.java index 6d48c3ac9..13424c950 100644 --- a/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/configuration/HealthCheckConstants.java +++ b/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/configuration/HealthCheckConstants.java @@ -26,25 +26,65 @@ public class HealthCheckConstants { /** * skip all readiness check */ - public static final String SOFABOOT_SKIP_ALL_HEALTH_CHECK = "com.alipay.sofa.healthcheck.skip.all"; + public static final String SOFABOOT_SKIP_ALL_HEALTH_CHECK = "com.alipay.sofa.healthcheck.skip.all"; /** - * skip all {@link com.alipay.sofa.healthcheck.core.HealthChecker} readiness check + * skip all {@literal com.alipay.sofa.healthcheck.core.HealthChecker} readiness check */ - public static final String SOFABOOT_SKIP_COMPONENT_HEALTH_CHECK = "com.alipay.sofa.healthcheck.skip.component"; + public static final String SOFABOOT_SKIP_COMPONENT_HEALTH_CHECK = "com.alipay.sofa.healthcheck.skip.component"; /** - * skip all {@link org.springframework.boot.actuate.health.HealthIndicator} readiness check + * skip all {@literal org.springframework.boot.actuate.health.HealthIndicator} readiness check */ - public static final String SOFABOOT_SKIP_HEALTH_INDICATOR_CHECK = "com.alipay.sofa.healthcheck.skip.indicator"; + public static final String SOFABOOT_SKIP_HEALTH_INDICATOR_CHECK = "com.alipay.sofa.healthcheck.skip.indicator"; /** * health check logging space */ - public static final String SOFABOOT_HEALTH_LOG_SPACE = "com.alipay.sofa.healthcheck"; + public static final String SOFABOOT_HEALTH_LOG_SPACE = "com.alipay.sofa.healthcheck"; /** * readiness health check endpoint name */ - public static final String READINESS_CHECK_ENDPOINT_NAME = "sofaboot_health_readiness"; + public static final String READINESS_CHECK_ENDPOINT_NAME = "sofaboot_health_readiness"; + + /** + * {@literal com.alipay.sofa.runtime.spring.health.SofaComponentHealthChecker} retry count config. + */ + public static final String SOFABOOT_COMPONENT_CHECK_RETRY_COUNT = "com.alipay.sofa.healthcheck.component.check.retry.count"; + + /** + * default {@literal com.alipay.sofa.runtime.spring.health.SofaComponentHealthChecker} retry count value. + */ + public static final int SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_COUNT = 20; + + /** + * {@literal com.alipay.sofa.runtime.spring.health.SofaComponentHealthChecker} retry time interval config. + */ + public static final String SOFABOOT_COMPONENT_CHECK_RETRY_INTERVAL = "com.alipay.sofa.healthcheck.component.check.retry.interval"; + + /** + * default {@literal com.alipay.sofa.runtime.spring.health.SofaComponentHealthChecker} retry time interval value. + */ + public static final long SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_INTERVAL = 1000; + + /** + * {@literal com.alipay.sofa.isle.spring.health.SofaModuleHealthChecker} retry count config. + */ + public static final String SOFABOOT_MODULE_CHECK_RETRY_COUNT = "com.alipay.sofa.healthcheck.module.check.retry.count"; + + /** + * default {@literal com.alipay.sofa.isle.spring.health.SofaModuleHealthChecker} retry count value. + */ + public static final int SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_COUNT = 0; + + /** + * {@literal com.alipay.sofa.isle.spring.health.SofaModuleHealthChecker} retry time interval config. + */ + public static final String SOFABOOT_MODULE_CHECK_RETRY_INTERVAL = "com.alipay.sofa.healthcheck.module.check.retry.interval"; + + /** + * default {@literal com.alipay.sofa.isle.spring.health.SofaModuleHealthChecker} retry time interval value. + */ + public static final long SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_INTERVAL = 1000; } diff --git a/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/core/HealthChecker.java b/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/core/HealthChecker.java index 083f4fdcb..e979c973a 100644 --- a/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/core/HealthChecker.java +++ b/healthcheck-sofa-boot-starter/src/main/java/com/alipay/sofa/healthcheck/core/HealthChecker.java @@ -22,10 +22,7 @@ * @author liangen * @author qilong.zql * @since 2.3.0 - * @deprecated this class is not intended for use and will be removed the next major version. - * {@link org.springframework.boot.actuate.health.HealthIndicator} is recommended to use instead. */ -@Deprecated public interface HealthChecker { /** diff --git a/infra-sofa-boot-starter/pom.xml b/infra-sofa-boot-starter/pom.xml index c877040d3..2fc97be1c 100644 --- a/infra-sofa-boot-starter/pom.xml +++ b/infra-sofa-boot-starter/pom.xml @@ -22,7 +22,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml 4.0.0 diff --git a/isle-sofa-boot-starter/pom.xml b/isle-sofa-boot-starter/pom.xml index df135268d..b50ad5126 100644 --- a/isle-sofa-boot-starter/pom.xml +++ b/isle-sofa-boot-starter/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml 4.0.0 diff --git a/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/deployment/impl/AbstractDeploymentDescriptor.java b/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/deployment/impl/AbstractDeploymentDescriptor.java index b6c2bf48a..5cabc23ab 100644 --- a/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/deployment/impl/AbstractDeploymentDescriptor.java +++ b/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/deployment/impl/AbstractDeploymentDescriptor.java @@ -33,15 +33,15 @@ * yangyanzhao Exp $ */ public abstract class AbstractDeploymentDescriptor implements DeploymentDescriptor { - private final Properties properties; - private final DeploymentDescriptorConfiguration deploymentDescriptorConfiguration; - private final ClassLoader classLoader; - private final List installedSpringXml = new ArrayList<>(); - private ApplicationContext applicationContext; - private long startTime; - private long elapsedTime; - final URL url; - Map springResources; + final Properties properties; + final DeploymentDescriptorConfiguration deploymentDescriptorConfiguration; + private final ClassLoader classLoader; + private final List installedSpringXml = new ArrayList<>(); + private ApplicationContext applicationContext; + private long startTime; + private long elapsedTime; + final URL url; + Map springResources; public AbstractDeploymentDescriptor(URL url, Properties properties, diff --git a/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthChecker.java b/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthChecker.java index 286cce2b8..b42a3c87b 100644 --- a/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthChecker.java +++ b/isle-sofa-boot-starter/src/main/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthChecker.java @@ -16,7 +16,9 @@ */ package com.alipay.sofa.isle.spring.health; +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; import com.alipay.sofa.healthcheck.core.HealthChecker; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.health.Health; /** @@ -25,6 +27,15 @@ * @author xuanbei 18/5/6 */ public class SofaModuleHealthChecker extends AbstractModuleHealthChecker implements HealthChecker { + + @Value("${" + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_COUNT + ":" + + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_COUNT + "}") + private int retryCount; + + @Value("${" + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_INTERVAL + ":" + + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_INTERVAL + "}") + private long retryInterval; + @Override public Health isHealthy() { return doHealthCheck(); @@ -37,12 +48,12 @@ public String getComponentName() { @Override public int getRetryCount() { - return 0; + return retryCount; } @Override public long getRetryTimeInterval() { - return 0; + return retryInterval; } @Override diff --git a/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/integration/IntegrationTest.java b/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/integration/IntegrationTest.java index 7551be8d0..17a33ef99 100644 --- a/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/integration/IntegrationTest.java +++ b/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/integration/IntegrationTest.java @@ -16,6 +16,7 @@ */ package com.alipay.sofa.isle.integration; +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; import com.alipay.sofa.healthcheck.core.HealthChecker; import com.alipay.sofa.isle.ApplicationRuntimeModel; import com.alipay.sofa.isle.constants.SofaModuleFrameworkConstants; @@ -99,8 +100,10 @@ public void testHealthChecker() { .getBean("sofaModuleHealthChecker"); Assert.assertTrue(healthChecker.isHealthy().getStatus().equals(Status.UP)); Assert.assertEquals("SOFABoot-Modules", healthChecker.getComponentName()); - Assert.assertEquals(0, healthChecker.getRetryCount()); - Assert.assertEquals(0, healthChecker.getRetryTimeInterval()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_COUNT, + healthChecker.getRetryCount()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_INTERVAL, + healthChecker.getRetryTimeInterval()); Assert.assertEquals(true, healthChecker.isStrictCheck()); } diff --git a/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthCheckerTest.java b/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthCheckerTest.java new file mode 100644 index 000000000..18fb9bc4f --- /dev/null +++ b/isle-sofa-boot-starter/src/test/java/com/alipay/sofa/isle/spring/health/SofaModuleHealthCheckerTest.java @@ -0,0 +1,70 @@ +/* + * 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 com.alipay.sofa.isle.spring.health; + +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; +import com.alipay.sofa.isle.spring.configuration.SofaModuleAutoConfiguration; +import com.alipay.sofa.runtime.spring.configuration.SofaRuntimeAutoConfiguration; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.boot.test.util.EnvironmentTestUtils; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +/** + * @author abby.zh + * @since 2.4.10 + */ +public class SofaModuleHealthCheckerTest { + + private final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); + + @After + public void closeContext() { + this.applicationContext.close(); + } + + @Test + public void testDefaultConfig() { + this.applicationContext.register(SofaModuleAutoConfiguration.class); + this.applicationContext.refresh(); + SofaModuleHealthChecker sofaModuleHealthChecker = applicationContext + .getBean(SofaModuleHealthChecker.class); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_COUNT, + sofaModuleHealthChecker.getRetryCount()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_DEFAULT_INTERVAL, + sofaModuleHealthChecker.getRetryTimeInterval()); + } + + @Test + public void testCustomConfig() { + int customRetryCount = 10; + int customRetryInterval = 30; + this.applicationContext.register(SofaModuleAutoConfiguration.class); + EnvironmentTestUtils.addEnvironment(this.applicationContext, + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_COUNT + "=" + customRetryCount); + EnvironmentTestUtils.addEnvironment(this.applicationContext, + HealthCheckConstants.SOFABOOT_MODULE_CHECK_RETRY_INTERVAL + "=" + customRetryInterval); + this.applicationContext.register(SofaRuntimeAutoConfiguration.class); + this.applicationContext.refresh(); + SofaModuleHealthChecker sofaModuleHealthChecker = applicationContext + .getBean(SofaModuleHealthChecker.class); + Assert.assertEquals(customRetryCount, sofaModuleHealthChecker.getRetryCount()); + Assert.assertEquals(customRetryInterval, sofaModuleHealthChecker.getRetryTimeInterval()); + } + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 9793fe6c4..599f79407 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ com.alipay.sofa sofaboot-dependencies - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/runtime-sofa-boot-plugin/pom.xml b/runtime-sofa-boot-plugin/pom.xml index 27a2a2acc..bb5fe1358 100644 --- a/runtime-sofa-boot-plugin/pom.xml +++ b/runtime-sofa-boot-plugin/pom.xml @@ -22,7 +22,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml 4.0.0 @@ -37,7 +37,7 @@ com.alipay.sofa runtime-sofa-boot-starter - 2.5.0-SNAPSHOT + 2.5.0 diff --git a/runtime-sofa-boot-starter/pom.xml b/runtime-sofa-boot-starter/pom.xml index cdf41be05..51e2b936f 100644 --- a/runtime-sofa-boot-starter/pom.xml +++ b/runtime-sofa-boot-starter/pom.xml @@ -22,7 +22,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml 4.0.0 diff --git a/runtime-sofa-boot-starter/src/main/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthChecker.java b/runtime-sofa-boot-starter/src/main/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthChecker.java index 0890061a8..449ceebf8 100644 --- a/runtime-sofa-boot-starter/src/main/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthChecker.java +++ b/runtime-sofa-boot-starter/src/main/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthChecker.java @@ -16,8 +16,10 @@ */ package com.alipay.sofa.runtime.spring.health; +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; import com.alipay.sofa.healthcheck.core.HealthChecker; import com.alipay.sofa.runtime.spi.component.SofaRuntimeContext; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.actuate.health.Health; /** @@ -27,6 +29,15 @@ */ public class SofaComponentHealthChecker extends AbstractComponentHealthChecker implements HealthChecker { + + @Value("${" + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_COUNT + ":" + + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_COUNT + "}") + private int retryCount; + + @Value("${" + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_INTERVAL + ":" + + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_INTERVAL + "}") + private int retryInterval; + public SofaComponentHealthChecker(SofaRuntimeContext sofaRuntimeContext) { super(sofaRuntimeContext); } @@ -43,12 +54,12 @@ public String getComponentName() { @Override public int getRetryCount() { - return 0; + return retryCount; } @Override public long getRetryTimeInterval() { - return 0; + return retryInterval; } @Override diff --git a/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/integration/IntegrationTest.java b/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/integration/IntegrationTest.java index d3dbc808c..af5c53285 100644 --- a/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/integration/IntegrationTest.java +++ b/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/integration/IntegrationTest.java @@ -16,6 +16,7 @@ */ package com.alipay.sofa.runtime.integration; +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; import com.alipay.sofa.healthcheck.core.HealthChecker; import com.alipay.sofa.runtime.beans.service.SampleService; import com.alipay.sofa.runtime.integration.aop.SampleServiceAspect; @@ -62,8 +63,10 @@ public void testHealthChecker() { HealthChecker healthChecker = (HealthChecker) context.getBean("sofaComponentHealthChecker"); Assert.assertTrue(healthChecker.isHealthy().getStatus().equals(Status.UP)); Assert.assertEquals("SOFABoot-Components", healthChecker.getComponentName()); - Assert.assertEquals(0, healthChecker.getRetryCount()); - Assert.assertEquals(0, healthChecker.getRetryTimeInterval()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_COUNT, + healthChecker.getRetryCount()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_INTERVAL, + healthChecker.getRetryTimeInterval()); Assert.assertEquals(true, healthChecker.isStrictCheck()); } diff --git a/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthCheckerTest.java b/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthCheckerTest.java new file mode 100644 index 000000000..030cfdac1 --- /dev/null +++ b/runtime-sofa-boot-starter/src/test/java/com/alipay/sofa/runtime/spring/health/SofaComponentHealthCheckerTest.java @@ -0,0 +1,70 @@ +/* + * 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 com.alipay.sofa.runtime.spring.health; + +import com.alipay.sofa.healthcheck.configuration.HealthCheckConstants; +import com.alipay.sofa.runtime.spring.configuration.SofaRuntimeAutoConfiguration; +import org.junit.After; +import org.junit.Assert; +import org.junit.Test; +import org.springframework.boot.test.util.EnvironmentTestUtils; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; + +/** + * @author abby.zh + * @since 2.4.10 + */ +public class SofaComponentHealthCheckerTest { + + private final AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(); + + @After + public void closeContext() { + this.applicationContext.close(); + } + + @Test + public void testDefaultConfig() { + this.applicationContext.register(SofaRuntimeAutoConfiguration.class); + this.applicationContext.refresh(); + SofaComponentHealthChecker sofaComponentHealthChecker = applicationContext + .getBean(SofaComponentHealthChecker.class); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_COUNT, + sofaComponentHealthChecker.getRetryCount()); + Assert.assertEquals(HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_DEFAULT_INTERVAL, + sofaComponentHealthChecker.getRetryTimeInterval()); + } + + @Test + public void testCustomConfig() { + int customRetryCount = 10; + int customRetryInterval = 30; + this.applicationContext.register(SofaRuntimeAutoConfiguration.class); + EnvironmentTestUtils.addEnvironment(this.applicationContext, + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_COUNT + "=" + customRetryCount); + EnvironmentTestUtils.addEnvironment(this.applicationContext, + HealthCheckConstants.SOFABOOT_COMPONENT_CHECK_RETRY_INTERVAL + "=" + + customRetryInterval); + this.applicationContext.register(SofaRuntimeAutoConfiguration.class); + this.applicationContext.refresh(); + SofaComponentHealthChecker sofaComponentHealthChecker = applicationContext + .getBean(SofaComponentHealthChecker.class); + Assert.assertEquals(customRetryCount, sofaComponentHealthChecker.getRetryCount()); + Assert.assertEquals(customRetryInterval, sofaComponentHealthChecker.getRetryTimeInterval()); + } + +} \ No newline at end of file diff --git a/sofaboot-dependencies/pom.xml b/sofaboot-dependencies/pom.xml deleted file mode 100644 index dd20f08e5..000000000 --- a/sofaboot-dependencies/pom.xml +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - - org.springframework.boot - spring-boot-starter-parent - 1.4.2.RELEASE - - 4.0.0 - - com.alipay.sofa - sofaboot-dependencies - 2.4.5-SNAPSHOT - pom - - - 1.7 - UTF-8 - UTF-8 - - 1.4.2.RELEASE - 2.5.0-SNAPSHOT - 0.5.1 - 5.4.5 - 2.1.1 - 1.4.0 - - 1.0.12 - 1.4.4 - 3.3.0 - - 1.2.47 - - 1.6.7 - 1.5 - - - - - The Apache License, Version 2.0 - http://www.apache.org/licenses/LICENSE-2.0.txt - - - - - - guanchao.ygc - guanchao.ygc@antfin.com - Ant Financial - https://www.alipay.com/ - - - wei.li - lw111072@antfin.com - Ant Financial - https://www.alipay.com/ - - - jie.cao - caojie.cj@alipay.com - Ant Financial - https://www.alipay.com/ - - - - - - scm:git:git://github.com/alipay/sofa-boot.git - scm:git:ssh://github.com/alipay/sofa-boot.git - https://github.com/alipay/sofa-boot/tree/master - - - - - - - - com.alipay.sofa - infra-sofa-boot-starter - ${sofa.boot.version} - - - com.alipay.sofa - healthcheck-sofa-boot-starter - ${sofa.boot.version} - - - com.alipay.sofa - runtime-sofa-boot-starter - ${sofa.boot.version} - - - com.alipay.sofa - test-sofa-boot-starter - ${sofa.boot.version} - - - com.alipay.sofa - isle-sofa-boot-starter - ${sofa.boot.version} - - - com.alipay.sofa - rpc-sofa-boot-starter - ${rpc.starter.version} - - - - - - com.alipay.sofa - sofa-ark-springboot-starter - ${sofa.ark.version} - - - - - - com.alipay.sofa - runtime-sofa-boot-plugin - ${sofa.boot.version} - - - - com.alipay.sofa - rpc-sofa-boot-plugin - ${rpc.starter.version} - - - - - - com.alipay.sofa - tracer-sofa-boot-starter - ${sofa.tracer.version} - - - - com.alipay.sofa.lookout - lookout-sofa-boot-starter - ${sofa.lookout.version} - - - - - com.alipay.sofa.common - sofa-common-tools - ${sofa.common.tools.version} - - - com.alipay.sofa - bolt - ${bolt.version} - - - com.alipay.sofa - hessian - ${hessian.version} - - - - - - com.alibaba - fastjson - ${fastjson.version} - - - - - - - - - - - com.alipay.sofa - sofa-ark-maven-plugin - ${sofa.ark.version} - - - com.alipay.sofa - sofa-ark-plugin-maven-plugin - ${sofa.ark.version} - - - - - - - - release - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${maven.staging.plugin} - true - - ossrh - https://oss.sonatype.org/ - false - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.pluign} - - - sign-artifacts - verify - - sign - - - - - - - - - ossrh - https://oss.sonatype.org/service/local/staging/deploy/maven2/ - - - - - - snapshot - - - - org.sonatype.plugins - nexus-staging-maven-plugin - ${maven.staging.plugin} - true - - ossrh - https://oss.sonatype.org/ - false - - - - org.apache.maven.plugins - maven-gpg-plugin - ${maven.gpg.pluign} - - - sign-artifacts - verify - - sign - - - - - - - - - ossrh - https://oss.sonatype.org/content/repositories/snapshots - - - - - - default - - true - - - - - true - - maven-snapshot - https://oss.sonatype.org/content/repositories/snapshots - - - - - - true - - maven-snapshot - https://oss.sonatype.org/content/repositories/snapshots - - - - - - diff --git a/sofaboot-samples/pom.xml b/sofaboot-samples/pom.xml index 83f7b4829..72e46d45e 100644 --- a/sofaboot-samples/pom.xml +++ b/sofaboot-samples/pom.xml @@ -22,7 +22,7 @@ com.alipay.sofa sofa-boot-runtime - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-standard/pom.xml b/sofaboot-samples/sofaboot-sample-standard/pom.xml index 9c804588a..921bab3df 100644 --- a/sofaboot-samples/sofaboot-sample-standard/pom.xml +++ b/sofaboot-samples/sofaboot-sample-standard/pom.xml @@ -5,7 +5,7 @@ sofaboot-samples com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 com.alipay.sofa diff --git a/sofaboot-samples/sofaboot-sample-with-isle/README.md b/sofaboot-samples/sofaboot-sample-with-isle/README.md index f7b8284d7..b409f8905 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/README.md +++ b/sofaboot-samples/sofaboot-sample-with-isle/README.md @@ -202,7 +202,7 @@ public class JvmServiceConsumer implements ClientFactoryAware { com.alipay.sofa sofaboot-dependencies - 2.5.0-SNAPSHOT + 2.5.0 ``` diff --git a/sofaboot-samples/sofaboot-sample-with-isle/pom.xml b/sofaboot-samples/sofaboot-sample-with-isle/pom.xml index a454ab8ab..6958fe3c6 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isle/pom.xml @@ -5,7 +5,7 @@ sofaboot-samples com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-isle/service-consumer/pom.xml b/sofaboot-samples/sofaboot-sample-with-isle/service-consumer/pom.xml index 500940dff..32bd1b7c1 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/service-consumer/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isle/service-consumer/pom.xml @@ -5,7 +5,7 @@ sofaboot-sample-with-isle com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-isle/service-facade/pom.xml b/sofaboot-samples/sofaboot-sample-with-isle/service-facade/pom.xml index bb232ee31..df5eb390a 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/service-facade/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isle/service-facade/pom.xml @@ -5,7 +5,7 @@ sofaboot-sample-with-isle com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-isle/service-provider/pom.xml b/sofaboot-samples/sofaboot-sample-with-isle/service-provider/pom.xml index 0b60d8b81..064ae63fe 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/service-provider/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isle/service-provider/pom.xml @@ -5,7 +5,7 @@ sofaboot-sample-with-isle com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-isle/sofa-boot-run/pom.xml b/sofaboot-samples/sofaboot-sample-with-isle/sofa-boot-run/pom.xml index bd3aa8580..14c97e4ef 100644 --- a/sofaboot-samples/sofaboot-sample-with-isle/sofa-boot-run/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isle/sofa-boot-run/pom.xml @@ -5,7 +5,7 @@ sofaboot-sample-with-isle com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-isolation/pom.xml b/sofaboot-samples/sofaboot-sample-with-isolation/pom.xml index 8240c196b..3a173b277 100644 --- a/sofaboot-samples/sofaboot-sample-with-isolation/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-isolation/pom.xml @@ -22,7 +22,7 @@ sofaboot-samples com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample-with-rpc/README.md b/sofaboot-samples/sofaboot-sample-with-rpc/README.md index 2d895662f..5c7ad0309 100644 --- a/sofaboot-samples/sofaboot-sample-with-rpc/README.md +++ b/sofaboot-samples/sofaboot-sample-with-rpc/README.md @@ -9,7 +9,7 @@ SOFABoot 提供了如健康检查,上下文隔离等基础能力,同时提 com.alipay.sofa sofaboot-dependencies - 2.5.0-SNAPSHOT + 2.5.0 ``` diff --git a/sofaboot-samples/sofaboot-sample-with-rpc/pom.xml b/sofaboot-samples/sofaboot-sample-with-rpc/pom.xml index 12f42a451..e34d23802 100644 --- a/sofaboot-samples/sofaboot-sample-with-rpc/pom.xml +++ b/sofaboot-samples/sofaboot-sample-with-rpc/pom.xml @@ -5,7 +5,7 @@ sofaboot-samples com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/sofaboot-samples/sofaboot-sample/pom.xml b/sofaboot-samples/sofaboot-sample/pom.xml index 5b6fe4728..c650efb77 100644 --- a/sofaboot-samples/sofaboot-sample/pom.xml +++ b/sofaboot-samples/sofaboot-sample/pom.xml @@ -22,7 +22,7 @@ sofaboot-samples com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 4.0.0 diff --git a/test-sofa-boot-starter/pom.xml b/test-sofa-boot-starter/pom.xml index c361e241a..4e385dcd0 100644 --- a/test-sofa-boot-starter/pom.xml +++ b/test-sofa-boot-starter/pom.xml @@ -5,7 +5,7 @@ sofa-boot-runtime com.alipay.sofa - 2.5.0-SNAPSHOT + 2.5.0 ../pom.xml 4.0.0