...
Method | Description |
---|---|
mockEndpoints | Is used to easily mock all endpoints. See more details and examples at Mock. |
mockEndpoints(pattern) | Is used to easily mock endpoints using a pattern. See more details and examples at Mock. See below for pattern matching. |
adviceById weaveById(pattern) | Is used to select node(s) matching by id's, and weave in the following nodes. See below for pattern matching and examples. |
adviceByToString weaveByToString(pattern) | Is used to select nodes(s) matching by their |
The pattern
option is used for matching. It uses the same rules as the Intercept, which is applied in the following order:
...
For example to match exact you can use adviceByweaveById("foo")
which will match only the id in the route which has the value "foo"
.
The wildcard is when the pattern ends with a * char, such as: adviceByweaveById("foo*")
which will match any id's starting with "foo"
, such as foo, foobar, foobie
and so forth.
The regular expression is more advanced and allows you to match multiple ids, such as adviceByweaveById("(foo|bar)")
which will match both "foo"
and "bar"
.
Using
...
weaveById
The adviceById
weaveById
allows you to manipulate the rote, for example by replacing a node with other nodes. The following methods is available:
...
In the example above, we add the following nodes to("mock:a").transform(constant("Bye World"))
after the node with the id "bar"
.
Using
...
weaveByToString
The adviceByToString
weaceByToString
also allows you to manipulate the rote, for example by replacing a node with other nodes. As opposed to adviceById
weaveById
, this method uses the toString
representation of the node(s) when matching. This allows you to match nodes, which may not have assigned ids, or to match EIP pattern.
You have to be a bit more careful when using this as the toString
representation can be verbose and contain characters such as [ ] ( ) -> and so forth. That is why using the regular expression matching is the must useable.
The adviceByToString
weaveByToString
has the same methods as adviceById
weaceById
.
For example to replace any nodes which has "foo"
you can do
...