Add bookmyshow module: seat booking with hold expiry and payment timeout, naive vs pessimistic vs optimistic inventories, race and deadlock demos, JDBC strategies on H2 (8 test classes, 8 transcripts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b5YFRisPHrLBR2dRu9
This commit is contained in:
co-authored by
Claude Sonnet 5.5
parent
deb924febd
commit
c57031aaeb
@@ -0,0 +1,29 @@
|
||||
Pitfalls: partial holds, foreign releases, bad input, double Pay
|
||||
================================================================
|
||||
|
||||
1. Request [A1, A2, A3] while someone else holds A3
|
||||
NaiveInventory result false A1 AVAILABLE v0 A2 AVAILABLE v0
|
||||
PessimisticInventory result false A1 AVAILABLE v0 A2 AVAILABLE v0
|
||||
OptimisticInventory result false A1 AVAILABLE v2 A2 AVAILABLE v2
|
||||
(v0 means the seat was never touched; v2 means it was held and handed back during the attempt)
|
||||
|
||||
2. Someone who does not own the hold tries to release or confirm it
|
||||
NaiveInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
|
||||
PessimisticInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
|
||||
OptimisticInventory after Ravi's release and confirm: C1 is HELD by ASHA, Ravi's confirm returned false
|
||||
|
||||
3. A BOOKED seat is not released by release(), even by its owner
|
||||
NaiveInventory C2 after owner's release: BOOKED, a new hold on it returns false
|
||||
PessimisticInventory C2 after owner's release: BOOKED, a new hold on it returns false
|
||||
OptimisticInventory C2 after owner's release: BOOKED, a new hold on it returns false
|
||||
|
||||
4. Bad input (identical for all three inventories)
|
||||
duplicate seat ids: IllegalArgumentException: duplicate seat id in request: A1
|
||||
unknown seat: IllegalArgumentException: unknown seat Z99 for show SH-1
|
||||
no seats at all: IllegalArgumentException: no seats requested
|
||||
unknown show: IllegalArgumentException: unknown show: SH-404
|
||||
|
||||
5. Pay pressed 50 times at once for the same booking
|
||||
calls that confirmed: 1
|
||||
calls refused with IllegalStateException: 49
|
||||
times the card was charged: 1
|
||||
Reference in New Issue
Block a user