blob: 34678125b48307b1fe1f9f6af707e527bd4716a6 [file] [log] [blame]
Toshio Koided46b66d2014-07-21 10:27:27 -07001package net.onrc.onos.core.flowmanager;
2
3import static org.junit.Assert.assertEquals;
4import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy;
5
6import org.junit.After;
7import org.junit.Before;
8import org.junit.Rule;
9import org.junit.Test;
10import org.junit.rules.ExpectedException;
11
12public class FlowManagerModuleTest {
13 @Rule
14 public ExpectedException thrown = ExpectedException.none();
15
16 @Before
17 public void setUp() throws Exception {
18 }
19
20 @After
21 public void tearDown() throws Exception {
22 }
23
24 /**
25 * Checks the default conflict detection policy is the FREE policy, and
26 * the other policies are not supported.
27 */
28 @Test
29 public void testConflictDetectionPolicy() {
30 FlowManagerModule flowManager = new FlowManagerModule();
31 assertEquals(ConflictDetectionPolicy.FREE,
32 flowManager.getConflictDetectionPolicy());
33
34 flowManager.setConflictDetectionPolicy(ConflictDetectionPolicy.FREE);
35 assertEquals(ConflictDetectionPolicy.FREE,
36 flowManager.getConflictDetectionPolicy());
37
38 thrown.expect(UnsupportedOperationException.class);
39 thrown.expectMessage("LOOSE is not supported.");
40 flowManager.setConflictDetectionPolicy(ConflictDetectionPolicy.LOOSE);
41 assertEquals(ConflictDetectionPolicy.FREE,
42 flowManager.getConflictDetectionPolicy());
43
44 thrown.expect(UnsupportedOperationException.class);
45 thrown.expectMessage("STRICT is not supported.");
46 flowManager.setConflictDetectionPolicy(ConflictDetectionPolicy.STRICT);
47 assertEquals(ConflictDetectionPolicy.FREE,
48 flowManager.getConflictDetectionPolicy());
49 }
50
51}