X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Fyang%2FYangTextSchemaSourceSetBuilderSpec.groovy;fp=cps-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Futils%2FYangTextSchemaSourceSetSpec.groovy;h=236221aca7a8810d9fdb62281e268b9b8ff1d839;hb=refs%2Fchanges%2F42%2F128942%2F3;hp=b6250612ed77e64cccbef25f4e062ef59b6e0cb7;hpb=d07a5e3cfd74357c626d099dc5d5812ecd8e33ea;p=cps.git diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/YangTextSchemaSourceSetSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/yang/YangTextSchemaSourceSetBuilderSpec.groovy similarity index 88% rename from cps-service/src/test/groovy/org/onap/cps/utils/YangTextSchemaSourceSetSpec.groovy rename to cps-service/src/test/groovy/org/onap/cps/yang/YangTextSchemaSourceSetBuilderSpec.groovy index b6250612e..236221aca 100644 --- a/cps-service/src/test/groovy/org/onap/cps/utils/YangTextSchemaSourceSetSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/yang/YangTextSchemaSourceSetBuilderSpec.groovy @@ -1,7 +1,7 @@ /* * ============LICENSE_START======================================================= * Copyright (C) 2020-2021 Pantheon.tech - * Modifications Copyright (C) 2020-2021 Nordix Foundation + * Modifications Copyright (C) 2020-2022 Nordix Foundation * Modifications Copyright (C) 2021 Bell Canada. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,22 +20,24 @@ * ============LICENSE_END========================================================= */ -package org.onap.cps.utils +package org.onap.cps.yang + import org.onap.cps.TestUtils import org.onap.cps.spi.exceptions.ModelValidationException -import org.onap.cps.yang.YangTextSchemaSourceSetBuilder import org.opendaylight.yangtools.yang.common.Revision import spock.lang.Specification -class YangTextSchemaSourceSetSpec extends Specification { +class YangTextSchemaSourceSetBuilderSpec extends Specification { def 'Building a valid YangTextSchemaSourceSet using #filenameCase filename.'() { given: 'a yang model (file)' def yangResourceNameToContent = [filename: TestUtils.getResourceFileContent('bookstore.yang')] when: 'the content is parsed' def result = YangTextSchemaSourceSetBuilder.of(yangResourceNameToContent).getSchemaContext() - then: 'the result contains 1 module of the correct name and revision' + then: 'it can be validated successfully' + YangTextSchemaSourceSetBuilder.validate(yangResourceNameToContent) + and: 'the result contains 1 module of the correct name and revision' result.modules.size() == 1 def optionalModule = result.findModule('stores', Revision.of('2020-09-15')) optionalModule.isPresent()