2 * Copyright (c) 2014 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 test.mock.util;
10 import org.junit.Before;
11 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
12 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
13 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 public abstract class AbstractSchemaAwareTest {
18 private Iterable<YangModuleInfo> moduleInfos;
19 private SchemaContext schemaContext;
22 protected Iterable<YangModuleInfo> getModuleInfos() {
23 return BindingReflections.loadModuleInfos();
28 public final void setup() {
29 moduleInfos = getModuleInfos();
30 ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
31 moduleContext.addModuleInfos(moduleInfos);
32 schemaContext = moduleContext.tryToCreateSchemaContext().get();
33 setupWithSchema(schemaContext);
37 * Setups test with Schema context.
38 * This method is called before {@link #setupWithSchemaService(SchemaService)}
42 protected abstract void setupWithSchema(SchemaContext context);