You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/08/23 07:30:52 UTC

[camel] branch CAMEL-13870 updated (d228f30 -> f137808)

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

davsclaus pushed a change to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from d228f30  Stop using mockito its a pain ....
     new cf5b088  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new 0be6f4f  CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
     new e316246  Avoid using mockito when possible
     new 68aa8db  Avoid using mockito when possible. Removed removed options as they were deprecated
     new 5ae25cc  Avoid using mockito when possible
     new f137808  Avoid using mockito when possible

The 6 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:
 components/camel-couchbase/pom.xml                 | 19 ++++++++-
 .../couchbase/CouchbaseComponentTest.java          | 41 ++++++++------------
 .../component/couchdb/CouchDbComponentTest.java    | 29 ++++----------
 .../camel/component/kafka/KafkaComponentTest.java  | 45 ++++++----------------
 .../component/metrics/MetricsComponentTest.java    |  8 +++-
 .../src/main/docs/milo-client-component.adoc       |  2 +-
 .../component/rabbitmq/RabbitMQComponentTest.java  | 20 ++++------
 .../src/main/docs/spring-ws-component.adoc         |  4 +-
 .../spring/ws/SpringWebserviceConfiguration.java   |  4 +-
 .../SpringWebserviceEndpointBuilderFactory.java    | 10 ++---
 .../EndpointPropertyConfigurerSupport.java         |  8 +---
 .../modules/ROOT/pages/log-component.adoc          |  3 +-
 .../modules/ROOT/pages/milo-client-component.adoc  |  4 +-
 .../modules/ROOT/pages/rabbitmq-component.adoc     |  2 +-
 .../components/modules/ROOT/pages/spring-boot.adoc |  4 +-
 .../apache/camel/maven/DocumentGeneratorMojo.java  | 10 ++---
 16 files changed, 90 insertions(+), 123 deletions(-)


[camel] 05/06: Avoid using mockito when possible

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 5ae25cc1168b276b84dabc31adb07b6df2c8e2a4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 08:49:18 2019 +0200

    Avoid using mockito when possible
---
 .../org/apache/camel/component/metrics/MetricsComponentTest.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentTest.java b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentTest.java
index edd8862..7eaa38b 100644
--- a/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentTest.java
+++ b/components/camel-metrics/src/test/java/org/apache/camel/component/metrics/MetricsComponentTest.java
@@ -24,7 +24,9 @@ import java.util.Map;
 import com.codahale.metrics.MetricRegistry;
 import org.apache.camel.CamelContext;
 import org.apache.camel.Endpoint;
+import org.apache.camel.ExtendedCamelContext;
 import org.apache.camel.RuntimeCamelException;
+import org.apache.camel.impl.engine.DefaultBeanIntrospection;
 import org.apache.camel.spi.Registry;
 import org.junit.Before;
 import org.junit.Test;
@@ -48,7 +50,7 @@ import static org.mockito.Mockito.when;
 public class MetricsComponentTest {
 
     @Mock
-    private CamelContext camelContext;
+    private ExtendedCamelContext camelContext;
 
     @Mock
     private Registry camelRegistry;
@@ -72,6 +74,8 @@ public class MetricsComponentTest {
         when(camelContext.getRegistry()).thenReturn(camelRegistry);
         when(camelContext.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
         when(camelRegistry.lookupByNameAndType(MetricsComponent.METRIC_REGISTRY_NAME, MetricRegistry.class)).thenReturn(metricRegistry);
+        when(camelContext.adapt(ExtendedCamelContext.class)).thenReturn(camelContext);
+        when(camelContext.getBeanIntrospection()).thenReturn(new DefaultBeanIntrospection());
 
         Map<String, Object> params = new HashMap<>();
         Long value = System.currentTimeMillis();
@@ -95,6 +99,8 @@ public class MetricsComponentTest {
         when(camelContext.getRegistry()).thenReturn(camelRegistry);
         when(camelContext.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
         when(camelRegistry.lookupByNameAndType(MetricsComponent.METRIC_REGISTRY_NAME, MetricRegistry.class)).thenReturn(metricRegistry);
+        when(camelContext.adapt(ExtendedCamelContext.class)).thenReturn(camelContext);
+        when(camelContext.getBeanIntrospection()).thenReturn(new DefaultBeanIntrospection());
         Map<String, Object> params = new HashMap<>();
         Long value = System.currentTimeMillis();
         params.put("mark", value);


[camel] 02/06: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 0be6f4fe115b9f46b585cf42763a885778ca8654
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 06:58:56 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 .../support/component/EndpointPropertyConfigurerSupport.java      | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java b/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
index 406e5e1..55a47e1 100644
--- a/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
+++ b/core/camel-support/src/main/java/org/apache/camel/support/component/EndpointPropertyConfigurerSupport.java
@@ -17,8 +17,6 @@
 package org.apache.camel.support.component;
 
 import org.apache.camel.CamelContext;
-import org.apache.camel.NoTypeConversionAvailableException;
-import org.apache.camel.RuntimeCamelException;
 import org.apache.camel.spi.EndpointPropertyConfigurer;
 
 public abstract class EndpointPropertyConfigurerSupport implements EndpointPropertyConfigurer {
@@ -47,11 +45,7 @@ public abstract class EndpointPropertyConfigurerSupport implements EndpointPrope
             }
         }
 
-        try {
-            return camelContext.getTypeConverter().mandatoryConvertTo(type, value);
-        } catch (NoTypeConversionAvailableException e) {
-            throw RuntimeCamelException.wrapRuntimeException(e);
-        }
+        return camelContext.getTypeConverter().convertTo(type, value);
     }
 
 }


[camel] 03/06: Avoid using mockito when possible

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit e316246745682c8f5dcb21bdef66e14f111eedc3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 08:00:29 2019 +0200

    Avoid using mockito when possible
---
 components/camel-couchbase/pom.xml                 | 19 ++++++++--
 .../couchbase/CouchbaseComponentTest.java          | 41 ++++++++--------------
 .../component/couchdb/CouchDbComponentTest.java    | 29 +++++----------
 3 files changed, 40 insertions(+), 49 deletions(-)

diff --git a/components/camel-couchbase/pom.xml b/components/camel-couchbase/pom.xml
index 296384d..09be1d2 100644
--- a/components/camel-couchbase/pom.xml
+++ b/components/camel-couchbase/pom.xml
@@ -49,8 +49,23 @@
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-log4j12</artifactId>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-api</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-slf4j-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.logging.log4j</groupId>
+            <artifactId>log4j-1.2-api</artifactId>
             <scope>test</scope>
         </dependency>
 
diff --git a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
index 6af8326..a2b0222 100644
--- a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
+++ b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseComponentTest.java
@@ -20,24 +20,23 @@ import java.net.URI;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
+public class CouchbaseComponentTest extends CamelTestSupport {
 
-@RunWith(MockitoJUnitRunner.class)
-public class CouchbaseComponentTest {
+    private CouchbaseComponent component;
 
-    @Mock
-    private CamelContext context;
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        component = context.getComponent("couchbase",  CouchbaseComponent.class);
+    }
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
 
     @Test
     public void testEndpointCreated() throws Exception {
@@ -46,14 +45,12 @@ public class CouchbaseComponentTest {
         String uri = "couchbase:http://localhost:9191/bucket";
         String remaining = "http://localhost:9191/bucket";
 
-        Endpoint endpoint = new CouchbaseComponent(context).createEndpoint(uri, remaining, params);
+        CouchbaseEndpoint endpoint = component.createEndpoint(uri, remaining, params);
         assertNotNull(endpoint);
     }
 
     @Test
     public void testPropertiesSet() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("username", "ugol");
         params.put("password", "pwd");
@@ -64,7 +61,7 @@ public class CouchbaseComponentTest {
         String uri = "couchdb:http://localhost:91234/bucket";
         String remaining = "http://localhost:91234/bucket";
 
-        CouchbaseEndpoint endpoint = new CouchbaseComponent(context).createEndpoint(uri, remaining, params);
+        CouchbaseEndpoint endpoint = component.createEndpoint(uri, remaining, params);
 
         assertEquals("http", endpoint.getProtocol());
         assertEquals("localhost", endpoint.getHostname());
@@ -89,8 +86,6 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testCouchbaseAdditionalHosts() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", "127.0.0.1,example.com,another-host");
         String uri = "couchbase:http://localhost/bucket?param=true";
@@ -108,8 +103,6 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testCouchbaseAdditionalHostsWithSpaces() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", " 127.0.0.1, example.com, another-host ");
         String uri = "couchbase:http://localhost/bucket?param=true";
@@ -127,8 +120,6 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testCouchbaseDuplicateAdditionalHosts() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", "127.0.0.1,localhost, localhost");
         String uri = "couchbase:http://localhost/bucket?param=true";
@@ -143,8 +134,6 @@ public class CouchbaseComponentTest {
 
     @Test
     public void testCouchbaseNullAdditionalHosts() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("additionalHosts", null);
         String uri = "couchbase:http://localhost/bucket?param=true";
diff --git a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
index c375dd0..5d472a6 100644
--- a/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
+++ b/components/camel-couchdb/src/test/java/org/apache/camel/component/couchdb/CouchDbComponentTest.java
@@ -19,26 +19,15 @@ package org.apache.camel.component.couchdb;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.Endpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
+public class CouchDbComponentTest extends CamelTestSupport {
 
-@RunWith(MockitoJUnitRunner.class)
-public class CouchDbComponentTest {
-
-    @Mock
-    private CamelContext context;
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
 
     @Test
     public void testEndpointCreated() throws Exception {
@@ -47,14 +36,12 @@ public class CouchDbComponentTest {
         String uri = "couchdb:http://localhost:5984/db";
         String remaining = "http://localhost:5984/db";
 
-        Endpoint endpoint = new CouchDbComponent(context).createEndpoint(uri, remaining, params);
+        CouchDbEndpoint endpoint = context.getComponent("couchdb", CouchDbComponent.class).createEndpoint(uri, remaining, params);
         assertNotNull(endpoint);
     }
 
     @Test
     public void testPropertiesSet() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-
         Map<String, Object> params = new HashMap<>();
         params.put("createDatabase", true);
         params.put("username", "coldplay");
@@ -67,7 +54,7 @@ public class CouchDbComponentTest {
         String uri = "couchdb:http://localhost:14/db";
         String remaining = "http://localhost:14/db";
 
-        CouchDbEndpoint endpoint = new CouchDbComponent(context).createEndpoint(uri, remaining, params);
+        CouchDbEndpoint endpoint = context.getComponent("couchdb", CouchDbComponent.class).createEndpoint(uri, remaining, params);
         assertEquals("http", endpoint.getProtocol());
         assertEquals("localhost", endpoint.getHostname());
         assertEquals("db", endpoint.getDatabase());


[camel] 01/06: CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit cf5b088c02f774e7fa73d2c0421ccdff4da30f0a
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 05:09:26 2019 +0200

    CAMEL-13870: Fast property configuration of Camel endpoints. Work in progress.
---
 components/camel-milo/src/main/docs/milo-client-component.adoc |  2 +-
 docs/components/modules/ROOT/pages/log-component.adoc          |  3 ++-
 docs/components/modules/ROOT/pages/milo-client-component.adoc  |  4 ++--
 docs/components/modules/ROOT/pages/rabbitmq-component.adoc     |  2 +-
 docs/components/modules/ROOT/pages/spring-boot.adoc            |  4 +++-
 .../java/org/apache/camel/maven/DocumentGeneratorMojo.java     | 10 +++++-----
 6 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/components/camel-milo/src/main/docs/milo-client-component.adoc b/components/camel-milo/src/main/docs/milo-client-component.adoc
index f0ddf32..8cfe8c1 100644
--- a/components/camel-milo/src/main/docs/milo-client-component.adoc
+++ b/components/camel-milo/src/main/docs/milo-client-component.adoc
@@ -171,7 +171,7 @@ The component supports 25 options, which are listed below.
 | *camel.component.milo-client.default-configuration.key-password* | The key password |  | String
 | *camel.component.milo-client.default-configuration.key-store-password* | The keystore password |  | String
 | *camel.component.milo-client.default-configuration.key-store-type* | The key store type |  | String
-| *camel.component.milo-client.default-configuration.key-store-url* | The URL where the key should be loaded from |  | URL
+| *camel.component.milo-client.default-configuration.key-store-url* | The URL where the key should be loaded from |  | String
 | *camel.component.milo-client.default-configuration.max-pending-publish-requests* | The maximum number of pending publish requests |  | Long
 | *camel.component.milo-client.default-configuration.max-response-message-size* | The maximum number of bytes a response message may have |  | Long
 | *camel.component.milo-client.default-configuration.override-host* | Override the server reported endpoint host with the host from the endpoint URI. | false | Boolean
diff --git a/docs/components/modules/ROOT/pages/log-component.adoc b/docs/components/modules/ROOT/pages/log-component.adoc
index 23a7668..3682f2f 100644
--- a/docs/components/modules/ROOT/pages/log-component.adoc
+++ b/docs/components/modules/ROOT/pages/log-component.adoc
@@ -93,7 +93,7 @@ with the following path and query parameters:
 |===
 
 
-=== Query Parameters (27 parameters):
+=== Query Parameters (28 parameters):
 
 
 [width="100%",cols="2,5,^1,2",options="header"]
@@ -108,6 +108,7 @@ with the following path and query parameters:
 | *logMask* (producer) | If true, mask sensitive information like password or passphrase in the log. |  | Boolean
 | *marker* (producer) | An optional Marker name to use. |  | String
 | *basicPropertyBinding* (advanced) | Whether the endpoint should use basic property binding (Camel 2.x) or the newer property binding with additional capabilities | false | boolean
+| *exchangeFormatter* (advanced) | To use a custom exchange formatter |  | ExchangeFormatter
 | *synchronous* (advanced) | Sets whether synchronous processing should be strictly used, or Camel is allowed to use asynchronous processing (if supported). | false | boolean
 | *maxChars* (formatting) | Limits the number of characters logged per line. | 10000 | int
 | *multiline* (formatting) | If enabled then each information is outputted on a newline. | false | boolean
diff --git a/docs/components/modules/ROOT/pages/milo-client-component.adoc b/docs/components/modules/ROOT/pages/milo-client-component.adoc
index 354b964..8cfe8c1 100644
--- a/docs/components/modules/ROOT/pages/milo-client-component.adoc
+++ b/docs/components/modules/ROOT/pages/milo-client-component.adoc
@@ -124,7 +124,7 @@ with the following path and query parameters:
 | *keyPassword* (client) | The key password |  | String
 | *keyStorePassword* (client) | The keystore password |  | String
 | *keyStoreType* (client) | The key store type |  | String
-| *keyStoreUrl* (client) | The URL where the key should be loaded from |  | URL
+| *keyStoreUrl* (client) | The URL where the key should be loaded from |  | String
 | *maxPendingPublishRequests* (client) | The maximum number of pending publish requests |  | Long
 | *maxResponseMessageSize* (client) | The maximum number of bytes a response message may have |  | Long
 | *overrideHost* (client) | Override the server reported endpoint host with the host from the endpoint URI. | false | boolean
@@ -171,7 +171,7 @@ The component supports 25 options, which are listed below.
 | *camel.component.milo-client.default-configuration.key-password* | The key password |  | String
 | *camel.component.milo-client.default-configuration.key-store-password* | The keystore password |  | String
 | *camel.component.milo-client.default-configuration.key-store-type* | The key store type |  | String
-| *camel.component.milo-client.default-configuration.key-store-url* | The URL where the key should be loaded from |  | URL
+| *camel.component.milo-client.default-configuration.key-store-url* | The URL where the key should be loaded from |  | String
 | *camel.component.milo-client.default-configuration.max-pending-publish-requests* | The maximum number of pending publish requests |  | Long
 | *camel.component.milo-client.default-configuration.max-response-message-size* | The maximum number of bytes a response message may have |  | Long
 | *camel.component.milo-client.default-configuration.override-host* | Override the server reported endpoint host with the host from the endpoint URI. | false | Boolean
diff --git a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
index 36f18ff..d5a5310 100644
--- a/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
+++ b/docs/components/modules/ROOT/pages/rabbitmq-component.adoc
@@ -133,7 +133,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *addresses* (common) | If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345 |  | Address[]
+| *addresses* (common) | If this option is set, camel-rabbitmq will try to create connection based on the setting of option addresses. The addresses value is a string which looks like server1:12345, server2:12345 |  | String
 | *autoDelete* (common) | If it is true, the exchange will be deleted when it is no longer in use | true | boolean
 | *automaticRecoveryEnabled* (common) | Enables connection automatic recovery (uses connection implementation that performs automatic recovery when existing connection has failures) | true | Boolean
 | *connectionFactory* (common) | To use a custom RabbitMQ connection factory. When this option is set, all connection options (connectionTimeout, requestedChannelMax...) set on URI are not used |  | ConnectionFactory
diff --git a/docs/components/modules/ROOT/pages/spring-boot.adoc b/docs/components/modules/ROOT/pages/spring-boot.adoc
index 155da7f..6715705 100644
--- a/docs/components/modules/ROOT/pages/spring-boot.adoc
+++ b/docs/components/modules/ROOT/pages/spring-boot.adoc
@@ -89,7 +89,7 @@ When using Spring Boot make sure to use the following Maven dependency to have s
 ----
 
 
-The component supports 127 options, which are listed below.
+The component supports 129 options, which are listed below.
 
 
 
@@ -146,6 +146,8 @@ The component supports 127 options, which are listed below.
 | *camel.springboot.allow-use-original-message* | Sets whether to allow access to the original message from Camel's error handler, or from org.apache.camel.spi.UnitOfWork.getOriginalInMessage(). Turning this off can optimize performance, as defensive copy of the original message is not needed. Default is false. | false | Boolean
 | *camel.springboot.auto-startup* | Sets whether the object should automatically start when Camel starts. Important: Currently only routes can be disabled, as CamelContext's are always started. Note: When setting auto startup false on CamelContext then that takes precedence and no routes is started. You would need to start CamelContext explicit using the org.apache.camel.CamelContext.start() method, to start the context, and then you would need to start the routes manually using Camelcon [...]
 | *camel.springboot.backlog-tracing* | Sets whether backlog tracing is enabled or not. Default is false. | false | Boolean
+| *camel.springboot.bean-introspection-extended-statistics* | Sets whether bean introspection uses extended statistics. The default is false. | false | Boolean
+| *camel.springboot.bean-introspection-logging-level* | Sets the logging level used by bean introspection, logging activity of its usage. The default is TRACE. |  | LoggingLevel
 | *camel.springboot.consumer-template-cache-size* | Consumer template endpoints cache size. | 1000 | Integer
 | *camel.springboot.duration-max-idle-seconds* | To specify for how long time in seconds Camel can be idle before automatic terminating the JVM. You can use this to run Spring Boot for a short while. | 0 | Integer
 | *camel.springboot.duration-max-messages* | To specify how many messages to process by Camel before automatic terminating the JVM. You can use this to run Spring Boot for a short while. | 0 | Integer
diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
index 2f17312..427c4eb 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/DocumentGeneratorMojo.java
@@ -32,7 +32,8 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
 
-import org.apache.camel.support.IntrospectionSupport;
+import org.apache.camel.impl.engine.DefaultBeanIntrospection;
+import org.apache.camel.spi.BeanIntrospection;
 import org.apache.camel.support.component.ApiCollection;
 import org.apache.camel.support.component.ApiMethod;
 import org.apache.camel.support.component.ApiMethodHelper;
@@ -41,7 +42,6 @@ import org.apache.commons.lang.ClassUtils;
 import org.apache.maven.doxia.siterenderer.RenderingContext;
 import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
 import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
 import org.apache.maven.plugins.annotations.Parameter;
@@ -118,7 +118,7 @@ public class DocumentGeneratorMojo extends AbstractGeneratorMojo implements Mave
         final Set<String> apiNames = new TreeSet<String>(collection.getApiNames());
         context.put("apiNames", apiNames);
         String suffix;
-        if (apiNames.size() == 1 && ((Set) apiNames).contains("")) {
+        if (apiNames.size() == 1 && apiNames.contains("")) {
             suffix = "://endpoint?[options]";
         } else {
             suffix = "://endpoint-prefix/endpoint?[options]";
@@ -170,8 +170,8 @@ public class DocumentGeneratorMojo extends AbstractGeneratorMojo implements Mave
         // so getDeclaredFields() won't work, like it does for generated endpoint config classes!!!
         final Map<String, String> configFields = new TreeMap<>();
         do {
-            IntrospectionSupport.ClassInfo classInfo = IntrospectionSupport.cacheClass(configClass);
-            for (IntrospectionSupport.MethodInfo method : classInfo.methods) {
+            BeanIntrospection.ClassInfo classInfo = new DefaultBeanIntrospection().cacheClass(configClass);
+            for (BeanIntrospection.MethodInfo method : classInfo.methods) {
                 if (method.isSetter) {
                     configFields.put(method.getterOrSetterShorthandName, getCanonicalName(method.method.getParameterTypes()[0]));
                 }


[camel] 04/06: Avoid using mockito when possible. Removed removed options as they were deprecated

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 68aa8dbf2ed1f8952aba97efe9702ff6a642f218
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 08:15:05 2019 +0200

    Avoid using mockito when possible. Removed removed options as they were deprecated
---
 .../camel/component/kafka/KafkaComponentTest.java  | 45 ++++++----------------
 1 file changed, 11 insertions(+), 34 deletions(-)

diff --git a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
index ece1a3d..35f2184 100644
--- a/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
+++ b/components/camel-kafka/src/test/java/org/apache/camel/component/kafka/KafkaComponentTest.java
@@ -20,38 +20,28 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-import org.apache.camel.CamelContext;
-import org.apache.camel.TypeConverter;
 import org.apache.camel.support.jsse.KeyStoreParameters;
 import org.apache.camel.support.jsse.SSLContextParameters;
 import org.apache.camel.support.jsse.TrustManagersParameters;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.apache.kafka.clients.CommonClientConfigs;
 import org.apache.kafka.clients.producer.ProducerConfig;
 import org.apache.kafka.common.config.SaslConfigs;
 import org.apache.kafka.common.config.SslConfigs;
 import org.junit.Test;
-import org.mockito.Mockito;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
+public class KafkaComponentTest extends CamelTestSupport {
 
-public class KafkaComponentTest {
-
-    private CamelContext context = Mockito.mock(CamelContext.class);
-    private TypeConverter tc = Mockito.mock(TypeConverter.class);
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
 
     @Test
     public void testPropertiesSet() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-        when(context.getTypeConverter()).thenReturn(tc);
-        when(tc.convertTo(boolean.class, Boolean.FALSE)).thenReturn(false);
-
         String uri = "kafka:mytopic?brokers=broker1:12345,broker2:12566&partitioner=com.class.Party";
 
-        KafkaEndpoint endpoint = (KafkaEndpoint) new KafkaComponent(context).createEndpoint(uri);
+        KafkaEndpoint endpoint = context.getEndpoint(uri, KafkaEndpoint.class);
         assertEquals("broker1:12345,broker2:12566", endpoint.getConfiguration().getBrokers());
         assertEquals("mytopic", endpoint.getConfiguration().getTopic());
         assertEquals("com.class.Party", endpoint.getConfiguration().getPartitioner());
@@ -59,16 +49,12 @@ public class KafkaComponentTest {
 
     @Test
     public void testBrokersOnComponent() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-        when(context.getTypeConverter()).thenReturn(tc);
-        when(tc.convertTo(boolean.class, Boolean.FALSE)).thenReturn(false);
-
-        KafkaComponent kafka = new KafkaComponent(context);
+        KafkaComponent kafka = context.getComponent("kafka", KafkaComponent.class);
         kafka.setBrokers("broker1:12345,broker2:12566");
 
         String uri = "kafka:mytopic?partitioner=com.class.Party";
 
-        KafkaEndpoint endpoint = (KafkaEndpoint) kafka.createEndpoint(uri);
+        KafkaEndpoint endpoint = context.getEndpoint(uri, KafkaEndpoint.class);
         assertEquals("broker1:12345,broker2:12566", endpoint.getConfiguration().getBrokers());
         assertEquals("broker1:12345,broker2:12566", endpoint.getComponent().getBrokers());
         assertEquals("mytopic", endpoint.getConfiguration().getTopic());
@@ -77,17 +63,12 @@ public class KafkaComponentTest {
 
     @Test
     public void testAllProducerConfigProperty() throws Exception {
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
-        when(context.getTypeConverter()).thenReturn(tc);
-        when(tc.convertTo(boolean.class, Boolean.FALSE)).thenReturn(false);
-
         Map<String, Object> params = new HashMap<>();
         setProducerProperty(params);
 
         String uri = "kafka:mytopic?brokers=dev1:12345,dev2:12566";
-        String remaining = "mytopic";
 
-        KafkaEndpoint endpoint = new KafkaComponent(context).createEndpoint(uri, remaining, params);
+        KafkaEndpoint endpoint = (KafkaEndpoint) context.getComponent("kafka").createEndpoint(uri, params);
 
         assertEquals("mytopic", endpoint.getConfiguration().getTopic());
         assertEquals("1", endpoint.getConfiguration().getRequestRequiredAcks());
@@ -141,9 +122,8 @@ public class KafkaComponentTest {
         Map<String, Object> params = new HashMap<>();
 
         String uri = "kafka:mytopic?brokers=dev1:12345,dev2:12566";
-        String remaining = "mytopic";
 
-        KafkaEndpoint endpoint = new KafkaComponent(context).createEndpoint(uri, remaining, params);
+        KafkaEndpoint endpoint = (KafkaEndpoint) context.getComponent("kafka").createEndpoint(uri, params);
         assertEquals(endpoint.getConfiguration().createProducerProperties().keySet(), getProducerKeys().keySet());
     }
 
@@ -202,10 +182,7 @@ public class KafkaComponentTest {
         params.put("receiveBufferBytes", 23);
         params.put("requestTimeoutMs", 100);
         params.put("sendBufferBytes", 765);
-        params.put("timeoutMs", 2045);
-        params.put("blockOnBufferFull", false);
         params.put("maxInFlightRequest", 1);
-        params.put("metadataFetchTimeoutMs", 9043);
         params.put("metadataMaxAgeMs", 1029);
         params.put("reconnectBackoffMs", 234);
         params.put("reconnectBackoffMaxMs", 234);


[camel] 06/06: Avoid using mockito when possible

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch CAMEL-13870
in repository https://gitbox.apache.org/repos/asf/camel.git

commit f1378086875633003be3e56d86839e6fb16c3ca3
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Aug 23 09:18:57 2019 +0200

    Avoid using mockito when possible
---
 .../component/rabbitmq/RabbitMQComponentTest.java    | 20 ++++++++------------
 .../src/main/docs/spring-ws-component.adoc           |  4 ++--
 .../spring/ws/SpringWebserviceConfiguration.java     |  4 ++--
 .../dsl/SpringWebserviceEndpointBuilderFactory.java  | 10 +++++-----
 4 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
index 4025f02..10183d9 100644
--- a/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
+++ b/components/camel-rabbitmq/src/test/java/org/apache/camel/component/rabbitmq/RabbitMQComponentTest.java
@@ -23,19 +23,16 @@ import com.rabbitmq.client.ConnectionFactory;
 import org.apache.camel.CamelContext;
 import org.apache.camel.impl.DefaultCamelContext;
 import org.apache.camel.support.SimpleRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
 import org.junit.Test;
 import org.mockito.Mockito;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.mockito.AdditionalAnswers.returnsFirstArg;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.when;
+public class RabbitMQComponentTest extends CamelTestSupport {
 
-public class RabbitMQComponentTest {
-
-    private CamelContext context = Mockito.mock(CamelContext.class);
+    @Override
+    public boolean isUseRouteBuilder() {
+        return super.isUseRouteBuilder();
+    }
 
     @Test
     public void testDefaultProperties() throws Exception {
@@ -100,10 +97,9 @@ public class RabbitMQComponentTest {
         String uri = "rabbitmq:special.host:14/queuey";
         String remaining = "special.host:14/queuey";
 
-        RabbitMQComponent comp = new RabbitMQComponent(context);
-        when(context.resolvePropertyPlaceholders(anyString())).then(returnsFirstArg());
+        RabbitMQComponent comp = context.getComponent("rabbitmq", RabbitMQComponent.class);
         comp.setAutoDetectConnectionFactory(false);
-        return comp.createEndpoint(uri, remaining, params);
+        return (RabbitMQEndpoint) comp.createEndpoint(uri, params);
     }
 
     @Test
diff --git a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
index 1b88ba8..905ad2d 100644
--- a/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
+++ b/components/camel-spring-ws/src/main/docs/spring-ws-component.adoc
@@ -113,9 +113,9 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
+| *type* | Endpoint mapping type if endpoint mapping is used. rootqname - Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction - Used to map web service requests based on the SOAP action specified in the header of the message. uri - In order to map web service requests that target a specific URI. xpathresult - Used to map web service requests based on the evaluation of an XPath expression against the incoming m [...]
+| *lookupKey* | Endpoint mapping key if endpoint mapping is used |  | String
 | *webServiceEndpointUri* | The default Web Service endpoint uri to use for the producer. |  | String
-| *endpointMappingType* | Endpoint mapping type if endpoint mapping is used. rootqname - Offers the option to map web service requests based on the qualified name of the root element contained in the message. soapaction - Used to map web service requests based on the SOAP action specified in the header of the message. uri - In order to map web service requests that target a specific URI. xpathresult - Used to map web service requests based on the evaluation of an XPath expression against [...]
-| *endpointMappingLookupKey* | Endpoint mapping key if endpoint mapping is used |  | String
 | *expression* | The XPath expression to use when option type=xpathresult. Then this option is required to be configured. |  | String
 |===
 
diff --git a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
index bc727d7..f162773 100644
--- a/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
+++ b/components/camel-spring-ws/src/main/java/org/apache/camel/component/spring/ws/SpringWebserviceConfiguration.java
@@ -77,9 +77,9 @@ public class SpringWebserviceConfiguration {
     private boolean allowResponseAttachmentOverride;
     
     /* Consumer configuration */
-    @UriPath(label = "consumer")
+    @UriPath(label = "consumer", name = "type")
     private EndpointMappingType endpointMappingType;
-    @UriPath(label = "consumer")
+    @UriPath(label = "consumer", name = "lookupKey")
     private String endpointMappingLookupKey;
     @UriPath(label = "consumer")
     private String expression;
diff --git a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
index cefc3d0..f5a00c9 100644
--- a/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
+++ b/core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/SpringWebserviceEndpointBuilderFactory.java
@@ -1002,10 +1002,7 @@ public interface SpringWebserviceEndpointBuilderFactory {
      * 
      * Syntax: <code>spring-ws:type:lookupKey:webServiceEndpointUri</code>
      * 
-     * Path parameter: webServiceEndpointUri
-     * The default Web Service endpoint uri to use for the producer.
-     * 
-     * Path parameter: endpointMappingType
+     * Path parameter: type
      * Endpoint mapping type if endpoint mapping is used. rootqname - Offers the
      * option to map web service requests based on the qualified name of the
      * root element contained in the message. soapaction - Used to map web
@@ -1021,9 +1018,12 @@ public interface SpringWebserviceEndpointBuilderFactory {
      * The value can be one of: ROOT_QNAME, ACTION, TO, SOAP_ACTION,
      * XPATHRESULT, URI, URI_PATH, BEANNAME
      * 
-     * Path parameter: endpointMappingLookupKey
+     * Path parameter: lookupKey
      * Endpoint mapping key if endpoint mapping is used
      * 
+     * Path parameter: webServiceEndpointUri
+     * The default Web Service endpoint uri to use for the producer.
+     * 
      * Path parameter: expression
      * The XPath expression to use when option type=xpathresult. Then this
      * option is required to be configured.