2 * Copyright (c) 2015 Tata Consultancy Services. All rights reserved.
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
9 package org.opendaylight.neutron.spi;
11 import javax.xml.bind.JAXBException;
12 import org.junit.Assert;
13 import org.junit.Test;
15 public class NeutronMeteringLabelRuleJAXBTest {
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\" }";
23 public void test_NeutronMeteringLabelRule_JAXB() throws JAXBException {
24 NeutronMeteringLabelRule meteringObject = new NeutronMeteringLabelRule();
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());
31 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 2: Testing remote_ip_prefix failed", "10.0.0.0/24",
32 testObject.getMeteringLabelRuleRemoteIPPrefix());
34 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 3: Testing direction failed", "ingress",
35 testObject.getMeteringLabelRuleDirection());
37 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 4: Testing excluded failed", false,
38 testObject.getMeteringLabelRuleExcluded());
40 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 5: Testing id failed",
41 "4e8e5957-649f-477b-9e5b-f1f75b21c03c", testObject.getID());