- dataspaceName || expectedAnchors
- DATASPACE_NAME || [Anchor.builder().name(ANCHOR_NAME1).schemaSetName(SCHEMA_SET_NAME1).dataspaceName(DATASPACE_NAME).build(),
- Anchor.builder().name(ANCHOR_NAME2).schemaSetName(SCHEMA_SET_NAME2).dataspaceName(DATASPACE_NAME).build()]
- EMPTY_DATASPACE_NAME || []
+ dataspaceName || expectedAnchors
+ DATASPACE_NAME || [Anchor.builder().name(ANCHOR_NAME1).schemaSetName(SCHEMA_SET_NAME1).dataspaceName(DATASPACE_NAME).build(),
+ Anchor.builder().name(ANCHOR_NAME2).schemaSetName(SCHEMA_SET_NAME2).dataspaceName(DATASPACE_NAME).build()]
+ DATASPACE_WITH_NO_DATA || []
+ }
+
+ @Sql([CLEAR_DATA, SET_DATA])
+ def 'Get all anchors associated with schemaset in a dataspace.'() {
+ when: 'anchors are retrieved by dataspace and schema-set'
+ def anchors = objectUnderTest.getAnchors(dataspace, schemasetName)
+ then: ' the response contains expected anchors'
+ anchors == expectedAnchors
+ where:
+ scenario | dataspace | schemasetName || expectedAnchors
+ 'no-anchors' | 'DATASPACE-003' | 'SCHEMA-SET-002-NO-ANCHORS' || Collections.emptySet()
+ 'one-anchor' | 'DATASPACE-001' | 'SCHEMA-SET-001' || Set.of(new Anchor('ANCHOR-001', 'DATASPACE-001', 'SCHEMA-SET-001'))
+ }
+
+ @Sql([CLEAR_DATA, SET_DATA])
+ def 'Error Handling: Get all anchors associated with schemaset in a dataspace.'() {
+ when: 'anchors are retrieved by dataspace and schema-set'
+ def anchors = objectUnderTest.getAnchors(dataspace, schemasetName)
+ then: ' an expected expception is thrown'
+ thrown(expectedException)
+ where:
+ scenario | dataspace | schemasetName || expectedException
+ 'unknown-dataspace' | 'unknown' | 'SCHEMA-SET-002-NO-ANCHORS' || DataspaceNotFoundException
+ 'unknown-schemaset' | 'DATASPACE-001' | 'unknown-schema-set' || SchemaSetNotFoundException