Task Summary
CollaborationResource (amber/src/main/scala/org/apache/texera/web/resource/CollaborationResource.scala, codecov ~62%) is a websocket collaboration endpoint. Bring it to full unit coverage. An earlier pass (#6900) covered the session lifecycle; the remaining uncovered lines are the collaboration lock-request handling — TryLockRequest → checkIsReadOnly → grant/reject via the in-memory session-holder maps (wIdLockHolderSessionIdMap, sessionIdWIdMap / sessionIdUIdMap). Test it the way the existing spec does — with a mocked javax.websocket.Session — and run the coverage report to cover the remaining red lines.
Behavior to add
Drive a TryLockRequest through myOnMsg with a mocked Session and seeded session maps, covering the lock branches:
DUMMY_WID session → immediately grants (WorkflowAccessEvent(readonly=false) + LockGrantedEvent).
- read-only user (
checkIsReadOnly true) → LockRejectedEvent + WorkflowAccessEvent(readonly=true).
- writable user with no current holder (or the holder is the sender) →
grantLock; writable user with a different holder → LockRejectedEvent.
checkIsReadOnly calls WorkflowAccessResource.hasWriteAccess (a DB lookup) — back it with a MockTexeraDB setup (seed a workflow_user_access row for the read/write cases) or stub that single access call. Explore the coverage output for any remaining unit-testable lines. No other infra.
Task Type
Task Summary
CollaborationResource(amber/src/main/scala/org/apache/texera/web/resource/CollaborationResource.scala, codecov ~62%) is a websocket collaboration endpoint. Bring it to full unit coverage. An earlier pass (#6900) covered the session lifecycle; the remaining uncovered lines are the collaboration lock-request handling —TryLockRequest→checkIsReadOnly→ grant/reject via the in-memory session-holder maps (wIdLockHolderSessionIdMap,sessionIdWIdMap/sessionIdUIdMap). Test it the way the existing spec does — with a mockedjavax.websocket.Session— and run the coverage report to cover the remaining red lines.Behavior to add
Drive a
TryLockRequestthroughmyOnMsgwith a mockedSessionand seeded session maps, covering the lock branches:DUMMY_WIDsession → immediately grants (WorkflowAccessEvent(readonly=false)+LockGrantedEvent).checkIsReadOnlytrue) →LockRejectedEvent+WorkflowAccessEvent(readonly=true).grantLock; writable user with a different holder →LockRejectedEvent.checkIsReadOnlycallsWorkflowAccessResource.hasWriteAccess(a DB lookup) — back it with aMockTexeraDBsetup (seed aworkflow_user_accessrow for the read/write cases) or stub that single access call. Explore the coverage output for any remaining unit-testable lines. No other infra.Task Type