Class ParentIdentityRetrievalStrategyTest
java.lang.Object
ubic.gemma.core.util.test.BaseTest5
ubic.gemma.core.util.test.BaseDatabaseTest5
ubic.gemma.core.security.authorization.acl.ParentIdentityRetrievalStrategyTest
@ContextConfiguration
@TestExecutionListeners(value=org.springframework.security.test.context.support.WithSecurityContextTestExecutionListener.class,
mergeMode=MERGE_WITH_DEFAULTS)
public class ParentIdentityRetrievalStrategyTest
extends BaseDatabaseTest5
Phase 3 gsec HQL deprecation: regression coverage for
ParentIdentityRetrievalStrategyImpl
after its HQL select against AclObjectIdentity was replaced with raw SQL against
acl_object_identity JOIN acl_class.
Two cases:
- Happy path: a seeded acl_object_identity row for ExpressionExperiment id=N is returned as
an
AclObjectIdentitycarrying type + identifier + the row's PK id. - Empty path: when no matching row exists, the strategy returns
null.
ExpressionExperimentService for
non-SecuredChild.getSecurityOwner() domain objects; we mock the service to return a
known identifier so the test focuses on the ACL lookup itself.-
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
Modifier and TypeMethodDescriptionvoidSeed an acl_class + acl_object_identity row for ExpressionExperiment id=4242, then drive the strategy with a synthetic BioAssay whose owning EE id is 4242.voidIf no acl_object_identity row exists for the resolved parent type+identifier, the strategy must return null (matching the prior HQL uniqueResult() behavior).voidIf the upstream lookup returns a null identifier (e.g.Methods inherited from class BaseDatabaseTest5
flushAndClearSession
-
Constructor Details
-
ParentIdentityRetrievalStrategyTest
public ParentIdentityRetrievalStrategyTest()
-
-
Method Details
-
testGetParentIdentity_returnsExistingAoi
@Test @WithMockUser(authorities="GROUP_ADMIN") public void testGetParentIdentity_returnsExistingAoi()Seed an acl_class + acl_object_identity row for ExpressionExperiment id=4242, then drive the strategy with a synthetic BioAssay whose owning EE id is 4242. The strategy should resolve the parent ObjectIdentity to that AOI. -
testGetParentIdentity_returnsNullWhenNoAoi
@Test @WithMockUser(authorities="GROUP_ADMIN") public void testGetParentIdentity_returnsNullWhenNoAoi()If no acl_object_identity row exists for the resolved parent type+identifier, the strategy must return null (matching the prior HQL uniqueResult() behavior). -
testGetParentIdentity_returnsNullWhenParentIdentifierIsNull
@Test @WithMockUser(authorities="GROUP_ADMIN") public void testGetParentIdentity_returnsNullWhenParentIdentifierIsNull()If the upstream lookup returns a null identifier (e.g. orphan BioMaterial), the strategy short-circuits to null without hitting the ACL tables.
-