Class DetachedCuratableValueObjectTest
GET /rest/v2/datasets/{id}/refresh answered 500 on every call with
Could not initialize proxy [AuditEvent#…] - no session: the endpoint thaws through one
@Transactional service method and builds the value object through another, which is two
sessions, and the three last*Event associations on CurationDetails are lazy and
were not covered by the thaw. The CLI's post-write cache refresh therefore never ran.
The two halves of the fix are checked here: Thaws#thawCurationDetails covers the three
associations, and the value-object constructors survive a reference that can no longer be
resolved. Both sides are needed — the thaw is what makes the data correct, the constructor guard
is what keeps the next caller who forgets it from taking the endpoint down.
The session boundary itself needs a database, so it is modelled here with a stand-in proxy whose
getters throw LazyInitializationException until LazyInitializer.initialize() runs
— the behaviour of a real proxy, in-session and out. A run against a live session would be an
integration test.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
DetachedCuratableValueObjectTest
public DetachedCuratableValueObjectTest()
-
-
Method Details
-
setUp
@BeforeEach public void setUp() -
tearDown
@AfterEach public void tearDown() -
thawCurationDetailsInitializesEveryLastEventAssociation
@Test public void thawCurationDetailsInitializesEveryLastEventAssociation() -
thawCurationDetailsToleratesAbsentEvents
@Test public void thawCurationDetailsToleratesAbsentEvents() -
valueObjectBuiltAfterAThawCarriesTheEvents
@Test public void valueObjectBuiltAfterAThawCarriesTheEvents()The refresh endpoint's shape: thaw in one transaction, build the value object in the next. -
valueObjectBuiltWithoutAThawDropsTheEventsRatherThanThrowing
@Test public void valueObjectBuiltWithoutAThawDropsTheEventsRatherThanThrowing()Same shape with the thaw missing, which is what production was doing. A dead proxy must cost the field, not the response. -
curationDetailsValueObjectBuiltWithoutAThawDropsTheEventsRatherThanThrowing
@Test public void curationDetailsValueObjectBuiltWithoutAThawDropsTheEventsRatherThanThrowing() -
curationDetailsValueObjectBuiltAfterAThawCarriesTheEvents
@Test public void curationDetailsValueObjectBuiltAfterAThawCarriesTheEvents()
-