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

[Major] allow to load mocks on non-rpi systems #373

Merged
merged 3 commits into from
Aug 27, 2024

Conversation

eitch
Copy link
Member

@eitch eitch commented Aug 5, 2024

This removes the

    Pi4J.newAutoContextAllowMocks()

function, as we now detect these systems using:

    BoardInfoHelper.runningOnRaspberryPi()

This is a breaking API change, but should satisfy people having to write special code to load the mock in tests, as this happens automatically now.

If a mock is to be loaded on the Raspberry Pi, then one can still do this using the following code:

    Pi4J.newContextBuilder().autoDetectMockPlugins().build();

The shutdown hook is hooked into the JVM and is executed when the JVM stops.

This can be beneficial when the application is not managing pi4j's life cycle, but when an application wants to properly manage the life cycle, then this can be detrimental to the shutdown sequence of the application.

This change allows such an application to disable this feature.

The shutdown hook is still enabled by default, a future version might decide to disable it by default.
This removes the

    Pi4J.newAutoContextAllowMocks()

function, as we now detect these systems using:

    BoardInfoHelper.runningOnRaspberryPi()

This is a breaking API change, but should satisfy people having to write special code to load the mock in tests, as this happens automatically now.

If a mock is to be loaded on the Raspberry Pi, then one can still do this using the following code:

    Pi4J.newContextBuilder().autoDetectMockPlugins().build();
@eitch eitch requested a review from FDelporte August 5, 2024 06:40
@eitch eitch self-assigned this Aug 5, 2024
@eitch eitch added the enhancement New feature or request label Aug 5, 2024
Copy link
Member

@FDelporte FDelporte left a comment

Choose a reason for hiding this comment

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

Looks good!

@eitch eitch merged commit 8b886b2 into develop Aug 27, 2024
1 check passed
@eitch eitch deleted the feature/auto-detect-mocks-on-non-rpi branch August 27, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants