Ray Milkey | 8f7feed | 2015-10-23 15:08:47 -0700 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
Ray Milkey | 8f7feed | 2015-10-23 15:08:47 -0700 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.net.packet; |
| 17 | |
| 18 | import org.junit.Test; |
| 19 | |
| 20 | import static org.hamcrest.MatcherAssert.assertThat; |
| 21 | import static org.hamcrest.Matchers.greaterThanOrEqualTo; |
| 22 | import static org.hamcrest.Matchers.lessThan; |
| 23 | |
| 24 | /** |
| 25 | * Unit tests for static APIs in the packet processor class. |
| 26 | */ |
| 27 | public class PacketProcessorTest { |
| 28 | |
| 29 | /** |
| 30 | * Tests a priority in the advisor range. |
| 31 | */ |
| 32 | @Test |
| 33 | public void testAdvisorPriorities() { |
| 34 | int advisorPriority = PacketProcessor.advisor(3); |
| 35 | assertThat(advisorPriority, lessThan(PacketProcessor.ADVISOR_MAX)); |
| 36 | assertThat(advisorPriority, greaterThanOrEqualTo(0)); |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Tests a priority in the director range. |
| 41 | */ |
| 42 | @Test |
| 43 | public void testDirectorPriorities() { |
| 44 | int directorPriority = PacketProcessor.director(3); |
| 45 | assertThat(directorPriority, lessThan(PacketProcessor.DIRECTOR_MAX)); |
| 46 | assertThat(directorPriority, greaterThanOrEqualTo(PacketProcessor.ADVISOR_MAX)); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Tests a priority in the observer range. |
| 51 | */ |
| 52 | @Test |
| 53 | public void testObserverPriorities() { |
| 54 | int observerPriority = PacketProcessor.observer(3); |
| 55 | assertThat(observerPriority, lessThan(PacketProcessor.OBSERVER_MAX)); |
| 56 | assertThat(observerPriority, greaterThanOrEqualTo(PacketProcessor.DIRECTOR_MAX)); |
| 57 | } |
| 58 | |
| 59 | } |