BGPCEP-710: Create Network Topology Loader
[bgpcep.git] / config-loader / bmp-monitors-config-loader / src / test / java / org / opendaylight / bgpcep / config / loader / bmp / BmpMonitorConfigFileProcessorTest.java
1 /*
2  * Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
3  *
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
7  */
8
9 package org.opendaylight.bgpcep.config.loader.bmp;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13 import static org.opendaylight.bgpcep.config.loader.bmp.BmpMonitorConfigFileProcessor.ODL_BMP_MONITORS_IID;
14 import static org.opendaylight.protocol.util.CheckUtil.checkNotPresentConfiguration;
15 import static org.opendaylight.protocol.util.CheckUtil.checkPresentConfiguration;
16
17 import org.junit.Before;
18 import org.junit.Test;
19 import org.opendaylight.bgpcep.config.loader.impl.AbstractConfigLoader;
20 import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.config.rev170517.OdlBmpMonitors;
22 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
23 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
24
25 public class BmpMonitorConfigFileProcessorTest extends AbstractConfigLoader {
26
27     @Override
28     @Before
29     public void setUp() throws Exception {
30         super.setUp();
31     }
32
33     @Override
34     protected void registerModules(final ModuleInfoBackedContext moduleInfoBackedContext) throws Exception {
35         moduleInfoBackedContext.registerModuleInfo(BindingReflections.getModuleInfo(OdlBmpMonitors.class));
36
37     }
38
39     @Test
40     public void configFileTest() throws Exception {
41         checkNotPresentConfiguration(getDataBroker(), ODL_BMP_MONITORS_IID);
42
43         assertNotNull(ClassLoader.getSystemClassLoader().getResource("initial/odl-bmp-monitors-config.xml"));
44         final BmpMonitorConfigFileProcessor processor = new BmpMonitorConfigFileProcessor(this.configLoader,
45                 getDataBroker());
46         processor.init();
47         checkPresentConfiguration(getDataBroker(), ODL_BMP_MONITORS_IID);
48
49         assertEquals(SchemaPath.create(true, OdlBmpMonitors.QNAME),
50                 processor.getSchemaPath());
51         processor.close();
52     }
53 }