Class TestSupportedRelationshipPaging


public class TestSupportedRelationshipPaging extends RepositoryConformanceTestCase
Test that a repository honours the paging contract when a caller pages through findRelationships().
The contract: the caller asks for a page by starting element and page size, and asks for the next page a page size further on. An empty list means the page was retrieved but nothing on it could be returned (for example, it was filtered out), so the caller keeps going. Null means there is nothing more, so the caller stops.
Every layer above the repository - the enterprise connector, the generic handlers, the REST APIs and the clients in every language - pages on that understanding, so a repository that breaks it breaks them all, and neither failure is noisy. Returning null before the end hides the remaining relationships. Returning an empty list at the end means a caller that pages never stops.
The test creates a few relationships of the type, each between entities of its own, then pages through every relationship of the type with a page size smaller than the number created, so that the instances span several pages. The results are sequenced by GUID so that each request sees the same order. It asserts that no page is larger than requested, that no relationship appears on two pages, that every relationship is reached, and that the end is signalled by null.
Other relationships of the type (and its subtypes) are included in the walk. If the repository holds more of them than one search can return, the walk is not attempted rather than reporting on a partial view. A type whose end types are not among the types being tested is skipped, since its relationships cannot be created.
  • Constructor Details

    • TestSupportedRelationshipPaging

      public TestSupportedRelationshipPaging(RepositoryConformanceWorkPad workPad, Map<String,EntityDef> entityDefs, RelationshipDef relationshipDef)
      Set up the test case.
      Parameters:
      workPad - place for parameters and results
      entityDefs - the entity types supported by the repository under test
      relationshipDef - the relationship type being paged through
  • Method Details