2 * Copyright (c) 2020 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.mdsal.dom.schema.osgi.impl;
10 import static org.mockito.ArgumentMatchers.any;
11 import static org.mockito.Mockito.doNothing;
12 import static org.mockito.Mockito.doReturn;
13 import static org.mockito.Mockito.verifyNoMoreInteractions;
15 import org.junit.After;
16 import org.junit.Before;
17 import org.junit.Test;
18 import org.junit.runner.RunWith;
19 import org.mockito.Mock;
20 import org.mockito.junit.MockitoJUnitRunner;
21 import org.opendaylight.yangtools.yang.model.parser.api.YangParserFactory;
22 import org.osgi.framework.Bundle;
23 import org.osgi.framework.BundleContext;
24 import org.osgi.service.component.ComponentFactory;
26 @RunWith(MockitoJUnitRunner.StrictStubs.class)
27 public class OSGiModelRuntimeTest {
29 private YangParserFactory parserFactory;
31 private ComponentFactory contextFactory;
33 private BundleContext bundleContext;
35 private OSGiModelRuntime target;
38 public void before() {
39 target = new OSGiModelRuntime();
40 target.parserFactory = parserFactory;
41 target.contextFactory = contextFactory;
46 verifyNoMoreInteractions(parserFactory);
47 verifyNoMoreInteractions(contextFactory);
48 verifyNoMoreInteractions(bundleContext);
52 public void testActivate() {
53 doReturn(new Bundle[0]).when(bundleContext).getBundles();
54 doNothing().when(bundleContext).addBundleListener(any());
55 target.activate(bundleContext);
59 public void testDeactivate() {
61 doNothing().when(bundleContext).removeBundleListener(any());