This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch CAMEL-13965 in repository https://gitbox.apache.org/repos/asf/camel.git
commit c010e8ae06b09ac848ae26924c90fa18b372b9b0 Author: aldettinger <aldettin...@gmail.com> AuthorDate: Thu Sep 12 20:41:37 2019 +0200 CAMEL-13965: Cleaned the code with constant semantics --- .../src/main/docs/test-spring-junit5.adoc | 8 ++--- .../AdviceWithOnExceptionMultipleIssueTest.java | 3 -- .../test/patterns/DebugSpringCamelContextTest.java | 2 +- .../camel/test/patterns/DebugSpringTest.java | 2 +- .../apache/camel/test/patterns/MyProduceBean.java | 5 +--- .../org/apache/camel/test/patterns/MySender.java | 3 -- .../camel/test/patterns/ProduceBeanTest.java | 3 -- .../test/spring/CamelSpringActiveProfileTest.java | 2 +- ...CamelSpringDisableJmxInheritedOverrideTest.java | 2 +- .../test/spring/CamelSpringDisableJmxTest.java | 2 +- ...ingOverridePropertiesForPropertyInjectTest.java | 8 ++--- .../spring/CamelSpringOverridePropertiesTest.java | 2 +- .../camel/test/spring/CamelSpringPlainTest.java | 34 +++++++++++----------- .../CamelSpringPropertiesLocationElementTest.java | 2 +- .../spring/CamelSpringProvidesBreakpointTest.java | 4 +-- ...lSpringRouteProcessorDumpRouteCoverageTest.java | 4 +-- ...SpringShutdownTimeoutInheritedOverrideTest.java | 2 +- .../spring/CamelSpringShutdownTimeoutTest.java | 2 +- .../test/spring/CamelSpringUseAdviceWithTest.java | 6 ++-- .../spring/TestPropertyInjectRouteBuilder.java | 4 +-- .../apache/camel/test/spring/TestRouteBuilder.java | 3 +- 21 files changed, 45 insertions(+), 58 deletions(-) diff --git a/components/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc b/components/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc index be53e83..fa3e2ab 100644 --- a/components/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc +++ b/components/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc @@ -46,20 +46,20 @@ protected abstract AbstractApplicationContext createApplicationContext(); Another approach involves the usage of the `org.apache.camel.test.spring.junit5.CamelSpringTest` annotation, for instance: ---- @CamelSpringTest -@ContextConfiguration() +@ContextConfiguration @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class CamelSpringPlainTest { @Autowired protected CamelContext camelContext; - @EndpointInject(value = "mock:a") + @EndpointInject("mock:a") protected MockEndpoint mockA; - @EndpointInject(value = "mock:b") + @EndpointInject("mock:b") protected MockEndpoint mockB; - @Produce(value = "direct:start") + @Produce("direct:start") protected ProducerTemplate start; @Test diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java index d7d5bdc..c2d1437 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java @@ -25,9 +25,6 @@ import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -/** - * - */ public class AdviceWithOnExceptionMultipleIssueTest extends CamelSpringTestSupport { @Override diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java index ccac96f..3be8b2e 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java @@ -24,7 +24,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; public class DebugSpringCamelContextTest extends DebugSpringTest { @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() throws Exception { diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java index de36d21..6dec6be 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java @@ -65,7 +65,7 @@ public class DebugSpringTest extends CamelSpringTestSupport { } @Override - protected RouteBuilder createRouteBuilder() throws Exception { + protected RouteBuilder createRouteBuilder() { return new RouteBuilder() { @Override public void configure() throws Exception { diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java index c692033..87cafd8 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java @@ -20,9 +20,6 @@ import org.apache.camel.EndpointInject; import org.apache.camel.Produce; import org.apache.camel.ProducerTemplate; -/** - * - */ public class MyProduceBean { @Produce("mock:result") @@ -34,7 +31,7 @@ public class MyProduceBean { public void doSomething(String body) { sender.send(body); } - + public ProducerTemplate getProducerTemplate() { return template; } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MySender.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MySender.java index 0319c98..6bc19f5 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MySender.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/MySender.java @@ -16,9 +16,6 @@ */ package org.apache.camel.test.patterns; -/** - * - */ public interface MySender { void send(String body); diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java index c02aed8..01597ba 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java @@ -21,9 +21,6 @@ import org.junit.jupiter.api.Test; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -/** - * - */ public class ProduceBeanTest extends CamelSpringTestSupport { @Test diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java index e006efd..10b2d6d 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java @@ -42,7 +42,7 @@ public class CamelSpringActiveProfileTest { @Autowired protected CamelContext camelContext; - @Produce(value = "direct:start") + @Produce("direct:start") protected ProducerTemplate start; @Test diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxInheritedOverrideTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxInheritedOverrideTest.java index 9f904c5..0412eb6 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxInheritedOverrideTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxInheritedOverrideTest.java @@ -28,7 +28,7 @@ public class CamelSpringDisableJmxInheritedOverrideTest @Override @Test - public void testJmx() throws Exception { + public void testJmx() { assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); } } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxTest.java index 50848b4..902168a 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringDisableJmxTest.java @@ -28,7 +28,7 @@ public class CamelSpringDisableJmxTest @Test @Override - public void testJmx() throws Exception { + public void testJmx() { assertEquals(JmxManagementStrategy.class, camelContext.getManagementStrategy().getClass()); } } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java index aa576c0..98aaab5 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesForPropertyInjectTest.java @@ -30,12 +30,12 @@ import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.core.Is.is; @CamelSpringTest -@ContextConfiguration() +@ContextConfiguration @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class CamelSpringOverridePropertiesForPropertyInjectTest { - + private static final String EXPECTED_PROPERTY_VALUE = "The value is overriden"; - + @Produce("direct:start-override-route") private ProducerTemplate start; @@ -47,7 +47,7 @@ public class CamelSpringOverridePropertiesForPropertyInjectTest { } @Test - public void testOverride() throws Exception { + public void testOverride() { String response = start.requestBody((Object)"ignored", String.class); assertThat(response, is(EXPECTED_PROPERTY_VALUE)); diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesTest.java index d5d8fbf..aaed058 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringOverridePropertiesTest.java @@ -29,7 +29,7 @@ import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ContextConfiguration; @CamelSpringTest -@ContextConfiguration() +@ContextConfiguration // Put here to prevent Spring context caching across tests and test methods since some tests inherit // from this test and therefore use the same Spring context. Also because we want to reset the // Camel context and mock endpoints between test methods automatically. diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPlainTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPlainTest.java index 84e2622..bed1c68 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPlainTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPlainTest.java @@ -41,25 +41,25 @@ import static org.junit.jupiter.api.Assertions.assertTrue; // tag::example[] @CamelSpringTest -@ContextConfiguration() +@ContextConfiguration // Put here to prevent Spring context caching across tests and test methods since some tests inherit // from this test and therefore use the same Spring context. Also because we want to reset the // Camel context and mock endpoints between test methods automatically. @DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) public class CamelSpringPlainTest { - + @Autowired protected CamelContext camelContext; - - @EndpointInject(value = "mock:a") + + @EndpointInject("mock:a") protected MockEndpoint mockA; - - @EndpointInject(value = "mock:b") + + @EndpointInject("mock:b") protected MockEndpoint mockB; - - @Produce(value = "direct:start") + + @Produce("direct:start") protected ProducerTemplate start; - + @Test public void testPositive() throws Exception { assertEquals(ServiceStatus.Started, camelContext.getStatus()); @@ -71,18 +71,18 @@ public class CamelSpringPlainTest { MockEndpoint.assertIsSatisfied(camelContext); } - + @Test - public void testJmx() throws Exception { + public void testJmx() { assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); } - + @Test - public void testShutdownTimeout() throws Exception { + public void testShutdownTimeout() { assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); } - + @Test public void testStopwatch() { StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch(); @@ -90,19 +90,19 @@ public class CamelSpringPlainTest { assertNotNull(stopWatch); assertTrue(stopWatch.taken() < 100); } - + @Test public void testExcludedRoute() { assertNotNull(camelContext.getRoute("excludedRoute")); } - + @Test public void testProvidesBreakpoint() { assertNull(camelContext.getDebugger()); } @Test - public void testRouteCoverage() throws Exception { + public void testRouteCoverage() { // noop } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPropertiesLocationElementTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPropertiesLocationElementTest.java index 1a54a1a..999c5c2 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPropertiesLocationElementTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringPropertiesLocationElementTest.java @@ -34,7 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; @CamelSpringTest -@ContextConfiguration() +@ContextConfiguration @DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD) public class CamelSpringPropertiesLocationElementTest { @Autowired diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringProvidesBreakpointTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringProvidesBreakpointTest.java index 95a0341..f4ce323 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringProvidesBreakpointTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringProvidesBreakpointTest.java @@ -35,7 +35,7 @@ public class CamelSpringProvidesBreakpointTest public static Breakpoint createBreakpoint() { return new TestBreakpoint(); } - + @Test @Override public void testProvidesBreakpoint() { @@ -50,7 +50,7 @@ public class CamelSpringProvidesBreakpointTest assertTrue(camelContext.getDebugger().getBreakpoints().get(0) instanceof TestBreakpoint); assertTrue(((TestBreakpoint) camelContext.getDebugger().getBreakpoints().get(0)).isBreakpointHit()); } - + private static final class TestBreakpoint extends BreakpointSupport { private boolean breakpointHit; diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java index 568ce5e..8ef5fbe 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringRouteProcessorDumpRouteCoverageTest.java @@ -40,13 +40,13 @@ public class CamelSpringRouteProcessorDumpRouteCoverageTest extends CamelSpringP @Override @Test @Disabled("@TODO: This test passes standalone but fail when run among other. Fix in a dedicated commit.") - public void testJmx() throws Exception { + public void testJmx() { // JMX is enabled with route coverage assertEquals(JmxManagementStrategy.class, camelContext.getManagementStrategy().getClass()); } @Override - public void testRouteCoverage() throws Exception { + public void testRouteCoverage() { camelContext.stop(); // there should be files diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java index f9c028a..b4f4d75 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutInheritedOverrideTest.java @@ -29,7 +29,7 @@ public class CamelSpringShutdownTimeoutInheritedOverrideTest @Test @Override - public void testShutdownTimeout() throws Exception { + public void testShutdownTimeout() { assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutTest.java index ebf4cc2..60bc496 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringShutdownTimeoutTest.java @@ -29,7 +29,7 @@ public class CamelSpringShutdownTimeoutTest @Test @Override - public void testShutdownTimeout() throws Exception { + public void testShutdownTimeout() { assertEquals(11, camelContext.getShutdownStrategy().getTimeout()); assertEquals(TimeUnit.MILLISECONDS, camelContext.getShutdownStrategy().getTimeUnit()); } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringUseAdviceWithTest.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringUseAdviceWithTest.java index d53c0d6..a8125f2 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringUseAdviceWithTest.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/CamelSpringUseAdviceWithTest.java @@ -29,7 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @UseAdviceWith public class CamelSpringUseAdviceWithTest extends CamelSpringPlainTest { - + @BeforeEach public void testContextStarted() throws Exception { assertEquals(ServiceStatus.Stopped, camelContext.getStatus()); @@ -38,12 +38,12 @@ public class CamelSpringUseAdviceWithTest extends CamelSpringPlainTest { // just sleep a little to simulate testing take a bit time Thread.sleep(1000); } - + @Override @Test public void testStopwatch() { StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch(); - + assertNotNull(stopWatch); long taken = stopWatch.taken(); assertTrue(taken > 0, taken + " > 0, but was: " + taken); diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestPropertyInjectRouteBuilder.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestPropertyInjectRouteBuilder.java index 62db815..bf10a05 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestPropertyInjectRouteBuilder.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestPropertyInjectRouteBuilder.java @@ -23,9 +23,9 @@ public class TestPropertyInjectRouteBuilder extends RouteBuilder { @PropertyInject("{{property.to.override}}") private String propertyToOverride; - + @Override - public void configure() throws Exception { + public void configure() { from("direct:start-override-route") .transform(constant(propertyToOverride)); } diff --git a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java index 01d7331..ef5eb2d 100644 --- a/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java +++ b/components/camel-test-spring-junit5/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java @@ -21,8 +21,7 @@ import org.apache.camel.builder.RouteBuilder; public class TestRouteBuilder extends RouteBuilder { @Override - public void configure() throws Exception { - + public void configure() { from("direct:z") .routeId("excludedRoute") .to("log:org.apache.camel.test.spring.junit5");