Class CompositeSequenceFactory
java.lang.Object
ubic.gemma.core.util.test.fixture.CompositeSequenceFactory
Typed factory for persistent
CompositeSequence (probe) test
fixtures.
Phase 3 split-out from the inline CS construction inside
ArrayDesignFactory.Builder.build(). Use this factory when a test
needs an isolated, persistent CompositeSequence (e.g.
gene-expression-vector tests that need probes independent of an AD-wide
build, or to attach an extra probe to an existing AD after the AD is
persisted).
Usage:
// Default: fresh CS on a freshly-built one-color AD, with attached BioSequence
CompositeSequence cs = compositeSequenceFactory.builder().build();
// CS attached to a specific AD, with no biosequence
CompositeSequence cs = compositeSequenceFactory.builder()
.withArrayDesign(ad)
.withBioSequence(false)
.build();
// Named CS
CompositeSequence cs = compositeSequenceFactory.builder()
.withName("probe_001")
.build();
Design notes (HB6-relevant):
- The CS mapping does NOT cascade from
CompositeSequencetobiologicalCharacteristic. The BS is therefore persisted throughBioSequenceService#findOrCreate(BioSequence)BEFORECompositeSequenceService.create(CompositeSequence)runs. Skipping this caused HB5→HB6 breakage; doing it explicitly is the safe pattern. - The
ArrayDesignis created viaArrayDesignFactory(default:oneColor()) when not supplied. The CS is added toad.getCompositeSequences()viaadd(...)on the managed collection - never viasetCompositeSequences(new HashSet<>(...)). Taxonon the BS is resolved viaTaxonFactory(default: mouse).- The attached BioSequence carries a GenBank
DatabaseEntryso tests filtering on the sequence-database link have something sensible to find. Override viaCompositeSequenceFactory.Builder.withBioSequence(boolean)to skip.
- Author:
- Phase 3 (Vision section 3 - test-fixture rewrite)
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
CompositeSequenceFactory
public CompositeSequenceFactory()
-
-
Method Details
-
builder
Start building aCompositeSequence. All defaults can be overridden viawithXxx(...)methods.
-