Skip to content

Refactor AzureStorageService to inject BlobContainerClient instead of BlobClient#1263

Merged
MartinWheelerMT merged 1 commit into
mainfrom
refactor-storage-services
May 8, 2026
Merged

Refactor AzureStorageService to inject BlobContainerClient instead of BlobClient#1263
MartinWheelerMT merged 1 commit into
mainfrom
refactor-storage-services

Conversation

@MartinWheelerMT
Copy link
Copy Markdown
Collaborator

@MartinWheelerMT MartinWheelerMT commented May 7, 2026

What

  • Move SpotBug suppression warning to the exclude file, for consistency when suppressing the warning for thread safe immutable cloud dependencies.
  • Refactor AzureStorageService and dependent tests to now inject the container client service, reducing the need to create a new one each time a work function is called against the service.

Why

The adaptor only ever accesses a single blob container with the name as provided in the configuration. At present the adaptor injects a BlobClient and creates a new BlobContainerClient each time an operation is performed against that container. That is inefficient and wasteful of resources.

This fix corrects that by injecting the BlobContainerClient instead.

This also moves the SpotBugs suppression warnings to the SpotBugs Exclusion File to ensure consistency and remove code bloat.

Type of change

Please delete options that are not relevant.

  • 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

…cy when suppressing the warning for thread safe immutable cloud dependencies.

* Refactor `AzureStorageService` and dependent tests to now inject the container client service, reducing the need to create a new one each time a work function is called against the service.
@MartinWheelerMT MartinWheelerMT requested a review from a team as a code owner May 7, 2026 16:20
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Looks good. All 4 mutations in this change were killed.

class surviving killed
💯uk.nhs.adaptors.pss.translator.storage.AzureStorageService 0 3
💯uk.nhs.adaptors.pss.translator.storage.StorageServiceConfig 0 1

See https://pitest.org

@MartinWheelerMT MartinWheelerMT enabled auto-merge (squash) May 7, 2026 16:28
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Images built and published to ECR using a Build Id of PR-1033-7656cfb

@MartinWheelerMT MartinWheelerMT merged commit 4a90dc8 into main May 8, 2026
19 checks passed
@MartinWheelerMT MartinWheelerMT deleted the refactor-storage-services branch May 8, 2026 14:44
chiaramapellimt pushed a commit that referenced this pull request May 13, 2026
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Delete StorageServiceFactory.java and StorageServiceFactoryConfig.java as unnecessary and confusing steps in the DI process.
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Introduce StorageServiceConfig to conditionally create the required service.
* Refactor AzureStorageService to now correctly inject the StorageServiceClient from the IOC container.
* Add Integration Test dfor AzureStorageService.
* Add `testcontainers` to `build.gradle` to enable use of azurite.
* Remove now unused methods in `AzureStorageService`.
* Add unit tests for `AzureStorageService`
* Add annotations to `StorageServiceConfig` to tell the compiler that a null value will not be returned.
* Add unit tests for `StorageServiceConfig`
* Update container name to remove underscore
* Address issues with test names.
* Add default coding for for the byte conversion in the tests.

Refactor AzureStorageService to inject BlobContainerClient instead of BlobClient (#1263)

* Refactor `AzureStorageService` and dependent tests to now inject the container client service, reducing the need to create a new one each time a work function is called against the service.
* Move SpotBug suppression warning to the exclude file, for consistency when suppressing the warning for thread safe immutable cloud dependencies. (#1263)
chiaramapellimt pushed a commit that referenced this pull request May 13, 2026
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Delete StorageServiceFactory.java and StorageServiceFactoryConfig.java as unnecessary and confusing steps in the DI process.
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Introduce StorageServiceConfig to conditionally create the required service.
* Refactor AzureStorageService to now correctly inject the StorageServiceClient from the IOC container.
* Add Integration Test dfor AzureStorageService.
* Add `testcontainers` to `build.gradle` to enable use of azurite.
* Remove now unused methods in `AzureStorageService`.
* Add unit tests for `AzureStorageService`
* Add annotations to `StorageServiceConfig` to tell the compiler that a null value will not be returned.
* Add unit tests for `StorageServiceConfig`
* Update container name to remove underscore
* Address issues with test names.
* Add default coding for for the byte conversion in the tests.

Refactor AzureStorageService to inject BlobContainerClient instead of BlobClient (#1263)

* Refactor `AzureStorageService` and dependent tests to now inject the container client service, reducing the need to create a new one each time a work function is called against the service.
* Move SpotBug suppression warning to the exclude file, for consistency when suppressing the warning for thread safe immutable cloud dependencies. (#1263)
chiaramapellimt pushed a commit that referenced this pull request May 13, 2026
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Delete StorageServiceFactory.java and StorageServiceFactoryConfig.java as unnecessary and confusing steps in the DI process.
* NIAD-3453: Refactor `StorageService` to correctly use DI/IOC
* Introduce StorageServiceConfig to conditionally create the required service.
* Refactor AzureStorageService to now correctly inject the StorageServiceClient from the IOC container.
* Add Integration Test dfor AzureStorageService.
* Add `testcontainers` to `build.gradle` to enable use of azurite.
* Remove now unused methods in `AzureStorageService`.
* Add unit tests for `AzureStorageService`
* Add annotations to `StorageServiceConfig` to tell the compiler that a null value will not be returned.
* Add unit tests for `StorageServiceConfig`
* Update container name to remove underscore
* Address issues with test names.
* Add default coding for for the byte conversion in the tests.

Refactor AzureStorageService to inject BlobContainerClient instead of BlobClient (#1263)

* Refactor `AzureStorageService` and dependent tests to now inject the container client service, reducing the need to create a new one each time a work function is called against the service.
* Move SpotBug suppression warning to the exclude file, for consistency when suppressing the warning for thread safe immutable cloud dependencies. (#1263)
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