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 46e23d1b7fa324f3a5ad2edf8d53e061262012ff
Author: Andrea Cosentino <anco...@gmail.com>
AuthorDate: Thu Oct 15 17:58:54 2020 +0200

    CAMEL-15688 - Camel-couchbase: Make the configuration of the endpoint less 
complex
---
 .../org/apache/camel/catalog/docs/couchbase-component.adoc          | 2 +-
 .../resources/org/apache/camel/component/couchbase/couchbase.json   | 2 +-
 components/camel-couchbase/src/main/docs/couchbase-component.adoc   | 2 +-
 .../org/apache/camel/component/couchbase/CouchbaseEndpoint.java     | 6 +-----
 .../apache/camel/component/couchbase/CouchbaseComponentTest.java    | 5 ++---
 .../org/apache/camel/component/couchbase/CouchbaseEndpointTest.java | 6 ------
 .../camel/builder/endpoint/dsl/CouchbaseEndpointBuilderFactory.java | 3 +++
 docs/components/modules/ROOT/pages/couchbase-component.adoc         | 2 +-
 8 files changed, 10 insertions(+), 18 deletions(-)

diff --git 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/couchbase-component.adoc
 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/couchbase-component.adoc
index e6034d4..a5e0472 100644
--- 
a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/couchbase-component.adoc
+++ 
b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/couchbase-component.adoc
@@ -79,7 +79,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *bucket* (common) | The bucket to use |  | String
+| *bucket* (common) | *Required* The bucket to use |  | String
 | *collection* (common) | The collection to use |  | String
 | *key* (common) | The key to use |  | String
 | *scope* (common) | The scope to use |  | String
diff --git 
a/components/camel-couchbase/src/generated/resources/org/apache/camel/component/couchbase/couchbase.json
 
b/components/camel-couchbase/src/generated/resources/org/apache/camel/component/couchbase/couchbase.json
index 392c32d..7d59f57 100644
--- 
a/components/camel-couchbase/src/generated/resources/org/apache/camel/component/couchbase/couchbase.json
+++ 
b/components/camel-couchbase/src/generated/resources/org/apache/camel/component/couchbase/couchbase.json
@@ -30,7 +30,7 @@
     "protocol": { "kind": "path", "displayName": "Protocol", "group": 
"common", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret": 
false, "description": "The protocol to use" },
     "hostname": { "kind": "path", "displayName": "Hostname", "group": 
"common", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret": 
false, "description": "The hostname to use" },
     "port": { "kind": "path", "displayName": "Port", "group": "common", 
"label": "", "required": false, "type": "integer", "javaType": "int", 
"deprecated": false, "secret": false, "defaultValue": 8091, "description": "The 
port number to use" },
-    "bucket": { "kind": "parameter", "displayName": "Bucket", "group": 
"common", "label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "secret": false, "description": "The 
bucket to use" },
+    "bucket": { "kind": "parameter", "displayName": "Bucket", "group": 
"common", "label": "", "required": true, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "deprecationNote": "", "secret": 
false, "description": "The bucket to use" },
     "collection": { "kind": "parameter", "displayName": "Collection", "group": 
"common", "label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "secret": false, "description": "The 
collection to use" },
     "key": { "kind": "parameter", "displayName": "Key", "group": "common", 
"label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "secret": false, "description": "The 
key to use" },
     "scope": { "kind": "parameter", "displayName": "Scope", "group": "common", 
"label": "", "required": false, "type": "string", "javaType": 
"java.lang.String", "deprecated": false, "secret": false, "description": "The 
scope to use" },
diff --git a/components/camel-couchbase/src/main/docs/couchbase-component.adoc 
b/components/camel-couchbase/src/main/docs/couchbase-component.adoc
index e6034d4..a5e0472 100644
--- a/components/camel-couchbase/src/main/docs/couchbase-component.adoc
+++ b/components/camel-couchbase/src/main/docs/couchbase-component.adoc
@@ -79,7 +79,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *bucket* (common) | The bucket to use |  | String
+| *bucket* (common) | *Required* The bucket to use |  | String
 | *collection* (common) | The collection to use |  | String
 | *key* (common) | The key to use |  | String
 | *scope* (common) | The scope to use |  | String
diff --git 
a/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java
 
b/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java
index a3145c3..4477784 100644
--- 
a/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java
+++ 
b/components/camel-couchbase/src/main/java/org/apache/camel/component/couchbase/CouchbaseEndpoint.java
@@ -67,6 +67,7 @@ public class CouchbaseEndpoint extends ScheduledPollEndpoint {
     private int port;
 
     @UriParam
+    @Metadata(required = true)
     private String bucket;
 
     @UriParam
@@ -146,11 +147,6 @@ public class CouchbaseEndpoint extends 
ScheduledPollEndpoint {
 
         port = remainingUri.getPort() == -1 ? DEFAULT_COUCHBASE_PORT : 
remainingUri.getPort();
 
-        if (remainingUri.getPath() == null || 
remainingUri.getPath().trim().length() == 0) {
-            throw new IllegalArgumentException(COUCHBASE_URI_ERROR);
-        }
-        bucket = remainingUri.getPath().substring(1);
-
         hostname = remainingUri.getHost();
         if (hostname == null) {
             throw new IllegalArgumentException(COUCHBASE_URI_ERROR);
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 d46920f..17a5938 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
@@ -63,14 +63,13 @@ public class CouchbaseComponentTest extends 
CamelTestSupport {
         params.put("persistTo", 2);
         params.put("replicateTo", 3);
 
-        String uri = "couchdb:http://localhost:91234/bucket";;
-        String remaining = "http://localhost:91234/bucket";;
+        String uri = "couchdb:http://localhost:91234";;
+        String remaining = "http://localhost:91234";;
 
         CouchbaseEndpoint endpoint = component.createEndpoint(uri, remaining, 
params);
 
         assertEquals("http", endpoint.getProtocol());
         assertEquals("localhost", endpoint.getHostname());
-        assertEquals("bucket", endpoint.getBucket());
         assertEquals(91234, endpoint.getPort());
         assertEquals("ugol", endpoint.getUsername());
         assertEquals("pwd", endpoint.getPassword());
diff --git 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseEndpointTest.java
 
b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseEndpointTest.java
index 610a1ce..2d68579 100644
--- 
a/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseEndpointTest.java
+++ 
b/components/camel-couchbase/src/test/java/org/apache/camel/component/couchbase/CouchbaseEndpointTest.java
@@ -35,12 +35,6 @@ public class CouchbaseEndpointTest {
     }
 
     @Test
-    public void testBucketRequired() throws Exception {
-        assertThrows(IllegalArgumentException.class,
-                () -> new CouchbaseEndpoint("couchbase:http://localhost:80";, 
"http://localhost:80";, new CouchbaseComponent()));
-    }
-
-    @Test
     public void testDefaultPortIsSet() throws Exception {
         CouchbaseEndpoint endpoint = new CouchbaseEndpoint(
                 "couchbase:http://localhost/bucket";, 
"http://localhost/bucket";, new CouchbaseComponent());
diff --git 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchbaseEndpointBuilderFactory.java
 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchbaseEndpointBuilderFactory.java
index 909f259..4f12741 100644
--- 
a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchbaseEndpointBuilderFactory.java
+++ 
b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/CouchbaseEndpointBuilderFactory.java
@@ -52,6 +52,7 @@ public interface CouchbaseEndpointBuilderFactory {
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
+         * Required: true
          * Group: common
          */
         default CouchbaseEndpointConsumerBuilder bucket(String bucket) {
@@ -909,6 +910,7 @@ public interface CouchbaseEndpointBuilderFactory {
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
+         * Required: true
          * Group: common
          */
         default CouchbaseEndpointProducerBuilder bucket(String bucket) {
@@ -1298,6 +1300,7 @@ public interface CouchbaseEndpointBuilderFactory {
          * 
          * The option is a: <code>java.lang.String</code> type.
          * 
+         * Required: true
          * Group: common
          */
         default CouchbaseEndpointBuilder bucket(String bucket) {
diff --git a/docs/components/modules/ROOT/pages/couchbase-component.adoc 
b/docs/components/modules/ROOT/pages/couchbase-component.adoc
index 0899532..9bc9546 100644
--- a/docs/components/modules/ROOT/pages/couchbase-component.adoc
+++ b/docs/components/modules/ROOT/pages/couchbase-component.adoc
@@ -81,7 +81,7 @@ with the following path and query parameters:
 [width="100%",cols="2,5,^1,2",options="header"]
 |===
 | Name | Description | Default | Type
-| *bucket* (common) | The bucket to use |  | String
+| *bucket* (common) | *Required* The bucket to use |  | String
 | *collection* (common) | The collection to use |  | String
 | *key* (common) | The key to use |  | String
 | *scope* (common) | The scope to use |  | String

Reply via email to