Skip to content

NIAD-3453: Refactor StorageService to correctly use DI/IOC#1262

Merged
MartinWheelerMT merged 8 commits into
mainfrom
niad-3453-refactor-storage-service
May 6, 2026
Merged

NIAD-3453: Refactor StorageService to correctly use DI/IOC#1262
MartinWheelerMT merged 8 commits into
mainfrom
niad-3453-refactor-storage-service

Conversation

@MartinWheelerMT
Copy link
Copy Markdown
Collaborator

What

  • Delete StorageServiceFactory.java and StorageServiceFactoryConfig.java as unnecessary and confusing steps in the DI process.
  • Introduce StorageServiceConfig to conditionally create the required service.
  • Refactor AzureStorageService to now correctly inject the StorageServiceClient from the IOC container.
  • Add Integration Test sfor AzureStorageService.
  • Add testcontainers to build.gradle to enable use of Azurite.

Why

DI was incorrectly set up and abstracted multiple times, causing the storage service to be manually created rather than correctly injected. This was refactored so that the bean is now correctly using IOC.
Since its creation the AzureStorageService class has not had any test coverage, and it's in our best interest to add this.

Type of change

  • Internal change (non-breaking change with no effect on the functionality affecting end users)

Checklist:

  • I have performed a self-review of my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

* Delete StorageServiceFactory.java and StorageServiceFactoryConfig.java as unnecessary and confusing steps in the DI process.
* Introduce StorageServiceConfig to conditionally create the required service.
* Refactor AzureStorageService to now correctly inject the StorageServiceClient from the IOC container.
* Add `testcontainers` to `build.gradle` to enable use of azurite.
@MartinWheelerMT MartinWheelerMT requested a review from a team as a code owner May 6, 2026 15:42
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Images built and published to ECR using a Build Id of PR-1031-4970435

… a null value will not be returned.

* Add unit tests for `StorageServiceConfig`
* Add default coding for for the byte conversion in the tests.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

  • Surviving mutants in this change: 2
  • Killed mutants in this change: 4
class surviving killed
🧟uk.nhs.adaptors.pss.translator.storage.StorageServiceConfig 2 4

See https://pitest.org

Copy link
Copy Markdown
Contributor

@chiaramapellimt chiaramapellimt left a comment

Choose a reason for hiding this comment

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

LGTM

@MartinWheelerMT MartinWheelerMT merged commit 65db528 into main May 6, 2026
19 checks passed
@MartinWheelerMT MartinWheelerMT deleted the niad-3453-refactor-storage-service branch May 6, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants