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.runners.MockitoJUnitRunner;
17 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
21 * Test for {@link DeviceMastership}.
23 @RunWith(MockitoJUnitRunner.class)
24 public class DeviceMastershipTest {
25 private static final NodeId NODE_ID = new NodeId("testNode");
26 private DeviceMastership deviceMastership;
28 private RoutedRpcRegistration routedRpcRegistration;
31 public void setUp() throws Exception {
32 deviceMastership = new DeviceMastership(NODE_ID, routedRpcRegistration);
36 public void testInstantiateServiceInstance() {
37 deviceMastership.instantiateServiceInstance();
38 Assert.assertTrue(deviceMastership.isDeviceMastered());
42 public void testCloseServiceInstance() {
43 deviceMastership.closeServiceInstance();
44 Assert.assertFalse(deviceMastership.isDeviceMastered());