JUnit JAXB tests for NeutronMeteringLabel, NeutronMeteringLabelRule and NeutronLoadBa...
[neutron.git] / neutron-spi / src / test / java / org / opendaylight / neutron / spi / NeutronMeteringLabelRuleJAXBTest.java
1 /*
2  * Copyright (C) 2015 IBM, Inc.
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 org.junit.Assert;
12 import org.junit.Test;
13
14 import org.opendaylight.neutron.spi.JaxbTestHelper;
15 import org.opendaylight.neutron.spi.NeutronMeteringLabelRule;
16
17 public class NeutronMeteringLabelRuleJAXBTest {
18
19     private static final String NeutronMeteringLabelRule_sourceJson = "{ "
20             + "\"metering_label_id\": \"e131d186-b02d-4c0b-83d5-0c0725c4f812\", "
21             + "\"remote_ip_prefix\": \"10.0.0.0/24\", " + "\"direction\": \"ingress\", " + "\"excluded\": false , "
22             + "\"id\": \"4e8e5957-649f-477b-9e5b-f1f75b21c03c\" }";
23
24     @Test
25     public void test_NeutronMeteringLabelRule_JAXB() {
26         NeutronMeteringLabelRule meteringObject = new NeutronMeteringLabelRule();
27         try {
28             NeutronMeteringLabelRule testObject = (NeutronMeteringLabelRule) JaxbTestHelper.jaxbUnmarshall(
29                     meteringObject, NeutronMeteringLabelRule_sourceJson);
30             Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 1: Testing metering_label_id failed",
31                     "e131d186-b02d-4c0b-83d5-0c0725c4f812", testObject.getMeteringLabelRuleLabelID());
32
33             Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 2: Testing remote_ip_prefix failed", "10.0.0.0/24",
34                     testObject.getMeteringLabelRuleRemoteIPPrefix());
35
36             Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 3: Testing direction failed", "ingress",
37                     testObject.getMeteringLabelRuleDirection());
38
39             Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 4: Testing excluded failed", false,
40                     testObject.getMeteringLabelRuleExcluded());
41
42             Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 5: Testing id failed",
43                     "4e8e5957-649f-477b-9e5b-f1f75b21c03c", testObject.getMeteringLabelRuleUUID());
44         } catch (Exception e) {
45             Assert.fail("Test failed");
46         }
47     }
48
49 }