-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 0.2.1 (#345) * Fix #169 * Polish : #324 & #325 * Polish : #315 * Polish : #321 * Polish : #321 * Polish : #321 for test case * Polish : Update Demos * Polish : Update version to be 0.2.1 * Polish : #319 * Polish : #226 * Polish : #309 * Fix the test case's bugs * Fix the test case's bugs * Fix a JavaDoc issue * Update SNAPSHOT and add exclude list * Update SNAPSHOT to be 0.2.1-SNAPSHOT * Update JDK versions * Update JDK versions * Reactor & remove author info * Refactor : to save a shutdown hook thread * 0.2.1 (#346) * Fix #169 * Polish : #324 & #325 * Polish : #315 * Polish : #321 * Polish : #321 * Polish : #321 for test case * Polish : Update Demos * Polish : Update version to be 0.2.1 * Polish : #319 * Polish : #226 * Polish : #309 * Fix the test case's bugs * Fix the test case's bugs * Fix a JavaDoc issue * Update SNAPSHOT and add exclude list * Update SNAPSHOT to be 0.2.1-SNAPSHOT * Update JDK versions * Update JDK versions * Reactor & remove author info * Refactor : to save a shutdown hook thread * Remove javax.servlet:javax.servlet-api:3.1.0 that may cause class conflict, and use indirectly dependencies from spring-boot-starter-* * Polish #341
- Loading branch information
1 parent
f65bec5
commit 9a6d197
Showing
33 changed files
with
303 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,13 @@ | |
*/ | ||
package com.alibaba.boot.dubbo.actuate.autoconfigure; | ||
|
||
import com.alibaba.boot.dubbo.actuate.endpoint.*; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboConfigsMetadataEndpoint; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboEndpoint; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboPropertiesEndpoint; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboReferencesMetadataEndpoint; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboServicesMetadataEndpoint; | ||
import com.alibaba.boot.dubbo.actuate.endpoint.DubboShutdownEndpoint; | ||
|
||
import org.springframework.boot.actuate.autoconfigure.endpoint.condition.ConditionalOnEnabledEndpoint; | ||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; | ||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | ||
|
@@ -27,7 +33,7 @@ | |
/** | ||
* Dubbo {@link Endpoint} Auto-{@link Configuration} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see Endpoint | ||
* @see Configuration | ||
* @since 0.2.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
import com.alibaba.boot.dubbo.actuate.health.DubboHealthIndicator; | ||
import com.alibaba.boot.dubbo.actuate.health.DubboHealthIndicatorProperties; | ||
import com.alibaba.boot.dubbo.autoconfigure.DubboAutoConfiguration; | ||
|
||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration; | ||
import org.springframework.boot.actuate.autoconfigure.health.ConditionalOnEnabledHealthIndicator; | ||
import org.springframework.boot.actuate.health.HealthIndicator; | ||
|
@@ -33,7 +34,7 @@ | |
/** | ||
* Dubbo {@link DubboHealthIndicator} Auto Configuration | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see HealthIndicator | ||
* @since 1.0.0 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
import com.alibaba.dubbo.config.ProtocolConfig; | ||
import com.alibaba.dubbo.config.spring.ServiceBean; | ||
import com.alibaba.dubbo.config.spring.beans.factory.annotation.ReferenceAnnotationBeanPostProcessor; | ||
|
||
import org.springframework.beans.BeansException; | ||
import org.springframework.boot.actuate.endpoint.annotation.Endpoint; | ||
import org.springframework.context.ApplicationContext; | ||
|
@@ -45,7 +46,7 @@ | |
/** | ||
* Abstract Dubbo {@link Endpoint @Endpoint} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @since 0.2.0 | ||
*/ | ||
public abstract class AbstractDubboEndpoint implements ApplicationContextAware, EnvironmentAware { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,10 +40,10 @@ | |
/** | ||
* Dubbo Configs Metadata {@link Endpoint} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @since 0.2.0 | ||
*/ | ||
@Endpoint(id = "dubboConfigs") | ||
@Endpoint(id = "dubboconfigs") | ||
public class DubboConfigsMetadataEndpoint extends AbstractDubboEndpoint { | ||
|
||
@ReadOperation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,7 +34,7 @@ | |
/** | ||
* Actuator {@link Endpoint} to expose Dubbo Meta Data | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see Endpoint | ||
* @since 1.0.0 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,10 +26,10 @@ | |
/** | ||
* Dubbo Properties {@link Endpoint} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Endpoint(id = "dubboProperties") | ||
@Endpoint(id = "dubboproperties") | ||
public class DubboPropertiesEndpoint extends AbstractDubboEndpoint { | ||
|
||
@ReadOperation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,10 +30,10 @@ | |
/** | ||
* Dubbo {@link Reference} Metadata {@link Endpoint} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @since 1.0.0 | ||
*/ | ||
@Endpoint(id = "dubboReferences") | ||
@Endpoint(id = "dubboreferences") | ||
public class DubboReferencesMetadataEndpoint extends AbstractDubboEndpoint { | ||
|
||
@ReadOperation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,10 @@ | |
/** | ||
* Dubbo {@link Service} Metadata {@link Endpoint} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @since 0.2.0 | ||
*/ | ||
@Endpoint(id = "dubboServices") | ||
@Endpoint(id = "dubboservices") | ||
public class DubboServicesMetadataEndpoint extends AbstractDubboEndpoint { | ||
|
||
@ReadOperation | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,10 +32,9 @@ | |
/** | ||
* Dubbo Shutdown | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* @since 0.2.0 | ||
*/ | ||
@Endpoint(id = "dubboShutdown") | ||
@Endpoint(id = "dubboshutdown") | ||
public class DubboShutdownEndpoint extends AbstractDubboEndpoint { | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
import com.alibaba.dubbo.common.status.StatusChecker; | ||
import com.alibaba.dubbo.config.ProtocolConfig; | ||
import com.alibaba.dubbo.config.ProviderConfig; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.actuate.health.AbstractHealthIndicator; | ||
import org.springframework.boot.actuate.health.Health; | ||
|
@@ -37,7 +38,7 @@ | |
/** | ||
* Dubbo {@link HealthIndicator} | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see HealthIndicator | ||
* @since 1.0.0 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ | |
/** | ||
* Dubbo {@link HealthIndicator} Properties | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see HealthIndicator | ||
* @since 1.0.0 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ | |
/** | ||
* {@link DubboEndpoint} Test | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see DubboEndpoint | ||
* @since 1.0.0 | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,21 +19,25 @@ | |
import com.alibaba.boot.dubbo.actuate.autoconfigure.DubboEndpointsAutoConfiguration; | ||
import com.alibaba.dubbo.config.annotation.Service; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.junit4.SpringRunner; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.util.Map; | ||
import java.util.SortedMap; | ||
import java.util.function.Supplier; | ||
|
||
/** | ||
* {@link DubboEndpointsAutoConfiguration} Test | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* @since 0.2.0 | ||
*/ | ||
@RunWith(SpringRunner.class) | ||
|
@@ -58,11 +62,12 @@ | |
"dubbo.provider.host=127.0.0.1", | ||
"dubbo.scan.basePackages=com.alibaba.boot.dubbo.actuate.endpoint", | ||
"management.endpoint.dubbo.enabled = true", | ||
"management.endpoint.dubboShutdown.enabled = true", | ||
"management.endpoint.dubboConfigs.enabled = true", | ||
"management.endpoint.dubboServices.enabled = true", | ||
"management.endpoint.dubboReferences.enabled = true", | ||
"management.endpoint.dubboProperties.enabled = true", | ||
"management.endpoint.dubboshutdown.enabled = true", | ||
"management.endpoint.dubboconfigs.enabled = true", | ||
"management.endpoint.dubboservices.enabled = true", | ||
"management.endpoint.dubboreferences.enabled = true", | ||
"management.endpoint.dubboproperties.enabled = true", | ||
"management.endpoints.web.exposure.include = *", | ||
}) | ||
@EnableAutoConfiguration | ||
public class DubboEndpointsAutoConfigurationTest { | ||
|
@@ -85,6 +90,13 @@ public class DubboEndpointsAutoConfigurationTest { | |
@Autowired | ||
private DubboShutdownEndpoint dubboShutdownEndpoint; | ||
|
||
private RestTemplate restTemplate = new RestTemplate(); | ||
|
||
@Autowired | ||
private ObjectMapper objectMapper; | ||
|
||
@Value("http://127.0.0.1:${local.management.port}${management.endpoints.web.base-path:/actuator}") | ||
private String actuatorBaseURL; | ||
|
||
@Test | ||
public void testShutdown() throws Exception { | ||
|
@@ -178,20 +190,35 @@ public void testProperties() { | |
Assert.assertEquals("com.alibaba.boot.dubbo.actuate.endpoint", properties.get("dubbo.scan.basePackages")); | ||
} | ||
|
||
@Test | ||
public void testHttpEndpoints() throws JsonProcessingException { | ||
// testHttpEndpoint("/dubbo", dubboEndpoint::invoke); | ||
testHttpEndpoint("/dubbo/configs", dubboConfigsMetadataEndpoint::configs); | ||
testHttpEndpoint("/dubbo/services", dubboServicesMetadataEndpoint::services); | ||
testHttpEndpoint("/dubbo/references", dubboReferencesMetadataEndpoint::references); | ||
testHttpEndpoint("/dubbo/properties", dubboPropertiesEndpoint::properties); | ||
} | ||
|
||
@Service( | ||
version = "${dubbo.service.version}", | ||
application = "${dubbo.application.id}", | ||
protocol = "${dubbo.protocol.id}", | ||
registry = "${dubbo.registry.id}" | ||
) | ||
static class DefaultDemoService implements DemoService { | ||
|
||
public String sayHello(String name) { | ||
return "Hello, " + name + " (from Spring Boot)"; | ||
private void testHttpEndpoint(String actuatorURI, Supplier<Map> resultsSupplier) throws JsonProcessingException { | ||
String actuatorURL = actuatorBaseURL + actuatorURI; | ||
String response = restTemplate.getForObject(actuatorURL, String.class); | ||
Assert.assertEquals(objectMapper.writeValueAsString(resultsSupplier.get()), response); | ||
} | ||
|
||
} | ||
|
||
@Service( | ||
version = "${dubbo.service.version}", | ||
application = "${dubbo.application.id}", | ||
protocol = "${dubbo.protocol.id}", | ||
registry = "${dubbo.registry.id}" | ||
) | ||
static class DefaultDemoService implements DemoService { | ||
|
||
public String sayHello(String name) { | ||
return "Hello, " + name + " (from Spring Boot)"; | ||
} | ||
|
||
} | ||
|
||
interface DemoService { | ||
String sayHello(String name); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
package com.alibaba.boot.dubbo.actuate.health; | ||
|
||
import com.alibaba.dubbo.config.spring.context.annotation.EnableDubboConfig; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
@@ -33,7 +34,7 @@ | |
/** | ||
* {@link DubboHealthIndicator} Test | ||
* | ||
* @author <a href="mailto:[email protected]">Mercy</a> | ||
* | ||
* @see DubboHealthIndicator | ||
* @since 1.0.0 | ||
*/ | ||
|
Oops, something went wrong.