Skip to content
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

RFC (Camel 4.10) CAMEL-21080: removing legacy methods #15830

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

orpiske
Copy link
Contributor

@orpiske orpiske commented Oct 3, 2024

This is a preview of the changes for the CamelTestSupport class to remove the deprecated methods. It changes the class to use the configuration builders (for the test and the context).

To help with the migration, it introduces 3 new interfaces:

  • LegacyBuiltinAssertions
  • LegacyDebug
  • LegacyTestSupport

The idea is that users that want to continue using the deprecated methods can implement those interfaces and avoid changing much of their code (apart from: 1. adjusting the visibility of the methods and 2. adding the interfaces to their test classes).

Alternatively, for users that want to perform a complete migration away from the deprecated methods, they can use the configureTest and configureContext methods (introduced on Camel 4.9) to do the test and camel context configuration.

As this is for 4.10, and the purpose is to gather feedback, the documentation is not yet available but it should look more or less like this:

_You only need to migrate from the old API to the new API, if you are customizing the test or the camel context and/or if you have been using any of the deprecated methods. In such case, you have to modify the code to implement the configureTest and/or configureContext methods and migrate from the deprecated methods. The table below lists the methods that need to be migrated. _

Old method New method
isUseRouteBuilder testConfiguration().withUseRouteBuilder()
isDumpRouteCoverage testConfiguration().withDumpRouteCoverage()
isUseDebugger camelContextConfiguration().withBreakpoint()

(... all other methods)

If you wish to continue using the old API methods, the code comes with 3 interfaces to help you:

  • LegacyBuiltinAssertions
  • LegacyDebug
  • LegacyTestSupport

These interfaces retain the old methods and come with pre-configured configureTest andconfigureContext methods that mimic the legacy behavior. In such case, you only need to adjust the visibility of the methods in your test classes.

Obs.: I am leaving on PTO for several days, so I may take a while to reply.

Copy link
Contributor

github-actions bot commented Oct 3, 2024

🌟 Thank you for your contribution to the Apache Camel project! 🌟

🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run

  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot.

  • You can label PRs using build-all, build-dependents, skip-tests and test-dependents to fine-tune the checks executed by this PR.

  • Build and test logs are available in the Summary page. Only Apache Camel committers have access to the summary.

  • ⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

Copy link
Contributor

@squakez squakez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we can have a deprecation notice time and make the legacy coexists while the new methods are working. In this way we guarantee backward compatibility and warn the user to move their test to the new method.

@orpiske
Copy link
Contributor Author

orpiske commented Oct 8, 2024

I wonder if we can have a deprecation notice time and make the legacy coexists while the new methods are working. In this way we guarantee backward compatibility and warn the user to move their test to the new method.

Unfortunately the @deprecated doesn't have a field to add that, but maybe we could include the forRemoval=true on the @deprecated annotations we currently have on CamelTestSupport.

@orpiske
Copy link
Contributor Author

orpiske commented Oct 8, 2024

I've also been reflecting a bit on this and I'm starting to think that 4.10 is way too short of a notice for users. We are currently reaching a maturity level on 4.x where many users will be looking more seriously to migrate.

It may not be a good idea to drop such another task on top of the other things they have to validate when moving from 2.x and 3.x all the way to 4.x. We always intended 4.x to be as close as a drop-in replacement as possible, so I am a bit conflicted here.

- rework assertions

- rework replaceRoute

- rework isUseDebugger

- rework useOverridePropertiesWithPropertiesComponent

CAMEL-21080: rework use override properties pattern

CAMEL-21080: rework include/exclude pattern
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants