Fix compiler error due to removal of InMemoryDataTreeFactory.create 60/42160/1
authorTom Pantelis <tpanteli@brocade.com>
Wed, 20 Jul 2016 05:38:12 +0000 (01:38 -0400)
committerTom Pantelis <tpanteli@brocade.com>
Wed, 20 Jul 2016 05:39:16 +0000 (01:39 -0400)
Change-Id: I016c1beeb55a438ba56b8076c7e792c79ac51294
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/TransactionProxy.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregator.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/utils/NormalizedNodeAggregatorTest.java

index af4c899..191cb2e 100644 (file)
@@ -130,7 +130,9 @@ public class TransactionProxy extends AbstractDOMStoreTransaction<TransactionIde
             @Override
             public Optional<NormalizedNode<?, ?>> apply(final List<Optional<NormalizedNode<?, ?>>> input) {
                 try {
-                    return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY, input, txContextFactory.getActorContext().getSchemaContext());
+                    return NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.EMPTY, input,
+                            txContextFactory.getActorContext().getSchemaContext(),
+                            txContextFactory.getActorContext().getDatastoreContext().getLogicalStoreType());
                 } catch (DataValidationFailedException e) {
                     throw new IllegalArgumentException("Failed to aggregate", e);
                 }
index 1860458..c096567 100644 (file)
@@ -9,12 +9,14 @@ package org.opendaylight.controller.cluster.datastore.utils;
 
 import com.google.common.base.Optional;
 import java.util.List;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 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.DataTreeModification;
 import org.opendaylight.yangtools.yang.data.api.schema.tree.DataValidationFailedException;
+import org.opendaylight.yangtools.yang.data.api.schema.tree.TreeType;
 import org.opendaylight.yangtools.yang.data.impl.schema.tree.InMemoryDataTreeFactory;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
@@ -24,11 +26,12 @@ public class NormalizedNodeAggregator {
     private final DataTree dataTree;
 
     private NormalizedNodeAggregator(final YangInstanceIdentifier rootIdentifier, final List<Optional<NormalizedNode<?, ?>>> nodes,
-                             final SchemaContext schemaContext) {
+                             final SchemaContext schemaContext, LogicalDatastoreType logicalDatastoreType) {
         this.rootIdentifier = rootIdentifier;
         this.nodes = nodes;
-        // FIXME: BUG-1014: pass down proper DataTree
-        this.dataTree = InMemoryDataTreeFactory.getInstance().create();
+        this.dataTree = InMemoryDataTreeFactory.getInstance().create(
+                logicalDatastoreType == LogicalDatastoreType.CONFIGURATION ? TreeType.CONFIGURATION :
+                    TreeType.OPERATIONAL);
         this.dataTree.setSchemaContext(schemaContext);
     }
 
@@ -37,13 +40,15 @@ public class NormalizedNodeAggregator {
      *
      * @param nodes
      * @param schemaContext
+     * @param logicalDatastoreType
      * @return
      * @throws DataValidationFailedException
      */
     public static Optional<NormalizedNode<?,?>> aggregate(final YangInstanceIdentifier rootIdentifier,
                                                           final List<Optional<NormalizedNode<?, ?>>> nodes,
-                                                          final SchemaContext schemaContext) throws DataValidationFailedException {
-        return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext).aggregate();
+                                                          final SchemaContext schemaContext,
+                                                          LogicalDatastoreType logicalDatastoreType) throws DataValidationFailedException {
+        return new NormalizedNodeAggregator(rootIdentifier, nodes, schemaContext, logicalDatastoreType).aggregate();
     }
 
     private Optional<NormalizedNode<?,?>> aggregate() throws DataValidationFailedException {
index 453262a..c8d3dd5 100644 (file)
@@ -20,6 +20,7 @@ import org.junit.Test;
 import org.opendaylight.controller.md.cluster.datastore.model.CarsModel;
 import org.opendaylight.controller.md.cluster.datastore.model.SchemaContextHelper;
 import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStore;
 import org.opendaylight.controller.sal.core.spi.data.DOMStoreReadTransaction;
@@ -45,7 +46,7 @@ public class NormalizedNodeAggregatorTest {
                 ImmutableList.of(
                         Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode1, schemaContext)),
                         Optional.<NormalizedNode<?, ?>>of(getRootNode(expectedNode2, schemaContext))),
-                schemaContext);
+                schemaContext, LogicalDatastoreType.CONFIGURATION);
 
 
         NormalizedNode<?,?> normalizedNode = optional.get();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.