Removed \r characters from all projects under yang directory.
Change-Id: I46a47d523449bc159ea508143d9a06726f8259ff
Signed-off-by: Martin Vitez <mvitez@cisco.com>
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Augmentable (extensible) object which could carry additional data defined by\r
- * third-party extension, without introducing conflict between various\r
- * extension.\r
- * \r
- * This interface uses extended version of ExtensibleInterface pattern which\r
- * also adds marker interface for augmentations (extensions) -\r
- * {@link Augmentable}\r
- * \r
- * @author Tony Tkacik <ttkacik@cisco.com>\r
- * @param <T>\r
- * Base class which should implements this interface and is target\r
- * for augmentation.\r
- */\r
-public interface Augmentable<T> {\r
-\r
- /**\r
- * Returns instance of augmentation.\r
- * \r
- * @param augmentationType\r
- * Type of augmentation to be returned.\r
- * @return instance of augmentation.\r
- */\r
- <E extends Augmentation<T>> E getAugmentation(Class<E> augmentationType);\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Augmentable (extensible) object which could carry additional data defined by
+ * third-party extension, without introducing conflict between various
+ * extension.
+ *
+ * This interface uses extended version of ExtensibleInterface pattern which
+ * also adds marker interface for augmentations (extensions) -
+ * {@link Augmentable}
+ *
+ * @author Tony Tkacik <ttkacik@cisco.com>
+ * @param <T>
+ * Base class which should implements this interface and is target
+ * for augmentation.
+ */
+public interface Augmentable<T> {
+
+ /**
+ * Returns instance of augmentation.
+ *
+ * @param augmentationType
+ * Type of augmentation to be returned.
+ * @return instance of augmentation.
+ */
+ <E extends Augmentation<T>> E getAugmentation(Class<E> augmentationType);
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Augmentation (extension) of other interface.\r
- * \r
- * This interface uniquely bounds Augmentation to generated \r
- * interface.\r
- * \r
- * All interfaces generated from YANG Augmentation statement\r
- * must implement this interface with parameter <code>P</code>\r
- * which uniquely points to it's target class.\r
- * \r
- * \r
- *\r
- * @param <T> Class to which this implementation is extension.\r
- */\r
-public interface Augmentation<T> {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Augmentation (extension) of other interface.
+ *
+ * This interface uniquely bounds Augmentation to generated
+ * interface.
+ *
+ * All interfaces generated from YANG Augmentation statement
+ * must implement this interface with parameter <code>P</code>
+ * which uniquely points to it's target class.
+ *
+ *
+ *
+ * @param <T> Class to which this implementation is extension.
+ */
+public interface Augmentation<T> {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Base Identity\r
- * \r
- */\r
-public abstract class BaseIdentity {\r
-\r
- public final static BaseIdentity INSTANCE = new BaseIdentity() {\r
- };\r
-\r
- protected BaseIdentity() {\r
-\r
- }\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Base Identity
+ *
+ */
+public abstract class BaseIdentity {
+
+ public final static BaseIdentity INSTANCE = new BaseIdentity() {
+ };
+
+ protected BaseIdentity() {
+
+ }
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Data Container - object contains structured data\r
- * \r
- * Marker interface which must be implmeneted by all interfaces\r
- * generated for YANG:\r
- * <ul>\r
- * <li>Rpc Input\r
- * <li>Output \r
- * <li>Notification\r
- * <li>Container\r
- * <li>List\r
- * <li>Case\r
- * </ul>\r
- * \r
- *\r
- */\r
-public interface DataContainer {\r
-\r
- public Class<? extends DataContainer> getImplementedInterface();\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Data Container - object contains structured data
+ *
+ * Marker interface which must be implmeneted by all interfaces
+ * generated for YANG:
+ * <ul>
+ * <li>Rpc Input
+ * <li>Output
+ * <li>Notification
+ * <li>Container
+ * <li>List
+ * <li>Case
+ * </ul>
+ *
+ *
+ */
+public interface DataContainer {
+
+ public Class<? extends DataContainer> getImplementedInterface();
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Data container is an interface which has structured contents.\r
- * \r
- * \r
- * @author Tony Tkacik <ttkacik@cisco.com>\r
- *\r
- */\r
-public interface DataObject extends DataContainer {\r
-\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Data container is an interface which has structured contents.
+ *
+ *
+ * @author Tony Tkacik <ttkacik@cisco.com>
+ *
+ */
+public interface DataObject extends DataContainer {
+
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Data Root of YANG module\r
- * \r
- */\r
-public interface DataRoot {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Data Root of YANG module
+ *
+ */
+public interface DataRoot {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-\r
-/**\r
- * Identifiable object, which could be identified by it's key\r
- * \r
- * @author ttkacik\r
- *\r
- * @param <T> Identifier class for this object\r
- */\r
-public interface Identifiable<T extends Identifier<? extends Identifiable<T>>> {\r
- \r
- /**\r
- * Returns an unique key for the object\r
- * \r
- * @return Key for the object\r
- */\r
- T getKey();\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+
+/**
+ * Identifiable object, which could be identified by it's key
+ *
+ * @author ttkacik
+ *
+ * @param <T> Identifier class for this object
+ */
+public interface Identifiable<T extends Identifier<? extends Identifiable<T>>> {
+
+ /**
+ * Returns an unique key for the object
+ *
+ * @return Key for the object
+ */
+ T getKey();
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * \r
- * Object is unique identifier for another object\r
- * \r
- * \r
- * \r
- * @param <T>\r
- * Class of object for which this object is identifier\r
- * @author ttkacik\r
- */\r
-public interface Identifier<T extends Identifiable<?>> extends org.opendaylight.yangtools.concepts.Identifier {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ *
+ * Object is unique identifier for another object
+ *
+ *
+ *
+ * @param <T>
+ * Class of object for which this object is identifier
+ * @author ttkacik
+ */
+public interface Identifier<T extends Identifiable<?>> extends org.opendaylight.yangtools.concepts.Identifier {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Marker interface for YANG-defined notifications\r
- *\r
- *\r
- */\r
-public interface Notification extends DataContainer {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Marker interface for YANG-defined notifications
+ *
+ *
+ */
+public interface Notification extends DataContainer {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-import java.util.EventListener;\r
-\r
-/**\r
- * Marker interface for generated notification listener interfaces\r
- * \r
- * <p>\r
- * The subclasses of this interface have callbacks for events, which are derived\r
- * from {@link Notification} class in form void\r
- * on{NotificationType}(NotificationType notification).\r
- * \r
- * <p>\r
- * E.g. if we have notification SessionUp the callback will have signature:\r
- * <code>void onSessionUp(SessionUp notification)</code>\r
- * \r
- * \r
- */\r
-public interface NotificationListener extends EventListener {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+import java.util.EventListener;
+
+/**
+ * Marker interface for generated notification listener interfaces
+ *
+ * <p>
+ * The subclasses of this interface have callbacks for events, which are derived
+ * from {@link Notification} class in form void
+ * on{NotificationType}(NotificationType notification).
+ *
+ * <p>
+ * E.g. if we have notification SessionUp the callback will have signature:
+ * <code>void onSessionUp(SessionUp notification)</code>
+ *
+ *
+ */
+public interface NotificationListener extends EventListener {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-import java.util.Set;\r
-import java.util.concurrent.Future;\r
-\r
-import org.opendaylight.yangtools.yang.common.RpcResult;\r
-\r
-public interface RpcImplementation {\r
-\r
- // Fixme: Change to RpcInput\r
- Set<Class<? extends DataContainer>> getSupportedInputs();\r
-\r
- // Fixme: Change to RpcInput\r
- <T extends DataContainer> Future<RpcResult<?>> invoke(Class<T> type, T input);\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+import java.util.Set;
+import java.util.concurrent.Future;
+
+import org.opendaylight.yangtools.yang.common.RpcResult;
+
+public interface RpcImplementation {
+
+ // Fixme: Change to RpcInput
+ Set<Class<? extends DataContainer>> getSupportedInputs();
+
+ // Fixme: Change to RpcInput
+ <T extends DataContainer> Future<RpcResult<?>> invoke(Class<T> type, T input);
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-public interface RpcInput extends DataContainer {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+public interface RpcInput extends DataContainer {
+
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
-package org.opendaylight.yangtools.yang.binding;\r
-\r
-/**\r
- * Marker interface for tagging generated YANG Modules\r
- *\r
- */\r
-public interface RpcService {\r
-\r
-}\r
+/*
+ * 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
+ */
+package org.opendaylight.yangtools.yang.binding;
+
+/**
+ * Marker interface for tagging generated YANG Modules
+ *
+ */
+public interface RpcService {
+
+}
* 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.yangtools.yang.binding.annotations;\r
-\r
-import java.lang.annotation.Documented;\r
-import java.lang.annotation.ElementType;\r
-import java.lang.annotation.Inherited;\r
-import java.lang.annotation.Retention;\r
-import java.lang.annotation.RetentionPolicy;\r
-import java.lang.annotation.Target;\r
-\r
-import org.opendaylight.yangtools.yang.binding.BaseIdentity;\r
-\r
-\r
-@Inherited\r
-@Documented\r
-@Target(ElementType.METHOD)\r
-@Retention(RetentionPolicy.RUNTIME)\r
-public @interface RoutingContext {\r
-\r
- Class<? extends BaseIdentity> value();\r
-}\r
+package org.opendaylight.yangtools.yang.binding.annotations;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Inherited;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.opendaylight.yangtools.yang.binding.BaseIdentity;
+
+
+@Inherited
+@Documented
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RoutingContext {
+
+ Class<? extends BaseIdentity> value();
+}
-/*\r
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.\r
- *\r
- * This program and the accompanying materials are made available under the\r
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
- * and is available at http://www.eclipse.org/legal/epl-v10.html\r
- */\r
+/*
+ * 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
+ */
package org.opendaylight.yangtools.yang.binding;
\ No newline at end of file
* 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.yangtools.yang.binding.test;\r
-\r
-import static org.junit.Assert.*;\r
-\r
-import org.junit.Test;\r
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.FooChild;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.InstantiatedFoo;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.Node;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.NodeChild;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.NodeChildKey;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.NodeKey;\r
-import org.opendaylight.yangtools.yang.binding.test.mock.Nodes;\r
-\r
-public class InstanceIdentifierTest {\r
-\r
- @Test\r
- public void constructWithPredicates() {\r
- \r
- InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();\r
- \r
- assertNotNull(nodes);\r
- assertEquals(Nodes.class, nodes.getTargetType());\r
- \r
- \r
- InstanceIdentifier<Node> node = InstanceIdentifier.builder(nodes).node(Node.class).toInstance();\r
- \r
- assertNotNull(node);\r
- assertEquals(Node.class, node.getTargetType());\r
- \r
- assertTrue(nodes.contains(node));\r
- }\r
-\r
- @Test\r
- public void fluentConstruction() {\r
-\r
- InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();\r
- InstanceIdentifier<Node> node = InstanceIdentifier.builder(Nodes.class).child(Node.class,new NodeKey(10)).toInstance();\r
-\r
- assertNotNull(node);\r
- assertEquals(Node.class, node.getTargetType());\r
-\r
- assertTrue(nodes.contains(node));\r
- }\r
- \r
- \r
- @Test\r
- public void negativeContains() {\r
- InstanceIdentifier<FooChild> fooChild = InstanceIdentifier.builder(Nodes.class).child(InstantiatedFoo.class).child(FooChild.class).build();\r
- \r
- InstanceIdentifier<Node> nodeTen = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(10)).toInstance();\r
- InstanceIdentifier<Node> nodeOne = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(1)).toInstance();\r
- InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();\r
- \r
- assertFalse(fooChild.contains(nodeTen));\r
- assertFalse(nodeTen.contains(nodes));\r
- \r
- assertFalse(nodeOne.contains(nodes));\r
- assertTrue(nodes.contains(nodeOne));\r
- }\r
- \r
- @Test\r
- public void containsWildcarded() {\r
- InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();\r
- InstanceIdentifier<Node> wildcarded = InstanceIdentifier.builder(Nodes.class).child(Node.class).build();\r
- InstanceIdentifier<NodeChild> wildcardedChildren = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class) //\r
- .child(NodeChild.class).build();\r
- \r
- assertTrue(wildcarded.isWildcarded());\r
- assertTrue(wildcardedChildren.isWildcarded());\r
- \r
- \r
- InstanceIdentifier<Node> nodeTen = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(10)).toInstance();\r
- InstanceIdentifier<Node> nodeOne = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(1)).toInstance();\r
- \r
- assertFalse(nodeTen.isWildcarded());\r
- assertFalse(nodeOne.isWildcarded());\r
- assertTrue(nodes.containsWildcarded(nodeOne));\r
- assertTrue(wildcarded.containsWildcarded(nodeOne));\r
- assertTrue(wildcarded.containsWildcarded(nodeTen));\r
- \r
- \r
- InstanceIdentifier<NodeChild> nodeTenChildWildcarded = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(10)).child(NodeChild.class).toInstance();\r
- \r
- assertTrue(nodeTenChildWildcarded.isWildcarded());\r
- \r
- InstanceIdentifier<NodeChild> nodeTenChild = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(10)).child(NodeChild.class, new NodeChildKey(10)).toInstance();\r
- InstanceIdentifier<NodeChild> nodeOneChild = InstanceIdentifier.builder(Nodes.class) //\r
- .child(Node.class,new NodeKey(1)).child(NodeChild.class, new NodeChildKey(1)).toInstance();\r
-\r
- \r
- assertFalse(nodeTenChildWildcarded.containsWildcarded(nodeOneChild));\r
- assertTrue(nodeTenChildWildcarded.containsWildcarded(nodeTenChild));\r
- \r
- }\r
- \r
- \r
- void childOfTest() {\r
- InstanceIdentifier.builder(Nodes.class).child(InstantiatedFoo.class).child(FooChild.class);\r
- }\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.test.mock.FooChild;
+import org.opendaylight.yangtools.yang.binding.test.mock.InstantiatedFoo;
+import org.opendaylight.yangtools.yang.binding.test.mock.Node;
+import org.opendaylight.yangtools.yang.binding.test.mock.NodeChild;
+import org.opendaylight.yangtools.yang.binding.test.mock.NodeChildKey;
+import org.opendaylight.yangtools.yang.binding.test.mock.NodeKey;
+import org.opendaylight.yangtools.yang.binding.test.mock.Nodes;
+
+public class InstanceIdentifierTest {
+
+ @Test
+ public void constructWithPredicates() {
+
+ InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();
+
+ assertNotNull(nodes);
+ assertEquals(Nodes.class, nodes.getTargetType());
+
+
+ InstanceIdentifier<Node> node = InstanceIdentifier.builder(nodes).node(Node.class).toInstance();
+
+ assertNotNull(node);
+ assertEquals(Node.class, node.getTargetType());
+
+ assertTrue(nodes.contains(node));
+ }
+
+ @Test
+ public void fluentConstruction() {
+
+ InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();
+ InstanceIdentifier<Node> node = InstanceIdentifier.builder(Nodes.class).child(Node.class,new NodeKey(10)).toInstance();
+
+ assertNotNull(node);
+ assertEquals(Node.class, node.getTargetType());
+
+ assertTrue(nodes.contains(node));
+ }
+
+
+ @Test
+ public void negativeContains() {
+ InstanceIdentifier<FooChild> fooChild = InstanceIdentifier.builder(Nodes.class).child(InstantiatedFoo.class).child(FooChild.class).build();
+
+ InstanceIdentifier<Node> nodeTen = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(10)).toInstance();
+ InstanceIdentifier<Node> nodeOne = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(1)).toInstance();
+ InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();
+
+ assertFalse(fooChild.contains(nodeTen));
+ assertFalse(nodeTen.contains(nodes));
+
+ assertFalse(nodeOne.contains(nodes));
+ assertTrue(nodes.contains(nodeOne));
+ }
+
+ @Test
+ public void containsWildcarded() {
+ InstanceIdentifier<Nodes> nodes = InstanceIdentifier.builder(Nodes.class).toInstance();
+ InstanceIdentifier<Node> wildcarded = InstanceIdentifier.builder(Nodes.class).child(Node.class).build();
+ InstanceIdentifier<NodeChild> wildcardedChildren = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class) //
+ .child(NodeChild.class).build();
+
+ assertTrue(wildcarded.isWildcarded());
+ assertTrue(wildcardedChildren.isWildcarded());
+
+
+ InstanceIdentifier<Node> nodeTen = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(10)).toInstance();
+ InstanceIdentifier<Node> nodeOne = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(1)).toInstance();
+
+ assertFalse(nodeTen.isWildcarded());
+ assertFalse(nodeOne.isWildcarded());
+ assertTrue(nodes.containsWildcarded(nodeOne));
+ assertTrue(wildcarded.containsWildcarded(nodeOne));
+ assertTrue(wildcarded.containsWildcarded(nodeTen));
+
+
+ InstanceIdentifier<NodeChild> nodeTenChildWildcarded = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(10)).child(NodeChild.class).toInstance();
+
+ assertTrue(nodeTenChildWildcarded.isWildcarded());
+
+ InstanceIdentifier<NodeChild> nodeTenChild = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(10)).child(NodeChild.class, new NodeChildKey(10)).toInstance();
+ InstanceIdentifier<NodeChild> nodeOneChild = InstanceIdentifier.builder(Nodes.class) //
+ .child(Node.class,new NodeKey(1)).child(NodeChild.class, new NodeChildKey(1)).toInstance();
+
+
+ assertFalse(nodeTenChildWildcarded.containsWildcarded(nodeOneChild));
+ assertTrue(nodeTenChildWildcarded.containsWildcarded(nodeTenChild));
+
+ }
+
+
+ void childOfTest() {
+ InstanceIdentifier.builder(Nodes.class).child(InstantiatedFoo.class).child(FooChild.class);
+ }
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.ChildOf;\r
-\r
-public interface FooChild extends ChildOf<GroupingFoo> {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+
+public interface FooChild extends ChildOf<GroupingFoo> {
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-public interface GroupingFoo {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+public interface GroupingFoo {
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.ChildOf;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-\r
-public interface InstantiatedFoo extends DataObject, GroupingFoo, ChildOf<Nodes> {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+public interface InstantiatedFoo extends DataObject, GroupingFoo, ChildOf<Nodes> {
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.ChildOf;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.opendaylight.yangtools.yang.binding.Identifiable;\r
-\r
-public interface Node extends //\r
- DataObject, //\r
- Identifiable<NodeKey>, //\r
- ChildOf<Nodes> {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+
+public interface Node extends //
+ DataObject, //
+ Identifiable<NodeKey>, //
+ ChildOf<Nodes> {
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.ChildOf;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.opendaylight.yangtools.yang.binding.Identifiable;\r
-\r
-public interface NodeChild extends //\r
- DataObject, //\r
- Identifiable<NodeChildKey>, //\r
- ChildOf<Node> {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+
+public interface NodeChild extends //
+ DataObject, //
+ Identifiable<NodeChildKey>, //
+ ChildOf<Node> {
+
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.Identifier;\r
-\r
-public class NodeChildKey implements //\r
- Identifier<NodeChild> {\r
-\r
- private final int id;\r
-\r
- public NodeChildKey(int id) {\r
- super();\r
- this.id = id;\r
- }\r
-\r
- public int getId() {\r
- return id;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + id;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (getClass() != obj.getClass())\r
- return false;\r
- NodeChildKey other = (NodeChildKey) obj;\r
- if (id != other.id)\r
- return false;\r
- return true;\r
- }\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.Identifier;
+
+public class NodeChildKey implements //
+ Identifier<NodeChild> {
+
+ private final int id;
+
+ public NodeChildKey(int id) {
+ super();
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + id;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NodeChildKey other = (NodeChildKey) obj;
+ if (id != other.id)
+ return false;
+ return true;
+ }
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.Identifier;\r
-\r
-public class NodeKey implements //\r
- Identifier<Node> {\r
-\r
- private final int id;\r
-\r
- public NodeKey(int id) {\r
- super();\r
- this.id = id;\r
- }\r
-\r
- public int getId() {\r
- return id;\r
- }\r
-\r
- @Override\r
- public int hashCode() {\r
- final int prime = 31;\r
- int result = 1;\r
- result = prime * result + id;\r
- return result;\r
- }\r
-\r
- @Override\r
- public boolean equals(Object obj) {\r
- if (this == obj)\r
- return true;\r
- if (obj == null)\r
- return false;\r
- if (getClass() != obj.getClass())\r
- return false;\r
- NodeKey other = (NodeKey) obj;\r
- if (id != other.id)\r
- return false;\r
- return true;\r
- }\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.Identifier;
+
+public class NodeKey implements //
+ Identifier<Node> {
+
+ private final int id;
+
+ public NodeKey(int id) {
+ super();
+ this.id = id;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + id;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ NodeKey other = (NodeKey) obj;
+ if (id != other.id)
+ return false;
+ return true;
+ }
+}
* 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.yangtools.yang.binding.test.mock;\r
-\r
-import org.opendaylight.yangtools.yang.binding.ChildOf;\r
-import org.opendaylight.yangtools.yang.binding.DataObject;\r
-import org.opendaylight.yangtools.yang.binding.DataRoot;\r
-\r
-public interface Nodes extends //\r
- ChildOf<DataRoot>, //\r
- DataObject {\r
-\r
-}\r
+package org.opendaylight.yangtools.yang.binding.test.mock;
+
+import org.opendaylight.yangtools.yang.binding.ChildOf;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.binding.DataRoot;
+
+public interface Nodes extends //
+ ChildOf<DataRoot>, //
+ DataObject {
+
+}