Migrate NetconfHelloMessage's use of Optional 40/79240/8
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 4 Jan 2019 16:14:52 +0000 (17:14 +0100)
committerJakub Morvay <jmorvay@frinx.io>
Mon, 7 Jan 2019 15:58:52 +0000 (16:58 +0100)
Use java.util.Optional, cascading that to all users.

Change-Id: I3ba97d060c8ea564bec378285bf6d8dbdb6a59d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
56 files changed:
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/NetconfCallHomeServerBuilder.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractConfigOperation.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/Commit.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfig.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/DiscardChanges.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/Lock.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/RuntimeRpc.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/Unlock.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/Validate.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/get/AbstractGet.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/get/FilterContentValidator.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/get/Get.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/get/GetConfig.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSource.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/messages/NetconfHelloMessage.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/monitoring/NetconfMonitoringService.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/xml/XmlElement.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/xml/XmlUtil.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/messages/NetconfHelloMessageTest.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/xml/XmlElementTest.java
netconf/netconf-api/src/test/java/org/opendaylight/netconf/api/xml/XmlUtilTest.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorFactory.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/conf/NetconfClientConfiguration.java
netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientConfigurationTest.java
netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorFactoryTest.java
netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiatorTest.java
netconf/netconf-client/src/test/java/org/opendaylight/netconf/client/NetconfReconnectingClientConfigurationTest.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/mapping/operations/DefaultCloseSession.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfMonitoringServiceImpl.java
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfSessionMonitoringService.java
netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringServiceTest.java
netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/osgi/NetconfSessionMonitoringServiceTest.java
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/GetSchema.java
netconf/netconf-monitoring/src/test/java/org/opendaylight/netconf/monitoring/GetSchemaTest.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfHelloMessageToXMLEncoder.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionNegotiatorTest.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/AbstractNetconfSessionTest.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/Netconf539Test.java
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/CreateSubscription.java
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/mapping/AbstractNetconfOperation.java
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageUtil.java
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/SubtreeFilter.java
netconf/netconf-util/src/test/java/org/opendaylight/netconf/util/messages/SubtreeFilterNotificationTest.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfMessageTransformUtil.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/DummyMonitoringService.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedCommit.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedCreateSubscription.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedDiscardChanges.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedEditConfig.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGet.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGetConfig.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedLock.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedUnLock.java

index 73d4c5b473538ad46a58aa4d6bcf7e5c40c7e066..c915ade8a33a44ab5334ef9502690c634a9b6366 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.netconf.callhome.protocol;
 
-import com.google.common.base.Optional;
 import io.netty.channel.DefaultEventLoopGroup;
 import io.netty.channel.EventLoopGroup;
 import io.netty.util.HashedWheelTimer;
 import java.net.InetSocketAddress;
+import java.util.Optional;
 import java.util.concurrent.TimeUnit;
 import org.apache.sshd.client.SshClient;
 import org.opendaylight.netconf.callhome.protocol.CallHomeSessionContext.Factory;
@@ -112,7 +112,7 @@ public class NetconfCallHomeServerBuilder implements Builder<NetconfCallHomeServ
 
     private static NetconfClientSessionNegotiatorFactory defaultNegotiationFactory() {
         return new NetconfClientSessionNegotiatorFactory(new HashedWheelTimer(),
-                                                         Optional.absent(), DEFAULT_SESSION_TIMEOUT_MILLIS);
+                                                         Optional.empty(), DEFAULT_SESSION_TIMEOUT_MILLIS);
     }
 
     private static EventLoopGroup defaultNettyGroup() {
index 9a57a2ecad0d49d2570925f4d48e359d60b154e1..9e3989cc4996cafa8658605089c850fc53a16cdc 100644 (file)
@@ -5,12 +5,10 @@
  * 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.mdsal.connector.ops;
 
 import static java.nio.charset.StandardCharsets.UTF_8;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import java.io.IOException;
 import java.io.InputStream;
@@ -19,6 +17,7 @@ import java.net.URL;
 import java.net.URLConnection;
 import java.net.URLStreamHandler;
 import java.util.Base64;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -56,19 +55,19 @@ abstract class AbstractConfigOperation extends AbstractSingletonNetconfOperation
         final Optional<XmlElement> configElement = parent.getOnlyChildElementOptionally(CONFIG_KEY);
         if (configElement.isPresent()) {
             return configElement.get();
-        } else {
-            final Optional<XmlElement> urlElement = parent.getOnlyChildElementOptionally(URL_KEY);
-            if (!urlElement.isPresent()) {
-                throw new DocumentedException("Invalid RPC, neither <config> not <url> element is present",
-                    DocumentedException.ErrorType.PROTOCOL,
-                    DocumentedException.ErrorTag.MISSING_ELEMENT,
-                    DocumentedException.ErrorSeverity.ERROR);
-            }
+        }
 
-            final Document document = getDocumentFromUrl(urlElement.get().getTextContent());
-            return XmlElement.fromDomElementWithExpected(document.getDocumentElement(), CONFIG_KEY,
-                XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
+        final Optional<XmlElement> urlElement = parent.getOnlyChildElementOptionally(URL_KEY);
+        if (!urlElement.isPresent()) {
+            throw new DocumentedException("Invalid RPC, neither <config> not <url> element is present",
+                DocumentedException.ErrorType.PROTOCOL,
+                DocumentedException.ErrorTag.MISSING_ELEMENT,
+                DocumentedException.ErrorSeverity.ERROR);
         }
+
+        final Document document = getDocumentFromUrl(urlElement.get().getTextContent());
+        return XmlElement.fromDomElementWithExpected(document.getDocumentElement(), CONFIG_KEY,
+            XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
     }
 
     /**
index 38a24ae79ec37d545492405af63daeaf24c2bba2..4f71ac89c07600db47496bff7e4e0740bc58810b 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -42,12 +40,11 @@ public class Commit extends AbstractSingletonNetconfOperation {
         boolean commitStatus = transactionProvider.commitTransaction();
         LOG.trace("Commit completed successfully {}", commitStatus);
 
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
     protected String getOperationName() {
         return OPERATION_NAME;
     }
-
 }
index c249a44391c9cd32ccc44d22b5b5cf9f2ce79134..a06dbf82a21be393f229d6ee93d3a249145973a8 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.mdsal.connector.ops;
 
 import static org.opendaylight.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0;
 
-import com.google.common.base.Optional;
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -18,6 +17,7 @@ import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
@@ -93,7 +93,7 @@ public final class CopyConfig extends AbstractEdit {
                 ErrorTag.BAD_ELEMENT,
                 ErrorSeverity.ERROR);
         }
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     private void copyToCandidate(final XmlElement operationElement)
index 3e90745d334643bf9145380c621d39ef8245aac2..3ec15d473db0f9d8401a248766a87892eb5ba89b 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import java.util.HashMap;
 import java.util.Map;
 import org.opendaylight.netconf.api.DocumentedException;
@@ -53,7 +51,7 @@ public class DiscardChanges extends AbstractSingletonNetconfOperation {
             throw new DocumentedException(e.getMessage(), e, ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED,
                     ErrorSeverity.ERROR, errorInfo);
         }
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index 7fcb1511059de0f3222b33e0386445815390ee66..dc107b8f65b0eefca045b245469460ba045eb030 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.List;
 import java.util.ListIterator;
@@ -82,7 +81,7 @@ public final class EditConfig extends AbstractEdit {
             executeOperations(changeTracker);
         }
 
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     private void executeOperations(final DataTreeChangeTracker changeTracker) throws DocumentedException {
index e1a6ff10c0fa947e7e319aaf9bb7ed03474e12d6..4c0554a3581972ce02613ea1e3b0ec32864c4861 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -40,7 +38,7 @@ public class Lock extends AbstractSingletonNetconfOperation {
         final Datastore targetDatastore = extractTargetParameter(operationElement);
         if (targetDatastore == Datastore.candidate) {
             LOG.debug("Locking candidate datastore on session: {}", getNetconfSessionIdForReporting());
-            return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+            return XmlUtil.createElement(document, XmlNetconfConstants.OK);
         }
 
         throw new DocumentedException("Unable to lock " + targetDatastore + " datastore",
index 52449dfcc1b05cd7d552f9db9d5374110d1df31c..5f304d24d4f7f7064ab749e4a6be4086e1609414 100644 (file)
@@ -7,12 +7,12 @@
  */
 package org.opendaylight.netconf.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import java.io.IOException;
 import java.net.URI;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import javax.annotation.Nullable;
 import javax.xml.stream.XMLOutputFactory;
@@ -103,7 +103,7 @@ public class RuntimeRpc extends AbstractSingletonNetconfOperation {
 
     //this returns module with the newest revision if more then 1 module with same namespace is found
     private Optional<Module> getModule(final URI namespaceURI) {
-        return Optional.fromJavaUtil(schemaContext.getCurrentContext().findModules(namespaceURI).stream().findFirst());
+        return schemaContext.getCurrentContext().findModules(namespaceURI).stream().findFirst();
     }
 
     private static Optional<RpcDefinition> getRpcDefinitionFromModule(final Module module, final URI namespaceURI,
@@ -114,7 +114,7 @@ public class RuntimeRpc extends AbstractSingletonNetconfOperation {
                 return Optional.of(rpcDef);
             }
         }
-        return Optional.absent();
+        return Optional.empty();
     }
 
     @Override
index ed3e0b1ebc77888ec97f4174da33b84863f8b6b3..00e7506bc5f68d7f0f4c5a201aff9529df01be96 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -39,7 +37,7 @@ public class Unlock extends AbstractSingletonNetconfOperation {
         final Datastore targetDatastore = Lock.extractTargetParameter(operationElement);
         if (targetDatastore == Datastore.candidate) {
             LOG.debug("Unlocking candidate datastore on session: {}", getNetconfSessionIdForReporting());
-            return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+            return XmlUtil.createElement(document, XmlNetconfConstants.OK);
         }
 
         throw new DocumentedException("Unable to unlock " + targetDatastore + " datastore",
index 4792dd7b31ad3421e3bd99796265641fe6bd3e6c..df1657b5bf51ea6cbae4927999dee57941a18f14 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mdsal.connector.ops;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import java.util.Map;
 import org.opendaylight.netconf.api.DocumentedException;
@@ -50,7 +48,7 @@ public final class Validate extends AbstractConfigOperation {
 
         transactionProvider.validateTransaction();
         LOG.trace("<validate> request completed successfully on session {}", getNetconfSessionIdForReporting());
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     protected static Datastore extractSourceParameter(final XmlElement operationElement, final String operationName)
index 6ce25640eacac864ad1762c3de5e9420fc3a7419..8eaef5545191261dbc535e08036444a56acb975f 100644 (file)
@@ -8,9 +8,9 @@
 package org.opendaylight.netconf.mdsal.connector.ops.get;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
 import com.google.common.collect.Iterables;
 import java.io.IOException;
+import java.util.Optional;
 import javax.xml.stream.XMLOutputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
@@ -127,7 +127,7 @@ public abstract class AbstractGet extends AbstractSingletonNetconfOperation {
         final Optional<XmlElement> filterElement = operationElement.getOnlyChildElementOptionally(FILTER);
         if (filterElement.isPresent()) {
             if (filterElement.get().getChildElements().size() == 0) {
-                return Optional.absent();
+                return Optional.empty();
             }
             return Optional.of(getInstanceIdentifierFromFilter(filterElement.get()));
         }
@@ -177,10 +177,9 @@ public abstract class AbstractGet extends AbstractSingletonNetconfOperation {
         private static Optional<Datastore> parseSource(final XmlElement xml) throws DocumentedException {
             final Optional<XmlElement> sourceElement = xml.getOnlyChildElementOptionally(XmlNetconfConstants.SOURCE_KEY,
                     XmlNetconfConstants.URN_IETF_PARAMS_XML_NS_NETCONF_BASE_1_0);
-
             return sourceElement.isPresent()
                     ? Optional.of(Datastore.valueOf(sourceElement.get().getOnlyChildElement().getName()))
-                    : Optional.absent();
+                    : Optional.empty();
         }
 
         private static void validateInputRpc(final XmlElement xml, final String operationName) throws
index 1c88362cee70cddf9ebc63e64a86e628841be54d..dd1c41ebc9016e27eef0b59aa7d70de3b27c3567 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.mdsal.connector.ops.get;
 
 import static org.opendaylight.yangtools.yang.data.util.ParserStreamUtils.findSchemaNodeByNameAndNamespace;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -20,6 +19,7 @@ import java.util.Deque;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import javax.xml.namespace.NamespaceContext;
 import javax.xml.stream.XMLStreamWriter;
 import org.opendaylight.netconf.api.DocumentedException;
index b7f0b2bf0092495b8f19a4c2cd17f5789ee5f1b7..8dadc6bec1e59deac8e1df78719f9a215a7019b2 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.netconf.mdsal.connector.ops.get;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
@@ -47,7 +47,7 @@ public class Get extends AbstractGet {
 
         final Optional<YangInstanceIdentifier> dataRootOptional = getDataRootFromFilter(operationElement);
         if (!dataRootOptional.isPresent()) {
-            return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+            return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
         }
 
         final YangInstanceIdentifier dataRoot = dataRootOptional.get();
@@ -59,7 +59,7 @@ public class Get extends AbstractGet {
             transactionProvider.abortRunningTransaction(rwTx);
 
             if (!normalizedNodeOptional.isPresent()) {
-                return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+                return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
             }
 
             return serializeNodeWithParentStructure(document, dataRoot, normalizedNodeOptional.get());
index 4cce7ac2c0b1576c1b7002589cae7d352b32b1dd..b23473da545c119cd9bb4cf28c4c8e1d156d246f 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.netconf.mdsal.connector.ops.get;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
+import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.mdsal.dom.api.DOMDataTreeReadWriteTransaction;
@@ -56,7 +56,7 @@ public class GetConfig extends AbstractGet {
 
         final Optional<YangInstanceIdentifier> dataRootOptional = getDataRootFromFilter(operationElement);
         if (!dataRootOptional.isPresent()) {
-            return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+            return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
         }
 
         final YangInstanceIdentifier dataRoot = dataRootOptional.get();
@@ -73,7 +73,7 @@ public class GetConfig extends AbstractGet {
             }
 
             if (!normalizedNodeOptional.isPresent()) {
-                return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+                return XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
             }
 
             return serializeNodeWithParentStructure(document, dataRoot, normalizedNodeOptional.get());
index 849c0de8d86af4f08e9042f7d5739825639d1e82..c4f8d406d748aa55f1f8d795bb32586135619a1f 100644 (file)
@@ -5,12 +5,10 @@
  * 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.messagebus.eventsources.netconf;
 
 import static com.google.common.util.concurrent.Futures.immediateFuture;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Maps;
@@ -25,6 +23,7 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.regex.Pattern;
index 349a57a64d2aa90badc498de134ec9705cb9f229..d46336a96296cc255299edad1cd9361c7c694466 100644 (file)
@@ -5,11 +5,10 @@
  * 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.api.messages;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.Sets;
+import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.xml.XmlElement;
@@ -41,7 +40,7 @@ public final class NetconfHelloMessage extends NetconfMessage {
     }
 
     public Optional<NetconfHelloMessageAdditionalHeader> getAdditionalHeader() {
-        return Optional.fromNullable(additionalHeader);
+        return Optional.ofNullable(additionalHeader);
     }
 
     private static void checkHelloMessage(final Document doc) {
@@ -54,7 +53,7 @@ public final class NetconfHelloMessage extends NetconfMessage {
 
     public static NetconfHelloMessage createClientHello(final Iterable<String> capabilities,
             final Optional<NetconfHelloMessageAdditionalHeader> additionalHeaderOptional) {
-        return new NetconfHelloMessage(createHelloMessageDoc(capabilities), additionalHeaderOptional.orNull());
+        return new NetconfHelloMessage(createHelloMessageDoc(capabilities), additionalHeaderOptional.orElse(null));
     }
 
     private static Document createHelloMessageDoc(final Iterable<String> capabilities) {
index 03d1d36e1b77b586e6b707d75f050f6827f29612..493052bb5013bc926ef9566bdce893ea2f03606b 100644 (file)
@@ -7,8 +7,8 @@
  */
 package org.opendaylight.netconf.api.monitoring;
 
-import com.google.common.base.Optional;
 import java.util.Collection;
+import java.util.Optional;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Capabilities;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Sessions;
index c04fda11ac240f862a82c09cb43e2de3e552a69e..039a45ed613619386158962c4eaad5458e39e70e 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.api.xml;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Strings;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
@@ -18,6 +17,7 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -234,7 +234,7 @@ public final class XmlElement {
     public Optional<XmlElement> getOnlyChildElementOptionally(final String childName) {
         List<XmlElement> nameElements = getChildElements(childName);
         if (nameElements.size() != 1) {
-            return Optional.absent();
+            return Optional.empty();
         }
         return Optional.of(nameElements.get(0));
     }
@@ -244,7 +244,7 @@ public final class XmlElement {
         children = Lists.newArrayList(Collections2.filter(children,
             xmlElement -> xmlElement.getName().equals(childName)));
         if (children.size() != 1) {
-            return Optional.absent();
+            return Optional.empty();
         }
         return Optional.of(children.get(0));
     }
@@ -252,7 +252,7 @@ public final class XmlElement {
     public Optional<XmlElement> getOnlyChildElementOptionally() {
         List<XmlElement> children = getChildElements();
         if (children.size() != 1) {
-            return Optional.absent();
+            return Optional.empty();
         }
         return Optional.of(children.get(0));
     }
@@ -274,11 +274,11 @@ public final class XmlElement {
             children = Lists.newArrayList(Collections2.filter(children,
                 xmlElement -> xmlElement.getName().equals(childName)));
             if (children.size() != 1) {
-                return Optional.absent();
+                return Optional.empty();
             }
             return Optional.of(children.get(0));
         }
-        return Optional.absent();
+        return Optional.empty();
     }
 
     public Optional<XmlElement> getOnlyChildElementWithSameNamespaceOptionally() {
@@ -289,7 +289,7 @@ public final class XmlElement {
                 && getNamespaceOptionally().get().equals(child.get().getNamespaceOptionally().get())) {
             return child;
         }
-        return Optional.absent();
+        return Optional.empty();
     }
 
     public XmlElement getOnlyChildElement(final String childName, final String namespace) throws DocumentedException {
@@ -357,7 +357,7 @@ public final class XmlElement {
                 return Optional.of(((Text) item).getWholeText());
             }
         }
-        return Optional.absent();
+        return Optional.empty();
     }
 
     public String getNamespaceAttribute() throws MissingNameSpaceException {
@@ -375,7 +375,7 @@ public final class XmlElement {
     public Optional<String> getNamespaceAttributeOptionally() {
         String attribute = element.getAttribute(XmlUtil.XMLNS_ATTRIBUTE_KEY);
         if (attribute.isEmpty() || attribute.equals(DEFAULT_NAMESPACE_PREFIX)) {
-            return Optional.absent();
+            return Optional.empty();
         }
         return Optional.of(attribute);
     }
@@ -383,7 +383,7 @@ public final class XmlElement {
     public Optional<String> getNamespaceOptionally() {
         String namespaceURI = element.getNamespaceURI();
         if (Strings.isNullOrEmpty(namespaceURI)) {
-            return Optional.absent();
+            return Optional.empty();
         } else {
             return Optional.of(namespaceURI);
         }
index d6d9f82f8a0f911ab1e0a6e4ce22f88474ee3391..458d4e4965a44d2dcdee555390310625bad8025c 100644 (file)
@@ -5,10 +5,8 @@
  * 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.api.xml;
 
-import com.google.common.base.Optional;
 import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -16,6 +14,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.StringWriter;
 import java.nio.charset.StandardCharsets;
+import java.util.Optional;
 import javax.xml.XMLConstants;
 import javax.xml.namespace.QName;
 import javax.xml.parsers.DocumentBuilder;
@@ -120,10 +119,14 @@ public final class XmlUtil {
         return DEFAULT_DOM_BUILDER.get().newDocument();
     }
 
-    public static Element createElement(final Document document, final String qmame,
+    public static Element createElement(final Document document, final String qname) {
+        return createElement(document, qname, Optional.empty());
+    }
+
+    public static Element createElement(final Document document, final String qname,
             final Optional<String> namespaceURI) {
         if (namespaceURI.isPresent()) {
-            final Element element = document.createElementNS(namespaceURI.get(), qmame);
+            final Element element = document.createElementNS(namespaceURI.get(), qname);
             String name = XMLNS_ATTRIBUTE_KEY;
             if (element.getPrefix() != null) {
                 name += ":" + element.getPrefix();
@@ -131,7 +134,7 @@ public final class XmlUtil {
             element.setAttributeNS(XMLNS_URI, name, namespaceURI.get());
             return element;
         }
-        return document.createElement(qmame);
+        return document.createElement(qname);
     }
 
     public static Element createTextElement(final Document document, final String qname, final String content,
@@ -145,7 +148,7 @@ public final class XmlUtil {
             final String prefix, final String namespace, final String contentWithoutPrefix) {
 
         return createTextElementWithNamespacedContent(document, qname, prefix, namespace, contentWithoutPrefix,
-                Optional.absent());
+                Optional.empty());
     }
 
     public static Element createTextElementWithNamespacedContent(final Document document, final String qname,
index 8d5107dc5f65efe7b708208773d7f00d1c312938..df0e4bc73855ff86304e1df984d8acc886746fcb 100644 (file)
@@ -5,13 +5,12 @@
  * 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.api.messages;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
index fac88d679b24067aee5bfbf7c7e01672184961fa..f529ed5492e5a1c1996fb5e52fecae357b458b5d 100644 (file)
@@ -5,7 +5,6 @@
  * 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.api.xml;
 
 import static org.hamcrest.CoreMatchers.both;
@@ -17,8 +16,8 @@ import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.google.common.base.Optional;
 import java.util.Map;
+import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.netconf.api.DocumentedException;
@@ -114,7 +113,7 @@ public class XmlElementTest {
         final XmlElement inner = xmlElement.getOnlyChildElement("inner");
         final XmlElement deepInner = inner.getOnlyChildElementWithSameNamespaceOptionally().get();
         assertEquals(deepInner, inner.getOnlyChildElementWithSameNamespace());
-        assertEquals(Optional.<XmlElement>absent(), xmlElement.getOnlyChildElementOptionally("unknown"));
+        assertEquals(Optional.empty(), xmlElement.getOnlyChildElementOptionally("unknown"));
         assertEquals("deepValue", deepInner.getTextContent());
         assertEquals("deepValue", deepInner.getOnlyTextContentOptionally().get());
         assertEquals("deepValue", deepInner.getOnlyTextContentOptionally().get());
index c45d7f4f6929afdf45e7aaeeaee05539021e50d5..20ad4e37b1fe7311db987493a77dbbab3e7fe51a 100644 (file)
@@ -5,15 +5,14 @@
  * 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.api.xml;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
-import com.google.common.base.Optional;
 import java.io.ByteArrayInputStream;
+import java.util.Optional;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Test;
index 2e8a90719fc8dd0abaad287513989e0516b2fa31..413ee30742a751948af91b881888e79210a64780 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.netconf.client;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 import com.siemens.ct.exi.core.CodingMode;
 import com.siemens.ct.exi.core.FidelityOptions;
@@ -17,6 +16,7 @@ import com.siemens.ct.exi.core.exceptions.UnsupportedOption;
 import io.netty.channel.Channel;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Promise;
+import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.netconf.api.NetconfClientSessionPreferences;
 import org.opendaylight.netconf.api.NetconfMessage;
index 756789a8e0256ca36103416999bc05e0045dda06..9ad03b915df50926539f5391e1f9cdefe346fd43 100644 (file)
@@ -9,10 +9,10 @@ package org.opendaylight.netconf.client.conf;
 
 import com.google.common.base.MoreObjects;
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.net.InetSocketAddress;
 import java.util.List;
+import java.util.Optional;
 import org.opendaylight.netconf.api.messages.NetconfHelloMessageAdditionalHeader;
 import org.opendaylight.netconf.client.NetconfClientSessionListener;
 import org.opendaylight.netconf.client.SslHandlerFactory;
@@ -68,7 +68,7 @@ public class NetconfClientConfiguration {
     }
 
     public final Optional<NetconfHelloMessageAdditionalHeader> getAdditionalHeader() {
-        return Optional.fromNullable(additionalHeader);
+        return Optional.ofNullable(additionalHeader);
     }
 
     public final NetconfClientSessionListener getSessionListener() {
index 2e2f7203cb9101e479da91db6cf7c6c99e3aa49d..46b2bfd38cb36f1cc0794058d43e09b36faca847 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.netconf.client;
 
-import com.google.common.base.Optional;
 import java.net.InetSocketAddress;
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -39,7 +39,7 @@ public class NetconfClientConfigurationTest {
                 .withAuthHandler(handler).build();
 
         Assert.assertEquals(timeout, cfg.getConnectionTimeoutMillis());
-        Assert.assertEquals(Optional.fromNullable(header), cfg.getAdditionalHeader());
+        Assert.assertEquals(Optional.of(header), cfg.getAdditionalHeader());
         Assert.assertEquals(listener, cfg.getSessionListener());
         Assert.assertEquals(handler, cfg.getAuthHandler());
         Assert.assertEquals(strategy, cfg.getReconnectStrategy());
@@ -57,7 +57,7 @@ public class NetconfClientConfigurationTest {
                 .withSslHandlerFactory(sslHandlerFactory).build();
 
         Assert.assertEquals(timeout, cfg2.getConnectionTimeoutMillis());
-        Assert.assertEquals(Optional.fromNullable(header), cfg2.getAdditionalHeader());
+        Assert.assertEquals(Optional.of(header), cfg2.getAdditionalHeader());
         Assert.assertEquals(listener, cfg2.getSessionListener());
         Assert.assertEquals(sslHandlerFactory, cfg2.getSslHandlerFactory());
         Assert.assertEquals(strategy, cfg2.getReconnectStrategy());
index a033ea5c4bf8e8ed2d73106814e8895c241ba309..34fa1f325662e7a97f76f5375f852a826ec144fb 100644 (file)
@@ -5,18 +5,17 @@
  * 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.client;
 
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.base.Optional;
 import io.netty.channel.Channel;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Promise;
+import java.util.Optional;
 import org.junit.Test;
 import org.opendaylight.netconf.api.NetconfSessionListenerFactory;
 
@@ -32,7 +31,7 @@ public class NetconfClientSessionNegotiatorFactoryTest {
         Channel channel = mock(Channel.class);
         Promise<NetconfClientSession> promise = mock(Promise.class);
         NetconfClientSessionNegotiatorFactory negotiatorFactory = new NetconfClientSessionNegotiatorFactory(timer,
-                Optional.absent(), 200L);
+                Optional.empty(), 200L);
 
         NetconfClientSessionNegotiator sessionNegotiator = negotiatorFactory.getSessionNegotiator(listenerFactory,
             channel, promise);
index b25de514c7f8acb8ff43fbea61c8a51c6f98e3aa..db9e80ed42688f918acce2acf4a632227c74e5e5 100644 (file)
@@ -5,7 +5,6 @@
  * 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.client;
 
 import static org.junit.Assert.assertEquals;
@@ -19,7 +18,6 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelHandler;
@@ -36,6 +34,7 @@ import io.netty.util.Timer;
 import io.netty.util.concurrent.GenericFutureListener;
 import io.netty.util.concurrent.Promise;
 import java.io.InputStream;
+import java.util.Optional;
 import java.util.Set;
 import org.junit.Before;
 import org.junit.Test;
@@ -65,7 +64,7 @@ public class NetconfClientSessionNegotiatorTest {
 
     @Before
     public void setUp() throws Exception {
-        helloMessage = NetconfHelloMessage.createClientHello(Sets.newSet("exi:1.0"), Optional.absent());
+        helloMessage = NetconfHelloMessage.createClientHello(Sets.newSet("exi:1.0"), Optional.empty());
         pipeline = mockChannelPipeline();
         future = mockChannelFuture();
         channel = mockChannel();
index be654a340ce3c98fc84d81c84b2c67423b5b9529..ec09f88efaf1998597f385cac4f56ae1dc811915 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.netconf.client;
 
-import com.google.common.base.Optional;
 import java.net.InetSocketAddress;
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Test;
 import org.mockito.Mockito;
@@ -44,7 +44,7 @@ public class NetconfReconnectingClientConfigurationTest {
                 .withAuthHandler(handler).build();
 
         Assert.assertEquals(timeout, cfg.getConnectionTimeoutMillis());
-        Assert.assertEquals(Optional.fromNullable(header), cfg.getAdditionalHeader());
+        Assert.assertEquals(Optional.of(header), cfg.getAdditionalHeader());
         Assert.assertEquals(listener, cfg.getSessionListener());
         Assert.assertEquals(handler, cfg.getAuthHandler());
         Assert.assertEquals(strategy, cfg.getConnectStrategyFactory());
@@ -64,7 +64,7 @@ public class NetconfReconnectingClientConfigurationTest {
                 .withSslHandlerFactory(sslHandlerFactory).build();
 
         Assert.assertEquals(timeout, cfg2.getConnectionTimeoutMillis());
-        Assert.assertEquals(Optional.fromNullable(header), cfg2.getAdditionalHeader());
+        Assert.assertEquals(Optional.of(header), cfg2.getAdditionalHeader());
         Assert.assertEquals(listener, cfg2.getSessionListener());
         Assert.assertEquals(sslHandlerFactory, cfg2.getSslHandlerFactory());
         Assert.assertEquals(strategy, cfg2.getConnectStrategyFactory());
index e32d5c7e451be7f4492b95ad499c11e5dc988627..1a975fc79f5a5c204c6d03346b6e1638dd78c8ea 100644 (file)
@@ -5,10 +5,8 @@
  * 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 com.google.common.base.Optional;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.Channel;
 import io.netty.channel.local.LocalAddress;
@@ -18,6 +16,7 @@ import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.AbstractMap;
 import java.util.Map;
+import java.util.Optional;
 import org.opendaylight.netconf.api.NetconfDocumentedException;
 import org.opendaylight.netconf.api.NetconfServerSessionPreferences;
 import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
index 194411f2d6b2d47c313c89d954ce823fd59e5327..1338ccdefddab234c06c641205c501b9bb6c7d93 100644 (file)
@@ -5,10 +5,8 @@
  * 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.mapping.operations;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.Collections;
 import org.opendaylight.netconf.api.DocumentedException;
@@ -60,7 +58,7 @@ public class DefaultCloseSession extends AbstractSingletonNetconfOperation imple
                     DocumentedException.ErrorSeverity.ERROR, Collections.singletonMap(
                     DocumentedException.ErrorSeverity.ERROR.toString(), e.getMessage()));
         }
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index 5e039cf67ffc29003e62777965e8e430f2c2ddd4..f9c931a1dce9a5abd65d1b8d02e5a418e3b1f777 100644 (file)
@@ -11,7 +11,6 @@ import static org.opendaylight.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARA
 import static org.opendaylight.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_URL_1_0;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
@@ -25,6 +24,7 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Optional;
 import java.util.Set;
 import org.opendaylight.netconf.api.capability.BasicCapability;
 import org.opendaylight.netconf.api.capability.Capability;
index ff0bc5ce392c235a11023b4e9df2a15152ff02f9..90bcfe3bd55561a713bbff63e2d41b2363974d53 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.netconf.impl.osgi;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.opendaylight.controller.config.threadpool.ScheduledThreadPool;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
 import org.opendaylight.netconf.api.monitoring.SessionListener;
@@ -23,13 +23,13 @@ public class NetconfMonitoringServiceImpl implements NetconfMonitoringService, A
     private final NetconfSessionMonitoringService sessionMonitoring;
 
     public NetconfMonitoringServiceImpl(NetconfOperationServiceFactory opProvider) {
-        this(opProvider, Optional.absent(), 0);
+        this(opProvider, Optional.empty(), 0);
     }
 
     public NetconfMonitoringServiceImpl(NetconfOperationServiceFactory opProvider,
                                         ScheduledThreadPool threadPool,
                                         long updateInterval) {
-        this(opProvider, Optional.fromNullable(threadPool), updateInterval);
+        this(opProvider, Optional.ofNullable(threadPool), updateInterval);
     }
 
     public NetconfMonitoringServiceImpl(NetconfOperationServiceFactory opProvider,
index 103dc1bcf84caf9fb7306e98fd0042d093871a5d..a3fecbdeef90f11c24df3f93d177746297618d68 100644 (file)
@@ -7,13 +7,13 @@
  */
 package org.opendaylight.netconf.impl.osgi;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.ImmutableList;
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
index 7799c166282714bbdf5b415d30c7ec452f34b582..ebadafefa36015f0b59077d800ac334b4beb9d0c 100644 (file)
@@ -15,12 +15,12 @@ import static org.mockito.Mockito.verify;
 import static org.opendaylight.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_CANDIDATE_1_0;
 import static org.opendaylight.netconf.api.xml.XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_CAPABILITY_URL_1_0;
 
-import com.google.common.base.Optional;
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import org.junit.Assert;
 import org.junit.Before;
@@ -156,7 +156,7 @@ public class NetconfCapabilityMonitoringServiceTest {
         //remove one revision
         monitoringService.onCapabilitiesChanged(Collections.emptySet(), Collections.singleton(moduleCapability1));
         //only one revision present
-        final String schema3 = monitoringService.getSchemaForModuleRevision(TEST_MODULE_NAME, Optional.absent());
+        final String schema3 = monitoringService.getSchemaForModuleRevision(TEST_MODULE_NAME, Optional.empty());
         Assert.assertEquals(TEST_MODULE_CONTENT2, schema3);
     }
 
index ef6a5dc61a298337c86d036eb1a0337aa40d6f1d..cd7096cb7a0e0f9eff525e5833fc76c33885c7b3 100644 (file)
@@ -14,9 +14,9 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.timeout;
 import static org.mockito.Mockito.verify;
 
-import com.google.common.base.Optional;
 import java.util.Collection;
 import java.util.HashSet;
+import java.util.Optional;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import org.junit.Assert;
@@ -73,7 +73,7 @@ public class NetconfSessionMonitoringServiceTest {
         doNothing().when(notificationPublisher).onSessionStarted(any());
         doNothing().when(notificationPublisher).onSessionEnded(any());
 
-        monitoringService = new NetconfSessionMonitoringService(Optional.absent(), 0);
+        monitoringService = new NetconfSessionMonitoringService(Optional.empty(), 0);
         monitoringService.registerListener(listener);
     }
 
index 4f8374c974c300868afababbd8a1393802e224c5..4a041d46a43c7a0fba419f6c4ed287c8cc4e9a79 100644 (file)
@@ -7,9 +7,9 @@
  */
 package org.opendaylight.netconf.monitoring;
 
-import com.google.common.base.Optional;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
 import org.opendaylight.netconf.api.xml.XmlElement;
@@ -92,7 +92,7 @@ public class GetSchema extends AbstractSingletonNetconfOperation {
             if (versionElement.isPresent()) {
                 version = Optional.of(versionElement.get().getTextContent());
             } else {
-                version = Optional.absent();
+                version = Optional.empty();
             }
         }
     }
index 178f6fac0db4ad04610c0e9815f18f01d0449929..ab1081ae8b483517e2d78cc761a18912c2b3055f 100644 (file)
@@ -5,7 +5,6 @@
  * 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.monitoring;
 
 import static org.junit.Assert.assertNotNull;
@@ -15,7 +14,7 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
 
-import com.google.common.base.Optional;
+import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.netconf.api.DocumentedException;
index fac1b2ba4db393aab8a2a2876369c99d46da1c96..ee24cc679e4c8ba0c2dd43e62f108cb0308aae99 100644 (file)
@@ -8,12 +8,12 @@
 package org.opendaylight.netconf.nettyutil.handler;
 
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
+import java.util.Optional;
 import javax.xml.transform.TransformerException;
 import org.opendaylight.netconf.api.NetconfMessage;
 import org.opendaylight.netconf.api.messages.NetconfHelloMessage;
index e2fe0c67fd00fba78063900273a624d0680efbba..68decb5ac5e246e2fb24dc49e949ca00efd1c652 100644 (file)
@@ -5,7 +5,6 @@
  * 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.nettyutil;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -19,7 +18,6 @@ import static org.mockito.Mockito.verify;
 import static org.opendaylight.netconf.nettyutil.AbstractChannelInitializer.NETCONF_MESSAGE_AGGREGATOR;
 import static org.opendaylight.netconf.nettyutil.AbstractChannelInitializer.NETCONF_MESSAGE_FRAME_ENCODER;
 
-import com.google.common.base.Optional;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelInboundHandlerAdapter;
@@ -33,6 +31,7 @@ import io.netty.util.concurrent.Promise;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -78,9 +77,9 @@ public class AbstractNetconfSessionNegotiatorTest {
         channel.pipeline().addLast(NETCONF_MESSAGE_FRAME_ENCODER,
                 FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
         channel.pipeline().addLast(NETCONF_MESSAGE_AGGREGATOR, new NetconfEOMAggregator());
-        hello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.absent());
+        hello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.empty());
         helloBase11 = NetconfHelloMessage.createClientHello(Collections
-                .singleton(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.absent());
+                .singleton(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.empty());
         prefs = new NetconfSessionPreferences(helloBase11);
         doReturn(promise).when(promise).setFailure(any());
         doReturn(promise).when(promise).setSuccess(any());
index e978850545723143994c59433012d6447dd4dd5b..e3d152c2659a70a5a04a13fc60ee596c574497eb 100644 (file)
@@ -5,7 +5,6 @@
  * 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.nettyutil;
 
 import static org.junit.Assert.assertEquals;
@@ -21,7 +20,6 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.verifyZeroInteractions;
 
-import com.google.common.base.Optional;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelHandler;
@@ -32,6 +30,7 @@ import io.netty.handler.codec.ByteToMessageDecoder;
 import io.netty.handler.codec.MessageToByteEncoder;
 import io.netty.util.concurrent.GenericFutureListener;
 import java.util.Collections;
+import java.util.Optional;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -84,7 +83,7 @@ public class AbstractNetconfSessionTest {
             return null;
         }).when(eventLoop).execute(any(Runnable.class));
 
-        clientHello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.absent());
+        clientHello = NetconfHelloMessage.createClientHello(Collections.emptySet(), Optional.empty());
     }
 
     @Test
@@ -154,7 +153,7 @@ public class AbstractNetconfSessionTest {
     public void testSendMessage() throws Exception {
         final TestingNetconfSession testingNetconfSession = new TestingNetconfSession(listener, channel, 1L);
         final NetconfHelloMessage hello = NetconfHelloMessage.createClientHello(Collections.emptySet(),
-            Optional.absent());
+            Optional.empty());
         testingNetconfSession.sendMessage(hello);
         verify(channel).writeAndFlush(hello, writeFuture);
     }
index 4bea19a2ade429509445ca60f2cecc419b2c0c3b..8e8edebb6c20609cd057dcc0d915d8bc141331b6 100644 (file)
@@ -5,7 +5,6 @@
  * 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.nettyutil;
 
 import static org.mockito.ArgumentMatchers.any;
@@ -13,12 +12,12 @@ import static org.mockito.Mockito.doReturn;
 import static org.opendaylight.netconf.nettyutil.AbstractChannelInitializer.NETCONF_MESSAGE_AGGREGATOR;
 import static org.opendaylight.netconf.nettyutil.AbstractChannelInitializer.NETCONF_MESSAGE_FRAME_ENCODER;
 
-import com.google.common.base.Optional;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.channel.embedded.EmbeddedChannel;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.concurrent.Promise;
 import java.util.Collections;
+import java.util.Optional;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -59,7 +58,7 @@ public class Netconf539Test {
             FramingMechanismHandlerFactory.createHandler(FramingMechanism.EOM));
         channel.pipeline().addLast(NETCONF_MESSAGE_AGGREGATOR, new NetconfEOMAggregator());
         final NetconfHelloMessage serverHello = NetconfHelloMessage.createClientHello(Collections
-            .singleton(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.absent());
+            .singleton(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1), Optional.empty());
         doReturn(promise).when(promise).setFailure(any());
         doReturn(promise).when(promise).setSuccess(any());
         negotiator = new TestSessionNegotiator(new NetconfSessionPreferences(serverHello), promise, channel,
index 99435ea15a7244a7f2499ce1f6e73a8067f69ae9..81c6af23e770c13aac3ae0c1662ecdc4acebc229 100644 (file)
@@ -7,11 +7,11 @@
  */
 package org.opendaylight.netconf.notifications.impl.ops;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.NetconfSession;
 import org.opendaylight.netconf.api.xml.XmlElement;
@@ -88,7 +88,7 @@ public class CreateSubscription extends AbstractSingletonNetconfOperation
                 .registerNotificationListener(streamNameType, new NotificationSubscription(netconfSession, filter));
         subscriptions.add(notificationListenerRegistration);
 
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     private static StreamNameType parseStreamIfPresent(final XmlElement operationElement) throws DocumentedException {
index a9ab6994d76b6e94e87b049beda395d8cfa7f769..b584b5661bcbd57325d0a763156ca976bb72827f 100644 (file)
@@ -5,11 +5,10 @@
  * 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.util.mapping;
 
-import com.google.common.base.Optional;
 import java.util.Map;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
index 6e16741be273b17cec739ce38d38c4cf2c024fa9..a0c2db36c4f634d1a630a6819cb4ceafac8a3cd6 100644 (file)
@@ -5,13 +5,12 @@
  * 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.util.messages;
 
-import com.google.common.base.Optional;
 import com.google.common.collect.Collections2;
 import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 import javax.annotation.Nonnull;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.NetconfDocumentedException;
@@ -70,9 +69,10 @@ public final class NetconfMessageUtil {
         XmlElement responseElement = XmlElement.fromDomDocument(doc);
         // Extract child element <capabilities> from <hello> with or without(fallback) the same namespace
         Optional<XmlElement> capabilitiesElement = responseElement
-                .getOnlyChildElementWithSameNamespaceOptionally(XmlNetconfConstants.CAPABILITIES)
-                .or(responseElement
-                        .getOnlyChildElementOptionally(XmlNetconfConstants.CAPABILITIES));
+                .getOnlyChildElementWithSameNamespaceOptionally(XmlNetconfConstants.CAPABILITIES);
+        if (!capabilitiesElement.isPresent()) {
+            capabilitiesElement = responseElement.getOnlyChildElementOptionally(XmlNetconfConstants.CAPABILITIES);
+        }
 
         List<XmlElement> caps = capabilitiesElement.get().getChildElements(XmlNetconfConstants.CAPABILITY);
         return Collections2.transform(caps, (@Nonnull final XmlElement input) -> {
index 3b803b6a43e16bdee112fe129cf610e30be9a37e..fdc3831c32fc9a19e112ccc601d2f4f9a5dac8fb 100644 (file)
@@ -5,11 +5,10 @@
  * 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.util.messages;
 
-import com.google.common.base.Optional;
 import java.util.Map;
+import java.util.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -69,7 +68,7 @@ public final class SubtreeFilter {
                                                                     Document notification) throws DocumentedException {
         removeEventTimeNode(notification);
         if (isSupported(filter)) {
-            return Optional.fromNullable(filteredNotification(filter, notification));
+            return Optional.ofNullable(filteredNotification(filter, notification));
         }
         return Optional.of(extractNotificationContent(notification));
     }
index 341c1c46e88a3f8c4c3075ecdc02f0b7c675da93..9e7ed2bb27657a49942d59099d02c4fcdf9fae2a 100644 (file)
@@ -5,17 +5,16 @@
  * 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.util.messages;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
-import com.google.common.base.Optional;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
+import java.util.Optional;
 import org.custommonkey.xmlunit.Diff;
 import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Before;
index ef4c254bdceb2edf9d71c94e3734e690a198ff45..2454b5eedc8931eeaf8060e096ec981cbb5b4909 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.sal.connect.netconf.util;
 
-import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -22,6 +21,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 import javax.xml.transform.dom.DOMResult;
index a3aa411beaf1b016756f2b668ea88f187b541885..d6109639eb4dd5437281ebbe0158bbfb05c58bd0 100644 (file)
@@ -5,16 +5,15 @@
  * 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.test.tool;
 
 import com.google.common.base.Function;
-import com.google.common.base.Optional;
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import java.util.Collections;
+import java.util.Optional;
 import java.util.Set;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
index c985f45f9f93bc74d7900a4161e245dce416f9ae..93ea6eaff811877b5ce7fded318a0d01c4b00b97 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -17,14 +15,13 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 
 public class SimulatedCommit extends AbstractLastNetconfOperation {
-
     public SimulatedCommit(final String netconfSessionIdForReporting) {
         super(netconfSessionIdForReporting);
     }
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index 8d62d3ada118fcc6e5ddfcc359911166fd7f1a68..cf6fd1d74a1eb353e8362bf52dfcfbab19caa6c9 100644 (file)
@@ -5,7 +5,6 @@
  * 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.test.tool.rpc;
 
 import com.google.common.base.Optional;
@@ -103,7 +102,7 @@ public class SimulatedCreateSubscription extends AbstractLastNetconfOperation im
                 }, delayAggregator, TimeUnit.SECONDS);
             }
         }
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     private static NetconfMessage parseNetconfNotification(String content) {
index fe54d84f9fae69acc422a09235de5cffab93c0f2..924024c2ba6311f59c0b8eb01ccdb96a2b824a98 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -24,7 +22,7 @@ public class SimulatedDiscardChanges extends AbstractLastNetconfOperation {
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index 509d9416de1846f679cd46324ba4a97244f09c02..b2231f2f33cfa269cdd52cb44c4cb2172b7ceeac 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.DocumentedException;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
@@ -41,7 +39,7 @@ public class SimulatedEditConfig extends AbstractLastNetconfOperation {
             storage.setConfigList(configElementData.getChildElements());
         }
 
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index e5b197d3c37f4bf4aa51b29efc7d83de48dbda1c..e7cc098d96fdf1f3095de83d26490d728015043b 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -27,7 +25,7 @@ public class SimulatedGet extends AbstractLastNetconfOperation {
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+        final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
 
         for (final XmlElement e : storage.getConfigList()) {
             final Element domElement = e.getDomElement();
index 4c2a8592a9946111412974fc325b484fc2a7f31d..ca09bb310c43a876e9bb10ea4ed8faefe8a5aad8 100644 (file)
@@ -5,7 +5,6 @@
  * 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.test.tool.rpc;
 
 import com.google.common.base.Optional;
@@ -60,7 +59,7 @@ public class SimulatedGetConfig extends AbstractLastNetconfOperation {
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY, Optional.absent());
+        final Element element = XmlUtil.createElement(document, XmlNetconfConstants.DATA_KEY);
 
         for (final XmlElement e : storage.getConfigList()) {
             final Element domElement = e.getDomElement();
index 1dfbd1f4287e7f77bb1ddb591c916d0c4a39500a..beda99d0660c0457f13633eee2dda724e87a43fa 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -24,7 +22,7 @@ public class SimulatedLock extends AbstractLastNetconfOperation {
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override
index bfd0026c37bc42debe4debd7cea6c28382bbc181..22d27f5c041e814b705bbd72340c56e4764d1758 100644 (file)
@@ -5,10 +5,8 @@
  * 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.test.tool.rpc;
 
-import com.google.common.base.Optional;
 import org.opendaylight.netconf.api.xml.XmlElement;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.api.xml.XmlUtil;
@@ -24,7 +22,7 @@ public class SimulatedUnLock extends AbstractLastNetconfOperation {
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement) {
-        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK);
     }
 
     @Override