HesandaLiyanage opened a new pull request, #3199:
URL: https://github.com/apache/james-project/pull/3199
### Context & Motivation
Following the discussion on #3193 regarding `ZstdBlobStoreDAO` running atop
non-S3 storage layers, @chibenwa noted:
> *"ZstdBlobStoreDAO should work out of the box atop file implem. If this is
not the case a separated PR is welcomed."*
Prior to this change:
1. `ZstdBlobStoreDAOTest` in `server/blob/blob-zstd` was hardcoded to
`S3BlobStoreDAO` and required spinning up a Docker AWS S3 container
(`DockerAwsS3Extension`).
2. There was zero test coverage proving that `ZstdBlobStoreDAO` operates
correctly atop `FileBlobStoreDAO` (or `MemoryBlobStoreDAO`).
3. Running Zstd compression tests locally always incurred Docker container
startup overhead.
4. `BlobStoreModulesChooserTest` in `james-server-guice-distributed` tested
S3 and Cassandra module resolution, but lacked test coverage for `file()` and
`postgres()` implementations.
---
### Solution Overview
1. **Extracted `ZstdBlobStoreDAOContract`:**
- Created `org.apache.james.blob.zstd.ZstdBlobStoreDAOContract` extending
`BlobStoreDAOContract` and `MetadataAwareBlobStoreDAOContract`.
- Encapsulates all Zstd-specific contract assertions (compression
threshold, min ratio, custom caller metadata preservation, decompression,
corrupt payload handling, metrics verification, and multi-file roundtrips).
2. **Added `ZstdFileBlobStoreDAOTest`:**
- Tests `ZstdBlobStoreDAO` directly atop `FileBlobStoreDAO` backed by
`FileSystemImpl.forTesting()`.
- Confirms that `FileBlobStoreDAO`'s user-defined extended attributes
(`UserDefinedFileAttributeView`) correctly store and propagate
`ContentEncoding.ZSTD` and `content-original-size` metadata out of the box.
3. **Added `ZstdMemoryBlobStoreDAOTest`:**
- Provides ultra-fast, containerless contract verification of
`ZstdBlobStoreDAO` atop `MemoryBlobStoreDAO`.
4. **Refactored `ZstdBlobStoreDAOTest`:**
- `ZstdBlobStoreDAOTest` now implements `ZstdBlobStoreDAOContract` for
`S3BlobStoreDAO` (retaining full Docker S3 integration coverage while reducing
boilerplate from 454 lines down to 88 lines).
5. **Enhanced `BlobStoreModulesChooserTest`:**
- Added test assertions verifying `BlobStoreModulesChooser` correctly
selects `FileBlobStoreDAODeclarationModule` and
`PostgresBlobStoreDAODeclarationModule`.
---
### Verification & Tests
- **`server/blob/blob-zstd`:**
- `ZstdFileBlobStoreDAOTest`: **109 / 109 tests passed** (100%)
- `ZstdMemoryBlobStoreDAOTest`: **109 / 109 tests passed** (100%)
- `ZstdBlobStoreDAOTest` (S3 + Testcontainers): **110 / 110 tests passed**
(100%)
- **Total:** 328 tests passed, 0 failures.
- **`server/container/guice/distributed`:**
- `BlobStoreModulesChooserTest`: **8 / 8 tests passed** (100%)
- **Checkstyle:** 0 violations across all modified modules.
- **Sortpom:** Clean pom ordering verified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]