This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel.git
commit 37852c3729a9de25941a0af517ff4c6dcc2a25ce Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Fri Mar 12 08:30:55 2021 +0100 CAMEL-16334 - Having a middle folder for test (unit + testcontainers) components --- bom/camel-bom/pom.xml | 8 +-- .../apache/camel/catalog/docs/mock-component.adoc | 4 +- .../org/apache/camel/catalog/others.properties | 1 - .../org/apache/camel/catalog/others/test.json | 15 ----- .../camel-mock/src/main/docs/mock-component.adoc | 4 +- .../java/org/apache/camel/test/cdi/FilterTest.java | 73 ---------------------- .../patterns/IsMockEndpointsAndSkipJUnit4Test.java | 0 .../test/patterns/IsMockEndpointsJUnit4Test.java | 0 .../modules/ROOT/pages/mock-component.adoc | 4 +- docs/components/modules/others/pages/test-cdi.adoc | 2 +- .../modules/others/pages/test-junit5.adoc | 2 +- .../modules/others/pages/test-spring-junit5.adoc | 2 +- .../modules/others/pages/test-spring.adoc | 2 +- docs/components/modules/others/pages/test.adoc | 2 +- .../others/pages/testcontainers-junit5.adoc | 2 +- .../others/pages/testcontainers-spring-junit5.adoc | 2 +- .../others/pages/testcontainers-spring.adoc | 2 +- .../modules/others/pages/testcontainers.adoc | 2 +- .../java/org/apache/camel/test/cdi/FilterTest.java | 0 .../test/spring/CamelSpringRunnerPlainTest.java | 0 docs/user-manual/modules/ROOT/pages/testing.adoc | 6 +- parent/pom.xml | 6 +- 22 files changed, 25 insertions(+), 114 deletions(-) diff --git a/bom/camel-bom/pom.xml b/bom/camel-bom/pom.xml index 0b195ee..f464b36 100644 --- a/bom/camel-bom/pom.xml +++ b/bom/camel-bom/pom.xml @@ -1820,22 +1820,22 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-parent</artifactId> + <artifactId>camel-test</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test</artifactId> + <artifactId>camel-test-cdi</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-cdi</artifactId> + <artifactId>camel-test-junit5</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-junit5</artifactId> + <artifactId>camel-test-parent</artifactId> <version>${project.version}</version> </dependency> <dependency> diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mock-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mock-component.adoc index aa914e2..e10d305 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mock-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/mock-component.adoc @@ -338,7 +338,7 @@ instead. [source,java] .*`isMockEndpoints` using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] ---- @@ -401,7 +401,7 @@ The same example using the Test Kit [source,java] .*isMockEndpointsAndSkip using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] ---- == Limiting the number of messages to keep diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties index aa9f1a3..5d7d5d5 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others.properties @@ -33,7 +33,6 @@ spring-main spring-security spring-xml swagger-java -test test-cdi test-junit5 test-spring diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/test.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/test.json deleted file mode 100644 index 906a658..0000000 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/others/test.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "other": { - "kind": "other", - "name": "test", - "title": "Test", - "description": "Camel unit testing", - "deprecated": false, - "firstVersion": "2.9.0", - "label": "testing,java", - "supportLevel": "Stable", - "groupId": "org.apache.camel", - "artifactId": "camel-test", - "version": "3.9.0-SNAPSHOT" - } -} diff --git a/components/camel-mock/src/main/docs/mock-component.adoc b/components/camel-mock/src/main/docs/mock-component.adoc index aa914e2..e10d305 100644 --- a/components/camel-mock/src/main/docs/mock-component.adoc +++ b/components/camel-mock/src/main/docs/mock-component.adoc @@ -338,7 +338,7 @@ instead. [source,java] .*`isMockEndpoints` using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] ---- @@ -401,7 +401,7 @@ The same example using the Test Kit [source,java] .*isMockEndpointsAndSkip using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] ---- == Limiting the number of messages to keep diff --git a/docs/components/modules/ROOT/examples/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java b/docs/components/modules/ROOT/examples/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java deleted file mode 100644 index 4171106..0000000 --- a/docs/components/modules/ROOT/examples/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java +++ /dev/null @@ -1,73 +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.cdi; - -import org.apache.camel.EndpointInject; -import org.apache.camel.Produce; -import org.apache.camel.ProducerTemplate; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; - -// START SNIPPET: example -// tag::example[] -@RunWith(CamelCdiRunner.class) -public class FilterTest { - - @EndpointInject("mock:result") - protected MockEndpoint resultEndpoint; - - @Produce("direct:start") - protected ProducerTemplate template; - - @Before - public void before() { - resultEndpoint.reset(); - } - - @Test - public void testSendMatchingMessage() throws Exception { - String expectedBody = "<matched/>"; - - resultEndpoint.expectedBodiesReceived(expectedBody); - - template.sendBodyAndHeader(expectedBody, "foo", "bar"); - - resultEndpoint.assertIsSatisfied(); - } - - @Test - public void testSendNotMatchingMessage() throws Exception { - resultEndpoint.expectedMessageCount(0); - - template.sendBodyAndHeader("<notMatched/>", "foo", "notMatchedHeaderValue"); - - resultEndpoint.assertIsSatisfied(); - } - - static class ContextConfig extends RouteBuilder { - - @Override - public void configure() { - from("direct:start").filter(header("foo").isEqualTo("bar")).to("mock:result"); - } - } -} -// end::example[] -// END SNIPPET: example diff --git a/docs/components/modules/ROOT/examples/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java b/docs/components/modules/ROOT/examples/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java similarity index 100% rename from docs/components/modules/ROOT/examples/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java rename to docs/components/modules/ROOT/examples/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java diff --git a/docs/components/modules/ROOT/examples/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java b/docs/components/modules/ROOT/examples/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java similarity index 100% rename from docs/components/modules/ROOT/examples/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java rename to docs/components/modules/ROOT/examples/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java diff --git a/docs/components/modules/ROOT/pages/mock-component.adoc b/docs/components/modules/ROOT/pages/mock-component.adoc index b0faa7f..db1a1e5 100644 --- a/docs/components/modules/ROOT/pages/mock-component.adoc +++ b/docs/components/modules/ROOT/pages/mock-component.adoc @@ -340,7 +340,7 @@ instead. [source,java] .*`isMockEndpoints` using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsJUnit4Test.java[tags=e1] ---- @@ -403,7 +403,7 @@ The same example using the Test Kit [source,java] .*isMockEndpointsAndSkip using camel-test kit* ---- -include::{examplesdir}/components/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] +include::{examplesdir}/components/camel-test/camel-test/src/test/java/org/apache/camel/test/patterns/IsMockEndpointsAndSkipJUnit4Test.java[tags=e1] ---- == Limiting the number of messages to keep diff --git a/docs/components/modules/others/pages/test-cdi.adoc b/docs/components/modules/others/pages/test-cdi.adoc index 6ee9b3b..c9e2490 100644 --- a/docs/components/modules/others/pages/test-cdi.adoc +++ b/docs/components/modules/others/pages/test-cdi.adoc @@ -1,7 +1,7 @@ [[test-cdi-other]] = Test CDI Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-test-cdi/src/main/docs/test-cdi.adoc +:page-source: components/camel-test/camel-test-cdi/src/main/docs/test-cdi.adoc :docTitle: Test CDI :artifactId: camel-test-cdi :description: Camel unit testing with CDI diff --git a/docs/components/modules/others/pages/test-junit5.adoc b/docs/components/modules/others/pages/test-junit5.adoc index 9d89db7..ae264b5 100644 --- a/docs/components/modules/others/pages/test-junit5.adoc +++ b/docs/components/modules/others/pages/test-junit5.adoc @@ -1,7 +1,7 @@ [[test-junit5-other]] = Test JUnit5 Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-test-junit5/src/main/docs/test-junit5.adoc +:page-source: components/camel-test/camel-test-junit5/src/main/docs/test-junit5.adoc :docTitle: Test JUnit5 :artifactId: camel-test-junit5 :description: Camel unit testing with JUnit 5 diff --git a/docs/components/modules/others/pages/test-spring-junit5.adoc b/docs/components/modules/others/pages/test-spring-junit5.adoc index d97afe4..8812881 100644 --- a/docs/components/modules/others/pages/test-spring-junit5.adoc +++ b/docs/components/modules/others/pages/test-spring-junit5.adoc @@ -1,7 +1,7 @@ [[test-spring-junit5-other]] = Test Spring JUnit5 Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc +:page-source: components/camel-test/camel-test-spring-junit5/src/main/docs/test-spring-junit5.adoc :docTitle: Test Spring JUnit5 :artifactId: camel-test-spring-junit5 :description: Camel unit testing with Spring and JUnit 5 diff --git a/docs/components/modules/others/pages/test-spring.adoc b/docs/components/modules/others/pages/test-spring.adoc index 1e43fcc..0e9341f 100644 --- a/docs/components/modules/others/pages/test-spring.adoc +++ b/docs/components/modules/others/pages/test-spring.adoc @@ -1,7 +1,7 @@ [[test-spring-other]] = Test Spring Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-test-spring/src/main/docs/test-spring.adoc +:page-source: components/camel-test/camel-test-spring/src/main/docs/test-spring.adoc :docTitle: Test Spring :artifactId: camel-test-spring :description: Camel unit testing with Spring diff --git a/docs/components/modules/others/pages/test.adoc b/docs/components/modules/others/pages/test.adoc index da81d0a..8cace19 100644 --- a/docs/components/modules/others/pages/test.adoc +++ b/docs/components/modules/others/pages/test.adoc @@ -1,7 +1,7 @@ [[test-other]] = Test Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-test/src/main/docs/test.adoc +:page-source: components/camel-test/camel-test/src/main/docs/test.adoc :docTitle: Test :artifactId: camel-test :description: Camel unit testing diff --git a/docs/components/modules/others/pages/testcontainers-junit5.adoc b/docs/components/modules/others/pages/testcontainers-junit5.adoc index 0d0ae04..d2cde20 100644 --- a/docs/components/modules/others/pages/testcontainers-junit5.adoc +++ b/docs/components/modules/others/pages/testcontainers-junit5.adoc @@ -1,7 +1,7 @@ [[testcontainers-junit5-other]] = Testcontainers JUnit5 Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-testcontainers-junit5/src/main/docs/testcontainers-junit5.adoc +:page-source: components/camel-test/camel-testcontainers-junit5/src/main/docs/testcontainers-junit5.adoc :docTitle: Testcontainers JUnit5 :artifactId: camel-testcontainers-junit5 :description: Camel support for testcontainers with JUnit 5 diff --git a/docs/components/modules/others/pages/testcontainers-spring-junit5.adoc b/docs/components/modules/others/pages/testcontainers-spring-junit5.adoc index cab2861..06d4f96 100644 --- a/docs/components/modules/others/pages/testcontainers-spring-junit5.adoc +++ b/docs/components/modules/others/pages/testcontainers-spring-junit5.adoc @@ -1,7 +1,7 @@ [[testcontainers-spring-junit5-other]] = Testcontainers Spring Junit5 Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc +:page-source: components/camel-test/camel-testcontainers-spring-junit5/src/main/docs/testcontainers-spring-junit5.adoc :docTitle: Testcontainers Spring Junit5 :artifactId: camel-testcontainers-spring-junit5 :description: Camel unit testing with Spring, testcontainers and JUnit 5 diff --git a/docs/components/modules/others/pages/testcontainers-spring.adoc b/docs/components/modules/others/pages/testcontainers-spring.adoc index 455ef50..e66fae8 100644 --- a/docs/components/modules/others/pages/testcontainers-spring.adoc +++ b/docs/components/modules/others/pages/testcontainers-spring.adoc @@ -1,7 +1,7 @@ [[testcontainers-spring-other]] = Testcontainers Spring Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-testcontainers-spring/src/main/docs/testcontainers-spring.adoc +:page-source: components/camel-test/camel-testcontainers-spring/src/main/docs/testcontainers-spring.adoc :docTitle: Testcontainers Spring :artifactId: camel-testcontainers-spring :description: Camel unit testing with Spring and testcontainers diff --git a/docs/components/modules/others/pages/testcontainers.adoc b/docs/components/modules/others/pages/testcontainers.adoc index f2fff22..fd83908 100644 --- a/docs/components/modules/others/pages/testcontainers.adoc +++ b/docs/components/modules/others/pages/testcontainers.adoc @@ -1,7 +1,7 @@ [[testcontainers-other]] = Testcontainers Component //THIS FILE IS COPIED: EDIT THE SOURCE FILE: -:page-source: components/camel-testcontainers/src/main/docs/testcontainers.adoc +:page-source: components/camel-test/camel-testcontainers/src/main/docs/testcontainers.adoc :docTitle: Testcontainers :artifactId: camel-testcontainers :description: Camel support for testcontainers diff --git a/docs/user-manual/modules/ROOT/examples/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java b/docs/user-manual/modules/ROOT/examples/components/camel-test/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java similarity index 100% rename from docs/user-manual/modules/ROOT/examples/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java rename to docs/user-manual/modules/ROOT/examples/components/camel-test/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java diff --git a/docs/user-manual/modules/ROOT/examples/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java b/docs/user-manual/modules/ROOT/examples/components/camel-test/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java similarity index 100% rename from docs/user-manual/modules/ROOT/examples/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java rename to docs/user-manual/modules/ROOT/examples/components/camel-test/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java diff --git a/docs/user-manual/modules/ROOT/pages/testing.adoc b/docs/user-manual/modules/ROOT/pages/testing.adoc index 3a8aeb4..5ffedcf 100644 --- a/docs/user-manual/modules/ROOT/pages/testing.adoc +++ b/docs/user-manual/modules/ROOT/pages/testing.adoc @@ -95,7 +95,7 @@ https://github.com/apache/camel/blob/master/components/camel-test-cdi/src/test/j [source,java] ---- -include::{examplesdir}/components/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java[tags=example] +include::{examplesdir}/components/camel-test/camel-test-cdi/src/test/java/org/apache/camel/test/cdi/FilterTest.java[tags=example] ---- You can find more testing patterns illustrated in the `camel-example-cdi-test` example @@ -173,13 +173,13 @@ include::{examplesdir}/components/camel-spring-javaconfig/src/test/java/org/apac === Spring Test with XML Config and Declarative Configuration Example Here is a Camel test support enhanced xref:spring-testing.adoc[Spring -Testing] https://github.com/apache/camel/blob/master/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java[example +Testing] https://github.com/apache/camel/blob/master/components/camel-test/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java[example using XML Config and pure Spring Test based configuration of the Camel Context]: [source,java] ---- -include::{examplesdir}/components/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java[tags=example] +include::{examplesdir}/components/camel-test/camel-test-spring/src/test/java/org/apache/camel/test/spring/CamelSpringRunnerPlainTest.java[tags=example] ---- Notice how a custom test runner is used with the `@RunWith` annotation diff --git a/parent/pom.xml b/parent/pom.xml index 8433394..098d533 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -2417,17 +2417,17 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring-junit5</artifactId> + <artifactId>camel-test-parent</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-spring</artifactId> + <artifactId>camel-test-spring-junit5</artifactId> <version>${project.version}</version> </dependency> <dependency> <groupId>org.apache.camel</groupId> - <artifactId>camel-test-parent</artifactId> + <artifactId>camel-test-spring</artifactId> <version>${project.version}</version> </dependency> <dependency>