2 * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.model.util;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertTrue;
14 import org.junit.jupiter.api.Test;
15 import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
16 import org.opendaylight.yangtools.yang.model.spi.SimpleSchemaContext;
17 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
21 void testGetAllModuleIdentifiers() {
22 final var foo = new SourceIdentifier("foo", "2016-01-01");
23 final var sub1Foo = new SourceIdentifier("sub1-foo", "2016-01-01");
24 final var sub2Foo = new SourceIdentifier("sub2-foo", "2016-01-01");
25 final var bar = new SourceIdentifier("bar", "2016-01-01");
26 final var sub1Bar = new SourceIdentifier("sub1-bar", "2016-01-01");
27 final var baz = new SourceIdentifier("baz", "2016-01-01");
28 final var context = YangParserTestUtils.parseYang("""
94 final var allModuleIdentifiers = SchemaContextUtil.getConstituentModuleIdentifiers(context);
95 assertEquals(6, allModuleIdentifiers.size());
96 final var allModuleIdentifiersResolved = SchemaContextUtil.getConstituentModuleIdentifiers(
97 SimpleSchemaContext.forModules(context.getModules()));
98 assertEquals(6, allModuleIdentifiersResolved.size());
99 assertEquals(allModuleIdentifiersResolved, allModuleIdentifiers);
100 assertEquals(Set.of(foo, sub1Foo, sub2Foo, bar, sub1Bar, baz), allModuleIdentifiers);
101 assertTrue(allModuleIdentifiers.contains(foo));