6. !!!WARNING!!! - never edit the generated sources files of protocol buffer
-7. !!!NOTE!!! if you are planning to add new .proto file option java_package should begin with
+7. !!!IMPORTANT!!! if you are planning to add new .proto file option java_package should begin with
org.opendaylight.controller.protobuff.messages to properly exclude from sonar.
+
+8. !!!IMPORTANT!!! for any new .proto file added you need to create corresponding version-compatibility-serialized-data
+ serialized test file under test/resources and a test case for one message in your .proto file.
+ Please follow the instruction in readme.txt in that folder
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node;
import com.google.common.base.Preconditions;
/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node;
import com.google.common.base.Preconditions;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.common.QName;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.common.QName;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.common.QName;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import com.google.common.base.Preconditions;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import com.google.common.base.Preconditions;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
public class PathUtils {
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import org.opendaylight.yangtools.yang.common.QName;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.util;
import com.google.common.base.Preconditions;
import java.util.Iterator;
import java.util.List;
-/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- */
/*
*
* <code>EncoderDecoderUtil</code> helps in wrapping the NormalizedNode into a SimpleNormalizedNode
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.util;
import org.opendaylight.controller.cluster.datastore.node.utils.NodeIdentifierFactory;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: CompositeModificationPayload.proto
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Cohort.proto
public final boolean isInitialized() {
if (!hasCanCommit()) {
-
+
return false;
}
return true;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Common.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
public final boolean isInitialized() {
if (!hasName()) {
-
+
return false;
}
return true;
getNameBytes() {
java.lang.Object ref = name_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
name_ = b;
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
public final boolean isInitialized() {
if (!hasValue()) {
-
+
return false;
}
return true;
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
getAttributesList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList() {
return attributes_;
}
attributesBuilder_ = null;
attributes_ = other.attributes_;
bitField0_ = (bitField0_ & ~0x00000008);
- attributesBuilder_ =
+ attributesBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getAttributesFieldBuilder() : null;
} else {
public final boolean isInitialized() {
if (!hasValue()) {
-
+
return false;
}
if (hasNodeType()) {
if (!getNodeType().isInitialized()) {
-
+
return false;
}
}
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
-
+
return false;
}
}
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
* <code>optional .org.opendaylight.controller.mdsal.QName nodeType = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QName.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.QNameOrBuilder>
getNodeTypeFieldBuilder() {
if (nodeTypeBuilder_ == null) {
nodeTypeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList() {
if (attributesBuilder_ != null) {
return attributesBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 4;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
getAttributesBuilderList() {
return getAttributesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesFieldBuilder() {
if (attributesBuilder_ == null) {
attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument>
getArgumentsList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
getArgumentsOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
getArgumentsOrBuilderList() {
return arguments_;
}
argumentsBuilder_ = null;
arguments_ = other.arguments_;
bitField0_ = (bitField0_ & ~0x00000001);
- argumentsBuilder_ =
+ argumentsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getArgumentsFieldBuilder() : null;
} else {
public final boolean isInitialized() {
for (int i = 0; i < getArgumentsCount(); i++) {
if (!getArguments(i).isInitialized()) {
-
+
return false;
}
}
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
getArgumentsOrBuilderList() {
if (argumentsBuilder_ != null) {
return argumentsBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.PathArgument arguments = 1;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder>
getArgumentsBuilderList() {
return getArgumentsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgument.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.PathArgumentOrBuilder>
getArgumentsFieldBuilder() {
if (argumentsBuilder_ == null) {
argumentsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute>
getAttributesList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node>
getChildList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getChildOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList() {
return attributes_;
}
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getChildOrBuilderList() {
return child_;
}
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getValueTypeBytes() {
java.lang.Object ref = valueType_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
valueType_ = b;
attributesBuilder_ = null;
attributes_ = other.attributes_;
bitField0_ = (bitField0_ & ~0x00000004);
- attributesBuilder_ =
+ attributesBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getAttributesFieldBuilder() : null;
} else {
childBuilder_ = null;
child_ = other.child_;
bitField0_ = (bitField0_ & ~0x00000008);
- childBuilder_ =
+ childBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getChildFieldBuilder() : null;
} else {
public final boolean isInitialized() {
for (int i = 0; i < getAttributesCount(); i++) {
if (!getAttributes(i).isInitialized()) {
-
+
return false;
}
}
for (int i = 0; i < getChildCount(); i++) {
if (!getChild(i).isInitialized()) {
-
+
return false;
}
}
if (hasInstanceIdentifierValue()) {
if (!getInstanceIdentifierValue().isInitialized()) {
-
+
return false;
}
}
getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
path_ = b;
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesOrBuilderList() {
if (attributesBuilder_ != null) {
return attributesBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Attribute attributes = 3;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder>
getAttributesBuilderList() {
return getAttributesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Attribute.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.AttributeOrBuilder>
getAttributesFieldBuilder() {
if (attributesBuilder_ == null) {
attributesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getChildOrBuilderList() {
if (childBuilder_ != null) {
return childBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Node child = 4;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder>
getChildBuilderList() {
return getChildFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getChildFieldBuilder() {
if (childBuilder_ == null) {
childBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
getValueBytes() {
java.lang.Object ref = value_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
value_ = b;
getValueTypeBytes() {
java.lang.Object ref = valueType_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
valueType_ = b;
* <code>optional .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierValue = 8;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierValueFieldBuilder() {
if (instanceIdentifierValueBuilder_ == null) {
instanceIdentifierValueBuilder_ = new com.google.protobuf.SingleFieldBuilder<
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getParentPathBytes() {
java.lang.Object ref = parentPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
parentPath_ = b;
public final boolean isInitialized() {
if (!hasParentPath()) {
-
+
return false;
}
if (hasNormalizedNode()) {
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
}
getParentPathBytes() {
java.lang.Object ref = parentPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
parentPath_ = b;
* <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
public final boolean isInitialized() {
if (!hasInstanceIdentifierPath()) {
-
+
return false;
}
if (!getInstanceIdentifierPath().isInitialized()) {
-
+
return false;
}
if (hasNormalizedNode()) {
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
}
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathFieldBuilder() {
if (instanceIdentifierPathBuilder_ == null) {
instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry>
getMapEntriesList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
getMapEntriesOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
getMapEntriesOrBuilderList() {
return mapEntries_;
}
mapEntriesBuilder_ = null;
mapEntries_ = other.mapEntries_;
bitField0_ = (bitField0_ & ~0x00000001);
- mapEntriesBuilder_ =
+ mapEntriesBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getMapEntriesFieldBuilder() : null;
} else {
public final boolean isInitialized() {
for (int i = 0; i < getMapEntriesCount(); i++) {
if (!getMapEntries(i).isInitialized()) {
-
+
return false;
}
}
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
getMapEntriesOrBuilderList() {
if (mapEntriesBuilder_ != null) {
return mapEntriesBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.NodeMapEntry mapEntries = 1;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder>
getMapEntriesBuilderList() {
return getMapEntriesFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntry.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapEntryOrBuilder>
getMapEntriesFieldBuilder() {
if (mapEntriesBuilder_ == null) {
mapEntriesBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: SimpleNormalizedNode.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getNodeIdentifierBytes() {
java.lang.Object ref = nodeIdentifier_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nodeIdentifier_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getXmlStringBytes() {
java.lang.Object ref = xmlString_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
xmlString_ = b;
public final boolean isInitialized() {
if (!hasNodeIdentifier()) {
-
+
return false;
}
if (!hasXmlString()) {
-
+
return false;
}
return true;
getNodeIdentifierBytes() {
java.lang.Object ref = nodeIdentifier_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nodeIdentifier_ = b;
getXmlStringBytes() {
java.lang.Object ref = xmlString_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
xmlString_ = b;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: DataChangeListener.proto
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>
+ java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier>
getRemovedPathsList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getRemovedPathsOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getRemovedPathsOrBuilderList() {
return removedPaths_;
}
removedPathsBuilder_ = null;
removedPaths_ = other.removedPaths_;
bitField0_ = (bitField0_ & ~0x00000020);
- removedPathsBuilder_ =
+ removedPathsBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getRemovedPathsFieldBuilder() : null;
} else {
public final boolean isInitialized() {
if (hasOriginalSubTree()) {
if (!getOriginalSubTree().isInitialized()) {
-
+
return false;
}
}
if (hasUpdatedSubTree()) {
if (!getUpdatedSubTree().isInitialized()) {
-
+
return false;
}
}
if (hasOriginalData()) {
if (!getOriginalData().isInitialized()) {
-
+
return false;
}
}
if (hasUpdatedData()) {
if (!getUpdatedData().isInitialized()) {
-
+
return false;
}
}
if (hasCreatedData()) {
if (!getCreatedData().isInitialized()) {
-
+
return false;
}
}
for (int i = 0; i < getRemovedPathsCount(); i++) {
if (!getRemovedPaths(i).isInitialized()) {
-
+
return false;
}
}
* <code>optional .org.opendaylight.controller.mdsal.Node originalSubTree = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getOriginalSubTreeFieldBuilder() {
if (originalSubTreeBuilder_ == null) {
originalSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.Node updatedSubTree = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getUpdatedSubTreeFieldBuilder() {
if (updatedSubTreeBuilder_ == null) {
updatedSubTreeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.NodeMap originalData = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
getOriginalDataFieldBuilder() {
if (originalDataBuilder_ == null) {
originalDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.NodeMap updatedData = 4;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
getUpdatedDataFieldBuilder() {
if (updatedDataBuilder_ == null) {
updatedDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.NodeMap createdData = 5;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMap.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeMapOrBuilder>
getCreatedDataFieldBuilder() {
if (createdDataBuilder_ == null) {
createdDataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getRemovedPathsOrBuilderList() {
if (removedPathsBuilder_ != null) {
return removedPathsBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.InstanceIdentifier removedPaths = 6;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder>
getRemovedPathsBuilderList() {
return getRemovedPathsFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getRemovedPathsFieldBuilder() {
if (removedPathsBuilder_ == null) {
removedPathsBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Persistent.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
public final boolean isInitialized() {
if (!hasType()) {
-
+
return false;
}
if (!hasPath()) {
-
+
return false;
}
if (!getPath().isInitialized()) {
-
+
return false;
}
if (hasData()) {
if (!getData().isInitialized()) {
-
+
return false;
}
}
getTypeBytes() {
java.lang.Object ref = type_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
type_ = b;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier path = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getPathFieldBuilder() {
if (pathBuilder_ == null) {
pathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>optional .org.opendaylight.controller.mdsal.Node data = 3;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getDataFieldBuilder() {
if (dataBuilder_ == null) {
dataBuilder_ = new com.google.protobuf.SingleFieldBuilder<
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
*/
- java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>
+ java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification>
getModificationList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
*/
- java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
getModificationOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
getModificationOrBuilderList() {
return modification_;
}
modificationBuilder_ = null;
modification_ = other.modification_;
bitField0_ = (bitField0_ & ~0x00000001);
- modificationBuilder_ =
+ modificationBuilder_ =
com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
getModificationFieldBuilder() : null;
} else {
public final boolean isInitialized() {
for (int i = 0; i < getModificationCount(); i++) {
if (!getModification(i).isInitialized()) {
-
+
return false;
}
}
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
*/
- public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ public java.util.List<? extends org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
getModificationOrBuilderList() {
if (modificationBuilder_ != null) {
return modificationBuilder_.getMessageOrBuilderList();
/**
* <code>repeated .org.opendaylight.controller.mdsal.Modification modification = 1;</code>
*/
- public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder>
+ public java.util.List<org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder>
getModificationBuilderList() {
return getModificationFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilder<
- org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
+ org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.Modification.Builder, org.opendaylight.controller.protobuff.messages.persistent.PersistentMessages.ModificationOrBuilder>
getModificationFieldBuilder() {
if (modificationBuilder_ == null) {
modificationBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ListenerRegistration.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getDataChangeListenerActorPathBytes() {
java.lang.Object ref = dataChangeListenerActorPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
dataChangeListenerActorPath_ = b;
public final boolean isInitialized() {
if (!hasInstanceIdentifierPath()) {
-
+
return false;
}
if (!hasDataChangeListenerActorPath()) {
-
+
return false;
}
if (!hasDataChangeScope()) {
-
+
return false;
}
if (!getInstanceIdentifierPath().isInitialized()) {
-
+
return false;
}
return true;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPath = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathFieldBuilder() {
if (instanceIdentifierPathBuilder_ == null) {
instanceIdentifierPathBuilder_ = new com.google.protobuf.SingleFieldBuilder<
getDataChangeListenerActorPathBytes() {
java.lang.Object ref = dataChangeListenerActorPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
dataChangeListenerActorPath_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getListenerRegistrationPathBytes() {
java.lang.Object ref = listenerRegistrationPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
listenerRegistrationPath_ = b;
public final boolean isInitialized() {
if (!hasListenerRegistrationPath()) {
-
+
return false;
}
return true;
getListenerRegistrationPathBytes() {
java.lang.Object ref = listenerRegistrationPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
listenerRegistrationPath_ = b;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ShardManager.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
public final boolean isInitialized() {
if (!hasShardName()) {
-
+
return false;
}
return true;
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getPrimaryPathBytes() {
java.lang.Object ref = primaryPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
primaryPath_ = b;
public final boolean isInitialized() {
if (!hasPrimaryPath()) {
-
+
return false;
}
return true;
getPrimaryPathBytes() {
java.lang.Object ref = primaryPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
primaryPath_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
public final boolean isInitialized() {
if (!hasShardName()) {
-
+
return false;
}
return true;
getShardNameBytes() {
java.lang.Object ref = shardName_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
shardName_ = b;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ShardTransactionChain.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTransactionChainPathBytes() {
java.lang.Object ref = transactionChainPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionChainPath_ = b;
public final boolean isInitialized() {
if (!hasTransactionChainPath()) {
-
+
return false;
}
return true;
getTransactionChainPathBytes() {
java.lang.Object ref = transactionChainPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionChainPath_ = b;
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ */
+
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: ShardTransaction.proto
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionId_ = b;
public final boolean isInitialized() {
if (!hasTransactionId()) {
-
+
return false;
}
return true;
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionId_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTransactionActorPathBytes() {
java.lang.Object ref = transactionActorPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionActorPath_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionId_ = b;
public final boolean isInitialized() {
if (!hasTransactionActorPath()) {
-
+
return false;
}
if (!hasTransactionId()) {
-
+
return false;
}
return true;
getTransactionActorPathBytes() {
java.lang.Object ref = transactionActorPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionActorPath_ = b;
getTransactionIdBytes() {
java.lang.Object ref = transactionId_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
transactionId_ = b;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
- com.google.protobuf.ByteString bs =
+ com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
if (bs.isValidUtf8()) {
getActorPathBytes() {
java.lang.Object ref = actorPath_;
if (ref instanceof java.lang.String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
actorPath_ = b;
public final boolean isInitialized() {
if (!hasActorPath()) {
-
+
return false;
}
return true;
getActorPathBytes() {
java.lang.Object ref = actorPath_;
if (ref instanceof String) {
- com.google.protobuf.ByteString b =
+ com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
actorPath_ = b;
public final boolean isInitialized() {
if (!hasInstanceIdentifierPathArguments()) {
-
+
return false;
}
if (!getInstanceIdentifierPathArguments().isInitialized()) {
-
+
return false;
}
return true;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathArgumentsFieldBuilder() {
if (instanceIdentifierPathArgumentsBuilder_ == null) {
instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
public final boolean isInitialized() {
if (!hasInstanceIdentifierPathArguments()) {
-
+
return false;
}
if (!getInstanceIdentifierPathArguments().isInitialized()) {
-
+
return false;
}
return true;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathArgumentsFieldBuilder() {
if (instanceIdentifierPathArgumentsBuilder_ == null) {
instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
public final boolean isInitialized() {
if (hasNormalizedNode()) {
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
}
* <code>optional .org.opendaylight.controller.mdsal.Node normalizedNode = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
public final boolean isInitialized() {
if (!hasInstanceIdentifierPathArguments()) {
-
+
return false;
}
if (!hasNormalizedNode()) {
-
+
return false;
}
if (!getInstanceIdentifierPathArguments().isInitialized()) {
-
+
return false;
}
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
return true;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathArgumentsFieldBuilder() {
if (instanceIdentifierPathArgumentsBuilder_ == null) {
instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
public final boolean isInitialized() {
if (!hasInstanceIdentifierPathArguments()) {
-
+
return false;
}
if (!hasNormalizedNode()) {
-
+
return false;
}
if (!getInstanceIdentifierPathArguments().isInitialized()) {
-
+
return false;
}
if (!getNormalizedNode().isInitialized()) {
-
+
return false;
}
return true;
* <code>required .org.opendaylight.controller.mdsal.InstanceIdentifier instanceIdentifierPathArguments = 1;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifier.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.InstanceIdentifierOrBuilder>
getInstanceIdentifierPathArgumentsFieldBuilder() {
if (instanceIdentifierPathArgumentsBuilder_ == null) {
instanceIdentifierPathArgumentsBuilder_ = new com.google.protobuf.SingleFieldBuilder<
* <code>required .org.opendaylight.controller.mdsal.Node normalizedNode = 2;</code>
*/
private com.google.protobuf.SingleFieldBuilder<
- org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
+ org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node.Builder, org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.NodeOrBuilder>
getNormalizedNodeFieldBuilder() {
if (normalizedNodeBuilder_ == null) {
normalizedNodeBuilder_ = new com.google.protobuf.SingleFieldBuilder<
/*
- * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
*
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node;
import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeGetter;
import org.opendaylight.controller.cluster.datastore.node.utils.NormalizedNodeNavigator;
import org.opendaylight.controller.cluster.datastore.util.TestModel;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Container;
import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages.Node;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
- private SchemaContext schemaContext;
+ private SchemaContext schemaContext;
- @Before
- public void setUp(){
- schemaContext = TestModel.createTestContext();
- assertNotNull("Schema context must not be null.", schemaContext);
- }
+ @Before
+ public void setUp() {
+ schemaContext = TestModel.createTestContext();
+ assertNotNull("Schema context must not be null.", schemaContext);
+ }
- private YangInstanceIdentifier instanceIdentifierFromString(String s){
+ private YangInstanceIdentifier instanceIdentifierFromString(String s) {
- String[] ids = s.split("/");
+ String[] ids = s.split("/");
- List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
- for(String nodeId : ids){
- if(!"".equals(nodeId)) {
- pathArguments.add(NodeIdentifierFactory.getArgument(nodeId));
- }
- }
- final YangInstanceIdentifier instanceIdentifier = YangInstanceIdentifier.create(pathArguments);
- return instanceIdentifier;
+ List<YangInstanceIdentifier.PathArgument> pathArguments = new ArrayList<>();
+ for (String nodeId : ids) {
+ if (!"".equals(nodeId)) {
+ pathArguments.add(NodeIdentifierFactory.getArgument(nodeId));
+ }
}
+ final YangInstanceIdentifier instanceIdentifier =
+ YangInstanceIdentifier.create(pathArguments);
+ return instanceIdentifier;
+ }
- @Test
- public void testNormalizeNodeAttributesToProtoBuffNode(){
- final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
- String id = "/(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)outer-list" +
- "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]" +
- "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id";
+ @Test
+ public void testNormalizeNodeAttributesToProtoBuffNode() {
+ final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+ String id =
+ "/(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)outer-list"
+ + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)outer-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=2}]"
+ + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id";
- NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id);
- new NormalizedNodeNavigator(normalizedNodeGetter).navigate(
- YangInstanceIdentifier.builder().build().toString(), documentOne);
+ NormalizedNodeGetter normalizedNodeGetter = new NormalizedNodeGetter(id);
+ new NormalizedNodeNavigator(normalizedNodeGetter).navigate(
+ YangInstanceIdentifier.builder().build().toString(), documentOne);
- // Validate the value of id can be retrieved from the normalized node
- NormalizedNode output = normalizedNodeGetter.getOutput();
- assertNotNull(output);
+ // Validate the value of id can be retrieved from the normalized node
+ NormalizedNode output = normalizedNodeGetter.getOutput();
+ assertNotNull(output);
- NormalizedNodeToNodeCodec codec = new NormalizedNodeToNodeCodec(schemaContext);
- Container container = codec.encode(instanceIdentifierFromString(id),output);
+ NormalizedNodeToNodeCodec codec =
+ new NormalizedNodeToNodeCodec(schemaContext);
+ Container container =
+ codec.encode(instanceIdentifierFromString(id), output);
- assertNotNull(container);
- assertEquals(id, container.getParentPath()+"/"+container.getNormalizedNode().getPath()) ;
+ assertNotNull(container);
+ assertEquals(id, container.getParentPath() + "/"
+ + container.getNormalizedNode().getPath());
- // Decode the normalized node from the ProtocolBuffer form
- //first get the node representation of normalized node
- final Node node = container.getNormalizedNode();
+ // Decode the normalized node from the ProtocolBuffer form
+ // first get the node representation of normalized node
+ final Node node = container.getNormalizedNode();
- NormalizedNode<?,?> normalizedNode = codec.decode(instanceIdentifierFromString(id),node);
+ NormalizedNode<?, ?> normalizedNode =
+ codec.decode(instanceIdentifierFromString(id), node);
- assertEquals(normalizedNode.getValue().toString(),output.getValue().toString());
- }
+ assertEquals(normalizedNode.getValue().toString(), output.getValue()
+ .toString());
+ }
- @Test
- public void testThatANormalizedNodeToProtoBuffNodeEncodeDecode() throws Exception {
- final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
+ @Test
+ public void testThatANormalizedNodeToProtoBuffNodeEncodeDecode()
+ throws Exception {
+ final NormalizedNode<?, ?> documentOne = TestModel.createTestContainer();
- final NormalizedNodeToNodeCodec normalizedNodeToNodeCodec = new NormalizedNodeToNodeCodec(schemaContext);
+ final NormalizedNodeToNodeCodec normalizedNodeToNodeCodec =
+ new NormalizedNodeToNodeCodec(schemaContext);
- Container container = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), documentOne);
+ Container container =
+ normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder()
+ .build(), documentOne);
- final NormalizedNode<?, ?> decode = normalizedNodeToNodeCodec.decode(instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"),container.getNormalizedNode());
- assertNotNull(decode != null);
+ final NormalizedNode<?, ?> decode =
+ normalizedNodeToNodeCodec
+ .decode(
+ instanceIdentifierFromString("/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)test"),
+ container.getNormalizedNode());
+ assertNotNull(decode != null);
- //let us ensure that the return decode normalized node encode returns same container
- Container containerResult = normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder().build(), decode);
+ // let us ensure that the return decode normalized node encode returns same container
+ Container containerResult =
+ normalizedNodeToNodeCodec.encode(YangInstanceIdentifier.builder()
+ .build(), decode);
- assertEquals(container.getParentPath(),containerResult.getParentPath());
- assertEquals(container.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+ assertEquals(container.getParentPath(), containerResult.getParentPath());
+ assertEquals(container.getNormalizedNode().getChildCount(), container
+ .getNormalizedNode().getChildCount());
- Assert.assertEquals(containerResult.getNormalizedNode().getChildCount(),container.getNormalizedNode().getChildCount());
+ Assert.assertEquals(containerResult.getNormalizedNode().getChildCount(),
+ container.getNormalizedNode().getChildCount());
- //check first level children are proper
- List<Node>childrenResult = containerResult.getNormalizedNode().getChildList();
- List<Node>childrenOriginal = container.getNormalizedNode().getChildList();
+ // check first level children are proper
+ List<Node> childrenResult =
+ containerResult.getNormalizedNode().getChildList();
+ List<Node> childrenOriginal = container.getNormalizedNode().getChildList();
- System.out.println("-------------------------------------------------");
+ System.out.println("-------------------------------------------------");
- System.out.println(childrenOriginal.toString());
+ System.out.println(childrenOriginal.toString());
- System.out.println("-------------------------------------------------");
+ System.out.println("-------------------------------------------------");
- System.out.println(childrenResult.toString());
+ System.out.println(childrenResult.toString());
- boolean bFound;
- for(Node resultChild: childrenResult){
- bFound = false;
- for(Node originalChild:childrenOriginal){
- if(originalChild.getPath().equals(resultChild.getPath())
- && resultChild.getType().equals(resultChild.getType())){
- bFound=true;
- break;
- }
- }
- Assert.assertTrue(bFound);
+ boolean bFound;
+ for (Node resultChild : childrenResult) {
+ bFound = false;
+ for (Node originalChild : childrenOriginal) {
+ if (originalChild.getPath().equals(resultChild.getPath())
+ && resultChild.getType().equals(resultChild.getType())) {
+ bFound = true;
+ break;
}
-
+ }
+ Assert.assertTrue(bFound);
}
- @Test
- public void addAugmentations(){
- String stringId = "/(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)augmented-list" +
- "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=1}]";
+ }
- YangInstanceIdentifier identifier = instanceIdentifierFromString(stringId);
+ @Test
+ public void addAugmentations() {
+ String stringId =
+ "/(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)augmented-list"
+ + "/(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)augmented-list[{(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)id=1}]";
- MapEntryNode uno = TestModel.createAugmentedListEntry(1, "Uno");
+ YangInstanceIdentifier identifier = instanceIdentifierFromString(stringId);
- NormalizedNodeToNodeCodec codec =
- new NormalizedNodeToNodeCodec(schemaContext);
+ MapEntryNode uno = TestModel.createAugmentedListEntry(1, "Uno");
- Container encode = codec
- .encode(identifier, uno);
+ NormalizedNodeToNodeCodec codec =
+ new NormalizedNodeToNodeCodec(schemaContext);
- System.out.println(encode.getNormalizedNode());
+ Container encode = codec.encode(identifier, uno);
- codec.decode(identifier, encode.getNormalizedNode());
- }
+ System.out.println(encode.getNormalizedNode());
+
+ codec.decode(identifier, encode.getNormalizedNode());
+ }
}
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.node.utils;
import junit.framework.Assert;
public class NodeIdentifierFactoryTest {
- @Test
- public void validateAugmentationIdentifier(){
- YangInstanceIdentifier.PathArgument argument = NodeIdentifierFactory
- .getArgument(
- "AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}");
+ @Test
+ public void validateAugmentationIdentifier() {
+ YangInstanceIdentifier.PathArgument argument =
+ NodeIdentifierFactory
+ .getArgument("AugmentationIdentifier{childNames=[(urn:opendaylight:flow:table:statistics?revision=2013-12-15)flow-table-statistics]}");
- Assert.assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
+ Assert
+ .assertTrue(argument instanceof YangInstanceIdentifier.AugmentationIdentifier);
- }
+ }
}
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.util;
import org.junit.Assert;
public class InstanceIdentifierUtilsTest {
- private static 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.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.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
- private static QName NAME_QNAME = QName.create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
+ private static 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
+ .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
+ .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)pred");
+ private static QName NAME_QNAME =
+ QName
+ .create("(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test?revision=2014-03-13)name");
- @Test
- public void testSerializationOfNodeIdentifier(){
- YangInstanceIdentifier.PathArgument p1 =
- new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+ @Test
+ public void testSerializationOfNodeIdentifier() {
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
- List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
- arguments.add(p1);
+ arguments.add(p1);
- YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
- NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
- InstanceIdentifierUtils.toSerializable(expected);
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
- YangInstanceIdentifier actual =
- InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
- Assert.assertEquals(expected.getLastPathArgument(),
- actual.getLastPathArgument());
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
- }
+ }
- @Test
- public void testSerializationOfNodeWithValue(){
+ @Test
+ public void testSerializationOfNodeWithValue() {
- withValue((short) 1);
- withValue((long) 2);
- withValue(3);
- withValue(true);
+ withValue((short) 1);
+ withValue((long) 2);
+ withValue(3);
+ withValue(true);
- }
+ }
- private void withValue(Object value){
- YangInstanceIdentifier.PathArgument p1 =
- new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+ private void withValue(Object value) {
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
- YangInstanceIdentifier.PathArgument p2 =
- new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
+ YangInstanceIdentifier.PathArgument p2 =
+ new YangInstanceIdentifier.NodeWithValue(NODE_WITH_VALUE_QNAME, value);
- List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
- arguments.add(p1);
- arguments.add(p2);
+ arguments.add(p1);
+ arguments.add(p2);
- YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
- NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
- InstanceIdentifierUtils.toSerializable(expected);
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
- YangInstanceIdentifier actual =
- InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
- Assert.assertEquals(expected.getLastPathArgument(),
- actual.getLastPathArgument());
- }
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+ }
- @Test
- public void testSerializationOfNodeIdentifierWithPredicates(){
+ @Test
+ public void testSerializationOfNodeIdentifierWithPredicates() {
- withPredicates((short) 1);
- withPredicates((long) 2);
- withPredicates(3);
- withPredicates(true);
+ withPredicates((short) 1);
+ withPredicates((long) 2);
+ withPredicates(3);
+ withPredicates(true);
- }
+ }
- private void withPredicates(Object value){
- YangInstanceIdentifier.PathArgument p1 =
- new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
+ private void withPredicates(Object value) {
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME);
- YangInstanceIdentifier.PathArgument p2 =
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value);
+ YangInstanceIdentifier.PathArgument p2 =
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ NODE_WITH_PREDICATES_QNAME, NAME_QNAME, value);
- List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
- arguments.add(p1);
- arguments.add(p2);
+ arguments.add(p1);
+ arguments.add(p2);
- YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
- NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
- InstanceIdentifierUtils.toSerializable(expected);
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
- YangInstanceIdentifier actual =
- InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
- Assert.assertEquals(expected.getLastPathArgument(),
- actual.getLastPathArgument());
- }
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
+ }
- @Test
- public void testAugmentationIdentifier(){
- YangInstanceIdentifier.PathArgument p1 =
- new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(Arrays.asList(TEST_QNAME)));
+ @Test
+ public void testAugmentationIdentifier() {
+ YangInstanceIdentifier.PathArgument p1 =
+ new YangInstanceIdentifier.AugmentationIdentifier(new HashSet(
+ Arrays.asList(TEST_QNAME)));
- List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
+ List<YangInstanceIdentifier.PathArgument> arguments = new ArrayList<>();
- arguments.add(p1);
+ arguments.add(p1);
- YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
+ YangInstanceIdentifier expected = YangInstanceIdentifier.create(arguments);
- NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
- InstanceIdentifierUtils.toSerializable(expected);
+ NormalizedNodeMessages.InstanceIdentifier instanceIdentifier =
+ InstanceIdentifierUtils.toSerializable(expected);
- YangInstanceIdentifier actual =
- InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
+ YangInstanceIdentifier actual =
+ InstanceIdentifierUtils.fromSerializable(instanceIdentifier);
- Assert.assertEquals(expected.getLastPathArgument(),
- actual.getLastPathArgument());
+ Assert.assertEquals(expected.getLastPathArgument(),
+ actual.getLastPathArgument());
- }
+ }
}
/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
*
- * This program and the accompanying materials are made available under the terms of the Eclipse
- * Public License v1.0 which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.util;
/**
- * Two of the testcases in the yangtools/yang-data-impl are leveraged (with modification) to
- * create the serialization of NormalizedNode using the ProtocolBuffer
+ * Two of the testcases in the yangtools/yang-data-impl are leveraged (with modification) to create
+ * the serialization of NormalizedNode using the ProtocolBuffer
*
* @syedbahm
*
public class NormalizedNodeXmlConverterTest {
- private static final Logger logger = LoggerFactory
- .getLogger(NormalizedNodeXmlConverterTest.class);
- public static final String NAMESPACE =
- "urn:opendaylight:params:xml:ns:yang:controller:test";
- private static Date revision;
- private ContainerNode expectedNode;
- private ContainerSchemaNode containerNode;
- private String xmlPath;
-
- static {
- try {
- revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
- } catch (ParseException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static DataSchemaNode getSchemaNode(final SchemaContext context,
- final String moduleName, final String childNodeName) {
- for (Module module : context.getModules()) {
- if (module.getName().equals(moduleName)) {
- DataSchemaNode found =
- findChildNode(module.getChildNodes(), childNodeName);
- Preconditions.checkState(found != null, "Unable to find %s",
- childNodeName);
- return found;
- }
- }
- throw new IllegalStateException("Unable to find child node "
- + childNodeName);
+ private static final Logger logger = LoggerFactory
+ .getLogger(NormalizedNodeXmlConverterTest.class);
+ public static final String NAMESPACE =
+ "urn:opendaylight:params:xml:ns:yang:controller:test";
+ private static Date revision;
+ private ContainerNode expectedNode;
+ private ContainerSchemaNode containerNode;
+ private String xmlPath;
+
+ static {
+ try {
+ revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-03-13");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
}
-
- static DataSchemaNode findChildNode(final Collection<DataSchemaNode> children, final String name) {
- List<DataNodeContainer> containers = Lists.newArrayList();
-
- for (DataSchemaNode dataSchemaNode : children) {
- if (dataSchemaNode.getQName().getLocalName().equals(name)) {
- return dataSchemaNode;
- }
- if (dataSchemaNode instanceof DataNodeContainer) {
- containers.add((DataNodeContainer) dataSchemaNode);
- } else if (dataSchemaNode instanceof ChoiceNode) {
- containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
- }
- }
-
- for (DataNodeContainer container : containers) {
- DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
- if (retVal != null) {
- return retVal;
- }
- }
-
- return null;
+ }
+
+ public static DataSchemaNode getSchemaNode(final SchemaContext context,
+ final String moduleName, final String childNodeName) {
+ for (Module module : context.getModules()) {
+ if (module.getName().equals(moduleName)) {
+ DataSchemaNode found =
+ findChildNode(module.getChildNodes(), childNodeName);
+ Preconditions.checkState(found != null, "Unable to find %s",
+ childNodeName);
+ return found;
+ }
}
-
- public static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(
- final String localName) {
- return new YangInstanceIdentifier.NodeIdentifier(QName.create(
- URI.create(NAMESPACE), revision, localName));
+ throw new IllegalStateException("Unable to find child node "
+ + childNodeName);
+ }
+
+ static DataSchemaNode findChildNode(
+ final Collection<DataSchemaNode> children, final String name) {
+ List<DataNodeContainer> containers = Lists.newArrayList();
+
+ for (DataSchemaNode dataSchemaNode : children) {
+ if (dataSchemaNode.getQName().getLocalName().equals(name)) {
+ return dataSchemaNode;
+ }
+ if (dataSchemaNode instanceof DataNodeContainer) {
+ containers.add((DataNodeContainer) dataSchemaNode);
+ } else if (dataSchemaNode instanceof ChoiceNode) {
+ containers.addAll(((ChoiceNode) dataSchemaNode).getCases());
+ }
}
- public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
- final String... childNames) {
- Set<QName> qn = Sets.newHashSet();
-
- for (String childName : childNames) {
- qn.add(getNodeIdentifier(childName).getNodeType());
- }
-
- return new YangInstanceIdentifier.AugmentationIdentifier(qn);
+ for (DataNodeContainer container : containers) {
+ DataSchemaNode retVal = findChildNode(container.getChildNodes(), name);
+ if (retVal != null) {
+ return retVal;
+ }
}
+ return null;
+ }
- public static ContainerNode augmentChoiceExpectedNode() {
-
- DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
- Builders.containerBuilder();
- b.withNodeIdentifier(getNodeIdentifier("container"));
-
- b.withChild(Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch2"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
- .build())
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
- .withValue("2").build()).build()).build());
-
- b.withChild(Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch3"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
- .build()).build());
-
- b.withChild(Builders
- .augmentationBuilder()
- .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("augLeaf"))
- .withValue("augment").build()).build());
-
- b.withChild(Builders
- .augmentationBuilder()
- .withNodeIdentifier(getAugmentIdentifier("ch"))
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(getNodeIdentifier("ch"))
- .withChild(
- Builders.leafBuilder()
- .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
- .withValue("1").build())
- .withChild(
- Builders
- .augmentationBuilder()
- .withNodeIdentifier(
- getAugmentIdentifier("c1Leaf_AnotherAugment",
- "deepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("c1Leaf_AnotherAugment"))
- .withValue("1").build())
- .withChild(
- Builders
- .choiceBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("deepChoice"))
- .withChild(
- Builders
- .leafBuilder()
- .withNodeIdentifier(
- getNodeIdentifier("deepLeafc1"))
- .withValue("1").build()).build())
- .build()).build()).build());
-
- return b.build();
- }
-
+ public static YangInstanceIdentifier.NodeIdentifier getNodeIdentifier(
+ final String localName) {
+ return new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ URI.create(NAMESPACE), revision, localName));
+ }
+ public static YangInstanceIdentifier.AugmentationIdentifier getAugmentIdentifier(
+ final String... childNames) {
+ Set<QName> qn = Sets.newHashSet();
- public void init(final String yangPath, final String xmlPath, final ContainerNode expectedNode)
- throws Exception {
- SchemaContext schema = parseTestSchema(yangPath);
- this.xmlPath = xmlPath;
- this.containerNode =
- (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
- this.expectedNode = expectedNode;
+ for (String childName : childNames) {
+ qn.add(getNodeIdentifier(childName).getNodeType());
}
- SchemaContext parseTestSchema(final String yangPath) throws Exception {
-
- YangParserImpl yangParserImpl = new YangParserImpl();
- InputStream stream =
- NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
- ArrayList<InputStream> al = new ArrayList<InputStream>();
- al.add(stream);
- Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
- return yangParserImpl.resolveSchemaContext(modules);
-
+ return new YangInstanceIdentifier.AugmentationIdentifier(qn);
+ }
+
+
+ public static ContainerNode augmentChoiceExpectedNode() {
+
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+ Builders.containerBuilder();
+ b.withNodeIdentifier(getNodeIdentifier("container"));
+
+ b.withChild(Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch2"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c2Leaf")).withValue("2")
+ .build())
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c2DeepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("c2DeepChoiceCase1Leaf2"))
+ .withValue("2").build()).build()).build());
+
+ b.withChild(Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch3"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c3Leaf")).withValue("3")
+ .build()).build());
+
+ b.withChild(Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(getAugmentIdentifier("augLeaf"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("augLeaf"))
+ .withValue("augment").build()).build());
+
+ b.withChild(Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(getAugmentIdentifier("ch"))
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(getNodeIdentifier("ch"))
+ .withChild(
+ Builders.leafBuilder()
+ .withNodeIdentifier(getNodeIdentifier("c1Leaf"))
+ .withValue("1").build())
+ .withChild(
+ Builders
+ .augmentationBuilder()
+ .withNodeIdentifier(
+ getAugmentIdentifier("c1Leaf_AnotherAugment",
+ "deepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("c1Leaf_AnotherAugment"))
+ .withValue("1").build())
+ .withChild(
+ Builders
+ .choiceBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("deepChoice"))
+ .withChild(
+ Builders
+ .leafBuilder()
+ .withNodeIdentifier(
+ getNodeIdentifier("deepLeafc1"))
+ .withValue("1").build()).build())
+ .build()).build()).build());
+
+ return b.build();
+ }
+
+
+
+ public void init(final String yangPath, final String xmlPath,
+ final ContainerNode expectedNode) throws Exception {
+ SchemaContext schema = parseTestSchema(yangPath);
+ this.xmlPath = xmlPath;
+ this.containerNode =
+ (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
+ this.expectedNode = expectedNode;
+ }
+
+ SchemaContext parseTestSchema(final String yangPath) throws Exception {
+
+ YangParserImpl yangParserImpl = new YangParserImpl();
+ InputStream stream =
+ NormalizedNodeXmlConverterTest.class.getResourceAsStream(yangPath);
+ ArrayList<InputStream> al = new ArrayList<InputStream>();
+ al.add(stream);
+ Set<Module> modules = yangParserImpl.parseYangModelsFromStreams(al);
+ return yangParserImpl.resolveSchemaContext(modules);
+
+ }
+
+
+ @Test
+ public void testConversionWithAugmentChoice() throws Exception {
+ init("/augment_choice.yang", "/augment_choice.xml",
+ augmentChoiceExpectedNode());
+ Document doc = loadDocument(xmlPath);
+
+ ContainerNode built =
+ DomToNormalizedNodeParserFactory
+ .getInstance(DomUtils.defaultValueCodecProvider())
+ .getContainerNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ containerNode);
+
+ if (expectedNode != null) {
+ junit.framework.Assert.assertEquals(expectedNode, built);
}
+ logger.info("{}", built);
- @Test
- public void testConversionWithAugmentChoice() throws Exception {
- init("/augment_choice.yang", "/augment_choice.xml",
- augmentChoiceExpectedNode());
- Document doc = loadDocument(xmlPath);
+ Iterable<Element> els =
+ DomFromNormalizedNodeSerializerFactory
+ .getInstance(XmlDocumentUtils.getDocument(),
+ DomUtils.defaultValueCodecProvider())
+ .getContainerNodeSerializer().serialize(containerNode, built);
- ContainerNode built =
- DomToNormalizedNodeParserFactory
- .getInstance(DomUtils.defaultValueCodecProvider())
- .getContainerNodeParser()
- .parse(Collections.singletonList(doc.getDocumentElement()),
- containerNode);
+ Element el = els.iterator().next();
- if (expectedNode != null) {
- junit.framework.Assert.assertEquals(expectedNode, built);
- }
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
- logger.info("{}", built);
+ System.out.println(toString(doc.getDocumentElement()));
+ System.out.println(toString(el));
- Iterable<Element> els =
- DomFromNormalizedNodeSerializerFactory
- .getInstance(XmlDocumentUtils.getDocument(),
- DomUtils.defaultValueCodecProvider())
- .getContainerNodeSerializer().serialize(containerNode, built);
+ new Diff(XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(el))).similar();
+ }
- Element el = els.iterator().next();
+ private static ContainerNode listLeafListWithAttributes() {
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
+ Builders.containerBuilder();
+ b.withNodeIdentifier(getNodeIdentifier("container"));
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
+ CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
+ Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
- System.out.println(toString(doc.getDocumentElement()));
- System.out.println(toString(el));
+ Map<QName, Object> predicates = Maps.newHashMap();
+ predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
- new Diff(
- XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
- XMLUnit.buildTestDocument(toString(el))).similar();
- }
+ DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
+ Builders.mapEntryBuilder().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ getNodeIdentifier("list").getNodeType(), predicates));
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
+ Builders.leafBuilder().withNodeIdentifier(
+ getNodeIdentifier("uint32InList"));
- private static ContainerNode listLeafListWithAttributes() {
- DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> b =
- Builders.containerBuilder();
- b.withNodeIdentifier(getNodeIdentifier("container"));
+ list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
- CollectionNodeBuilder<MapEntryNode, MapNode> listBuilder =
- Builders.mapBuilder().withNodeIdentifier(getNodeIdentifier("list"));
+ listBuilder.withChild(list1Builder.build());
+ b.withChild(listBuilder.build());
- Map<QName, Object> predicates = Maps.newHashMap();
- predicates.put(getNodeIdentifier("uint32InList").getNodeType(), 3L);
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
+ Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
+ booleanBuilder.withValue(false);
+ b.withChild(booleanBuilder.build());
- DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> list1Builder =
- Builders.mapEntryBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(
- getNodeIdentifier("list").getNodeType(), predicates));
- NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> uint32InListBuilder =
- Builders.leafBuilder().withNodeIdentifier(
- getNodeIdentifier("uint32InList"));
+ ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
+ Builders.leafSetBuilder().withNodeIdentifier(
+ getNodeIdentifier("leafList"));
- list1Builder.withChild(uint32InListBuilder.withValue(3L).build());
+ NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
+ Builders.leafSetEntryBuilder().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier(
+ "leafList").getNodeType(), "a"));
- listBuilder.withChild(list1Builder.build());
- b.withChild(listBuilder.build());
+ leafList1Builder.withValue("a");
- NormalizedNodeBuilder<YangInstanceIdentifier.NodeIdentifier, Object, LeafNode<Object>> booleanBuilder =
- Builders.leafBuilder().withNodeIdentifier(getNodeIdentifier("boolean"));
- booleanBuilder.withValue(false);
- b.withChild(booleanBuilder.build());
+ leafListBuilder.withChild(leafList1Builder.build());
+ b.withChild(leafListBuilder.build());
- ListNodeBuilder<Object, LeafSetEntryNode<Object>> leafListBuilder =
- Builders.leafSetBuilder().withNodeIdentifier(
- getNodeIdentifier("leafList"));
+ return b.build();
+ }
- NormalizedNodeBuilder<YangInstanceIdentifier.NodeWithValue, Object, LeafSetEntryNode<Object>> leafList1Builder =
- Builders.leafSetEntryBuilder().withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(getNodeIdentifier("leafList")
- .getNodeType(), "a"));
- leafList1Builder.withValue("a");
+ @Test
+ public void testConversionWithAttributes() throws Exception {
+ init("/test.yang", "/simple_xml_with_attributes.xml",
+ listLeafListWithAttributes());
+ Document doc = loadDocument(xmlPath);
- leafListBuilder.withChild(leafList1Builder.build());
- b.withChild(leafListBuilder.build());
+ ContainerNode built =
+ DomToNormalizedNodeParserFactory
+ .getInstance(DomUtils.defaultValueCodecProvider())
+ .getContainerNodeParser()
+ .parse(Collections.singletonList(doc.getDocumentElement()),
+ containerNode);
- return b.build();
+ if (expectedNode != null) {
+ junit.framework.Assert.assertEquals(expectedNode, built);
}
+ logger.info("{}", built);
- @Test
- public void testConversionWithAttributes() throws Exception {
- init("/test.yang", "/simple_xml_with_attributes.xml",
- listLeafListWithAttributes());
- Document doc = loadDocument(xmlPath);
+ Iterable<Element> els =
+ DomFromNormalizedNodeSerializerFactory
+ .getInstance(XmlDocumentUtils.getDocument(),
+ DomUtils.defaultValueCodecProvider())
+ .getContainerNodeSerializer().serialize(containerNode, built);
- ContainerNode built =
- DomToNormalizedNodeParserFactory
- .getInstance(DomUtils.defaultValueCodecProvider())
- .getContainerNodeParser()
- .parse(Collections.singletonList(doc.getDocumentElement()),
- containerNode);
+ Element el = els.iterator().next();
- if (expectedNode != null) {
- junit.framework.Assert.assertEquals(expectedNode, built);
- }
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
- logger.info("{}", built);
+ System.out.println(toString(doc.getDocumentElement()));
+ System.out.println(toString(el));
- Iterable<Element> els =
- DomFromNormalizedNodeSerializerFactory
- .getInstance(XmlDocumentUtils.getDocument(),
- DomUtils.defaultValueCodecProvider())
- .getContainerNodeSerializer().serialize(containerNode, built);
+ new Diff(XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(el))).similar();
+ }
- Element el = els.iterator().next();
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
+ private Document loadDocument(final String xmlPath) throws Exception {
+ InputStream resourceAsStream =
+ NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
- System.out.println(toString(doc.getDocumentElement()));
- System.out.println(toString(el));
+ Document currentConfigElement = readXmlToDocument(resourceAsStream);
+ Preconditions.checkNotNull(currentConfigElement);
+ return currentConfigElement;
+ }
- new Diff(
- XMLUnit.buildControlDocument(toString(doc.getDocumentElement())),
- XMLUnit.buildTestDocument(toString(el))).similar();
- }
+ private static final DocumentBuilderFactory BUILDERFACTORY;
+ static {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setNamespaceAware(true);
+ factory.setCoalescing(true);
+ factory.setIgnoringElementContentWhitespace(true);
+ factory.setIgnoringComments(true);
+ BUILDERFACTORY = factory;
+ }
- private Document loadDocument(final String xmlPath) throws Exception {
- InputStream resourceAsStream =
- NormalizedNodeXmlConverterTest.class.getResourceAsStream(xmlPath);
-
- Document currentConfigElement = readXmlToDocument(resourceAsStream);
- Preconditions.checkNotNull(currentConfigElement);
- return currentConfigElement;
- }
-
- private static final DocumentBuilderFactory BUILDERFACTORY;
-
- static {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- factory.setCoalescing(true);
- factory.setIgnoringElementContentWhitespace(true);
- factory.setIgnoringComments(true);
- BUILDERFACTORY = factory;
+ private Document readXmlToDocument(final InputStream xmlContent)
+ throws IOException, SAXException {
+ DocumentBuilder dBuilder;
+ try {
+ dBuilder = BUILDERFACTORY.newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ throw new RuntimeException("Failed to parse XML document", e);
}
-
- private Document readXmlToDocument(final InputStream xmlContent)
- throws IOException, SAXException {
- DocumentBuilder dBuilder;
- try {
- dBuilder = BUILDERFACTORY.newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- throw new RuntimeException("Failed to parse XML document", e);
- }
- Document doc = dBuilder.parse(xmlContent);
-
- doc.getDocumentElement().normalize();
- return doc;
- }
-
- public static String toString(final Element xml) {
- try {
- Transformer transformer =
- TransformerFactory.newInstance().newTransformer();
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-
- StreamResult result = new StreamResult(new StringWriter());
- DOMSource source = new DOMSource(xml);
- transformer.transform(source, result);
-
- return result.getWriter().toString();
- } catch (IllegalArgumentException | TransformerFactoryConfigurationError
- | TransformerException e) {
- throw new RuntimeException("Unable to serialize xml element " + xml, e);
- }
+ Document doc = dBuilder.parse(xmlContent);
+
+ doc.getDocumentElement().normalize();
+ return doc;
+ }
+
+ public static String toString(final Element xml) {
+ try {
+ Transformer transformer =
+ TransformerFactory.newInstance().newTransformer();
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(xml);
+ transformer.transform(source, result);
+
+ return result.getWriter().toString();
+ } catch (IllegalArgumentException | TransformerFactoryConfigurationError
+ | TransformerException e) {
+ throw new RuntimeException("Unable to serialize xml element " + xml, e);
}
+ }
- @Test
- public void testConversionToNormalizedXml() throws Exception {
- SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
- EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
- augmentChoiceExpectedNode());
- Document expectedDoc = loadDocument("/augment_choice.xml");
- Document convertedDoc =
- EncoderDecoderUtil.factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
- System.out.println(toString(convertedDoc.getDocumentElement()));
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
- new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
- .getDocumentElement())),
- XMLUnit.buildTestDocument(toString(convertedDoc
- .getDocumentElement()))).similar();
- System.out.println(toString(expectedDoc.getDocumentElement()));
-
- }
-
-
- @Test
- public void testConversionFromXmlToNormalizedNode() throws Exception {
- SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
- EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
- listLeafListWithAttributes());
- Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
- Document convertedDoc =
- EncoderDecoderUtil.factory.newDocumentBuilder().parse(
- new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
- System.out.println(toString(convertedDoc.getDocumentElement()));
- XMLUnit.setIgnoreWhitespace(true);
- XMLUnit.setIgnoreComments(true);
- new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
- .getDocumentElement())),
- XMLUnit.buildTestDocument(toString(convertedDoc
- .getDocumentElement()))).similar();
- System.out.println(toString(expectedDoc.getDocumentElement()));
-
- // now we will try to convert xml back to normalize node.
- ContainerNode cn =
- (ContainerNode) EncoderDecoderUtil.decode(
- parseTestSchema("/test.yang"), nnXml);
- junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
-
- }
+ @Test
+ public void testConversionToNormalizedXml() throws Exception {
+ SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+ EncoderDecoderUtil.encode(parseTestSchema("/augment_choice.yang"),
+ augmentChoiceExpectedNode());
+ Document expectedDoc = loadDocument("/augment_choice.xml");
+ Document convertedDoc =
+ EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+ System.out.println(toString(convertedDoc.getDocumentElement()));
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
+ new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+ .getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(convertedDoc.getDocumentElement())))
+ .similar();
+ System.out.println(toString(expectedDoc.getDocumentElement()));
+
+ }
+
+
+ @Test
+ public void testConversionFromXmlToNormalizedNode() throws Exception {
+ SimpleNormalizedNodeMessage.NormalizedNodeXml nnXml =
+ EncoderDecoderUtil.encode(parseTestSchema("/test.yang"),
+ listLeafListWithAttributes());
+ Document expectedDoc = loadDocument("/simple_xml_with_attributes.xml");
+ Document convertedDoc =
+ EncoderDecoderUtil.factory.newDocumentBuilder().parse(
+ new ByteArrayInputStream(nnXml.getXmlString().getBytes("utf-8")));
+ System.out.println(toString(convertedDoc.getDocumentElement()));
+ XMLUnit.setIgnoreWhitespace(true);
+ XMLUnit.setIgnoreComments(true);
+ new Diff(XMLUnit.buildControlDocument(toString(expectedDoc
+ .getDocumentElement())),
+ XMLUnit.buildTestDocument(toString(convertedDoc.getDocumentElement())))
+ .similar();
+ System.out.println(toString(expectedDoc.getDocumentElement()));
+
+ // now we will try to convert xml back to normalize node.
+ ContainerNode cn =
+ (ContainerNode) EncoderDecoderUtil.decode(
+ parseTestSchema("/test.yang"), nnXml);
+ junit.framework.Assert.assertEquals(listLeafListWithAttributes(), cn);
+
+ }
}
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.cluster.datastore.util;
import org.opendaylight.yangtools.yang.common.QName;
public class TestModel {
- public static final QName TEST_QNAME = QName.create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
- "2014-03-13", "test");
-
- public static final QName AUG_NAME_QNAME = QName.create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
- "2014-03-13", "name");
-
- public static final QName AUG_CONT_QNAME = QName.create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
- "2014-03-13", "cont");
-
-
- public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
- public static final QName POINTER_QNAME =
- QName.create(TEST_QNAME, "pointer");
- public static final QName SOME_REF_QNAME =
- QName.create(TEST_QNAME, "some-ref");
- public static final QName MYIDENTITY_QNAME =
- QName.create(TEST_QNAME, "myidentity");
- public static final QName SWITCH_FEATURES_QNAME =
- QName.create(TEST_QNAME, "switch-features");
-
- public static final QName AUGMENTED_LIST_QNAME =
- QName.create(TEST_QNAME, "augmented-list");
-
- public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME,
- "outer-list");
- public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME,
- "inner-list");
- public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME,
- "outer-choice");
- public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
- public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
- public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
- private static final String DATASTORE_TEST_YANG =
- "/odl-datastore-test.yang";
- private static final String DATASTORE_AUG_YANG =
- "/odl-datastore-augmentation.yang";
- private static final String DATASTORE_TEST_NOTIFICATION_YANG =
- "/odl-datastore-test-notification.yang";
-
-
- public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
- .of(TEST_QNAME);
- public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
- .builder(TEST_PATH).node(DESC_QNAME).build();
- public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier
- .builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
- public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
- public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
-
- private static final Integer ONE_ID = 1;
- private static final Integer TWO_ID = 2;
- private static final String TWO_ONE_NAME = "one";
- private static final String TWO_TWO_NAME = "two";
- private static final String DESC = "Hello there";
-
- // Family specific constants
- public static final QName FAMILY_QNAME =
- QName
- .create(
- "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
- "2014-04-17", "family");
- public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
- "children");
- public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
- "grand-children");
- public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
- "child-number");
- public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
- "child-name");
- public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
- FAMILY_QNAME, "grand-child-number");
- public static final QName GRAND_CHILD_NAME_QNAME =
- QName.create(FAMILY_QNAME,
- "grand-child-name");
-
- public static final YangInstanceIdentifier FAMILY_PATH = YangInstanceIdentifier
- .of(FAMILY_QNAME);
- public static final YangInstanceIdentifier FAMILY_DESC_PATH = YangInstanceIdentifier
- .builder(FAMILY_PATH).node(DESC_QNAME).build();
- public static final YangInstanceIdentifier CHILDREN_PATH = YangInstanceIdentifier
- .builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
-
- private static final Integer FIRST_CHILD_ID = 1;
- private static final Integer SECOND_CHILD_ID = 2;
-
- private static final String FIRST_CHILD_NAME = "first child";
- private static final String SECOND_CHILD_NAME = "second child";
-
- private static final Integer FIRST_GRAND_CHILD_ID = 1;
- private static final Integer SECOND_GRAND_CHILD_ID = 2;
-
- private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
- private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
-
- // first child
- private static final YangInstanceIdentifier CHILDREN_1_PATH = YangInstanceIdentifier
- .builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
- .build();
- private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
- YangInstanceIdentifier.builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
- .build();
+ public static final QName TEST_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test",
+ "2014-03-13", "test");
+
+ public static final QName AUG_NAME_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+ "2014-03-13", "name");
+
+ public static final QName AUG_CONT_QNAME = QName.create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:aug",
+ "2014-03-13", "cont");
+
+
+ public static final QName DESC_QNAME = QName.create(TEST_QNAME, "desc");
+ public static final QName POINTER_QNAME = QName.create(TEST_QNAME, "pointer");
+ public static final QName SOME_REF_QNAME = QName.create(TEST_QNAME,
+ "some-ref");
+ public static final QName MYIDENTITY_QNAME = QName.create(TEST_QNAME,
+ "myidentity");
+ public static final QName SWITCH_FEATURES_QNAME = QName.create(TEST_QNAME,
+ "switch-features");
+
+ public static final QName AUGMENTED_LIST_QNAME = QName.create(TEST_QNAME,
+ "augmented-list");
+
+ public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME,
+ "outer-list");
+ public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME,
+ "inner-list");
+ public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME,
+ "outer-choice");
+ public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
+ public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
+ public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
+ private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
+ private static final String DATASTORE_AUG_YANG =
+ "/odl-datastore-augmentation.yang";
+ private static final String DATASTORE_TEST_NOTIFICATION_YANG =
+ "/odl-datastore-test-notification.yang";
+
+
+ public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier
+ .of(TEST_QNAME);
+ public static final YangInstanceIdentifier DESC_PATH = YangInstanceIdentifier
+ .builder(TEST_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier OUTER_LIST_PATH =
+ YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
+ public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
+ public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
+
+ private static final Integer ONE_ID = 1;
+ private static final Integer TWO_ID = 2;
+ private static final String TWO_ONE_NAME = "one";
+ private static final String TWO_TWO_NAME = "two";
+ private static final String DESC = "Hello there";
+
+ // Family specific constants
+ public static final QName FAMILY_QNAME =
+ QName
+ .create(
+ "urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test",
+ "2014-04-17", "family");
+ public static final QName CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "children");
+ public static final QName GRAND_CHILDREN_QNAME = QName.create(FAMILY_QNAME,
+ "grand-children");
+ public static final QName CHILD_NUMBER_QNAME = QName.create(FAMILY_QNAME,
+ "child-number");
+ public static final QName CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+ "child-name");
+ public static final QName GRAND_CHILD_NUMBER_QNAME = QName.create(
+ FAMILY_QNAME, "grand-child-number");
+ public static final QName GRAND_CHILD_NAME_QNAME = QName.create(FAMILY_QNAME,
+ "grand-child-name");
+
+ public static final YangInstanceIdentifier FAMILY_PATH =
+ YangInstanceIdentifier.of(FAMILY_QNAME);
+ public static final YangInstanceIdentifier FAMILY_DESC_PATH =
+ YangInstanceIdentifier.builder(FAMILY_PATH).node(DESC_QNAME).build();
+ public static final YangInstanceIdentifier CHILDREN_PATH =
+ YangInstanceIdentifier.builder(FAMILY_PATH).node(CHILDREN_QNAME).build();
+
+ private static final Integer FIRST_CHILD_ID = 1;
+ private static final Integer SECOND_CHILD_ID = 2;
+
+ private static final String FIRST_CHILD_NAME = "first child";
+ private static final String SECOND_CHILD_NAME = "second child";
+
+ private static final Integer FIRST_GRAND_CHILD_ID = 1;
+ private static final Integer SECOND_GRAND_CHILD_ID = 2;
+
+ private static final String FIRST_GRAND_CHILD_NAME = "first grand child";
+ private static final String SECOND_GRAND_CHILD_NAME = "second grand child";
+
+ // first child
+ private static final YangInstanceIdentifier CHILDREN_1_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_1_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, FIRST_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier CHILDREN_2_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
+ .build();
+ private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
+ YangInstanceIdentifier.builder(CHILDREN_PATH)
+ .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+ .build();
+
+
+ private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
+ YangInstanceIdentifier
+ .builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
+ YangInstanceIdentifier
+ .builder(CHILDREN_1_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ FIRST_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
+ YangInstanceIdentifier
+ .builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
+ YangInstanceIdentifier
+ .builder(CHILDREN_2_PATH)
+ .node(GRAND_CHILDREN_QNAME)
+ //
+ .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier DESC_PATH_ID =
+ YangInstanceIdentifier.builder(DESC_PATH).build();
+ private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_PATH)
+ .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_PATH =
+ YangInstanceIdentifier.builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
+ .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
+ .build();
+
+ private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
+ YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
+ .build();
+
+ private static final MapEntryNode BAR_NODE = mapEntryBuilder(
+ OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
+ .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
+ .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
+ .build()) //
+ .build();
+
+ public static final InputStream getDatastoreTestInputStream() {
+ return getInputStream(DATASTORE_TEST_YANG);
+ }
+
+ public static final InputStream getDatastoreAugInputStream() {
+ return getInputStream(DATASTORE_AUG_YANG);
+ }
+
+ public static final InputStream getDatastoreTestNotificationInputStream() {
+ return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
+ }
+
+ private static InputStream getInputStream(final String resourceName) {
+ return TestModel.class.getResourceAsStream(resourceName);
+ }
+
+ public static SchemaContext createTestContext() {
+ List<InputStream> inputStreams = new ArrayList<>();
+ inputStreams.add(getDatastoreTestInputStream());
+ inputStreams.add(getDatastoreAugInputStream());
+ inputStreams.add(getDatastoreTestNotificationInputStream());
+
+ YangParserImpl parser = new YangParserImpl();
+ Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
+ return parser.resolveSchemaContext(modules);
+ }
+
+ /**
+ * Returns a test document
+ * <p/>
+ *
+ * <pre>
+ * test
+ * outer-list
+ * id 1
+ * outer-list
+ * id 2
+ * inner-list
+ * name "one"
+ * inner-list
+ * name "two"
+ *
+ * </pre>
+ *
+ * @return
+ */
+ public static NormalizedNode<?, ?> createDocumentOne(
+ SchemaContext schemaContext) {
+ return ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
+ .withChild(createTestContainer()).build();
+
+ }
+
+ public static ContainerNode createTestContainer() {
+
+
+ // Create a list of shoes
+ // This is to test leaf list entry
+ final LeafSetEntryNode<Object> nike =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(QName.create(
+ TEST_QNAME, "shoe"), "nike")).withValue("nike").build();
+
+ final LeafSetEntryNode<Object> puma =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(QName.create(
+ TEST_QNAME, "shoe"), "puma")).withValue("puma").build();
- private static final YangInstanceIdentifier CHILDREN_2_PATH = YangInstanceIdentifier
- .builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID) //
- .build();
- private static final YangInstanceIdentifier CHILDREN_2_NAME_PATH =
- YangInstanceIdentifier.builder(CHILDREN_PATH)
- .nodeWithKey(CHILDREN_QNAME, CHILD_NAME_QNAME, SECOND_CHILD_NAME) //
+ final LeafSetNode<Object> shoes =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ TEST_QNAME, "shoe"))).withChild(nike).withChild(puma)
.build();
- private static final YangInstanceIdentifier GRAND_CHILD_1_PATH =
- YangInstanceIdentifier.builder(CHILDREN_1_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID) //
- .build();
+ // Test a leaf-list where each entry contains an identity
+ final LeafSetEntryNode<Object> cap1 =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeWithValue(QName.create(
+ TEST_QNAME, "capability"), DESC_QNAME))
+ .withValue(DESC_QNAME).build();
- private static final YangInstanceIdentifier GRAND_CHILD_1_NAME_PATH =
- YangInstanceIdentifier.builder(CHILDREN_1_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
- FIRST_GRAND_CHILD_NAME) //
- .build();
+ final LeafSetNode<Object> capabilities =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ TEST_QNAME, "capability"))).withChild(cap1).build();
- private static final YangInstanceIdentifier GRAND_CHILD_2_PATH =
- YangInstanceIdentifier.builder(CHILDREN_2_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- SECOND_GRAND_CHILD_ID) //
- .build();
+ ContainerNode switchFeatures =
+ ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(SWITCH_FEATURES_QNAME))
+ .withChild(capabilities).build();
- private static final YangInstanceIdentifier GRAND_CHILD_2_NAME_PATH =
- YangInstanceIdentifier.builder(CHILDREN_2_PATH)
- .node(GRAND_CHILDREN_QNAME)
- //
- .nodeWithKey(GRAND_CHILDREN_QNAME, GRAND_CHILD_NAME_QNAME,
- SECOND_GRAND_CHILD_NAME) //
+ // Create a leaf list with numbers
+ final LeafSetEntryNode<Object> five =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ TEST_QNAME, "number"), 5))).withValue(5).build();
+ final LeafSetEntryNode<Object> fifteen =
+ ImmutableLeafSetEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ (new YangInstanceIdentifier.NodeWithValue(QName.create(
+ TEST_QNAME, "number"), 15))).withValue(15).build();
+ final LeafSetNode<Object> numbers =
+ ImmutableLeafSetNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(QName.create(
+ TEST_QNAME, "number"))).withChild(five).withChild(fifteen)
.build();
- private static final YangInstanceIdentifier DESC_PATH_ID = YangInstanceIdentifier
- .builder(DESC_PATH).build();
- private static final YangInstanceIdentifier OUTER_LIST_1_PATH =
- YangInstanceIdentifier.builder(OUTER_LIST_PATH)
- .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, ONE_ID) //
- .build();
- private static final YangInstanceIdentifier OUTER_LIST_2_PATH =
- YangInstanceIdentifier.builder(OUTER_LIST_PATH)
- .nodeWithKey(OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
- .build();
+ // Create augmentations
+ MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test");
- private static final YangInstanceIdentifier TWO_TWO_PATH = YangInstanceIdentifier
- .builder(OUTER_LIST_2_PATH).node(INNER_LIST_QNAME) //
- .nodeWithKey(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME) //
- .build();
- private static final YangInstanceIdentifier TWO_TWO_VALUE_PATH =
- YangInstanceIdentifier.builder(TWO_TWO_PATH).node(VALUE_QNAME) //
- .build();
+ // Create the document
+ return ImmutableContainerNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
+ .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
+ .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer"))
+ .withChild(
+ ImmutableNodes.leafNode(SOME_REF_QNAME, YangInstanceIdentifier
+ .builder().build()))
+ .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
- private static final MapEntryNode BAR_NODE = mapEntryBuilder(
- OUTER_LIST_QNAME, ID_QNAME, TWO_ID) //
- .withChild(mapNodeBuilder(INNER_LIST_QNAME) //
- .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_ONE_NAME)) //
- .withChild(mapEntry(INNER_LIST_QNAME, NAME_QNAME, TWO_TWO_NAME)) //
- .build()) //
- .build();
-
- public static final InputStream getDatastoreTestInputStream() {
- return getInputStream(DATASTORE_TEST_YANG);
- }
-
- public static final InputStream getDatastoreAugInputStream() {
- return getInputStream(DATASTORE_AUG_YANG);
- }
-
- public static final InputStream getDatastoreTestNotificationInputStream() {
- return getInputStream(DATASTORE_TEST_NOTIFICATION_YANG);
- }
-
- private static InputStream getInputStream(final String resourceName) {
- return TestModel.class.getResourceAsStream(resourceName);
- }
-
- public static SchemaContext createTestContext() {
- List<InputStream> inputStreams = new ArrayList<>();
- inputStreams.add(getDatastoreTestInputStream());
- inputStreams.add(getDatastoreAugInputStream());
- inputStreams.add(getDatastoreTestNotificationInputStream());
-
- YangParserImpl parser = new YangParserImpl();
- Set<Module> modules = parser.parseYangModelsFromStreams(inputStreams);
- return parser.resolveSchemaContext(modules);
- }
-
- /**
- * Returns a test document
- * <p/>
- * <pre>
- * test
- * outer-list
- * id 1
- * outer-list
- * id 2
- * inner-list
- * name "one"
- * inner-list
- * name "two"
- *
- * </pre>
- *
- * @return
- */
- public static NormalizedNode<?, ?> createDocumentOne(
- SchemaContext schemaContext) {
- return ImmutableContainerNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(schemaContext.getQName()))
- .withChild(createTestContainer()).build();
-
- }
-
- public static ContainerNode createTestContainer() {
-
-
- // Create a list of shoes
- // This is to test leaf list entry
- final LeafSetEntryNode<Object> nike =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(
- QName.create(TEST_QNAME,
- "shoe"), "nike")
- ).withValue("nike").build();
-
- final LeafSetEntryNode<Object> puma =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(
- QName.create(TEST_QNAME,
- "shoe"), "puma")
- ).withValue("puma").build();
-
- final LeafSetNode<Object> shoes =
- ImmutableLeafSetNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(
- QName.create(TEST_QNAME,
- "shoe"))
- ).withChild(nike).withChild(puma).build();
-
-
- // Test a leaf-list where each entry contains an identity
- final LeafSetEntryNode<Object> cap1 =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeWithValue(
- QName.create(TEST_QNAME,
- "capability"), DESC_QNAME)
- ).withValue(DESC_QNAME).build();
-
- final LeafSetNode<Object> capabilities =
- ImmutableLeafSetNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(
- QName.create(TEST_QNAME,
- "capability"))
- ).withChild(cap1).build();
-
- ContainerNode switchFeatures = ImmutableContainerNodeBuilder
- .create()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(
- SWITCH_FEATURES_QNAME))
- .withChild(capabilities)
- .build();
+ // .withChild(augmentationNode)
+ .withChild(shoes)
+ .withChild(numbers)
+ .withChild(switchFeatures)
+ .withChild(
+ mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(mapEntry).build())
+ .withChild(
+ mapNodeBuilder(OUTER_LIST_QNAME)
+ .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
+ .withChild(BAR_NODE).build()).build();
+
+ }
- // Create a leaf list with numbers
- final LeafSetEntryNode<Object> five =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(
- QName.create(TEST_QNAME,
- "number"), 5))
- ).withValue(5).build();
- final LeafSetEntryNode<Object> fifteen =
- ImmutableLeafSetEntryNodeBuilder
- .create()
- .withNodeIdentifier(
- (new YangInstanceIdentifier.NodeWithValue(
- QName.create(TEST_QNAME,
- "number"), 15))
- ).withValue(15).build();
- final LeafSetNode<Object> numbers =
- ImmutableLeafSetNodeBuilder
- .create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(
- QName.create(TEST_QNAME,
- "number"))
- ).withChild(five).withChild(fifteen).build();
-
-
- // Create augmentations
- MapEntryNode mapEntry = createAugmentedListEntry(1, "First Test");
-
-
- // Create the document
- return ImmutableContainerNodeBuilder
+ public static MapEntryNode createAugmentedListEntry(int id, String name) {
+
+ Set<QName> childAugmentations = new HashSet<>();
+ childAugmentations.add(AUG_CONT_QNAME);
+
+ ContainerNode augCont =
+ ImmutableContainerNodeBuilder
.create()
.withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(TEST_QNAME))
- .withChild(ImmutableNodes.leafNode(DESC_QNAME, DESC))
- .withChild(ImmutableNodes.leafNode(POINTER_QNAME, "pointer"))
- .withChild(ImmutableNodes.leafNode(SOME_REF_QNAME,
- YangInstanceIdentifier.builder().build()))
- .withChild(ImmutableNodes.leafNode(MYIDENTITY_QNAME, DESC_QNAME))
-
- //.withChild(augmentationNode)
- .withChild(shoes)
- .withChild(numbers)
- .withChild(switchFeatures)
- .withChild(mapNodeBuilder(AUGMENTED_LIST_QNAME).withChild(mapEntry).build())
- .withChild(
- mapNodeBuilder(OUTER_LIST_QNAME)
- .withChild(mapEntry(OUTER_LIST_QNAME, ID_QNAME, ONE_ID))
- .withChild(BAR_NODE).build()
- ).build();
-
- }
-
- public static MapEntryNode createAugmentedListEntry(int id, String name) {
-
- Set<QName> childAugmentations = new HashSet<>();
- childAugmentations.add(AUG_CONT_QNAME);
-
- ContainerNode augCont = ImmutableContainerNodeBuilder
- .create()
- .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
- .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name))
- .build();
+ new YangInstanceIdentifier.NodeIdentifier(AUG_CONT_QNAME))
+ .withChild(ImmutableNodes.leafNode(AUG_NAME_QNAME, name)).build();
- final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
- new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
+ final YangInstanceIdentifier.AugmentationIdentifier augmentationIdentifier =
+ new YangInstanceIdentifier.AugmentationIdentifier(childAugmentations);
- final AugmentationNode augmentationNode =
- Builders.augmentationBuilder()
- .withNodeIdentifier(augmentationIdentifier)
- .withChild(augCont)
- .build();
+ final AugmentationNode augmentationNode =
+ Builders.augmentationBuilder()
+ .withNodeIdentifier(augmentationIdentifier).withChild(augCont)
+ .build();
- return ImmutableMapEntryNodeBuilder.create()
- .withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifierWithPredicates(
- AUGMENTED_LIST_QNAME, ID_QNAME, id))
- .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
- .withChild(augmentationNode).build();
- }
-
-
- public static ContainerNode createFamily() {
- final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode>
- familyContainerBuilder =
- ImmutableContainerNodeBuilder.create().withNodeIdentifier(
- new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
-
- final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
- mapNodeBuilder(CHILDREN_QNAME);
-
- final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
- firstChildBuilder =
- mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
- final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
- secondChildBuilder =
- mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME,
- SECOND_CHILD_ID);
-
- final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
- firstGrandChildBuilder =
- mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID);
- final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode>
- secondGrandChildBuilder =
- mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
- SECOND_GRAND_CHILD_ID);
-
- firstGrandChildBuilder
- .withChild(
- ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
- FIRST_GRAND_CHILD_ID)
- ).withChild(
+ return ImmutableMapEntryNodeBuilder
+ .create()
+ .withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifierWithPredicates(
+ AUGMENTED_LIST_QNAME, ID_QNAME, id))
+ .withChild(ImmutableNodes.leafNode(ID_QNAME, id))
+ .withChild(augmentationNode).build();
+ }
+
+
+ public static ContainerNode createFamily() {
+ final DataContainerNodeAttrBuilder<YangInstanceIdentifier.NodeIdentifier, ContainerNode> familyContainerBuilder =
+ ImmutableContainerNodeBuilder.create().withNodeIdentifier(
+ new YangInstanceIdentifier.NodeIdentifier(FAMILY_QNAME));
+
+ final CollectionNodeBuilder<MapEntryNode, MapNode> childrenBuilder =
+ mapNodeBuilder(CHILDREN_QNAME);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, FIRST_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondChildBuilder =
+ mapEntryBuilder(CHILDREN_QNAME, CHILD_NUMBER_QNAME, SECOND_CHILD_ID);
+
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> firstGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID);
+ final DataContainerNodeBuilder<YangInstanceIdentifier.NodeIdentifierWithPredicates, MapEntryNode> secondGrandChildBuilder =
+ mapEntryBuilder(GRAND_CHILDREN_QNAME, GRAND_CHILD_NUMBER_QNAME,
+ SECOND_GRAND_CHILD_ID);
+
+ firstGrandChildBuilder
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NUMBER_QNAME,
+ FIRST_GRAND_CHILD_ID)).withChild(
ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
- FIRST_GRAND_CHILD_NAME)
- );
-
- secondGrandChildBuilder.withChild(
- ImmutableNodes
- .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID)
- )
- .withChild(
- ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
- SECOND_GRAND_CHILD_NAME)
- );
-
- firstChildBuilder
- .withChild(
- ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
- .withChild(
- ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
- .withChild(
- mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
- firstGrandChildBuilder.build()).build()
- );
-
-
- secondChildBuilder
- .withChild(
- ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
- .withChild(
- ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
- .withChild(
- mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
- firstGrandChildBuilder.build()).build()
- );
-
- childrenBuilder.withChild(firstChildBuilder.build());
- childrenBuilder.withChild(secondChildBuilder.build());
-
- return familyContainerBuilder.withChild(childrenBuilder.build())
- .build();
- }
+ FIRST_GRAND_CHILD_NAME));
+
+ secondGrandChildBuilder.withChild(
+ ImmutableNodes
+ .leafNode(GRAND_CHILD_NUMBER_QNAME, SECOND_GRAND_CHILD_ID))
+ .withChild(
+ ImmutableNodes.leafNode(GRAND_CHILD_NAME_QNAME,
+ SECOND_GRAND_CHILD_NAME));
+
+ firstChildBuilder
+ .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, FIRST_CHILD_ID))
+ .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, FIRST_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build());
+
+
+ secondChildBuilder
+ .withChild(ImmutableNodes.leafNode(CHILD_NUMBER_QNAME, SECOND_CHILD_ID))
+ .withChild(ImmutableNodes.leafNode(CHILD_NAME_QNAME, SECOND_CHILD_NAME))
+ .withChild(
+ mapNodeBuilder(GRAND_CHILDREN_QNAME).withChild(
+ firstGrandChildBuilder.build()).build());
+
+ childrenBuilder.withChild(firstChildBuilder.build());
+ childrenBuilder.withChild(secondChildBuilder.build());
+
+ return familyContainerBuilder.withChild(childrenBuilder.build()).build();
+ }
}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+
+/**
+ * @author: syedbahm Date: 7/31/14
+ */
+public abstract class AbstractMessagesTest {
+ public final String VERSION_COMPATIBILTY_TEST_DATA_PATH = "."
+ + File.separator + "src" + File.separator + "test" + File.separator
+ + "resources" + File.separator + "version-compatibility-serialized-data";
+ private File file;
+ private File testDataFile;
+
+ protected AbstractMessagesTest() {
+ init();
+ }
+
+ protected void init() {
+ file = new File(getTestFileName());
+ testDataFile =
+ new File(VERSION_COMPATIBILTY_TEST_DATA_PATH + File.separator
+ + getTestFileName() + "Data");
+ }
+
+
+
+ abstract public void verifySerialization() throws Exception;
+
+
+ protected void writeToFile(
+ com.google.protobuf.GeneratedMessage.Builder<?> builder) throws Exception {
+
+ FileOutputStream output = new FileOutputStream(file);
+ builder.build().writeTo(output);
+ output.close();;
+
+ }
+
+ protected com.google.protobuf.GeneratedMessage readFromFile(
+ com.google.protobuf.Parser<?> parser) throws Exception {
+ com.google.protobuf.GeneratedMessage message =
+ (com.google.protobuf.GeneratedMessage) parser
+ .parseFrom(new FileInputStream(file));
+
+ /*Note: we will delete only the test file -- comment below if you want to capture the
+ version-compatibility-serialized-data test data file.The file will be generated at root of the
+ sal-protocolbuffer-encoding
+ and you need to move it to test/resources/version-compatbility-serialized-data folder renaming the file to include suffix <TestFileName>"Data"
+ */
+ file.delete();
+ return message;
+ }
+
+ protected com.google.protobuf.GeneratedMessage readFromTestDataFile(
+ com.google.protobuf.Parser<?> parser) throws Exception {
+ return (com.google.protobuf.GeneratedMessage) parser
+ .parseFrom(new FileInputStream(testDataFile));
+ }
+
+
+ public abstract String getTestFileName();
+
+
+}
+++ /dev/null
-package org.opendaylight.controller.protobuff.messages;
-
-/**
- * This test case is present to ensure that if others have used proper version of protocol buffer.
- *
- * If a different version of protocol buffer is used then it would generate different java sources
- * and would result in breaking of this test case.
- *
- * @author: syedbahm Date: 6/20/14
- *
- */
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.opendaylight.controller.protobuff.messages.shard.ShardManagerMessages;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-
-public class ShardManagerMessagesTest {
-
- @Test
- public void verifySerialization() throws Exception {
- ShardManagerMessages.FindPrimary.Builder builder =
- ShardManagerMessages.FindPrimary.newBuilder();
- builder.setShardName("Inventory");
- File testFile = new File("./test");
- FileOutputStream output = new FileOutputStream(testFile);
- builder.build().writeTo(output);
- output.close();
-
- // Here we will read the same and check we got back what we had saved
- ShardManagerMessages.FindPrimary findPrimary =
- ShardManagerMessages.FindPrimary
- .parseFrom(new FileInputStream(testFile));
- Assert.assertEquals("Inventory", findPrimary.getShardName());
-
- testFile.delete();
-
- }
-}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.cohort3pc;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the cohort.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+
+public class ThreePhaseCommitCohortMessagesTest extends AbstractMessagesTest {
+
+
+ @Test
+ public void verifySerialization() throws Exception {
+
+
+
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply.Builder builder =
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply.newBuilder();
+ builder.setCanCommit(true);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ // Here we will read from the just serialized data
+
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply newCanCommitTransactionReply =
+ (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) readFromFile(ThreePhaseCommitCohortMessages.CanCommitTransactionReply.PARSER);
+
+ Assert.assertTrue(newCanCommitTransactionReply.getCanCommit());
+
+
+ // Here we will read the same from our test-data file and check we got back what we had saved
+ // earlier
+ ThreePhaseCommitCohortMessages.CanCommitTransactionReply originalCanCommitTransactionReply =
+ (ThreePhaseCommitCohortMessages.CanCommitTransactionReply) readFromTestDataFile(ThreePhaseCommitCohortMessages.CanCommitTransactionReply.PARSER);
+
+ Assert.assertEquals(newCanCommitTransactionReply.getCanCommit(),
+ originalCanCommitTransactionReply.getCanCommit());
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return ThreePhaseCommitCohortMessagesTest.class.getSimpleName();
+ }
+
+
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.common;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the common.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+public class NormalizedNodeMessagesTest extends AbstractMessagesTest {
+
+ @Override
+ @Test
+ public void verifySerialization() throws Exception {
+ NormalizedNodeMessages.Attribute.Builder builder =
+ NormalizedNodeMessages.Attribute.newBuilder();
+ builder.setName("test");
+ builder.setType("fake");
+ builder.setValue("testValue");
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ NormalizedNodeMessages.Attribute attributeNew =
+ (NormalizedNodeMessages.Attribute) readFromFile(NormalizedNodeMessages.Attribute.PARSER);
+ Assert.assertEquals("test", attributeNew.getName());
+ Assert.assertEquals("fake", attributeNew.getType());
+ Assert.assertEquals("testValue", attributeNew.getValue());
+
+ NormalizedNodeMessages.Attribute attributeOriginal =
+ (NormalizedNodeMessages.Attribute) readFromTestDataFile(NormalizedNodeMessages.Attribute.PARSER);
+ Assert.assertEquals(attributeNew.getName(), attributeOriginal.getName());
+ }
+
+ @Override
+ public String getTestFileName() {
+ return NormalizedNodeMessagesTest.class.getSimpleName();
+ }
+
+
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.datachange.notification;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the DataChangeListener.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+public class DataChangeListenerMessagesTest extends AbstractMessagesTest {
+
+ private final String namespace = "urn:protobuff", revision = "2014-07-31",
+ localName = "test";
+
+ @Override
+ @Test
+ public void verifySerialization() throws Exception {
+ NormalizedNodeMessages.InstanceIdentifier.Builder instanceIdentifierBuilder =
+ NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+ NormalizedNodeMessages.PathArgument.Builder pathArgument =
+ NormalizedNodeMessages.PathArgument.newBuilder();
+ pathArgument.setNodeType(NormalizedNodeMessages.QName.newBuilder()
+ .setValue(QName.create(namespace, revision, localName).toString())
+ .build());
+ pathArgument.setValue("test");
+ instanceIdentifierBuilder.addArguments(pathArgument.build());
+
+ NormalizedNodeMessages.InstanceIdentifier expectedOne =
+ instanceIdentifierBuilder.build();
+ DataChangeListenerMessages.DataChanged.Builder builder =
+ DataChangeListenerMessages.DataChanged.newBuilder();
+ builder.addRemovedPaths(expectedOne);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ DataChangeListenerMessages.DataChanged dataChangedNew =
+ (DataChangeListenerMessages.DataChanged) readFromFile(DataChangeListenerMessages.DataChanged.PARSER);
+ Assert.assertEquals(expectedOne.getArgumentsCount(), dataChangedNew
+ .getRemovedPaths(0).getArgumentsCount());
+ Assert.assertEquals(expectedOne.getArguments(0).getType(), dataChangedNew
+ .getRemovedPaths(0).getArguments(0).getType());
+
+ DataChangeListenerMessages.DataChanged dataChangedOriginal =
+ (DataChangeListenerMessages.DataChanged) readFromTestDataFile(DataChangeListenerMessages.DataChanged.PARSER);
+ Assert.assertEquals(dataChangedNew.getRemovedPathsCount(),
+ dataChangedOriginal.getRemovedPathsCount());
+ Assert.assertEquals(dataChangedNew.getRemovedPaths(0).getArguments(0)
+ .getValue(), dataChangedOriginal.getRemovedPaths(0).getArguments(0)
+ .getValue());
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return DataChangeListenerMessages.class.getSimpleName();
+ }
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.persistent;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the peristent.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+public class PersistentMessagesTest extends AbstractMessagesTest {
+
+ private final String namespace = "urn:protobuff", revision = "2014-07-31",
+ localName = "test";
+
+ @Override
+ @Test
+ public void verifySerialization() throws Exception {
+ NormalizedNodeMessages.InstanceIdentifier.Builder instanceIdentifierBuilder =
+ NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+ NormalizedNodeMessages.PathArgument.Builder pathArgument =
+ NormalizedNodeMessages.PathArgument.newBuilder();
+ pathArgument.setNodeType(NormalizedNodeMessages.QName.newBuilder()
+ .setValue(QName.create(namespace, revision, localName).toString())
+ .build());
+ pathArgument.setValue("test");
+ instanceIdentifierBuilder.addArguments(pathArgument.build());
+ NormalizedNodeMessages.InstanceIdentifier expectedOne =
+ instanceIdentifierBuilder.build();
+
+ PersistentMessages.Modification.Builder builder =
+ PersistentMessages.Modification.newBuilder();
+ builder.setType("test");
+ builder.setPath(expectedOne);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ PersistentMessages.Modification modificationNew =
+ (PersistentMessages.Modification) readFromFile(PersistentMessages.Modification.PARSER);
+ Assert.assertEquals("test", modificationNew.getType());
+ Assert.assertEquals(expectedOne.getArguments(0).getValue(), modificationNew
+ .getPath().getArguments(0).getValue());
+ Assert.assertEquals(expectedOne.getArguments(0).getType(), modificationNew
+ .getPath().getArguments(0).getType());
+
+ // we will compare with the serialized data that we had shipped
+ PersistentMessages.Modification modificationOriginal =
+ (PersistentMessages.Modification) readFromTestDataFile(PersistentMessages.Modification.PARSER);
+ Assert.assertEquals(modificationOriginal.getPath().getArguments(0)
+ .getValue(), modificationNew.getPath().getArguments(0).getValue());
+ Assert.assertEquals(modificationOriginal.getPath().getArguments(0)
+ .getType(), modificationNew.getPath().getArguments(0).getType());
+
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return PersistentMessagesTest.class.getSimpleName();
+ }
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.registration;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the ListenerRegistration.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+public class ListenerRegistrationMessagesTest extends AbstractMessagesTest {
+
+ @Override
+ @Test
+ public void verifySerialization() throws Exception {
+ String testListenerRegistrationPath =
+ "(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test?revision=2014-04-15)family";
+ ListenerRegistrationMessages.RegisterChangeListenerReply.Builder builder =
+ ListenerRegistrationMessages.RegisterChangeListenerReply.newBuilder();
+ builder.setListenerRegistrationPath(testListenerRegistrationPath);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ ListenerRegistrationMessages.RegisterChangeListenerReply rclrNew =
+ (ListenerRegistrationMessages.RegisterChangeListenerReply) readFromFile(ListenerRegistrationMessages.RegisterChangeListenerReply.PARSER);
+ Assert.assertEquals(testListenerRegistrationPath,
+ rclrNew.getListenerRegistrationPath());
+
+ ListenerRegistrationMessages.RegisterChangeListenerReply rclrOriginal =
+ (ListenerRegistrationMessages.RegisterChangeListenerReply) readFromTestDataFile(ListenerRegistrationMessages.RegisterChangeListenerReply.PARSER);
+ Assert.assertEquals(rclrOriginal.getListenerRegistrationPath(),
+ rclrNew.getListenerRegistrationPath());
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return ListenerRegistrationMessages.class.getSimpleName();
+ }
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.shard;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the ShardManager.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+
+public class ShardManagerMessagesTest extends AbstractMessagesTest {
+
+ @Test
+ public void verifySerialization() throws Exception {
+ ShardManagerMessages.FindPrimary.Builder builder =
+ ShardManagerMessages.FindPrimary.newBuilder();
+ builder.setShardName("Inventory");
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+
+ // Here we will read the same and check we got back what we had saved
+ ShardManagerMessages.FindPrimary findPrimaryNew =
+ (ShardManagerMessages.FindPrimary) readFromFile(ShardManagerMessages.FindPrimary.PARSER);
+
+ Assert.assertEquals("Inventory", findPrimaryNew.getShardName());
+
+ // Here we compare with the version we had shipped to catch any protobuff compiler version
+ // changes
+ ShardManagerMessages.FindPrimary findPrimaryOriginal =
+ (ShardManagerMessages.FindPrimary) readFromTestDataFile(ShardManagerMessages.FindPrimary.PARSER);
+
+ Assert.assertEquals(findPrimaryNew.getShardName(),
+ findPrimaryOriginal.getShardName());
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return ShardManagerMessagesTest.class.getSimpleName();
+ }
+
+}
--- /dev/null
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.transaction;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+
+/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the ShardTransactionChain.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
+ * @author: syedbahm
+ *
+ */
+
+
+public class ShardTransactionChainMessagesTest extends AbstractMessagesTest {
+
+ @Override
+ @Test
+ public void verifySerialization() throws Exception {
+ String testTransactionChainPath =
+ "/actor/path";
+
+ ShardTransactionChainMessages.CreateTransactionChainReply.Builder builder =
+ ShardTransactionChainMessages.CreateTransactionChainReply.newBuilder();
+ builder.setTransactionChainPath(testTransactionChainPath);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ // Here we will read the same and check we got back what we had saved
+ ShardTransactionChainMessages.CreateTransactionChainReply replyNew =
+ (ShardTransactionChainMessages.CreateTransactionChainReply) readFromFile(ShardTransactionChainMessages.CreateTransactionChainReply.PARSER);
+
+ Assert.assertEquals(replyNew.getTransactionChainPath(),testTransactionChainPath);
+
+ // the following will compare with the version we had shipped
+ ShardTransactionChainMessages.CreateTransactionChainReply replyOriginal =
+ (ShardTransactionChainMessages.CreateTransactionChainReply) readFromTestDataFile(ShardTransactionChainMessages.CreateTransactionChainReply.PARSER);
+
+
+ Assert.assertEquals(replyOriginal.getTransactionChainPath(),
+ replyNew.getTransactionChainPath());
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return ShardTransactionChainMessagesTest.class.getSimpleName();
+ }
+
+
+
+}
+/*
+ *
+ * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * 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.protobuff.messages.transaction;
+import org.junit.Assert;
+import org.junit.Test;
+import org.opendaylight.controller.protobuff.messages.AbstractMessagesTest;
+import org.opendaylight.controller.protobuff.messages.common.NormalizedNodeMessages;
+import org.opendaylight.yangtools.yang.common.QName;
+
/**
+ * This test case is present to ensure that if others have used proper version of protocol buffer
+ * for the ShardTransaction.proto messages
+ *
+ * If a different version of protocol buffer and there is change in serializaiton format
+ * this test would break as we are comparing with protocol buffer 2.5 generated
+ * serialized data.
+ *
* @author: syedbahm
- * Date: 7/7/14
+ *
*/
-public class ShardTransactionMessagesTest {
+
+
+public class ShardTransactionMessagesTest extends AbstractMessagesTest {
+
+ private final String namespace = "urn:protobuff", revision = "2014-07-31",
+ localName = "test";
+
+ @Test
+ public void verifySerialization() throws Exception {
+ NormalizedNodeMessages.InstanceIdentifier.Builder instanceIdentifierBuilder =
+ NormalizedNodeMessages.InstanceIdentifier.newBuilder();
+ NormalizedNodeMessages.PathArgument.Builder pathArgument =
+ NormalizedNodeMessages.PathArgument.newBuilder();
+ pathArgument.setNodeType(NormalizedNodeMessages.QName.newBuilder()
+ .setValue(QName.create(namespace, revision, localName).toString())
+ .build());
+ pathArgument.setValue("test");
+ instanceIdentifierBuilder.addArguments(pathArgument.build());
+ ShardTransactionMessages.ReadData.Builder builder =
+ ShardTransactionMessages.ReadData.newBuilder();
+ NormalizedNodeMessages.InstanceIdentifier expectedOne =
+ instanceIdentifierBuilder.build();
+ builder.setInstanceIdentifierPathArguments(expectedOne);
+
+ writeToFile((com.google.protobuf.GeneratedMessage.Builder<?>) builder);
+
+ // Here we will read the same and check we got back what we had saved
+ ShardTransactionMessages.ReadData readDataNew =
+ (ShardTransactionMessages.ReadData) readFromFile(ShardTransactionMessages.ReadData.PARSER);
+
+
+ Assert.assertEquals(expectedOne.getArgumentsCount(), readDataNew
+ .getInstanceIdentifierPathArguments().getArgumentsCount());
+ Assert.assertEquals(expectedOne.getArguments(0), readDataNew
+ .getInstanceIdentifierPathArguments().getArguments(0));
+
+
+ // the following will compare with the version we had shipped
+ ShardTransactionMessages.ReadData readDataOriginal =
+ (ShardTransactionMessages.ReadData) readFromTestDataFile(ShardTransactionMessages.ReadData.PARSER);
+
+
+ Assert.assertEquals(readDataNew.getInstanceIdentifierPathArguments()
+ .getArguments(0), readDataOriginal.getInstanceIdentifierPathArguments()
+ .getArguments(0));
+
+ }
+
+ @Override
+ public String getTestFileName() {
+ return ShardTransactionMessagesTest.class.getSimpleName();
+ }
+
}
+<!--
+ ~ /*
+ ~ Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ ~ */
+ -->
+
<container xmlns="urn:opendaylight:params:xml:ns:yang:controller:test">
<c2Leaf>2</c2Leaf>
+<!--
+ ~ /*
+ ~ Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
+ ~
+ ~ This program and the accompanying materials are made available under the
+ ~ terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ ~ and is available at http://www.eclipse.org/legal/epl-v10.html
+ ~ */
+ -->
+
<container xmlns="urn:opendaylight:params:xml:ns:yang:controller:test" name="test" xmlns:foo="http://www.foo.com/"
foo:baz="baz">
--- /dev/null
+23
+1
+\ 4test\1a)
+'(urn:protobuff?revision=2014-07-31)test
\ No newline at end of file
--- /dev/null
+
+m(urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:notification-test?revision=2014-04-15)family
\ No newline at end of file
--- /dev/null
+
+\ 4test\12 testValue\1a\ 4fake
\ No newline at end of file
--- /dev/null
+
+\ 4test\123
+1
+\ 4test\1a)
+'(urn:protobuff?revision=2014-07-31)test
\ No newline at end of file
--- /dev/null
+
+ Inventory
\ No newline at end of file
--- /dev/null
+
+\v/actor/path
\ No newline at end of file
--- /dev/null
+
+3
+1
+\ 4test\1a)
+'(urn:protobuff?revision=2014-07-31)test
\ No newline at end of file
--- /dev/null
+\b\ 1
\ No newline at end of file
--- /dev/null
+This directory contains one serialized test data file for one of the messages in each .proto file.
+These files are utilized as part of the test cases, mostly to fail the test cases in case some engineer has used
+a different version of protocol buffer than what we ship with (Protocol Buffer 2.5.0) to generate the messages source f
+file.
+
+1. If you see protocolbuffer version/invalid message exception in the test case
+ 1. ensure you are using the right version of protocol buffer/protoc compiler i.e protocol
+
+2. If you have knowingly updated an existing .proto message than please update the corresponding version-compatibility-serialized-data
+file. You can get the file by commenting out the test file deletion in AbstractMessagesTest look for comments
+
+ /* we will delete only the test file -- comment below if you want to capture the
+ version-compatibility-serialized-data test data file.The file will be generated at root of the sal-protocolbuffer-encoding
+ and you need to move it to version-compatbility-serialized-data folder renaming the file to include suffix <TestFileName>"Data"
+ */
+
+3. If you are creating a new .proto file -- Follow an existing test case e.g. ThreePhaseCommitCohortMessagesTest to
+ check how the test case is created and create the corresponding serialized test data file in version-compatibility-serialized-data