Merge "Bug 714 - Fixed creating DOM Document's element with namespace"
authorTony Tkacik <ttkacik@cisco.com>
Tue, 15 Apr 2014 10:40:30 +0000 (10:40 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 15 Apr 2014 10:40:30 +0000 (10:40 +0000)
1  2 
opendaylight/netconf/config-netconf-connector/src/test/java/org/opendaylight/controller/netconf/confignetconfconnector/NetconfMappingTest.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/NetconfServerSessionNegotiatorFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/netconf/impl/mapping/operations/DefaultCloseSession.java

@@@ -11,12 -11,15 +11,17 @@@ package org.opendaylight.controller.net
  import io.netty.channel.Channel;
  import io.netty.util.Timer;
  import io.netty.util.concurrent.Promise;
+ import java.io.InputStream;
+ import javax.xml.xpath.XPathConstants;
+ import javax.xml.xpath.XPathExpression;
  import org.opendaylight.controller.netconf.api.NetconfServerSessionPreferences;
  import org.opendaylight.controller.netconf.impl.mapping.CapabilityProvider;
 -import org.opendaylight.controller.netconf.impl.osgi.NetconfOperationServiceFactoryListener;
 +import org.opendaylight.controller.netconf.impl.osgi.SessionMonitoringService;
 +import org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider;
 +import org.opendaylight.controller.netconf.mapping.api.NetconfOperationServiceSnapshot;
  import org.opendaylight.controller.netconf.util.NetconfUtil;
  import org.opendaylight.controller.netconf.util.messages.NetconfHelloMessage;
  import org.opendaylight.controller.netconf.util.xml.XMLNetconfUtil;
@@@ -29,12 -32,9 +34,11 @@@ import org.w3c.dom.Document
  import org.w3c.dom.Element;
  import org.w3c.dom.Node;
  
- import javax.xml.xpath.XPathConstants;
- import javax.xml.xpath.XPathExpression;
- import java.io.InputStream;
+ import com.google.common.base.Optional;
+ import com.google.common.base.Preconditions;
  
 +import static org.opendaylight.controller.netconf.mapping.api.NetconfOperationProvider.NetconfOperationProviderUtil.getNetconfSessionIdForReporting;
 +
  public class NetconfServerSessionNegotiatorFactory implements SessionNegotiatorFactory<NetconfHelloMessage, NetconfServerSession, NetconfServerSessionListener> {
  
      public static final String SERVER_HELLO_XML_LOCATION = "/server_hello.xml";
          final Element capabilitiesElement = (Element) XmlUtil.evaluateXPath(capabilitiesXPath, helloMessageTemplate,
                  XPathConstants.NODE);
  
 -        CapabilityProvider capabilityProvider = new CapabilityProviderImpl(factoriesListener.getSnapshot(sessionId));
 -
          for (String capability : capabilityProvider.getCapabilities()) {
-             final Element capabilityElement = helloMessageTemplate.createElement(XmlNetconfConstants.CAPABILITY);
+             final Element capabilityElement = XmlUtil.createElement(helloMessageTemplate, XmlNetconfConstants.CAPABILITY, Optional.<String>absent());
              capabilityElement.setTextContent(capability);
              capabilitiesElement.appendChild(capabilityElement);
          }
@@@ -15,8 -18,8 +16,10 @@@ import org.opendaylight.controller.netc
  import org.w3c.dom.Document;
  import org.w3c.dom.Element;
  
+ import com.google.common.base.Optional;
 +import java.util.Collections;
 +
  public class DefaultCloseSession extends AbstractSingletonNetconfOperation {
      public static final String CLOSE_SESSION = "close-session";
      private final AutoCloseable sessionResources;

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.