X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-distributed-datastore%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fmd%2Fcluster%2Fdatastore%2Fmodel%2FPeopleModel.java;h=33ee0a38afe9a4c2ee186f6bcc35e525e3a2c6ec;hb=c8121ea6b5bf54c43777afe6a747be40637e1f42;hp=e637920e7855c9859ee9cab249f31b20766e9ef2;hpb=8e42b08cb626a60919c145b2a46d94114c3905d6;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java index e637920e78..33ee0a38af 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/PeopleModel.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.controller.md.cluster.datastore.model; import org.opendaylight.yangtools.yang.common.QName; @@ -18,19 +17,23 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNo import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableContainerNodeBuilder; import org.opendaylight.yangtools.yang.data.impl.schema.builder.impl.ImmutableMapNodeBuilder; -public class PeopleModel { - public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13", - "people"); +public final class PeopleModel { + public static final QName BASE_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:people", "2014-03-13", "people"); - public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME); public static final QName PEOPLE_QNAME = QName.create(BASE_QNAME, "people"); public static final QName PERSON_QNAME = QName.create(PEOPLE_QNAME, "person"); public static final QName PERSON_NAME_QNAME = QName.create(PERSON_QNAME, "name"); public static final QName PERSON_AGE_QNAME = QName.create(PERSON_QNAME, "age"); + public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME); + public static final YangInstanceIdentifier PERSON_LIST_PATH = BASE_PATH.node(PERSON_QNAME); + private PeopleModel() { + + } - public static NormalizedNode create(){ + public static NormalizedNode create() { // Create a list builder CollectionNodeBuilder cars = @@ -62,11 +65,24 @@ public class PeopleModel { } - public static NormalizedNode emptyContainer(){ + public static NormalizedNode emptyContainer() { return ImmutableContainerNodeBuilder.create() .withNodeIdentifier( new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .build(); } + public static NormalizedNode newPersonMapNode() { + return ImmutableNodes.mapNodeBuilder(PERSON_QNAME).build(); + } + + public static MapEntryNode newPersonEntry(final String name) { + return ImmutableNodes.mapEntryBuilder(PERSON_QNAME, PERSON_NAME_QNAME, name) + .withChild(ImmutableNodes.leafNode(PERSON_NAME_QNAME, name)).build(); + } + + public static YangInstanceIdentifier newPersonPath(final String name) { + return YangInstanceIdentifier.builder(PERSON_LIST_PATH) + .nodeWithKey(PERSON_QNAME, PERSON_NAME_QNAME, name).build(); + } }