New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CAMEL-18262 - Fixing the Template issue #7995
Conversation
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
🚫 There are (likely) no components to be tested in this PR |
@rhuan080 Thx for the PR, just one remark, as you have a clear reproducer, would you mind adding a test to ensure that the problem is fixed and will not occur anymore? |
Hi @essobedo the camel-model-core does not have a unit test. I have seen the tests are applied to components. Thus, I had doubts about providing unit tests here. |
@rhuan080 can you add a unit test at https://github.com/apache/camel/tree/main/core/camel-core/src/test/java/org/apache/camel/model |
Sure! I`ll send a commit soon. |
Thanks @rhuan080 and that could be great! |
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thx for the unit test. Just to be sure, What happens when you remove your changes, does the test fail as expected?
final String testMsg = "{ test msg }"; | ||
|
||
mockEndpoint.expectedMessageCount(0); | ||
//mockEndpoint.expectedBodiesReceived(testMsg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this can be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
There are some checkstyle errors to fix:
|
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
Done! |
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
1 similar comment
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
The stylecheck failure is related to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR doesn't really fix the bug, please don't merge
The test case doesn't really prove that the bug is fixed. Here is a good test case with normal route and route template:
You will see that the test with the route template fails and the other passes. After a quick investigation, the main additional problem seems to be the fact that the route is not prepared when registering it. |
Hi @essobedo, Actually, the tests work with the new code and doesn`t work with the old code. I think we have two problems here, the code update I have done is correct. However, the test works because it is calling the Advice.adviceWith. This code is passing on tests
|
I believe that it works with the |
In other words, if you compare how a normal route and a templated route are initialized, you should see that in case of a templated route, this method is never called https://github.com/apache/camel/blob/main/core/camel-core-model/src/main/java/org/apache/camel/model/RoutesDefinition.java#L233 |
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
Hi @essobedo, I have used your unit test code! Thank you for helping me with this! I sent another commit fixing the template that does not prepare the RouteDefinition. Please, look at this and tell me what you think. The first commit is right, however, it really don't solves the issue totally. Now it is solving. |
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are very close, one small comment
@@ -96,6 +97,7 @@ public class DefaultModel implements Model { | |||
private final Map<String, Resilience4jConfigurationDefinition> resilience4jConfigurations = new ConcurrentHashMap<>(); | |||
private final Map<String, FaultToleranceConfigurationDefinition> faultToleranceConfigurations = new ConcurrentHashMap<>(); | |||
private Function<RouteDefinition, Boolean> routeFilter; | |||
private RoutesDefinition routeCollection = new RoutesDefinition(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not meant to be shared, I rather prefer that you create a new instance at each call instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thx!
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
2 similar comments
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
There are too many components to be tested in this PR, components were removed or the code needs a rebase: (303 likely to be tested) |
Thanks for the PR - I would like to prepare the route before adding |
* CAMEL-18262 - Fixing the Template issue Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Adding unit test Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Removing comments. Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Fixing the format issue. Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Fixing the template routeDefinition prepare Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Fixing the format issue. Signed-off-by: Rhuan Rocha <rhuan080@gmail.com> * CAMEL-18262 - Creating one RoutesDefinition per call Signed-off-by: Rhuan Rocha <rhuan080@gmail.com>
Signed-off-by: Rhuan Rocha rhuan080@gmail.com
[CAMEL-XXX] Fixes bug in camel-file component
, where you replaceCAMEL-XXX
with the appropriate JIRA issue.mvn clean install -Psourcecheck
in your module with source check enabled to make sure basic checks pass and there are no checkstyle violations. A more thorough check will be performed on your pull request automatically.Below are the contribution guidelines:
https://github.com/apache/camel/blob/main/CONTRIBUTING.md