2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2024 Ericsson
4 * Modifications Copyright (C) 2024 OpenInfra Foundation Europe
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 * SPDX-License-Identifier: Apache-2.0
19 * ============LICENSE_END=========================================================
21 package org.oran.smo.yangtools.parser.model.schema.test;
23 import static org.junit.Assert.assertTrue;
25 import java.util.Arrays;
26 import java.util.Collections;
27 import java.util.List;
29 import org.junit.Test;
31 import org.oran.smo.yangtools.parser.model.schema.AnnotationRegistry;
32 import org.oran.smo.yangtools.parser.model.util.YangAnnotation;
33 import org.oran.smo.yangtools.parser.testutils.YangTestCommon;
35 public class AnnotationRegistryTest extends YangTestCommon {
38 public void test_all_modules() {
40 final List<String> absoluteImplementsFilePath = Arrays.asList(
41 "src/test/resources/model-schema/annotation-registry-test/module1.yang",
42 "src/test/resources/model-schema/annotation-registry-test/module2.yang", YANG_METADATA_PATH,
44 final List<String> absoluteImportsFilePath = Collections.<String> emptyList();
46 parseAbsoluteYangModels(absoluteImplementsFilePath, absoluteImportsFilePath);
50 final AnnotationRegistry annotationRegistry = yangDeviceModel.getTopLevelSchema().getAnnotationRegistry();
52 final List<YangAnnotation> annotations = annotationRegistry.getAnnotations();
54 assertTrue(annotations.contains(new YangAnnotation("test:module1", "module1", "created")));
55 assertTrue(annotations.contains(new YangAnnotation("test:module1", "module1", "last-modified")));
57 assertTrue(annotations.contains(new YangAnnotation("test:module2", "module2", "modified-user")));
59 assertTrue(annotations.contains(new YangAnnotation("urn:ietf:params:xml:ns:yang:ietf-origin", "ietf-origin",
62 assertTrue(annotations.size() == 4);