X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tests%2Fhoneynode%2F1.2.1%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2FExiEncodeDecodeTest.java;fp=tests%2Fhoneynode%2F1.2.1%2Fnetconf-impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fimpl%2FExiEncodeDecodeTest.java;h=2fe0d5173cacce09349663f0505bd28b4edb38cd;hb=c764b14f67faf1665f8814db9e5d16ddb342553e;hp=0000000000000000000000000000000000000000;hpb=b90fdacec82f92e07d14ed1df31e3fe53275c676;p=transportpce.git diff --git a/tests/honeynode/1.2.1/netconf-impl/src/test/java/org/opendaylight/netconf/impl/ExiEncodeDecodeTest.java b/tests/honeynode/1.2.1/netconf-impl/src/test/java/org/opendaylight/netconf/impl/ExiEncodeDecodeTest.java new file mode 100644 index 000000000..2fe0d5173 --- /dev/null +++ b/tests/honeynode/1.2.1/netconf-impl/src/test/java/org/opendaylight/netconf/impl/ExiEncodeDecodeTest.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2013 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.netconf.impl; + +import static org.junit.Assert.assertNotNull; + +import org.junit.Test; +import org.opendaylight.netconf.api.NetconfMessage; +import org.opendaylight.netconf.util.test.XmlFileLoader; + +public class ExiEncodeDecodeTest { + @Test + public void encodeExi() throws Exception { + + String startExiString = XmlFileLoader.xmlFileToString("netconfMessages/startExi.xml"); + assertNotNull(startExiString); + + NetconfMessage startExiMessage = XmlFileLoader.xmlFileToNetconfMessage(("netconfMessages/startExi.xml")); + assertNotNull(startExiMessage); + + /* + ExiParameters exiParams = new ExiParameters(); + exiParams.setParametersFromXmlElement(XmlElement.fromDomElement(startExiMessage.getDocument() + .getDocumentElement())); + assertNotNull(exiParams); + + ByteBuf encodedBuf = Unpooled.buffer(); + ByteBuf sourceBuf = Unpooled.copiedBuffer(startExiString.getBytes()); + ExiUtil.encode(sourceBuf, encodedBuf, exiParams); + + List newOut = new ArrayList(); + ExiUtil.decode(encodedBuf, newOut, exiParams); + + ByteBuf decodedBuf = (ByteBuf)newOut.get(0); + String decodedString = new String(decodedBuf.array(),"UTF-8"); + assertNotNull(decodedString); + */ + } +}