Search in sources :

Example 6 with ExposableJmxEndpoint

use of org.springframework.boot.actuate.endpoint.jmx.ExposableJmxEndpoint in project spring-boot by spring-projects.

the class JmxEndpointDiscovererTests method getEndpointsShouldDiscoverStandardEndpoints.

@Test
void getEndpointsShouldDiscoverStandardEndpoints() {
    load(TestEndpoint.class, (discoverer) -> {
        Map<EndpointId, ExposableJmxEndpoint> endpoints = discover(discoverer);
        assertThat(endpoints).containsOnlyKeys(EndpointId.of("test"));
        Map<String, JmxOperation> operationByName = mapOperations(endpoints.get(EndpointId.of("test")).getOperations());
        assertThat(operationByName).containsOnlyKeys("getAll", "getSomething", "update", "deleteSomething");
        JmxOperation getAll = operationByName.get("getAll");
        assertThat(getAll.getDescription()).isEqualTo("Invoke getAll for endpoint test");
        assertThat(getAll.getOutputType()).isEqualTo(Object.class);
        assertThat(getAll.getParameters()).isEmpty();
        JmxOperation getSomething = operationByName.get("getSomething");
        assertThat(getSomething.getDescription()).isEqualTo("Invoke getSomething for endpoint test");
        assertThat(getSomething.getOutputType()).isEqualTo(String.class);
        assertThat(getSomething.getParameters()).hasSize(1);
        assertThat(getSomething.getParameters().get(0).getType()).isEqualTo(String.class);
        JmxOperation update = operationByName.get("update");
        assertThat(update.getDescription()).isEqualTo("Invoke update for endpoint test");
        assertThat(update.getOutputType()).isEqualTo(Void.TYPE);
        assertThat(update.getParameters()).hasSize(2);
        assertThat(update.getParameters().get(0).getType()).isEqualTo(String.class);
        assertThat(update.getParameters().get(1).getType()).isEqualTo(String.class);
        JmxOperation deleteSomething = operationByName.get("deleteSomething");
        assertThat(deleteSomething.getDescription()).isEqualTo("Invoke deleteSomething for endpoint test");
        assertThat(deleteSomething.getOutputType()).isEqualTo(Void.TYPE);
        assertThat(deleteSomething.getParameters()).hasSize(1);
        assertThat(deleteSomething.getParameters().get(0).getType()).isEqualTo(String.class);
    });
}
Also used : JmxOperation(org.springframework.boot.actuate.endpoint.jmx.JmxOperation) ExposableJmxEndpoint(org.springframework.boot.actuate.endpoint.jmx.ExposableJmxEndpoint) EndpointId(org.springframework.boot.actuate.endpoint.EndpointId) Test(org.junit.jupiter.api.Test)

Example 7 with ExposableJmxEndpoint

use of org.springframework.boot.actuate.endpoint.jmx.ExposableJmxEndpoint in project spring-boot by spring-projects.

the class DefaultEndpointObjectNameFactoryTests method endpoint.

private ExposableJmxEndpoint endpoint(EndpointId id) {
    ExposableJmxEndpoint endpoint = mock(ExposableJmxEndpoint.class);
    given(endpoint.getEndpointId()).willReturn(id);
    return endpoint;
}
Also used : ExposableJmxEndpoint(org.springframework.boot.actuate.endpoint.jmx.ExposableJmxEndpoint)

Aggregations

ExposableJmxEndpoint (org.springframework.boot.actuate.endpoint.jmx.ExposableJmxEndpoint)7 Test (org.junit.jupiter.api.Test)5 EndpointId (org.springframework.boot.actuate.endpoint.EndpointId)4 JmxOperation (org.springframework.boot.actuate.endpoint.jmx.JmxOperation)4 CachingOperationInvoker (org.springframework.boot.actuate.endpoint.invoker.cache.CachingOperationInvoker)2 ObjectName (javax.management.ObjectName)1 EndpointObjectNameFactory (org.springframework.boot.actuate.endpoint.jmx.EndpointObjectNameFactory)1