From f9814cf027886294b74fb6c8748f4a3e0a545e86 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Tue, 24 Apr 2018 12:23:17 +0200 Subject: [PATCH] Fixup Augmentable and Identifiable methods changing 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 Signed-off-by: Claudio D. Gasparini --- .../dsbenchmark/BaListBuilder.java | 5 ++- .../dsbenchmark/simpletx/SimpletxBaWrite.java | 2 +- .../dsbenchmark/txchain/TxchainBaWrite.java | 7 +++-- .../blueprint/ext/BindingContext.java | 3 +- .../messagebus/app/impl/EventSourceTopic.java | 2 +- .../app/impl/EventSourceTopology.java | 12 ++++++- .../app/impl/EventSourceTopicTest.java | 4 +-- .../app/impl/EventSourceTopologyTest.java | 26 ++++------------ ...wardsCompatibleNotificationBrokerTest.java | 6 ++-- .../Bug2562DeserializedUnkeyedListTest.java | 2 +- .../ForwardedNotificationAdapterTest.java | 8 ++--- .../impl/test/WriteTransactionTest.java | 2 +- .../binding/test/AugmentationVerifier.java | 12 +++---- .../data/ConcurrentImplicitCreateTest.java | 7 ++--- .../WildcardedDataChangeListenerTest.java | 31 +++++++++---------- ...eteNestedAugmentationListenParentTest.java | 9 +++--- .../bugfix/WriteParentListenAugmentTest.java | 3 +- .../test/bugfix/WriteParentReadChildTest.java | 16 ++++------ .../connect/dom/BrokerIntegrationTest.java | 14 ++++----- .../test/sal/binding/it/DataServiceIT.java | 17 +++++----- .../test/model/util/ListsBindingUtils.java | 8 ++--- .../it/listener/PeopleCarListener.java | 12 +++---- .../clustering/it/provider/CarProvider.java | 9 ++---- .../it/provider/PeopleProvider.java | 7 ++--- 24 files changed, 102 insertions(+), 122 deletions(-) diff --git a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java index 018246e922..28ff58f618 100644 --- a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java +++ b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/BaListBuilder.java @@ -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()); diff --git a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java index 9a3f27eabf..1fef7f8938 100644 --- a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java +++ b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/simpletx/SimpletxBaWrite.java @@ -49,7 +49,7 @@ public class SimpletxBaWrite extends DatastoreAbstractWriter { for (OuterList element : this.list) { InstanceIdentifier 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 { diff --git a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java index a0327a9702..b36404d52c 100644 --- a/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java +++ b/benchmark/dsbenchmark/src/main/java/org/opendaylight/dsbenchmark/txchain/TxchainBaWrite.java @@ -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 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 diff --git a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/BindingContext.java b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/BindingContext.java index fb950b8a58..a1e9635326 100644 --- a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/BindingContext.java +++ b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/BindingContext.java @@ -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 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); diff --git a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java index 8b57d2dc09..a84f260005 100644 --- a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java +++ b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopic.java @@ -130,7 +130,7 @@ public final class EventSourceTopic implements DataTreeChangeListener, 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())); } } } diff --git a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java index 8f7bc92992..934056dcab 100644 --- a/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java +++ b/opendaylight/md-sal/messagebus-impl/src/main/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopology.java @@ -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> getRoutedRpcRegistrations() { + return routedRpcRegistrations; + } + + @VisibleForTesting + Map getEventSourceTopicMap() { + return eventSourceTopicMap; + } +} diff --git a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopicTest.java b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopicTest.java index a2b2b7561a..72b2698047 100644 --- a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopicTest.java +++ b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopicTest.java @@ -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)); } } diff --git a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopologyTest.java b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopologyTest.java index 56d67bff4d..fda32a6ade 100644 --- a/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopologyTest.java +++ b/opendaylight/md-sal/messagebus-impl/src/test/java/org/opendaylight/controller/messagebus/app/impl/EventSourceTopologyTest.java @@ -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 localMap = getEventSourceTopicMap(); + Map 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 localMap = getEventSourceTopicMap(); + Map 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> localMap = - getRoutedRpcRegistrations(); + Map> localMap = eventSourceTopology + .getRoutedRpcRegistrations(); NodeKey nodeKeyMock = mock(NodeKey.class); doReturn(nodeKeyMock).when(eventSourceMock).getSourceNodeKey(); BindingAwareBroker.RoutedRpcRegistration 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); - } - } diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java index dd434b8152..5b49bd7873 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/BackwardsCompatibleNotificationBrokerTest.java @@ -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 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(); } diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java index 6d6b16e129..8caaa61bbc 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/Bug2562DeserializedUnkeyedListTest.java @@ -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(); diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java index 1687705854..692b19efc0 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/ForwardedNotificationAdapterTest.java @@ -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 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(); } diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java index 470eeb4336..ca2375fce6 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/md/sal/binding/impl/test/WriteTransactionTest.java @@ -31,7 +31,7 @@ public class WriteTransactionTest extends AbstractConcurrentDataBrokerTest { private static final InstanceIdentifier TOP_PATH = InstanceIdentifier.create(Top.class); private static final TopLevelListKey TOP_LIST_KEY = new TopLevelListKey("foo"); private static final InstanceIdentifier 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 diff --git a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java index 939349c96f..77b34a856d 100644 --- a/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java +++ b/opendaylight/md-sal/sal-binding-broker/src/test/java/org/opendaylight/controller/sal/binding/test/AugmentationVerifier.java @@ -16,23 +16,23 @@ public class AugmentationVerifier> { private final T object; - public AugmentationVerifier(T objectToVerify) { + public AugmentationVerifier(final T objectToVerify) { this.object = objectToVerify; } - public AugmentationVerifier assertHasAugmentation(Class> augmentation) { + public AugmentationVerifier assertHasAugmentation(final Class> augmentation) { assertHasAugmentation(object, augmentation); return this; } - public static > void assertHasAugmentation(T object, - Class> augmentation) { + public static > void assertHasAugmentation(final T object, + final Class> augmentation) { assertNotNull(object); assertNotNull("Augmentation " + augmentation.getSimpleName() + " is not present.", - object.getAugmentation(augmentation)); + object.augmentation(augmentation)); } - public static > AugmentationVerifier from(T obj) { + public static > AugmentationVerifier from(final T obj) { return new AugmentationVerifier<>(obj); } } diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java index e74a97fce9..6959912d36 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/ConcurrentImplicitCreateTest.java @@ -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); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java index 48872a865c..a0c69d5907 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/md/sal/binding/data/WildcardedDataChangeListenerTest.java @@ -44,41 +44,40 @@ public class WildcardedDataChangeListenerTest extends AbstractDataTreeChangeList protected static final InstanceIdentifier 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 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 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 NODE_0_LVU_PATH = NODE_0_TCU_PATH.child(ListViaUses.class, LIST_VIA_USES_KEY); + private static final InstanceIdentifier NODE_0_LVU_PATH = NODE_0_TCU_PATH.child(ListViaUses.class, + LIST_VIA_USES_KEY); - private static final InstanceIdentifier NODE_1_LVU_PATH = NODE_1_TCU_PATH.child(ListViaUses.class, LIST_VIA_USES_KEY); + private static final InstanceIdentifier NODE_1_LVU_PATH = NODE_1_TCU_PATH.child(ListViaUses.class, + LIST_VIA_USES_KEY); private static final InstanceIdentifier 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 getModuleInfos() throws Exception { diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java index be22d83586..c5efe76c7f 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/DeleteNestedAugmentationListenParentTest.java @@ -40,7 +40,8 @@ public class DeleteNestedAugmentationListenParentTest extends AbstractDataTreeCh private static final List11Key LIST11_KEY = new List11Key(100); - private static final InstanceIdentifier TLL_COMPLEX_AUGMENT_PATH = InstanceIdentifier.builder(Top.class) + private static final InstanceIdentifier 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 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"); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentListenAugmentTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentListenAugmentTest.java index 4a76ad97fd..eb181fd119 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentListenAugmentTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentListenAugmentTest.java @@ -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); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java index 153d9d2720..ccedb89a2b 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/bugfix/WriteParentReadChildTest.java @@ -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 TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) // + private static final InstanceIdentifier TLL_INSTANCE_ID_BA = InstanceIdentifier.builder(Top.class) .child(TopLevelList.class, TLL_KEY).build(); - private static final InstanceIdentifier LIST1_INSTANCE_ID_BA = // - TLL_INSTANCE_ID_BA.builder() // + private static final InstanceIdentifier LIST1_INSTANCE_ID_BA = + TLL_INSTANCE_ID_BA.builder() .augmentation(TllComplexAugment.class).child(List1.class, LIST1_KEY).build(); - private static final InstanceIdentifier LIST11_INSTANCE_ID_BA = // + private static final InstanceIdentifier 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); diff --git a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java index 2d7f44d3a3..306cfcf779 100644 --- a/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java +++ b/opendaylight/md-sal/sal-binding-dom-it/src/test/java/org/opendaylight/controller/sal/binding/test/connect/dom/BrokerIntegrationTest.java @@ -39,7 +39,7 @@ public class BrokerIntegrationTest extends AbstractDataServiceTest { DataBroker dataBroker = testContext.getDataBroker(); Optional 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 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 = 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 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(); } } diff --git a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java index 5a1d16634e..e10eb0c3a6 100644 --- a/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java +++ b/opendaylight/md-sal/sal-binding-it/src/test/java/org/opendaylight/controller/test/sal/binding/it/DataServiceIT.java @@ -50,40 +50,41 @@ public class DataServiceIT extends AbstractIT { InstanceIdentifier node1 = createNodeRef("0"); Optional 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 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 readedData2 = dataBroker.newReadOnlyTransaction().read(LogicalDatastoreType.OPERATIONAL, - node1).checkedGet(5, TimeUnit.SECONDS); + node1).get(5, TimeUnit.SECONDS); assertFalse(readedData2.isPresent()); } private static InstanceIdentifier 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(); diff --git a/opendaylight/md-sal/sal-test-model/src/main/java/org/opendaylight/controller/md/sal/test/model/util/ListsBindingUtils.java b/opendaylight/md-sal/sal-test-model/src/main/java/org/opendaylight/controller/md/sal/test/model/util/ListsBindingUtils.java index d1bd2efe20..a1ab580067 100644 --- a/opendaylight/md-sal/sal-test-model/src/main/java/org/opendaylight/controller/md/sal/test/model/util/ListsBindingUtils.java +++ b/opendaylight/md-sal/sal-test-model/src/main/java/org/opendaylight/controller/md/sal/test/model/util/ListsBindingUtils.java @@ -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 = ImmutableList.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(); } diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java index f68ea1d33b..d76d0c7aba 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/listener/PeopleCarListener.java @@ -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 carPersonIId = InstanceIdentifier.builder(CarPeople.class) - .child(CarPerson.class, carPerson.getKey()).build(); + InstanceIdentifier carPersonIId = InstanceIdentifier.builder(CarPeople.class) + .child(CarPerson.class, carPerson.key()).build(); WriteTransaction tx = dataProvider.newWriteOnlyTransaction(); diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java index c0744de3a1..13349d95e3 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/CarProvider.java @@ -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 carsId = InstanceIdentifier.builder(Cars.class).build(); + InstanceIdentifier 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.builder(Cars.class).child(CarEntry.class, car.getKey()).build(), - car); - CheckedFuture future = tx1.submit(); - Futures.addCallback(future, new FutureCallback() { + InstanceIdentifier.builder(Cars.class).child(CarEntry.class, car.key()).build(), car); + Futures.addCallback(tx1.submit(), new FutureCallback() { @Override public void onSuccess(final Void result) { diff --git a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java index 736b869b06..58fcdc4850 100644 --- a/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java +++ b/opendaylight/md-sal/samples/clustering-test-app/provider/src/main/java/org/opendaylight/controller/clustering/it/provider/PeopleProvider.java @@ -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> futureResult = SettableFuture.create(); // Each entry will be identifiable by a unique key, we have to create that identifier - final InstanceIdentifier.InstanceIdentifierBuilder personIdBuilder = - InstanceIdentifier.builder(People.class) - .child(Person.class, person.getKey()); - final InstanceIdentifier personId = personIdBuilder.build(); + final InstanceIdentifier 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); -- 2.36.6