Claus Ibsen created CAMEL-27964:
-----------------------------------
Summary: camel-wordpress: criteria options never reach the search,
force delete of a post sends no query, consumer endpoint has no scheduler
options
Key: CAMEL-27964
URL: https://issues.apache.org/jira/browse/CAMEL-27964
Project: Camel
Issue Type: Bug
Components: camel-wordpress
Reporter: Claus Ibsen
Fix For: 4.25.0
Found while improving the option descriptions of camel-wordpress for
CAMEL-23832 (pull request https://github.com/apache/camel/pull/31198).
These are separate problems of the component; the descriptions change only
documents the current behavior.
h4. 1. criteria.* options never reach the search criteria
{{WordpressEndpoint.configureProperties}} reads the criteria with
PropertiesHelper.extractProperties(options, "criteria."), but the generated
configurer has already moved criteria.* into the criteria map and removed them
from the options, so the consumer searches with a blank PostSearchCriteria or
UserSearchCriteria. Checked with a scratch test:
wordpress:post?url=...&criteria.search=test&criteria.perPage=10&criteria.categories=camel,dozer,json
gave a filled criteria map but search, perPage and categories null in
searchCriteria. WordpressComponentTest only checks the map. The same method
splits list values with e.toString() on the Map.Entry ("key=a,b"), so a list
becomes ["key=a","b"].
Proposed change: build the SearchCriteria from configuration.getCriteria() and
split e.getValue().toString().
h4. 2. force=true on post delete calls a wrong path
{{PostsSPI.forceDelete}} has the path
"/v{apiVersion}/posts/{postId}?force=true", and CXF encodes the "?": a local
HTTP server received DELETE /wp-json/wp/v2/posts/9%3Fforce=true with no query
string.
Proposed change: use @QueryParam("force") as UsersSPI.delete does.
h4. 3. delete without an id creates an entity
{{AbstractWordpressProducer.process}} calls processInsert when the id is null,
so wordpress:post:delete or user:delete without an id creates an entity from
the body instead of failing.
Proposed change: fail when operationDetail is delete and id is null.
h4. 4. The consumer endpoint has no scheduler options
{{AbstractWordpressConsumer}} is a ScheduledPollConsumer, but WordpressEndpoint
extends DefaultEndpoint, so the scheduler options are not in the catalog and
not accepted on the URI. It polls with the defaults (every 500 ms) and sends
the same posts or users again on every poll.
Proposed change: extend ScheduledPollEndpoint.
h4. 5. Smaller issues
WordpressServiceUsersAdapter.doForceDelete always sends reassign=1, so the
posts of a deleted user always go to user 1, with no option. The error message
of WordpressServiceProvider.doInit gives the example URL
http://myblog.com/wp-json/wp, which would produce .../wp-json/wp/wp/v2 (the
base is http://myblog.com/wp-json/). criteria and searchCriteria are in the
common group but only the consumer uses them; force and operationDetail are
only used by the producer. The doc page example with criteria.* does not work
because of item 1.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)