Polish "Add actuator endpoint for exposing the Spring Integration graph"
Closes gh-12331
This commit is contained in:
@@ -28,31 +28,28 @@ import org.springframework.integration.support.management.graph.IntegrationGraph
|
||||
* @author Tim Ysewyn
|
||||
* @since 2.1.0
|
||||
*/
|
||||
@Endpoint(id = "integrationgraph", enableByDefault = false)
|
||||
@Endpoint(id = "integrationgraph")
|
||||
public class IntegrationGraphEndpoint {
|
||||
|
||||
private final IntegrationGraphServer integrationGraphServer;
|
||||
private final IntegrationGraphServer graphServer;
|
||||
|
||||
/**
|
||||
* Creates a new {@code IntegrationGraphEndpoint} that exposes a graph containing all the
|
||||
* Spring Integration components in the given {@code integrationGraphServer}.
|
||||
*
|
||||
* @param integrationGraphServer the integration graph server
|
||||
* @see IntegrationGraphServer
|
||||
* Create a new {@code IntegrationGraphEndpoint} that exposes a graph containing all
|
||||
* the Spring Integration components in the given {@link IntegrationGraphServer}.
|
||||
* @param graphServer the integration graph server
|
||||
*/
|
||||
public IntegrationGraphEndpoint(IntegrationGraphServer integrationGraphServer) {
|
||||
this.integrationGraphServer = integrationGraphServer;
|
||||
public IntegrationGraphEndpoint(IntegrationGraphServer graphServer) {
|
||||
this.graphServer = graphServer;
|
||||
}
|
||||
|
||||
@ReadOperation
|
||||
public Graph graph() {
|
||||
return this.integrationGraphServer.getGraph();
|
||||
return this.graphServer.getGraph();
|
||||
}
|
||||
|
||||
|
||||
@WriteOperation
|
||||
public void rebuild() {
|
||||
this.integrationGraphServer.rebuild();
|
||||
this.graphServer.rebuild();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,6 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Actuator support relating to Spring Integration.
|
||||
* Actuator support for Spring Integration.
|
||||
*/
|
||||
package org.springframework.boot.actuate.integration;
|
||||
|
||||
@@ -49,21 +49,18 @@ public class IntegrationGraphEndpointTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldReturnGraph() {
|
||||
public void readOperationShouldReturnGraph() {
|
||||
Graph mockedGraph = mock(Graph.class);
|
||||
when(this.integrationGraphServer.getGraph()).thenReturn(mockedGraph);
|
||||
|
||||
Graph graph = this.integrationGraphEndpoint.graph();
|
||||
|
||||
verify(this.integrationGraphServer).getGraph();
|
||||
|
||||
assertThat(graph).isEqualTo(mockedGraph);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldRebuildGraph() {
|
||||
public void writeOperationShouldRebuildGraph() {
|
||||
this.integrationGraphEndpoint.rebuild();
|
||||
|
||||
verify(this.integrationGraphServer).rebuild();
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class IntegrationGraphEndpointWebIntegrationTests {
|
||||
public void graph() {
|
||||
client.get().uri("/actuator/integrationgraph").accept(MediaType.APPLICATION_JSON).exchange()
|
||||
.expectStatus().isOk().expectBody()
|
||||
.jsonPath("contentDescriptor.providerVersion").isEqualTo("5.0.3.RELEASE")
|
||||
.jsonPath("contentDescriptor.providerVersion").isNotEmpty()
|
||||
.jsonPath("contentDescriptor.providerFormatVersion").isEqualTo(1.0f)
|
||||
.jsonPath("contentDescriptor.provider").isEqualTo("spring-integration");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user