Sean Condon | 0e89bda | 2017-03-21 14:23:19 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Foundation |
| 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.cfm.web; |
| 17 | |
| 18 | import static org.junit.Assert.assertEquals; |
| 19 | |
| 20 | import org.junit.Before; |
| 21 | import org.junit.Test; |
| 22 | import org.onosproject.cfm.CfmCodecContext; |
| 23 | import org.onosproject.incubator.net.l2monitoring.cfm.DefaultMepLbEntry; |
| 24 | import org.onosproject.incubator.net.l2monitoring.cfm.MepLbEntry; |
| 25 | |
| 26 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 27 | |
| 28 | public class MepLbEntryCodecTest { |
| 29 | ObjectMapper mapper; |
| 30 | CfmCodecContext context; |
| 31 | |
| 32 | @Before |
| 33 | public void setUp() throws Exception { |
| 34 | mapper = new ObjectMapper(); |
| 35 | context = new CfmCodecContext(); |
| 36 | } |
| 37 | |
| 38 | @Test |
| 39 | public void testEncodeMepLbEntryCodecContext() { |
| 40 | MepLbEntry mepLbEntry1 = DefaultMepLbEntry.builder() |
| 41 | .countLbrMacMisMatch(987654321L) |
| 42 | .countLbrReceived(987654322L) |
| 43 | .countLbrTransmitted(987654323L) |
| 44 | .countLbrValidInOrder(987654324L) |
| 45 | .countLbrValidOutOfOrder(987654325L) |
| 46 | .nextLbmIdentifier(987654326L) |
| 47 | .build(); |
| 48 | |
| 49 | assertEquals(987654321L, mepLbEntry1.countLbrMacMisMatch()); |
| 50 | assertEquals(987654322L, mepLbEntry1.countLbrReceived()); |
| 51 | assertEquals(987654323L, mepLbEntry1.countLbrTransmitted()); |
| 52 | assertEquals(987654324L, mepLbEntry1.countLbrValidInOrder()); |
| 53 | assertEquals(987654325L, mepLbEntry1.countLbrValidOutOfOrder()); |
| 54 | assertEquals(987654326L, mepLbEntry1.nextLbmIdentifier()); |
| 55 | } |
| 56 | |
| 57 | } |