/* * Copyright (c) 2015 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.netconf.notifications.impl.ops; import com.google.common.collect.Lists; import java.io.IOException; import org.junit.Test; import org.opendaylight.controller.netconf.util.xml.XmlUtil; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netconf.notification._1._0.rev080714.StreamNameType; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.Streams; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.StreamsBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamBuilder; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.netmod.notification.rev080714.netconf.streams.StreamKey; import org.w3c.dom.Document; import org.xml.sax.SAXException; public class GetTest { @Test public void testSerializeStreamsSubtree() throws Exception { final StreamsBuilder streamsBuilder = new StreamsBuilder(); final StreamBuilder streamBuilder = new StreamBuilder(); final StreamNameType base = new StreamNameType("base"); streamBuilder.setName(base); streamBuilder.setKey(new StreamKey(base)); streamBuilder.setDescription("description"); streamBuilder.setReplaySupport(false); streamsBuilder.setStream(Lists.newArrayList(streamBuilder.build())); final Streams streams = streamsBuilder.build(); final Document response = getBlankResponse(); Get.serializeStreamsSubtree(response, streams); NotificationsTransformUtilTest.compareXml(XmlUtil.toString(response), "\n" + "\n" + "\n" + "\n" + "\n" + "base\n" + "description\n" + "false\n" + "\n" + "\n" + "\n" + "\n" + "\n"); } private Document getBlankResponse() throws IOException, SAXException { return XmlUtil.readXmlToDocument("\n" + "\n" + "\n" + ""); } }