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.bgpcep.config.loader.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.doNothing;
14 import org.junit.Before;
15 import org.mockito.Mock;
16 import org.mockito.MockitoAnnotations;
17 import org.opendaylight.bgpcep.config.loader.spi.ConfigFileProcessor;
18 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
19 import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractDataBrokerTestCustomizer;
20 import org.opendaylight.mdsal.dom.api.DOMSchemaService;
22 public abstract class AbstractConfigLoaderTest extends AbstractConcurrentDataBrokerTest {
23 protected final class TestConfigLoader extends AbstractConfigLoader {
26 return new File(getResourceFolder());
29 public void triggerEvent(final String filename) {
30 handleEvent(filename);
34 protected final TestConfigLoader configLoader = new TestConfigLoader();
37 ConfigFileProcessor processor;
38 protected DOMSchemaService schemaService;
40 public AbstractConfigLoaderTest() {
45 public void setUp() throws Exception {
46 MockitoAnnotations.initMocks(this);
47 doNothing().when(processor).loadConfiguration(any());
48 configLoader.updateModelContext(modelContext());
52 protected AbstractDataBrokerTestCustomizer createDataBrokerTestCustomizer() {
53 final var customizer = super.createDataBrokerTestCustomizer();
54 schemaService = customizer.getSchemaService();
58 protected String getResourceFolder() {
59 return ClassLoader.getSystemClassLoader().getResource("initial").getPath();