Rehost BaseYangTypes 73/87873/3
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Feb 2020 19:55:42 +0000 (20:55 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Feb 2020 20:32:13 +0000 (21:32 +0100)
These types are closely related to Types and as such are part of
the same API group as binding.model.util. Relocating them allows
us to lower dependencies on mdsal-binding-generator-impl.

JIRA: MDSAL-392
Change-Id: I3ba9097c3194c42d3c8f3f1b3fac521934e7d1cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 files changed:
binding/mdsal-binding-dom-adapter/pom.xml
binding/mdsal-binding-dom-codec-osgi/pom.xml
binding/mdsal-binding-dom-codec/pom.xml
binding/mdsal-binding-dom-codec/src/main/java/org/opendaylight/mdsal/binding/dom/codec/impl/UnionTypeCodec.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/generator/impl/AbstractTypeGenerator.java
binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/AbstractTypeProvider.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/BaseTypeProvider.java
binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/generator/impl/ExtendedTypedefTest.java
binding/mdsal-binding-generator-util/src/main/java/org/opendaylight/mdsal/binding/generator/util/BaseYangTypes.java [moved from binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/mdsal/binding/yang/types/BaseYangTypes.java with 99% similarity]
binding/mdsal-binding-generator-util/src/test/java/org/opendaylight/mdsal/binding/generator/util/BaseYangTypesTest.java [moved from binding/mdsal-binding-generator-impl/src/test/java/org/opendaylight/mdsal/binding/yang/types/BaseYangTypesTest.java with 99% similarity]
binding/mdsal-binding-generator-util/src/test/resources/base-yang-types.yang [new file with mode: 0644]
binding/mdsal-binding-test-utils/pom.xml

index 05062b51c735790cda89bdcb30a481be883e59e6..4e51157998fe4ceefbebb57a141f36ea1cff6b5e 100644 (file)
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-dom-spi</artifactId>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>mdsal-binding-generator-impl</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-dom-codec</artifactId>
             <artifactId>yang-parser-impl</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-binding-generator-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-test-model</artifactId>
index 85287879d10da3f352e5e903345d65813def9e02..f33c6fbffc04ceaeaf3650423dfe2aad94097f7e 100644 (file)
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-dom-codec</artifactId>
         </dependency>
+        <dependency>
+            <!-- FIXME: MDSAL-392: this is ugly, we should be looking this up,
+                 but then we may want to end up doing something
+                 completely different in this artifact -->
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-binding-generator-impl</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.osgi</groupId>
             <artifactId>org.osgi.core</artifactId>
index 8570eb216c82754fba86f34501433070a7d5653a..71d2e6fd830510866e4913e48ce3fece88ddc816 100644 (file)
             <artifactId>byte-buddy</artifactId>
             <version>1.10.7</version>
         </dependency>
-        <dependency>
-            <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>mdsal-binding-generator-impl</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-data-impl</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>mdsal-binding-dom-codec-api</artifactId>
+            <artifactId>mdsal-binding-generator-util</artifactId>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
-            <artifactId>mdsal-binding-test-model</artifactId>
+            <artifactId>mdsal-binding-dom-codec-api</artifactId>
         </dependency>
 
-        <dependency>
-            <groupId>com.google.guava</groupId>
-            <artifactId>guava</artifactId>
-        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>mockito-configuration</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-binding-test-model</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-binding-generator-impl</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
     <build>
index 738b17071302693d1606883ec7f4706d4cdb2ef6..14065cc718f95e4da27075aa6242bc8087b159d4 100644 (file)
@@ -12,8 +12,8 @@ import java.lang.reflect.Method;
 import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.concurrent.Callable;
+import org.opendaylight.mdsal.binding.generator.util.BaseYangTypes;
 import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
-import org.opendaylight.mdsal.binding.yang.types.BaseYangTypes;
 import org.opendaylight.yangtools.concepts.IllegalArgumentCodec;
 import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
index 5e506a03fd961aff055d5851daf18466c66dd495..7ecd4b16046bbb00ff7d0546ec775631bec6b631 100644 (file)
@@ -64,6 +64,7 @@ import java.util.Map;
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
+import org.opendaylight.mdsal.binding.generator.util.BaseYangTypes;
 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
 import org.opendaylight.mdsal.binding.model.api.Constant;
 import org.opendaylight.mdsal.binding.model.api.DefaultType;
@@ -87,7 +88,6 @@ import org.opendaylight.mdsal.binding.model.util.TypeConstants;
 import org.opendaylight.mdsal.binding.model.util.generated.type.builder.GeneratedPropertyBuilderImpl;
 import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
 import org.opendaylight.mdsal.binding.yang.types.AbstractTypeProvider;
-import org.opendaylight.mdsal.binding.yang.types.BaseYangTypes;
 import org.opendaylight.mdsal.binding.yang.types.GroupingDefinitionDependencySort;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
index f2a93739828d9276be1b91dab2e4d844b7c791e3..e3f5c8ba17bbb90a0165039f8528fca5e808a3af 100644 (file)
@@ -34,6 +34,7 @@ import java.util.Set;
 import java.util.TreeMap;
 import java.util.regex.Pattern;
 import org.opendaylight.mdsal.binding.generator.spi.TypeProvider;
+import org.opendaylight.mdsal.binding.generator.util.BaseYangTypes;
 import org.opendaylight.mdsal.binding.model.api.AccessModifier;
 import org.opendaylight.mdsal.binding.model.api.ConcreteType;
 import org.opendaylight.mdsal.binding.model.api.Enumeration;
index 4af7479d74297f5b33c3ca667a8a9c96e308cbca..afe88544f60db2e72e38f635cd6286f5dfdef1a8 100644 (file)
@@ -11,11 +11,11 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.generator.util.BaseYangTypes;
 import org.opendaylight.mdsal.binding.model.api.ConcreteType;
 import org.opendaylight.mdsal.binding.model.api.ParameterizedType;
 import org.opendaylight.mdsal.binding.model.api.Type;
 import org.opendaylight.mdsal.binding.model.util.Types;
-import org.opendaylight.mdsal.binding.yang.types.BaseYangTypes;
 
 public class BaseTypeProvider {
 
index 4b881de3775d95201f90cae706c713fd50c627bc..9102e8d9380adb211ebae841ef8530e1258705d3 100644 (file)
@@ -14,10 +14,10 @@ import static org.junit.Assert.assertTrue;
 
 import java.util.List;
 import org.junit.Test;
+import org.opendaylight.mdsal.binding.generator.util.BaseYangTypes;
 import org.opendaylight.mdsal.binding.model.api.GeneratedProperty;
 import org.opendaylight.mdsal.binding.model.api.GeneratedTransferObject;
 import org.opendaylight.mdsal.binding.model.api.Type;
-import org.opendaylight.mdsal.binding.yang.types.BaseYangTypes;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 
@@ -5,7 +5,7 @@
  * 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.yang.types;
+package org.opendaylight.mdsal.binding.generator.util;
 
 import com.google.common.collect.ImmutableMap;
 import java.math.BigDecimal;
@@ -5,7 +5,7 @@
  * 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.yang.types;
+package org.opendaylight.mdsal.binding.generator.util;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
diff --git a/binding/mdsal-binding-generator-util/src/test/resources/base-yang-types.yang b/binding/mdsal-binding-generator-util/src/test/resources/base-yang-types.yang
new file mode 100644 (file)
index 0000000..14daf7a
--- /dev/null
@@ -0,0 +1,111 @@
+module base-yang-types {
+    yang-version 1;
+    namespace "urn:opendaylight:org:test:base:yang:types";
+    prefix "tp";
+
+    organization "OPEN DAYLIGHT";
+    contact "http://www.opendaylight.org/";
+
+    description "This module contains definitions of all Yang base types.";
+
+    revision "2014-09-14" {
+        reference "Added yang-int8-restricted type.";
+     }
+
+    revision "2014-07-23" {
+        reference "Initial Revision.";
+    }
+
+    typedef yang-boolean {
+        type boolean;
+    }
+
+    typedef yang-empty {
+        type empty;
+    }
+
+    typedef yang-enumeration {
+        type enumeration {
+            enum a;
+            enum b;
+        }
+    }
+
+    typedef yang-int8 {
+        type int8;
+    }
+
+    typedef yang-int8-restricted {
+        type int8 {
+            range 1..100;
+        }
+    }
+
+    typedef yang-int16 {
+        type int16;
+    }
+
+    typedef yang-int32 {
+        type int32;
+    }
+
+    typedef yang-int64 {
+        type int64;
+    }
+
+    typedef yang-string {
+        type string;
+    }
+
+    typedef yang-decimal64 {
+        type decimal64 {
+            fraction-digits 2;
+        }
+    }
+
+    typedef yang-uint8 {
+        type uint8;
+    }
+
+    typedef yang-uint16 {
+        type uint16;
+    }
+
+    typedef yang-uint32 {
+        type uint32;
+    }
+
+    typedef yang-uint64 {
+        type uint64;
+    }
+
+    typedef yang-union {
+        type union {
+            type int32;
+            type int16;
+        }
+    }
+
+    typedef yang-binary {
+        type binary;
+    }
+
+    typedef yang-bits {
+        type bits {
+            bit disable-nagle {
+                position 0;
+            }
+            bit auto-sense-speed {
+                position 1;
+            }
+            bit only-10-Mb {
+                position 2;
+            }
+        }
+        default "auto-sense-speed";
+    }
+
+    typedef yang-instance-identifier {
+        type instance-identifier;
+    }
+}
index e9a6a780bf6eeeaf5b7d0866143f2b50c2e6eb6e..0168f84f5d2e705b560df9a5319bcb053b4c0543 100644 (file)
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-spi</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.mdsal</groupId>
+            <artifactId>mdsal-binding-generator-impl</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.mdsal</groupId>
             <artifactId>mdsal-binding-dom-adapter</artifactId>