Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAMEL-15297 camel-pgevent issue with URI verification #4073

Merged
merged 1 commit into from Aug 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -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 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." },
Expand Down
Expand Up @@ -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
|===

Expand Down
Expand Up @@ -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";
Expand Down Expand Up @@ -186,7 +186,7 @@ public String getDatabase() {
}

/**
* 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;
Expand Down
Expand Up @@ -25,10 +25,10 @@

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")
Expand Down
Expand Up @@ -50,7 +50,7 @@ public PGDataSource loadDataSource() throws Exception {
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"));


Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -11351,7 +11351,9 @@ public static org.apache.camel.builder.endpoint.dsl.PdfEndpointBuilderFactory.Pd
* 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
Expand Down Expand Up @@ -11381,7 +11383,9 @@ public static org.apache.camel.builder.endpoint.dsl.PgEventEndpointBuilderFactor
* 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
Expand Down
Expand Up @@ -569,7 +569,9 @@ public interface PgEventBuilders {
* 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
Expand Down Expand Up @@ -598,7 +600,9 @@ default PgEventEndpointBuilder pgevent(String path) {
* 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
Expand Down