1 package org.onap.ccsdk.sli.plugins.restconfapicall;
3 import static org.junit.Assert.assertNotNull;
4 import static org.junit.Assert.assertNull;
7 import org.onap.ccsdk.sli.core.sli.SvcLogicException;
8 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
9 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
10 import org.opendaylight.yangtools.yang.parser.impl.YangParserFactoryImpl;
13 * ============LICENSE_START=======================================================
15 * ================================================================================
16 * Copyright (C) 2021 AT&T Intellectual Property. All rights
18 * ================================================================================
19 * Licensed under the Apache License, Version 2.0 (the "License");
20 * you may not use this file except in compliance with the License.
21 * You may obtain a copy of the License at
23 * http://www.apache.org/licenses/LICENSE-2.0
25 * Unless required by applicable law or agreed to in writing, software
26 * distributed under the License is distributed on an "AS IS" BASIS,
27 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
28 * See the License for the specific language governing permissions and
29 * limitations under the License.
30 * ============LICENSE_END=========================================================
33 public class TestRestconfApiUtils {
35 public void testGetSchemaCtxFromDir() throws SvcLogicException {
37 YangParserFactory factory = new YangParserFactoryImpl();
40 // Test with valid subdirectories
41 EffectiveModelContext modelCtx = RestconfApiUtils.getSchemaCtxFromDir(factory, "src/test/test-yang");
42 assertNotNull(modelCtx);
44 // Test with directory with no yang
45 modelCtx = RestconfApiUtils.getSchemaCtxFromDir(factory, "src/test/java");
46 assertNotNull(modelCtx);
48 // Test with invalid directory
49 modelCtx = RestconfApiUtils.getSchemaCtxFromDir(factory, "no/such/directory");
50 assertNotNull(modelCtx);