9 changed files with 135 additions and 88 deletions
@ -1,26 +0,0 @@
@@ -1,26 +0,0 @@
|
||||
/* |
||||
* Copyright 2013 the original author or authors. |
||||
* |
||||
* Licensed 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 org.springframework.boot.actuate.endpoint; |
||||
|
||||
/** |
||||
* {@link RuntimeException} indicating an {@link Endpoint} implementation is not enabled. |
||||
* |
||||
* @author Christian Dupuis |
||||
*/ |
||||
public class EndpointDisabledException extends RuntimeException { |
||||
|
||||
} |
||||
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
* Copyright 2013 the original author or authors. |
||||
* |
||||
* Licensed 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 org.springframework.boot.actuate.endpoint; |
||||
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
|
||||
/** |
||||
* @author Christian Dupuis |
||||
*/ |
||||
public class JolokiaEndpointTests extends AbstractEndpointTests<JolokiaEndpoint> { |
||||
|
||||
public JolokiaEndpointTests() { |
||||
super(Config.class, JolokiaEndpoint.class, "/jolokia", true, "endpoints.jolokia"); |
||||
} |
||||
|
||||
@Configuration |
||||
@EnableConfigurationProperties |
||||
public static class Config { |
||||
|
||||
@Bean |
||||
public JolokiaEndpoint endpoint() { |
||||
return new JolokiaEndpoint(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
@ -0,0 +1,64 @@
@@ -0,0 +1,64 @@
|
||||
/* |
||||
* Copyright 2013 the original author or authors. |
||||
* |
||||
* Licensed 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 org.springframework.boot.actuate.endpoint.mvc; |
||||
|
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration; |
||||
import org.springframework.boot.actuate.endpoint.mvc.JolokiaEndpointTests.Config; |
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties; |
||||
import org.springframework.boot.test.SpringApplicationConfiguration; |
||||
import org.springframework.context.annotation.Bean; |
||||
import org.springframework.context.annotation.Configuration; |
||||
import org.springframework.context.annotation.Import; |
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
||||
import org.springframework.test.context.web.WebAppConfiguration; |
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc; |
||||
|
||||
import static org.junit.Assert.assertEquals; |
||||
|
||||
/** |
||||
* @author Christian Dupuis |
||||
* @author Dave Syer |
||||
*/ |
||||
@RunWith(SpringJUnit4ClassRunner.class) |
||||
@SpringApplicationConfiguration(classes = { Config.class }) |
||||
@WebAppConfiguration |
||||
public class JolokiaEndpointTests { |
||||
|
||||
@Autowired |
||||
private MvcEndpoints endpoints; |
||||
|
||||
@Test |
||||
public void endpointRegistered() throws Exception { |
||||
assertEquals(1, this.endpoints.getEndpoints().size()); |
||||
} |
||||
|
||||
@Configuration |
||||
@EnableConfigurationProperties |
||||
@EnableWebMvc |
||||
@Import(EndpointWebMvcAutoConfiguration.class) |
||||
public static class Config { |
||||
|
||||
@Bean |
||||
public JolokiaMvcEndpoint endpoint() { |
||||
return new JolokiaMvcEndpoint(); |
||||
} |
||||
|
||||
} |
||||
} |
||||
Loading…
Reference in new issue