Fixup Augmentable and Identifiable methods changing 49/71249/12
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 24 Apr 2018 10:23:17 +0000 (12:23 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 4 Jun 2018 14:15:01 +0000 (14:15 +0000)
This is a fixup of the change in binding codegen, adjusting:
- getKey() -> key()
- setKey() -> withKey()
- getAugmentation() -> augmentation()

As a drive-by cleanup, some more references to CheckedFuture
are gone.

Change-Id: Ifa573f93d1776ab2db98524df4da63259e811767
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
24 files changed:
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java
benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/BindingContext.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java
opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java
opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopicTest.java
opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopologyTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java
opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentListenAugmentTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java
opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java
opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java
opendaylight/md-sal/sal-test-model/src/main/java/org/opendaylight/controller/md/sal/test/model/util/ListsBindingUtils.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java
opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java

index 018246e..28ff58f 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.dsbenchmark;
 
 import java.util.ArrayList;
 import java.util.List;
-
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterList;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.dsbenchmark.rev150105.test.exec.OuterListKey;
@@ -25,7 +24,7 @@ public final class BaListBuilder {
             outerList.add(new OuterListBuilder()
                                 .setId( j )
                                 .setInnerList(buildInnerList(j, innerElements))
-                                .setKey(new OuterListKey( j ))
+                                .withKey(new OuterListKey( j ))
                                 .build());
         }
         return outerList;
@@ -37,7 +36,7 @@ public final class BaListBuilder {
         final String itemStr = "Item-" + String.valueOf(index) + "-";
         for (int i = 0; i < elements; i++) {
             innerList.add(new InnerListBuilder()
-                                .setKey( new InnerListKey( i ) )
+                                .withKey( new InnerListKey( i ) )
                                 .setName(i)
                                 .setValue( itemStr + String.valueOf( i ) )
                                 .build());
index 9a3f27e..1fef7f8 100644 (file)
@@ -49,7 +49,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter {
 
         for (OuterList element : this.list) {
             InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
-                                                    .child(OuterList.class, element.getKey());
+                                                    .child(OuterList.class, element.key());
             if (oper == StartTestInput.Operation.PUT) {
                 tx.put(dsType, iid, element);
             } else {
index a0327a9..b36404d 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.dsbenchmark.txchain;
 
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
 import java.util.List;
 import org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain;
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
@@ -58,7 +59,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
 
         for (OuterList element : this.list) {
             InstanceIdentifier<OuterList> iid = InstanceIdentifier.create(TestExec.class)
-                                                    .child(OuterList.class, element.getKey());
+                                                    .child(OuterList.class, element.key());
 
             if (oper == StartTestInput.Operation.PUT) {
                 tx.put(dsType, iid, element);
@@ -81,7 +82,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
                         LOG.error("Transaction failed, {}", t);
                         txError++;
                     }
-                });
+                }, MoreExecutors.directExecutor());
                 tx = chain.newWriteOnlyTransaction();
                 writeCnt = 0;
             }
@@ -103,7 +104,7 @@ public class TxchainBaWrite extends DatastoreAbstractWriter implements Transacti
         } catch (final IllegalStateException e) {
             LOG.error("Transaction close failed,", e);
         }
-        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, (txOk + txError));
+        LOG.debug("Transactions: submitted {}, completed {}", txSubmitted, txOk + txError);
     }
 
     @Override
index fb950b8..a1e9635 100644 (file)
@@ -44,6 +44,7 @@ import org.xml.sax.SAXException;
  * @author Thomas Pantelis (originally; re-factored by Michael Vorburger.ch)
  */
 public abstract class BindingContext {
+    private static String GET_KEY_METHOD = "key";
 
     public static BindingContext create(final String logName, final Class<? extends DataObject> klass,
             final String appConfigListKeyValue) {
@@ -138,7 +139,7 @@ public abstract class BindingContext {
                 final String listKeyValue) throws InstantiationException, IllegalAccessException,
                 IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException {
             // We assume the yang list key type is string.
-            Identifier keyInstance = (Identifier) bindingClass.getMethod("getKey").getReturnType()
+            Identifier keyInstance = (Identifier) bindingClass.getMethod(GET_KEY_METHOD).getReturnType()
                     .getConstructor(String.class).newInstance(listKeyValue);
             InstanceIdentifier appConfigPath = InstanceIdentifier.builder((Class)bindingClass, keyInstance).build();
             return new ListBindingContext(bindingClass, appConfigPath, listKeyValue);
index 8b57d2d..a84f260 100644 (file)
@@ -130,7 +130,7 @@ public final class EventSourceTopic implements DataTreeChangeListener<Node>, Aut
                         for (final Node node : nodes) {
                             if (nodeRegex.matcher(node.getNodeId().getValue()).matches()) {
                                 notifyNode(EventSourceTopology.EVENT_SOURCE_TOPOLOGY_PATH.child(Node.class,
-                                        node.getKey()));
+                                    node.key()));
                             }
                         }
                     }
index 8f7bc92..934056d 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.controller.messagebus.app.impl;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -219,5 +220,14 @@ public class EventSourceTopology implements EventAggregatorService, EventSourceR
     EventSourceService getEventSourceService() {
         return eventSourceService;
     }
-}
 
+    @VisibleForTesting
+    Map<NodeKey, RoutedRpcRegistration<EventSourceService>> getRoutedRpcRegistrations() {
+        return routedRpcRegistrations;
+    }
+
+    @VisibleForTesting
+    Map<TopicId, EventSourceTopic> getEventSourceTopicMap() {
+        return eventSourceTopicMap;
+    }
+}
index a2b2b75..72b2698 100644 (file)
@@ -100,7 +100,7 @@ public class EventSourceTopicTest {
         doReturn(DataObjectModification.ModificationType.WRITE).when(mockModification).getModificationType();
 
         Node dataObjectNodeMock = mock(Node.class);
-        doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).getKey();
+        doReturn(getNodeKey("testNodeId01")).when(dataObjectNodeMock).key();
         NodeId nodeIdMock = mock(NodeId.class);
         doReturn(nodeIdMock).when(dataObjectNodeMock).getNodeId();
         doReturn("nodeIdPattern1").when(nodeIdMock).getValue();
@@ -119,7 +119,7 @@ public class EventSourceTopicTest {
         verify(eventSourceServiceMock, times(1)).joinTopic(any(JoinTopicInput.class));
     }
 
-    public NodeKey getNodeKey(String nodeId) {
+    public NodeKey getNodeKey(final String nodeId) {
         return new NodeKey(new NodeId(nodeId));
     }
 }
index 56d67bf..fda32a6 100644 (file)
@@ -18,7 +18,6 @@ import static org.mockito.Mockito.verify;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
-import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
@@ -98,7 +97,7 @@ public class EventSourceTopologyTest {
     public void destroyTopicTest() throws Exception {
         topicTestHelper();
         TopicId topicId = new TopicId("topic-id-007");
-        Map<TopicId,EventSourceTopic> localMap = getEventSourceTopicMap();
+        Map<TopicId, EventSourceTopic> localMap = eventSourceTopology.getEventSourceTopicMap();
         EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"),
                 "pattern", eventSourceTopology);
         localMap.put(topicId, eventSourceTopic);
@@ -146,7 +145,7 @@ public class EventSourceTopologyTest {
     public void closeTest() throws Exception {
         constructorTestHelper();
         topicTestHelper();
-        Map<TopicId,EventSourceTopic> localMap = getEventSourceTopicMap();
+        Map<TopicId, EventSourceTopic> localMap = eventSourceTopology.getEventSourceTopicMap();
         TopicId topicIdMock = mock(TopicId.class);
         EventSourceTopic eventSourceTopic = EventSourceTopic.create(new NotificationPattern("foo"),
                 "pattern", eventSourceTopology);
@@ -163,7 +162,7 @@ public class EventSourceTopologyTest {
         EventSource eventSourceMock = mock(EventSource.class);
         NodeId nodeId = new NodeId("nodeIdValue1");
         nodeKey = new NodeKey(nodeId);
-        doReturn(nodeKey).when(nodeMock).getKey();
+        doReturn(nodeKey).when(nodeMock).key();
         doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
         BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(
                 BindingAwareBroker.RoutedRpcRegistration.class);
@@ -182,8 +181,8 @@ public class EventSourceTopologyTest {
         EventSource eventSourceMock = mock(EventSource.class);
         NodeId nodeId = new NodeId("nodeIdValue1");
         nodeKey = new NodeKey(nodeId);
-        Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap =
-                getRoutedRpcRegistrations();
+        Map<NodeKey, BindingAwareBroker.RoutedRpcRegistration<EventSourceService>> localMap = eventSourceTopology
+                .getRoutedRpcRegistrations();
         NodeKey nodeKeyMock = mock(NodeKey.class);
         doReturn(nodeKeyMock).when(eventSourceMock).getSourceNodeKey();
         BindingAwareBroker.RoutedRpcRegistration<EventSourceService> routedRpcRegistrationMock =
@@ -200,7 +199,7 @@ public class EventSourceTopologyTest {
         EventSource eventSourceMock = mock(EventSource.class);
         NodeId nodeId = new NodeId("nodeIdValue1");
         nodeKey = new NodeKey(nodeId);
-        doReturn(nodeKey).when(nodeMock).getKey();
+        doReturn(nodeKey).when(nodeMock).key();
         doReturn(nodeKey).when(eventSourceMock).getSourceNodeKey();
         BindingAwareBroker.RoutedRpcRegistration routedRpcRegistrationMock = mock(
                 BindingAwareBroker.RoutedRpcRegistration.class);
@@ -211,17 +210,4 @@ public class EventSourceTopologyTest {
         assertNotNull("Return value has not been created correctly.",
                 eventSourceTopology.registerEventSource(eventSourceMock));
     }
-
-    private Map getEventSourceTopicMap() throws Exception {
-        Field nesField = EventSourceTopology.class.getDeclaredField("eventSourceTopicMap");
-        nesField.setAccessible(true);
-        return (Map) nesField.get(eventSourceTopology);
-    }
-
-    private Map getRoutedRpcRegistrations() throws Exception {
-        Field nesField = EventSourceTopology.class.getDeclaredField("routedRpcRegistrations");
-        nesField.setAccessible(true);
-        return (Map) nesField.get(eventSourceTopology);
-    }
-
 }
index dd434b8..5b49bd7 100644 (file)
@@ -44,7 +44,7 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
 
     private TwoLevelListChanged createTestData() {
         final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
-        tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
+        tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().withKey(new TopLevelListKey("test")).build()));
         return tb.build();
     }
 
@@ -75,12 +75,12 @@ public class BackwardsCompatibleNotificationBrokerTest extends AbstractNotificat
         private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
         private final CountDownLatch latch;
 
-        NotifTestListener(CountDownLatch latch) {
+        NotifTestListener(final CountDownLatch latch) {
             this.latch = latch;
         }
 
         @Override
-        public void onTwoLevelListChanged(TwoLevelListChanged notification) {
+        public void onTwoLevelListChanged(final TwoLevelListChanged notification) {
             receivedNotifications.add(notification);
             latch.countDown();
         }
index 6d6b16e..8caaa61 100644 (file)
@@ -35,7 +35,7 @@ public class Bug2562DeserializedUnkeyedListTest extends AbstractDataTreeChangeLi
 
     @Test
     public void writeListToList2562Root() {
-        final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).setKey(new BarrootKey(2)).build();
+        final Barroot barRoot = new BarrootBuilder().setType(2).setValue(2).withKey(new BarrootKey(2)).build();
         final Fooroot fooRoot = new FoorootBuilder().setBarroot(Arrays.asList(barRoot)).build();
         final Root root = new RootBuilder().setFooroot(Arrays.asList(fooRoot)).build();
 
index 1687705..692b19e 100644 (file)
@@ -44,9 +44,9 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker
 
     }
 
-    private TwoLevelListChanged createTestData() {
+    private static TwoLevelListChanged createTestData() {
         final TwoLevelListChangedBuilder tb = new TwoLevelListChangedBuilder();
-        tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().setKey(new TopLevelListKey("test")).build()));
+        tb.setTopLevelList(ImmutableList.of(new TopLevelListBuilder().withKey(new TopLevelListKey("test")).build()));
         return tb.build();
     }
 
@@ -111,12 +111,12 @@ public class ForwardedNotificationAdapterTest extends AbstractNotificationBroker
         private final List<TwoLevelListChanged> receivedNotifications = new ArrayList<>();
         private final CountDownLatch latch;
 
-        TestNotifListener(CountDownLatch latch) {
+        TestNotifListener(final CountDownLatch latch) {
             this.latch = latch;
         }
 
         @Override
-        public void onTwoLevelListChanged(TwoLevelListChanged notification) {
+        public void onTwoLevelListChanged(final TwoLevelListChanged notification) {
             receivedNotifications.add(notification);
             latch.countDown();
         }
index 470eeb4..ca2375f 100644 (file)
@@ -31,7 +31,7 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest {
     private static final InstanceIdentifier<Top> TOP_PATH = InstanceIdentifier.create(Top.class);
     private static final TopLevelListKey TOP_LIST_KEY = new TopLevelListKey("foo");
     private static final InstanceIdentifier<TopLevelList> NODE_PATH = TOP_PATH.child(TopLevelList.class, TOP_LIST_KEY);
-    private static final TopLevelList NODE = new TopLevelListBuilder().setKey(TOP_LIST_KEY).build();
+    private static final TopLevelList NODE = new TopLevelListBuilder().withKey(TOP_LIST_KEY).build();
 
     @Test
     @Deprecated
index 939349c..77b34a8 100644 (file)
@@ -16,23 +16,23 @@ public class AugmentationVerifier<T extends Augmentable<T>> {
 
     private final T object;
 
-    public AugmentationVerifier(T objectToVerify) {
+    public AugmentationVerifier(final T objectToVerify) {
         this.object = objectToVerify;
     }
 
-    public AugmentationVerifier<T> assertHasAugmentation(Class<? extends Augmentation<T>> augmentation) {
+    public AugmentationVerifier<T> assertHasAugmentation(final Class<? extends Augmentation<T>> augmentation) {
         assertHasAugmentation(object, augmentation);
         return this;
     }
 
-    public static <T extends Augmentable<T>> void assertHasAugmentation(T object,
-            Class<? extends Augmentation<T>> augmentation) {
+    public static <T extends Augmentable<T>> void assertHasAugmentation(final T object,
+            final Class<? extends Augmentation<T>> augmentation) {
         assertNotNull(object);
         assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.",
-                object.getAugmentation(augmentation));
+                object.augmentation(augmentation));
     }
 
-    public static <T extends Augmentable<T>> AugmentationVerifier<T> from(T obj) {
+    public static <T extends Augmentable<T>> AugmentationVerifier<T> from(final T obj) {
         return new AugmentationVerifier<>(obj);
     }
 }
index e74a97f..6959912 100644 (file)
@@ -22,8 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controll
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 
 /**
- * FIXME: THis test should be moved to sal-binding-broker and rewriten
- * to use new DataBroker API
+ * FIXME: THis test should be moved to sal-binding-broker and rewritten to use new DataBroker API
  */
 public class ConcurrentImplicitCreateTest extends AbstractDataServiceTest {
 
@@ -40,8 +39,8 @@ public class ConcurrentImplicitCreateTest extends AbstractDataServiceTest {
         WriteTransaction fooTx = dataBroker.newWriteOnlyTransaction();
         WriteTransaction barTx = dataBroker.newWriteOnlyTransaction();
 
-        fooTx.put(LogicalDatastoreType.OPERATIONAL, FOO_PATH, new TopLevelListBuilder().setKey(FOO_KEY).build());
-        barTx.put(LogicalDatastoreType.OPERATIONAL, BAR_PATH, new TopLevelListBuilder().setKey(BAR_KEY).build());
+        fooTx.put(LogicalDatastoreType.OPERATIONAL, FOO_PATH, new TopLevelListBuilder().withKey(FOO_KEY).build());
+        barTx.put(LogicalDatastoreType.OPERATIONAL, BAR_PATH, new TopLevelListBuilder().withKey(BAR_KEY).build());
 
         fooTx.submit().get(5, TimeUnit.SECONDS);
         barTx.submit().get(5, TimeUnit.SECONDS);
index 48872a8..a0c69d5 100644 (file)
@@ -44,41 +44,40 @@ public class WildcardedDataChangeListenerTest extends AbstractDataTreeChangeList
 
     protected static final InstanceIdentifier<ListViaUses> DEEP_WILDCARDED_PATH = InstanceIdentifier
             .builder(Top.class)
-            .child(TopLevelList.class) //
-            .augmentation(TreeComplexUsesAugment.class) //
-            .child(ListViaUses.class) //
+            .child(TopLevelList.class)
+            .augmentation(TreeComplexUsesAugment.class)
+            .child(ListViaUses.class)
             .build();
 
     private static final InstanceIdentifier<TreeComplexUsesAugment> NODE_0_TCU_PATH = InstanceIdentifier
             .builder(Top.class)
-            .child(TopLevelList.class, TOP_LEVEL_LIST_0_KEY) //
-            .augmentation(TreeComplexUsesAugment.class) //
+            .child(TopLevelList.class, TOP_LEVEL_LIST_0_KEY)
+            .augmentation(TreeComplexUsesAugment.class)
             .build();
 
     private static final InstanceIdentifier<TreeComplexUsesAugment> NODE_1_TCU_PATH = InstanceIdentifier
             .builder(Top.class)
-            .child(TopLevelList.class, TOP_LEVEL_LIST_1_KEY) //
-            .augmentation(TreeComplexUsesAugment.class) //
+            .child(TopLevelList.class, TOP_LEVEL_LIST_1_KEY)
+            .augmentation(TreeComplexUsesAugment.class)
             .build();
 
 
     private static final ListViaUsesKey LIST_VIA_USES_KEY = new ListViaUsesKey("test");
 
-    private static final InstanceIdentifier<ListViaUses> NODE_0_LVU_PATH = NODE_0_TCU_PATH.child(ListViaUses.class, LIST_VIA_USES_KEY);
+    private static final InstanceIdentifier<ListViaUses> NODE_0_LVU_PATH = NODE_0_TCU_PATH.child(ListViaUses.class,
+        LIST_VIA_USES_KEY);
 
-    private static final InstanceIdentifier<ListViaUses> NODE_1_LVU_PATH = NODE_1_TCU_PATH.child(ListViaUses.class, LIST_VIA_USES_KEY);
+    private static final InstanceIdentifier<ListViaUses> NODE_1_LVU_PATH = NODE_1_TCU_PATH.child(ListViaUses.class,
+        LIST_VIA_USES_KEY);
 
     private static final InstanceIdentifier<ContainerWithUses> NODE_0_CWU_PATH =
             NODE_0_TCU_PATH.child(ContainerWithUses.class);
 
-    private static final ContainerWithUses CWU= new ContainerWithUsesBuilder()//
-            .setLeafFromGrouping("some container value") //
-            .build();
+    private static final ContainerWithUses CWU = new ContainerWithUsesBuilder()
+            .setLeafFromGrouping("some container value").build();
 
-    private static final ListViaUses LVU = new ListViaUsesBuilder() //
-            .setKey(LIST_VIA_USES_KEY) //
-            .setName("john")
-            .build();
+    private static final ListViaUses LVU = new ListViaUsesBuilder()
+            .withKey(LIST_VIA_USES_KEY).setName("john").build();
 
     @Override
     protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
index be22d83..c5efe76 100644 (file)
@@ -40,7 +40,8 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataTreeCh
 
     private static final List11Key LIST11_KEY = new List11Key(100);
 
-    private static final InstanceIdentifier<TllComplexAugment> TLL_COMPLEX_AUGMENT_PATH = InstanceIdentifier.builder(Top.class)
+    private static final InstanceIdentifier<TllComplexAugment> TLL_COMPLEX_AUGMENT_PATH = InstanceIdentifier
+            .builder(Top.class)
             .child(TopLevelList.class,FOO_KEY)
             .augmentation(TllComplexAugment.class)
             .build();
@@ -65,7 +66,7 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataTreeCh
         initTx.put(LogicalDatastoreType.OPERATIONAL, LIST11_PATH, list11Before, true);
         initTx.submit().get(5, TimeUnit.SECONDS);
 
-        List11 list11After = new List11Builder().setKey(LIST11_KEY).setAttrStr("good").build();
+        List11 list11After = new List11Builder().withKey(LIST11_KEY).setAttrStr("good").build();
 
         final TestListener<List11> listener = createListener(LogicalDatastoreType.OPERATIONAL, LIST11_PATH,
                 added(LIST11_PATH, list11Before), subtreeModified(LIST11_PATH, list11Before, list11After));
@@ -77,9 +78,9 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataTreeCh
         listener.verify();
     }
 
-    private List11 createList11() {
+    private static List11 createList11() {
         List11Builder builder = new List11Builder()
-            .setKey(LIST11_KEY)
+            .withKey(LIST11_KEY)
             .addAugmentation(List11SimpleAugment.class,new List11SimpleAugmentBuilder()
                     .setAttrStr2("bad").build())
             .setAttrStr("good");
index 4a76ad9..eb181fd 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.controller.sal.binding.test.bugfix;
 
 import static org.junit.Assert.assertEquals;
@@ -60,7 +59,7 @@ public class WriteParentListenAugmentTest extends AbstractDataTreeChangeListener
 
         final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
 
-        TopLevelList tll = new TopLevelListBuilder().setKey(TLL_KEY)
+        TopLevelList tll = new TopLevelListBuilder().withKey(TLL_KEY)
                 .addAugmentation(TreeComplexUsesAugment.class, treeComplexUsesAugment).build();
         transaction.put(OPERATIONAL, TLL_INSTANCE_ID_BA, tll, true);
         transaction.submit().get(5, TimeUnit.SECONDS);
index 153d9d2..ccedb89 100644 (file)
@@ -43,14 +43,14 @@ public class WriteParentReadChildTest extends AbstractDataServiceTest {
     private static final List11Key LIST11_KEY = new List11Key(LIST11_ID);
     private static final List1Key LIST1_KEY = new List1Key(LIST1_NAME);
 
-    private static final InstanceIdentifier<TopLevelList> TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) //
+    private static final InstanceIdentifier<TopLevelList> TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class)
             .child(TopLevelList.class, TLL_KEY).build();
 
-    private static final InstanceIdentifier<List1> LIST1_INSTANCE_ID_BA = //
-            TLL_INSTANCE_ID_BA.builder() //
+    private static final InstanceIdentifier<List1> LIST1_INSTANCE_ID_BA =
+            TLL_INSTANCE_ID_BA.builder()
             .augmentation(TllComplexAugment.class).child(List1.class, LIST1_KEY).build();
 
-    private static final InstanceIdentifier<? extends DataObject> LIST11_INSTANCE_ID_BA = //
+    private static final InstanceIdentifier<? extends DataObject> LIST11_INSTANCE_ID_BA =
             LIST1_INSTANCE_ID_BA.child(List11.class, LIST11_KEY);
 
     /**
@@ -64,12 +64,8 @@ public class WriteParentReadChildTest extends AbstractDataServiceTest {
         DataBroker dataBroker = testContext.getDataBroker();
         final WriteTransaction transaction = dataBroker.newWriteOnlyTransaction();
 
-        List11 list11 = new List11Builder() //
-                .setKey(LIST11_KEY) //
-                .setAttrStr("primary")
-                .build();
-
-        List1 list1 = new List1Builder().setKey(LIST1_KEY).setList11(ImmutableList.of(list11)).build();
+        List11 list11 = new List11Builder().withKey(LIST11_KEY).setAttrStr("primary").build();
+        List1 list1 = new List1Builder().withKey(LIST1_KEY).setList11(ImmutableList.of(list11)).build();
 
         transaction.put(LogicalDatastoreType.OPERATIONAL, LIST1_INSTANCE_ID_BA, list1, true);
         transaction.submit().get(5, TimeUnit.SECONDS);
index 2d7f44d..306cfcf 100644 (file)
@@ -39,7 +39,7 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest {
 
         DataBroker dataBroker = testContext.getDataBroker();
         Optional<TopLevelList> tllFoo = dataBroker.newReadOnlyTransaction().read(
-                LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
+                LogicalDatastoreType.CONFIGURATION, FOO_PATH).get(5, TimeUnit.SECONDS);
         assertFalse(tllFoo.isPresent());
 
         TopLevelList tllFooData = createTll(TLL_FOO_KEY);
@@ -49,9 +49,9 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest {
         transaction.submit().get(5, TimeUnit.SECONDS);
 
         Optional<TopLevelList> readedData = dataBroker.newReadOnlyTransaction().read(
-                LogicalDatastoreType.CONFIGURATION, FOO_PATH).checkedGet(5, TimeUnit.SECONDS);
+                LogicalDatastoreType.CONFIGURATION, FOO_PATH).get(5, TimeUnit.SECONDS);
         assertTrue(readedData.isPresent());
-        assertEquals(tllFooData.getKey(), readedData.get().getKey());
+        assertEquals(tllFooData.key(), readedData.get().key());
 
         TopLevelList nodeBarData = createTll(TLL_BAR_KEY);
         TopLevelList nodeBazData = createTll(TLL_BAZ_KEY);
@@ -62,7 +62,7 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest {
         insertMoreTr.submit().get(5, TimeUnit.SECONDS);
 
         Optional<Top> top = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.CONFIGURATION, TOP_PATH)
-                .checkedGet(5, TimeUnit.SECONDS);
+                .get(5, TimeUnit.SECONDS);
         assertTrue(top.isPresent());
         assertEquals(3, top.get().getTopLevelList().size());
 
@@ -76,13 +76,11 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest {
         removalTransaction.submit().get(5, TimeUnit.SECONDS);
 
         Optional<TopLevelList> readedData2 = dataBroker.newReadOnlyTransaction().read(
-                LogicalDatastoreType.CONFIGURATION, BAR_PATH).checkedGet(5, TimeUnit.SECONDS);
+                LogicalDatastoreType.CONFIGURATION, BAR_PATH).get(5, TimeUnit.SECONDS);
         assertFalse(readedData2.isPresent());
     }
 
     private static TopLevelList createTll(final TopLevelListKey key) {
-        TopLevelListBuilder ret = new TopLevelListBuilder();
-        ret.setKey(key);
-        return ret.build();
+        return new TopLevelListBuilder().withKey(key).build();
     }
 }
index 5a1d166..e10eb0c 100644 (file)
@@ -50,40 +50,41 @@ public class DataServiceIT extends AbstractIT {
 
         InstanceIdentifier<UnorderedList> node1 = createNodeRef("0");
         Optional<UnorderedList> node = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, node1)
-                .checkedGet(5, TimeUnit.SECONDS);
+                .get(5, TimeUnit.SECONDS);
         assertFalse(node.isPresent());
         UnorderedList nodeData1 = createNode("0");
 
         transaction.put(LogicalDatastoreType.OPERATIONAL, node1, nodeData1);
-        transaction.submit().checkedGet(5, TimeUnit.SECONDS);
+        transaction.submit().get(5, TimeUnit.SECONDS);
 
         Optional<UnorderedList> readedData = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL,
-                node1).checkedGet(5, TimeUnit.SECONDS);
+                node1).get(5, TimeUnit.SECONDS);
         assertTrue(readedData.isPresent());
-        assertEquals(nodeData1.getKey(), readedData.get().getKey());
+        assertEquals(nodeData1.key(), readedData.get().key());
 
         final WriteTransaction transaction2 = dataBroker.newWriteOnlyTransaction();
         assertNotNull(transaction2);
 
         transaction2.delete(LogicalDatastoreType.OPERATIONAL, node1);
 
-        transaction2.submit().checkedGet(5, TimeUnit.SECONDS);
+        transaction2.submit().get(5, TimeUnit.SECONDS);
 
         Optional<UnorderedList> readedData2 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL,
-                node1).checkedGet(5, TimeUnit.SECONDS);
+                node1).get(5, TimeUnit.SECONDS);
         assertFalse(readedData2.isPresent());
     }
 
 
     private static InstanceIdentifier<UnorderedList> createNodeRef(final String string) {
         UnorderedListKey key = new UnorderedListKey(string);
-        return  InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key).build();
+        return InstanceIdentifier.builder(Lists.class).child(UnorderedContainer.class).child(UnorderedList.class, key)
+                .build();
     }
 
     private static UnorderedList createNode(final String string) {
         UnorderedListBuilder ret = new UnorderedListBuilder();
         UnorderedListKey nodeKey = new UnorderedListKey(string);
-        ret.setKey(nodeKey);
+        ret.withKey(nodeKey);
         ret.setName("name of " + string);
         ret.setName("value of " + string);
         return ret.build();
index d1bd2ef..a1ab580 100644 (file)
@@ -63,11 +63,11 @@ public final class ListsBindingUtils {
     }
 
     public static TopLevelList topLevelList(final TopLevelListKey key) {
-        return new TopLevelListBuilder().setKey(key).build();
+        return new TopLevelListBuilder().withKey(key).build();
     }
 
     public static TopLevelList topLevelList(final TopLevelListKey key, final TreeComplexUsesAugment augment) {
-        TopLevelListBuilder builder = new TopLevelListBuilder().setKey(key);
+        TopLevelListBuilder builder = new TopLevelListBuilder().withKey(key);
         builder.addAugmentation(TreeComplexUsesAugment.class, augment);
         return builder.build();
     }
@@ -75,12 +75,12 @@ public final class ListsBindingUtils {
     public static TreeComplexUsesAugment complexUsesAugment(final ListViaUsesKey... keys) {
         ImmutableList.Builder<ListViaUses> listViaUses = ImmutableList.<ListViaUses>builder();
         for (ListViaUsesKey key : keys) {
-            listViaUses.add(new ListViaUsesBuilder().setKey(key).build());
+            listViaUses.add(new ListViaUsesBuilder().withKey(key).build());
         }
         return new TreeComplexUsesAugmentBuilder().setListViaUses(listViaUses.build()).build();
     }
 
-    public static TreeLeafOnlyUsesAugment leafOnlyUsesAugment(String leafFromGroupingValue) {
+    public static TreeLeafOnlyUsesAugment leafOnlyUsesAugment(final String leafFromGroupingValue) {
 
         return new TreeLeafOnlyUsesAugmentBuilder().setLeafFromGrouping(leafFromGroupingValue).build();
     }
index f68ea1d..d76d0c7 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.controller.clustering.it.listener;
 
 import com.google.common.util.concurrent.FutureCallback;
@@ -24,33 +23,30 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 public class PeopleCarListener implements CarPurchaseListener {
 
     private static final Logger LOG = LoggerFactory.getLogger(PeopleCarListener.class);
 
     private DataBroker dataProvider;
 
-
-
     public void setDataProvider(final DataBroker salDataProvider) {
         this.dataProvider = salDataProvider;
     }
 
     @Override
-    public void onCarBought(CarBought notification) {
+    public void onCarBought(final CarBought notification) {
 
         final CarPersonBuilder carPersonBuilder = new CarPersonBuilder();
         carPersonBuilder.setCarId(notification.getCarId());
         carPersonBuilder.setPersonId(notification.getPersonId());
         CarPersonKey key = new CarPersonKey(notification.getCarId(), notification.getPersonId());
-        carPersonBuilder.setKey(key);
+        carPersonBuilder.withKey(key);
         final CarPerson carPerson = carPersonBuilder.build();
 
         LOG.info("Car bought, adding car-person entry: [{}]", carPerson);
 
-        InstanceIdentifier<CarPerson> carPersonIId = InstanceIdentifier.<CarPeople>builder(CarPeople.class)
-                .child(CarPerson.class, carPerson.getKey()).build();
+        InstanceIdentifier<CarPerson> carPersonIId = InstanceIdentifier.builder(CarPeople.class)
+                .child(CarPerson.class, carPerson.key()).build();
 
 
         WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
index c0744de..13349d9 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.controller.clustering.it.provider;
 
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.Sets;
-import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -159,7 +158,7 @@ public class CarProvider implements CarService {
         failureCounter.set(0);
 
         WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
-        InstanceIdentifier<Cars> carsId = InstanceIdentifier.<Cars>builder(Cars.class).build();
+        InstanceIdentifier<Cars> carsId = InstanceIdentifier.create(Cars.class);
         tx.merge(LogicalDatastoreType.CONFIGURATION, carsId, new CarsBuilder().build());
         try {
             tx.submit().checkedGet(5, TimeUnit.SECONDS);
@@ -179,10 +178,8 @@ public class CarProvider implements CarService {
                 WriteTransaction tx1 = dataProvider.newWriteOnlyTransaction();
                 CarEntry car = new CarEntryBuilder().setId(new CarId("car" + id)).build();
                 tx1.put(LogicalDatastoreType.CONFIGURATION,
-                        InstanceIdentifier.<Cars>builder(Cars.class).child(CarEntry.class, car.getKey()).build(),
-                        car);
-                CheckedFuture<Void, TransactionCommitFailedException> future = tx1.submit();
-                Futures.addCallback(future, new FutureCallback<Void>() {
+                        InstanceIdentifier.<Cars>builder(Cars.class).child(CarEntry.class, car.key()).build(), car);
+                Futures.addCallback(tx1.submit(), new FutureCallback<Void>() {
 
                     @Override
                     public void onSuccess(final Void result) {
index 736b869..58fcdc4 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.controller.clustering.it.provider;
 
 import com.google.common.util.concurrent.FutureCallback;
@@ -59,10 +58,8 @@ public class PeopleProvider implements PeopleService, AutoCloseable {
         final SettableFuture<RpcResult<AddPersonOutput>> futureResult = SettableFuture.create();
 
         // Each entry will be identifiable by a unique key, we have to create that identifier
-        final InstanceIdentifier.InstanceIdentifierBuilder<Person> personIdBuilder =
-                InstanceIdentifier.<People>builder(People.class)
-                .child(Person.class, person.getKey());
-        final InstanceIdentifier<Person> personId = personIdBuilder.build();
+        final InstanceIdentifier<Person> personId = InstanceIdentifier.builder(People.class)
+                .child(Person.class, person.key()).build();
         // Place entry in data store tree
         WriteTransaction tx = dataProvider.newWriteOnlyTransaction();
         tx.put(LogicalDatastoreType.CONFIGURATION, personId, person, true);

©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.