http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java b/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java deleted file mode 100644 index d3cc369..0000000 --- a/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/StopWatchTestExecutionListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.util.StopWatch; -import org.apache.camel.util.TimeUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.test.context.TestContext; -import org.springframework.test.context.support.AbstractTestExecutionListener; - -/** - * An execution listener that simulates the timing output built in to {@link org.apache.camel.test.junit4.CamelTestSupport}. - */ -public class StopWatchTestExecutionListener extends AbstractTestExecutionListener { - - protected static ThreadLocal<StopWatch> threadStopWatch = new ThreadLocal<StopWatch>(); - - /** - * Exists primarily for testing purposes, but allows for access to the underlying stop watch instance for a test. - */ - public static StopWatch getStopWatch() { - return threadStopWatch.get(); - } - - @Override - public void beforeTestMethod(TestContext testContext) throws Exception { - StopWatch stopWatch = new StopWatch(); - threadStopWatch.set(stopWatch); - - stopWatch.restart(); - } - - @Override - public void afterTestMethod(TestContext testContext) throws Exception { - long time = threadStopWatch.get().stop(); - threadStopWatch.remove(); - Logger log = LoggerFactory.getLogger(testContext.getTestClass()); - - log.info("********************************************************************************"); - log.info("Testing done: " + testContext.getTestMethod().getName() + "(" + testContext.getTestClass().getName() + ")"); - log.info("Took: " + TimeUtils.printDuration(time) + " (" + time + " millis)"); - log.info("********************************************************************************"); - } - -}
http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java b/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java deleted file mode 100644 index 71487d1..0000000 --- a/components/camel-test-spring3/src/main/java/org/apache/camel/test/spring/UseAdviceWith.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apache.camel.CamelContext; - -/** - * Indicates the use of {@code adviceWith()} within the test class. If a class is annotated with - * this annotation and {@link UseAdviceWith#value()} returns true, any - * {@code CamelContext}s bootstrapped during the test through the use of Spring Test loaded - * application contexts will not be started automatically. The test author is responsible for - * injecting the Camel contexts into the test and executing {@link CamelContext#start()} on them - * at the appropriate time after any advice has been applied to the routes in the Camel context(s). - */ -@Documented -@Inherited -@Retention(RetentionPolicy.RUNTIME) -@Target({ElementType.TYPE}) -public @interface UseAdviceWith { - - /** - * Whether the test annotated with this annotation should be treated as if - * {@code adviceWith()} is in use in the test and the Camel contexts should not be started - * automatically. - * Defaults to {@code true}. - */ - boolean value() default true; -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/main/resources/META-INF/LICENSE.txt ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/main/resources/META-INF/LICENSE.txt b/components/camel-test-spring3/src/main/resources/META-INF/LICENSE.txt deleted file mode 100755 index 6b0b127..0000000 --- a/components/camel-test-spring3/src/main/resources/META-INF/LICENSE.txt +++ /dev/null @@ -1,203 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. - http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/main/resources/META-INF/NOTICE.txt ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/main/resources/META-INF/NOTICE.txt b/components/camel-test-spring3/src/main/resources/META-INF/NOTICE.txt deleted file mode 100644 index 2e215bf..0000000 --- a/components/camel-test-spring3/src/main/resources/META-INF/NOTICE.txt +++ /dev/null @@ -1,11 +0,0 @@ - ========================================================================= - == NOTICE file corresponding to the section 4 d of == - == the Apache License, Version 2.0, == - == in this case for the Apache Camel distribution. == - ========================================================================= - - This product includes software developed by - The Apache Software Foundation (http://www.apache.org/). - - Please read the different LICENSE files present in the licenses directory of - this distribution. http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java deleted file mode 100644 index 839dbf9..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.java +++ /dev/null @@ -1,116 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.issues; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.AdviceWithRouteBuilder; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * - */ -public class AdviceWithOnExceptionMultipleIssueTest extends CamelSpringTestSupport { - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/test/issues/AdviceWithOnExceptionMultipleIssueTest.xml"); - } - - @Override - public boolean isUseAdviceWith() { - return true; - } - - @Test - public void testSimpleMultipleAdvice() throws Exception { - context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() { - @Override - public void configure() throws Exception { - interceptSendToEndpoint("mock:resultA").process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - } - }); - } - }); - - context.getRouteDefinition("RouteB").adviceWith(context, new AdviceWithRouteBuilder() { - @Override - public void configure() throws Exception { - } - }); - - context.start(); - - getMockEndpoint("mock:resultA").expectedMessageCount(1); - template.sendBody("direct:startA", "a trigger"); - assertMockEndpointsSatisfied(); - } - - @Test - public void testMultipleAdviceWithExceptionThrown() throws Exception { - context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() { - @Override - public void configure() throws Exception { - interceptSendToEndpoint("mock:resultA").process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - throw new Exception("my exception"); - } - }); - } - }); - - context.start(); - - getMockEndpoint("mock:resultA").expectedMessageCount(0); - template.sendBody("direct:startA", "a trigger"); - assertMockEndpointsSatisfied(); - } - - @Test - public void testMultipleAdvice() throws Exception { - context.getRouteDefinition("RouteA").adviceWith(context, new AdviceWithRouteBuilder() { - @Override - public void configure() throws Exception { - interceptSendToEndpoint("mock:resultA").process(new Processor() { - @Override - public void process(Exchange exchange) throws Exception { - throw new Exception("my exception"); - } - }); - } - }); - - context.getRouteDefinition("RouteB").adviceWith(context, new AdviceWithRouteBuilder() { - @Override - public void configure() throws Exception { - } - }); - - context.start(); - - getMockEndpoint("mock:resultA").expectedMessageCount(0); - template.sendBody("direct:startA", "a trigger"); - assertMockEndpointsSatisfied(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/MockEndpointsAndSkipTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/MockEndpointsAndSkipTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/MockEndpointsAndSkipTest.java deleted file mode 100644 index d1bf95e..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/issues/MockEndpointsAndSkipTest.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.issues; - -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class MockEndpointsAndSkipTest extends CamelSpringTestSupport { - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/test/issues/MockEndpointsAndSkipTest.xml"); - } - - @Override - public String isMockEndpointsAndSkip() { - return "seda*"; - } - - @Test - public void testHelloWorld() throws Exception { - getMockEndpoint("mock:seda:foo").expectedBodiesReceived("Hello World"); - - template.sendBody("direct:start", "Hello World"); - - assertMockEndpointsSatisfied(); - } - - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java deleted file mode 100644 index 0a13b66..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringCamelContextTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -import org.apache.camel.builder.RouteBuilder; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - - -public class DebugSpringCamelContextTest extends DebugSpringTest { - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - // there is no route to be used - } - }; - } - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/test/patterns/applicationContext.xml"); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java deleted file mode 100644 index 482e2ef..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/DebugSpringTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.model.ProcessorDefinition; -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.GenericApplicationContext; - -public class DebugSpringTest extends CamelSpringTestSupport { - private boolean debugged; - - @Override - public boolean isUseDebugger() { - // must enable debugger - return true; - } - - @Override - protected void debugBefore(Exchange exchange, Processor processor, - ProcessorDefinition<?> definition, String id, String shortName) { - // this method is invoked before we are about to enter the given processor - // from your Java editor you can just add a breakpoint in the code line below - log.info("Before " + definition + " with body " + exchange.getIn().getBody()); - debugged = true; - } - - - @Test - public void testDebugger() throws Exception { - // set mock expectations - getMockEndpoint("mock:a").expectedMessageCount(1); - getMockEndpoint("mock:b").expectedMessageCount(1); - - // send a message - template.sendBody("direct:start", "World"); - - // assert mocks - assertMockEndpointsSatisfied(); - assertTrue("The debugger is not called!", debugged); - } - - @Override - protected RouteBuilder createRouteBuilder() throws Exception { - return new RouteBuilder() { - @Override - public void configure() throws Exception { - // this is the route we want to debug - from("direct:start") - .to("mock:a") - .transform(body().prepend("Hello ")) - .to("mock:b"); - } - }; - } - - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new GenericApplicationContext(); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java deleted file mode 100644 index 100b349..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MyProduceBean.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Produce; -import org.apache.camel.ProducerTemplate; - -/** - * - */ -public class MyProduceBean { - - @Produce(uri = "mock:result") - MySender sender; - - @EndpointInject(uri = "direct:start") - ProducerTemplate template; - - public void doSomething(String body) { - sender.send(body); - } - - public ProducerTemplate getProducerTemplate() { - return template; - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MySender.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MySender.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MySender.java deleted file mode 100644 index e36c042..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/MySender.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -/** - * - */ -public interface MySender { - - void send(String body); -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java deleted file mode 100644 index 5d9417f..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProduceBeanTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -import org.apache.camel.test.spring.CamelSpringTestSupport; -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -/** - * - */ -public class ProduceBeanTest extends CamelSpringTestSupport { - - @Test - public void testProduceBean() throws Exception { - getMockEndpoint("mock:result").expectedMessageCount(1); - - template.sendBody("direct:start", "Hello World"); - - assertMockEndpointsSatisfied(); - } - - @Override - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/test/patterns/ProduceBeanTest.xml"); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProducerBeanInjectTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProducerBeanInjectTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProducerBeanInjectTest.java deleted file mode 100644 index fd794c6..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/patterns/ProducerBeanInjectTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.patterns; - -import org.junit.Assert; -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class ProducerBeanInjectTest extends Assert { - - @Test - public void checkProducerBeanInjection() { - AbstractApplicationContext applicationContext = createApplicationContext(); - MyProduceBean bean = applicationContext.getBean("myProduceBean", MyProduceBean.class); - assertNotNull("The producerTemplate should not be null.", bean.getProducerTemplate()); - assertEquals("Get a wrong response", "Camel rocks!", bean.getProducerTemplate().requestBody("Camel")); - } - - protected AbstractApplicationContext createApplicationContext() { - return new ClassPathXmlApplicationContext("org/apache/camel/test/patterns/ProduceBeanInjectTest.xml"); - } - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java deleted file mode 100644 index 2478bf0..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringActiveProfileTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.CamelContext; -import org.apache.camel.Produce; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.component.mock.MockEndpoint; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.ContextConfiguration; - -// START SNIPPET: e1 - -/** - * Spring style testing with annotations to configure and setup the test. - * <p/> - * As we do next extend any base test class, we need to inject our resources - * for testing such as the {@link CamelContext} and {@link ProducerTemplate}. - */ -@ContextConfiguration -@ActiveProfiles("test") -@RunWith(CamelSpringJUnit4ClassRunner.class) -public class CamelSpringActiveProfileTest { - - @Autowired - protected CamelContext camelContext; - @Produce(uri = "direct:start", context = "camelContext") - protected ProducerTemplate start; - - @Test - public void testLoadActiveProfile() throws InterruptedException { - MockEndpoint mock = camelContext.getEndpoint("mock:test", MockEndpoint.class); - mock.expectedBodiesReceived("Hello World"); - start.sendBody("World"); - mock.assertIsSatisfied(); - } - -} -// END SNIPPET: e1 http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java deleted file mode 100644 index 89c1105..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.management.DefaultManagementStrategy; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -@DisableJmx -public class CamelSpringJUnit4ClassRunnerDisableJmxInheritedOverrideTest - extends CamelSpringJUnit4ClassRunnerDisableJmxTest { - - @Test - public void testJmx() throws Exception { - assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java deleted file mode 100644 index b0630e5..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -public class CamelSpringJUnit4ClassRunnerDisableJmxInheritedTest - extends CamelSpringJUnit4ClassRunnerDisableJmxTest { -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxTest.java deleted file mode 100644 index 67cfd7b..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerDisableJmxTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.management.ManagedManagementStrategy; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -@DisableJmx(false) -public class CamelSpringJUnit4ClassRunnerDisableJmxTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @Test - @Override - public void testJmx() throws Exception { - assertEquals(ManagedManagementStrategy.class, camelContext.getManagementStrategy().getClass()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java deleted file mode 100644 index 1d9d2ad..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerExcludeRoutesTest.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import static org.junit.Assert.assertNull; - -@ExcludeRoutes(TestRouteBuilder.class) -public class CamelSpringJUnit4ClassRunnerExcludeRoutesTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @Override - public void testExcludedRoute() { - assertNull(camelContext.getRoute("excludedRoute")); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java deleted file mode 100644 index 37d2c1d..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.junit.Test; -import static org.junit.Assert.assertTrue; - -@SuppressWarnings("deprecation") -@LazyLoadTypeConverters(true) -public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedOverrideTest - extends CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest { - - @Test - @Override - public void testLazyLoadTypeConverters() { - assertTrue(camelContext.isLazyLoadTypeConverters()); - assertTrue(camelContext2.isLazyLoadTypeConverters()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java deleted file mode 100644 index 229e3c9..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersInheritedTest - extends CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest { -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java deleted file mode 100644 index 20bc31a..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.junit.Test; -import static org.junit.Assert.assertFalse; - -@SuppressWarnings("deprecation") -@LazyLoadTypeConverters(false) -public class CamelSpringJUnit4ClassRunnerLazyLoadTypeConvertersTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @Test - @Override - public void testLazyLoadTypeConverters() { - assertFalse(camelContext.isLazyLoadTypeConverters()); - assertFalse(camelContext2.isLazyLoadTypeConverters()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java deleted file mode 100644 index 59191ad..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.EndpointInject; -import org.apache.camel.ServiceStatus; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.component.seda.SedaEndpoint; -import org.apache.camel.impl.InterceptSendToEndpoint; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@MockEndpointsAndSkip("{{mock.skip}}") -public class CamelSpringJUnit4ClassRunnerMockEndpointsAndSkipTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @EndpointInject(uri = "mock:seda:context2.seda", context = "camelContext2") - protected MockEndpoint mock; - - @EndpointInject(uri = "seda:context2.seda", context = "camelContext2") - private InterceptSendToEndpoint original; - - @Test - @Override - public void testPositive() throws Exception { - assertEquals(ServiceStatus.Started, camelContext.getStatus()); - assertEquals(ServiceStatus.Started, camelContext2.getStatus()); - - mockA.expectedBodiesReceived("David"); - mockB.expectedBodiesReceived("Hello David"); - mock.expectedBodiesReceived("Hello David"); - - start.sendBody("David"); - start2.sendBody("David"); - - MockEndpoint.assertIsSatisfied(camelContext); - MockEndpoint.assertIsSatisfied(camelContext2); - assertTrue("Original endpoint was invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().isEmpty()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java deleted file mode 100644 index 73dac9f..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerMockEndpointsTest.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.EndpointInject; -import org.apache.camel.ServiceStatus; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.component.seda.SedaEndpoint; -import org.apache.camel.impl.InterceptSendToEndpoint; -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -@MockEndpoints("seda:context2.seda") -public class CamelSpringJUnit4ClassRunnerMockEndpointsTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @EndpointInject(uri = "mock:seda:context2.seda", context = "camelContext2") - protected MockEndpoint mock; - - @EndpointInject(uri = "seda:context2.seda", context = "camelContext2") - private InterceptSendToEndpoint original; - - @Test - @Override - public void testPositive() throws Exception { - - assertEquals(ServiceStatus.Started, camelContext.getStatus()); - assertEquals(ServiceStatus.Started, camelContext2.getStatus()); - - mockA.expectedBodiesReceived("David"); - mockB.expectedBodiesReceived("Hello David"); - mockC.expectedBodiesReceived("David"); - mock.expectedBodiesReceived("Hello David"); - - start.sendBody("David"); - start2.sendBody("David"); - - MockEndpoint.assertIsSatisfied(camelContext); - MockEndpoint.assertIsSatisfied(camelContext2); - assertTrue("Original endpoint should be invoked", ((SedaEndpoint) original.getDelegate()).getExchanges().size() == 1); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java deleted file mode 100644 index 337d387..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerPlainTest.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import java.util.concurrent.TimeUnit; - -import org.apache.camel.CamelContext; -import org.apache.camel.EndpointInject; -import org.apache.camel.Produce; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.ServiceStatus; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.management.DefaultManagementStrategy; -import org.apache.camel.util.StopWatch; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.annotation.DirtiesContext; -import org.springframework.test.annotation.DirtiesContext.ClassMode; -import org.springframework.test.context.ContextConfiguration; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -// START SNIPPET: e1 -@RunWith(CamelSpringJUnit4ClassRunner.class) -@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 CamelSpringJUnit4ClassRunnerPlainTest { - - @Autowired - protected CamelContext camelContext; - - @Autowired - protected CamelContext camelContext2; - - @EndpointInject(uri = "mock:a", context = "camelContext") - protected MockEndpoint mockA; - - @EndpointInject(uri = "mock:b", context = "camelContext") - protected MockEndpoint mockB; - - @EndpointInject(uri = "mock:c", context = "camelContext2") - protected MockEndpoint mockC; - - @Produce(uri = "direct:start", context = "camelContext") - protected ProducerTemplate start; - - @Produce(uri = "direct:start2", context = "camelContext2") - protected ProducerTemplate start2; - - @Test - public void testPositive() throws Exception { - assertEquals(ServiceStatus.Started, camelContext.getStatus()); - assertEquals(ServiceStatus.Started, camelContext2.getStatus()); - - mockA.expectedBodiesReceived("David"); - mockB.expectedBodiesReceived("Hello David"); - mockC.expectedBodiesReceived("David"); - - start.sendBody("David"); - start2.sendBody("David"); - - MockEndpoint.assertIsSatisfied(camelContext); - MockEndpoint.assertIsSatisfied(camelContext2); - } - - @Test - public void testJmx() throws Exception { - assertEquals(DefaultManagementStrategy.class, camelContext.getManagementStrategy().getClass()); - } - - @Test - public void testShutdownTimeout() throws Exception { - assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); - assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); - } - - @Test - public void testStopwatch() { - StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch(); - - assertNotNull(stopWatch); - assertTrue(stopWatch.taken() < 100); - } - - @Test - public void testExcludedRoute() { - assertNotNull(camelContext.getRoute("excludedRoute")); - } - - @Test - public void testProvidesBreakpoint() { - assertNull(camelContext.getDebugger()); - assertNull(camelContext2.getDebugger()); - } - - @SuppressWarnings("deprecation") - @Test - public void testLazyLoadTypeConverters() { - assertTrue(camelContext.isLazyLoadTypeConverters()); - assertTrue(camelContext2.isLazyLoadTypeConverters()); - } -} -// END SNIPPET: e1 http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java deleted file mode 100644 index 98d47e8..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -public class CamelSpringJUnit4ClassRunnerProvidesBreakpointInherritedTest - extends CamelSpringJUnit4ClassRunnerProvidesBreakpointTest { - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java deleted file mode 100644 index ae2d637..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerProvidesBreakpointTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.Exchange; -import org.apache.camel.Processor; -import org.apache.camel.impl.BreakpointSupport; -import org.apache.camel.model.ProcessorDefinition; -import org.apache.camel.spi.Breakpoint; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class CamelSpringJUnit4ClassRunnerProvidesBreakpointTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @ProvidesBreakpoint - public static Breakpoint createBreakpoint() { - return new TestBreakpoint(); - } - - @Test - @Override - public void testProvidesBreakpoint() { - assertNotNull(camelContext.getDebugger()); - assertNotNull(camelContext2.getDebugger()); - - start.sendBody("David"); - - assertNotNull(camelContext.getDebugger()); - assertNotNull(camelContext.getDebugger().getBreakpoints()); - assertEquals(1, camelContext.getDebugger().getBreakpoints().size()); - - 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; - - @Override - public void beforeProcess(Exchange exchange, Processor processor, ProcessorDefinition<?> definition) { - breakpointHit = true; - } - - public boolean isBreakpointHit() { - return breakpointHit; - } - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java deleted file mode 100644 index c011d1f..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import java.util.concurrent.TimeUnit; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -@ShutdownTimeout -public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedOverrideTest - extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest { - - @Test - @Override - public void testShutdownTimeout() throws Exception { - assertEquals(10, camelContext.getShutdownStrategy().getTimeout()); - assertEquals(TimeUnit.SECONDS, camelContext.getShutdownStrategy().getTimeUnit()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java deleted file mode 100644 index 9f66625..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -public class CamelSpringJUnit4ClassRunnerShutdownTimeoutInheritedTest - extends CamelSpringJUnit4ClassRunnerShutdownTimeoutTest { - -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java deleted file mode 100644 index 85a80ba..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerShutdownTimeoutTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import java.util.concurrent.TimeUnit; - -import org.junit.Test; -import static org.junit.Assert.assertEquals; - -@ShutdownTimeout(value = 11, timeUnit = TimeUnit.MILLISECONDS) -public class CamelSpringJUnit4ClassRunnerShutdownTimeoutTest - extends CamelSpringJUnit4ClassRunnerPlainTest { - - @Test - @Override - public void testShutdownTimeout() throws Exception { - assertEquals(11, camelContext.getShutdownStrategy().getTimeout()); - assertEquals(TimeUnit.MILLISECONDS, camelContext.getShutdownStrategy().getTimeUnit()); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java deleted file mode 100644 index 7cf5e06..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringJUnit4ClassRunnerUseAdviceWithTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.ServiceStatus; -import org.apache.camel.util.StopWatch; -import org.junit.Before; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -@UseAdviceWith -public class CamelSpringJUnit4ClassRunnerUseAdviceWithTest extends CamelSpringJUnit4ClassRunnerPlainTest { - - @Before - public void testContextStarted() throws Exception { - - assertEquals(ServiceStatus.Stopped, camelContext.getStatus()); - assertEquals(ServiceStatus.Stopped, camelContext2.getStatus()); - camelContext.start(); - camelContext2.start(); - - // just sleep a little to simulate testing take a bit time - Thread.sleep(1000); - } - - @Test - public void testStopwatch() { - StopWatch stopWatch = StopWatchTestExecutionListener.getStopWatch(); - - assertNotNull(stopWatch); - long taken = stopWatch.taken(); - assertTrue(taken + " > 0, but was: " + taken, taken > 0); - assertTrue(taken + " < 3000, but was: " + taken, taken < 3000); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java deleted file mode 100644 index 7e7445c..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/CamelSpringTestSupportActiveProfileTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.junit.Test; -import org.springframework.context.support.AbstractApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -// START SNIPPET: e1 - -/** - * Just extend the CamelSpringTestSupport and use Camel test kit for easy Camel based unit testing. - */ -public class CamelSpringTestSupportActiveProfileTest extends CamelSpringTestSupport { - - @Override - protected AbstractApplicationContext createApplicationContext() { - // must not refresh when using active profiles - // lets reuse the xml file from the other test - return new ClassPathXmlApplicationContext(new String[]{"org/apache/camel/test/spring/CamelSpringActiveProfileTest-context.xml"}, false); - } - - @Override - protected String[] activeProfiles() { - // return the active profiles to be used - return new String[]{"test"}; - } - - @Test - public void testLoadActiveProfile() throws InterruptedException { - getMockEndpoint("mock:test").expectedBodiesReceived("Hello World"); - template.sendBody("direct:start", "World"); - assertMockEndpointsSatisfied(); - } - -} -// END SNIPPET: e1 http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java b/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java deleted file mode 100644 index 52059c4..0000000 --- a/components/camel-test-spring3/src/test/java/org/apache/camel/test/spring/TestRouteBuilder.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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.apache.camel.test.spring; - -import org.apache.camel.builder.RouteBuilder; - -public class TestRouteBuilder extends RouteBuilder { - - @Override - public void configure() throws Exception { - - from("direct:z") - .routeId("excludedRoute") - .to("log:org.apache.camel.test.junit4.spring"); - } -} http://git-wip-us.apache.org/repos/asf/camel/blob/ab388bf2/components/camel-test-spring3/src/test/resources/jndi.properties ---------------------------------------------------------------------- diff --git a/components/camel-test-spring3/src/test/resources/jndi.properties b/components/camel-test-spring3/src/test/resources/jndi.properties deleted file mode 100644 index 5961589..0000000 --- a/components/camel-test-spring3/src/test/resources/jndi.properties +++ /dev/null @@ -1,22 +0,0 @@ -## --------------------------------------------------------------------------- -## Licensed to the Apache Software Foundation (ASF) under one or more -## contributor license agreements. See the NOTICE file distributed with -## this work for additional information regarding copyright ownership. -## The ASF licenses this file to You 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. -## --------------------------------------------------------------------------- - -# START SNIPPET: jndi - -java.naming.factory.initial = org.apache.camel.util.jndi.CamelInitialContextFactory - -# END SNIPPET: jndi