Switch to MD-SAL APIs
[openflowplugin.git] / applications / forwardingrules-manager / src / test / java / org / opendaylight / openflowplugin / applications / frm / impl / DeviceMastershipTest.java
1 /*
2  * Copyright (c) 2016, 2017 Pantheon Technologies s.r.o. and others. 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 package org.opendaylight.openflowplugin.applications.frm.impl;
9
10 import org.junit.Assert;
11 import org.junit.Before;
12 import org.junit.Test;
13 import org.junit.runner.RunWith;
14 import org.mockito.junit.MockitoJUnitRunner;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
16
17 /**
18  * Test for {@link DeviceMastership}.
19  */
20 @RunWith(MockitoJUnitRunner.class)
21 public class DeviceMastershipTest {
22     private static final NodeId NODE_ID = new NodeId("testNode");
23     private DeviceMastership deviceMastership;
24
25     @Before
26     public void setUp() throws Exception {
27         deviceMastership = new DeviceMastership(NODE_ID);
28     }
29
30     @Test
31     public void testInstantiateServiceInstance() {
32         deviceMastership.instantiateServiceInstance();
33         Assert.assertTrue(deviceMastership.isDeviceMastered());
34     }
35
36     @Test
37     public void testCloseServiceInstance() {
38         deviceMastership.closeServiceInstance();
39         Assert.assertFalse(deviceMastership.isDeviceMastered());
40     }
41 }