Move DataObjectReadingUtil to mdsal-binding-spec-util 34/74334/6
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 23 Jul 2018 12:32:52 +0000 (14:32 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 23 Jul 2018 16:22:36 +0000 (18:22 +0200)
This moves access utility from yang-binding to mdsal-binding-spec-util,
as it has no place in yang-binding.

Change-Id: Ieda67f69da45183dfcd75d7828cc244839b25cde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
binding/mdsal-binding-spec-util/pom.xml [new file with mode: 0644]
binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtil.java [moved from binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/util/DataObjectReadingUtil.java with 99% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtilTest.java [moved from binding/yang-binding/src/test/java/org/opendaylight/yangtools/yang/binding/util/DataObjectReadingUtilTest.java with 94% similarity]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Node.java [new file with mode: 0644]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/NodeKey.java [new file with mode: 0644]
binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Nodes.java [new file with mode: 0644]
binding/pom.xml
common/artifacts/pom.xml
common/features/odl-mdsal-binding-base/pom.xml

diff --git a/binding/mdsal-binding-spec-util/pom.xml b/binding/mdsal-binding-spec-util/pom.xml
new file mode 100644 (file)
index 0000000..efd539d
--- /dev/null
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ 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
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>bundle-parent</artifactId>
+        <version>3.1.2</version>
+        <relativePath/>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.opendaylight.mdsal</groupId>
+    <artifactId>mdsal-binding-spec-util</artifactId>
+    <version>0.13.0-SNAPSHOT</version>
+    <packaging>bundle</packaging>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.mdsal</groupId>
+                <artifactId>mdsal-artifacts</artifactId>
+                <version>2.5.0-SNAPSHOT</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>com.google.guava</groupId>
+            <artifactId>guava</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>yang-binding</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mockito</groupId>
+            <artifactId>mockito-core</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+    <scm>
+        <connection>scm:git:http://git.opendaylight.org/gerrit/controller.git</connection>
+        <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
+        <tag>HEAD</tag>
+        <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
+    </scm>
+</project>
similarity index 99%
rename from binding/yang-binding/src/main/java/org/opendaylight/yangtools/yang/binding/util/DataObjectReadingUtil.java
rename to binding/mdsal-binding-spec-util/src/main/java/org/opendaylight/mdsal/binding/spec/util/DataObjectReadingUtil.java
index 0011bc666b2286d75149c44e0e1b387430b9af01..f960ea6520dcef27f6617db1780b0cd322d47d57 100644 (file)
@@ -5,11 +5,12 @@
  * 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.util;
+package org.opendaylight.mdsal.binding.spec.util;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkState;
 
+import com.google.common.annotations.Beta;
 import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
@@ -32,6 +33,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.IdentifiableIt
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.Item;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
 
+@Beta
 public final class DataObjectReadingUtil {
 
     private static final DataObjectReadingStrategy REAUSABLE_AUGMENTATION_READING_STRATEGY =
@@ -5,13 +5,13 @@
  * 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.util;
+package org.opendaylight.mdsal.binding.spec.util;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
-import static org.opendaylight.yangtools.yang.binding.util.DataObjectReadingUtil.readData;
+import static org.opendaylight.mdsal.binding.spec.util.DataObjectReadingUtil.readData;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -28,8 +28,6 @@ import org.mockito.MockitoAnnotations;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.Identifiable;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.test.mock.Node;
-import org.opendaylight.yangtools.yang.binding.test.mock.Nodes;
 
 public class DataObjectReadingUtilTest {
 
diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Node.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Node.java
new file mode 100644 (file)
index 0000000..0612011
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * 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.mdsal.binding.spec.util;
+
+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> {
+
+}
diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/NodeKey.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/NodeKey.java
new file mode 100644 (file)
index 0000000..cfe9e77
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * 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.mdsal.binding.spec.util;
+
+import org.opendaylight.yangtools.yang.binding.Identifier;
+
+public class NodeKey implements Identifier<Node> {
+    private static final long serialVersionUID = 1L;
+
+    private final int id;
+
+    public NodeKey(final int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return id;
+    }
+
+    @Override
+    public int hashCode() {
+        return Integer.hashCode(id);
+    }
+
+    @Override
+    public boolean equals(final 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;
+    }
+}
diff --git a/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Nodes.java b/binding/mdsal-binding-spec-util/src/test/java/org/opendaylight/mdsal/binding/spec/util/Nodes.java
new file mode 100644 (file)
index 0000000..775bf90
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * 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.mdsal.binding.spec.util;
+
+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 {
+
+    Iterable<?> getNode();
+}
index de3b0eb44af797fd5f739ad77cfbe6a041194ba2..4cc5825f8dd068d6d9d0e12da8a07a75fc6dfdbb 100644 (file)
@@ -31,7 +31,9 @@
         <module>maven-sal-api-gen-plugin</module>
         <!-- FIXME: should be probably renamed to mdsal-model-binding-parent -->
         <module>binding-parent</module>
+        <!-- FIXME: rename to mdsal-binding-spec-api -->
         <module>yang-binding</module>
+        <module>mdsal-binding-spec-util</module>
 
         <module>mdsal-binding-test-model</module>
         <module>mdsal-binding-dom-codec</module>
index f5020d373e83a1866a1da0c7e60058e00fd76150..5749d1f44e54e87a8394d9a1cacde296ea5b87f1 100644 (file)
                 <artifactId>yang-binding</artifactId>
                 <version>0.13.0-SNAPSHOT</version>
             </dependency>
+            <dependency>
+                <groupId>org.opendaylight.mdsal</groupId>
+                <artifactId>mdsal-binding-spec-util</artifactId>
+                <version>0.13.0-SNAPSHOT</version>
+            </dependency>
             <dependency>
                 <groupId>org.opendaylight.mdsal</groupId>
                 <artifactId>mdsal-binding-dom-codec</artifactId>
index a3680941d35c6aafd8cd647e3c6a91d78782be62..bf4f2c05e1d02bed562c68d24c49253e5bca6088 100644 (file)
             <groupId>${project.groupId}</groupId>
             <artifactId>yang-binding</artifactId>
         </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
+            <artifactId>mdsal-binding-spec-util</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal.model</groupId>
             <artifactId>yang-ext</artifactId>