e792ae89708f26dbf6c9718ca47e86938bfa236f
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronMeteringLabelRuleJAXBTest.java
1 /*
2  * Copyright (c) 2015 Tata Consultancy Services.  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
9 package org.opendaylight.neutron.spi;
10
11 import javax.xml.bind.JAXBException;
12 import org.junit.Assert;
13 import org.junit.Test;
14
15 public class NeutronMeteringLabelRuleJAXBTest {
16
17     private static final String NeutronMeteringLabelRule_sourceJson = "{ "
18             + "\"metering_label_id\": \"e131d186-b02d-4c0b-83d5-0c0725c4f812\", "
19             + "\"remote_ip_prefix\": \"10.0.0.0/24\", " + "\"direction\": \"ingress\", " + "\"excluded\": false , "
20             + "\"id\": \"4e8e5957-649f-477b-9e5b-f1f75b21c03c\" }";
21
22     @Test
23     public void test_NeutronMeteringLabelRule_JAXB()  throws JAXBException {
24         NeutronMeteringLabelRule meteringObject = new NeutronMeteringLabelRule();
25
26         NeutronMeteringLabelRule testObject = (NeutronMeteringLabelRule) JaxbTestHelper
27                 .jaxbUnmarshall(meteringObject, NeutronMeteringLabelRule_sourceJson);
28         Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 1: Testing metering_label_id failed",
29                 "e131d186-b02d-4c0b-83d5-0c0725c4f812", testObject.getMeteringLabelRuleLabelID());
30
31         Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 2: Testing remote_ip_prefix failed", "10.0.0.0/24",
32                 testObject.getMeteringLabelRuleRemoteIPPrefix());
33
34         Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 3: Testing direction failed", "ingress",
35                 testObject.getMeteringLabelRuleDirection());
36
37         Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 4: Testing excluded failed", false,
38                 testObject.getMeteringLabelRuleExcluded());
39
40         Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 5: Testing id failed",
41                 "4e8e5957-649f-477b-9e5b-f1f75b21c03c", testObject.getID());
42     }
43 }