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 9a73abd06e68c01746550c7003b53886e8d28524 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Jun 4 16:17:44 2019 +0200 Regen --- docs/components/modules/ROOT/nav.adoc | 2 +- .../components/modules/ROOT/pages/spring-boot.adoc | 4 +- .../modules/ROOT/pages/telegram-component.adoc | 18 +-- docs/components/modules/ROOT/pages/test.adoc | 137 ++++++--------------- .../camel-spring-boot-dependencies/pom.xml | 2 +- 5 files changed, 54 insertions(+), 109 deletions(-) diff --git a/docs/components/modules/ROOT/nav.adoc b/docs/components/modules/ROOT/nav.adoc index 42afa10..a190bdf 100644 --- a/docs/components/modules/ROOT/nav.adoc +++ b/docs/components/modules/ROOT/nav.adoc @@ -332,7 +332,7 @@ * xref:test-cdi.adoc[CDI Testing] * xref:test-karaf.adoc[Test Karaf] * xref:test-spring.adoc[Test Spring] -* xref:test.adoc[Test Component] +* xref:test.adoc[Test Module] * xref:testcontainers-spring.adoc[Testcontainers Spring] * xref:testcontainers.adoc[Testcontainers] * xref:thrift-component.adoc[Thrift Component] diff --git a/docs/components/modules/ROOT/pages/spring-boot.adoc b/docs/components/modules/ROOT/pages/spring-boot.adoc index 679a7e7..8218937 100644 --- a/docs/components/modules/ROOT/pages/spring-boot.adoc +++ b/docs/components/modules/ROOT/pages/spring-boot.adoc @@ -169,6 +169,8 @@ The component supports 140 options, which are listed below. | *camel.springboot.message-history* | Sets whether message history is enabled or not. Default is true. | true | Boolean | *camel.springboot.name* | Sets the name of the CamelContext. | | String | *camel.springboot.producer-template-cache-size* | Producer template endpoints cache size. | 1000 | Integer +| *camel.springboot.route-filter-exclude-pattern* | Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression. For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Multiple patterns can be separated by c [...] +| *camel.springboot.route-filter-include-pattern* | Used for filtering routes routes matching the given pattern, which follows the following rules: - Match by route id - Match by route input endpoint uri The matching is using exact match, by wildcard and regular expression. For example to only include routes which starts with foo in their route id's, use: include=foo* And to exclude routes which starts from JMS endpoints, use: exclude=jms:* Multiple patterns can be separated by c [...] | *camel.springboot.shutdown-log-inflight-exchanges-on-timeout* | Sets whether to log information about the inflight Exchanges which are still running during a shutdown which didn't complete without the given timeout. | true | Boolean | *camel.springboot.shutdown-now-on-timeout* | Sets whether to force shutdown of all consumers when a timeout occurred and thus not all consumers was shutdown within that period. You should have good reasons to set this option to false as it means that the routes keep running and is halted abruptly when CamelContext has been shutdown. | true | Boolean | *camel.springboot.shutdown-routes-in-reverse-order* | Sets whether routes should be shutdown in reverse or the same order as they where started. | true | Boolean @@ -236,8 +238,6 @@ The component supports 140 options, which are listed below. | *management.endpoint.camelroutes.read-only* | Whether Camel Routes actuator is in read-only mode. If not in read-only mode then operations to start/stop routes would be enabled. | true | Boolean | *management.info.camel.enabled* | Whether to enable Camel info. | true | Boolean | *management.info.camel.verbose* | Global option to enable/disable health bean camel version info, default is true. | true | Boolean -| *camel.springboot.stream-caching* | Sets whether stream caching is enabled or not (deprecated use stream-caching-enabled instead). Default is false. | false | Boolean -| *camel.springboot.use-m-d-c-logging* | To turn on MDC logging (deprecated use use-mdc-logging instead) | false | Boolean |=== // spring-boot-auto-configure options: END diff --git a/docs/components/modules/ROOT/pages/telegram-component.adoc b/docs/components/modules/ROOT/pages/telegram-component.adoc index 13939b0..4439707 100644 --- a/docs/components/modules/ROOT/pages/telegram-component.adoc +++ b/docs/components/modules/ROOT/pages/telegram-component.adoc @@ -79,12 +79,14 @@ with the following path and query parameters: |=== -==== Query Parameters (23 parameters): +==== Query Parameters (25 parameters): [width="100%",cols="2,5,^1,2",options="header"] |=== | Name | Description | Default | Type +| *proxyHost* (common) | The proxyHost which could be used when sending out the message. | | String +| *proxyPort* (common) | The proxyPort which could be used when sending out the message. | | Integer | *bridgeErrorHandler* (consumer) | Allows for bridging the consumer to the Camel routing Error Handler, which mean any exceptions occurred while the consumer is trying to pickup incoming messages, or the likes, will now be processed as a message and handled by the routing Error Handler. By default the consumer will use the org.apache.camel.spi.ExceptionHandler to deal with exceptions, that will be logged at WARN or ERROR level and ignored. | false | boolean | *limit* (consumer) | Limit on the number of updates that can be received in a single polling request. | 100 | Integer | *sendEmptyMessageWhenIdle* (consumer) | If the polling consumer did not poll any files, you can enable this option to send an empty message (no body) instead. | false | boolean @@ -358,16 +360,16 @@ from("telegram:bots/123456789:insertYourAuthorizationTokenHere") OutgoingTextMessage msg = new OutgoingTextMessage(); msg.setText("Choose one option!"); - + InlineKeyboardButton buttonOptionOneI = InlineKeyboardButton.builder() .text("Option One - I").build(); - + InlineKeyboardButton buttonOptionOneII = InlineKeyboardButton.builder() .text("Option One - II").build(); - + InlineKeyboardButton buttonOptionTwoI = InlineKeyboardButton.builder() .text("Option Two - I").build(); - + ReplyKeyboardMarkup replyMarkup = ReplyKeyboardMarkup.builder() .keyboard() .addRow(Arrays.asList(buttonOptionOneI, buttonOptionOneII)) @@ -375,7 +377,7 @@ from("telegram:bots/123456789:insertYourAuthorizationTokenHere") .close() .oneTimeKeyboard(true) .build(); - + msg.setReplyKeyboardMarkup(replyMarkup); exchange.getIn().setBody(msg); @@ -392,11 +394,11 @@ from("telegram:bots/123456789:insertYourAuthorizationTokenHere") OutgoingTextMessage msg = new OutgoingTextMessage(); msg.setText("Your answer was accepted!"); - + ReplyKeyboardMarkup replyMarkup = ReplyKeyboardMarkup.builder() .removeKeyboard(true) .build(); - + msg.setReplyKeyboardMarkup(replyMarkup); exchange.getIn().setBody(msg); diff --git a/docs/components/modules/ROOT/pages/test.adoc b/docs/components/modules/ROOT/pages/test.adoc index 5f2256d..f4c6013 100644 --- a/docs/components/modules/ROOT/pages/test.adoc +++ b/docs/components/modules/ROOT/pages/test.adoc @@ -1,104 +1,47 @@ -[[Test-TestComponent]] -== Test Component +[[Test]] +== Test Module -Testing of distributed and asynchronous processing is -notoriously difficult. The <<mock-component,Mock>>, <<mock-component,Test>> -and <<dataset-component,DataSet>> endpoints work great with the -Camel Testing Framework to simplify your unit and -integration testing using -link:enterprise-integration-patterns.html[Enterprise Integration -Patterns] and Camel's large range of Components -together with the powerful Bean Integration. +The `camel-test` module is used for unit testing Camel. -The *test* component extends the <<mock-component,Mock>> component to -support pulling messages from another endpoint on startup to set the -expected message bodies on the underlying <<mock-component,Mock>> endpoint. -That is, you use the test endpoint in a route and messages arriving on -it will be implicitly compared to some expected messages extracted from -some other location. +The class `org.apache.camel.test.junit4.CamelTestSupport` provides a base JUnit class which you would extend +and implement your Camel unit test. -So you can use, for example, an expected set of message bodies as files. -This will then set up a properly configured <<mock-component,Mock>> -endpoint, which is only valid if the received messages match the number -of expected messages and their message payloads are equal. +=== Simple unit test example -Maven users will need to add the following dependency to their `pom.xml` -for this component when using *Camel 2.8* or older: - -[source,xml] ------------------------------------------------------------- -<dependency> - <groupId>org.apache.camel</groupId> - <artifactId>camel-spring</artifactId> - <version>x.x.x</version> - <!-- use the same version as your Camel core version --> -</dependency> ------------------------------------------------------------- - -From Camel 2.9 onwards the <<test-component,Test>> component is provided -directly in the camel-core. - -[[Test-URIformat]] -=== URI format +As shown below is a basic junit test which uses `camel-test`. The `createRouteBuilder` method is used +for build the routes to be tested. Then the methods with `@Test` annotations are JUnit test methods which +will be executed. The base class `CamelTestSupport` has a number of helper methods to configure testing, +see more at the javadoc of this class. [source,java] --------------------------------- -test:expectedMessagesEndpointUri --------------------------------- - -Where *expectedMessagesEndpointUri* refers to some other -Component URI that the expected message bodies are -pulled from before starting the test. - -[[Test-URIOptions]] -=== URI Options - -[width="100%",cols="10%,10%,80%",options="header",] -|======================================================================= -|Name |Default Value |Description - -|`timeout` |`2000` |*Camel 2.12:* The timeout to use when polling for message bodies from -the URI. - -|anyOrder |false |*Camel 2.17:* Whether the expected messages should arrive in the same -order or can be in any order. - -|split |false |*Camel 2.17:* If enabled the messages loaded from the test endpoint -will be split using \n\r delimiters (new lines) so each line is an -expected message. + -For example to use a file endpoint to load a file where each line is an -expected message. - -|delimiter |\n,\r |*Camel 2.17:* The split delimiter to use when split is enabled. By -default the delimiter is new line based. The delimiter can be a regular -expression. -|======================================================================= - -[[Test-Example]] -=== Example - -For example, you could write a test case as follows: - -[source,java] --------------------------------------------------- -from("seda:someEndpoint"). - to("test:file://data/expectedOutput?noop=true"); --------------------------------------------------- - -If your test then invokes the -http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/component/mock/MockEndpoint.html#assertIsSatisfied(org.apache.camel.CamelContext)[MockEndpoint.assertIsSatisfied(camelContext) -method], your test case will perform the necessary assertions. - -To see how you can set other expectations on the test endpoint, see the -<<mock-component,Mock>> component. - -[[Test-SeeAlso]] -=== See Also - -* Configuring Camel -* Component -* Endpoint -* Getting Started - -* Spring Testing +---- +import org.apache.camel.RoutesBuilder; +import org.apache.camel.builder.RouteBuilder; +import org.apache.camel.test.junit4.CamelTestSupport; +import org.junit.Test; + +public class SimpleMockTest extends CamelTestSupport { + + @Test + public void testMock() throws Exception { + getMockEndpoint("mock:result").expectedBodiesReceived("Hello World"); + + template.sendBody("direct:start", "Hello World"); + + assertMockEndpointsSatisfied(); + } + + @Override + protected RoutesBuilder createRouteBuilder() throws Exception { + return new RouteBuilder() { + @Override + public void configure() throws Exception { + from("direct:start") + .to("mock:result"); + } + }; + } + +} +---- diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml index eab2efe..efd9ec2 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies/pom.xml @@ -73,7 +73,7 @@ <dependency> <groupId>com.alibaba</groupId> <artifactId>fastjson</artifactId> - <version>1.2.57</version> + <version>1.2.58</version> </dependency> <dependency> <groupId>com.cloudbees.thirdparty</groupId>