This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push: new 5ef780e22c4 CAMEL-19063: camel-atom/camel-rss - Use another atom parser that is up to date. 5ef780e22c4 is described below commit 5ef780e22c48eb8fd68911e1b24d12d0703c7341 Author: Claus Ibsen <claus.ib...@gmail.com> AuthorDate: Tue Jul 18 12:50:41 2023 +0200 CAMEL-19063: camel-atom/camel-rss - Use another atom parser that is up to date. --- .../org/apache/camel/catalog/components/atom.json | 6 +- .../org/apache/camel/catalog/components/rss.json | 4 +- components/camel-atom/pom.xml | 122 +-------------------- .../component/atom/AtomEndpointConfigurer.java | 6 - .../component/atom/AtomEndpointUriFactory.java | 9 +- .../services/org/apache/camel/adapter-factory | 2 - .../services/org/apache/camel/atom-adapter-factory | 2 - .../org/apache/camel/component/atom/atom.json | 6 +- .../apache/camel/component/atom/AtomConstants.java | 7 +- .../apache/camel/component/atom/AtomEndpoint.java | 3 +- .../component/atom/AtomEntryPollingConsumer.java | 51 ++++----- .../camel/component/atom/AtomPollingConsumer.java | 23 ++-- .../org/apache/camel/component/atom/AtomUtils.java | 87 +++++---------- .../camel/component/atom/UpdatedDateFilter.java | 67 ----------- .../apache/camel/component/feed/EntryFilter.java | 40 ------- .../apache/camel/component/feed/FeedEndpoint.java | 38 +------ .../component/feed/FeedEntryPollingConsumer.java | 41 +------ .../AtomEntryPollingConsumerWithBasicAuthTest.java | 59 ---------- .../AtomEntryPollingConsumerWithResumeTest.java | 67 ----------- .../camel/component/atom/AtomEntrySortTest.java | 75 ------------- .../camel/component/atom/AtomGoodBlogsTest.java | 6 +- .../component/atom/AtomPollingConsumerTest.java | 9 +- .../atom/AtomPollingConsumerWithBasicAuthTest.java | 60 ---------- .../camel/component/atom/AtomProducerTest.java | 40 ------- .../apache/camel/component/atom/AtomRouteTest.java | 6 +- .../apache/camel/component/atom/MyHttpServlet.java | 39 ------- .../component/atom/UpdatedDateFilterTest.java | 67 ----------- components/camel-rss/pom.xml | 6 - .../camel/component/rss/RssEndpointConfigurer.java | 6 - .../camel/component/rss/RssEndpointUriFactory.java | 9 +- .../org/apache/camel/component/rss/rss.json | 4 +- .../component/rss/RssEntryPollingConsumer.java | 8 +- .../camel/component/rss/RssPollingConsumer.java | 7 +- .../org/apache/camel/component/rss/RssUtils.java | 29 ----- .../camel/component/rss/UpdatedDateFilter.java | 82 -------------- .../apache/camel/component/rss/MyHttpServlet.java | 38 ------- .../RssEntryPollingConsumerWithBasicAuthTest.java | 63 ----------- .../rss/RssPollingConsumerWithBasicAuthTest.java | 52 --------- .../camel/component/rss/UpdatedDateFilterTest.java | 58 ---------- .../dsl/ArangoDbEndpointBuilderFactory.java | 30 +++++ parent/pom.xml | 3 +- 41 files changed, 133 insertions(+), 1204 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/atom.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/atom.json index e2aefaaa775..e0563d9dd34 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/atom.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/atom.json @@ -26,7 +26,7 @@ "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { - "CamelAtomFeed": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "org.apache.abdera.model.Feed", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When consuming the org.apache.abdera.model.Feed object is set to this header.", "constantName": "org.apache.camel.component.atom.AtomConstants#ATOM_FEED" } + "CamelAtomFeed": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "java.util.List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When consuming the List object is set to this header.", "constantName": "org.apache.camel.component.atom.AtomConstants#ATOM_FEED" } }, "properties": { "feedUri": { "index": 0, "kind": "path", "displayName": "Feed Uri", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The URI to the feed to poll." }, @@ -52,8 +52,6 @@ "schedulerProperties": { "index": 20, "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." }, "startScheduler": { "index": 21, "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the scheduler should be auto started." }, "timeUnit": { "index": 22, "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." }, - "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, - "password": { "index": 24, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the password to be used for basic authentication when polling from a HTTP feed.Notice: Basic authentication is not a secured method, and is not recommended to be used." }, - "username": { "index": 25, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the username to be used for basic authentication when polling from a HTTP feed. Notice: Basic authentication is not a secured method, and is not recommended to be used." } + "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." } } } diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rss.json b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rss.json index 86738b8d9e4..85141b08b12 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rss.json +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/components/rss.json @@ -52,8 +52,6 @@ "schedulerProperties": { "index": 20, "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." }, "startScheduler": { "index": 21, "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the scheduler should be auto started." }, "timeUnit": { "index": 22, "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." }, - "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, - "password": { "index": 24, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the password to be used for basic authentication when polling from a HTTP feed.Notice: Basic authentication is not a secured method, and is not recommended to be used." }, - "username": { "index": 25, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the username to be used for basic authentication when polling from a HTTP feed. Notice: Basic authentication is not a secured method, and is not recommended to be used." } + "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." } } } diff --git a/components/camel-atom/pom.xml b/components/camel-atom/pom.xml index ec5e7364604..4f0ab9d69a6 100644 --- a/components/camel-atom/pom.xml +++ b/components/camel-atom/pom.xml @@ -43,125 +43,11 @@ <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> </dependency> + <dependency> - <groupId>org.apache.abdera</groupId> - <artifactId>abdera-core</artifactId> - <version>${abdera-version}</version> - <exclusions> - <exclusion> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-activation_1.0.2_spec</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.geronimo.specs</groupId> - <artifactId>geronimo-stax-api_1.0_spec</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.abdera</groupId> - <artifactId>abdera-parser</artifactId> - <version>${abdera-version}</version> - <exclusions> - <exclusion> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - </exclusion> - <exclusion> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - </exclusion> - <exclusion> - <artifactId>xmlParserAPIs</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xercesImpl</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xom</artifactId> - <groupId>xom</groupId> - </exclusion> - <exclusion> - <artifactId>xalan</artifactId> - <groupId>xalan</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - <exclusion> - <groupId>org.codehaus.woodstox</groupId> - <artifactId>wstx-asl</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.ws.commons.axiom</groupId> - <artifactId>axiom-api</artifactId> - <version>${axiom-version}</version> - <exclusions> - <exclusion> - <artifactId>geronimo-javamail_1.4_spec</artifactId> - <groupId>org.apache.geronimo.specs</groupId> - </exclusion> - <exclusion> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - </exclusion> - <exclusion> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - </exclusion> - <exclusion> - <artifactId>xmlParserAPIs</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xercesImpl</artifactId> - <groupId>xerces</groupId> - </exclusion> - <exclusion> - <artifactId>xom</artifactId> - <groupId>xom</groupId> - </exclusion> - <exclusion> - <artifactId>xalan</artifactId> - <groupId>xalan</groupId> - </exclusion> - <exclusion> - <artifactId>xml-apis</artifactId> - <groupId>xml-apis</groupId> - </exclusion> - <exclusion> - <groupId>org.codehaus.woodstox</groupId> - <artifactId>wstx-asl</artifactId> - </exclusion> - </exclusions> - </dependency> - <dependency> - <groupId>org.apache.ws.commons.axiom</groupId> - <artifactId>axiom-impl</artifactId> - <version>${axiom-version}</version> - <exclusions> - <exclusion> - <artifactId>geronimo-javamail_1.4_spec</artifactId> - <groupId>org.apache.geronimo.specs</groupId> - </exclusion> - <exclusion> - <groupId>xml-apis</groupId> - <artifactId>xml-apis</artifactId> - </exclusion> - <exclusion> - <groupId>stax</groupId> - <artifactId>stax-api</artifactId> - </exclusion> - <exclusion> - <groupId>org.codehaus.woodstox</groupId> - <artifactId>wstx-asl</artifactId> - </exclusion> - </exclusions> + <groupId>com.apptasticsoftware</groupId> + <artifactId>rssreader</artifactId> + <version>${rssreader-version}</version> </dependency> <!-- testing --> diff --git a/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointConfigurer.java b/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointConfigurer.java index ad131f4cc5c..11de6a42980 100644 --- a/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointConfigurer.java +++ b/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointConfigurer.java @@ -39,7 +39,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": target.setGreedy(property(camelContext, boolean.class, value)); return true; case "initialdelay": case "initialDelay": target.setInitialDelay(property(camelContext, long.class, value)); return true; - case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; case "pollstrategy": case "pollStrategy": target.setPollStrategy(property(camelContext, org.apache.camel.spi.PollingConsumerPollStrategy.class, value)); return true; case "repeatcount": @@ -65,7 +64,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": target.setTimeUnit(property(camelContext, java.util.concurrent.TimeUnit.class, value)); return true; case "usefixeddelay": case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true; - case "username": target.setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } } @@ -91,7 +89,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": return boolean.class; case "initialdelay": case "initialDelay": return long.class; - case "password": return java.lang.String.class; case "pollstrategy": case "pollStrategy": return org.apache.camel.spi.PollingConsumerPollStrategy.class; case "repeatcount": @@ -117,7 +114,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": return java.util.concurrent.TimeUnit.class; case "usefixeddelay": case "useFixedDelay": return boolean.class; - case "username": return java.lang.String.class; default: return null; } } @@ -144,7 +140,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": return target.isGreedy(); case "initialdelay": case "initialDelay": return target.getInitialDelay(); - case "password": return target.getPassword(); case "pollstrategy": case "pollStrategy": return target.getPollStrategy(); case "repeatcount": @@ -170,7 +165,6 @@ public class AtomEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": return target.getTimeUnit(); case "usefixeddelay": case "useFixedDelay": return target.isUseFixedDelay(); - case "username": return target.getUsername(); default: return null; } } diff --git a/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointUriFactory.java b/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointUriFactory.java index 365b17e4adf..d2ed51fadfa 100644 --- a/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointUriFactory.java +++ b/components/camel-atom/src/generated/java/org/apache/camel/component/atom/AtomEndpointUriFactory.java @@ -21,7 +21,7 @@ public class AtomEndpointUriFactory extends org.apache.camel.support.component.E private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(26); + Set<String> props = new HashSet<>(24); props.add("backoffErrorThreshold"); props.add("backoffIdleThreshold"); props.add("backoffMultiplier"); @@ -33,7 +33,6 @@ public class AtomEndpointUriFactory extends org.apache.camel.support.component.E props.add("feedUri"); props.add("greedy"); props.add("initialDelay"); - props.add("password"); props.add("pollStrategy"); props.add("repeatCount"); props.add("runLoggingLevel"); @@ -47,12 +46,8 @@ public class AtomEndpointUriFactory extends org.apache.camel.support.component.E props.add("throttleEntries"); props.add("timeUnit"); props.add("useFixedDelay"); - props.add("username"); PROPERTY_NAMES = Collections.unmodifiableSet(props); - Set<String> secretProps = new HashSet<>(2); - secretProps.add("password"); - secretProps.add("username"); - SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps); + SECRET_PROPERTY_NAMES = Collections.emptySet(); Set<String> prefixes = new HashSet<>(1); prefixes.add("scheduler."); MULTI_VALUE_PREFIXES = Collections.unmodifiableSet(prefixes); diff --git a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory deleted file mode 100644 index f71a880bc41..00000000000 --- a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/adapter-factory +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.atom.UpdatedDateFilter diff --git a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory b/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory deleted file mode 100644 index f71a880bc41..00000000000 --- a/components/camel-atom/src/generated/resources/META-INF/services/org/apache/camel/atom-adapter-factory +++ /dev/null @@ -1,2 +0,0 @@ -# Generated by camel build tools - do NOT edit this file! -class=org.apache.camel.component.atom.UpdatedDateFilter diff --git a/components/camel-atom/src/generated/resources/org/apache/camel/component/atom/atom.json b/components/camel-atom/src/generated/resources/org/apache/camel/component/atom/atom.json index e2aefaaa775..e0563d9dd34 100644 --- a/components/camel-atom/src/generated/resources/org/apache/camel/component/atom/atom.json +++ b/components/camel-atom/src/generated/resources/org/apache/camel/component/atom/atom.json @@ -26,7 +26,7 @@ "autowiredEnabled": { "index": 1, "kind": "property", "displayName": "Autowired Enabled", "group": "advanced", "label": "advanced", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether autowiring is enabled. This is used for automatic autowiring options (the option must be marked as autowired) by looking up in the registry to find if there is a single instance of matching t [...] }, "headers": { - "CamelAtomFeed": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "org.apache.abdera.model.Feed", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When consuming the org.apache.abdera.model.Feed object is set to this header.", "constantName": "org.apache.camel.component.atom.AtomConstants#ATOM_FEED" } + "CamelAtomFeed": { "index": 0, "kind": "header", "displayName": "", "group": "consumer", "label": "", "required": false, "javaType": "java.util.List", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "When consuming the List object is set to this header.", "constantName": "org.apache.camel.component.atom.AtomConstants#ATOM_FEED" } }, "properties": { "feedUri": { "index": 0, "kind": "path", "displayName": "Feed Uri", "group": "consumer", "label": "", "required": true, "type": "string", "javaType": "java.lang.String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The URI to the feed to poll." }, @@ -52,8 +52,6 @@ "schedulerProperties": { "index": 20, "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." }, "startScheduler": { "index": 21, "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the scheduler should be auto started." }, "timeUnit": { "index": 22, "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." }, - "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, - "password": { "index": 24, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the password to be used for basic authentication when polling from a HTTP feed.Notice: Basic authentication is not a secured method, and is not recommended to be used." }, - "username": { "index": 25, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the username to be used for basic authentication when polling from a HTTP feed. Notice: Basic authentication is not a secured method, and is not recommended to be used." } + "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." } } } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomConstants.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomConstants.java index 93713ce6561..d531ca32b37 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomConstants.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomConstants.java @@ -24,10 +24,11 @@ import org.apache.camel.spi.Metadata; public final class AtomConstants { /** - * Header key for the {@link org.apache.abdera.model.Feed} object is stored on the in message on the exchange. + * Header key for the List of {@link com.apptasticsoftware.rssreader.Item} object is stored on the in message on the + * exchange. */ - @Metadata(description = "When consuming the `org.apache.abdera.model.Feed` object is set to this header.", - javaType = "org.apache.abdera.model.Feed") + @Metadata(description = "When consuming the List<com.apptasticsoftware.rssreader.Item> object is set to this header.", + javaType = "java.util.List") public static final String ATOM_FEED = "CamelAtomFeed"; private AtomConstants() { diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java index 1302674cba7..6322fed1260 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEndpoint.java @@ -16,7 +16,6 @@ */ package org.apache.camel.component.atom; -import org.apache.abdera.model.Feed; import org.apache.camel.Category; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -42,7 +41,7 @@ public class AtomEndpoint extends FeedEndpoint { @Override public Exchange createExchange(Object feed) { Exchange exchange = createExchangeWithFeedHeader(feed, AtomConstants.ATOM_FEED); - exchange.getIn().setBody(((Feed) feed).getEntries()); + exchange.getIn().setBody(feed); return exchange; } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java index 0d5b02ed291..311f26b1e00 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomEntryPollingConsumer.java @@ -17,57 +17,54 @@ package org.apache.camel.component.atom; import java.io.IOException; +import java.util.List; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Feed; -import org.apache.abdera.parser.ParseException; +import com.apptasticsoftware.rssreader.Item; +import com.apptasticsoftware.rssreader.RssReader; import org.apache.camel.Processor; import org.apache.camel.component.feed.FeedEntryPollingConsumer; -import org.apache.camel.util.ObjectHelper; /** * Consumer to poll atom feeds and return each entry from the feed step by step. */ public class AtomEntryPollingConsumer extends FeedEntryPollingConsumer { - private Document<Feed> document; + + private RssReader rssReader; + private List<Item> items; public AtomEntryPollingConsumer(AtomEndpoint endpoint, Processor processor, boolean throttleEntries) { super(endpoint, processor, throttleEntries); } - private Document<Feed> getDocument() throws IOException, ParseException { - if (document == null) { - if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) { - document = AtomUtils.parseDocument(endpoint.getFeedUri()); - } else { - document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword()); - } - Feed root = document.getRoot(); - if (endpoint.isSortEntries()) { - sortEntries(root); - } - list = root.getEntries(); - entryIndex = list.size() - 1; - } - return document; - } - - protected void sortEntries(Feed feed) { - feed.sortEntriesByUpdated(true); + @Override + protected void doStart() throws Exception { + this.rssReader = new RssReader(); + this.rssReader.addItemExtension("name", Item::setAuthor); + super.doStart(); } @Override - protected void populateList(Object feed) throws ParseException, IOException { + protected void populateList(Object feed) throws IOException { // list is populated already in the createFeed method } @Override protected Object createFeed() throws IOException { - return getDocument().getRoot(); + return readItems(); } @Override protected void resetList() { - document = null; + items = null; } + + private List<Item> readItems() throws IOException { + if (items == null) { + items = AtomUtils.readItems(endpoint.getCamelContext(), endpoint.getFeedUri(), rssReader, endpoint.isSortEntries()); + list = items; + entryIndex = list.size() - 1; + } + return items; + } + } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java index 4196d1b0c89..e286e8221c1 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomPollingConsumer.java @@ -18,29 +18,32 @@ package org.apache.camel.component.atom; import java.io.IOException; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Feed; +import com.apptasticsoftware.rssreader.Item; +import com.apptasticsoftware.rssreader.RssReader; import org.apache.camel.Processor; import org.apache.camel.component.feed.FeedPollingConsumer; -import org.apache.camel.util.ObjectHelper; /** * Consumer to poll atom feeds and return the full feed. */ public class AtomPollingConsumer extends FeedPollingConsumer { + private RssReader rssReader; + public AtomPollingConsumer(AtomEndpoint endpoint, Processor processor) { super(endpoint, processor); } + @Override + protected void doStart() throws Exception { + this.rssReader = new RssReader(); + this.rssReader.addItemExtension("name", Item::setAuthor); + super.doStart(); + } + @Override protected Object createFeed() throws IOException { - Document<Feed> document; - if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) { - document = AtomUtils.parseDocument(endpoint.getFeedUri()); - } else { - document = AtomUtils.parseDocument(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword()); - } - return document.getRoot(); + return AtomUtils.readItems(endpoint.getCamelContext(), endpoint.getFeedUri(), rssReader, endpoint.isSortEntries()); } + } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java index dac6b76ba3c..61320f82035 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/atom/AtomUtils.java @@ -18,71 +18,36 @@ package org.apache.camel.component.atom; import java.io.IOException; import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLConnection; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; -import org.apache.abdera.Abdera; -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Feed; -import org.apache.abdera.parser.ParseException; -import org.apache.abdera.parser.Parser; -import org.apache.commons.codec.binary.Base64; +import com.apptasticsoftware.rssreader.Item; +import com.apptasticsoftware.rssreader.RssReader; +import com.apptasticsoftware.rssreader.util.ItemComparator; +import org.apache.camel.CamelContext; +import org.apache.camel.support.ResourceHelper; +import org.apache.camel.util.IOHelper; -/** - * Atom utilities. - */ public final class AtomUtils { - private AtomUtils() { - // Helper class - } - - /** - * Gets the Atom parser. - */ - public static Parser getAtomParser() { - return Abdera.getInstance().getParser(); - } - - /** - * Parses the given uri and returns the response as a atom feed document. - * - * @param uri the uri for the atom feed. - * @return the document - * @throws IOException is thrown if error reading from the uri - * @throws ParseException is thrown if the parsing failed - */ - public static Document<Feed> parseDocument(String uri) throws IOException, ParseException { - URL feedUrl = new URL(uri); - URLConnection urlConn = feedUrl.openConnection(); - urlConn.setConnectTimeout(60000); - urlConn.setReadTimeout(60000); - InputStream in = urlConn.getInputStream(); - return parseInputStream(in); - } - - public static Document<Feed> parseDocument(String uri, String username, String password) throws IOException { - URL feedUrl = new URL(uri); - HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection(); - httpcon.setConnectTimeout(60000); - httpcon.setReadTimeout(60000); - String encoding = Base64.encodeBase64String(username.concat(":").concat(password).getBytes()); - httpcon.setRequestProperty("Authorization", "Basic " + encoding); - InputStream in = httpcon.getInputStream(); - return parseInputStream(in); - } - - private static Document<Feed> parseInputStream(InputStream in) throws ParseException { - Parser parser = getAtomParser(); - // set the thread context loader with the ParserClassLoader - ClassLoader old = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(parser.getClass().getClassLoader()); - return parser.parse(in); - } finally { - Thread.currentThread().setContextClassLoader(old); + public static List<Item> readItems(CamelContext camelContext, String uri, RssReader reader, boolean sort) + throws IOException { + if (ResourceHelper.isHttpUri(uri)) { + return reader + .read(uri) + .sorted(sort ? ItemComparator.oldestItemFirst() : Comparator.naturalOrder()) + .collect(Collectors.toList()); + } else { + InputStream is = ResourceHelper.resolveMandatoryResourceAsInputStream(camelContext, uri); + try { + return reader + .read(is) + .sorted(sort ? ItemComparator.oldestItemFirst() : Comparator.naturalOrder()) + .collect(Collectors.toList()); + } finally { + IOHelper.close(is); + } } } - } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java b/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java deleted file mode 100644 index d89ed30366f..00000000000 --- a/components/camel-atom/src/main/java/org/apache/camel/component/atom/UpdatedDateFilter.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import java.util.Date; - -import org.apache.abdera.model.Entry; -import org.apache.camel.component.feed.EntryFilter; -import org.apache.camel.resume.ResumeAdapter; -import org.apache.camel.spi.annotations.JdkService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Filters out all entries which occur before the last time of the entry we saw (assuming entries arrive sorted in - * order). - */ -@JdkService(ResumeAdapter.RESUME_ADAPTER_FACTORY) -public class UpdatedDateFilter implements EntryFilter<Entry> { - - private static final Logger LOG = LoggerFactory.getLogger(UpdatedDateFilter.class); - private Date lastUpdate; - - public UpdatedDateFilter() { - - } - - public UpdatedDateFilter(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - @Override - public boolean isValidEntry(Entry entry) { - Date updated = entry.getUpdated(); - if (updated == null) { - // never been updated so get published date - updated = entry.getPublished(); - } - if (updated == null) { - LOG.debug("No updated time for entry so assuming its valid: entry=[{}]", entry); - return true; - } - if (lastUpdate != null) { - // we need to skip the latest updated entry - if (lastUpdate.after(updated) || lastUpdate.equals(updated)) { - LOG.debug("Entry is older than last update=[{}], no valid entry=[{}]", lastUpdate, entry); - return false; - } - } - lastUpdate = updated; - return true; - } -} diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/feed/EntryFilter.java b/components/camel-atom/src/main/java/org/apache/camel/component/feed/EntryFilter.java deleted file mode 100644 index b0a4dd6e5a3..00000000000 --- a/components/camel-atom/src/main/java/org/apache/camel/component/feed/EntryFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.feed; - -import org.apache.camel.resume.ResumeAdapter; - -/** - * Filter used by the {@link org.apache.camel.component.feed.FeedEntryPollingConsumer} to filter entries from the feed. - * - * @param <E> entry type - */ -public interface EntryFilter<E> extends ResumeAdapter { - - /** - * Tests to be used as filtering the feed for only entries of interest, such as only new entries, etc. - * - * @param entry the given entry to filter - * @return <tt>true</tt> to include the entry, <ff>false</tt> to skip it - */ - boolean isValidEntry(E entry); - - @Override - default void resume() { - // NO-OP by default. Implementations can implement more complex behaviors if needed - } -} diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java index 6bdf7704f14..0cb4f6797fb 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEndpoint.java @@ -46,16 +46,6 @@ public abstract class FeedEndpoint extends DefaultPollingEndpoint { + "single feed poll should be delivered immediately. If true, only one entry is processed " + "per delay. Only applicable when splitEntries = true.") private boolean throttleEntries = true; - @UriParam(label = "security", secret = true, - description = "Sets the username to be used for basic authentication when polling from a HTTP feed. " - + "Notice: Basic authentication is not a secured method, and is not recommended to be used.") - @Deprecated - private String username; - @UriParam(label = "security", secret = true, - description = "Sets the password to be used for basic authentication when polling from a HTTP feed." - + "Notice: Basic authentication is not a secured method, and is not recommended to be used.") - @Deprecated - private String password; protected FeedEndpoint() { } @@ -150,8 +140,7 @@ public abstract class FeedEndpoint extends DefaultPollingEndpoint { } /** - * Sets whether or not entries should be sent individually or whether the entire feed should be sent as a single - * message + * Sets whether entries should be sent individually or whether the entire feed should be sent as a single message */ public void setSplitEntries(boolean splitEntries) { this.splitEntries = splitEntries; @@ -197,29 +186,4 @@ public abstract class FeedEndpoint extends DefaultPollingEndpoint { return this.throttleEntries; } - public String getUsername() { - return username; - } - - /** - * Sets the username to be used for basic authentication when polling from a HTTP feed - */ - public void setUsername(String username) { - this.username = username; - } - - public String getPassword() { - return password; - } - - /** - * Sets the password to be used for basic authentication when polling from a HTTP feed - */ - public void setPassword(String password) { - this.password = password; - } - - // Implementation methods - //------------------------------------------------------------------------- - } diff --git a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java index 0f27b6ee379..91ead9052b5 100644 --- a/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java +++ b/components/camel-atom/src/main/java/org/apache/camel/component/feed/FeedEntryPollingConsumer.java @@ -20,16 +20,12 @@ import java.util.List; import org.apache.camel.Exchange; import org.apache.camel.Processor; -import org.apache.camel.resume.ResumeAdapter; -import org.apache.camel.resume.ResumeAware; -import org.apache.camel.resume.ResumeStrategy; /** * Consumer to poll feeds and return each entry from the feed step by step. */ -public abstract class FeedEntryPollingConsumer<E> extends FeedPollingConsumer implements ResumeAware<ResumeStrategy> { +public abstract class FeedEntryPollingConsumer<E> extends FeedPollingConsumer { protected int entryIndex; - protected ResumeStrategy resumeStrategy; @SuppressWarnings("rawtypes") protected List<E> list; protected boolean throttleEntries; @@ -53,21 +49,11 @@ public abstract class FeedEntryPollingConsumer<E> extends FeedPollingConsumer im E entry = list.get(entryIndex--); polledMessages++; - boolean valid = true; - if (resumeStrategy != null) { - ResumeAdapter adapter = resumeStrategy.getAdapter(); - - if (adapter instanceof EntryFilter) { - valid = ((EntryFilter<E>) adapter).isValidEntry(entry); - } - } - if (valid) { - Exchange exchange = endpoint.createExchange(feed, entry); - getProcessor().process(exchange); - if (this.throttleEntries) { - // return and wait for the next poll to continue from last time (this consumer is stateful) - return polledMessages; - } + Exchange exchange = endpoint.createExchange(feed, entry); + getProcessor().process(exchange); + if (this.throttleEntries) { + // return and wait for the next poll to continue from last time (this consumer is stateful) + return polledMessages; } } @@ -78,21 +64,6 @@ public abstract class FeedEntryPollingConsumer<E> extends FeedPollingConsumer im return polledMessages; } - @Override - public void setResumeStrategy(ResumeStrategy resumeStrategy) { - this.resumeStrategy = resumeStrategy; - } - - @Override - public ResumeStrategy getResumeStrategy() { - return resumeStrategy; - } - - @Override - public String adapterFactoryService() { - return "atom-adapter-factory"; - } - protected abstract void resetList(); protected abstract void populateList(Object feed) throws Exception; diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithBasicAuthTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithBasicAuthTest.java deleted file mode 100644 index b3d5c2ef971..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithBasicAuthTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.infra.jetty.services.JettyConfiguration; -import org.apache.camel.test.infra.jetty.services.JettyConfigurationBuilder; -import org.apache.camel.test.infra.jetty.services.JettyEmbeddedService; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; -import org.junit.jupiter.api.extension.RegisterExtension; - -@DisabledOnOs(OS.AIX) -public class AtomEntryPollingConsumerWithBasicAuthTest extends AtomEntryPollingConsumerTest { - private static final int PORT = AvailablePortFinder.getNextAvailable(); - - @RegisterExtension - public JettyEmbeddedService service = new JettyEmbeddedService( - JettyConfigurationBuilder.bareTemplate() - .withPort(PORT) - .withServletConfiguration() - .addServletConfiguration(new JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration<>( - new MyHttpServlet(), - JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration.ROOT_PATH_SPEC)) - .addBasicAuthUser("camel", "camelPass", "Private!") - .build() - .build()); - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() { - from("atom:http://localhost:" + PORT - + "/?splitEntries=true&delay=500&username=camel&password=camelPass") - .to("mock:result1"); - - from("atom:http://localhost:" + PORT - + "/?splitEntries=true&filter=false&delay=500&username=camel&password=camelPass") - .to("mock:result2"); - } - }; - } -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithResumeTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithResumeTest.java deleted file mode 100644 index 4c810f8a65e..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntryPollingConsumerWithResumeTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.processor.resume.TransientResumeStrategy; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.DisplayName; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; - -/** - * Unit test for AtomEntryPollingConsumer - */ -@DisabledOnOs(OS.AIX) -public class AtomEntryPollingConsumerWithResumeTest extends CamelTestSupport { - - @DisplayName("Tests whether the component can consume with resume API enabled") - @Test - void testCanConsumeWithResume() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedMessageCount(4); - mock.assertIsSatisfied(); - } - - private Date getTestFilterDate() { - SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z"); - - try { - return df.parse("2007-11-13 14:35:00 +0100"); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - public void configure() { - from("atom:file:src/test/data/feed.atom?splitEntries=true&delay=500") - .resumable().resumeStrategy(new TransientResumeStrategy(new UpdatedDateFilter(getTestFilterDate()))) - .routeId("WithResume") - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java deleted file mode 100644 index 2673ec914ee..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomEntrySortTest.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import java.util.Date; - -import org.apache.abdera.model.Entry; -import org.apache.camel.Body; -import org.apache.camel.builder.ExpressionBuilder; -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.spi.Registry; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; - -@DisabledOnOs(OS.AIX) -public class AtomEntrySortTest extends CamelTestSupport { - - @Test - void testSortedEntries() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:sorted"); - mock.expectsAscending(ExpressionBuilder.beanExpression("myBean?method=getPubDate")); - mock.expectedMessageCount(10); - mock.setResultWaitTime(15000L); - mock.assertIsSatisfied(); - } - - @Test - void testUnSortedEntries() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:unsorted"); - mock.expectsAscending(ExpressionBuilder.beanExpression("myBean?method=getPubDate")); - mock.expectedMessageCount(10); - mock.setResultWaitTime(2000L); - mock.assertIsNotSatisfied(2000L); - } - - @Override - protected void bindToRegistry(Registry registry) { - registry.bind("myBean", new MyBean()); - } - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - public void configure() { - from("atom:file:src/test/data/unsortedfeed.atom?splitEntries=true&sortEntries=true&delay=50").to("mock:sorted"); - from("atom:file:src/test/data/unsortedfeed.atom?splitEntries=true&sortEntries=false&delay=50") - .to("mock:unsorted"); - } - }; - } - - public static class MyBean { - public Date getPubDate(@Body Object body) { - Entry syndEntry = (Entry) body; - return syndEntry.getUpdated(); - } - } -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java index 2bca43bc59e..a8267cc77f5 100644 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java +++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomGoodBlogsTest.java @@ -16,7 +16,7 @@ */ package org.apache.camel.component.atom; -import org.apache.abdera.model.Entry; +import com.apptasticsoftware.rssreader.Item; import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; @@ -114,8 +114,8 @@ public class AtomGoodBlogsTest { * Tests the blogs if its a good blog entry or not */ public boolean isGoodBlog(Exchange exchange) { - Entry entry = exchange.getIn().getBody(Entry.class); - String title = entry.getTitle(); + Item entry = exchange.getIn().getBody(Item.class); + String title = entry.getTitle().get(); // We like blogs about Camel return title.toLowerCase().contains("camel"); diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java index f58e5adaf8a..f98ae2bedbf 100644 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java +++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerTest.java @@ -18,7 +18,7 @@ package org.apache.camel.component.atom; import java.util.List; -import org.apache.abdera.model.Feed; +import com.apptasticsoftware.rssreader.Item; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.builder.RouteBuilder; @@ -48,10 +48,11 @@ public class AtomPollingConsumerTest extends CamelTestSupport { Message in = exchange.getIn(); assertNotNull(in); assertTrue(in.getBody() instanceof List); - assertTrue(in.getHeader(AtomConstants.ATOM_FEED) instanceof Feed); + assertTrue(in.getHeader(AtomConstants.ATOM_FEED) instanceof List); - Feed feed = in.getHeader(AtomConstants.ATOM_FEED, Feed.class); - assertEquals("James Strachan", feed.getAuthor().getName()); + List feed = in.getHeader(AtomConstants.ATOM_FEED, List.class); + Item item = (Item) feed.get(0); + assertEquals("James Strachan", item.getAuthor().get()); List<?> entries = in.getBody(List.class); assertEquals(7, entries.size()); diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java deleted file mode 100644 index 8f1d3abadf2..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomPollingConsumerWithBasicAuthTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.infra.jetty.services.JettyConfiguration; -import org.apache.camel.test.infra.jetty.services.JettyConfigurationBuilder; -import org.apache.camel.test.infra.jetty.services.JettyEmbeddedService; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; -import org.junit.jupiter.api.extension.RegisterExtension; - -@DisabledOnOs(OS.AIX) -public class AtomPollingConsumerWithBasicAuthTest extends AtomPollingConsumerTest { - private static final int PORT = AvailablePortFinder.getNextAvailable(); - - @RegisterExtension - public JettyEmbeddedService service = new JettyEmbeddedService( - JettyConfigurationBuilder.bareTemplate() - .withPort(PORT) - .withServletConfiguration() - .addServletConfiguration(new JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration<>( - new MyHttpServlet(), - JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration.ROOT_PATH_SPEC)) - .addBasicAuthUser("camel", "camelPass", "Private!") - .build() - .build()); - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() { - from("atom:http://localhost:" + PORT - + "/?splitEntries=false&username=camel&password=camelPass") - .to("mock:result"); - - // this is a bit weird syntax that normally is not using the feedUri parameter - from("atom:?feedUri=http://localhost:" + PORT - + "/&splitEntries=false&username=camel&password=camelPass") - .to("mock:result2"); - } - }; - } -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java deleted file mode 100644 index 9ffd4a75d6f..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomProducerTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import org.apache.camel.Endpoint; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; - -import static org.junit.jupiter.api.Assertions.assertThrows; - -/** - * Unit test for AtomProducer. - */ -@DisabledOnOs(OS.AIX) -public class AtomProducerTest extends CamelTestSupport { - - @Test - void testNotYetImplemented() { - Endpoint ep = context.getEndpoint("atom:file://target/out.atom"); - - assertThrows(UnsupportedOperationException.class, () -> ep.createProducer()); - } - -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomRouteTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomRouteTest.java index 0df1e92e5bf..164e3b3be27 100644 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomRouteTest.java +++ b/components/camel-atom/src/test/java/org/apache/camel/component/atom/AtomRouteTest.java @@ -18,7 +18,7 @@ package org.apache.camel.component.atom; import java.util.List; -import org.apache.abdera.model.Entry; +import com.apptasticsoftware.rssreader.Item; import org.apache.camel.Exchange; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; @@ -54,11 +54,11 @@ public class AtomRouteTest extends CamelTestSupport { "ActiveMQ webinar archive available" }; int counter = 0; for (Exchange exchange : list) { - Entry entry = exchange.getIn().getBody(Entry.class); + Item entry = exchange.getIn().getBody(Item.class); assertNotNull(entry, "No entry found for exchange: " + exchange); String expectedTitle = expectedTitles[counter]; - String title = entry.getTitle(); + String title = entry.getTitle().get(); assertEquals(expectedTitle, title, "Title of message " + counter); LOG.debug("<<<< {}", entry); diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/MyHttpServlet.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/MyHttpServlet.java deleted file mode 100644 index 26f5eea893c..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/MyHttpServlet.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.camel.component.atom; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.apache.commons.io.FileUtils; - -public class MyHttpServlet extends HttpServlet { - - private static final long serialVersionUID = 5594945031962091041L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { - resp.getWriter().write(FileUtils.readFileToString(new File("src/test/data/feed.atom"), - StandardCharsets.UTF_8)); - } -} diff --git a/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java b/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java deleted file mode 100644 index 00eeeb89494..00000000000 --- a/components/camel-atom/src/test/java/org/apache/camel/component/atom/UpdatedDateFilterTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.atom; - -import java.util.Calendar; -import java.util.List; -import java.util.TimeZone; - -import org.apache.abdera.model.Document; -import org.apache.abdera.model.Entry; -import org.apache.abdera.model.Feed; -import org.apache.camel.component.feed.EntryFilter; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.condition.DisabledOnOs; -import org.junit.jupiter.api.condition.OS; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; - -/** - * Unit test for UpdatedDateFilter - */ -@DisabledOnOs(OS.AIX) -public class UpdatedDateFilterTest { - - @Test - void testFilter() throws Exception { - Document<Feed> doc = AtomUtils.parseDocument("file:src/test/data/feed.atom"); - assertNotNull(doc); - - // timestamp from the feed to use as base - // 2007-11-13T13:35:25.014Z - Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT+1:00")); - cal.set(2007, Calendar.NOVEMBER, 13, 14, 35, 0); - EntryFilter filter = new UpdatedDateFilter(cal.getTime()); - - List<Entry> entries = doc.getRoot().getEntries(); - - // must reverse backwards - for (int i = entries.size() - 1; i > 0; i--) { - Entry entry = entries.get(i); - boolean valid = filter.isValidEntry(entry); - // only the 3 last should be true - if (i > 3) { - assertFalse(valid, "not valid"); - } else { - assertTrue(valid, "valid"); - } - } - } - -} diff --git a/components/camel-rss/pom.xml b/components/camel-rss/pom.xml index 236d3755ecc..0df5689fcd5 100644 --- a/components/camel-rss/pom.xml +++ b/components/camel-rss/pom.xml @@ -42,12 +42,6 @@ <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-atom</artifactId> - <exclusions> - <exclusion> - <groupId>org.apache.abdera</groupId> - <artifactId>abdera-extensions-main</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>com.rometools</groupId> diff --git a/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointConfigurer.java b/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointConfigurer.java index e874ec456a6..507a93fca3d 100644 --- a/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointConfigurer.java +++ b/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointConfigurer.java @@ -39,7 +39,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": target.setGreedy(property(camelContext, boolean.class, value)); return true; case "initialdelay": case "initialDelay": target.setInitialDelay(property(camelContext, long.class, value)); return true; - case "password": target.setPassword(property(camelContext, java.lang.String.class, value)); return true; case "pollstrategy": case "pollStrategy": target.setPollStrategy(property(camelContext, org.apache.camel.spi.PollingConsumerPollStrategy.class, value)); return true; case "repeatcount": @@ -65,7 +64,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": target.setTimeUnit(property(camelContext, java.util.concurrent.TimeUnit.class, value)); return true; case "usefixeddelay": case "useFixedDelay": target.setUseFixedDelay(property(camelContext, boolean.class, value)); return true; - case "username": target.setUsername(property(camelContext, java.lang.String.class, value)); return true; default: return false; } } @@ -91,7 +89,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": return boolean.class; case "initialdelay": case "initialDelay": return long.class; - case "password": return java.lang.String.class; case "pollstrategy": case "pollStrategy": return org.apache.camel.spi.PollingConsumerPollStrategy.class; case "repeatcount": @@ -117,7 +114,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": return java.util.concurrent.TimeUnit.class; case "usefixeddelay": case "useFixedDelay": return boolean.class; - case "username": return java.lang.String.class; default: return null; } } @@ -144,7 +140,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "greedy": return target.isGreedy(); case "initialdelay": case "initialDelay": return target.getInitialDelay(); - case "password": return target.getPassword(); case "pollstrategy": case "pollStrategy": return target.getPollStrategy(); case "repeatcount": @@ -170,7 +165,6 @@ public class RssEndpointConfigurer extends PropertyConfigurerSupport implements case "timeUnit": return target.getTimeUnit(); case "usefixeddelay": case "useFixedDelay": return target.isUseFixedDelay(); - case "username": return target.getUsername(); default: return null; } } diff --git a/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointUriFactory.java b/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointUriFactory.java index 97a95a66950..26d144e2ef9 100644 --- a/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointUriFactory.java +++ b/components/camel-rss/src/generated/java/org/apache/camel/component/rss/RssEndpointUriFactory.java @@ -21,7 +21,7 @@ public class RssEndpointUriFactory extends org.apache.camel.support.component.En private static final Set<String> SECRET_PROPERTY_NAMES; private static final Set<String> MULTI_VALUE_PREFIXES; static { - Set<String> props = new HashSet<>(26); + Set<String> props = new HashSet<>(24); props.add("backoffErrorThreshold"); props.add("backoffIdleThreshold"); props.add("backoffMultiplier"); @@ -33,7 +33,6 @@ public class RssEndpointUriFactory extends org.apache.camel.support.component.En props.add("feedUri"); props.add("greedy"); props.add("initialDelay"); - props.add("password"); props.add("pollStrategy"); props.add("repeatCount"); props.add("runLoggingLevel"); @@ -47,12 +46,8 @@ public class RssEndpointUriFactory extends org.apache.camel.support.component.En props.add("throttleEntries"); props.add("timeUnit"); props.add("useFixedDelay"); - props.add("username"); PROPERTY_NAMES = Collections.unmodifiableSet(props); - Set<String> secretProps = new HashSet<>(2); - secretProps.add("password"); - secretProps.add("username"); - SECRET_PROPERTY_NAMES = Collections.unmodifiableSet(secretProps); + SECRET_PROPERTY_NAMES = Collections.emptySet(); Set<String> prefixes = new HashSet<>(1); prefixes.add("scheduler."); MULTI_VALUE_PREFIXES = Collections.unmodifiableSet(prefixes); diff --git a/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json b/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json index 86738b8d9e4..85141b08b12 100644 --- a/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json +++ b/components/camel-rss/src/generated/resources/org/apache/camel/component/rss/rss.json @@ -52,8 +52,6 @@ "schedulerProperties": { "index": 20, "kind": "parameter", "displayName": "Scheduler Properties", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.Map<java.lang.String, java.lang.Object>", "prefix": "scheduler.", "multiValue": true, "deprecated": false, "autowired": false, "secret": false, "description": "To configure additional properties when using a custom scheduler or any of the Quartz, Spring based scheduler." }, "startScheduler": { "index": 21, "kind": "parameter", "displayName": "Start Scheduler", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Whether the scheduler should be auto started." }, "timeUnit": { "index": 22, "kind": "parameter", "displayName": "Time Unit", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "object", "javaType": "java.util.concurrent.TimeUnit", "enum": [ "NANOSECONDS", "MICROSECONDS", "MILLISECONDS", "SECONDS", "MINUTES", "HOURS", "DAYS" ], "deprecated": false, "autowired": false, "secret": false, "defaultValue": "MILLISECONDS", "description": "Time unit for initialDelay and delay options." }, - "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." }, - "password": { "index": 24, "kind": "parameter", "displayName": "Password", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the password to be used for basic authentication when polling from a HTTP feed.Notice: Basic authentication is not a secured method, and is not recommended to be used." }, - "username": { "index": 25, "kind": "parameter", "displayName": "Username", "group": "security", "label": "security", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": true, "autowired": false, "secret": true, "description": "Sets the username to be used for basic authentication when polling from a HTTP feed. Notice: Basic authentication is not a secured method, and is not recommended to be used." } + "useFixedDelay": { "index": 23, "kind": "parameter", "displayName": "Use Fixed Delay", "group": "scheduler", "label": "consumer,scheduler", "required": false, "type": "boolean", "javaType": "boolean", "deprecated": false, "autowired": false, "secret": false, "defaultValue": true, "description": "Controls if fixed delay or fixed rate is used. See ScheduledExecutorService in JDK for details." } } } diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEntryPollingConsumer.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEntryPollingConsumer.java index 854e318037b..19916834b67 100644 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEntryPollingConsumer.java +++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssEntryPollingConsumer.java @@ -19,7 +19,6 @@ package org.apache.camel.component.rss; import com.rometools.rome.feed.synd.SyndFeed; import org.apache.camel.Processor; import org.apache.camel.component.feed.FeedEntryPollingConsumer; -import org.apache.camel.util.ObjectHelper; /** * Consumer to poll RSS feeds and return each entry from the feed step by step. @@ -48,12 +47,7 @@ public class RssEntryPollingConsumer extends FeedEntryPollingConsumer { @Override protected Object createFeed() throws Exception { - if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) { - return RssUtils.createFeed(endpoint.getFeedUri(), RssEntryPollingConsumer.class.getClassLoader()); - } else { - return RssUtils.createFeed(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword(), - RssEntryPollingConsumer.class.getClassLoader()); - } + return RssUtils.createFeed(endpoint.getFeedUri(), RssEntryPollingConsumer.class.getClassLoader()); } @Override diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssPollingConsumer.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssPollingConsumer.java index eb335dbf606..fe436f662f1 100644 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssPollingConsumer.java +++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssPollingConsumer.java @@ -18,7 +18,6 @@ package org.apache.camel.component.rss; import org.apache.camel.Processor; import org.apache.camel.component.feed.FeedPollingConsumer; -import org.apache.camel.util.ObjectHelper; /** * Consumer to poll RSS feeds and return the full feed. @@ -31,11 +30,7 @@ public class RssPollingConsumer extends FeedPollingConsumer { @Override protected Object createFeed() throws Exception { - if (ObjectHelper.isEmpty(endpoint.getUsername()) || ObjectHelper.isEmpty(endpoint.getPassword())) { - return RssUtils.createFeed(endpoint.getFeedUri()); - } else { - return RssUtils.createFeed(endpoint.getFeedUri(), endpoint.getUsername(), endpoint.getPassword()); - } + return RssUtils.createFeed(endpoint.getFeedUri()); } } diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssUtils.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssUtils.java index 06851e86927..aa5d5f5c00d 100644 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssUtils.java +++ b/components/camel-rss/src/main/java/org/apache/camel/component/rss/RssUtils.java @@ -17,14 +17,12 @@ package org.apache.camel.component.rss; import java.io.IOException; -import java.net.HttpURLConnection; import java.net.URL; import com.rometools.rome.feed.synd.SyndFeed; import com.rometools.rome.io.FeedException; import com.rometools.rome.io.SyndFeedInput; import com.rometools.rome.io.XmlReader; -import org.apache.commons.codec.binary.Base64; public final class RssUtils { @@ -53,31 +51,4 @@ public final class RssUtils { } } - public static SyndFeed createFeed(String feedUri, String username, String password) throws Exception { - return createFeed(feedUri, username, password, Thread.currentThread().getContextClassLoader()); - } - - public static SyndFeed createFeed(String feedUri, String username, String password, ClassLoader classLoader) - throws Exception { - ClassLoader tccl = Thread.currentThread().getContextClassLoader(); - try { - Thread.currentThread().setContextClassLoader(classLoader); - URL feedUrl = new URL(feedUri); - HttpURLConnection httpcon = (HttpURLConnection) feedUrl.openConnection(); - String encoding = Base64.encodeBase64String(username.concat(":").concat(password).getBytes()); - httpcon.setRequestProperty("Authorization", "Basic " + encoding); - - return createSyndFeed(httpcon); - } finally { - Thread.currentThread().setContextClassLoader(tccl); - } - } - - private static SyndFeed createSyndFeed(HttpURLConnection connection) throws IOException, FeedException { - try (XmlReader reader = new XmlReader(connection)) { - SyndFeedInput input = new SyndFeedInput(); - return input.build(reader); - } - } - } diff --git a/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java b/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java deleted file mode 100644 index 22dde13dc98..00000000000 --- a/components/camel-rss/src/main/java/org/apache/camel/component/rss/UpdatedDateFilter.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rss; - -import java.util.Date; -import java.util.Map; - -import com.rometools.rome.feed.synd.SyndEntry; -import org.apache.camel.component.feed.EntryFilter; -import org.apache.camel.support.LRUCacheFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Filters out all entries which occur before the last time of the entry we saw (assuming entries arrive sorted in - * order). - */ -public class UpdatedDateFilter implements EntryFilter<SyndEntry> { - - private static final Logger LOG = LoggerFactory.getLogger(UpdatedDateFilter.class); - private Date lastUpdate; - // use a LRU so we only keep the last 1000 elements to avoid growing to large - @SuppressWarnings("unchecked") - private Map<Integer, Integer> entriesForLastUpdate = LRUCacheFactory.newLRUCache(1000); - - public UpdatedDateFilter() { - } - - public UpdatedDateFilter(Date lastUpdate) { - this.lastUpdate = lastUpdate; - } - - public Date getLastUpdate() { - return lastUpdate; - } - - @Override - public boolean isValidEntry(SyndEntry entry) { - Date updated = entry.getUpdatedDate(); - if (updated == null) { - // never been updated so get published date - updated = entry.getPublishedDate(); - } - if (updated == null) { - LOG.debug("No updated time for entry so assuming its valid: entry=[{}]", entry); - return true; - } - if (lastUpdate != null) { - if (lastUpdate.after(updated)) { - LOG.debug("Entry is older than last update=[{}], no valid entry=[{}]", lastUpdate, entry); - return false; - } else { - Integer hash = entry.hashCode(); - if (lastUpdate.equals(updated)) { - if (entriesForLastUpdate.containsKey(hash)) { - LOG.debug("Already processed entry=[{}]", entry); - return false; - } - } else { - entriesForLastUpdate.clear(); - } - entriesForLastUpdate.put(hash, hash); - } - } - lastUpdate = updated; - return true; - } -} diff --git a/components/camel-rss/src/test/java/org/apache/camel/component/rss/MyHttpServlet.java b/components/camel-rss/src/test/java/org/apache/camel/component/rss/MyHttpServlet.java deleted file mode 100644 index 2577707a84a..00000000000 --- a/components/camel-rss/src/test/java/org/apache/camel/component/rss/MyHttpServlet.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.camel.component.rss; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.apache.commons.io.FileUtils; - -public class MyHttpServlet extends HttpServlet { - - private static final long serialVersionUID = 5594945031962091041L; - - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { - resp.getWriter().write(FileUtils.readFileToString(new File("src/test/data/rss20.xml"), StandardCharsets.UTF_8)); - } -} diff --git a/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssEntryPollingConsumerWithBasicAuthTest.java b/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssEntryPollingConsumerWithBasicAuthTest.java deleted file mode 100644 index b2b8d4f2dcc..00000000000 --- a/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssEntryPollingConsumerWithBasicAuthTest.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rss; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.infra.jetty.services.JettyConfiguration; -import org.apache.camel.test.infra.jetty.services.JettyConfigurationBuilder; -import org.apache.camel.test.infra.jetty.services.JettyEmbeddedService; -import org.apache.camel.test.junit5.CamelTestSupport; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.extension.RegisterExtension; - -public class RssEntryPollingConsumerWithBasicAuthTest extends CamelTestSupport { - - private static final int PORT = AvailablePortFinder.getNextAvailable(); - - @RegisterExtension - public JettyEmbeddedService service = new JettyEmbeddedService( - JettyConfigurationBuilder.bareTemplate() - .withPort(PORT) - .withServletConfiguration() - .addServletConfiguration(new JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration<>( - new MyHttpServlet(), - JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration.ROOT_PATH_SPEC)) - .addBasicAuthUser("camel", "camelPass", "Private!") - .build() - .build()); - - @Test - public void testListOfEntriesIsSplitIntoPieces() throws Exception { - MockEndpoint mock = getMockEndpoint("mock:result"); - mock.expectedMessageCount(10); - mock.assertIsSatisfied(); - } - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() { - fromF("rss:http://localhost:%d/?splitEntries=true&sortEntries=true&delay=100&username=camel&password=camelPass", - PORT) - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssPollingConsumerWithBasicAuthTest.java b/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssPollingConsumerWithBasicAuthTest.java deleted file mode 100644 index 5e022381422..00000000000 --- a/components/camel-rss/src/test/java/org/apache/camel/component/rss/RssPollingConsumerWithBasicAuthTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rss; - -import org.apache.camel.builder.RouteBuilder; -import org.apache.camel.test.AvailablePortFinder; -import org.apache.camel.test.infra.jetty.services.JettyConfiguration; -import org.apache.camel.test.infra.jetty.services.JettyConfigurationBuilder; -import org.apache.camel.test.infra.jetty.services.JettyEmbeddedService; -import org.junit.jupiter.api.extension.RegisterExtension; - -public class RssPollingConsumerWithBasicAuthTest extends RssPollingConsumerTest { - - private static final int PORT = AvailablePortFinder.getNextAvailable(); - - @RegisterExtension - public JettyEmbeddedService service = new JettyEmbeddedService( - JettyConfigurationBuilder.bareTemplate() - .withPort(PORT) - .withServletConfiguration() - .addServletConfiguration(new JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration<>( - new MyHttpServlet(), - JettyConfiguration.ServletHandlerConfiguration.ServletConfiguration.ROOT_PATH_SPEC)) - .addBasicAuthUser("camel", "camelPass", "Private!") - .build() - .build()); - - @Override - protected RouteBuilder createRouteBuilder() { - return new RouteBuilder() { - @Override - public void configure() { - fromF("rss:http://localhost:%d/?splitEntries=false&username=camel&password=camelPass", PORT) - .to("mock:result"); - } - }; - } -} diff --git a/components/camel-rss/src/test/java/org/apache/camel/component/rss/UpdatedDateFilterTest.java b/components/camel-rss/src/test/java/org/apache/camel/component/rss/UpdatedDateFilterTest.java deleted file mode 100644 index 23f1123b662..00000000000 --- a/components/camel-rss/src/test/java/org/apache/camel/component/rss/UpdatedDateFilterTest.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.camel.component.rss; - -import java.util.Date; - -import com.rometools.rome.feed.synd.SyndEntry; -import com.rometools.rome.feed.synd.SyndEntryImpl; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; - -public class UpdatedDateFilterTest { - - private UpdatedDateFilter fixture; - private Date now; - - @BeforeEach - public void setup() { - now = new Date(); - fixture = new UpdatedDateFilter(now); - } - - @Test - public void testFilter() { - SyndEntry entry = new SyndEntryImpl(); - entry.setPublishedDate(now); - entry.setAuthor("ANDY"); - assertTrue(fixture.isValidEntry(entry)); - - entry = new SyndEntryImpl(); - entry.setPublishedDate(now); - entry.setAuthor("ANDY"); - assertFalse(fixture.isValidEntry(entry)); - - entry = new SyndEntryImpl(); - entry.setPublishedDate(now); - entry.setAuthor("FRED"); - assertTrue(fixture.isValidEntry(entry)); - } - -} diff --git a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java index 906abebd071..d33d55f0f73 100644 --- a/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java +++ b/dsl/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/ArangoDbEndpointBuilderFactory.java @@ -277,6 +277,36 @@ public interface ArangoDbEndpointBuilderFactory { doSetProperty("lazyStartProducer", lazyStartProducer); return this; } + /** + * To use an existing ArangDB client. + * + * The option is a: <code>com.arangodb.ArangoDB</code> type. + * + * Group: advanced + * + * @param arangoDB the value to set + * @return the dsl builder + */ + default AdvancedArangoDbEndpointBuilder arangoDB( + com.arangodb.ArangoDB arangoDB) { + doSetProperty("arangoDB", arangoDB); + return this; + } + /** + * To use an existing ArangDB client. + * + * The option will be converted to a + * <code>com.arangodb.ArangoDB</code> type. + * + * Group: advanced + * + * @param arangoDB the value to set + * @return the dsl builder + */ + default AdvancedArangoDbEndpointBuilder arangoDB(String arangoDB) { + doSetProperty("arangoDB", arangoDB); + return this; + } } public interface ArangoDbBuilders { diff --git a/parent/pom.xml b/parent/pom.xml index 558fe5a0c3a..ce6e4fd75e2 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -49,7 +49,6 @@ <sourcecheckExcludesComma></sourcecheckExcludesComma> <!-- dependency versions --> - <abdera-version>1.1.3</abdera-version> <activemq-version>5.18.2</activemq-version> <!-- Artemis upgrade blocked by CAMEL-19561 --> <activemq-artemis-version>2.28.0</activemq-artemis-version> @@ -73,7 +72,6 @@ <awaitility-version>4.2.0</awaitility-version> <aws-java-sdk2-version>2.20.103</aws-java-sdk2-version> <aws-xray-version>2.14.0</aws-xray-version> - <axiom-version>1.2.14</axiom-version> <azure-sdk-bom-version>1.2.14</azure-sdk-bom-version> <azure-storage-blob-changefeed-version>12.0.0-beta.18</azure-storage-blob-changefeed-version> <bouncycastle-version>1.75</bouncycastle-version> @@ -419,6 +417,7 @@ <robotframework-version>4.1.2</robotframework-version> <rocketmq-version>4.9.7</rocketmq-version> <rome-version>2.1.0</rome-version> + <rssreader-version>3.4.5</rssreader-version> <rxjava2-version>2.2.21</rxjava2-version> <saxon-version>12.3</saxon-version> <scala-datasonnet-version>2.13.11</scala-datasonnet-version>