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:

  1. Happy path: a seeded acl_object_identity row for ExpressionExperiment id=N is returned as an AclObjectIdentity carrying type + identifier + the row's PK id.
  2. Empty path: when no matching row exists, the strategy returns null.
The strategy resolves the parent identifier through 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.
  • 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.