diff options
author | Michal Cmarada <mcmarada@cisco.com> | 2019-04-08 11:37:45 +0200 |
---|---|---|
committer | Michal Cmarada <mcmarada@cisco.com> | 2019-04-08 11:37:45 +0200 |
commit | b16cea20258ba537db7c0755208c82ab93331ff7 (patch) | |
tree | 8a5a3c87069b9ce700c34323e75ff434e7acae97 /infra/cfg-init | |
parent | 23979469bcf8cd312cb3ec9e9e548003110f68f4 (diff) |
HONEYCOMB-443: ODL bump to Neon
- bumps ODL dependencies to neon
- migrates guava optional to java.utils.optional
Change-Id: Ibdaa365c7e21a341103aba88dfd67277e40d2969
Signed-off-by: Michal Cmarada <mcmarada@cisco.com>
Diffstat (limited to 'infra/cfg-init')
-rw-r--r-- | infra/cfg-init/src/main/java/io/fd/honeycomb/data/init/RestoringInitializer.java | 16 | ||||
-rw-r--r-- | infra/cfg-init/src/test/java/io/fd/honeycomb/data/init/RestoringInitializerTest.java | 14 |
2 files changed, 15 insertions, 15 deletions
diff --git a/infra/cfg-init/src/main/java/io/fd/honeycomb/data/init/RestoringInitializer.java b/infra/cfg-init/src/main/java/io/fd/honeycomb/data/init/RestoringInitializer.java index 4488f8342..20085803a 100644 --- a/infra/cfg-init/src/main/java/io/fd/honeycomb/data/init/RestoringInitializer.java +++ b/infra/cfg-init/src/main/java/io/fd/honeycomb/data/init/RestoringInitializer.java @@ -24,11 +24,11 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; +import java.util.concurrent.ExecutionException; import javax.annotation.Nonnull; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction; import org.opendaylight.mdsal.dom.api.DOMSchemaService; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; @@ -90,7 +90,7 @@ public class RestoringInitializer implements DataTreeInitializer { try { final ContainerNode containerNode = jsonReader.readData(schemaService.getGlobalContext(), path); - final DOMDataWriteTransaction domDataWriteTransaction = dataTree.newWriteOnlyTransaction(); + final DOMDataTreeWriteTransaction domDataWriteTransaction = dataTree.newWriteOnlyTransaction(); for (DataContainerChild<? extends YangInstanceIdentifier.PathArgument, ?> dataContainerChild : containerNode .getValue()) { final YangInstanceIdentifier iid = YangInstanceIdentifier.create(dataContainerChild.getIdentifier()); @@ -110,11 +110,11 @@ public class RestoringInitializer implements DataTreeInitializer { } // Block here to prevent subsequent initializers processing before context is fully restored - domDataWriteTransaction.submit().checkedGet(); + domDataWriteTransaction.commit().get(); LOG.debug("Data from {} restored successfully", path); - } catch (IOException | TransactionCommitFailedException e) { - throw new InitializeException("Unable to restore data from " + path, e); + } catch (IOException | InterruptedException | ExecutionException ex) { + throw new InitializeException("Unable to restore data from " + path, ex); } } diff --git a/infra/cfg-init/src/test/java/io/fd/honeycomb/data/init/RestoringInitializerTest.java b/infra/cfg-init/src/test/java/io/fd/honeycomb/data/init/RestoringInitializerTest.java index 3aeb6895b..7c10988bf 100644 --- a/infra/cfg-init/src/test/java/io/fd/honeycomb/data/init/RestoringInitializerTest.java +++ b/infra/cfg-init/src/test/java/io/fd/honeycomb/data/init/RestoringInitializerTest.java @@ -20,7 +20,6 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; import static org.mockito.Mockito.when; -import com.google.common.util.concurrent.Futures; import java.io.IOException; import java.nio.file.Files; import java.nio.file.NoSuchFileException; @@ -31,10 +30,11 @@ import org.junit.Before; import org.junit.Test; import org.mockito.Mock; import org.mockito.MockitoAnnotations; -import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; -import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker; -import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction; +import org.opendaylight.mdsal.common.api.LogicalDatastoreType; +import org.opendaylight.mdsal.dom.api.DOMDataBroker; +import org.opendaylight.mdsal.dom.api.DOMDataTreeWriteTransaction; import org.opendaylight.mdsal.dom.api.DOMSchemaService; +import org.opendaylight.yangtools.util.concurrent.FluentFutures; import org.opendaylight.yangtools.yang.common.QName; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode; @@ -53,7 +53,7 @@ public class RestoringInitializerTest { @Mock private ContainerNode data; @Mock - private DOMDataWriteTransaction writeTx; + private DOMDataTreeWriteTransaction writeTx; private Path path; private YangInstanceIdentifier.NodeIdentifier nodeId = new YangInstanceIdentifier.NodeIdentifier(QName.create("namespace", "data")); @@ -65,7 +65,7 @@ public class RestoringInitializerTest { when(schemaService.getGlobalContext()).thenReturn(schemaContext); when(jsonReader.readData(schemaContext, path)).thenReturn(data); when(dataTree.newWriteOnlyTransaction()).thenReturn(writeTx); - when(writeTx.submit()).thenReturn(Futures.immediateCheckedFuture(null)); + when(writeTx.commit()).thenReturn(FluentFutures.immediateNullFluentFuture()); when(data.getValue()).thenReturn(Collections.singleton(data)); when(data.getIdentifier()).thenReturn(nodeId); } @@ -92,7 +92,7 @@ public class RestoringInitializerTest { verify(dataTree).newWriteOnlyTransaction(); verify(writeTx).put(LogicalDatastoreType.OPERATIONAL, YangInstanceIdentifier.create(nodeId), data); - verify(writeTx).submit(); + verify(writeTx).commit(); } @Test |