[midPoint-git] [Evolveum/midpoint] 33405b: Remove method intended for testing only
Andrej
noreply at github.com
Fri Oct 3 10:37:28 CEST 2025
Branch: refs/heads/improvement/10888-wiring
Home: https://github.com/Evolveum/midpoint
Commit: 33405b41b01d36bfb260e8244102c079db67534c
https://github.com/Evolveum/midpoint/commit/33405b41b01d36bfb260e8244102c079db67534c
Author: Andrej Zan <andrej.zan at evolveum.com>
Date: 2025-10-03 (Fri, 03 Oct 2025)
Changed paths:
M model/model-intest/pom.xml
M model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/smart/TestSmartIntegrationService.java
M model/model-intest/src/test/java/com/evolveum/midpoint/model/intest/smart/TestSmartIntegrationServiceStory.java
A model/smart-api/src/main/java/com/evolveum/midpoint/smart/api/ServiceClientFactory.java
M model/smart-api/src/main/java/com/evolveum/midpoint/smart/api/SmartIntegrationService.java
A model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/ConfigBasedServiceClientFactory.java
M model/smart-impl/src/main/java/com/evolveum/midpoint/smart/impl/SmartIntegrationServiceImpl.java
M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/AbstractSmartIntegrationTest.java
M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestCorrelatorSuggestions.java
A model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestServiceClientFactory.java
M model/smart-impl/src/test/java/com/evolveum/midpoint/smart/impl/TestSmartIntegrationServiceImpl.java
Log Message:
-----------
Remove method intended for testing only
**What**
Remove method from `SmartIntegrationServiceImpl`, which was intended
just for use in test to override (mock) service client.
**Why**
The way how the service clients were initialized had several flaws:
- Requires extra dependency unrelated to the function of
the service itself (`SystemObjectCache`).
- Makes it hard to test the service, because the service client
inherently needs to be mocked (because the service the client calls is
an external entity). This was the reason for a "workaround" using the
mentioned method and class field.
- Because the extra method was not declared in the interface (rightfully
so), the test classes had to use the implementation instead of the
interface (in some cases relevant, but in the most not).
- Makes it impossible to use different implementations of service client
creation if necessary.
- Does not leverage the benefits of our Spring ecosystem (mainly the
application context), which can simply hold an instance of service
client factory, which may be injected where necessary.
This refactoring will also allow to potentially move the
`ServiceClientFactory` to other places where it is relevant (e.g. to
particular `*Operation` factories - not implemented yet) and thus
completely remove another dependency from the service.
To unsubscribe from these emails, change your notification settings at https://github.com/Evolveum/midpoint/settings/notifications
More information about the midPoint-svn
mailing list