try {
String className = DefaultConfigParamsImpl.this.customRaftPolicyImplementationClass;
LOG.info("Trying to use custom RaftPolicy {}", className);
- Class c = Class.forName(className);
+ Class<?> c = Class.forName(className);
RaftPolicy obj = (RaftPolicy)c.newInstance();
return obj;
} catch (Exception e) {
final String name = matcher.group(1);
final String value = matcher.group(2);
- return new YangInstanceIdentifier.NodeWithValue(
+ return new YangInstanceIdentifier.NodeWithValue<>(
QNameFactory.create(name), getValue(value));
}
import java.util.Set;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
public class PathUtils {
private static final Splitter SLASH_SPLITTER = Splitter.on('/').omitEmptyStrings();
* @return
*/
public static String toString(YangInstanceIdentifier path) {
- final Iterator<YangInstanceIdentifier.PathArgument> it =
- path.getPathArguments().iterator();
+ final Iterator<PathArgument> it = path.getPathArguments().iterator();
if (!it.hasNext()) {
return "";
}
* @param pathArgument
* @return
*/
- public static String toString(YangInstanceIdentifier.PathArgument pathArgument){
- if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifier){
- return toString((YangInstanceIdentifier.NodeIdentifier) pathArgument);
- } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier){
- return toString((YangInstanceIdentifier.AugmentationIdentifier) pathArgument);
- } else if(pathArgument instanceof YangInstanceIdentifier.NodeWithValue){
- return toString((YangInstanceIdentifier.NodeWithValue) pathArgument);
- } else if(pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates){
- return toString((YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument);
+ public static String toString(PathArgument pathArgument){
+ if(pathArgument instanceof NodeIdentifier){
+ return toString((NodeIdentifier) pathArgument);
+ } else if(pathArgument instanceof AugmentationIdentifier){
+ return toString((AugmentationIdentifier) pathArgument);
+ } else if(pathArgument instanceof NodeWithValue){
+ return toString((NodeWithValue<?>) pathArgument);
+ } else if(pathArgument instanceof NodeIdentifierWithPredicates){
+ return toString((NodeIdentifierWithPredicates) pathArgument);
}
return pathArgument.toString();
* @return
*/
public static YangInstanceIdentifier toYangInstanceIdentifier(String path){
- List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+ List<PathArgument> pathArguments = new ArrayList<>();
for (String segment : SLASH_SPLITTER.split(path)) {
pathArguments.add(NodeIdentifierFactory.getArgument(segment));
}
return YangInstanceIdentifier.create(pathArguments);
}
- private static String toString(YangInstanceIdentifier.NodeIdentifier pathArgument){
+ private static String toString(NodeIdentifier pathArgument){
return pathArgument.getNodeType().toString();
}
- private static String toString(YangInstanceIdentifier.AugmentationIdentifier pathArgument){
+ private static String toString(AugmentationIdentifier pathArgument){
Set<QName> childNames = pathArgument.getPossibleChildNames();
final StringBuilder sb = new StringBuilder("AugmentationIdentifier{");
sb.append("childNames=").append(childNames).append('}');
}
- private static String toString(YangInstanceIdentifier.NodeWithValue pathArgument){
+ private static String toString(NodeWithValue<?> pathArgument) {
return pathArgument.getNodeType().toString() + "[" + pathArgument.getValue() + "]";
}
- private static String toString(YangInstanceIdentifier.NodeIdentifierWithPredicates pathArgument){
+ private static String toString(NodeIdentifierWithPredicates pathArgument){
return pathArgument.getNodeType().toString() + '[' + pathArgument.getKeyValues() + ']';
}
* @param node
* @return
*/
- public static NormalizedNodeMessages.Node serialize(NormalizedNode<?, ?> node){
+ public static NormalizedNodeMessages.Node serialize(final NormalizedNode<?, ?> node){
Preconditions.checkNotNull(node, "node should not be null");
return new Serializer(node).serialize();
}
- public static Serializer newSerializer(NormalizedNode<?, ?> node) {
+ public static Serializer newSerializer(final NormalizedNode<?, ?> node) {
Preconditions.checkNotNull(node, "node should not be null");
return new Serializer(node);
}
* @param node
* @return
*/
- public static NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node) {
+ public static NormalizedNode<?, ?> deSerialize(final NormalizedNodeMessages.Node node) {
Preconditions.checkNotNull(node, "node should not be null");
return new DeSerializer(null, node).deSerialize();
}
- public static DeSerializer newDeSerializer(NormalizedNodeMessages.InstanceIdentifier path,
- NormalizedNodeMessages.Node node) {
+ public static DeSerializer newDeSerializer(final NormalizedNodeMessages.InstanceIdentifier path,
+ final NormalizedNodeMessages.Node node) {
Preconditions.checkNotNull(node, "node should not be null");
return new DeSerializer(path, node);
}
* @param pathArgument
* @return
*/
- public static YangInstanceIdentifier.PathArgument deSerialize(NormalizedNodeMessages.Node node,
- NormalizedNodeMessages.PathArgument pathArgument){
+ public static YangInstanceIdentifier.PathArgument deSerialize(final NormalizedNodeMessages.Node node,
+ final NormalizedNodeMessages.PathArgument pathArgument){
Preconditions.checkNotNull(node, "node should not be null");
Preconditions.checkNotNull(pathArgument, "pathArgument should not be null");
return new DeSerializer(null, node).deSerialize(pathArgument);
private NormalizedNodeMessages.InstanceIdentifier serializedPath;
- private Serializer(NormalizedNode<?, ?> node) {
+ private Serializer(final NormalizedNode<?, ?> node) {
this.node = node;
}
return this.serialize(node).addAllCode(getCodes()).build();
}
- public NormalizedNodeMessages.Node serialize(YangInstanceIdentifier path) {
+ public NormalizedNodeMessages.Node serialize(final YangInstanceIdentifier path) {
Builder builder = serialize(node);
serializedPath = InstanceIdentifierUtils.toSerializable(path, this);
return builder.addAllCode(getCodes()).build();
}
private NormalizedNodeMessages.Node.Builder serialize(
- NormalizedNode<?, ?> node) {
+ final NormalizedNode<?, ?> node) {
NormalizedNodeMessages.Node.Builder builder =
NormalizedNodeMessages.Node.newBuilder();
m.put(CONTAINER_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder = Builders.containerBuilder()
.withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
});
m.put(LEAF_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>> builder = Builders.leafBuilder()
.withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
});
m.put(MAP_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
return deSerializer.buildCollectionNode(Builders.mapBuilder(), node);
}
});
m.put(MAP_ENTRY_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder =
Builders.mapEntryBuilder().withNodeIdentifier(deSerializer.toNodeIdentifierWithPredicates(
node.getPathArgument()));
});
m.put(AUGMENTATION_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
DataContainerNodeBuilder<AugmentationIdentifier, AugmentationNode> builder =
Builders.augmentationBuilder().withNodeIdentifier(
deSerializer.toAugmentationIdentifier(node.getPathArgument()));
});
m.put(LEAF_SET_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
return deSerializer.buildListNode(Builders.leafSetBuilder(), node);
}
});
m.put(LEAF_SET_ENTRY_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> builder =
Builders.leafSetEntryBuilder().withNodeIdentifier(deSerializer.toNodeWithValue(
node.getPathArgument()));
});
m.put(CHOICE_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> builder = Builders.choiceBuilder()
.withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
});
m.put(ORDERED_LEAF_SET_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
return deSerializer.buildListNode(Builders.orderedLeafSetBuilder(), node);
}
});
m.put(ORDERED_MAP_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
return deSerializer.buildCollectionNode(Builders.orderedMapBuilder(), node);
}
});
m.put(UNKEYED_LIST_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
return deSerializer.buildCollectionNode(Builders.unkeyedListBuilder(), node);
}
});
m.put(UNKEYED_LIST_ENTRY_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder =
Builders.unkeyedListEntryBuilder().withNodeIdentifier(deSerializer.toNodeIdentifier(
node.getPathArgument()));
});
m.put(ANY_XML_NODE_TYPE, new DeSerializationFunction() {
@Override
- public NormalizedNode<?, ?> apply(DeSerializer deSerializer, NormalizedNodeMessages.Node node) {
+ public NormalizedNode<?, ?> apply(final DeSerializer deSerializer, final NormalizedNodeMessages.Node node) {
NormalizedNodeAttrBuilder<NodeIdentifier, DOMSource, AnyXmlNode> builder = Builders.anyXmlBuilder()
.withNodeIdentifier(deSerializer.toNodeIdentifier(node.getPathArgument()));
private final NormalizedNodeMessages.InstanceIdentifier path;
private YangInstanceIdentifier deserializedPath;
- public DeSerializer(NormalizedNodeMessages.InstanceIdentifier path,
- NormalizedNodeMessages.Node node) {
+ public DeSerializer(final NormalizedNodeMessages.InstanceIdentifier path,
+ final NormalizedNodeMessages.Node node) {
super(node.getCodeList());
this.path = path;
this.node = node;
return deserializedNode;
}
- private NormalizedNode<?, ?> deSerialize(NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> deSerialize(final NormalizedNodeMessages.Node node){
Preconditions.checkNotNull(node, "node should not be null");
DeSerializationFunction deSerializationFunction = DESERIALIZATION_FUNCTIONS.get(
private NormalizedNode<?, ?> buildCollectionNode(
- CollectionNodeBuilder builder,
- NormalizedNodeMessages.Node node) {
+ final CollectionNodeBuilder builder,
+ final NormalizedNodeMessages.Node node) {
builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
private NormalizedNode<?, ?> buildListNode(
- ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
- NormalizedNodeMessages.Node node) {
+ final ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder,
+ final NormalizedNodeMessages.Node node) {
builder.withNodeIdentifier(toNodeIdentifier(node.getPathArgument()));
for(NormalizedNodeMessages.Node child : node.getChildList()){
return builder.build();
}
- private NormalizedNode<?, ?> buildDataContainer(DataContainerNodeBuilder<?, ?> builder, NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> buildDataContainer(final DataContainerNodeBuilder<?, ?> builder, final NormalizedNodeMessages.Node node){
for(NormalizedNodeMessages.Node child : node.getChildList()){
builder.withChild((DataContainerChild<?, ?>) deSerialize(child));
return builder.build();
}
- private NormalizedNode<?, ?> buildNormalizedNode(NormalizedNodeAttrBuilder builder, NormalizedNodeMessages.Node node){
+ private NormalizedNode<?, ?> buildNormalizedNode(final NormalizedNodeAttrBuilder builder, final NormalizedNodeMessages.Node node){
builder.withValue(ValueSerializer.deSerialize(this, node));
}
-
- private YangInstanceIdentifier.NodeIdentifierWithPredicates toNodeIdentifierWithPredicates(
- NormalizedNodeMessages.PathArgument path) {
- return (YangInstanceIdentifier.NodeIdentifierWithPredicates) PathArgumentSerializer.deSerialize(this, path);
+ private NodeIdentifierWithPredicates toNodeIdentifierWithPredicates(
+ final NormalizedNodeMessages.PathArgument path) {
+ return (NodeIdentifierWithPredicates) PathArgumentSerializer.deSerialize(this, path);
}
- private YangInstanceIdentifier.AugmentationIdentifier toAugmentationIdentifier(
- NormalizedNodeMessages.PathArgument path) {
- return (YangInstanceIdentifier.AugmentationIdentifier) PathArgumentSerializer.deSerialize(this, path);
+ private AugmentationIdentifier toAugmentationIdentifier(final NormalizedNodeMessages.PathArgument path) {
+ return (AugmentationIdentifier) PathArgumentSerializer.deSerialize(this, path);
}
- private YangInstanceIdentifier.NodeWithValue toNodeWithValue(
- NormalizedNodeMessages.PathArgument path) {
- return (YangInstanceIdentifier.NodeWithValue) PathArgumentSerializer.deSerialize(
- this, path);
+ @SuppressWarnings("unchecked")
+ private <T> NodeWithValue<T> toNodeWithValue(final NormalizedNodeMessages.PathArgument path) {
+ return (NodeWithValue<T>) PathArgumentSerializer.deSerialize(this, path);
}
- private NodeIdentifier toNodeIdentifier(NormalizedNodeMessages.PathArgument path){
+ private NodeIdentifier toNodeIdentifier(final NormalizedNodeMessages.PathArgument path){
return (NodeIdentifier) PathArgumentSerializer.deSerialize(this, path);
}
- public YangInstanceIdentifier.PathArgument deSerialize(
- NormalizedNodeMessages.PathArgument pathArgument) {
+ public YangInstanceIdentifier.PathArgument deSerialize(final NormalizedNodeMessages.PathArgument pathArgument) {
return PathArgumentSerializer.deSerialize(this, pathArgument);
}
public Iterable<? extends NormalizedNodeMessages.PathArgumentAttribute> get(
QNameSerializationContext context, YangInstanceIdentifier.PathArgument pathArgument) {
- YangInstanceIdentifier.NodeWithValue identifier
- = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+ YangInstanceIdentifier.NodeWithValue<?> identifier
+ = (YangInstanceIdentifier.NodeWithValue<?>) pathArgument;
NormalizedNodeMessages.PathArgumentAttribute attribute =
buildAttribute(context, null, identifier.getValue());
switch(PathArgumentType.values()[pathArgument.getIntType()]){
case NODE_IDENTIFIER_WITH_VALUE : {
- YangInstanceIdentifier.NodeWithValue nodeWithValue =
- new YangInstanceIdentifier.NodeWithValue(
+ YangInstanceIdentifier.NodeWithValue<?> nodeWithValue =
+ new YangInstanceIdentifier.NodeWithValue<>(
QNameFactory.create(qNameToString(context, pathArgument.getNodeType())),
parseAttribute(context, pathArgument.getAttribute(0)));
import java.util.Set;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
}
@Override
- public void leafNode(final YangInstanceIdentifier.NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
+ public void leafNode(final NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Writing a new leaf node");
startNode(name.getNodeType(), NodeTypes.LEAF_NODE);
}
@Override
- public void startLeafSet(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new leaf set");
}
@Override
- public void startOrderedLeafSet(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startOrderedLeafSet(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new ordered leaf set");
}
@Override
- public void startContainerNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new container node");
}
@Override
- public void startYangModeledAnyXmlNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startYangModeledAnyXmlNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new yang modeled anyXml node");
}
@Override
- public void startUnkeyedList(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new unkeyed list");
}
@Override
- public void startUnkeyedListItem(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalStateException {
+ public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalStateException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new unkeyed list item");
}
@Override
- public void startMapNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new map node");
}
@Override
- public void startMapEntryNode(final YangInstanceIdentifier.NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(identifier, "Node identifier should not be null");
LOG.debug("Starting a new map entry node");
startNode(identifier.getNodeType(), NodeTypes.MAP_ENTRY_NODE);
}
@Override
- public void startOrderedMapNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new ordered map node");
}
@Override
- public void startChoiceNode(final YangInstanceIdentifier.NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Starting a new choice node");
}
@Override
- public void startAugmentationNode(final YangInstanceIdentifier.AugmentationIdentifier identifier) throws IOException, IllegalArgumentException {
+ public void startAugmentationNode(final AugmentationIdentifier identifier) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(identifier, "Node identifier should not be null");
LOG.debug("Starting a new augmentation node");
}
@Override
- public void anyxmlNode(final YangInstanceIdentifier.NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
+ public void anyxmlNode(final NodeIdentifier name, final Object value) throws IOException, IllegalArgumentException {
Preconditions.checkNotNull(name, "Node identifier should not be null");
LOG.debug("Writing a new xml node");
}
private void writeYangInstanceIdentifierInternal(final YangInstanceIdentifier identifier) throws IOException {
- Collection<YangInstanceIdentifier.PathArgument> pathArguments = identifier.getPathArguments();
+ Collection<PathArgument> pathArguments = identifier.getPathArguments();
output.writeInt(pathArguments.size());
- for(YangInstanceIdentifier.PathArgument pathArgument : pathArguments) {
+ for(PathArgument pathArgument : pathArguments) {
writePathArgument(pathArgument);
}
}
@Override
- public void writePathArgument(final YangInstanceIdentifier.PathArgument pathArgument) throws IOException {
+ public void writePathArgument(final PathArgument pathArgument) throws IOException {
byte type = PathArgumentTypes.getSerializablePathArgumentType(pathArgument);
switch(type) {
case PathArgumentTypes.NODE_IDENTIFIER:
- YangInstanceIdentifier.NodeIdentifier nodeIdentifier =
- (YangInstanceIdentifier.NodeIdentifier) pathArgument;
+ NodeIdentifier nodeIdentifier = (NodeIdentifier) pathArgument;
writeQName(nodeIdentifier.getNodeType());
break;
case PathArgumentTypes.NODE_IDENTIFIER_WITH_PREDICATES:
- YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
- (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+ NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+ (NodeIdentifierWithPredicates) pathArgument;
writeQName(nodeIdentifierWithPredicates.getNodeType());
writeKeyValueMap(nodeIdentifierWithPredicates.getKeyValues());
case PathArgumentTypes.NODE_IDENTIFIER_WITH_VALUE :
- YangInstanceIdentifier.NodeWithValue nodeWithValue =
- (YangInstanceIdentifier.NodeWithValue) pathArgument;
+ NodeWithValue<?> nodeWithValue = (NodeWithValue<?>) pathArgument;
writeQName(nodeWithValue.getNodeType());
writeObject(nodeWithValue.getValue());
case PathArgumentTypes.AUGMENTATION_IDENTIFIER :
- YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
- (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+ AugmentationIdentifier augmentationIdentifier = (AugmentationIdentifier) pathArgument;
// No Qname in augmentation identifier
writeQNameSet(augmentationIdentifier.getPossibleChildNames());
private NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier,
Object, LeafNode<Object>> leafBuilder;
- private NormalizedNodeAttrBuilder<NodeWithValue, Object,
- LeafSetEntryNode<Object>> leafSetEntryBuilder;
+ private NormalizedNodeAttrBuilder<NodeWithValue, Object, LeafSetEntryNode<Object>> leafSetEntryBuilder;
private final StringBuilder reusableStringBuilder = new StringBuilder(50);
}
Object value = readObject();
- NodeWithValue<?> leafIdentifier = new NodeWithValue<>(name, value);
+ NodeWithValue<Object> leafIdentifier = new NodeWithValue<>(name, value);
LOG.debug("Reading leaf set entry node {}, value {}", leafIdentifier, value);
return new NodeIdentifierWithPredicates(readQName(), readKeyValueMap());
case PathArgumentTypes.NODE_IDENTIFIER_WITH_VALUE :
- return new NodeWithValue(readQName(), readObject());
+ return new NodeWithValue<>(readQName(), readObject());
default :
return null;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
NormalizedNodeMessages.InstanceIdentifier.newBuilder();
try {
- for (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.
- PathArgument pathArgument : path.getPathArguments()) {
+ for (PathArgument pathArgument : path.getPathArguments()) {
NormalizedNodeMessages.PathArgument serializablePathArgument;
if(context == null) {
String nodeType = "";
- if(!(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier)){
+ if (!(pathArgument instanceof AugmentationIdentifier)) {
nodeType = pathArgument.getNodeType().toString();
}
public static YangInstanceIdentifier fromSerializable(NormalizedNodeMessages.InstanceIdentifier path,
QNameDeSerializationContext context) {
- List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+ List<PathArgument> pathArguments = new ArrayList<>();
for(NormalizedNodeMessages.PathArgument pathArgument : path.getArgumentsList()) {
if(context == null || pathArgument.hasType()) {
* @return
*/
private static Iterable<? extends NormalizedNodeMessages.Attribute> getPathArgumentAttributes(
- YangInstanceIdentifier.PathArgument pathArgument) {
+ PathArgument pathArgument) {
List<NormalizedNodeMessages.Attribute> attributes = new ArrayList<>();
-
-
- if (pathArgument instanceof YangInstanceIdentifier.NodeWithValue) {
- YangInstanceIdentifier.NodeWithValue identifier
- = (YangInstanceIdentifier.NodeWithValue) pathArgument;
+ if (pathArgument instanceof NodeWithValue) {
+ NodeWithValue<?> identifier = (NodeWithValue<?>) pathArgument;
NormalizedNodeMessages.Attribute attribute =
NormalizedNodeMessages.Attribute.newBuilder()
.build();
attributes.add(attribute);
- } else if (pathArgument instanceof YangInstanceIdentifier.NodeIdentifierWithPredicates) {
- YangInstanceIdentifier.NodeIdentifierWithPredicates identifier
- = (YangInstanceIdentifier.NodeIdentifierWithPredicates) pathArgument;
+ } else if (pathArgument instanceof NodeIdentifierWithPredicates) {
+ NodeIdentifierWithPredicates identifier = (NodeIdentifierWithPredicates) pathArgument;
for (QName key : identifier.getKeyValues().keySet()) {
Object value = identifier.getKeyValues().get(key);
}
- } else if(pathArgument instanceof YangInstanceIdentifier.AugmentationIdentifier) {
- YangInstanceIdentifier.AugmentationIdentifier identifier
- = (YangInstanceIdentifier.AugmentationIdentifier) pathArgument;
+ } else if(pathArgument instanceof AugmentationIdentifier) {
+ AugmentationIdentifier identifier = (AugmentationIdentifier) pathArgument;
for (QName key : identifier.getPossibleChildNames()) {
Object value = key;
* @param pathArgument protocol buffer PathArgument
* @return MD-SAL PathArgument
*/
- private static YangInstanceIdentifier.PathArgument parsePathArgument(
+ private static PathArgument parsePathArgument(
NormalizedNodeMessages.PathArgument pathArgument) {
- if (YangInstanceIdentifier.NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
+ if (NodeWithValue.class.getSimpleName().equals(pathArgument.getType())) {
- YangInstanceIdentifier.NodeWithValue nodeWithValue =
- new YangInstanceIdentifier.NodeWithValue(
+ NodeWithValue<?> nodeWithValue = new NodeWithValue<>(
QNameFactory.create(pathArgument.getNodeType().getValue()),
parseAttribute(pathArgument.getAttributes(0)));
return nodeWithValue;
- } else if(YangInstanceIdentifier.NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
+ } else if(NodeIdentifierWithPredicates.class.getSimpleName().equals(pathArgument.getType())){
- YangInstanceIdentifier.NodeIdentifierWithPredicates
- nodeIdentifierWithPredicates =
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ NodeIdentifierWithPredicates nodeIdentifierWithPredicates =
+ new NodeIdentifierWithPredicates(
QNameFactory.create(pathArgument.getNodeType().getValue()), toAttributesMap(pathArgument.getAttributesList()));
return nodeIdentifierWithPredicates;
- } else if(YangInstanceIdentifier.AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
+ } else if(AugmentationIdentifier.class.getSimpleName().equals(pathArgument.getType())){
Set<QName> qNameSet = new HashSet<>();
qNameSet.add(QNameFactory.create(attribute.getValue()));
}
- return new YangInstanceIdentifier.AugmentationIdentifier(qNameSet);
+ return new AugmentationIdentifier(qNameSet);
}
return NodeIdentifierFactory.getArgument(pathArgument.getValue());
LOG.trace("Sending yang schema source for {}", identifier);
final Promise<YangTextSchemaSourceSerializationProxy> promise = akka.dispatch.Futures.promise();
- CheckedFuture future = repository.getSchemaSource(identifier, YangTextSchemaSource.class);
+ CheckedFuture<YangTextSchemaSource, ?> future = repository.getSchemaSource(identifier, YangTextSchemaSource.class);
Futures.addCallback(future, new FutureCallback<YangTextSchemaSource>() {
@Override
*/
public class XmlUtils {
- public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
- @Override
- public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
- return TypeDefinitionAwareCodec.from(baseType);
- }
- };
+ public static final XmlCodecProvider DEFAULT_XML_CODEC_PROVIDER = new XmlCodecProvider() {
+ @Override
+ public TypeDefinitionAwareCodec<Object, ? extends TypeDefinition<?>> codecFor(final TypeDefinition<?> baseType) {
+ return TypeDefinitionAwareCodec.from(baseType);
+ }
+ };
- private XmlUtils() {
- }
+ private XmlUtils() {
+ }
- public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
- TypeDefinition<?> superType = type;
- while (superType.getBaseType() != null) {
- superType = superType.getBaseType();
+ public static TypeDefinition<?> resolveBaseTypeFrom(final @Nonnull TypeDefinition<?> type) {
+ TypeDefinition<?> superType = type;
+ while (superType.getBaseType() != null) {
+ superType = superType.getBaseType();
+ }
+ return superType;
}
- return superType;
- }
- /**
- * This code is picked from yangtools and modified to add type of instance identifier
- * output of instance identifier something like below for a flow ref composite node of type instance identifier,
- * which has path arguments with predicates, whose value is of type java.lang.short
- * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
- * /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
- * /bgkj:table[bgkj:id='3@java.lang.Short']
- * /bgkj:flow[bgkj:id='156@java.lang.String']
- * </flow-ref>
- *
- */
+ /**
+ * This code is picked from yangtools and modified to add type of instance identifier
+ * output of instance identifier something like below for a flow ref composite node of type instance identifier,
+ * which has path arguments with predicates, whose value is of type java.lang.short
+ * <flow-ref xmlns:bgkj="urn:opendaylight:flow:inventory" xmlns:jdlk="urn:opendaylight:inventory">
+ * /jdlk:nodes/jdlk:node[jdlk:id='openflow:205558455098190@java.lang.String']
+ * /bgkj:table[bgkj:id='3@java.lang.Short']
+ * /bgkj:flow[bgkj:id='156@java.lang.String']
+ * </flow-ref>
+ *
+ */
- public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
- final StringBuilder textContent = new StringBuilder();
- for (final PathArgument pathArgument : id.getPathArguments()) {
- textContent.append('/');
- textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
- if (pathArgument instanceof NodeIdentifierWithPredicates) {
- final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
+ public static String encodeIdentifier(final RandomPrefix prefixes, final YangInstanceIdentifier id) {
+ final StringBuilder textContent = new StringBuilder();
+ for (final PathArgument pathArgument : id.getPathArguments()) {
+ textContent.append('/');
+ textContent.append(prefixes.encodeQName(pathArgument.getNodeType()));
+ if (pathArgument instanceof NodeIdentifierWithPredicates) {
+ final Map<QName, Object> predicates = ((NodeIdentifierWithPredicates) pathArgument).getKeyValues();
- for (final QName keyValue : predicates.keySet()) {
- final Object value = predicates.get(keyValue);
- final String type = value.getClass().getName();
- final String predicateValue = String.valueOf(value);
- textContent.append('[');
- textContent.append(prefixes.encodeQName(keyValue));
- textContent.append("='");
- textContent.append(predicateValue);
- textContent.append("@");
- textContent.append(type);
- textContent.append("']");
+ for (final QName keyValue : predicates.keySet()) {
+ final Object value = predicates.get(keyValue);
+ final String type = value.getClass().getName();
+ final String predicateValue = String.valueOf(value);
+ textContent.append('[');
+ textContent.append(prefixes.encodeQName(keyValue));
+ textContent.append("='");
+ textContent.append(predicateValue);
+ textContent.append("@");
+ textContent.append(type);
+ textContent.append("']");
+ }
+ } else if (pathArgument instanceof NodeWithValue) {
+ textContent.append("[.='");
+ textContent.append(((NodeWithValue<?>) pathArgument).getValue());
+ textContent.append("']");
+ }
}
- } else if (pathArgument instanceof NodeWithValue) {
- textContent.append("[.='");
- textContent.append(((NodeWithValue) pathArgument).getValue());
- textContent.append("']");
- }
- }
- return textContent.toString();
- }
+ return textContent.toString();
+ }
}
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
@Test
public void toStringNodeIdentifier(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifier();
+ PathArgument pathArgument = nodeIdentifier();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test";
public void toStringAugmentationIdentifier(){
String expected = "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}";
- YangInstanceIdentifier.PathArgument pathArgument = augmentationIdentifier();
+ PathArgument pathArgument = augmentationIdentifier();
assertEquals(expected, PathUtils.toString(pathArgument));
}
@Test
public void toStringNodeWithValue(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeWithValue();
+ PathArgument pathArgument = nodeWithValue();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test[100]";
@Test
public void toStringNodeIdentifierWithPredicates(){
- YangInstanceIdentifier.PathArgument pathArgument = nodeIdentifierWithPredicates();
+ PathArgument pathArgument = nodeIdentifierWithPredicates();
String expected = "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=100}]";
}
- private static YangInstanceIdentifier.NodeIdentifier nodeIdentifier(){
- return new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME);
+ private static NodeIdentifier nodeIdentifier(){
+ return new NodeIdentifier(TestModel.TEST_QNAME);
}
- private static YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier(){
+ private static AugmentationIdentifier augmentationIdentifier(){
Set<QName> childNames = ImmutableSet.of(QNameFactory.create("(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics"));
- return new YangInstanceIdentifier.AugmentationIdentifier(childNames);
+ return new AugmentationIdentifier(childNames);
}
- private static YangInstanceIdentifier.NodeWithValue nodeWithValue(){
- return new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, Integer.valueOf(100));
+ private static NodeWithValue<?> nodeWithValue(){
+ return new NodeWithValue<>(TestModel.TEST_QNAME, Integer.valueOf(100));
}
- private static YangInstanceIdentifier.NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
+ private static NodeIdentifierWithPredicates nodeIdentifierWithPredicates(){
Map<QName, Object> keys = new HashMap<>();
keys.put(TestModel.ID_QNAME, Integer.valueOf(100));
- return new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.TEST_QNAME, keys);
+ return new NodeIdentifierWithPredicates(TestModel.TEST_QNAME, keys);
}
}
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import java.net.URI;
import java.util.Date;
import java.util.HashMap;
expectedException.expect(NullPointerException.class);
expectedException.expectMessage("context should not be null");
- PathArgumentSerializer.serialize(null, mock(
- YangInstanceIdentifier.PathArgument.class));
+ PathArgumentSerializer.serialize(null, mock(PathArgument.class));
}
@Test
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeIdentifier(
+ new NodeIdentifier(
TestModel.TEST_QNAME));
assertEquals(PathArgumentType.NODE_IDENTIFIER.ordinal(), actual.getIntType());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeWithValue(
+ new NodeWithValue<>(
TestModel.TEST_QNAME, "foo"));
assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_VALUE.ordinal(), actual.getIntType());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(
- TestModel.TEST_QNAME, predicates));
+ new NodeIdentifierWithPredicates(TestModel.TEST_QNAME, predicates));
assertEquals(PathArgumentType.NODE_IDENTIFIER_WITH_PREDICATES.ordinal(), actual.getIntType());
assertEquals(5, actual.getNodeType().getLocalName());
NormalizedNodeMessages.PathArgument actual = PathArgumentSerializer
.serialize(serializationContext,
- new YangInstanceIdentifier.AugmentationIdentifier(
- ImmutableSet.of(TestModel.TEST_QNAME)));
+ new AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)));
assertEquals(PathArgumentType.AUGMENTATION_IDENTIFIER.ordinal(), actual.getIntType());
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeIdentifier(TestModel.TEST_QNAME), pathArgument);
+ assertEquals(new NodeIdentifier(TestModel.TEST_QNAME), pathArgument);
}
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeWithValue(TestModel.TEST_QNAME, "foo"), pathArgument);
+ assertEquals(new NodeWithValue<>(TestModel.TEST_QNAME, "foo"), pathArgument);
}
@Test
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
- assertEquals(new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.TEST_QNAME,
+ assertEquals(new NodeIdentifierWithPredicates(TestModel.TEST_QNAME,
ImmutableMap.<QName, Object>of(TestModel.TEST_QNAME, "foo")), pathArgument);
}
nodeBuilder.addCode(TestModel.TEST_QNAME.getFormattedRevision());
nodeBuilder.addCode(TestModel.TEST_QNAME.getLocalName());
- YangInstanceIdentifier.PathArgument pathArgument =
- NormalizedNodeSerializer
- .deSerialize(nodeBuilder.build(), pathBuilder.build());
-
- assertEquals(new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)), pathArgument);
+ PathArgument pathArgument = NormalizedNodeSerializer.deSerialize(nodeBuilder.build(), pathBuilder.build());
+ assertEquals(new AugmentationIdentifier(ImmutableSet.of(TestModel.TEST_QNAME)), pathArgument);
}
-
-
-
}
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.LeafSetEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
private static NormalizedNode<?, ?> createTestContainer() {
byte[] bytes1 = {1,2,3};
LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
- withValue(bytes1).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).withValue(bytes1).build();
byte[] bytes2 = {};
LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
- withValue(bytes2).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).withValue(bytes2).build();
LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, null)).
- withValue(null).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();
return TestModel.createBaseTestContainerBuilder().
withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
+ new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
withChild(entry1).withChild(entry2).withChild(entry3).build()).
withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1,2,3,4})).
withChild(Builders.orderedMapBuilder().
- withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
+ withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
TestModel.ID_QNAME, 11)).build()).
build();
assertEquals(ValueTypes.STRING_BYTES_TYPE, ValueTypes.getSerializableType(largeString));
}
- private String largeString(int minSize){
+ private static String largeString(int minSize){
final int pow = (int) (Math.log(minSize * 2) / Math.log(2));
String s = "X";
for(int i=0;i<pow;i++){
import org.opendaylight.controller.cluster.datastore.util.TestModel;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.AnyXmlNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
@Override
public void visitNode(int level, String parentPath, NormalizedNode<?, ?> normalizedNode) {
- if(!(normalizedNode.getIdentifier() instanceof YangInstanceIdentifier.AugmentationIdentifier)) {
+ if(!(normalizedNode.getIdentifier() instanceof AugmentationIdentifier)) {
if (normalizedNode.getIdentifier().getNodeType().getNamespace().toString().contains(namespaceFilter)) {
count.incrementAndGet();
}
}
}
- }).navigate(YangInstanceIdentifier.builder().build().toString(), normalizedNode);
+ }).navigate(YangInstanceIdentifier.EMPTY.toString(), normalizedNode);
return count.get();
}
@Test
public void testLeafNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
+ new NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafNodeHasParent() throws IOException {
LeafNode<Object> child = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
+ new NodeIdentifier(TestModel.DESC_QNAME)).withValue("test").build();
NormalizedNode<?, ?> input = Builders.containerBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafNodeSchemaMissing() throws IOException {
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
- prunerNoAugSchema.leafNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(Object.class));
+ prunerNoAugSchema.leafNode(new NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(Object.class));
verify(normalizedNodeContainerBuilder, never()).addChild(any(NormalizedNode.class));
}
@Test
public void testLeafSetEntryNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.leafSetEntryBuilder().withValue("test").withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
+ new NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafSetEntryNodeHasParent() throws IOException {
LeafSetEntryNode<Object> child = Builders.leafSetEntryBuilder().withValue("test").withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
+ new NodeWithValue<>(TestModel.FAMILY_QNAME, "test")).build();
NormalizedNode<?, ?> input = Builders.leafSetBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.FAMILY_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.FAMILY_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testLeafSetEntryNodeSchemaMissing() throws IOException {
- doReturn(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
+ doReturn(new NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
prunerNoAugSchema.leafSetEntryNode(TestModel.AUG_CONT_QNAME, "");
@Test
public void testAnyXMLNodeHasNoParent() throws IOException {
NormalizedNode<?, ?> input = Builders.anyXmlBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
+ new NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
withValue(mock(DOMSource.class)).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
@Test
public void testAnyXMLNodeHasParent() throws IOException {
AnyXmlNode child = Builders.anyXmlBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
+ new NodeIdentifier(TestModel.CHILD_NAME_QNAME)).
withValue(mock(DOMSource.class)).build();
NormalizedNode<?, ?> input = Builders.containerBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
+ new NodeIdentifier(TestModel.AUG_CONT_QNAME)).withChild(child).build();
NormalizedNodeWriter.forStreamWriter(prunerFullSchema).write(input);
NormalizedNode<?, ?> actual = prunerFullSchema.normalizedNode();
@Test
public void testAnyXmlNodeSchemaMissing() throws IOException {
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
- prunerNoAugSchema.anyxmlNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(DOMSource.class));
+ prunerNoAugSchema.anyxmlNode(new NodeIdentifier(TestModel.AUG_CONT_QNAME), mock(DOMSource.class));
verify(normalizedNodeContainerBuilder, never()).addChild(any(NormalizedNode.class));
}
@Test
public void testLeafSetPushesBuilderToStack() throws IOException {
- prunerFullSchema.startLeafSet(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startLeafSet(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartContainerNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startContainerNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startContainerNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartUnkeyedListPushesBuilderToStack() throws IOException {
- prunerFullSchema.startUnkeyedList(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startUnkeyedList(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartUnkeyedListItemPushesBuilderToStack() throws IOException {
- prunerFullSchema.startUnkeyedListItem(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startUnkeyedListItem(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartMapNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startMapNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startMapNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartMapEntryNodePushesBuilderToStack() throws IOException {
prunerFullSchema.startMapEntryNode(
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(TestModel.BOOLEAN_LEAF_QNAME,
+ new NodeIdentifierWithPredicates(TestModel.BOOLEAN_LEAF_QNAME,
ImmutableMap.<QName, Object>of(TestModel.BOOLEAN_LEAF_QNAME, "value")), 10);
assertEquals(1, prunerFullSchema.stack().size());
@Test
public void testStartOrderedMapNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startOrderedMapNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startOrderedMapNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartChoiceNodePushesBuilderToStack() throws IOException {
- prunerFullSchema.startChoiceNode(new YangInstanceIdentifier.NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
+ prunerFullSchema.startChoiceNode(new NodeIdentifier(TestModel.BOOLEAN_LEAF_QNAME), 10);
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testStartAugmentationPushesBuilderToStack() throws IOException {
- prunerFullSchema.startAugmentationNode(new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(TestModel.AUG_CONT_QNAME)));
+ prunerFullSchema.startAugmentationNode(new AugmentationIdentifier(ImmutableSet.of(TestModel.AUG_CONT_QNAME)));
assertEquals(1, prunerFullSchema.stack().size());
assertNotNull(prunerFullSchema.stack().peek());
@Test
public void testEndNodeSchemaMissing() throws IOException {
- doReturn(new YangInstanceIdentifier.NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
+ doReturn(new NodeIdentifier(TestModel.AUG_CONT_QNAME)).when(normalizedNodeBuilderWrapper).identifier();
prunerNoAugSchema.stack().push(normalizedNodeBuilderWrapper);
prunerNoAugSchema.endNode();
private static NormalizedNode<?, ?> createTestContainer() {
byte[] bytes1 = {1,2,3};
LeafSetEntryNode<Object> entry1 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes1)).
withValue(bytes1).build();
byte[] bytes2 = {};
LeafSetEntryNode<Object> entry2 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, bytes2)).
withValue(bytes2).build();
LeafSetEntryNode<Object> entry3 = ImmutableLeafSetEntryNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(TestModel.BINARY_LEAF_LIST_QNAME, null)).
- withValue(null).build();
+ new NodeWithValue<>(TestModel.BINARY_LEAF_LIST_QNAME, null)).withValue(null).build();
return TestModel.createBaseTestContainerBuilder().
withChild(ImmutableLeafSetNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
+ new NodeIdentifier(TestModel.BINARY_LEAF_LIST_QNAME)).
withChild(entry1).withChild(entry2).withChild(entry3).build()).
withChild(ImmutableNodes.leafNode(TestModel.SOME_BINARY_DATA_QNAME, new byte[]{1, 2, 3, 4})).
withChild(Builders.orderedMapBuilder().
- withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
+ withNodeIdentifier(new NodeIdentifier(TestModel.ORDERED_LIST_QNAME)).
withChild(ImmutableNodes.mapEntry(TestModel.ORDERED_LIST_ENTRY_QNAME,
TestModel.ID_QNAME, 11)).build()).
build();
public class InstanceIdentifierUtilsTest {
- private static QName TEST_QNAME = QName
+ private static final QName TEST_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test");
- private static QName NODE_WITH_VALUE_QNAME = QName
+ private static final QName NODE_WITH_VALUE_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)value");
- private static QName NODE_WITH_PREDICATES_QNAME = QName
+ private static final QName NODE_WITH_PREDICATES_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
- private static QName NAME_QNAME = QName
+ private static final QName NAME_QNAME = QName
.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
@Test
YangInstanceIdentifier.PathArgument p1 = new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
YangInstanceIdentifier.PathArgument p2 =
- new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
+ new YangInstanceIdentifier.NodeWithValue<>(NODE_WITH_VALUE_QNAME, value);
List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
List<YangInstanceIdentifier.PathArgument> arguments =
Arrays.<YangInstanceIdentifier.PathArgument>asList(
new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME),
- new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, 1),
+ new YangInstanceIdentifier.NodeWithValue<>(NODE_WITH_VALUE_QNAME, 1),
new YangInstanceIdentifier.NodeIdentifierWithPredicates(
NODE_WITH_PREDICATES_QNAME, NAME_QNAME, 2));
import java.util.Set;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeWithValue;
import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
return ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+ new NodeIdentifier(schemaContext.getQName()))
.withChild(createTestContainer()).build();
}
- public static DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
+ public static DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> createBaseTestContainerBuilder() {
// Create a list of shoes
// This is to test leaf list entry
final LeafSetEntryNode<Object> nike =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "shoe"), "nike")).withValue("nike").build();
final LeafSetEntryNode<Object> puma =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "shoe"), "puma")).withValue("puma").build();
final LeafSetNode<Object> shoes =
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "shoe"))).withChild(nike).withChild(puma)
.build();
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(QName.create(
+ new NodeWithValue<>(QName.create(
TEST_QNAME, "capability"), DESC_QNAME))
.withValue(DESC_QNAME).build();
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "capability"))).withChild(cap1).build();
ContainerNode switchFeatures =
ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(SWITCH_FEATURES_QNAME))
+ new NodeIdentifier(SWITCH_FEATURES_QNAME))
.withChild(capabilities).build();
// Create a leaf list with numbers
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ (new NodeWithValue<>(QName.create(
TEST_QNAME, "number"), 5))).withValue(5).build();
final LeafSetEntryNode<Object> fifteen =
ImmutableLeafSetEntryNodeBuilder
.create()
.withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ (new NodeWithValue<>(QName.create(
TEST_QNAME, "number"), 15))).withValue(15).build();
final LeafSetNode<Object> numbers =
ImmutableLeafSetNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ new NodeIdentifier(QName.create(
TEST_QNAME, "number"))).withChild(five).withChild(fifteen)
.build();
MapEntryNode augMapEntry = createAugmentedListEntry(1, "First Test");
// Create a bits leaf
- NormalizedNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>>
- myBits = Builders.leafBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(
- QName.create(TEST_QNAME, "my-bits"))).withValue(
- ImmutableSet.of("foo", "bar"));
+ NormalizedNodeAttrBuilder<NodeIdentifier, Object, LeafNode<Object>>
+ myBits = Builders.leafBuilder()
+ .withNodeIdentifier(new NodeIdentifier(QName.create(TEST_QNAME, "my-bits")))
+ .withValue(ImmutableSet.of("foo", "bar"));
// Create unkeyed list entry
UnkeyedListEntryNode unkeyedListEntry =
// Create YangInstanceIdentifier with all path arg types.
YangInstanceIdentifier instanceID = YangInstanceIdentifier.create(
- new YangInstanceIdentifier.NodeIdentifier(QName.create(TEST_QNAME, "qname")),
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
+ new NodeIdentifier(QName.create(TEST_QNAME, "qname")),
+ new NodeIdentifierWithPredicates(QName.create(TEST_QNAME, "list-entry"),
QName.create(TEST_QNAME, "key"), 10),
- new YangInstanceIdentifier.AugmentationIdentifier(ImmutableSet.of(
+ new AugmentationIdentifier(ImmutableSet.of(
QName.create(TEST_QNAME, "aug1"), QName.create(TEST_QNAME, "aug2"))),
- new YangInstanceIdentifier.NodeWithValue(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
+ new NodeWithValue<>(QName.create(TEST_QNAME, "leaf-list-entry"), "foo"));
Map<QName, Object> keyValues = new HashMap<>();
keyValues.put(CHILDREN_QNAME, FIRST_CHILD_NAME);
Mockito.when(mockedRemoteSchemaRepository.getYangTextSchemaSource(ID)).thenReturn(
Futures.<YangTextSchemaSourceSerializationProxy>failed(new SchemaSourceException("Source not provided")));
- CheckedFuture sourceFuture = remoteSchemaProvider.getSource(ID);
+ CheckedFuture<?, ?> sourceFuture = remoteSchemaProvider.getSource(ID);
assertTrue(sourceFuture.isDone());
sourceFuture.checkedGet();
}