Update MRI projects for Aluminium
[netconf.git] / netconf / tools / netconf-testtool / src / main / java / org / opendaylight / netconf / test / tool / NetconfDeviceSimulator.java
index a87dd0648cd690938e38a56e9100292bff207d94..dba9cb0da18354a5afc55912ca3dfa3369f59f90 100644 (file)
@@ -5,14 +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.test.tool;
 
 import com.google.common.base.MoreObjects.ToStringHelper;
-import com.google.common.base.Optional;
 import com.google.common.collect.Collections2;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -29,7 +25,10 @@ import java.net.Inet4Address;
 import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.nio.channels.AsynchronousChannelGroup;
+import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
@@ -59,8 +58,8 @@ import org.opendaylight.netconf.test.tool.operations.OperationsProvider;
 import org.opendaylight.netconf.test.tool.rpchandler.SettableOperationRpcProvider;
 import org.opendaylight.netconf.test.tool.schemacache.SchemaSourceCache;
 import org.opendaylight.yangtools.yang.common.Revision;
+import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.repo.api.RevisionSourceIdentifier;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceRepresentation;
 import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
@@ -81,12 +80,12 @@ public class NetconfDeviceSimulator implements Closeable {
 
     private final NioEventLoopGroup nettyThreadgroup;
     private final HashedWheelTimer hashedWheelTimer;
-    private final List<Channel> devicesChannels = Lists.newArrayList();
-    private final List<SshProxyServer> sshWrappers = Lists.newArrayList();
+    private final List<Channel> devicesChannels = new ArrayList<>();
+    private final List<SshProxyServer> sshWrappers = new ArrayList<>();
     private final ScheduledExecutorService minaTimerExecutor;
     private final ExecutorService nioExecutor;
     private final Configuration configuration;
-    private SchemaContext schemaContext;
+    private EffectiveModelContext schemaContext;
 
     private boolean sendFakeSchema = false;
 
@@ -103,7 +102,7 @@ public class NetconfDeviceSimulator implements Closeable {
     private NetconfServerDispatcherImpl createDispatcher(final Set<Capability> capabilities,
             final SchemaSourceProvider<YangTextSchemaSource> sourceProvider) {
 
-        final Set<Capability> transformedCapabilities = Sets.newHashSet(Collections2.transform(capabilities, input -> {
+        final Set<Capability> transformedCapabilities = new HashSet<>(Collections2.transform(capabilities, input -> {
             if (sendFakeSchema) {
                 sendFakeSchema = false;
                 return new FakeCapability((YangModuleCapability) input);
@@ -145,8 +144,8 @@ public class NetconfDeviceSimulator implements Closeable {
         } else if (configuration.isXmlConfigurationProvided()) {
             LOG.info("using SimulatedOperationProvider.");
             operationProvider = new SimulatedOperationProvider(idProvider, transformedCapabilities,
-                    Optional.fromNullable(configuration.getNotificationFile()),
-                    Optional.fromNullable(configuration.getInitialConfigXMLFile()));
+                    Optional.ofNullable(configuration.getNotificationFile()),
+                    Optional.ofNullable(configuration.getInitialConfigXMLFile()));
         } else {
             LOG.info("using OperationsProvider.");
             operationProvider = new OperationsProvider(idProvider, transformedCapabilities,
@@ -184,7 +183,7 @@ public class NetconfDeviceSimulator implements Closeable {
 
         int currentPort = configuration.getStartingPort();
 
-        final List<Integer> openDevices = Lists.newArrayList();
+        final List<Integer> openDevices = new ArrayList<>();
 
         // Generate key to temp folder
         final KeyPairProvider keyPairProvider = new VirtualKeyPairProvider();
@@ -285,7 +284,7 @@ public class NetconfDeviceSimulator implements Closeable {
     }
 
     private Set<Capability> parseSchemasToModuleCapabilities(final SharedSchemaRepository consumer) {
-        final Set<SourceIdentifier> loadedSources = Sets.newHashSet();
+        final Set<SourceIdentifier> loadedSources = new HashSet<>();
         consumer.registerSchemaSourceListener(TextToASTTransformer.create(consumer, consumer));
         consumer.registerSchemaSourceListener(new SchemaSourceListener() {
             @Override
@@ -334,7 +333,7 @@ public class NetconfDeviceSimulator implements Closeable {
             throw new RuntimeException("Cannot parse schema context", e);
         }
 
-        final Set<Capability> capabilities = Sets.newHashSet();
+        final Set<Capability> capabilities = new HashSet<>();
 
         for (final Module module : schemaContext.getModules()) {
             for (final Module subModule : module.getSubmodules()) {