From bd5fe730fdef0d990163e60fdbbc957df34bdba9 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Thu, 27 Jan 2022 20:27:20 +0100 Subject: [PATCH] Migrate to Empty.value() Empty.getInstance() is being removed, migrate to its replacement. Change-Id: Ic12e07df3c16827afcddf32f2fb595389e4efdbe Signed-off-by: Robert Varga --- .../netconf/callhome/mount/SingleReconnectFuture.java | 2 +- .../impl/CapabilityChangeNotificationProducer.java | 2 +- .../impl/CapabilityChangeNotificationProducerTest.java | 2 +- .../netconf/impl/osgi/NetconfCapabilityMonitoringService.java | 2 +- .../java/org/opendaylight/netconf/util/StreamingContext.java | 2 +- .../netconf/sal/connect/netconf/util/NetconfBaseOps.java | 4 ++-- .../connect/netconf/sal/tx/WriteCandidateRunningTxTest.java | 2 +- .../schema/mapping/BaseRpcSchemalessTransformerTest.java | 2 +- .../restconf/common/util/OperationsResourceUtils.java | 2 +- .../netconf/sal/restconf/impl/DataNormalizationOperation.java | 2 +- .../opendaylight/netconf/sal/restconf/impl/RestconfImpl.java | 2 +- .../controller/sal/restconf/impl/test/RestconfImplTest.java | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/SingleReconnectFuture.java b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/SingleReconnectFuture.java index 1a26a4f44f..121235dfa9 100644 --- a/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/SingleReconnectFuture.java +++ b/netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/SingleReconnectFuture.java @@ -27,7 +27,7 @@ final class SingleReconnectFuture extends DefaultPromise implements Recon if (future.isCancelled()) { cancel(false); } else if (future.isSuccess()) { - setSuccess(Empty.getInstance()); + setSuccess(Empty.value()); } else { setFailure(future.cause()); } diff --git a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java index 87cfa2a081..c27b9387be 100644 --- a/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java +++ b/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducer.java @@ -87,7 +87,7 @@ public final class CapabilityChangeNotificationProducer extends OperationalDatas private void publishNotification(final Set added, final Set removed) { final NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder(); netconfCapabilityChangeBuilder.setChangedBy(new ChangedByBuilder().setServerOrUser(new ServerBuilder() - .setServer(Empty.getInstance()).build()).build()); + .setServer(Empty.value()).build()).build()); netconfCapabilityChangeBuilder.setAddedCapability(ImmutableList.copyOf(added)); netconfCapabilityChangeBuilder.setDeletedCapability(ImmutableList.copyOf(removed)); // TODO modified should be computed ... but why ? diff --git a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java index 61969db2c6..6c721dc05f 100644 --- a/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java +++ b/netconf/mdsal-netconf-notification/src/test/java/org/opendaylight/netconf/mdsal/notification/impl/CapabilityChangeNotificationProducerTest.java @@ -126,7 +126,7 @@ public class CapabilityChangeNotificationProducerTest { private static NetconfCapabilityChange changedCapabilitesFrom(final List added, final List deleted) { NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder(); netconfCapabilityChangeBuilder.setChangedBy(new ChangedByBuilder().setServerOrUser( - new ServerBuilder().setServer(Empty.getInstance()).build()).build()); + new ServerBuilder().setServer(Empty.value()).build()).build()); netconfCapabilityChangeBuilder.setModifiedCapability(Collections.emptyList()); netconfCapabilityChangeBuilder.setAddedCapability(added); diff --git a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java index 2c658a7518..543f657cb9 100644 --- a/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java +++ b/netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/osgi/NetconfCapabilityMonitoringService.java @@ -217,7 +217,7 @@ class NetconfCapabilityMonitoringService implements CapabilityListener, AutoClos final NetconfCapabilityChangeBuilder netconfCapabilityChangeBuilder = new NetconfCapabilityChangeBuilder(); netconfCapabilityChangeBuilder .setChangedBy(new ChangedByBuilder().setServerOrUser( - new ServerBuilder().setServer(Empty.getInstance()).build()).build()); + new ServerBuilder().setServer(Empty.value()).build()).build()); netconfCapabilityChangeBuilder.setDeletedCapability(Lists.newArrayList(Collections2 .transform(removed, CAPABILITY_TO_URI))); netconfCapabilityChangeBuilder.setAddedCapability(Lists.newArrayList(Collections2 diff --git a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/StreamingContext.java b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/StreamingContext.java index eb02e2b72e..abfd79a83a 100644 --- a/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/StreamingContext.java +++ b/netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/StreamingContext.java @@ -372,7 +372,7 @@ abstract class StreamingContext implements Identifiable< private static final class LeafListEntry extends AbstractSimple> { LeafListEntry(final LeafListSchemaNode potential) { - super(new NodeWithValue<>(potential.getQName(), Empty.getInstance())); + super(new NodeWithValue<>(potential.getQName(), Empty.value())); } @Override diff --git a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java index 38135fadd3..6b6079767c 100644 --- a/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java +++ b/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java @@ -463,7 +463,7 @@ public final class NetconfBaseOps { .withNodeIdentifier(NETCONF_SOURCE_NODEID) .withChild(Builders.choiceBuilder() .withNodeIdentifier(CONFIG_SOURCE_NODEID) - .withChild(ImmutableNodes.leafNode(datastore, Empty.getInstance())) + .withChild(ImmutableNodes.leafNode(datastore, Empty.value())) .build()) .build(); } @@ -476,7 +476,7 @@ public final class NetconfBaseOps { public static @NonNull ContainerNode getTargetNode(final QName datastore) { return Builders.containerBuilder().withNodeIdentifier(NETCONF_TARGET_NODEID) .withChild(Builders.choiceBuilder().withNodeIdentifier(CONFIG_TARGET_NODEID).withChild( - Builders.leafBuilder().withNodeIdentifier(toId(datastore)).withValue(Empty.getInstance()).build()) + Builders.leafBuilder().withNodeIdentifier(toId(datastore)).withValue(Empty.value()).build()) .build()).build(); } diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTxTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTxTest.java index 1af16dec4b..928636b206 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTxTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateRunningTxTest.java @@ -82,7 +82,7 @@ public class WriteCandidateRunningTxTest extends AbstractTestModelTest { private static ContainerNode getLockContent(final QName op, final QName datastore) { final LeafNode datastoreLeaf = Builders.leafBuilder().withNodeIdentifier(toId(datastore)) - .withValue(Empty.getInstance()).build(); + .withValue(Empty.value()).build(); final ChoiceNode choice = Builders.choiceBuilder() .withNodeIdentifier(toId(ConfigTarget.QNAME)) .withChild(datastoreLeaf) diff --git a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/BaseRpcSchemalessTransformerTest.java b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/BaseRpcSchemalessTransformerTest.java index 1506fb1446..e91abae2fc 100644 --- a/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/BaseRpcSchemalessTransformerTest.java +++ b/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/BaseRpcSchemalessTransformerTest.java @@ -90,7 +90,7 @@ public class BaseRpcSchemalessTransformerTest extends AbstractBaseSchemasTest { new YangInstanceIdentifier.NodeIdentifier(ConfigTarget.QNAME)) .withChild(Builders.leafBuilder().withNodeIdentifier( new YangInstanceIdentifier.NodeIdentifier(Candidate.QNAME)) - .withValue(Empty.getInstance()).build()) + .withValue(Empty.value()).build()) .build(); final ContainerNode target = Builders.containerBuilder() .withNodeIdentifier( diff --git a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsResourceUtils.java b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsResourceUtils.java index 03e289d19e..ceeb963966 100644 --- a/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsResourceUtils.java +++ b/restconf/restconf-common/src/main/java/org/opendaylight/restconf/common/util/OperationsResourceUtils.java @@ -57,7 +57,7 @@ public final class OperationsResourceUtils { final DataContainerNodeBuilder operationsBuilder = Builders.containerBuilder() .withNodeIdentifier(new NodeIdentifier(OperationsContainerSchemaNode.QNAME)); for (final OperationsLeafSchemaNode leaf : rpcLeafSchemas) { - operationsBuilder.withChild(ImmutableNodes.leafNode(leaf.getQName(), Empty.getInstance())); + operationsBuilder.withChild(ImmutableNodes.leafNode(leaf.getQName(), Empty.value())); } return Map.entry(new InstanceIdentifierContext<>(null, operatationsSchema, mountPoint, diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/DataNormalizationOperation.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/DataNormalizationOperation.java index 0499e21d60..57ba15374a 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/DataNormalizationOperation.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/DataNormalizationOperation.java @@ -93,7 +93,7 @@ abstract class DataNormalizationOperation implements Ide private static final class LeafListEntryNormalization extends SimpleTypeNormalization { LeafListEntryNormalization(final LeafListSchemaNode potential) { - super(new NodeWithValue<>(potential.getQName(), Empty.getInstance())); + super(new NodeWithValue<>(potential.getQName(), Empty.value())); } } diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java index a07b832d60..7ee506bde9 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java @@ -1487,7 +1487,7 @@ public final class RestconfImpl implements RestconfService { final DataSchemaNode eventsSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null); checkState(eventsSchemaNode instanceof LeafSchemaNode); streamNodeValues.withChild( - SchemaAwareBuilders.leafBuilder((LeafSchemaNode) eventsSchemaNode).withValue(Empty.getInstance()).build()); + SchemaAwareBuilders.leafBuilder((LeafSchemaNode) eventsSchemaNode).withValue(Empty.value()).build()); return streamNodeValues.build(); } diff --git a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java index 02fa1fe8e2..ac208c6e06 100644 --- a/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java +++ b/restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java @@ -248,7 +248,7 @@ public class RestconfImplTest { instanceDataChildrenByName = ControllerContext.findInstanceDataChildrenByName(listStreamSchemaNode, "events"); final DataSchemaNode eventsSchemaNode = Iterables.getFirst(instanceDataChildrenByName, null); streamNodeValues.withChild( - SchemaAwareBuilders.leafBuilder((LeafSchemaNode) eventsSchemaNode).withValue(Empty.getInstance()).build()); + SchemaAwareBuilders.leafBuilder((LeafSchemaNode) eventsSchemaNode).withValue(Empty.value()).build()); assertNotNull(streamNodeValues.build()); } -- 2.36.6