* 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;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Sets;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import org.opendaylight.mdsal.dom.api.DOMSchemaService;
public class CurrentSchemaContext implements SchemaContextListener, AutoCloseable {
private final AtomicReference<SchemaContext> currentContext = new AtomicReference<>();
private final ListenerRegistration<SchemaContextListener> schemaContextListenerListenerRegistration;
- private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(Sets.newHashSet());
+ private final Set<CapabilityListener> listeners1 = Collections.synchronizedSet(new HashSet<>());
private final SchemaSourceProvider<YangTextSchemaSource> rootSchemaSourceProvider;
public SchemaContext getCurrentContext() {
final String namespace = notification.getType().getLastComponent().getNamespace().toString();
for (NotificationTopicRegistration notifReg : notificationTopicRegistrations.get(namespace)) {
notifReg.setLastEventTime(notificationEventTime);
- Set<TopicId> topicIdsForNotification = notifReg.getTopicsForNotification(notificationPath);
- for (TopicId topicId : topicIdsForNotification) {
+ for (TopicId topicId : notifReg.getTopicsForNotification(notificationPath)) {
publishNotification(notification, topicId);
LOG.debug("Notification {} has been published for TopicId {}", notification.getType(),
topicId.getValue());
*/
package org.opendaylight.netconf.messagebus.eventsources.netconf;
-import com.google.common.collect.Sets;
import java.time.Instant;
+import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
*/
Set<TopicId> getTopicsForNotification(final SchemaPath notificationPath) {
final Set<TopicId> topicIds = notificationTopicMap.get(notificationPath);
- return topicIds != null ? topicIds : Sets.newHashSet();
+ return topicIds != null ? topicIds : new HashSet<>();
}
/**
* 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 com.google.common.base.Strings;
import com.google.common.collect.Collections2;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.io.IOException;
+import java.util.AbstractMap.SimpleImmutableEntry;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
public Map<String, Attr> getAttributes() {
- Map<String, Attr> mappedAttributes = Maps.newHashMap();
+ Map<String, Attr> mappedAttributes = new HashMap<>();
NamedNodeMap attributes = element.getAttributes();
for (int i = 0; i < attributes.getLength(); i++) {
throw new IllegalArgumentException("Cannot find namespace for " + XmlUtil.toString(element)
+ ". Prefix from content is " + prefix + ". Found namespaces " + namespaces);
}
- return Maps.immutableEntry(prefix, namespaces.get(prefix));
+ return new SimpleImmutableEntry<>(prefix, namespaces.get(prefix));
}
public List<XmlElement> getChildElementsWithSameNamespace(final String childName) throws MissingNameSpaceException {
* 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.osgi;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multimaps;
-import com.google.common.collect.Sets;
-import io.netty.util.internal.ConcurrentSet;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import org.opendaylight.netconf.api.capability.Capability;
import org.opendaylight.netconf.api.monitoring.CapabilityListener;
import org.opendaylight.netconf.mapping.api.NetconfOperation;
private static final Logger LOG = LoggerFactory.getLogger(AggregatedNetconfOperationServiceFactory.class);
- private final Set<NetconfOperationServiceFactory> factories = new ConcurrentSet<>();
+ private final Set<NetconfOperationServiceFactory> factories = ConcurrentHashMap.newKeySet();
private final Multimap<NetconfOperationServiceFactory, AutoCloseable> registrations =
Multimaps.synchronizedMultimap(HashMultimap.create());
- private final Set<CapabilityListener> listeners = new ConcurrentSet<>();
+ private final Set<CapabilityListener> listeners = ConcurrentHashMap.newKeySet();
public AggregatedNetconfOperationServiceFactory() {
}
@Override
public Set<Capability> getCapabilities() {
- final HashSet<Capability> capabilities = Sets.newHashSet();
+ final Set<Capability> capabilities = new HashSet<>();
for (final NetconfOperationServiceFactory factory : factories) {
capabilities.addAll(factory.getCapabilities());
}
@Override
public synchronized AutoCloseable registerCapabilityListener(final CapabilityListener listener) {
- final Map<NetconfOperationServiceFactory, AutoCloseable> regs = Maps.newHashMap();
+ final Map<NetconfOperationServiceFactory, AutoCloseable> regs = new HashMap<>();
for (final NetconfOperationServiceFactory factory : factories) {
final AutoCloseable reg = factory.registerCapabilityListener(listener);
@Override
public Set<NetconfOperation> getNetconfOperations() {
- final HashSet<NetconfOperation> operations = Sets.newHashSet();
+ final Set<NetconfOperation> operations = new HashSet<>();
for (final NetconfOperationService service : services) {
operations.addAll(service.getNetconfOperations());
}
import com.google.common.collect.ImmutableList.Builder;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
private static final Function<Capability, Uri> CAPABILITY_TO_URI = input -> new Uri(input.getCapabilityUri());
private final NetconfOperationServiceFactory netconfOperationProvider;
- private final Map<Uri, Capability> capabilities = Maps.newHashMap();
- private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = Maps.newHashMap();
+ private final Map<Uri, Capability> capabilities = new HashMap<>();
+ private final Map<String, Map<String, String>> mappedModulesToRevisionToSchema = new HashMap<>();
- private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = Sets.newHashSet();
+ private final Set<NetconfMonitoringService.CapabilitiesListener> listeners = new HashSet<>();
private volatile BaseNotificationPublisherRegistration notificationPublisher;
NetconfCapabilityMonitoringService(final NetconfOperationServiceFactory netconfOperationProvider) {
final String currentModuleName = cap.getModuleName().get();
Map<String, String> revisionMap =
- mappedModulesToRevisionToSchema.computeIfAbsent(currentModuleName, k -> Maps.newHashMap());
+ mappedModulesToRevisionToSchema.computeIfAbsent(currentModuleName, k -> new HashMap<>());
final String currentRevision = cap.getRevision().get();
revisionMap.put(currentRevision, cap.getCapabilitySchema().get());
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
private TreeMap<HandlingPriority, NetconfOperation> getSortedNetconfOperationsWithCanHandle(
final Document message, final NetconfServerSession session) throws DocumentedException {
- final TreeMap<HandlingPriority, NetconfOperation> sortedPriority = Maps.newTreeMap();
+ final TreeMap<HandlingPriority, NetconfOperation> sortedPriority = new TreeMap<>();
for (final NetconfOperation netconfOperation : allNetconfOperations) {
final HandlingPriority handlingPriority = netconfOperation.canHandle(message);
import com.google.common.base.Preconditions;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Sets;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
private static final Logger LOG = LoggerFactory.getLogger(NetconfSessionMonitoringService.class);
- private final Set<NetconfManagementSession> sessions = Sets.newHashSet();
- private final Set<NetconfManagementSession> changedSessions = Sets.newHashSet();
- private final Set<NetconfMonitoringService.SessionsListener> listeners = Sets.newHashSet();
+ private final Set<NetconfManagementSession> sessions = new HashSet<>();
+ private final Set<NetconfManagementSession> changedSessions = new HashSet<>();
+ private final Set<NetconfMonitoringService.SessionsListener> listeners = new HashSet<>();
private final ScheduledExecutorService executor;
private final long updateInterval;
private boolean running;
* 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.util;
-import com.google.common.collect.Maps;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelHandlerContext;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.util.messages.SendErrorExceptionUtil;
}
private static void handleDeserializerException(final ChannelHandlerContext ctx, final Throwable cause) {
-
- final Map<String, String> info = Maps.newHashMap();
+ final Map<String, String> info = new HashMap<>();
info.put("cause", cause.getMessage());
final DocumentedException ex = new DocumentedException(cause.getMessage(),
DocumentedException.ErrorType.RPC, DocumentedException.ErrorTag.MALFORMED_MESSAGE,
* 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 com.google.common.base.Optional;
-import com.google.common.collect.Maps;
+import java.util.HashMap;
import java.util.Map;
import org.opendaylight.netconf.api.DocumentedException;
import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
try {
schema = cap.getSchemaForCapability(entry.identifier, entry.version);
} catch (final IllegalStateException e) {
- final Map<String, String> errorInfo = Maps.newHashMap();
+ final Map<String, String> errorInfo = new HashMap<>();
errorInfo.put(DocumentedException.ErrorTag.OPERATION_FAILED.toString(), e.getMessage());
LOG.warn("Rpc error: {}", DocumentedException.ErrorTag.OPERATION_FAILED, e);
throw new DocumentedException(e.getMessage(), e, DocumentedException.ErrorType.APPLICATION,
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.ByteBufUtil;
import io.netty.channel.ChannelHandlerContext;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.opendaylight.netconf.api.NetconfMessage;
// State variables do not have to by synchronized
// Netty uses always the same (1) thread per pipeline
// We use instance of this per pipeline
- private final List<NetconfMessage> nonHelloMessages = Lists.newArrayList();
+ private final List<NetconfMessage> nonHelloMessages = new ArrayList<>();
private boolean helloReceived = false;
@Override
import static org.junit.Assert.assertEquals;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
import java.util.List;
import org.junit.BeforeClass;
import org.junit.Test;
@Test
public void testMultipleChunks() throws Exception {
- final List<Object> output = Lists.newArrayList();
+ final List<Object> output = new ArrayList<>();
final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE.getBytes(StandardCharsets.UTF_8));
agr.decode(null, input, output);
@Test
public void testOneChunks() throws Exception {
- final List<Object> output = Lists.newArrayList();
+ final List<Object> output = new ArrayList<>();
final ByteBuf input = Unpooled.copiedBuffer(CHUNKED_MESSAGE_ONE.getBytes(StandardCharsets.UTF_8));
agr.decode(null, input, output);
assertEquals(EXPECTED_MESSAGE, chunk.toString(StandardCharsets.UTF_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.nettyutil.handler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
+import java.util.ArrayList;
import java.util.List;
import org.hamcrest.CoreMatchers;
import org.junit.Test;
final ByteBuf src = Unpooled.wrappedBuffer(String.format("%s\n%s",
"[tomas;10.0.0.0:10000;tcp;client;]",
"<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>").getBytes());
- final List<Object> out = Lists.newArrayList();
+ final List<Object> out = new ArrayList<>();
new NetconfXMLToHelloMessageDecoder().decode(null, src, out);
assertEquals(1, out.size());
public void testDecodeNoHeader() throws Exception {
final ByteBuf src =
Unpooled.wrappedBuffer("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
- final List<Object> out = Lists.newArrayList();
+ final List<Object> out = new ArrayList<>();
new NetconfXMLToHelloMessageDecoder().decode(null, src, out);
assertEquals(1, out.size());
Unpooled.wrappedBuffer("<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
final ByteBuf src =
Unpooled.wrappedBuffer("<hello xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
- final List<Object> out = Lists.newArrayList();
+ final List<Object> out = new ArrayList<>();
final NetconfXMLToHelloMessageDecoder decoder = new NetconfXMLToHelloMessageDecoder();
decoder.decode(null, src, out);
decoder.decode(null, msg1, out);
public void testDecodeNotHelloReceived() throws Exception {
final ByteBuf msg1 =
Unpooled.wrappedBuffer("<rpc-reply xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"/>".getBytes());
- final List<Object> out = Lists.newArrayList();
+ final List<Object> out = new ArrayList<>();
NetconfXMLToHelloMessageDecoder decoder = new NetconfXMLToHelloMessageDecoder();
decoder.decode(null, msg1, out);
}
* 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.handler;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Lists;
import io.netty.buffer.Unpooled;
import java.util.ArrayList;
import org.junit.Test;
@Test
public void testDecodeNoMoreContent() throws Exception {
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null, Unpooled.buffer(), out);
assertEquals(0, out.size());
}
@Test
public void testDecode() throws Exception {
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("<msg/>".getBytes()), out);
assertEquals(1, out.size());
}
* XML declaration in the XML prologue.
* A leading LF is the case reported in BUG-2838.
*/
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null,
Unpooled.wrappedBuffer("\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg/>".getBytes()), out);
assertEquals(1, out.size());
* Leading CRLF can be seen with some Cisco routers
* (eg CSR1000V running IOS 15.4(1)S)
*/
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null,
Unpooled.wrappedBuffer("\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?><msg/>".getBytes()), out);
assertEquals(1, out.size());
@Test
public void testDecodeGibberish() throws Exception {
/* Test that we reject inputs where we cannot find the xml start '<' character */
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("\r\n?xml version>".getBytes()), out);
assertEquals(1, out.size());
assertTrue(FailedNetconfMessage.class.isInstance(out.get(0)));
public void testDecodeOnlyWhitespaces() throws Exception {
/* Test that we handle properly a bunch of whitespaces.
*/
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
new NetconfXMLToMessageDecoder().decode(null, Unpooled.wrappedBuffer("\r\n".getBytes()), out);
assertEquals(0, out.size());
}
/* Test that every whitespace we want to skip is actually skipped.
*/
- final ArrayList<Object> out = Lists.newArrayList();
+ final ArrayList<Object> out = new ArrayList<>();
byte[] whitespaces = {' ', '\t', '\n', '\r', '\f', 0x0b /* vertical tab */};
new NetconfXMLToMessageDecoder().decode(
null,
* 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.notifications.impl;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.HashMultiset;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.common.collect.Multimap;
import com.google.common.collect.Multiset;
-import com.google.common.collect.Sets;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.annotation.concurrent.GuardedBy;
HashMultimap.create();
@GuardedBy("this")
- private final Set<NetconfNotificationStreamListener> streamListeners = Sets.newHashSet();
+ private final Set<NetconfNotificationStreamListener> streamListeners = new HashSet<>();
@GuardedBy("this")
- private final Map<StreamNameType, Stream> streamMetadata = Maps.newHashMap();
+ private final Map<StreamNameType, Stream> streamMetadata = new HashMap<>();
@GuardedBy("this")
private final Multiset<StreamNameType> availableStreams = HashMultiset.create();
@GuardedBy("this")
- private final Set<GenericNotificationPublisherReg> notificationPublishers = Sets.newHashSet();
+ private final Set<GenericNotificationPublisherReg> notificationPublishers = new HashSet<>();
@Override
public synchronized void onNotification(final StreamNameType stream, final NetconfNotification notification) {
* 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.notifications.impl.ops;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.opendaylight.netconf.api.DocumentedException;
static final String CREATE_SUBSCRIPTION = "create-subscription";
private final NetconfNotificationRegistry notifications;
- private final List<NotificationListenerRegistration> subscriptions = Lists.newArrayList();
+ private final List<NotificationListenerRegistration> subscriptions = new ArrayList<>();
private NetconfSession netconfSession;
public CreateSubscription(final String netconfSessionIdForReporting,
* 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.topology.singleton.impl;
import akka.actor.ActorRef;
import akka.dispatch.OnComplete;
import akka.pattern.Patterns;
import akka.util.Timeout;
-import com.google.common.collect.Sets;
+import java.util.Collections;
import java.util.Set;
import javax.annotation.Nonnull;
import org.opendaylight.controller.cluster.schema.provider.RemoteYangTextSourceProvider;
@Override
public Future<Set<SourceIdentifier>> getProvidedSources() {
// NOOP
- return Futures.successful(Sets.newHashSet());
+ return Futures.successful(Collections.emptySet());
}
@Override
import com.google.common.util.concurrent.SettableFuture;
import java.io.InputStream;
import java.net.InetSocketAddress;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
// Test CreateInitialMasterActorData.
- initializeMaster(Lists.newArrayList());
+ initializeMaster(new ArrayList<>());
// Test RefreshSetupMasterActorData.
import static org.mockito.Mockito.when;
import static org.opendaylight.mdsal.common.api.CommitInfo.emptyFluentFuture;
-import com.google.common.collect.Sets;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import io.netty.util.concurrent.ImmediateEventExecutor;
import io.netty.util.concurrent.SucceededFuture;
import java.util.Collection;
+import java.util.HashSet;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
when(newNode.getDataAfter()).thenReturn(nn.build());
- final Collection<DataTreeModification<Node>> changes = Sets.newHashSet();
+ final Collection<DataTreeModification<Node>> changes = new HashSet<>();
final DataTreeModification<Node> ch = mock(DataTreeModification.class);
when(ch.getRootNode()).thenReturn(newNode);
changes.add(ch);
import com.google.common.base.Optional;
import com.google.common.base.Strings;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import io.netty.util.concurrent.Future;
import java.util.ArrayDeque;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Queue;
LOG.warn("It's curious that no one to close the session but tearDown is called!");
}
LOG.debug("Tearing down {}", reason);
- final List<UncancellableFuture<RpcResult<NetconfMessage>>> futuresToCancel = Lists.newArrayList();
+ final List<UncancellableFuture<RpcResult<NetconfMessage>>> futuresToCancel = new ArrayList<>();
sessionLock.lock();
try {
if (currentSession != null) {
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
+import java.util.ArrayList;
import java.util.List;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.dom.api.DOMActionService;
private final RemoteDeviceId id;
private final NetconfDeviceSalProvider salProvider;
- private final List<AutoCloseable> salRegistrations = Lists.newArrayList();
+ private final List<AutoCloseable> salRegistrations = new ArrayList<>();
public NetconfDeviceSalFacade(final RemoteDeviceId id, final DOMMountPointService mountPointService,
final DataBroker dataBroker) {
* 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.sal.connect.netconf.sal.tx;
import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.SettableFuture;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
protected final RemoteDeviceId id;
protected final NetconfBaseOps netOps;
protected final boolean rollbackSupport;
- protected final List<ListenableFuture<DOMRpcResult>> resultsFutures;
+ protected final List<ListenableFuture<DOMRpcResult>> resultsFutures = new ArrayList<>();
private final List<TxListener> listeners = new CopyOnWriteArrayList<>();
// Allow commit to be called only once
protected volatile boolean finished = false;
this.netOps = netOps;
this.id = id;
this.rollbackSupport = rollbackSupport;
- this.resultsFutures = Lists.newArrayList();
init();
}
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
NetconfRemoteSchemaYangSourceProvider
.createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
- final Map<QName, Object> keys = Maps.newHashMap();
+ final Map<QName, Object> keys = new HashMap<>();
for (final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> value : values) {
keys.put(value.getNodeType(), value.getValue());
}
NetconfRemoteSchemaYangSourceProvider
.createGetSchemaRequest("module", Optional.of("2012-12-12")).getValue());
- final Map<QName, Object> keys = Maps.newHashMap();
+ final Map<QName, Object> keys = new HashMap<>();
for (final DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> value : values) {
keys.put(value.getNodeType(), value.getValue());
}
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import io.netty.channel.Channel;
-import io.netty.util.internal.ConcurrentSet;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
private static final Logger LOG = LoggerFactory.getLogger(AbstractCommonSubscriber.class);
- private final Set<Channel> subscribers = new ConcurrentSet<>();
+ private final Set<Channel> subscribers = ConcurrentHashMap.newKeySet();
private final EventBus eventBus;
@SuppressWarnings("rawtypes")
import static org.junit.Assert.assertNull;
import static org.junit.Assert.fail;
-import com.google.common.collect.Maps;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
+import java.util.HashMap;
import java.util.Map;
import org.junit.BeforeClass;
import org.opendaylight.controller.sal.restconf.impl.test.YangAndXmlAndDataSchemaLoader;
private static void jsonReadContElements(final JsonReader jsonReader) throws IOException {
jsonReader.beginObject();
- final Map<String, LeafVerifier> expectedMap = Maps.newHashMap();
+ final Map<String, LeafVerifier> expectedMap = new HashMap<>();
expectedMap.put("lfnint8Min", new NumberVerifier(-128));
expectedMap.put("lfnint8Max", new NumberVerifier(127));
expectedMap.put("lfnint16Min", new NumberVerifier(-32768));
import com.google.common.collect.ImmutableClassToInstanceMap;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FluentFuture;
+import java.util.ArrayList;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
final PatchContext patchContext = mock(PatchContext.class);
final InstanceIdentifierContext<?> identifierContext = mock(InstanceIdentifierContext.class);
- when(patchContext.getData()).thenReturn(Lists.newArrayList());
+ when(patchContext.getData()).thenReturn(new ArrayList<>());
doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
// no mount point
final DOMDataBroker mountDataBroker = mock(DOMDataBroker.class);
final DOMDataTreeReadWriteTransaction transaction = mock(DOMDataTreeReadWriteTransaction.class);
- when(patchContext.getData()).thenReturn(Lists.newArrayList());
+ when(patchContext.getData()).thenReturn(new ArrayList<>());
doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
// return mount point with broker
final DOMDataBroker mountDataBroker = mock(DOMDataBroker.class);
final DOMDataTreeReadWriteTransaction transaction = mock(DOMDataTreeReadWriteTransaction.class);
- when(patchContext.getData()).thenReturn(Lists.newArrayList());
+ when(patchContext.getData()).thenReturn(new ArrayList<>());
doReturn(identifierContext).when(patchContext).getInstanceIdentifierContext();
when(identifierContext.getMountPoint()).thenReturn(mountPoint);
import static org.mockito.Mockito.when;
import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
import java.net.URI;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
return;
}
- final Map<String, NodeData> expChildMap = Maps.newHashMap();
+ final Map<String, NodeData> expChildMap = new HashMap<>();
for (final NodeData expChild : (List<NodeData>) nodeData.data) {
expChildMap.put(expChild.key.toString(), expChild);
}
import static org.mockito.Mockito.when;
import com.google.common.collect.Iterators;
-import com.google.common.collect.Maps;
import com.google.common.io.ByteStreams;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
final ErrorInfoVerifier errorInfoVerifier) {
JsonElement errorInfoElement = null;
- final Map<String, String> leafMap = Maps.newHashMap();
+ final Map<String, String> leafMap = new HashMap<>();
for (final Entry<String, JsonElement> entry : errorEntryElement.getAsJsonObject().entrySet()) {
final String leafName = entry.getKey();
final JsonElement leafElement = entry.getValue();
"2014-01-14", "create-notification-stream")).when(schemaNode).getQName();
doReturn(null).when(iiCtx).getMountPoint();
- final Set<DataContainerChild<?, ?>> children = Sets.newHashSet();
+ final Set<DataContainerChild<?, ?>> children = new HashSet<>();
final DataContainerChild<?, ?> child = mock(DataContainerChild.class,
Mockito.withSettings().extraInterfaces(LeafSetNode.class));
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import io.netty.channel.Channel;
-import io.netty.util.internal.ConcurrentSet;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Executors;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.slf4j.Logger;
private static final Logger LOG = LoggerFactory.getLogger(AbstractCommonSubscriber.class);
- private final Set<Channel> subscribers = new ConcurrentSet<>();
+ private final Set<Channel> subscribers = ConcurrentHashMap.newKeySet();
private final EventBus eventBus;
@SuppressWarnings("rawtypes")
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Optional;
import java.util.Set;
@Test
public void writeContainerWithLimitedFieldsTest() throws Exception {
final List<Set<QName>> limitedFields = new ArrayList<>();
- limitedFields.add(Sets.newHashSet());
+ limitedFields.add(new HashSet<>());
final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter(
writer, null, limitedFields);
@Test
public void writeMapEntryNodeWithLimitedFieldsTest() throws Exception {
final List<Set<QName>> limitedFields = new ArrayList<>();
- limitedFields.add(Sets.newHashSet());
+ limitedFields.add(new HashSet<>());
final ParameterAwareNormalizedNodeWriter parameterWriter = ParameterAwareNormalizedNodeWriter.forStreamWriter(
writer, null, limitedFields);
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import org.junit.Before;
public void serializeListWithNoKeysTest() {
final YangInstanceIdentifier data = YangInstanceIdentifier.builder()
.node(QName.create("serializer:test", "2016-06-06", "list-no-key"))
- .nodeWithKey(QName.create("serializer:test", "2016-06-06", "list-no-key"), Maps.newHashMap())
+ .nodeWithKey(QName.create("serializer:test", "2016-06-06", "list-no-key"), new HashMap<>())
.build();
final String result = YangInstanceIdentifierSerializer.create(this.schemaContext, data);