2 * Copyright (C) 2015 IBM, Inc.
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 org.junit.Assert;
12 import org.junit.Test;
14 import org.opendaylight.neutron.spi.JaxbTestHelper;
15 import org.opendaylight.neutron.spi.NeutronMeteringLabelRule;
17 public class NeutronMeteringLabelRuleJAXBTest {
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\" }";
25 public void test_NeutronMeteringLabelRule_JAXB() {
26 NeutronMeteringLabelRule meteringObject = new NeutronMeteringLabelRule();
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());
33 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 2: Testing remote_ip_prefix failed", "10.0.0.0/24",
34 testObject.getMeteringLabelRuleRemoteIPPrefix());
36 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 3: Testing direction failed", "ingress",
37 testObject.getMeteringLabelRuleDirection());
39 Assert.assertEquals("NeutronMeteringLabelRule JAXB Test 4: Testing excluded failed", false,
40 testObject.getMeteringLabelRuleExcluded());
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");