Class BioAssayFactory

java.lang.Object
ubic.gemma.core.util.test.fixture.BioAssayFactory

@Component public class BioAssayFactory extends Object
Typed factory for persistent BioAssay test fixtures.

Phase 3 split-out from the inline BA construction inside ExperimentFactory.Builder.build(). Use this factory when a test needs an isolated, persistent BioAssay (not necessarily attached to an ExpressionExperiment); for the EE-attached case keep using ExperimentFactory.

Usage:

  // Fresh BA with auto-created BioMaterial + ArrayDesign on mouse
  BioAssay ba = bioAssayFactory.builder().build();

  // BA wired to a specific BM and AD
  BioAssay ba = bioAssayFactory.builder()
                     .withBioMaterial(bm)
                     .withArrayDesign(ad)
                     .build();

  // Named BA
  BioAssay ba = bioAssayFactory.builder()
                     .withName("GSM12345_ba")
                     .build();

Design notes (HB6-relevant):

  • The BA mapping does NOT cascade from BioAssay to sampleUsed / arrayDesignUsed. Both must be persistent before SecurableBaseImmutableService.create(BioAssay) is called. This factory pre-persists both via their respective services so the production code path fires (ACL listeners on the BM and AD).
  • BioMaterial.getBioAssaysUsedIn().add(ba) is the collection mutation that keeps the inverse side in sync. We do this BEFORE the BA persist so subsequent loads see the relationship.
  • A transient GEO DatabaseEntry accession is attached to every BA - mirrors the inline pattern in ExperimentFactory and satisfies tests that filter on accession.
  • BioMaterialFactory does not yet exist as a separate component; until it lands, this factory inlines BM creation (same shape as ExperimentFactory's inline BM block). The BioAssayFactory.Builder.withBioMaterial(BioMaterial) hook is the seam to swap in once BioMaterialFactory lands.
Author:
Phase 3 (Vision section 3 - test-fixture rewrite)
  • Constructor Details

    • BioAssayFactory

      public BioAssayFactory()
  • Method Details