diff options
Diffstat (limited to 'cps-service/src/test')
-rw-r--r-- | cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy index b975de6555..5ef584a0b8 100644 --- a/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/utils/PrefixResolverSpec.groovy @@ -48,10 +48,10 @@ class PrefixResolverSpec extends Specification { def schemaContext = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getSchemaContext() + def anchor = new Anchor(dataspaceName: 'testDataspace', name: 'testAnchor') + def setup() { - given: 'an anchor for the test-tree model' - def anchor = new Anchor(dataspaceName: 'testDataspace', name: 'testAnchor') - and: 'the system can get this anchor' + given: 'the system can get the anchor' mockCpsAnchorService.getAnchor('testDataspace', 'testAnchor') >> anchor and: 'the schema source cache contains the schema context for the test-tree module' mockYangTextSchemaSourceSet.getSchemaContext() >> schemaContext @@ -59,7 +59,7 @@ class PrefixResolverSpec extends Specification { def 'get xpath prefix using node schema context'() { when: 'the prefix of the yang module is retrieved' - def result = objectUnderTest.getPrefix('testDataspace', 'testAnchor', xpath) + def result = objectUnderTest.getPrefix(anchor, xpath) then: 'the expected prefix is returned' result == expectedPrefix and: 'the cache is updated for the given anchor with a map of prefixes per top level container (just one one this case)' @@ -90,7 +90,7 @@ class PrefixResolverSpec extends Specification { mockAnchorDataCache.containsKey('testAnchor') >> true mockAnchorDataCache.get('testAnchor') >> anchorDataCacheEntry when: 'the prefix of the yang module is retrieved' - def result = objectUnderTest.getPrefix('testDataspace', 'testAnchor', '/test-tree') + def result = objectUnderTest.getPrefix(anchor, '/test-tree') then: 'the expected prefix is returned' result == expectedPrefix and: 'schema source cache is not used (i.e. no need to build schema context)' @@ -108,7 +108,7 @@ class PrefixResolverSpec extends Specification { mockAnchorDataCache.containsKey('testAnchor') >> true mockAnchorDataCache.get('testAnchor') >> anchorDataCacheEntry when: 'the prefix of the yang module is retrieved' - def result = objectUnderTest.getPrefix('testDataspace', 'testAnchor', '/test-tree') + def result = objectUnderTest.getPrefix(anchor, '/test-tree') then: 'the expected prefix is returned' result == 'tree' and: 'schema source cache is used (i.e. need to build schema context)' |