2 * Copyright (c) 2016, 2017 Pantheon Technologies 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
9 package org.opendaylight.openflowplugin.applications.frm.impl;
11 import org.junit.Assert;
12 import org.junit.Before;
13 import org.junit.Test;
14 import org.junit.runner.RunWith;
15 import org.mockito.Mock;
16 import org.mockito.Mockito;
17 import org.mockito.runners.MockitoJUnitRunner;
18 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
19 import org.opendaylight.openflowplugin.applications.frm.FlowNodeReconciliation;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
23 * Test for {@link DeviceMastership}.
25 @RunWith(MockitoJUnitRunner.class)
26 public class DeviceMastershipTest {
27 private static final NodeId NODE_ID = new NodeId("testNode");
28 private DeviceMastership deviceMastership;
31 private DeviceMastershipManager deviceMastershipManager;
34 private FlowNodeReconciliation reconcliationAgent;
37 public void setUp() throws Exception {
38 deviceMastership = new DeviceMastership(NODE_ID, Mockito.mock(ClusterSingletonServiceProvider.class), reconcliationAgent);
42 public void testInstantiateServiceInstance() {
43 deviceMastership.instantiateServiceInstance();
44 Assert.assertTrue(deviceMastership.isDeviceMastered());
48 public void testCloseServiceInstance() {
49 deviceMastership.closeServiceInstance();
50 Assert.assertFalse(deviceMastership.isDeviceMastered());