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%2FCarsModel.java;h=c93dbccff55845f151b7fede2b41bd2aacd61742;hb=0cb5ce07fc959deed2e7887ed22dfde81cb2c9a2;hp=6ad88e568ad479de489219cd53f0529ab7f456f5;hpb=288a70d15252b3c5fafd202fe7935563f05da9c8;p=controller.git diff --git a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java index 6ad88e568a..c93dbccff5 100644 --- a/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java +++ b/opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/md/cluster/datastore/model/CarsModel.java @@ -5,11 +5,10 @@ * 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 java.math.BigInteger; import org.opendaylight.yangtools.yang.common.QName; +import org.opendaylight.yangtools.yang.common.Uint64; 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; @@ -20,9 +19,9 @@ 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 CarsModel { - public static final QName BASE_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13", - "cars"); +public final class CarsModel { + public static final QName BASE_QNAME = QName.create( + "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test:cars", "2014-03-13", "cars"); public static final QName CARS_QNAME = QName.create(BASE_QNAME, "cars"); public static final QName CAR_QNAME = QName.create(CARS_QNAME, "car"); @@ -32,7 +31,11 @@ public class CarsModel { public static final YangInstanceIdentifier BASE_PATH = YangInstanceIdentifier.of(BASE_QNAME); public static final YangInstanceIdentifier CAR_LIST_PATH = BASE_PATH.node(CAR_QNAME); - public static NormalizedNode create(){ + private CarsModel() { + + } + + public static NormalizedNode create() { // Create a list builder CollectionNodeBuilder cars = @@ -44,14 +47,14 @@ public class CarsModel { MapEntryNode altima = ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "altima") .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "altima")) - .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("1000"))) + .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, Uint64.valueOf(1000))) .build(); // Create an entry for the car accord MapEntryNode honda = ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, "accord") .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, "accord")) - .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, new BigInteger("2000"))) + .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, Uint64.valueOf("2000"))) .build(); cars.withChild(altima); @@ -64,26 +67,26 @@ public class CarsModel { } - public static NormalizedNode createEmptyCarsList(){ + public static NormalizedNode createEmptyCarsList() { return newCarsNode(newCarsMapNode()); } - public static ContainerNode newCarsNode(MapNode carsList) { + public static ContainerNode newCarsNode(final MapNode carsList) { return ImmutableContainerNodeBuilder.create().withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier( BASE_QNAME)).withChild(carsList).build(); } - public static MapNode newCarsMapNode(MapEntryNode... carEntries) { - CollectionNodeBuilder builder = ImmutableMapNodeBuilder.create(). - withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CAR_QNAME)); - for(MapEntryNode e: carEntries) { + public static MapNode newCarsMapNode(final MapEntryNode... carEntries) { + CollectionNodeBuilder builder = ImmutableMapNodeBuilder.create() + .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(CAR_QNAME)); + for (MapEntryNode e : carEntries) { builder.withChild(e); } return builder.build(); } - public static NormalizedNode emptyContainer(){ + public static NormalizedNode emptyContainer() { return ImmutableContainerNodeBuilder.create() .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(BASE_QNAME)) .build(); @@ -93,13 +96,13 @@ public class CarsModel { return ImmutableNodes.mapNodeBuilder(CAR_QNAME).build(); } - public static MapEntryNode newCarEntry(String name, BigInteger price) { + public static MapEntryNode newCarEntry(final String name, final Uint64 price) { return ImmutableNodes.mapEntryBuilder(CAR_QNAME, CAR_NAME_QNAME, name) .withChild(ImmutableNodes.leafNode(CAR_NAME_QNAME, name)) .withChild(ImmutableNodes.leafNode(CAR_PRICE_QNAME, price)).build(); } - public static YangInstanceIdentifier newCarPath(String name) { + public static YangInstanceIdentifier newCarPath(final String name) { return YangInstanceIdentifier.builder(CAR_LIST_PATH).nodeWithKey(CAR_QNAME, CAR_NAME_QNAME, name).build(); } }