Assignment And Organization Tests
OpenFrame Documentation
Get the most out of OpenFrame · Book 30 minutes with Conrad, 25 years in IT. He'll show you what Mingo and Fae can take off your list.
OpenFrame Documentation
Assignment And Organization Tests is an ordered end-to-end test module supplied by the com.openframe.oss:openframe-test-service-core library and run by this repository's OpenFrame test service. It validates three related management workflows against a running tenant:
The module is integration-oriented rather than unit-oriented. Each test class drives the public test API facade, asserts the returned domain representation, and, where appropriate, confirms persistence through test database collections. Ordered methods deliberately carry fixtures from one lifecycle stage to the next; cleanup paths protect the shared test tenant when a preceding assertion fails.
The implementation belongs to the OpenFrame OSS Library artifact com.openframe.oss:openframe-test-service-core at version 7.0.11, which this repository consumes. It is executed by the OpenFrame test service assembled in this tenant repository.
| Test class | Focus | Source |
|---|---|---|
AssignmentsTest |
Knowledge article assignment lifecycle | Assignments Test |
OrganizationsTest |
Organization lifecycle and organization query semantics | Organizations Test |
UserInvitationsTest |
Invitation and invited-user lifecycle | User Invitations Test |
flowchart TD
TestRunner["JUnit ordered test classes"] --> Assignments["Assignments Test"]
TestRunner --> Organizations["Organizations Test"]
TestRunner --> Invitations["User Invitations Test"]
Assignments --> AssignmentApi["Assignment API facade"]
Assignments --> KnowledgeApi["Knowledge Base API facade"]
Assignments --> TicketApi["Ticket API facade"]
Assignments --> DeviceApi["Device API facade"]
Organizations --> OrganizationApi["Organization API facade"]
Organizations --> AgentApi["Agent API facade"]
Organizations --> PipelineContext["Pipeline Context"]
Invitations --> InvitationApi["Invitation API facade"]
Invitations --> UserApi["User API facade"]
Invitations --> TestCollections["Test database collections"]
Invitations --> PipelineContext
AssignmentApi --> TenantApi["Running tenant API"]
KnowledgeApi --> TenantApi
TicketApi --> TenantApi
DeviceApi --> TenantApi
OrganizationApi --> TenantApi
AgentApi --> TenantApi
InvitationApi --> TenantApi
UserApi --> TenantApi
TestCollections --> TenantDatabase["Tenant database"]
The test classes use API facades as their primary interface. UserInvitationsTest additionally reads invitation and user records through test-only collections to compare API behavior with persisted state. PipelineContext is a coordination boundary for pipeline runs: organization creation can publish an organization identifier and agent registration key for later device-install stages, while invitation acceptance publishes the user created by that run for targeted deletion.
Each class uses JUnit method ordering. Later checks either consume state produced by earlier checks or protect themselves with assumptions. For example, assignment list and pagination checks require the ticket and two article assignments to exist; device-specific checks are skipped when the expected QA Windows device cannot be found.
The suite verifies observable contracts, not merely successful responses:
Fixtures are namespaced with a generated run identifier when assignment tests create knowledge-base items and tickets. Assignment cleanup removes any remaining links, archives the fixture folder and its child articles, and moves the fixture ticket through resolved and archived statuses. Invitation cleanup deletes the dedicated edit user or revokes its outstanding invitation, then revokes any pending listing fixture. Organization cases archive their own temporary organization when testing archiving eligibility.
AssignmentsTest validates assignments from a knowledge-base article to three target categories: tickets, knowledge-base articles, and devices. It creates a folder with three draft articles, creates a ticket, and optionally discovers a specifically named QA Windows device.
flowchart LR
FixtureFolder["Fixture folder"] --> SourceArticle["Source article"]
FixtureFolder --> ArticleOne["Target article one"]
FixtureFolder --> ArticleTwo["Target article two"]
FixtureTicket["Fixture ticket"] --> TicketAssignment["Ticket assignment"]
SourceArticle --> TicketAssignment
SourceArticle --> ArticleAssignments["Article assignments"]
ArticleOne --> ArticleAssignments
ArticleTwo --> ArticleAssignments
SourceArticle --> DeviceAssignment["Device assignment"]
QaDevice["QA Windows device"] --> DeviceAssignment
TicketAssignment --> QueryChecks["Counts, filters, sorting, and paging"]
ArticleAssignments --> QueryChecks
DeviceAssignment --> QueryChecks
QueryChecks --> Cleanup["Unassign and archive fixtures"]
The class tracks every assignment it creates in an in-memory target-to-type map. That map supports both precise assertions and best-effort cleanup after an interrupted scenario.
OrganizationsTest exercises organization management across OSS and SaaS-tagged environments. It uses generated create and update requests, then checks both organization fields and query behavior.
flowchart TD
Create["Create organization"] --> ValidateCreate["Validate generated fields and addresses"]
ValidateCreate --> PublishDecision{"Later pipeline phase?"}
PublishDecision -->|"yes"| PublishContext["Publish organization and registration key"]
PublishDecision -->|"no"| TenantScope["Keep later lookups tenant-wide"]
ValidateCreate --> ListRead["List and retrieve organizations"]
ListRead --> Update["Update organization"]
Update --> Archive["Archive selected organization"]
ListRead --> QueryChecks["Sort and filter by last activity"]
ListRead --> ArchiveEligibility["Check archive eligibility"]
ListRead --> GlobalLookup["Resolve present and missing global identifiers"]
PipelineContext; it also attempts to fetch and publish the active agent registration secret. Standalone runs deliberately do not publish this state, avoiding unintended narrowing of later device lookups.ARCHIVED afterward.null for a syntactically valid, non-existent organization identifier.UserInvitationsTest tests the coupled invitation and user lifecycle. It uses invitation and user API facades for actions, test collections for persistence comparison, and PipelineContext to ensure the delete stage removes the user created in the same run rather than a shared administrator.
flowchart TD
Invite["Invite user"] --> DbCompare["Compare API response with invitation record"]
DbCompare --> Accept["Accept pending invitation"]
Accept --> PublishUser["Publish created user to pipeline context"]
Accept --> DuplicateAccept["Reject second acceptance"]
Invite --> Revoke["Revoke separate invitation"]
Revoke --> RejectRevoked["Reject acceptance of revoked invitation"]
Accept --> EditFixture["Create dedicated editable user"]
EditFixture --> EditName["Update valid name"]
EditName --> LongName["Accept 128-character first name"]
LongName --> InvalidName["Reject 129-character first name"]
Invite --> ListFixture["Create pending listing fixture"]
ListFixture --> ListPages["Validate listing and page size"]
ListPages --> Resend["Refuse resend before expiry"]
Resend --> RevokeListed["Revoke and remove from listing"]
PublishUser --> DeleteUser["Delete run-scoped user"]
DeleteUser --> Reinvite["Invite deleted user again"]
The module covers pending, accepted, revoked, and deleted-user cases:
PipelineContext for safe cleanup.REVOKED status in persistence, and an attempt to accept it returns the expected revoked conflict response.DELETED status.A dedicated invitation and accepted user isolate update behavior from shared users:
VALIDATION_ERROR referring to firstName and does not alter persisted user names.A separate pending invitation verifies list semantics:
409.| Dependency | Role in Assignment And Organization Tests |
|---|---|
| OpenFrame test service core library | Provides the three JUnit test classes, API facades, DTOs, generators, helpers, and test database collections. |
| Tenant API | Executes assignment, knowledge-base, ticket, device, organization, invitation, agent, and user operations through the test facades. |
| Tenant database | Supplies direct persistence verification for invitations and users through test-only collections. |
| Pipeline Context | Shares a created organization, registration secret, and invited user only when later pipeline phases need them. |
| QA Windows device | Optional fixture for device-assignment coverage; unavailable infrastructure skips only the device-specific checks. |