Use YangInstanceIdentifier.EMPTY 14/39014/7
authorRobert Varga <rovarga@cisco.com>
Tue, 17 May 2016 20:58:47 +0000 (22:58 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Fri, 20 May 2016 08:36:22 +0000 (08:36 +0000)
While the empty build resolves to the same instance, inline the constant
directly saves a bit of the constant pool and makes it a bit more explicit.

Change-Id: I6c92183f473c551a882d2f2a23b5de13406b1982
Signed-off-by: Robert Varga <rovarga@cisco.com>
17 files changed:
opendaylight/md-sal/sal-binding-broker/src/main/java/org/opendaylight/controller/md/sal/binding/impl/BindingDOMRpcProviderServiceAdapter.java
opendaylight/md-sal/sal-clustering-commons/src/test/java/org/opendaylight/controller/cluster/datastore/node/NormalizedNodeToNodeCodecTest.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardDataTree.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardReadTransaction.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardSnapshotCohort.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/databroker/ConcurrentDOMDataBrokerTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/AbstractShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DataChangeListenerProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DistributedDataStoreIntegrationTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/LocalTransactionContextTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardTransactionTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/TransactionProxyTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/compat/PreLithiumShardTest.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregatorTest.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/DOMRpcRoutingTable.java
opendaylight/md-sal/sal-dom-broker/src/main/java/org/opendaylight/controller/md/sal/dom/broker/impl/GlobalDOMRpcRoutingTableEntry.java

index f9cbe27..1232035 100644 (file)
@@ -25,7 +25,7 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 public class BindingDOMRpcProviderServiceAdapter {
 
-    private static final Set<YangInstanceIdentifier> GLOBAL = ImmutableSet.of(YangInstanceIdentifier.builder().build());
+    private static final Set<YangInstanceIdentifier> GLOBAL = ImmutableSet.of(YangInstanceIdentifier.EMPTY);
     private final BindingToNormalizedNodeCodec codec;
     private final DOMRpcProviderService domRpcRegistry;
 
index 0260ffb..ac8fa41 100644 (file)
@@ -8,6 +8,10 @@
 
 package org.opendaylight.controller.cluster.datastore.node;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter;
@@ -22,12 +26,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
 public class NormalizedNodeToNodeCodecTest {
   private SchemaContext schemaContext;
 
@@ -52,7 +50,7 @@ public class NormalizedNodeToNodeCodecTest {
 
     NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id);
     new NormalizedNodeNavigator(normalizedNodeGetter).navigate(
-        PathUtils.toString(YangInstanceIdentifier.builder().build()), documentOne);
+        PathUtils.toString(YangInstanceIdentifier.EMPTY), documentOne);
 
     // Validate the value of id can be retrieved from the normalized node
     NormalizedNode<?, ?> output = normalizedNodeGetter.getOutput();
index 210d7f4..17c3cd8 100644 (file)
@@ -46,7 +46,6 @@ import org.slf4j.LoggerFactory;
 @NotThreadSafe
 public class ShardDataTree extends ShardDataTreeTransactionParent {
     private static final Logger LOG = LoggerFactory.getLogger(ShardDataTree.class);
-    private static final YangInstanceIdentifier ROOT_PATH = YangInstanceIdentifier.builder().build();
 
     private final Map<String, ShardDataTreeTransactionChain> transactionChains = new HashMap<>();
     private final ShardDataTreeChangeListenerPublisher treeChangeListenerPublisher;
@@ -164,9 +163,9 @@ public class ShardDataTree extends ShardDataTreeTransactionParent {
     }
 
     private Optional<DataTreeCandidate> readCurrentData() {
-        final Optional<NormalizedNode<?, ?>> currentState = dataTree.takeSnapshot().readNode(ROOT_PATH);
+        final Optional<NormalizedNode<?, ?>> currentState = dataTree.takeSnapshot().readNode(YangInstanceIdentifier.EMPTY);
         return currentState.isPresent() ? Optional.of(DataTreeCandidates.fromNormalizedNode(
-                ROOT_PATH, currentState.get())) : Optional.<DataTreeCandidate>absent();
+            YangInstanceIdentifier.EMPTY, currentState.get())) : Optional.<DataTreeCandidate>absent();
     }
 
     public Entry<ListenerRegistration<DOMDataTreeChangeListener>, Optional<DataTreeCandidate>> registerTreeChangeListener(
index 6b40d9b..8ece259 100644 (file)
@@ -25,8 +25,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
  * Date: 8/6/14
  */
 public class ShardReadTransaction extends ShardTransaction {
-    private static final YangInstanceIdentifier DATASTORE_ROOT = YangInstanceIdentifier.builder().build();
-
     private final AbstractShardDataTreeTransaction<?> transaction;
 
     public ShardReadTransaction(AbstractShardDataTreeTransaction<?> transaction, ActorRef shardActor,
@@ -57,7 +55,7 @@ public class ShardReadTransaction extends ShardTransaction {
 
         final ActorRef sender = getSender();
         final ActorRef self = getSelf();
-        final Optional<NormalizedNode<?, ?>> result = transaction.getSnapshot().readNode(DATASTORE_ROOT);
+        final Optional<NormalizedNode<?, ?>> result = transaction.getSnapshot().readNode(YangInstanceIdentifier.EMPTY);
 
         byte[] serialized = SerializationUtils.serializeNormalizedNode(result.get());
         sender.tell(new CaptureSnapshotReply(serialized), self);
index 30299c7..e49aa1e 100644 (file)
@@ -24,14 +24,12 @@ import org.slf4j.Logger;
  * @author Thomas Pantelis
  */
 class ShardSnapshotCohort implements RaftActorSnapshotCohort {
-
-    private static final YangInstanceIdentifier DATASTORE_ROOT = YangInstanceIdentifier.builder().build();
-
-    private int createSnapshotTransactionCounter;
     private final ShardTransactionActorFactory transactionActorFactory;
     private final ShardDataTree store;
-    private final Logger log;
     private final String logId;
+    private final Logger log;
+
+    private int createSnapshotTransactionCounter;
 
     ShardSnapshotCohort(ShardTransactionActorFactory transactionActorFactory, ShardDataTree store,
             Logger log, String logId) {
@@ -70,10 +68,10 @@ class ShardSnapshotCohort implements RaftActorSnapshotCohort {
             NormalizedNode<?, ?> node = SerializationUtils.deserializeNormalizedNode(snapshotBytes);
 
             // delete everything first
-            transaction.getSnapshot().delete(DATASTORE_ROOT);
+            transaction.getSnapshot().delete(YangInstanceIdentifier.EMPTY);
 
             // Add everything from the remote node back
-            transaction.getSnapshot().write(DATASTORE_ROOT, node);
+            transaction.getSnapshot().write(YangInstanceIdentifier.EMPTY, node);
             syncCommitTransaction(transaction);
         } catch (InterruptedException | ExecutionException e) {
             log.error("{}: An exception occurred when applying snapshot", logId, e);
index 7315ac7..3a88a72 100644 (file)
@@ -353,14 +353,14 @@ public class ConcurrentDOMDataBrokerTest {
                 configDomStore), futureExecutor)) {
             DOMDataReadWriteTransaction dataTxn = dataBroker.newReadWriteTransaction();
 
-            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
-            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
-            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build());
+            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
+            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
+            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
 
             verify(configDomStore, never()).newReadWriteTransaction();
             verify(operationalDomStore, times(1)).newReadWriteTransaction();
 
-            dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
+            dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
 
             verify(configDomStore, times(1)).newReadWriteTransaction();
             verify(operationalDomStore, times(1)).newReadWriteTransaction();
@@ -382,13 +382,13 @@ public class ConcurrentDOMDataBrokerTest {
                 configDomStore), futureExecutor)) {
             DOMDataWriteTransaction dataTxn = dataBroker.newWriteOnlyTransaction();
 
-            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
-            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
+            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
+            dataTxn.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
 
             verify(configDomStore, never()).newWriteOnlyTransaction();
             verify(operationalDomStore, times(1)).newWriteOnlyTransaction();
 
-            dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
+            dataTxn.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
 
             verify(configDomStore, times(1)).newWriteOnlyTransaction();
             verify(operationalDomStore, times(1)).newWriteOnlyTransaction();
@@ -409,13 +409,13 @@ public class ConcurrentDOMDataBrokerTest {
                 configDomStore), futureExecutor)) {
             DOMDataReadOnlyTransaction dataTxn = dataBroker.newReadOnlyTransaction();
 
-            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build());
-            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build());
+            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
+            dataTxn.read(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
 
             verify(configDomStore, never()).newReadOnlyTransaction();
             verify(operationalDomStore, times(1)).newReadOnlyTransaction();
 
-            dataTxn.read(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.builder().build());
+            dataTxn.read(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY);
 
             verify(configDomStore, times(1)).newReadOnlyTransaction();
             verify(operationalDomStore, times(1)).newReadOnlyTransaction();
@@ -449,7 +449,7 @@ public class ConcurrentDOMDataBrokerTest {
         }) {
             DOMDataReadWriteTransaction domDataReadWriteTransaction = dataBroker.newReadWriteTransaction();
 
-            domDataReadWriteTransaction.delete(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build());
+            domDataReadWriteTransaction.delete(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY);
 
             domDataReadWriteTransaction.submit();
 
@@ -494,8 +494,8 @@ public class ConcurrentDOMDataBrokerTest {
         }) {
             DOMDataReadWriteTransaction domDataReadWriteTransaction = dataBroker.newReadWriteTransaction();
 
-            domDataReadWriteTransaction.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
-            domDataReadWriteTransaction.merge(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
+            domDataReadWriteTransaction.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
+            domDataReadWriteTransaction.merge(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
 
             domDataReadWriteTransaction.submit();
 
@@ -538,7 +538,7 @@ public class ConcurrentDOMDataBrokerTest {
 
             verify(mockChain, never()).newWriteOnlyTransaction();
 
-            domDataWriteTransaction.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.builder().build(), mock(NormalizedNode.class));
+            domDataWriteTransaction.put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.EMPTY, mock(NormalizedNode.class));
         }
     }
 
index 88caa86..cc2e29e 100644 (file)
@@ -396,7 +396,7 @@ public abstract class AbstractShardTest extends AbstractActorTest{
 
         writeToStore(testStore, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-        final NormalizedNode<?, ?> root = readStore(testStore, YangInstanceIdentifier.builder().build());
+        final NormalizedNode<?, ?> root = readStore(testStore, YangInstanceIdentifier.EMPTY);
 
         InMemorySnapshotStore.addSnapshot(shardID.toString(), Snapshot.create(
                 SerializationUtils.serializeNormalizedNode(root),
@@ -457,7 +457,7 @@ public abstract class AbstractShardTest extends AbstractActorTest{
         final DataTreeCandidateTip mockCandidate = mock(DataTreeCandidateTip.class, name);
         final DataTreeCandidateNode mockCandidateNode = mock(DataTreeCandidateNode.class, name + "-node");
         doReturn(ModificationType.UNMODIFIED).when(mockCandidateNode).getModificationType();
-        doReturn(YangInstanceIdentifier.builder().build()).when(mockCandidate).getRootPath();
+        doReturn(YangInstanceIdentifier.EMPTY).when(mockCandidate).getRootPath();
         doReturn(mockCandidateNode).when(mockCandidate).getRootNode();
         return mockCandidate;
     }
index 68e7e10..ee06b68 100644 (file)
@@ -38,13 +38,13 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
 
     @Override
     public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getCreatedData() {
-      createdData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createDocumentOne(CompositeModel.createTestContext()));
+      createdData.put(YangInstanceIdentifier.EMPTY, CompositeModel.createDocumentOne(CompositeModel.createTestContext()));
       return createdData;
     }
 
     @Override
     public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getUpdatedData() {
-      updatedData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createTestContainer());
+      updatedData.put(YangInstanceIdentifier.EMPTY, CompositeModel.createTestContainer());
       return updatedData;
 
     }
@@ -58,7 +58,7 @@ public class DataChangeListenerProxyTest extends AbstractActorTest {
 
     @Override
     public Map<YangInstanceIdentifier, NormalizedNode<?, ?>> getOriginalData() {
-      originalData.put(YangInstanceIdentifier.builder().build(), CompositeModel.createFamily());
+      originalData.put(YangInstanceIdentifier.EMPTY, CompositeModel.createFamily());
       return originalData;
     }
 
index 9d86b8d..f00472c 100644 (file)
@@ -1169,7 +1169,7 @@ public class DistributedDataStoreIntegrationTest {
             ShardDataTree dataTree = new ShardDataTree(SchemaContextHelper.full(), TreeType.OPERATIONAL);
             AbstractShardTest.writeToStore(dataTree, CarsModel.BASE_PATH, carsNode);
             NormalizedNode<?, ?> root = AbstractShardTest.readStore(dataTree.getDataTree(),
-                    YangInstanceIdentifier.builder().build());
+                    YangInstanceIdentifier.EMPTY);
 
             Snapshot carsSnapshot = Snapshot.create(SerializationUtils.serializeNormalizedNode(root),
                     Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1");
@@ -1177,7 +1177,7 @@ public class DistributedDataStoreIntegrationTest {
             NormalizedNode<?, ?> peopleNode = PeopleModel.create();
             dataTree = new ShardDataTree(SchemaContextHelper.full(), TreeType.OPERATIONAL);
             AbstractShardTest.writeToStore(dataTree, PeopleModel.BASE_PATH, peopleNode);
-            root = AbstractShardTest.readStore(dataTree.getDataTree(), YangInstanceIdentifier.builder().build());
+            root = AbstractShardTest.readStore(dataTree.getDataTree(), YangInstanceIdentifier.EMPTY);
 
             Snapshot peopleSnapshot = Snapshot.create(SerializationUtils.serializeNormalizedNode(root),
                     Collections.<ReplicatedLogEntry>emptyList(), 2, 1, 2, 1, 1, "member-1");
index bb32aca..dd81b6b 100644 (file)
@@ -68,7 +68,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testWrite() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class);
         localTransactionContext.executeModification(new WriteModification(yangInstanceIdentifier, normalizedNode));
         verify(readWriteTransaction).write(yangInstanceIdentifier, normalizedNode);
@@ -76,7 +76,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testMerge() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class);
         localTransactionContext.executeModification(new MergeModification(yangInstanceIdentifier, normalizedNode));
         verify(readWriteTransaction).merge(yangInstanceIdentifier, normalizedNode);
@@ -84,7 +84,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testDelete() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         localTransactionContext.executeModification(new DeleteModification(yangInstanceIdentifier));
         verify(readWriteTransaction).delete(yangInstanceIdentifier);
     }
@@ -92,7 +92,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testRead() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class);
         doReturn(Futures.immediateCheckedFuture(Optional.of(normalizedNode))).when(readWriteTransaction).read(yangInstanceIdentifier);
         localTransactionContext.executeRead(new ReadData(yangInstanceIdentifier, DataStoreVersions.CURRENT_VERSION),
@@ -102,7 +102,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testExists() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         doReturn(Futures.immediateCheckedFuture(true)).when(readWriteTransaction).exists(yangInstanceIdentifier);
         localTransactionContext.executeRead(new DataExists(yangInstanceIdentifier, DataStoreVersions.CURRENT_VERSION),
                 SettableFuture.<Boolean>create());
@@ -123,7 +123,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testReadyWithWriteError() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class);
         RuntimeException error = new RuntimeException("mock");
         doThrow(error).when(readWriteTransaction).write(yangInstanceIdentifier, normalizedNode);
@@ -138,7 +138,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testReadyWithMergeError() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?, ?> normalizedNode = mock(NormalizedNode.class);
         RuntimeException error = new RuntimeException("mock");
         doThrow(error).when(readWriteTransaction).merge(yangInstanceIdentifier, normalizedNode);
@@ -153,7 +153,7 @@ public class LocalTransactionContextTest {
 
     @Test
     public void testReadyWithDeleteError() {
-        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier yangInstanceIdentifier = YangInstanceIdentifier.EMPTY;
         RuntimeException error = new RuntimeException("mock");
         doThrow(error).when(readWriteTransaction).delete(yangInstanceIdentifier);
 
index 2f19180..994c91c 100644 (file)
@@ -421,7 +421,7 @@ public class ShardTest extends AbstractShardTest {
 
         writeToStore(store, TestModel.TEST_PATH, container);
 
-        final YangInstanceIdentifier root = YangInstanceIdentifier.builder().build();
+        final YangInstanceIdentifier root = YangInstanceIdentifier.EMPTY;
         final NormalizedNode<?,?> expected = readStore(store, root);
 
         final Snapshot snapshot = Snapshot.create(SerializationUtils.serializeNormalizedNode(expected),
@@ -1213,7 +1213,7 @@ public class ShardTest extends AbstractShardTest {
 
                 final String transactionID = "tx1";
                 final MutableCompositeModification modification = new MutableCompositeModification();
-                modification.addModification(new DeleteModification(YangInstanceIdentifier.builder().build()));
+                modification.addModification(new DeleteModification(YangInstanceIdentifier.EMPTY));
                 final ShardDataTreeCohort cohort = mock(ShardDataTreeCohort.class, "cohort1");
                 doReturn(Futures.immediateFuture(Boolean.TRUE)).when(cohort).canCommit();
                 doReturn(Futures.immediateFuture(Boolean.TRUE)).when(cohort).preCommit();
@@ -2106,7 +2106,7 @@ public class ShardTest extends AbstractShardTest {
             waitUntilLeader(shard);
             writeToStore(shard, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-            final NormalizedNode<?,?> expectedRoot = readStore(shard, YangInstanceIdentifier.builder().build());
+            final NormalizedNode<?,?> expectedRoot = readStore(shard, YangInstanceIdentifier.EMPTY);
 
             // Trigger creation of a snapshot by ensuring
             final RaftActorContext raftActorContext = ((TestShard) shard.underlyingActor()).getRaftActorContext();
@@ -2153,16 +2153,16 @@ public class ShardTest extends AbstractShardTest {
         commitTransaction(store, putTransaction);
 
 
-        final NormalizedNode<?, ?> expected = readStore(store, YangInstanceIdentifier.builder().build());
+        final NormalizedNode<?, ?> expected = readStore(store, YangInstanceIdentifier.EMPTY);
 
         final DataTreeModification writeTransaction = store.takeSnapshot().newModification();
 
-        writeTransaction.delete(YangInstanceIdentifier.builder().build());
-        writeTransaction.write(YangInstanceIdentifier.builder().build(), expected);
+        writeTransaction.delete(YangInstanceIdentifier.EMPTY);
+        writeTransaction.write(YangInstanceIdentifier.EMPTY, expected);
 
         commitTransaction(store, writeTransaction);
 
-        final NormalizedNode<?, ?> actual = readStore(store, YangInstanceIdentifier.builder().build());
+        final NormalizedNode<?, ?> actual = readStore(store, YangInstanceIdentifier.EMPTY);
 
         assertEquals(expected, actual);
     }
index a94a9a6..e0b3492 100644 (file)
@@ -108,8 +108,8 @@ public class ShardTransactionTest extends AbstractActorTest {
         }
 
         private void testOnReceiveReadData(final ActorRef transaction) {
-            transaction.tell(new ReadData(YangInstanceIdentifier.builder().build(),
-                    DataStoreVersions.CURRENT_VERSION),getRef());
+            transaction.tell(new ReadData(YangInstanceIdentifier.EMPTY,
+                    DataStoreVersions.CURRENT_VERSION), getRef());
 
             ReadDataReply reply = expectMsgClass(duration("5 seconds"), ReadDataReply.class);
 
@@ -151,8 +151,8 @@ public class ShardTransactionTest extends AbstractActorTest {
         }
 
         private void testOnReceiveDataExistsPositive(final ActorRef transaction) {
-            transaction.tell(new DataExists(YangInstanceIdentifier.builder().build(),
-                    DataStoreVersions.CURRENT_VERSION),getRef());
+            transaction.tell(new DataExists(YangInstanceIdentifier.EMPTY,
+                    DataStoreVersions.CURRENT_VERSION), getRef());
 
             DataExistsReply reply = expectMsgClass(duration("5 seconds"), DataExistsReply.class);
 
@@ -347,7 +347,7 @@ public class ShardTransactionTest extends AbstractActorTest {
                     ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
             NormalizedNode<?,?> expectedRoot = ShardTest.readStore(store.getDataTree(),
-                    YangInstanceIdentifier.builder().build());
+                    YangInstanceIdentifier.EMPTY);
 
             final ActorRef transaction = newTransactionActor(TransactionType.READ_ONLY, readOnlyTransaction(),
                     "testOnReceiveCreateSnapshot");
index c3f93ec..7d23c0a 100644 (file)
@@ -1497,7 +1497,7 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
         TransactionProxy transactionProxy = new TransactionProxy(mockComponentFactory, READ_ONLY);
 
         Optional<NormalizedNode<?, ?>> readOptional = transactionProxy.read(
-                YangInstanceIdentifier.builder().build()).get(5, TimeUnit.SECONDS);
+                YangInstanceIdentifier.EMPTY).get(5, TimeUnit.SECONDS);
 
         assertEquals("NormalizedNode isPresent", true, readOptional.isPresent());
 
@@ -1544,6 +1544,6 @@ public class TransactionProxyTest extends AbstractTransactionProxyTest {
                         eqCreateTransaction(memberName, TransactionType.READ_ONLY), any(Timeout.class));
 
         doReturn(readDataReply(expectedNode)).when(mockActorContext).executeOperationAsync(
-                eq(actorSelection(txActorRef)), eqReadData(YangInstanceIdentifier.builder().build()), any(Timeout.class));
+                eq(actorSelection(txActorRef)), eqReadData(YangInstanceIdentifier.EMPTY), any(Timeout.class));
     }
 }
index 79beb15..0631b1b 100644 (file)
@@ -80,7 +80,7 @@ public class PreLithiumShardTest extends AbstractShardTest {
 
         writeToStore(store, TestModel.TEST_PATH, ImmutableNodes.containerNode(TestModel.TEST_QNAME));
 
-        YangInstanceIdentifier root = YangInstanceIdentifier.builder().build();
+        YangInstanceIdentifier root = YangInstanceIdentifier.EMPTY;
         NormalizedNode<?,?> expected = readStore(store, root);
 
         NormalizedNodeMessages.Container encode = codec.encode(expected);
index 2321fd1..453262a 100644 (file)
@@ -41,7 +41,7 @@ public class NormalizedNodeAggregatorTest {
         NormalizedNode<?, ?> expectedNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
         NormalizedNode<?, ?> expectedNode2 = ImmutableNodes.containerNode(CarsModel.CARS_QNAME);
 
-        Optional<NormalizedNode<?, ?>> optional = NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.builder().build(),
+        Optional<NormalizedNode<?, ?>> optional = NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY,
                 ImmutableList.of(
                         Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode1, schemaContext)),
                         Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode2, schemaContext))),
@@ -77,7 +77,7 @@ public class NormalizedNodeAggregatorTest {
 
             DOMStoreWriteTransaction writeTransaction = store.newWriteOnlyTransaction();
 
-            writeTransaction.merge(YangInstanceIdentifier.builder().node(moduleNode.getNodeType()).build(), moduleNode);
+            writeTransaction.merge(YangInstanceIdentifier.of(moduleNode.getNodeType()), moduleNode);
 
             DOMStoreThreePhaseCommitCohort ready = writeTransaction.ready();
 
@@ -88,7 +88,7 @@ public class NormalizedNodeAggregatorTest {
             DOMStoreReadTransaction readTransaction = store.newReadOnlyTransaction();
 
             CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read = readTransaction
-                    .read(YangInstanceIdentifier.builder().build());
+                    .read(YangInstanceIdentifier.EMPTY);
 
             Optional<NormalizedNode<?, ?>> nodeOptional = read.checkedGet();
 
index 7c070fd..4c6b631 100644 (file)
@@ -164,7 +164,7 @@ final class DOMRpcRoutingTable {
                 for (DataSchemaNode c : input.getChildNodes()) {
                     for (UnknownSchemaNode extension : c.getUnknownSchemaNodes()) {
                         if (CONTEXT_REFERENCE.equals(extension.getNodeType())) {
-                            final YangInstanceIdentifier keyId = YangInstanceIdentifier.builder().node(c.getQName()).build();
+                            final YangInstanceIdentifier keyId = YangInstanceIdentifier.of(c.getQName());
                             return new RoutedDOMRpcRoutingTableEntry(rpcDef, keyId, implementations);
                         }
                     }
index 18234f3..3971bd7 100644 (file)
@@ -20,7 +20,6 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 
 final class GlobalDOMRpcRoutingTableEntry extends AbstractDOMRpcRoutingTableEntry {
-    private static final YangInstanceIdentifier ROOT = YangInstanceIdentifier.builder().build();
     private final DOMRpcIdentifier rpcId;
 
     private GlobalDOMRpcRoutingTableEntry(final DOMRpcIdentifier rpcId, final Map<YangInstanceIdentifier, List<DOMRpcImplementation>> impls) {
@@ -37,7 +36,7 @@ final class GlobalDOMRpcRoutingTableEntry extends AbstractDOMRpcRoutingTableEntr
 
     @Override
     protected CheckedFuture<DOMRpcResult, DOMRpcException> invokeRpc(final NormalizedNode<?, ?> input) {
-        return getImplementations(ROOT).get(0).invokeRpc(rpcId, input);
+        return getImplementations(YangInstanceIdentifier.EMPTY).get(0).invokeRpc(rpcId, input);
     }
 
     @Override

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.