下面列出了org.springframework.boot.actuate.endpoint.EndpointId#org.springframework.boot.actuate.endpoint.web.WebOperation 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private ExposableWebEndpoint createEndpoint(final String name) {
return new ExposableWebEndpoint() {
@Override
public String getRootPath() {
return name;
}
@Override
public EndpointId getEndpointId() {
return EndpointId.of(name);
}
@Override
public boolean isEnableByDefault() {
return false;
}
@Override
public Collection<WebOperation> getOperations() {
return null;
}
};
}
@SuppressWarnings("unchecked")
void assertReadProperties(Class<?> testConfigClass) {
load(testConfigClass, (discoverer) -> {
Map<EndpointId, ExposableWebEndpoint> endpoints = mapEndpoints(discoverer.getEndpoints());
assertThat(endpoints).containsKey(endpointId);
ExposableWebEndpoint endpoint = endpoints.get(endpointId);
assertThat(endpoint.getOperations()).hasSize(1);
WebOperation operation = endpoint.getOperations().iterator().next();
Object invoker = ReflectionTestUtils.getField(operation, "invoker");
assertThat(invoker).isInstanceOf(ReflectiveOperationInvoker.class);
Map<String, Properties> properties = (Map<String, Properties>) ((ReflectiveOperationInvoker) invoker).invoke(
new InvocationContext(mock(SecurityContext.class), Collections.emptyMap()));
assertThat(properties).hasSize(1);
});
}
WebOperationService(WebOperation operation,
SimpleHttpCodeStatusMapper statusMapper) {
this.operation = operation;
this.statusMapper = statusMapper;
}