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.jupiter.api.Assertions.assertEquals;
12 import org.eclipse.jdt.annotation.NonNull;
13 import org.junit.jupiter.api.BeforeAll;
14 import org.opendaylight.yangtools.yang.common.QName;
15 import org.opendaylight.yangtools.yang.common.QNameModule;
16 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
17 import org.opendaylight.yangtools.yang.model.api.Module;
20 * Abstract base class for tests of the model context available in {@code src/test/resources/model}.
22 public abstract class AbstractModelTest extends AbstractYangTest {
23 private static final QNameModule FOO_NS = QNameModule.of("urn:opendaylight.foo", "2013-02-27");
24 private static final QNameModule BAR_NS = QNameModule.of("urn:opendaylight.bar", "2013-07-03");
25 private static final QNameModule BAZ_NS = QNameModule.of("urn:opendaylight.baz", "2013-02-27");
27 static EffectiveModelContext CTX;
33 static void beforeClass() throws Exception {
34 CTX = assertEffectiveModelDir("/model");
35 assertEquals(3, CTX.getModules().size());
37 FOO = CTX.findModules("foo").iterator().next();
38 BAR = CTX.findModules("bar").iterator().next();
39 BAZ = CTX.findModules("baz").iterator().next();
42 static final @NonNull QName fooQName(final String localName) {
43 return QName.create(FOO_NS, localName);
46 static final @NonNull QName barQName(final String localName) {
47 return QName.create(BAR_NS, localName);
50 static final @NonNull QName bazQName(final String localName) {
51 return QName.create(BAZ_NS, localName);