Class DatasetsDiagnosticsRestTest
- All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.context.ApplicationContextAware
DatasetsWebService. Each test exercises the real Hibernate session lifecycle that the
mock-based DatasetsWebServiceTest cannot reproduce.
Regression target #1: the mean-variance handler previously called
ee.getMeanVarianceRelation().getMeans() on the entity returned by
DatasetArgService.getEntity(), which carries a lazy MVR proxy. Outside the service-bounded
Hibernate session this threw LazyInitializationException (HTTP 500). The fix in commit
a70e3dc8f6 switched to expressionExperimentService.loadWithMeanVarianceRelation.
Builds before that commit fail testGetDatasetMeanVarianceReturnsArrays() with a 500.
Regression target #2: the SVDResult constructor
previously assigned pca.getExperimentAnalyzed() (returns a BioAssaySet-typed
Hibernate proxy) directly to its ExpressionExperiment field. The implicit checkcast
inserted by javac threw ClassCastException, caught + logged message-only by
SVDServiceImpl.getSvd, which returned null silently. The fix in
dd63676978 calls Hibernate.unproxy(Object) in the constructor and switched the
catch-block to log the full stack. getDatasetSvd_returns200_andExperimentAnalyzedSurfacesUnderlyingEntity()
locks this in: pre-fix, the call returned 404 instead of 200.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidRegression guard fordd63676978.voidNegative case: an EE without a PCA → 404.voidCompanion: /svd/loadings on a valid PCA should return 200 with at mosttoprows and the requested PC.voidNegative case: /svd/loadings on an EE without a PCA → 404.voidvoidvoidPOST /samples/outliers atomically marks one assay and unmarks another.voidPOST /samples/outliers must reject ids that don't belong to the path-derived dataset with HTTP 400, AND must not mutate any state.voidPOST /samples/outliers rejects an id that appears in BOTHmarkandunmark(ambiguous caller-side delta) with HTTP 400.voidWire-shape check: the HTTP response is 200 with a JSON body containing the means array.voidRegression guard: calling the handler must not throwLazyInitializationException.voidNegative case: a dataset without an MVR returns 404 (NotFoundException from the handler).voidvoidMost RNA-seq assays carry a read count in the database while only a minority of datasets have a MultiQC report, so a read count alone has to answer 200 — withreportPresentfalse so the caller can tell the two apart.voidA dataset with no MultiQC report and no sequencing read counts has nothing to show, so the endpoint 404s rather than returning an empty row per assay.voidGET /sample-correlation returns 404 when the dataset has noSampleCoexpressionAnalysis.voidPUT /samples/{bioAssayId}/outlier flipsisOutlier=trueon the targeted BioAssay.Methods 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
-
DatasetsDiagnosticsRestTest
public DatasetsDiagnosticsRestTest()
-
-
Method Details
-
setUpFixtures
@BeforeEach public void setUpFixtures() -
tearDownFixtures
@AfterEach public void tearDownFixtures() -
testGetDatasetMeanVarianceReturnsArrays
@Test public void testGetDatasetMeanVarianceReturnsArrays()Regression guard: calling the handler must not throwLazyInitializationException. Pre-a70e3dc8f6this returned HTTP 500. -
testGetDatasetMeanVarianceHttp200
@Test public void testGetDatasetMeanVarianceHttp200()Wire-shape check: the HTTP response is 200 with a JSON body containing the means array. Complements the direct-handler call above by exercising the Jersey serialization path. -
testGetDatasetMeanVarianceWhenNoneIs404
@Test public void testGetDatasetMeanVarianceWhenNoneIs404()Negative case: a dataset without an MVR returns 404 (NotFoundException from the handler). -
testGetDatasetMeanVarianceWithUnknownDatasetIs404
@Test public void testGetDatasetMeanVarianceWithUnknownDatasetIs404() -
getDatasetSvd_returns200_andExperimentAnalyzedSurfacesUnderlyingEntity
@Test public void getDatasetSvd_returns200_andExperimentAnalyzedSurfacesUnderlyingEntity()Regression guard fordd63676978. Pre-fix, the SVDResult constructor's implicit checkcast onpca.getExperimentAnalyzed()threwClassCastException(because the generic-erased Hibernate proxy is typedBioAssaySet, notExpressionExperiment).SVDServiceImpl.getSvdcaught it message-only and returned null, surfacing the call as a 404 on /svd. Post-fix:Hibernate.unproxy(...)lets the underlying EE surface,- the catch logs the full stack (any future CCE-style regression is visible).
-
getDatasetSvdLoadings_returns200_forValidPcAndTop
@Test public void getDatasetSvdLoadings_returns200_forValidPcAndTop()Companion: /svd/loadings on a valid PCA should return 200 with at mosttoprows and the requested PC. Pre-fix, this surfaced as 500 becausegetSvd()returned null after the SVDResult-ctor CCE whilehasSvd()was still true. -
getDatasetSvd_returns404_whenNoSvd
@Test public void getDatasetSvd_returns404_whenNoSvd()Negative case: an EE without a PCA → 404. Locks in the "throw new NotFoundException" branch ingetDatasetSvd. -
getDatasetSvdLoadings_returns404_whenNoSvd
@Test public void getDatasetSvdLoadings_returns404_whenNoSvd()Negative case: /svd/loadings on an EE without a PCA → 404. ThehasSvd()short-circuit covers this; we also exercise the wire path. -
testGetDatasetSampleCorrelationWhenNoneIs404
@Test public void testGetDatasetSampleCorrelationWhenNoneIs404()GET /sample-correlation returns 404 when the dataset has noSampleCoexpressionAnalysis. Cheap fixture (no SCA computed). -
testMarkSampleOutlierViaPutEndpointFlipsIsOutlier
@Test public void testMarkSampleOutlierViaPutEndpointFlipsIsOutlier()PUT /samples/{bioAssayId}/outlier flipsisOutlier=trueon the targeted BioAssay. Re-load through the BioAssayService to confirm the persisted state. -
testBatchMarkOutliersMarksAndUnmarksAtomically
@Test public void testBatchMarkOutliersMarksAndUnmarksAtomically()POST /samples/outliers atomically marks one assay and unmarks another. The response carries the post-state full outlier set; the marked id is present, the unmarked id is absent. -
testBatchMarkOutliersReturns400WhenIdDoesntBelongToDataset
@Test public void testBatchMarkOutliersReturns400WhenIdDoesntBelongToDataset()POST /samples/outliers must reject ids that don't belong to the path-derived dataset with HTTP 400, AND must not mutate any state. Validation runs before any service call so the EE's outlier set is unchanged after the call. -
testBatchMarkOutliersReturns400WhenIdInBothMarkAndUnmark
@Test public void testBatchMarkOutliersReturns400WhenIdInBothMarkAndUnmark()POST /samples/outliers rejects an id that appears in BOTHmarkandunmark(ambiguous caller-side delta) with HTTP 400. -
testGetDatasetQcMetricsWhenThereIsNothingIs404
@Test public void testGetDatasetQcMetricsWhenThereIsNothingIs404()A dataset with no MultiQC report and no sequencing read counts has nothing to show, so the endpoint 404s rather than returning an empty row per assay. -
testGetDatasetQcMetricsServesTheDatabaseReadCountWithoutAReport
@Test public void testGetDatasetQcMetricsServesTheDatabaseReadCountWithoutAReport()Most RNA-seq assays carry a read count in the database while only a minority of datasets have a MultiQC report, so a read count alone has to answer 200 — withreportPresentfalse so the caller can tell the two apart.
-