You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2019/09/26 08:08:16 UTC

[camel] branch master updated (6184880 -> 18728d6)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 6184880  Update async.adoc
     new 40c0695  Regen
     new 18728d6  Regen docs

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../src/main/docs/aws-s3-component.adoc            |  2 +-
 .../main/docs/kubernetes-services-component.adoc   | 51 +++++++++++++++++++++
 .../modules/ROOT/pages/aws-s3-component.adoc       |  2 +-
 .../ROOT/pages/kubernetes-services-component.adoc  | 51 +++++++++++++++++++++
 .../components/modules/ROOT/pages/spring-boot.adoc | 52 +++++++++++++++++++++-
 .../modules/ROOT/pages/test-spring-junit5.adoc     |  1 +
 6 files changed, 156 insertions(+), 3 deletions(-)


[camel] 02/02: Regen docs

Posted by ac...@apache.org.
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 18728d66ba57654c867fe34d7d8a6b2789c6140b
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Sep 26 10:07:44 2019 +0200

    Regen docs
---
 .../ROOT/pages/kubernetes-services-component.adoc  | 51 ++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/docs/components/modules/ROOT/pages/kubernetes-services-component.adoc b/docs/components/modules/ROOT/pages/kubernetes-services-component.adoc
index cd9361d..bed148f 100644
--- a/docs/components/modules/ROOT/pages/kubernetes-services-component.adoc
+++ b/docs/components/modules/ROOT/pages/kubernetes-services-component.adoc
@@ -119,3 +119,54 @@ The component supports 2 options, which are listed below.
 - getService
 - createService
 - deleteService
+
+== Kubernetes Services Producer Examples
+
+- listServices: this operation list the services on a kubernetes cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:list").
+    toF("kubernetes-services:///?kubernetesClient=#kubernetesClient&operation=listServices").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of servoces from your cluster
+
+- listServicesByLabels:  this operation list the deployments by labels on a kubernetes cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:listByLabels").process(new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Map<String, String> labels = new HashMap<>();
+                labels.put("key1", "value1");
+                labels.put("key2", "value2");
+                exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_SERVICE_LABELS, labels);
+            }
+        });
+    toF("kubernetes-services:///?kubernetesClient=#kubernetesClient&operation=listServicesByLabels").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of Services from your cluster, using a label selector (with key1 and key2, with value value1 and value2)
+
+== Kubernetes Services Consumer Example
+
+[source,java]
+--------------------------------------------------------------------------------
+fromF("kubernetes-services://%s?oauthToken=%s&namespace=default&resourceName=test", host, authToken).process(new KubernertesProcessor()).to("mock:result");
+
+    public class KubernertesProcessor implements Processor {
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            Message in = exchange.getIn();
+            Service sv = exchange.getIn().getBody(Service.class);
+            log.info("Got event with configmap name: " + sv.getMetadata().getName() + " and action " + in.getHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION));
+        }
+    }
+--------------------------------------------------------------------------------
+
+This consumer will return a list of events on the namespace default for the deployment test.


[camel] 01/02: Regen

Posted by ac...@apache.org.
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 40c0695fb88b3f6616203b1ad9226921484c26eb
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Thu Sep 26 10:05:48 2019 +0200

    Regen
---
 .../src/main/docs/aws-s3-component.adoc            |  2 +-
 .../main/docs/kubernetes-services-component.adoc   | 51 +++++++++++++++++++++
 .../modules/ROOT/pages/aws-s3-component.adoc       |  2 +-
 .../components/modules/ROOT/pages/spring-boot.adoc | 52 +++++++++++++++++++++-
 .../modules/ROOT/pages/test-spring-junit5.adoc     |  1 +
 5 files changed, 105 insertions(+), 3 deletions(-)

diff --git a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
index 628eb41..962cf4c 100644
--- a/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
+++ b/components/camel-aws-s3/src/main/docs/aws-s3-component.adoc
@@ -65,7 +65,7 @@ The AWS S3 Storage Service component supports 5 options, which are listed below.
 The AWS S3 Storage Service endpoint is configured using URI syntax:
 
 ----
-aws-s3:bucketNameOrArn
+aws-s3://bucketNameOrArn
 ----
 
 with the following path and query parameters:
diff --git a/components/camel-kubernetes/src/main/docs/kubernetes-services-component.adoc b/components/camel-kubernetes/src/main/docs/kubernetes-services-component.adoc
index 2917639..fb1852e 100644
--- a/components/camel-kubernetes/src/main/docs/kubernetes-services-component.adoc
+++ b/components/camel-kubernetes/src/main/docs/kubernetes-services-component.adoc
@@ -118,3 +118,54 @@ The component supports 2 options, which are listed below.
 - getService
 - createService
 - deleteService
+
+== Kubernetes Services Producer Examples
+
+- listServices: this operation list the services on a kubernetes cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:list").
+    toF("kubernetes-services:///?kubernetesClient=#kubernetesClient&operation=listServices").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of servoces from your cluster
+
+- listServicesByLabels:  this operation list the deployments by labels on a kubernetes cluster
+
+[source,java]
+--------------------------------------------------------------------------------
+from("direct:listByLabels").process(new Processor() {
+
+            @Override
+            public void process(Exchange exchange) throws Exception {
+                Map<String, String> labels = new HashMap<>();
+                labels.put("key1", "value1");
+                labels.put("key2", "value2");
+                exchange.getIn().setHeader(KubernetesConstants.KUBERNETES_SERVICE_LABELS, labels);
+            }
+        });
+    toF("kubernetes-services:///?kubernetesClient=#kubernetesClient&operation=listServicesByLabels").
+    to("mock:result");
+--------------------------------------------------------------------------------
+
+This operation return a List of Services from your cluster, using a label selector (with key1 and key2, with value value1 and value2)
+
+== Kubernetes Services Consumer Example
+
+[source,java]
+--------------------------------------------------------------------------------
+fromF("kubernetes-services://%s?oauthToken=%s&namespace=default&resourceName=test", host, authToken).process(new KubernertesProcessor()).to("mock:result");
+
+    public class KubernertesProcessor implements Processor {
+        @Override
+        public void process(Exchange exchange) throws Exception {
+            Message in = exchange.getIn();
+            Service sv = exchange.getIn().getBody(Service.class);
+            log.info("Got event with configmap name: " + sv.getMetadata().getName() + " and action " + in.getHeader(KubernetesConstants.KUBERNETES_EVENT_ACTION));
+        }
+    }
+--------------------------------------------------------------------------------
+
+This consumer will return a list of events on the namespace default for the deployment test.
diff --git a/docs/components/modules/ROOT/pages/aws-s3-component.adoc b/docs/components/modules/ROOT/pages/aws-s3-component.adoc
index 6ca3296..a204dbf 100644
--- a/docs/components/modules/ROOT/pages/aws-s3-component.adoc
+++ b/docs/components/modules/ROOT/pages/aws-s3-component.adoc
@@ -66,7 +66,7 @@ The AWS S3 Storage Service component supports 5 options, which are listed below.
 The AWS S3 Storage Service endpoint is configured using URI syntax:
 
 ----
-aws-s3:bucketNameOrArn
+aws-s3://bucketNameOrArn
 ----
 
 with the following path and query parameters:
diff --git a/docs/components/modules/ROOT/pages/spring-boot.adoc b/docs/components/modules/ROOT/pages/spring-boot.adoc
index 3ed2e85..f0bac65 100644
--- a/docs/components/modules/ROOT/pages/spring-boot.adoc
+++ b/docs/components/modules/ROOT/pages/spring-boot.adoc
@@ -578,7 +578,7 @@ The Rest-DSL XML files should be Camel XML rests (not CamelContext) such as
 ----
 
 [[SpringBoot-Testing]]
-== Testing
+== Testing the JUnit 4 way
 For testing, Maven users will need to add the following dependencies to their `pom.xml`:
 
 [source,xml]
@@ -628,3 +628,53 @@ public class MyApplicationTest {
 
 }
 ----
+== Testing the JUnit 5 way
+For testing, Maven users will need to add the following dependencies to their `pom.xml`:
+
+[source,xml]
+----
+<dependency>
+    <groupId>org.springframework.boot</groupId>
+    <artifactId>spring-boot-starter-test</artifactId>
+    <version>${spring-boot.version}</version> <!-- Use the same version as your Spring Boot version -->
+    <scope>test</scope>
+</dependency>
+<dependency>
+    <groupId>org.apache.camel</groupId>
+    <artifactId>camel-test-spring-junit5</artifactId>
+    <version>${camel.version}</version> <!-- use the same version as your Camel core version -->
+    <scope>test</scope>
+</dependency>
+----
+
+To test a Camel Spring Boot application, annotate your test class(es) with
+`@CamelSpringBootTest`. This brings Camel's Spring Test
+support to your application, so that you can write tests using
+https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-testing.html[Spring Boot test conventions].
+
+To get the `CamelContext` or `ProducerTemplate`, you can inject them into the class in the normal Spring manner, using `@Autowired`.
+
+You can also use xref:manual::spring-testing.adoc[Camel Spring test annotations] to configure tests declaratively. This example uses the `@MockEndpoints` annotation to auto-mock an endpoint:
+
+[source,java]
+----
+@CamelSpringBootTest
+@SpringBootApplication
+@MockEndpoints("direct:end")
+public class MyApplicationTest {
+
+    @Autowired
+    private ProducerTemplate template;
+
+    @EndpointInject("mock:direct:end")
+    private MockEndpoint mock;
+
+    @Test
+    public void testReceive() throws Exception {
+        mock.expectedBodiesReceived("Hello");
+        template.sendBody("direct:start", "Hello");
+        mock.assertIsSatisfied();
+    }
+
+}
+----
diff --git a/docs/components/modules/ROOT/pages/test-spring-junit5.adoc b/docs/components/modules/ROOT/pages/test-spring-junit5.adoc
index dcf5242..bf26517 100644
--- a/docs/components/modules/ROOT/pages/test-spring-junit5.adoc
+++ b/docs/components/modules/ROOT/pages/test-spring-junit5.adoc
@@ -139,3 +139,4 @@ Tips: It's possible to run JUnit 4 & JUnit 5 based Camel Spring tests side by si
 * Imports of `org.apache.camel.test.spring.\*` should be replaced with `org.apache.camel.test.spring.junit5.*`
 * Usage of `@RunWith(CamelSpringRunner.class)` should be replaced with `@CamelSpringTest`
 * Usage of `@BootstrapWith(CamelTestContextBootstrapper.class)` should be replaced with `@CamelSpringTest`
+* Usage of `@RunWith(CamelSpringBootRunner.class)` should be replaced with `@CamelSpringBootTest`