2 * Copyright (c) 2021 PANTHEON.tech, s.r.o. 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.stmt;
10 import static org.junit.Assert.assertEquals;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.junit.BeforeClass;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.common.Revision;
17 import org.opendaylight.yangtools.yang.common.XMLNamespace;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
19 import org.opendaylight.yangtools.yang.model.api.Module;
22 * Abstract base class for tests of the model context available in {@code src/test/resources/model}.
24 public abstract class AbstractModelTest extends AbstractYangTest {
25 private static final QNameModule FOO_NS =
26 QNameModule.create(XMLNamespace.of("urn:opendaylight.foo"), Revision.of("2013-02-27"));
27 private static final QNameModule BAR_NS =
28 QNameModule.create(XMLNamespace.of("urn:opendaylight.bar"), Revision.of("2013-07-03"));
29 private static final QNameModule BAZ_NS =
30 QNameModule.create(XMLNamespace.of("urn:opendaylight.baz"), Revision.of("2013-02-27"));
32 static EffectiveModelContext CTX;
38 public static void beforeClass() throws Exception {
39 CTX = assertEffectiveModelDir("/model");
40 assertEquals(3, CTX.getModules().size());
42 FOO = CTX.findModules("foo").iterator().next();
43 BAR = CTX.findModules("bar").iterator().next();
44 BAZ = CTX.findModules("baz").iterator().next();
47 static final @NonNull QName fooQName(final String localName) {
48 return QName.create(FOO_NS, localName);
51 static final @NonNull QName barQName(final String localName) {
52 return QName.create(BAR_NS, localName);
55 static final @NonNull QName bazQName(final String localName) {
56 return QName.create(BAZ_NS, localName);