Class AclSemanticsContractTest
AclQueryUtils.formAclRestrictionClause(String) (and its sibling
formNativeAclRestrictionClause) from the current row-multiplying
JOIN strategy to a correlated EXISTS subquery.
The intent is that every DAO callsite of the ACL clause is exercised here from each of the three principals (anonymous, authenticated non-admin, admin), producing a deterministic fingerprint (count + sorted id list) of the result set. The test class is run twice: once against the current JOIN-based ACL clause, once against the rewritten EXISTS-based clause. Diff zero is the green bar. Any drift between the two runs would be a silent security regression (data leak or improper restriction), which is why this scaffolding ships ahead of the refactor itself.
Fixture. Lives in src/test/resources/db/migration/h2-acl-contract/V9000__acl_contract_fixture.sql
— a non-default Flyway location that this test's Configuration adds
to the Flyway locations list. Other BaseDatabaseTest5 subclasses
see only the default db/migration/h2 migrations, so the
"fresh test DB" invariant they rely on (e.g. AclLinterServiceTest)
still holds. The fixture seeds:
- 4 EEs spanning PUBLIC / PRIVATE_OWNED / PRIVATE_SHARED / ADMIN_ONLY,
- 3 ArrayDesigns spanning PUBLIC / PRIVATE_OWNED / ADMIN_ONLY,
- 4 BibliographicReferences (3 attached as primaryPublication, 1 unattached),
- 2 FactorValues per EE,
- 3 CompositeSequences under the public AD,
- 3 Genes (Homo sapiens fixture taxon),
- Test users
testuser-owner(sid 9001) andtestuser-collaborator(sid 9002), - ACL entries materialising the four ACL situations.
CALLSITES list captures every
place in gemma-core/src/main/java that calls one of the three
ACL clause-forming helpers. Each entry pairs a stable human-readable
description with a Supplier that either invokes the underlying
DAO method (callsites reachable from a public DAO API) or returns
UNWIRED (callsites buried behind protected/abstract methods
inside the DAO base classes — these contribute a "n/a" fingerprint row
to the baseline so the refactor session sees them but their byte-identity
is established by transitivity through the wired callsites that share
the same query path).
The list size (35) intentionally exceeds the original 27-callsite
estimate in the planning doc: a number of
resolveFilterablePropertyMeta branches and the
populateExpressionExperimentCount family contribute extra
native-SQL callsites beyond the original HQL count.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BaseDatabaseTest5
BaseDatabaseTest5.BaseDatabaseTestContextConfiguration -
Field Summary
Fields inherited from class BaseDatabaseTest5
sessionFactory -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class BaseDatabaseTest5
flushAndClearSession
-
Constructor Details
-
AclSemanticsContractTest
public AclSemanticsContractTest()
-
-
Method Details
-
setUpFixtureAuthentication
@BeforeEach public void setUpFixtureAuthentication()
-