22dc39ad90101cb4f6b0d7ac1948ebedc5b666d1
[cps.git] / cps-service / src / test / groovy / org / onap / cps / api / impl / E2ENetworkSliceSpec.groovy
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  *  Copyright (C) 2021 Nordix Foundation. All rights reserved.\r
4  * ================================================================================\r
5  * Licensed under the Apache License, Version 2.0 (the "License");\r
6  * you may not use this file except in compliance with the License.\r
7  * You may obtain a copy of the License at\r
8  *\r
9  *      http://www.apache.org/licenses/LICENSE-2.0\r
10  *\r
11  * Unless required by applicable law or agreed to in writing, software\r
12  * distributed under the License is distributed on an "AS IS" BASIS,\r
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
14  * See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  *\r
17  * SPDX-License-Identifier: Apache-2.0\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.onap.cps.api.impl\r
22 \r
23 import org.onap.cps.TestUtils\r
24 import org.onap.cps.spi.CpsModulePersistenceService\r
25 import spock.lang.Specification\r
26 \r
27 \r
28 class E2ENetworkSliceSpec extends Specification {\r
29     def mockModuleStoreService = Mock(CpsModulePersistenceService)\r
30     def objectUnderTest = new CpsModuleServiceImpl()\r
31 \r
32     def setup() {\r
33         objectUnderTest.cpsModulePersistenceService = mockModuleStoreService\r
34     }\r
35 \r
36     def 'E2E model can be parsed by CPS.'() {\r
37         given: 'Valid yang resource as name-to-content map'\r
38             def yangResourcesNameToContentMap = TestUtils.getYangResourcesAsMap('e2e/basic/ietf-inet-types.yang','e2e/basic/ietf-yang-types.yang','e2e/basic/ran-network2020-08-06.yang')\r
39         when: 'Create schema set method is invoked'\r
40             objectUnderTest.createSchemaSet('someDataspace', 'someSchemaSet', yangResourcesNameToContentMap)\r
41         then: 'Parameters are validated and processing is delegated to persistence service'\r
42             1 * mockModuleStoreService.storeSchemaSet('someDataspace', 'someSchemaSet', yangResourcesNameToContentMap)\r
43     }\r
44 }\r