X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fdatastore%2Fmodification%2FAbstractModificationTest.java;h=f2527b13abb013b475f8eeb2286ec809a9debc18;hp=17d05f22b797a71c74291637eb8b5bea39daaff2;hb=69d944b7b97e0e2c6a062ecb1227b7b30474cc18;hpb=09d76ff670a3d54dac595336b9fe3151b793d630 diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java index 17d05f22b7..f2527b13ab 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/modification/AbstractModificationTest.java @@ -7,24 +7,27 @@ */ package org.opendaylight.controller.cluster.datastore.modification; -import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.MoreExecutors; import java.util.Optional; +import org.eclipse.jdt.annotation.NonNull; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.opendaylight.controller.md.cluster.datastore.model.TestModel; -import org.opendaylight.mdsal.dom.spi.store.DOMStoreReadTransaction; import org.opendaylight.mdsal.dom.spi.store.DOMStoreThreePhaseCommitCohort; import org.opendaylight.mdsal.dom.spi.store.DOMStoreWriteTransaction; import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; +import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext; public abstract class AbstractModificationTest { private static EffectiveModelContext TEST_SCHEMA_CONTEXT; + static final @NonNull ContainerNode TEST_CONTAINER = ImmutableNodes.containerNode(TestModel.TEST_QNAME); + protected InMemoryDOMDataStore store; @BeforeClass @@ -50,9 +53,8 @@ public abstract class AbstractModificationTest { } protected Optional readData(final YangInstanceIdentifier path) throws Exception { - // FIXME: close the transaction - DOMStoreReadTransaction transaction = store.newReadOnlyTransaction(); - ListenableFuture> future = transaction.read(path); - return future.get(); + try (var transaction = store.newReadOnlyTransaction()) { + return transaction.read(path).get(); + } } }