summaryrefslogtreecommitdiffstats
path: root/infra/data-impl
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2018-01-04 07:08:34 +0100
committerMarek Gradzki <mgradzki@cisco.com>2018-03-23 06:54:25 +0100
commit8acc5613345d9c50d0f33c3d74ae64e474b80724 (patch)
tree130723e4f6e4daa2fcc57538d971dfd34886c8a8 /infra/data-impl
parentbc559d4e6ccbdbaf65e612e56b2fe5d0614ff623 (diff)
HONEYCOMB-424: bump ODL dependencies to Oxygen
Change-Id: I3160e5df4e66b3b3c732619fc1fc7599459fda76 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'infra/data-impl')
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java3
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java26
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java4
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java4
-rw-r--r--infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java5
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java3
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java19
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java10
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java10
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java12
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java34
-rw-r--r--infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java6
12 files changed, 70 insertions, 66 deletions
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
index 48b9e79..8dcca27 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModifiableDataTreeManager.java
@@ -75,7 +75,8 @@ public class ModifiableDataTreeManager implements ModifiableDataManager {
@Override
public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
@Nonnull final YangInstanceIdentifier path) {
- final Optional<NormalizedNode<?, ?>> node = modification.readNode(path);
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ final Optional<NormalizedNode<?, ?>> node = Optional.fromNullable(modification.readNode(path).orElse(null));
if (LOG.isTraceEnabled() && node.isPresent()) {
LOG.trace("ConfigSnapshot.read: {}", node.get());
}
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
index 88823c5..45a207c 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/Modification.java
@@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.ModificationType;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.AugmentationTarget;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
@@ -89,11 +89,13 @@ final class Modification {
}
com.google.common.base.Optional<NormalizedNode<?, ?>> getDataBefore() {
- return dataCandidate.getDataBefore();
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ return com.google.common.base.Optional.fromNullable(dataCandidate.getDataBefore().orElse(null));
}
com.google.common.base.Optional<NormalizedNode<?, ?>> getDataAfter() {
- return dataCandidate.getDataAfter();
+ // FIXME switch to java.util.Optional when rest of ODL infra does
+ return com.google.common.base.Optional.fromNullable(dataCandidate.getDataAfter().orElse(null));
}
Object getSchemaNode() {
@@ -107,25 +109,25 @@ final class Modification {
boolean isMixin() {
// Checking whether node is a mixin is not performed on schema, but on data since mixin is
// only a NormalizedNode concept, not a schema concept
- return dataCandidate.getDataBefore().orNull() instanceof MixinNode ||
- dataCandidate.getDataAfter().orNull() instanceof MixinNode;
+ return dataCandidate.getDataBefore().orElse(null) instanceof MixinNode ||
+ dataCandidate.getDataAfter().orElse(null) instanceof MixinNode;
}
boolean isBeforeAndAfterDifferent() {
if (dataCandidate.getDataBefore().isPresent()) {
- return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orNull());
+ return !dataCandidate.getDataBefore().get().equals(dataCandidate.getDataAfter().orElse(null));
}
// considering not a modification if data after is also null
return dataCandidate.getDataAfter().isPresent();
}
- private AugmentationSchema findAugmentation(Object currentNode,
- final YangInstanceIdentifier.AugmentationIdentifier identifier) {
+ private AugmentationSchemaNode findAugmentation(Object currentNode,
+ final YangInstanceIdentifier.AugmentationIdentifier identifier) {
if (currentNode != null) {
// check if identifier points to some augmentation of currentNode
if (currentNode instanceof AugmentationTarget) {
- Optional<AugmentationSchema> augmentationSchema =
+ Optional<AugmentationSchemaNode> augmentationSchema =
((AugmentationTarget) currentNode).getAvailableAugmentations().stream()
.filter(aug -> identifier.equals(new YangInstanceIdentifier.AugmentationIdentifier(
aug.getChildNodes().stream()
@@ -142,7 +144,7 @@ final class Modification {
if (currentNode instanceof DataNodeContainer) {
childNodes = ((DataNodeContainer) currentNode).getChildNodes();
} else if (currentNode instanceof ChoiceSchemaNode) {
- childNodes = ((ChoiceSchemaNode) currentNode).getCases().stream()
+ childNodes = ((ChoiceSchemaNode) currentNode).getCases().values().stream()
.flatMap(cas -> cas.getChildNodes().stream()).collect(Collectors.toList());
}
return childNodes.stream().map(n -> findAugmentation(n, identifier)).filter(n -> n != null).findFirst()
@@ -161,7 +163,7 @@ final class Modification {
// An augment cannot change other augment, so we do not update parent node if we are streaming
// children of AugmentationSchema (otherwise we would fail to find schema for nested augmentations):
if (updateParentNode) {
- if (schemaNode instanceof AugmentationSchema) {
+ if (schemaNode instanceof AugmentationSchemaNode) {
// child nodes would not have nested augmentations, so we stop moving parentNode:
return new Modification(childId, child, parentNode, schemaChild, false);
} else {
@@ -218,7 +220,7 @@ final class Modification {
}
} else if (schemaNode instanceof ChoiceSchemaNode) {
// For choices, iterate through all the cases
- final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().stream()
+ final Optional<DataSchemaNode> maybeChild = ((ChoiceSchemaNode) schemaNode).getCases().values().stream()
.flatMap(cas -> cas.getChildNodes().stream())
.filter(child -> child.getQName().equals(identifier.getNodeType()))
.findFirst();
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
index 9d97d91..98950b2 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/ModificationDiff.java
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.MixinNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode;
import org.opendaylight.yangtools.yang.data.impl.schema.nodes.AbstractImmutableDataContainerNode;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.LeafListSchemaNode;
@@ -176,7 +176,7 @@ final class ModificationDiff {
// APPEAR/DISAPPEAR are not valid modifications, but some of the children can be modified
// aka. list entry added to nested list under non-presence container, which would be resolved as APPEAR for
// that container, but MERGE for nested list
- if (modification.isMixin() && !modification.is(AugmentationSchema.class)) {
+ if (modification.isMixin() && !modification.is(AugmentationSchemaNode.class)) {
return false;
} else {
return isCurrentModified(modification);
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
index c7832ac..9cd1406 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/NormalizedNodeRewriteDeleteRegistry.java
@@ -28,7 +28,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
-import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
+import org.opendaylight.yangtools.yang.model.api.CaseSchemaNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -86,7 +86,7 @@ final class NormalizedNodeRewriteDeleteRegistry implements RewriteDeleteProducer
return choiceDeleteProducer.normalizedUpdates(topLevelIdentifier, entry);
}
- if (entry.getValue() instanceof ChoiceCaseNode) {
+ if (entry.getValue() instanceof CaseSchemaNode) {
LOG.debug("Processing case {}", topLevelIdentifier);
return caseDeleteProducer.normalizedUpdates(topLevelIdentifier, entry);
}
diff --git a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
index 3c356c2..d779e62 100644
--- a/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
+++ b/infra/data-impl/src/main/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapter.java
@@ -21,19 +21,20 @@ import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.MoreObjects;
-import com.google.common.base.Optional;
import io.fd.honeycomb.translate.util.JsonUtils;
import java.io.IOException;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
+import java.util.Optional;
import javax.annotation.Nonnull;
import org.opendaylight.controller.sal.core.api.model.SchemaService;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
@@ -163,7 +164,7 @@ public class PersistingDataTreeAdapter implements DataTree {
}
@Override
- public DataTreeCandidate prepare(
+ public DataTreeCandidateTip prepare(
final DataTreeModification dataTreeModification) {
return delegateDependency.prepare(dataTreeModification);
}
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java
index 56c0c61..3065a94 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModifiableDataTreeDelegatorTest.java
@@ -63,7 +63,8 @@ public class ModifiableDataTreeDelegatorTest extends ModifiableDataTreeDelegator
assertEquals(normalizedNodeOptional, normalizedNodeOptional2);
assertTrue(normalizedNodeOptional.isPresent());
assertEquals(topContainer, normalizedNodeOptional.get());
- assertEquals(dataTree.takeSnapshot().readNode(TOP_CONTAINER_ID), normalizedNodeOptional);
+ // FIXMe use toJavaUtil everywhere
+ assertEquals(dataTree.takeSnapshot().readNode(TOP_CONTAINER_ID), Optional.toJavaUtil(normalizedNodeOptional));
}
@Test
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java
index 7e9c34d..666386d 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationBaseTest.java
@@ -36,11 +36,10 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidate;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeConfiguration;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
@@ -63,8 +62,8 @@ abstract class ModificationBaseTest extends ModificationMetadata {
dataTree.commit(prepare);
}
- protected TipProducingDataTree getDataTree() throws ReactorException {
- final TipProducingDataTree dataTree = InMemoryDataTreeFactory.getInstance().create(TreeType.CONFIGURATION);
+ protected DataTree getDataTree() throws ReactorException {
+ final DataTree dataTree = new InMemoryDataTreeFactory().create(DataTreeConfiguration.DEFAULT_CONFIGURATION);
dataTree.setSchemaContext(getSchemaCtx());
return dataTree;
}
@@ -126,16 +125,16 @@ abstract class ModificationBaseTest extends ModificationMetadata {
}
SchemaContext getSchemaCtx() throws ReactorException {
- return YangParserTestUtils.parseYangSources(Collections.singletonList("/test-diff.yang"));
+ return YangParserTestUtils.parseYangResource("/test-diff.yang");
}
- DataTreeModification getModification(final TipProducingDataTree dataTree) {
+ DataTreeModification getModification(final DataTree dataTree) {
final DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot();
return dataTreeSnapshot.newModification();
}
- DataTreeCandidateTip prepareModification(final TipProducingDataTree dataTree,
+ DataTreeCandidateTip prepareModification(final DataTree dataTree,
final DataTreeModification dataTreeModification)
throws DataValidationFailedException {
dataTreeModification.ready();
@@ -329,9 +328,9 @@ abstract class ModificationBaseTest extends ModificationMetadata {
.build()).build()).build();
}
- TipProducingDataTree prepareStateBeforeWithTopContainer(final NormalizedNode<?, ?> topContainerData)
+ DataTree prepareStateBeforeWithTopContainer(final NormalizedNode<?, ?> topContainerData)
throws ReactorException, DataValidationFailedException {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModificationOriginal = getModification(dataTree);
// non presence, but with valid child list
dataTreeModificationOriginal.write(TOP_CONTAINER_ID, topContainerData);
@@ -340,7 +339,7 @@ abstract class ModificationBaseTest extends ModificationMetadata {
return dataTree;
}
- DataTreeCandidateTip prepareStateAfterEmpty(final TipProducingDataTree dataTree)
+ DataTreeCandidateTip prepareStateAfterEmpty(final DataTree dataTree)
throws DataValidationFailedException {
final NormalizedNode<?, ?> topContainerModified = Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java
index c2b9598..eeef85e 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffAugRewriteDeleteTest.java
@@ -22,9 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.slf4j.Logger;
@@ -37,7 +37,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceNonEmptyContainerAugWithLeaf()
throws ReactorException, DataValidationFailedException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithLeafUnderAug("val"))
.build());
@@ -58,7 +58,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceNonEmptyContainerAugWithList()
throws ReactorException, DataValidationFailedException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithListUnderAug("val"))
.build());
@@ -79,7 +79,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceNonEmptyContainerAugWithNonPresenceContainer()
throws ReactorException, DataValidationFailedException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithContUnderAug("val"))
.build());
@@ -100,7 +100,7 @@ public class ModificationDiffAugRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceNonEmptyContainerAugWithLeafList()
throws ReactorException, DataValidationFailedException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithLeafListUnderAug("val"))
.build());
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java
index 9c92b4f..071701d 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffNestedAugRewriteDeleteTest.java
@@ -22,9 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.slf4j.Logger;
@@ -37,7 +37,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase
@Test
public void testWriteNonPresenceNonEmptyContainerNestedAugWithContainer()
throws DataValidationFailedException, ReactorException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithContainerUnderNestedAug("val"))
.build());
@@ -58,7 +58,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase
@Test
public void testWriteNonPresenceNonEmptyContainerNestedAugWithLeafList()
throws DataValidationFailedException, ReactorException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithLeafListUnderNestedAug("val"))
.build());
@@ -79,7 +79,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase
@Test
public void testWriteNonPresenceNonEmptyContainerNestedAugWithList()
throws DataValidationFailedException, ReactorException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithListUnderNestedAug("val"))
.build());
@@ -100,7 +100,7 @@ public class ModificationDiffNestedAugRewriteDeleteTest extends ModificationBase
@Test
public void testWriteNonPresenceNonEmptyContainerNestedAugWithLeaf()
throws DataValidationFailedException, ReactorException {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedContWithLeafUnderNestedAug("val"))
.build());
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java
index a1ede96..0be681c 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffRewriteDeleteTest.java
@@ -23,8 +23,8 @@ import com.google.common.collect.ImmutableSet;
import org.junit.Test;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -40,7 +40,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceNonEmptyContainerPreviousDataOverrideByEmpty() throws Exception {
final MapEntryNode alreadyPresent = getNestedListEntry("value", "txt");
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
.withChild(getNestedList(alreadyPresent))
.build());
@@ -66,7 +66,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceMultipleNonEmptyContainerPreviousDataOverrideByEmpty() throws Exception {
final MapEntryNode alreadyPresent = getNestedListInContainerEntry("key");
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
// another non-presence container with list entry
.withChild(Builders.containerBuilder()
@@ -97,7 +97,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest {
*/
@Test
public void testWriteNonPresenceNonEmptyContainerLeaf() throws Exception {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
// another non-presence container with leaf
.withChild(Builders.containerBuilder()
@@ -127,7 +127,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest {
*/
@Test
public void testWriteNonPresenceNonEmptyContainerLeafList() throws Exception {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
// another non-presence container with leaf
.withChild(getNestedContainerWithLeafList())
@@ -152,7 +152,7 @@ public class ModificationDiffRewriteDeleteTest extends ModificationBaseTest {
*/
@Test
public void testWriteNonPresenceNonEmptyContainerWithChoice() throws Exception {
- final TipProducingDataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
+ final DataTree dataTree = prepareStateBeforeWithTopContainer(Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
// another non-presence container with leaf
.withChild(getNestedContainerWithChoice("val"))
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java
index cd980dd..546bb05 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/ModificationDiffTest.java
@@ -22,19 +22,19 @@ import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import com.google.common.base.Optional;
import com.google.common.collect.ImmutableSet;
import java.util.Map;
+import java.util.Optional;
import org.junit.Test;
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.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTree;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateTip;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeModification;
import org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeSnapshot;
-import org.opendaylight.yangtools.yang.data.api.schema.tree.TipProducingDataTree;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.slf4j.Logger;
@@ -46,7 +46,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testInitialWrite() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final NormalizedNode<?, ?> topContainer = getTopContainer("string1");
final YangInstanceIdentifier TOP_CONTAINER_ID = YangInstanceIdentifier.of(TOP_CONTAINER_QNAME);
@@ -62,7 +62,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testLeafList() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final ContainerNode topContainer = getTopContainerWithLeafList("string1", "string2");
final YangInstanceIdentifier TOP_CONTAINER_ID = YangInstanceIdentifier.of(TOP_CONTAINER_QNAME);
@@ -80,7 +80,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWritePresenceEmptyContainer() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final NormalizedNode<?, ?> presenceContainer = Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(PRESENCE_CONTAINER_QNAME))
@@ -104,7 +104,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testInitialWriteForContainerWithChoice() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final ContainerNode containerWithChoice = Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(WITH_CHOICE_CONTAINER_QNAME))
@@ -128,7 +128,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceEmptyContainer() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final NormalizedNode<?, ?> topContainer = ImmutableNodes.containerNode(TOP_CONTAINER_QNAME);
dataTreeModification.write(TOP_CONTAINER_ID, topContainer);
@@ -144,7 +144,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
*/
@Test
public void testWriteNonPresenceNonEmptyContainer() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
// non presence ,but with valid child list
final NormalizedNode<?, ?> topContainer = Builders.containerBuilder()
@@ -167,7 +167,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
*/
@Test
public void testWriteNonPresenceNonEmptyContainerPreviousData() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModificationOriginal = getModification(dataTree);
// non presence, but with valid child list
final MapEntryNode alreadyPresent = getNestedListEntry("value", "txt");
@@ -200,7 +200,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWriteNonPresenceEmptyNestedContainer() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final DataTreeModification dataTreeModification = getModification(dataTree);
final NormalizedNode<?, ?> topContainer = Builders.containerBuilder()
.withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TOP_CONTAINER_QNAME))
@@ -220,7 +220,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testUpdateWrite() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final ContainerNode topContainer = getTopContainer("string1");
addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID);
@@ -239,7 +239,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testUpdateMerge() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final ContainerNode topContainer = getTopContainer("string1");
addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID);
@@ -256,7 +256,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testUpdateDelete() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
final ContainerNode topContainer = getTopContainer("string1");
addNodeToTree(dataTree, topContainer, TOP_CONTAINER_ID);
@@ -272,7 +272,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWriteAndUpdateInnerList() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot();
DataTreeModification dataTreeModification = dataTreeSnapshot.newModification();
@@ -316,7 +316,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWriteTopContainerAndInnerList() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot();
DataTreeModification dataTreeModification = dataTreeSnapshot.newModification();
@@ -353,7 +353,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testWriteDeepList() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot();
DataTreeModification dataTreeModification = dataTreeSnapshot.newModification();
@@ -412,7 +412,7 @@ public class ModificationDiffTest extends ModificationBaseTest {
@Test
public void testDeleteInnerListItem() throws Exception {
- final TipProducingDataTree dataTree = getDataTree();
+ final DataTree dataTree = getDataTree();
DataTreeSnapshot dataTreeSnapshot = dataTree.takeSnapshot();
DataTreeModification dataTreeModification = dataTreeSnapshot.newModification();
diff --git a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
index 7e135a2..dba7077 100644
--- a/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
+++ b/infra/data-impl/src/test/java/io/fd/honeycomb/data/impl/PersistingDataTreeAdapterTest.java
@@ -27,10 +27,10 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.base.Optional;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
@@ -83,7 +83,7 @@ public class PersistingDataTreeAdapterTest {
public void testPersist() throws Exception {
persistingDataTreeAdapter = new PersistingDataTreeAdapter(delegatingDataTree, persister);
final DataTreeSnapshot snapshot = mock(DataTreeSnapshot.class);
- when(snapshot.readNode(any())).thenReturn(Optional.absent());
+ when(snapshot.readNode(any())).thenReturn(Optional.empty());
when(delegatingDataTree.takeSnapshot()).thenReturn(snapshot);
persistingDataTreeAdapter.commit(mock(DataTreeCandidate.class));
verify(delegatingDataTree).takeSnapshot();
@@ -126,7 +126,7 @@ public class PersistingDataTreeAdapterTest {
final PersistingDataTreeAdapter.JsonPersister jsonPersister =
new PersistingDataTreeAdapter.JsonPersister(tmpPersistFile, schemaService);
// Nothing
- jsonPersister.persistCurrentData(Optional.absent());
+ jsonPersister.persistCurrentData(Optional.empty());
// Exception
jsonPersister.persistCurrentData(Optional.of(ImmutableNodes.leafNode(QName.create("namespace", "leaf"), "value")));
}