slachiewicz opened a new pull request, #2279:
URL: https://github.com/apache/maven-resolver/pull/2279

   The hazelcast, redisson and ipc named-lock modules each carried their own 
copy of `NamedLockFactoryTestSupport` and `NamedLockFactoryAdapterTestSupport`. 
The copies had drifted from the originals in `maven-resolver-named-locks` and 
`maven-resolver-impl`, so a test added to one did not reach the others. This PR 
publishes the two originals as `test-jar` artifacts of their modules and makes 
the three `*IT` classes extend them; the modules keep no `*TestSupport` of 
their own.
   
   The adapter support cannot live in the named-locks test-jar: 
`NamedLockFactoryAdapter` is in `maven-resolver-impl`, which depends on 
`maven-resolver-named-locks`, so it ships in the impl test-jar instead. 
`maven-resolver-test-util` was ruled out for the same reason, since impl's 
tests depend on it.
   
   ### Differences between the copies and the shared classes, and how each is 
kept
   
   `NamedLockFactoryTestSupport`:
   
   - The copies lacked `testFailure`, `fullyConsumeLockTime` and 
`releasedExclusiveAllowAccess`. Every IT now runs them; each 
`*NamedLockFactoryIT` goes from 9 to 12 tests.
   - The boxing tests waited 1 ms for a free lock everywhere except ipc, which 
waited 100 ms. Kept through the `lockWaitMillis()` hook, which 
`IpcNamedLockFactoryIT` overrides.
   - The contending `Access` waited 1000 ms in core and ipc but 100 ms in 
hazelcast and redisson. Kept through the `accessWaitMillis()` hook, which the 
four hazelcast and redisson ITs override; `fullyConsumeLockTime` asserts 
against the same value.
   - ipc used `@Timeout` 15/25/15 s on `sharedAccess`, `exclusiveAccess` and 
`mixedAccess` instead of 5 s. A subclass cannot change a superclass method's 
annotation, so `IpcNamedLockFactoryIT` overrides the three methods, 
re-annotated, and delegates to `super`.
   - The copies asserted `unlockWoLock` on `unlock()` alone and gave `rwBoxing` 
a failure message; the shared class adopts both, which is stricter than the 
core version was.
   - ipc bounded the joins and latch waits and asserted on them; the shared 
class and its `Access` adopt that form for every provider. Under the unchanged 
`@Timeout` the outcome is the same, the failure message is better.
   - The copies shut down the factory in `@AfterAll`; the core class did not. 
The shared class now does, so the three core tests shut their factories down 
too.
   - Class-level `@DisabledOnOs(WINDOWS)` (ipc), `@Testcontainers` with the 
Redis container (redisson) and the `HazelcastClientUtils` field (hazelcast) 
move to the ITs. Redis uses `@Container` and `HazelcastClientUtils` is now an 
`AfterAllCallback` registered with `@RegisterExtension`, so in both cases the 
infrastructure is torn down after the superclass `@AfterAll` has shut the 
factory down, the same order the copies had.
   
   `NamedLockFactoryAdapterTestSupport`:
   
   - The copies lacked `multipleAcquires`, `multipleAcquiresWithALoser`, 
`fullyConsumeLockTime` and `releasedExclusiveAllowAccess`. Every `*AdapterIT` 
goes from 9 to 13 tests.
   - The copies offered `setNamedLockFactory(factory)`; the impl class sets the 
`namedLockFactory` field and calls `createAdapter()`. The ITs follow the impl 
idiom.
   - ipc used `@Timeout(25)` on `exclusiveAccess` instead of 15 s; 
`IpcAdapterIT` and `IpcAdapterNoForkIT` override that method as above.
   - `IpcAdapterNoForkIT.cleanup()` used to shadow the copy's `@AfterAll 
cleanup()`, so the adapter's factory was never shut down for that class. The 
impl method is `cleanupAdapter()`, so the shutdown now runs and the in-process 
server is stopped through `IpcClient.close()`.
   
   The test-jar executions override the `archive` configuration so the tests 
jar does not reuse the main jar's bnd manifest.
   
   Overlaps with #2275, which modernises the three adapter copies this PR 
deletes and adds a deprecation suppression to the four hazelcast ITs; whichever 
lands second rebases, keeping the copies deleted and the suppression on the 
ITs. #2275's changes to the impl `NamedLockFactoryAdapterTestSupport` then 
reach the three providers through the test-jar.
   
   Verified: `mvn -P run-its verify` on JDK 21 for the four named-locks 
modules, twice → BUILD SUCCESS; per class, the three core tests stay at 12, 
each `*NamedLockFactoryIT` goes 9 → 12 and each `*AdapterIT` 9 → 13, every 
other class unchanged (161 → 200 tests in total); `mvn spotless:check` on JDK 
17 → clean.
   


-- 
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]

Reply via email to