This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch camel-3.4.x in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/camel-3.4.x by this push: new a8b9177 CAMEL-15297 camel-pgevent issue with URI verification (#4073) (#4075) a8b9177 is described below commit a8b91770d1d76b62ac6f4caa2007a83374c4c42d Author: Zineb BENDHIBA <bendhiba.zi...@gmail.com> AuthorDate: Thu Aug 6 08:44:38 2020 +0200 CAMEL-15297 camel-pgevent issue with URI verification (#4073) (#4075) --- .../resources/org/apache/camel/component/pgevent/pgevent.json | 2 +- components/camel-pgevent/src/main/docs/pgevent-component.adoc | 2 +- .../org/apache/camel/component/pgevent/PgEventEndpoint.java | 10 +++++----- .../pgevent/integration/PgEventPubSubIntegrationTest.java | 4 ++-- .../PgEventWithDefinedDatasourceIntegrationTest.java | 2 +- .../camel-pgevent/src/test/resources/test-options.properties | 2 +- .../apache/camel/builder/endpoint/StaticEndpointBuilders.java | 8 ++++++-- .../builder/endpoint/dsl/PgEventEndpointBuilderFactory.java | 8 ++++++-- 8 files changed, 23 insertions(+), 15 deletions(-) diff --git a/components/camel-pgevent/src/generated/resources/org/apache/camel/component/pgevent/pgevent.json b/components/camel-pgevent/src/generated/resources/org/apache/camel/component/pgevent/pgevent.json index 4b180d1..8b7774b 100644 --- a/components/camel-pgevent/src/generated/resources/org/apache/camel/component/pgevent/pgevent.json +++ b/components/camel-pgevent/src/generated/resources/org/apache/camel/component/pgevent/pgevent.json @@ -28,7 +28,7 @@ "properties": { "host": { "kind": "path", "displayName": "Host", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "secret": false, "defaultValue": "localhost", "description": "To connect using hostname and port to the database." }, "port": { "kind": "path", "displayName": "Port", "group": "common", "label": "", "required": false, "type": "integer", "javaType": "java.lang.Integer", "deprecated": false, "secret": false, "defaultValue": "5432", "description": "To connect using hostname and port to the database." }, - "database": { "kind": "path", "displayName": "Database", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "The database name" }, + "database": { "kind": "path", "displayName": "Database", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "The database name. The database name can take any characters because it is sent as a quoted identifier. It is part of the endpoint URI, so diacritical marks and non-Latin letters have to be URL encoded." }, "channel": { "kind": "path", "displayName": "Channel", "group": "common", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "secret": false, "description": "The channel name" }, "datasource": { "kind": "parameter", "displayName": "Datasource", "group": "common", "label": "", "required": false, "type": "object", "javaType": "javax.sql.DataSource", "deprecated": false, "secret": false, "description": "To connect using the given javax.sql.DataSource instead of using hostname and port." }, "bridgeErrorHandler": { "kind": "parameter", "displayName": "Bridge Error Handler", "group": "consumer", "label": "consumer", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "secret": false, "defaultValue": false, "description": "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 b [...] diff --git a/components/camel-pgevent/src/main/docs/pgevent-component.adoc b/components/camel-pgevent/src/main/docs/pgevent-component.adoc index fe890b9..21a22e4 100644 --- a/components/camel-pgevent/src/main/docs/pgevent-component.adoc +++ b/components/camel-pgevent/src/main/docs/pgevent-component.adoc @@ -78,7 +78,7 @@ with the following path and query parameters: | Name | Description | Default | Type | *host* | To connect using hostname and port to the database. | localhost | String | *port* | To connect using hostname and port to the database. | 5432 | Integer -| *database* | *Required* The database name | | String +| *database* | *Required* The database name. The database name can take any characters because it is sent as a quoted identifier. It is part of the endpoint URI, so diacritical marks and non-Latin letters have to be URL encoded. | | String | *channel* | *Required* The channel name | | String |=== diff --git a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java index 8a0a4cd..5d83ce5 100644 --- a/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java +++ b/components/camel-pgevent/src/main/java/org/apache/camel/component/pgevent/PgEventEndpoint.java @@ -46,10 +46,10 @@ public class PgEventEndpoint extends DefaultEndpoint { private static final Logger LOG = LoggerFactory.getLogger(PgEventEndpoint.class); - private static final String FORMAT1 = "^pgevent://([^:]*):(\\d+)/(\\w+)/(\\w+).*$"; - private static final String FORMAT2 = "^pgevent://([^:]+)/(\\w+)/(\\w+).*$"; - private static final String FORMAT3 = "^pgevent:///(\\w+)/(\\w+).*$"; - private static final String FORMAT4 = "^pgevent:(\\w+)/(\\w+)/(\\w+).*$"; + private static final String FORMAT1 = "^pgevent://([^:]*):(\\d+)/(.+)/(\\w+).*$"; + private static final String FORMAT2 = "^pgevent://([^:]+)/(.+)/(\\w+).*$"; + private static final String FORMAT3 = "^pgevent:///(.+)/(\\w+).*$"; + private static final String FORMAT4 = "^pgevent:(.+)/(\\w+)/(\\w+).*$"; @UriPath(defaultValue = "localhost") private String host = "localhost"; @@ -186,7 +186,7 @@ public class PgEventEndpoint extends DefaultEndpoint { } /** - * The database name + * The database name. The database name can take any characters because it is sent as a quoted identifier. It is part of the endpoint URI, so diacritical marks and non-Latin letters have to be URL encoded. */ public void setDatabase(String database) { this.database = database; diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java index ae8c954..30a656d 100644 --- a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java +++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventPubSubIntegrationTest.java @@ -25,10 +25,10 @@ import org.junit.Test; public class PgEventPubSubIntegrationTest extends AbstractPgEventIntegrationTest { - @EndpointInject("pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{userName}}&pass={{password}}") + @EndpointInject("pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{databaseUser}}&pass={{password}}") private Endpoint subscribeEndpoint; - @EndpointInject("pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{userName}}&pass={{password}}") + @EndpointInject("pgevent://{{host}}:{{port}}/{{database}}/testchannel?user={{databaseUser}}&pass={{password}}") private Endpoint notifyEndpoint; @EndpointInject("timer://test?repeatCount=1&period=1") diff --git a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java index 4ecbcac..27ce506 100644 --- a/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java +++ b/components/camel-pgevent/src/test/java/org/apache/camel/pgevent/integration/PgEventWithDefinedDatasourceIntegrationTest.java @@ -50,7 +50,7 @@ public class PgEventWithDefinedDatasourceIntegrationTest extends AbstractPgEvent dataSource.setHost(properties.getProperty("host")); dataSource.setPort(Integer.parseInt(properties.getProperty("port"))); dataSource.setDatabaseName(properties.getProperty("database")); - dataSource.setUser(properties.getProperty("userName")); + dataSource.setUser(properties.getProperty("databaseUser")); dataSource.setPassword(properties.getProperty("password")); diff --git a/components/camel-pgevent/src/test/resources/test-options.properties b/components/camel-pgevent/src/test/resources/test-options.properties index 08ff2c4..0b6b18e 100644 --- a/components/camel-pgevent/src/test/resources/test-options.properties +++ b/components/camel-pgevent/src/test/resources/test-options.properties @@ -28,7 +28,7 @@ host=localhost port=5432 # The user name used for connecting to PostgreSQL -userName=postgres +databaseUser=postgres # The password used for connecting to PostgreSQL password=mysecretpassword diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java index f49e10a..d7416b7 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/StaticEndpointBuilders.java @@ -11214,7 +11214,9 @@ public class StaticEndpointBuilders { * Default value: 5432 * * Path parameter: database (required) - * The database name + * The database name. The database name can take any characters because it + * is sent as a quoted identifier. It is part of the endpoint URI, so + * diacritical marks and non-Latin letters have to be URL encoded. * * Path parameter: channel (required) * The channel name @@ -11244,7 +11246,9 @@ public class StaticEndpointBuilders { * Default value: 5432 * * Path parameter: database (required) - * The database name + * The database name. The database name can take any characters because it + * is sent as a quoted identifier. It is part of the endpoint URI, so + * diacritical marks and non-Latin letters have to be URL encoded. * * Path parameter: channel (required) * The channel name diff --git a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PgEventEndpointBuilderFactory.java b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PgEventEndpointBuilderFactory.java index 16eec9a..0ed4728 100644 --- a/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PgEventEndpointBuilderFactory.java +++ b/core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/PgEventEndpointBuilderFactory.java @@ -569,7 +569,9 @@ public interface PgEventEndpointBuilderFactory { * Default value: 5432 * * Path parameter: database (required) - * The database name + * The database name. The database name can take any characters because + * it is sent as a quoted identifier. It is part of the endpoint URI, so + * diacritical marks and non-Latin letters have to be URL encoded. * * Path parameter: channel (required) * The channel name @@ -598,7 +600,9 @@ public interface PgEventEndpointBuilderFactory { * Default value: 5432 * * Path parameter: database (required) - * The database name + * The database name. The database name can take any characters because + * it is sent as a quoted identifier. It is part of the endpoint URI, so + * diacritical marks and non-Latin letters have to be URL encoded. * * Path parameter: channel (required) * The channel name