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

index 6fce8d333ad49b28f7365c2c3dc8555432528c8c,4c551a60209fc09068b966f8af9e8f4fe8503cf3..9ffb8da1dd975fc6592e2b789e49e7f5492e0069
@@@ -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);
          }
index af19335389fb03dc5c78ecf51a5007205c2151c2,2b48f5d51c5877d6441a9052e75b5aae283ac2c2..f31233987e97531a563fca3f186fee480e6b6616
@@@ -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;