Toshio Koide | d46b66d | 2014-07-21 10:27:27 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.flowmanager; |
| 2 | |
| 3 | import static org.junit.Assert.assertEquals; |
| 4 | import net.onrc.onos.api.flowmanager.ConflictDetectionPolicy; |
| 5 | |
| 6 | import org.junit.After; |
| 7 | import org.junit.Before; |
| 8 | import org.junit.Rule; |
| 9 | import org.junit.Test; |
| 10 | import org.junit.rules.ExpectedException; |
| 11 | |
| 12 | public 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 | } |