X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-binding-broker%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Fbinding%2Ftest%2Fbugfix%2FUnionSerializationTest.java;h=9f8a443bbf7e37400683736c64d2a08fad2f13f8;hb=2903b4d426ed5c37930844b60a36d20149c67302;hp=2057619bfd398c07251e3fa41f7cdb290ccd6920;hpb=576aa6018e48dfca8f223b7ac929139a32135201;p=controller.git diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java index 2057619bfd..9f8a443bbf 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/UnionSerializationTest.java @@ -1,41 +1,41 @@ +/* + * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ package org.opendaylight.controller.sal.binding.test.bugfix; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import org.junit.Test; import org.opendaylight.controller.sal.binding.test.AbstractDataServiceTest; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpPrefix; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Prefix; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.Prefix; import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.nt.l3.unicast.igp.topology.rev131021.igp.node.attributes.igp.node.attributes.PrefixBuilder; -import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.CompositeNode; +public class UnionSerializationTest extends AbstractDataServiceTest { + public static final String PREFIX_STRING = "192.168.0.1/32"; - - - - -import static org.junit.Assert.*; - -public class UnionSerializationTest extends AbstractDataServiceTest { - - public static final String PREFIX_STRING = "192.168.0.1/32"; - - @Test public void testPrefixSerialization() throws Exception { - + Ipv4Prefix ipv4prefix = new Ipv4Prefix(PREFIX_STRING); IpPrefix ipPrefix = new IpPrefix(ipv4prefix); Prefix prefix = new PrefixBuilder().setPrefix(ipPrefix).build(); - + CompositeNode serialized = testContext.getBindingToDomMappingService().toDataDom(prefix); assertNotNull(serialized); assertNotNull(serialized.getFirstSimpleByName(Prefix.QNAME)); assertEquals(PREFIX_STRING, serialized.getFirstSimpleByName(Prefix.QNAME).getValue()); - - Prefix deserialized = (Prefix) testContext.getBindingToDomMappingService().dataObjectFromDataDom(InstanceIdentifier.builder().node(Prefix.class).build(), serialized); + + Prefix deserialized = (Prefix) testContext.getBindingToDomMappingService().dataObjectFromDataDom(Prefix.class, serialized); assertNotNull(deserialized); assertNotNull(deserialized.getPrefix()); assertNotNull(deserialized.getPrefix().getIpv4Prefix());