import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.config.distributed.datastore.provider.rev231229.DataStorePropertiesContainer;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
abstract class AbstractDatastoreContextIntrospectorFactory implements DatastoreContextIntrospectorFactory {
@Override
@VisibleForTesting
final @NonNull DatastoreContextIntrospector newInstance(final DatastoreContext context) {
- final DataStorePropertiesContainer defaultPropsContainer = (DataStorePropertiesContainer)
- serializer().fromNormalizedNode(YangInstanceIdentifier.of(DataStorePropertiesContainer.QNAME),
- ImmutableNodes.containerNode(DataStorePropertiesContainer.QNAME)).getValue();
-
- return new DatastoreContextIntrospector(context, defaultPropsContainer);
+ return new DatastoreContextIntrospector(context, (DataStorePropertiesContainer) serializer()
+ .fromNormalizedNode(YangInstanceIdentifier.of(DataStorePropertiesContainer.QNAME),
+ ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(DataStorePropertiesContainer.QNAME))
+ .build())
+ .getValue());
}
abstract BindingNormalizedNodeSerializer serializer();
import org.opendaylight.yangtools.yang.common.Empty;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.tree.api.CursorAwareDataTreeModification;
import org.opendaylight.yangtools.yang.data.tree.api.DataTreeSnapshot;
protected static final YangInstanceIdentifier PATH_3 = YangInstanceIdentifier.builder()
.node(QName.create("ns-1", "node-3"))
.build();
- protected static final ContainerNode DATA_1 = Builders.containerBuilder()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(PATH_1.getLastPathArgument().getNodeType()))
+ protected static final ContainerNode DATA_1 = ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(PATH_1.getLastPathArgument().getNodeType()))
.build();
- protected static final ContainerNode DATA_2 = Builders.containerBuilder()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(PATH_2.getLastPathArgument().getNodeType()))
+ protected static final ContainerNode DATA_2 = ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(PATH_2.getLastPathArgument().getNodeType()))
.build();
protected static final String PERSISTENCE_ID = "per-1";
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
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.Builders;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.tree.api.CursorAwareDataTreeModification;
public class ClientTransactionTest extends AbstractClientHandleTest<ClientTransaction> {
-
- private static final YangInstanceIdentifier PATH = YangInstanceIdentifier.builder()
- .node(QName.create("ns-1", "node-1"))
- .build();
- private static final ContainerNode DATA = Builders.containerBuilder()
- .withNodeIdentifier(NodeIdentifier.create(PATH.getLastPathArgument().getNodeType()))
- .build();
+ private static final YangInstanceIdentifier PATH = YangInstanceIdentifier.of(QName.create("ns-1", "node-1"));
+ private static final ContainerNode DATA = ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(NodeIdentifier.create(PATH.getLastPathArgument().getNodeType()))
+ .build();
@Mock
private CursorAwareDataTreeModification modification;
import org.opendaylight.controller.cluster.datastore.utils.MockDataTreeChangeListener;
import org.opendaylight.controller.md.cluster.datastore.model.TestModel;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.tree.api.DataValidationFailedException;
import scala.concurrent.Await;
import scala.concurrent.duration.FiniteDuration;
@Test
public void testInitialChangeListenerEventWithContainerPath() throws DataValidationFailedException {
- writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
+ writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TEST_QNAME))
+ .build());
Entry<MockDataTreeChangeListener, ActorSelection> entry = registerChangeListener(TEST_PATH, 1);
MockDataTreeChangeListener listener = entry.getKey();
listener.reset(1);
- writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
+ writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TEST_QNAME))
+ .build());
listener.waitForChangeEvents();
listener.verifyNotifiedData(TEST_PATH);
entry.getValue().tell(CloseDataTreeNotificationListenerRegistration.getInstance(), kit.getRef());
kit.expectMsgClass(Duration.ofSeconds(5), CloseDataTreeNotificationListenerRegistrationReply.class);
- writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.containerNode(TEST_QNAME));
+ writeToStore(shard.getDataStore(), TEST_PATH, ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TEST_QNAME))
+ .build());
listener.verifyNoNotifiedData(TEST_PATH);
}
import org.opendaylight.mdsal.dom.store.inmemory.InMemoryDOMDataStore;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
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.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.tree.api.DataValidationFailedException;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
@Test
public void testAggregate() throws InterruptedException, ExecutionException, DataValidationFailedException {
EffectiveModelContext schemaContext = SchemaContextHelper.full();
- NormalizedNode expectedNode1 = ImmutableNodes.containerNode(TestModel.TEST_QNAME);
- NormalizedNode expectedNode2 = ImmutableNodes.containerNode(CarsModel.CARS_QNAME);
+ NormalizedNode expectedNode1 = ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(TestModel.TEST_QNAME))
+ .build();
+ NormalizedNode expectedNode2 = ImmutableNodes.newContainerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(CarsModel.CARS_QNAME))
+ .build();
Optional<NormalizedNode> optional = NormalizedNodeAggregator.aggregate(YangInstanceIdentifier.of(),
ImmutableList.of(
*/
package org.opendaylight.controller.md.cluster.datastore.model;
-import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.leafNode;
import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntry;
import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapNodeBuilder;
+import static org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes.leafNode;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
}
public static ContainerNode createTestContainer() {
- return Builders.containerBuilder()
+ return ImmutableNodes.newContainerBuilder()
.withNodeIdentifier(new NodeIdentifier(TEST_QNAME))
.withChild(leafNode(DESC_QNAME, DESC))
.withChild(leafNode(AUG_QNAME, "First Test"))
- .withChild(Builders.leafSetBuilder()
+ .withChild(ImmutableNodes.<String>newSystemLeafSetBuilder()
.withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "shoe")))
- .withChild(Builders.leafSetEntryBuilder()
- .withNodeIdentifier(new NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "nike"))
- .withValue("nike")
- .build())
- .withChild(Builders.leafSetEntryBuilder()
- .withNodeIdentifier(new NodeWithValue<>(QName.create(TEST_QNAME, "shoe"), "puma"))
- .withValue("puma")
- .build())
+ .withChildValue("nike")
+ .withChildValue("puma")
.build())
- .withChild(Builders.leafSetBuilder()
+ .withChild(ImmutableNodes.<Integer>newSystemLeafSetBuilder()
.withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "number")))
- .withChild(Builders.leafSetEntryBuilder()
- .withNodeIdentifier(new NodeWithValue<>(QName.create(TEST_QNAME, "number"), 5))
- .withValue(5)
- .build())
- .withChild(Builders.leafSetEntryBuilder()
- .withNodeIdentifier(new NodeWithValue<>(QName.create(TEST_QNAME, "number"), 15))
- .withValue(15)
- .build())
+ .withChildValue(5)
+ .withChildValue(15)
.build())
.withChild(mapNodeBuilder(OUTER_LIST_QNAME)
.withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
.withChild(leafNode(GRAND_CHILD_NAME_QNAME, FIRST_GRAND_CHILD_NAME))
.build();
- return Builders.containerBuilder()
+ return ImmutableNodes.newContainerBuilder()
.withNodeIdentifier(new NodeIdentifier(FAMILY_QNAME))
.withChild(mapNodeBuilder(CHILDREN_QNAME)
.withChild(mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID)
*/
package org.opendaylight.controller.md.cluster.datastore.model;
+import static org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes.mapEntryBuilder;
+
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
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.SystemMapNode;
-import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
-import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
+import org.opendaylight.yangtools.yang.data.spi.node.ImmutableNodes;
public final class PeopleModel {
public static final QName BASE_QNAME = QName.create(
}
public static ContainerNode create() {
- return Builders.containerBuilder()
+ return ImmutableNodes.newContainerBuilder()
.withNodeIdentifier(new NodeIdentifier(BASE_QNAME))
- .withChild(Builders.mapBuilder()
+ .withChild(ImmutableNodes.newSystemMapBuilder()
.withNodeIdentifier(new NodeIdentifier(PERSON_QNAME))
// Create an entry for the person jack
- .withChild(ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack")
+ .withChild(mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jack")
.withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jack"))
.withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 100L))
.build())
// Create an entry for the person jill
- .withChild(ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill")
+ .withChild(mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, "jill")
.withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, "jill"))
.withChild(ImmutableNodes.leafNode(PERSON_AGE_QNAME, 200L))
.build())
}
public static ContainerNode emptyContainer() {
- return Builders.containerBuilder()
- .withNodeIdentifier(new NodeIdentifier(BASE_QNAME))
- .build();
+ return ImmutableNodes.newContainerBuilder().withNodeIdentifier(new NodeIdentifier(BASE_QNAME)).build();
}
public static SystemMapNode newPersonMapNode() {
- return ImmutableNodes.mapNodeBuilder(PERSON_QNAME).build();
+ return ImmutableNodes.newSystemMapBuilder().withNodeIdentifier(new NodeIdentifier(PERSON_QNAME)).build();
}
public static MapEntryNode newPersonEntry(final String name) {
- return ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, name)
+ return mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, name)
.withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, name))
.build();
}