Croway commented on PR #25843:
URL: https://github.com/apache/camel/pull/25843#issuecomment-5451521572
Hi @marcinwieckowski, thanks for working on this. The implementation looks
good to me.
Could you also add focused tests for XQuery and XML Tokenize? For example,
in their respective modules:
```java
@Test
void testXQueryNamespacesRef() {
context.getRegistry().bind(
"namespaces", new Namespaces("c", "urn:cheese"));
XQueryExpression definition =
new XQueryExpression("/c:person[@name='James']");
definition.setNamespacesRef("namespaces");
Predicate predicate = definition.createPredicate(context);
Exchange exchange = new DefaultExchange(context);
exchange.getMessage().setBody(
"<person xmlns='urn:cheese' name='James'/>");
assertTrue(predicate.matches(exchange));
}
@Test
void testXTokenizeNamespacesRef() {
context.getRegistry().bind(
"namespaces", new Namespaces("c", "urn:orders"));
XMLTokenizerExpression definition =
new XMLTokenizerExpression("//c:order");
definition.setNamespacesRef("namespaces");
Expression expression = definition.createExpression(context);
Exchange exchange = new DefaultExchange(context);
exchange.getMessage().setBody(
"<root xmlns:c='urn:orders'><c:order>one</c:order></root>");
Object result = expression.evaluate(exchange, Object.class);
Iterator<?> iterator = assertInstanceOf(Iterator.class, result);
assertTrue(iterator.hasNext());
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]