Class DatasetsPlatformsRestTest
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
GET /datasets/{dataset}/platforms, in both modes, against a real
(gemdtest) database.
🛑 The point of this class is the transaction boundary, which neither of the two existing test layers
crosses. ArrayDesignDaoTest covers the same three cases but runs inside BaseDatabaseTest5's
own transaction, so a Hibernate session is always bound to the thread; DatasetsWebServiceTest stubs
ArrayDesignService, so the real service method never executes. A read-service method missing its
@Transactional is green in both and 500s in production — which is what
ArrayDesignReadServiceImpl.loadOriginalPlatformValueObjectsForEE did until 69c1c11b5f:
Could not obtain transaction-synchronized Session for current thread.
These tests call the handler with no transaction open on the test thread (the Jersey base class registers
no TransactionalTestExecutionListener and the in-memory container has no open-session-in-view
filter), so the service must open its own. Fixture setup is the one part that needs a session, and it takes
one explicitly through a TransactionTemplate.
Cases, mirroring the endpoint's documented contract:
- a switched dataset answers with the platform it was submitted on, not the one in use;
- a dataset that was never switched answers with an empty list, not its current platform;
- a no-op switch (recorded original == the platform in use) is excluded.
- Author:
- gemma
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidA no-op switch — the original recorded as the platform already in use — is excluded, so a non-empty answer always names something that actually changed.voidNever switched: an empty list, NOT the platform the dataset is on.voidThe wire check, and the reason this class exists: the route answers 200 with the submitted platform in the body.voidA real switch:?original=truenames the submitted platform, and the default mode still names the one in use.voidvoidMethods inherited from class BaseJerseyIntegrationTest5
setUpAuthentication, tearDownSecurityContextMethods inherited from class BaseJerseyTest5
configure, configureClient, getTestContainerFactory, setApplicationContext, setUp, tearDownMethods inherited from class org.glassfish.jersey.test.JerseyTest
client, close, closeIfNotNull, configureDeployment, disable, enable, forceDisable, forceEnable, forceSet, getAsyncTimeoutMultiplier, getBaseUri, getClient, getLastLoggedRecord, getLoggedRecords, getPort, getSslContext, getSslParameters, isEnabled, set, set, setClient, target, target
-
Constructor Details
-
DatasetsPlatformsRestTest
public DatasetsPlatformsRestTest()
-
-
Method Details
-
setUpFixtures
@BeforeEach public void setUpFixtures() -
tearDownFixtures
@AfterEach public void tearDownFixtures() -
getPlatformsOriginal_namesTheSubmittedPlatform
@Test public void getPlatformsOriginal_namesTheSubmittedPlatform()A real switch:?original=truenames the submitted platform, and the default mode still names the one in use. -
getPlatformsOriginal_isTwoHundredOverHttp
@Test public void getPlatformsOriginal_isTwoHundredOverHttp()The wire check, and the reason this class exists: the route answers 200 with the submitted platform in the body. With the read service's@Transactionalabsent this is a 500 and the body carriesCould not obtain transaction-synchronized Session for current thread. -
getPlatformsOriginal_isEmptyWhenNeverSwitched
@Test public void getPlatformsOriginal_isEmptyWhenNeverSwitched()Never switched: an empty list, NOT the platform the dataset is on. Returning the current platform here would render "as originally submitted" on every dataset in the corpus. -
getPlatformsOriginal_excludesANoopSwitch
@Test public void getPlatformsOriginal_excludesANoopSwitch()A no-op switch — the original recorded as the platform already in use — is excluded, so a non-empty answer always names something that actually changed.
-