Merge "Bug 584: Test coverage increase"
authorTony Tkacik <ttkacik@cisco.com>
Fri, 17 Oct 2014 09:04:12 +0000 (09:04 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 17 Oct 2014 09:04:12 +0000 (09:04 +0000)
28 files changed:
code-generator/binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/BindingGeneratorImpl.java
code-generator/binding-generator-util/src/main/java/org/opendaylight/yangtools/binding/generator/util/Types.java
code-generator/binding-generator-util/src/main/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/AbstractGeneratedTypeBuilder.java
code-generator/binding-generator-util/src/main/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/AbstractTypeMemberBuilder.java
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/BindingGeneratorUtilTest.java
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/AbstractGeneratedTypeBuilderTest.java [new file with mode: 0644]
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyBuilderImplTest.java [new file with mode: 0644]
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyImplTest.java [new file with mode: 0644]
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureBuilderTest.java [new file with mode: 0644]
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureImplTest.java [new file with mode: 0644]
code-generator/binding-type-provider/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/BaseYangTypes.java
code-generator/binding-type-provider/src/main/java/org/opendaylight/yangtools/sal/binding/yang/types/TypeProviderImpl.java
code-generator/maven-sal-api-gen-plugin/pom.xml
code-generator/pom.xml
common/artifacts/pom.xml [new file with mode: 0644]
common/features-builder/pom.xml [new file with mode: 0644]
common/features/pom.xml
common/features/src/main/feature/features.xml [moved from common/features/src/main/resources/features.xml with 60% similarity]
common/parent/pom.xml
common/pom.xml
integration-test/bug1196-test-model/pom.xml
integration-test/bundle-test/pom.xml
model/ietf/pom.xml
yang/yang-data-codec-gson/src/main/java/org/opendaylight/yangtools/yang/data/codec/gson/JSONNormalizedNodeStreamWriter.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/NormalizedNodeToJsonStreamTest.java
yang/yang-data-codec-gson/src/test/java/org/opendaylight/yangtools/yang/data/codec/gson/TestingNormalizedNodeStructuresCreator.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/DerivableSchemaNode.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/repo/DependencyResolver.java

index 0b45713b56dbe1da209cfac1bd7b51280bcfb8f7..00abec0db68d4006ec7561bf4b9174ddd66ee7ab 100644 (file)
@@ -1928,7 +1928,7 @@ public class BindingGeneratorImpl implements BindingGenerator {
             }
 
             final GeneratedPropertyBuilder genPropBuilder = resultTOBuilder.addProperty("value");
-            genPropBuilder.setReturnType(Types.primitiveType("char[]", null));
+            genPropBuilder.setReturnType(Types.CHAR_ARRAY);
             resultTOBuilder.addEqualsIdentity(genPropBuilder);
             resultTOBuilder.addHashIdentity(genPropBuilder);
             resultTOBuilder.addToStringProperty(genPropBuilder);
index 91d56a3562bbcfcdff2f62e263c46e7e05fc3085..605c989bbad18f52111d62e9677299ee110711de 100644 (file)
@@ -7,6 +7,9 @@
  */
 package org.opendaylight.yangtools.binding.generator.util;
 
+import com.google.common.cache.CacheBuilder;
+import com.google.common.cache.CacheLoader;
+import com.google.common.cache.LoadingCache;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
@@ -21,6 +24,16 @@ import org.opendaylight.yangtools.yang.binding.Augmentable;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
 
 public final class Types {
+    private static final CacheLoader<Class<?>, ConcreteType> TYPE_LOADER =
+            new CacheLoader<Class<?>, ConcreteType>() {
+                @Override
+                public ConcreteType load(final Class<?> key) {
+                    return new ConcreteTypeImpl(key.getPackage().getName(), key.getSimpleName(), null);
+                }
+    };
+    private static final LoadingCache<Class<?>, ConcreteType> TYPE_CACHE =
+            CacheBuilder.newBuilder().weakKeys().softValues().build(TYPE_LOADER);
+
     private static final Type SET_TYPE = typeForClass(Set.class);
     private static final Type LIST_TYPE = typeForClass(List.class);
     private static final Type MAP_TYPE = typeForClass(Map.class);
@@ -29,6 +42,8 @@ public final class Types {
     public static final ConcreteType FUTURE = typeForClass(Future.class);
     public static final ConcreteType STRING = typeForClass(String.class);
     public static final ConcreteType VOID = typeForClass(Void.class);
+    public static final ConcreteType BYTE_ARRAY = primitiveType("byte[]", null);
+    public static final ConcreteType CHAR_ARRAY = primitiveType("char[]", null);
 
     /**
      * It is not desirable to create instance of this class
@@ -55,12 +70,12 @@ public final class Types {
      * doesn't exist.
      *
      * @param primitiveType
-     *            string containing programaticall construction based on
+     *            string containing programmatic construction based on
      *            primitive type (e.g byte[])
-     * @return <code>ConcreteType</code> instance which represents programatic
+     * @return <code>ConcreteType</code> instance which represents programmatic
      *         construction with primitive JAVA type
      */
-    public static Type primitiveType(final String primitiveType, final Restrictions restrictions) {
+    public static ConcreteType primitiveType(final String primitiveType, final Restrictions restrictions) {
         return new ConcreteTypeImpl("", primitiveType, restrictions);
     }
 
@@ -71,12 +86,16 @@ public final class Types {
      *            Class to describe
      * @return Description of class
      */
-    public static ConcreteType typeForClass(Class<?> cls) {
-        return typeForClass(cls, null);
+    public static ConcreteType typeForClass(final Class<?> cls) {
+        return TYPE_CACHE.getUnchecked(cls);
     }
 
-    public static ConcreteType typeForClass(Class<?> cls, Restrictions restrictions) {
-        return new ConcreteTypeImpl(cls.getPackage().getName(), cls.getSimpleName(), restrictions);
+    public static ConcreteType typeForClass(final Class<?> cls, final Restrictions restrictions) {
+        if (restrictions != null) {
+            return new ConcreteTypeImpl(cls.getPackage().getName(), cls.getSimpleName(), restrictions);
+        } else {
+            return typeForClass(cls);
+        }
     }
 
     /**
@@ -89,7 +108,7 @@ public final class Types {
      *            Value Type
      * @return Description of generic type instance
      */
-    public static ParameterizedType mapTypeFor(Type keyType, Type valueType) {
+    public static ParameterizedType mapTypeFor(final Type keyType, final Type valueType) {
         return parameterizedTypeFor(MAP_TYPE, keyType, valueType);
     }
 
@@ -101,7 +120,7 @@ public final class Types {
      *            Value Type
      * @return Description of generic type instance of Set
      */
-    public static ParameterizedType setTypeFor(Type valueType) {
+    public static ParameterizedType setTypeFor(final Type valueType) {
         return parameterizedTypeFor(SET_TYPE, valueType);
     }
 
@@ -113,7 +132,7 @@ public final class Types {
      *            Value Type
      * @return Description of type instance of List
      */
-    public static ParameterizedType listTypeFor(Type valueType) {
+    public static ParameterizedType listTypeFor(final Type valueType) {
         return parameterizedTypeFor(LIST_TYPE, valueType);
     }
 
@@ -129,7 +148,7 @@ public final class Types {
      * @return <code>ParametrizedType</code> reprezentation of <code>type</code>
      *         and its parameters <code>parameters</code>
      */
-    public static ParameterizedType parameterizedTypeFor(Type type, Type... parameters) {
+    public static ParameterizedType parameterizedTypeFor(final Type type, final Type... parameters) {
         return new ParametrizedTypeImpl(type, parameters);
     }
 
@@ -142,10 +161,10 @@ public final class Types {
      *            string with the package name
      * @param typeName
      *            string with the type name
-     * @return <code>WildcardType</code> reprezentation of
+     * @return <code>WildcardType</code> representation of
      *         <code>packageName</code> and <code>typeName</code>
      */
-    public static WildcardType wildcardTypeFor(String packageName, String typeName) {
+    public static WildcardType wildcardTypeFor(final String packageName, final String typeName) {
         return new WildcardTypeImpl(packageName, typeName);
     }
 
@@ -158,11 +177,11 @@ public final class Types {
      *
      * @param valueType
      *            JAVA <code>Type</code> with actual parameter
-     * @return <code>ParametrizedType</code> reprezentation of raw type
+     * @return <code>ParametrizedType</code> representation of raw type
      *         <code>Augmentable</code> with actual parameter
      *         <code>valueType</code>
      */
-    public static ParameterizedType augmentableTypeFor(Type valueType) {
+    public static ParameterizedType augmentableTypeFor(final Type valueType) {
         final Type augmentable = typeForClass(Augmentable.class);
         return parameterizedTypeFor(augmentable, valueType);
     }
@@ -180,7 +199,7 @@ public final class Types {
      *         <code>Augmentation</code> with actual parameter
      *         <code>valueType</code>
      */
-    public static ParameterizedType augmentationTypeFor(Type valueType) {
+    public static ParameterizedType augmentationTypeFor(final Type valueType) {
         final Type augmentation = typeForClass(Augmentation.class);
         return parameterizedTypeFor(augmentation, valueType);
     }
@@ -202,7 +221,7 @@ public final class Types {
          * @param name
          *            string with the name of the type
          */
-        private ConcreteTypeImpl(String pkName, String name, Restrictions restrictions) {
+        private ConcreteTypeImpl(final String pkName, final String name, final Restrictions restrictions) {
             super(pkName, name);
             this.restrictions = restrictions;
         }
@@ -222,12 +241,12 @@ public final class Types {
         /**
          * Array of JAVA actual type parameters.
          */
-        private Type[] actualTypes;
+        private final Type[] actualTypes;
 
         /**
          * JAVA raw type (like List, Set, Map...)
          */
-        private Type rawType;
+        private final Type rawType;
 
         @Override
         public Type[] getActualTypeArguments() {
@@ -249,7 +268,7 @@ public final class Types {
          * @param actTypes
          *            array of actual parameters
          */
-        public ParametrizedTypeImpl(Type rawType, Type[] actTypes) {
+        public ParametrizedTypeImpl(final Type rawType, final Type[] actTypes) {
             super(rawType.getPackageName(), rawType.getName());
             this.rawType = rawType;
             this.actualTypes = Arrays.copyOf(actTypes, actTypes.length);
@@ -271,7 +290,7 @@ public final class Types {
          * @param typeName
          *            string with the name of type
          */
-        public WildcardTypeImpl(String packageName, String typeName) {
+        public WildcardTypeImpl(final String packageName, final String typeName) {
             super(packageName, typeName);
         }
     }
index b80ada0f2f5a19c32519148541c6e83dd0e7c38e..d98a9600cd5c6a3f5c1984089919f827590f6490 100644 (file)
@@ -169,6 +169,7 @@ abstract class AbstractGeneratedTypeBuilder<T extends GeneratedTypeBuilderBase<T
 
     @Override
     public GeneratedPropertyBuilder addProperty(final String name) {
+        Preconditions.checkArgument(name != null, "Parameter name can't be null");
         final GeneratedPropertyBuilder builder = new GeneratedPropertyBuilderImpl(name);
         builder.setAccessModifier(AccessModifier.PUBLIC);
         properties = LazyCollections.lazyAdd(properties, builder);
index cb84ac2ea8d2a5a50c80665f7dd0a3899fc3a9d3..849df263e5eef79d6c76f2e0ca3fc3d81b44555f 100644 (file)
@@ -143,7 +143,7 @@ abstract class AbstractTypeMemberBuilder<T extends TypeMemberBuilder<T>> impleme
         if (getClass() != obj.getClass()) {
             return false;
         }
-        MethodSignatureBuilderImpl other = (MethodSignatureBuilderImpl) obj;
+        AbstractTypeMemberBuilder<?> other = (AbstractTypeMemberBuilder<?>) obj;
         if (getName() == null) {
             if (other.getName() != null) {
                 return false;
index ef268c7ed998cef2e10637677fe3828b351a8531..413856eb65493b61125a4bd1f225aadf869dd23a 100644 (file)
@@ -7,24 +7,45 @@
  */
 package org.opendaylight.yangtools.binding.generator.util;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.io.IOException;
+import java.io.Serializable;
+import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
+
+import com.google.common.base.Optional;
+
 import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.generated.type.builder.GeneratedTypeBuilderImpl;
+import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier;
+import org.opendaylight.yangtools.sal.binding.model.api.Restrictions;
+import org.opendaylight.yangtools.sal.binding.model.api.type.builder.MethodSignatureBuilder;
 import org.opendaylight.yangtools.yang.binding.BindingMapping;
+import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.DecimalTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
+import org.opendaylight.yangtools.yang.model.api.type.PatternConstraint;
+import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
+import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinition;
 import org.opendaylight.yangtools.yang.model.parser.api.YangContextParser;
+import org.opendaylight.yangtools.yang.model.util.BaseConstraints;
 import org.opendaylight.yangtools.yang.model.util.DataNodeIterator;
+import org.opendaylight.yangtools.yang.model.util.Decimal64;
+import org.opendaylight.yangtools.yang.model.util.ExtendedType;
+import org.opendaylight.yangtools.yang.model.util.ExtendedType.Builder;
+import org.opendaylight.yangtools.yang.model.util.Int16;
+import org.opendaylight.yangtools.yang.model.util.StringType;
+import org.opendaylight.yangtools.yang.model.util.Uint16;
 import org.opendaylight.yangtools.yang.parser.builder.impl.ModuleBuilder;
 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
 
@@ -162,4 +183,129 @@ public class BindingGeneratorUtilTest {
                 BindingGeneratorUtil.parseToValidParamName("  0some-testing_parameter   name   "));
     }
 
+    @Test
+    public void computeDefaultSUIDTest() {
+        GeneratedTypeBuilderImpl generatedTypeBuilder = new GeneratedTypeBuilderImpl("my.package", "MyName");
+
+        MethodSignatureBuilder method = generatedTypeBuilder.addMethod("myMethodName");
+        method.setAccessModifier(AccessModifier.PUBLIC);
+        generatedTypeBuilder.addProperty("myProperty");
+        generatedTypeBuilder.addImplementsType(Types.typeForClass(Serializable.class));
+
+        assertEquals(6788238694991761868L, BindingGeneratorUtil.computeDefaultSUID(generatedTypeBuilder));
+
+    }
+
+    @Test
+    public void getRestrictionsTest() {
+
+        Optional<String> absent = Optional.absent();
+
+        Builder extTypeBuilder = ExtendedType.builder(new QName(URI.create("namespace"), "localName"),
+                Int16.getInstance(), absent, absent, SchemaPath.create(true, QName.create("/root")));
+
+        ArrayList<LengthConstraint> lenght = new ArrayList<LengthConstraint>();
+        ArrayList<RangeConstraint> range = new ArrayList<RangeConstraint>();
+        ArrayList<PatternConstraint> pattern = new ArrayList<PatternConstraint>();
+
+        lenght.add(BaseConstraints.newLengthConstraint(1, 2, absent, absent));
+        range.add(BaseConstraints.newRangeConstraint(1, 2, absent, absent));
+        pattern.add(BaseConstraints.newPatternConstraint(".*", absent, absent));
+
+        extTypeBuilder.lengths(lenght);
+        extTypeBuilder.ranges(range);
+        extTypeBuilder.patterns(pattern);
+
+        Restrictions restrictions = BindingGeneratorUtil.getRestrictions(extTypeBuilder.build());
+
+        assertNotNull(restrictions);
+
+        assertEquals(1, restrictions.getLengthConstraints().size());
+        assertEquals(1, restrictions.getRangeConstraints().size());
+        assertEquals(1, restrictions.getPatternConstraints().size());
+
+        assertFalse(restrictions.isEmpty());
+        assertTrue(restrictions.getLengthConstraints().contains(
+                BaseConstraints.newLengthConstraint(1, 2, absent, absent)));
+        assertTrue(restrictions.getRangeConstraints()
+                .contains(BaseConstraints.newRangeConstraint(1, 2, absent, absent)));
+        assertTrue(restrictions.getPatternConstraints().contains(
+                BaseConstraints.newPatternConstraint(".*", absent, absent)));
+    }
+
+    @Test
+    public void getEmptyRestrictionsTest() {
+
+        Optional<String> absent = Optional.absent();
+
+        Builder extTypeBuilder = ExtendedType.builder(new QName(URI.create("namespace"), "localName"),
+                StringType.getInstance(), absent, absent, SchemaPath.create(true, QName.create("/root")));
+
+        Restrictions restrictions = BindingGeneratorUtil.getRestrictions(extTypeBuilder.build());
+
+        assertNotNull(restrictions);
+        assertTrue(restrictions.isEmpty());
+
+    }
+
+    @Test
+    public void getDefaultIntegerRestrictionsTest() {
+
+        Optional<String> absent = Optional.absent();
+
+        Builder extTypeBuilder = ExtendedType.builder(new QName(URI.create("namespace"), "localName"),
+                Int16.getInstance(), absent, absent, SchemaPath.create(true, QName.create("/root")));
+
+        ExtendedType extType = extTypeBuilder.build();
+        Restrictions restrictions = BindingGeneratorUtil.getRestrictions(extType);
+
+        assertNotNull(restrictions);
+        assertFalse(restrictions.isEmpty());
+        assertEquals(((IntegerTypeDefinition) extType.getBaseType()).getRangeConstraints(),
+                restrictions.getRangeConstraints());
+        assertTrue(restrictions.getLengthConstraints().isEmpty());
+        assertTrue(restrictions.getPatternConstraints().isEmpty());
+
+    }
+
+    @Test
+    public void getDefaultUnsignedIntegerRestrictionsTest() {
+
+        Optional<String> absent = Optional.absent();
+
+        Builder extTypeBuilder = ExtendedType.builder(new QName(URI.create("namespace"), "localName"),
+                Uint16.getInstance(), absent, absent, SchemaPath.create(true, QName.create("/root")));
+
+        ExtendedType extType = extTypeBuilder.build();
+        Restrictions restrictions = BindingGeneratorUtil.getRestrictions(extType);
+
+        assertNotNull(restrictions);
+        assertFalse(restrictions.isEmpty());
+        assertEquals(((UnsignedIntegerTypeDefinition) extType.getBaseType()).getRangeConstraints(),
+                restrictions.getRangeConstraints());
+        assertTrue(restrictions.getLengthConstraints().isEmpty());
+        assertTrue(restrictions.getPatternConstraints().isEmpty());
+    }
+
+    @Test
+    public void getDefaultDecimalRestrictionsTest() {
+
+        Optional<String> absent = Optional.absent();
+        SchemaPath path = SchemaPath.create(true, QName.create("/root"));
+
+        Builder extTypeBuilder = ExtendedType.builder(new QName(URI.create("namespace"), "localName"),
+                Decimal64.create(path, 10), absent, absent, path);
+
+        ExtendedType extType = extTypeBuilder.build();
+        Restrictions restrictions = BindingGeneratorUtil.getRestrictions(extType);
+
+        assertNotNull(restrictions);
+        assertFalse(restrictions.isEmpty());
+        assertEquals(((DecimalTypeDefinition) extType.getBaseType()).getRangeConstraints(),
+                restrictions.getRangeConstraints());
+        assertTrue(restrictions.getLengthConstraints().isEmpty());
+        assertTrue(restrictions.getPatternConstraints().isEmpty());
+
+    }
+
 }
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/AbstractGeneratedTypeBuilderTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/AbstractGeneratedTypeBuilderTest.java
new file mode 100644 (file)
index 0000000..8cf6967
--- /dev/null
@@ -0,0 +1,17 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ */
+package org.opendaylight.yangtools.binding.generator.util.generated.type.builder;
+
+import org.junit.Test;
+
+public class AbstractGeneratedTypeBuilderTest {
+
+    @Test(expected = IllegalArgumentException.class)
+    public void addPropertyIllegalArgumentTest() {
+        GeneratedTypeBuilderImpl generatedTypeBuilder = new GeneratedTypeBuilderImpl("my.package", "MyName");
+
+        generatedTypeBuilder.addProperty(null);
+    }
+
+}
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyBuilderImplTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyBuilderImplTest.java
new file mode 100644 (file)
index 0000000..0bcd513
--- /dev/null
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ */
+package org.opendaylight.yangtools.binding.generator.util.generated.type.builder;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.Types;
+import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier;
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+
+public class GeneratedPropertyBuilderImplTest {
+
+    @Test
+    public void generatedPropertyBuilderImplTest() {
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl = new GeneratedPropertyBuilderImpl("myPropertyName");
+        generatedPropertyBuilderImpl.setValue("myValue");
+        generatedPropertyBuilderImpl.setReadOnly(false);
+        generatedPropertyBuilderImpl.setStatic(true);
+        generatedPropertyBuilderImpl.setComment(null);
+        generatedPropertyBuilderImpl.setFinal(true);
+        generatedPropertyBuilderImpl.setAccessModifier(AccessModifier.PUBLIC);
+        generatedPropertyBuilderImpl.setReturnType(Types.BOOLEAN);
+
+        assertEquals(
+                "GeneratedPropertyImpl [name=myPropertyName, annotations=[], comment=null, returnType=Type (java.lang.Boolean), isFinal=true, isReadOnly=false, modifier=PUBLIC]",
+                generatedPropertyBuilderImpl.toString());
+
+        GeneratedProperty instance = generatedPropertyBuilderImpl.toInstance(null);
+
+        assertNotNull(instance);
+
+        assertTrue(instance.isFinal());
+        assertTrue(instance.isStatic());
+        assertFalse(instance.isReadOnly());
+        assertEquals("myValue", instance.getValue());
+        assertEquals(null, instance.getComment());
+        assertEquals(AccessModifier.PUBLIC, instance.getAccessModifier());
+        assertEquals(Types.BOOLEAN, instance.getReturnType());
+
+    }
+
+    @Test
+    public void generatedPropertyBuilderImplEqualsAndHashCodeTest() {
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl = new GeneratedPropertyBuilderImpl("myPropertyName");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl2 = new GeneratedPropertyBuilderImpl("myPropertyName");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl3 = new GeneratedPropertyBuilderImpl("myPropertyName3");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl4 = new GeneratedPropertyBuilderImpl("myPropertyName");
+
+        assertNotNull(generatedPropertyBuilderImpl);
+        assertNotNull(generatedPropertyBuilderImpl2);
+        assertNotNull(generatedPropertyBuilderImpl3);
+        assertNotNull(generatedPropertyBuilderImpl4);
+
+        generatedPropertyBuilderImpl.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl2.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl3.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl4.setReturnType(Types.STRING);
+
+        assertFalse(generatedPropertyBuilderImpl.equals(null));
+        assertFalse(generatedPropertyBuilderImpl.equals(new Object()));
+        assertTrue(generatedPropertyBuilderImpl.equals(generatedPropertyBuilderImpl));
+        assertTrue(generatedPropertyBuilderImpl.equals(generatedPropertyBuilderImpl2));
+        assertFalse(generatedPropertyBuilderImpl.equals(generatedPropertyBuilderImpl3));
+        assertFalse(generatedPropertyBuilderImpl.equals(generatedPropertyBuilderImpl4));
+
+        assertTrue(generatedPropertyBuilderImpl.hashCode() == generatedPropertyBuilderImpl.hashCode());
+        assertTrue(generatedPropertyBuilderImpl.hashCode() == generatedPropertyBuilderImpl2.hashCode());
+        assertFalse(generatedPropertyBuilderImpl.hashCode() == generatedPropertyBuilderImpl3.hashCode());
+        assertFalse(generatedPropertyBuilderImpl.hashCode() == generatedPropertyBuilderImpl4.hashCode());
+    }
+
+}
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyImplTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedPropertyImplTest.java
new file mode 100644 (file)
index 0000000..01572ab
--- /dev/null
@@ -0,0 +1,80 @@
+/**
+ * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
+ */
+package org.opendaylight.yangtools.binding.generator.util.generated.type.builder;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.Types;
+import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier;
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedProperty;
+
+public class GeneratedPropertyImplTest {
+
+    @Test
+    public void generatedPropertyImplTest() {
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl = new GeneratedPropertyBuilderImpl("myPropertyName");
+        generatedPropertyBuilderImpl.setValue("myValue");
+        generatedPropertyBuilderImpl.setReadOnly(false);
+        generatedPropertyBuilderImpl.setStatic(true);
+        generatedPropertyBuilderImpl.setComment("myComment");
+        generatedPropertyBuilderImpl.setFinal(true);
+        generatedPropertyBuilderImpl.setAccessModifier(AccessModifier.PUBLIC);
+        generatedPropertyBuilderImpl.setReturnType(Types.BOOLEAN);
+
+        GeneratedProperty instance = generatedPropertyBuilderImpl.toInstance(new GeneratedTypeBuilderImpl("my.package",
+                "myTypeName").toInstance());
+
+        assertNotNull(instance);
+
+        assertTrue(instance.isFinal());
+        assertTrue(instance.isStatic());
+        assertFalse(instance.isReadOnly());
+        assertEquals("myValue", instance.getValue());
+        assertEquals("myComment", instance.getComment());
+        assertEquals(AccessModifier.PUBLIC, instance.getAccessModifier());
+        assertEquals(Types.BOOLEAN, instance.getReturnType());
+
+        assertEquals(
+                "GeneratedPropertyImpl [name=myPropertyName, annotations=[], comment=myComment, parent=my.package.myTypeName, returnType=Type (java.lang.Boolean), isFinal=true, isReadOnly=false, modifier=PUBLIC]",
+                instance.toString());
+
+    }
+
+    @Test
+    public void generatedPropertyImplEqualsAndHashCodeTest() {
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl = new GeneratedPropertyBuilderImpl("myPropertyName");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl2 = new GeneratedPropertyBuilderImpl("myPropertyName");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl3 = new GeneratedPropertyBuilderImpl("myPropertyName3");
+        GeneratedPropertyBuilderImpl generatedPropertyBuilderImpl4 = new GeneratedPropertyBuilderImpl("myPropertyName");
+
+        generatedPropertyBuilderImpl.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl2.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl3.setReturnType(Types.BOOLEAN);
+        generatedPropertyBuilderImpl4.setReturnType(Types.STRING);
+
+        GeneratedProperty property = generatedPropertyBuilderImpl.toInstance(null);
+        GeneratedProperty property2 = generatedPropertyBuilderImpl2.toInstance(null);
+        GeneratedProperty property3 = generatedPropertyBuilderImpl3.toInstance(null);
+        GeneratedProperty property4 = generatedPropertyBuilderImpl4.toInstance(null);
+
+        assertNotNull(property);
+        assertNotNull(property2);
+        assertNotNull(property3);
+        assertNotNull(property4);
+
+        assertFalse(property.equals(null));
+        assertFalse(property.equals(new Object()));
+        assertTrue(property.equals(property));
+        assertTrue(property.equals(property2));
+        assertFalse(property.equals(property3));
+        assertFalse(property.equals(property4));
+
+        assertTrue(property.hashCode() == property.hashCode());
+        assertTrue(property.hashCode() == property2.hashCode());
+        assertFalse(property.hashCode() == property3.hashCode());
+        assertFalse(property.hashCode() == property4.hashCode());
+    }
+
+}
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureBuilderTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureBuilderTest.java
new file mode 100644 (file)
index 0000000..433e94f
--- /dev/null
@@ -0,0 +1,72 @@
+/*
+ * 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.yangtools.binding.generator.util.generated.type.builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.Types;
+import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+import org.opendaylight.yangtools.sal.binding.model.api.type.builder.MethodSignatureBuilder;
+
+public class MethodSignatureBuilderTest {
+
+    MethodSignatureBuilder builder1, builder2, builder3, builder4;
+    int hash1, hash2, hash3;
+
+    @Before
+    public void setup() {
+        builder1 = new MethodSignatureBuilderImpl("methodSignature");
+        builder2 = new MethodSignatureBuilderImpl("otherMethodSignature");
+        builder2.setReturnType(Types.STRING);
+        builder3 = new MethodSignatureBuilderImpl(null);
+        builder3.setAbstract(false);
+        builder4 = new MethodSignatureBuilderImpl("otherMethodSignature");
+        builder4.setReturnType(Types.BOOLEAN);
+
+        hash1 = builder1.hashCode();
+        hash2 = builder2.hashCode();
+        hash3 = builder3.hashCode();
+    }
+
+    @Test
+    public void testAddParameter() {
+        Type type = Types.STRING;
+        String name = "customParam";
+        builder1.addParameter(type, name);
+        Type methodType = Types.voidType();
+        MethodSignature signature = builder1.toInstance(methodType);
+        assertNotNull(signature);
+    }
+
+    @Test
+    public void testToString() {
+        String toString = builder1.toString();
+        assertTrue(toString.contains("MethodSignatureBuilderImpl"));
+    }
+
+    @Test
+    public void testHashCode() {
+        assertEquals(hash1, hash1);
+    }
+
+    @Test
+    public void testEquals() {
+        assertTrue(builder1.equals(builder1));
+        assertFalse(builder1.equals(builder2));
+        assertFalse(builder1.equals(null));
+        assertFalse(builder1.equals("string"));
+        assertFalse(builder3.equals(builder2));
+        assertFalse(builder4.equals(builder2));
+    }
+}
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureImplTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodSignatureImplTest.java
new file mode 100644 (file)
index 0000000..f7ef7b1
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * 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.yangtools.binding.generator.util.generated.type.builder;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.Types;
+import org.opendaylight.yangtools.sal.binding.model.api.AccessModifier;
+import org.opendaylight.yangtools.sal.binding.model.api.AnnotationType;
+import org.opendaylight.yangtools.sal.binding.model.api.MethodSignature.Parameter;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+
+public class MethodSignatureImplTest {
+
+    MethodSignatureImpl signature1, signature2, signature3, signature4;
+    int hash1, hash4;
+
+    @Before
+    public void setup() {
+        Type type = Types.STRING;
+        String name = "customMethod";
+        List<AnnotationType> annotations = new ArrayList<>();
+        String comment = "This is just a comment";
+        AccessModifier accessModifier = AccessModifier.PUBLIC;
+        Type returnType = Types.STRING;
+        List<Parameter> params = new ArrayList<>();
+        boolean isFinal = false;
+        boolean isAbstract = false;
+        boolean isStatic = false;
+
+        signature1 = new MethodSignatureImpl(type, name, annotations, comment,
+                accessModifier, returnType, params, isFinal, isAbstract,
+                isStatic);
+        signature2 = new MethodSignatureImpl(type, name, annotations, comment,
+                accessModifier, returnType, params, isFinal, isAbstract,
+                isStatic);
+        returnType = null;
+        signature3 = new MethodSignatureImpl(type, name, annotations, comment,
+                accessModifier, returnType, params, isFinal, isAbstract,
+                isStatic);
+        name = null;
+        signature4 = new MethodSignatureImpl(type, name, annotations, comment,
+                accessModifier, returnType, params, isFinal, isAbstract,
+                isStatic);
+
+        hash1 = signature1.hashCode();
+        hash4 = signature4.hashCode();
+    }
+
+    @Test
+    public void testToString() {
+        String toString = signature1.toString();
+        assertTrue(toString.contains("MethodSignatureImpl"));
+    }
+
+    @Test
+    public void testHashCode() {
+        assertEquals(hash1, hash1);
+        assertTrue(!(hash1 == hash4));
+    }
+
+    @Test
+    public void testEquals() {
+        assertTrue(signature1.equals(signature1));
+        assertTrue(signature1.equals(signature2));
+        assertFalse(signature1.equals(signature3));
+        assertFalse(signature3.equals(signature1));
+        assertFalse(signature1.equals(null));
+        assertFalse(signature1.equals(signature4));
+        assertFalse(signature4.equals(signature1));
+        assertFalse(signature1.equals(Types.STRING));
+    }
+
+}
index 86b40c027efada8b0e20fe16e2f421f1e31d65e8..987850821c582ecb2284fc507fe333117edf4f5d 100644 (file)
@@ -144,7 +144,7 @@ public final class BaseYangTypes {
          * @return java <code>Type</code> representation of <code>type</code>
          */
         @Override
-        public Type javaTypeForYangType(String type) {
+        public Type javaTypeForYangType(final String type) {
             return typeMap.get(type);
         }
 
@@ -159,7 +159,7 @@ public final class BaseYangTypes {
          *         returned.
          */
         @Override
-        public Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode) {
+        public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode) {
             if (type != null) {
                 return typeMap.get(type.getQName().getLocalName());
             }
@@ -168,12 +168,12 @@ public final class BaseYangTypes {
         }
 
         @Override
-        public Type javaTypeForSchemaDefinitionType(TypeDefinition<?> type, SchemaNode parentNode,
-                Restrictions restrictions) {
+        public Type javaTypeForSchemaDefinitionType(final TypeDefinition<?> type, final SchemaNode parentNode,
+                final Restrictions restrictions) {
             String typeName = type.getQName().getLocalName();
             switch (typeName) {
             case "binary":
-                return Types.primitiveType("byte[]", restrictions);
+                return restrictions == null ? Types.BYTE_ARRAY : Types.primitiveType("byte[]", restrictions);
             case "decimal64":
                 return Types.typeForClass(BigDecimal.class, restrictions);
             case "enumeration":
@@ -204,17 +204,17 @@ public final class BaseYangTypes {
         }
 
         @Override
-        public String getTypeDefaultConstruction(LeafSchemaNode node) {
+        public String getTypeDefaultConstruction(final LeafSchemaNode node) {
             return null;
         }
 
         @Override
-        public String getConstructorPropertyName(SchemaNode node) {
+        public String getConstructorPropertyName(final SchemaNode node) {
             return null;
         }
 
         @Override
-        public String getParamNameFromType(TypeDefinition<?> type) {
+        public String getParamNameFromType(final TypeDefinition<?> type) {
             return "_" + BindingGeneratorUtil.parseToValidParamName(type.getQName().getLocalName());
         }
     };
index 8f57b987ea868a4da017067a6cb6e3e5a2394b19..dd3038baca608d4e9489fcde2a59509d6ad9b0a1 100644 (file)
@@ -13,7 +13,6 @@ import static org.opendaylight.yangtools.binding.generator.util.BindingGenerator
 import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNode;
 import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findDataSchemaNodeForRelativeXPath;
 import static org.opendaylight.yangtools.yang.model.util.SchemaContextUtil.findParentModule;
-
 import com.google.common.base.Preconditions;
 import com.google.common.collect.Sets;
 import com.google.common.io.BaseEncoding;
@@ -220,7 +219,7 @@ public final class TypeProviderImpl implements TypeProvider {
         return returnType;
     }
 
-    private GeneratedTransferObject shadedTOWithRestrictions(GeneratedTransferObject gto, Restrictions r) {
+    private GeneratedTransferObject shadedTOWithRestrictions(final GeneratedTransferObject gto, final Restrictions r) {
         GeneratedTOBuilder gtob = new GeneratedTOBuilderImpl(gto.getPackageName(), gto.getName());
         GeneratedTransferObject parent = gto.getSuperType();
         if (parent != null) {
@@ -805,7 +804,7 @@ public final class TypeProviderImpl implements TypeProvider {
         }
 
         final GeneratedPropertyBuilder genPropBuilder = resultTOBuilder.addProperty("value");
-        genPropBuilder.setReturnType(Types.primitiveType("char[]", null));
+        genPropBuilder.setReturnType(Types.CHAR_ARRAY);
         resultTOBuilder.addEqualsIdentity(genPropBuilder);
         resultTOBuilder.addHashIdentity(genPropBuilder);
         resultTOBuilder.addToStringProperty(genPropBuilder);
index f8ccd295a21b245bc927a267b9821857177939cf..ec862465669992981b907c253a7a25a1b664ca06 100644 (file)
             <artifactId>plexus-slf4j-logging</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.sonatype.sisu</groupId>
+            <artifactId>sisu-guava</artifactId>
+            <version>0.11.1</version>
+            <scope>runtime</scope>
+        </dependency>
+
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
index c7f3dfd306e41bb7c36f98c6aa852966a2ac7b57..b0538883de70258d4955ee625581814d14fc2182 100644 (file)
         <module>binding-data-codec</module>
     </modules>
 
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.javassist</groupId>
-                <artifactId>javassist</artifactId>
-                <version>${javassist.version}</version>
-            </dependency>
-
-            <!-- Local Dependencies -->
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-test-model</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-model-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-spi</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-util</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-impl</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-java-api-generator</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>maven-sal-api-gen-plugin</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-
-            <!-- YANG Utilities and Parser -->
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-common</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-impl</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-util</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-util</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-binding</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-parser-api</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-parser-impl</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-maven-plugin</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-maven-plugin-spi</artifactId>
-                <version>${project.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <build>
         <pluginManagement>
             <plugins>
diff --git a/common/artifacts/pom.xml b/common/artifacts/pom.xml
new file mode 100644 (file)
index 0000000..a58b447
--- /dev/null
@@ -0,0 +1,333 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ 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
+-->
+<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">
+
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.opendaylight.yangtools</groupId>
+    <artifactId>yangtools-artifacts</artifactId>
+    <version>0.7.0-SNAPSHOT</version>
+    <packaging>pom</packaging>
+
+    <prerequisites>
+        <maven>3.0.4</maven>
+    </prerequisites>
+
+    <properties>
+        <!-- Model versions -->
+        <ietf.topology.version>2013.10.21.7-SNAPSHOT</ietf.topology.version>
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>maven-sal-api-gen-plugin</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.thirdparty</groupId>
+                <artifactId>antlr4-runtime-osgi-nohead</artifactId>
+                <version>4.0</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.thirdparty</groupId>
+                <artifactId>xtend-lib-osgi</artifactId>
+                <version>2.4.3</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>concepts</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>object-cache-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>object-cache-guava</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>object-cache-noop</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-model-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-generator-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-generator-spi</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-generator-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-generator-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-java-api-generator</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-common</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-codec-gson</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-model-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-model-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-binding</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-parser-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-parser-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-maven-plugin-spi</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-inet-types</artifactId>
+                <version>2010.09.24.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-yang-types</artifactId>
+                <version>2010.09.24.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-yang-types-20130715</artifactId>
+                <version>2013.07.15.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-restconf</artifactId>
+                <version>2013.10.19.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-ted</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-topology</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-topology-isis</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-topology-l3-unicast-igp</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-topology-ospf</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>ietf-topology-l3-unicast</artifactId>
+                <version>${ietf.topology.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-composite-node</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-client-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-common</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-test-service</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-client-impl</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>restconf-jaxrs-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>bug527-test-model</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>bug1196-test-model</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>websocket-client</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>object-cache-api</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>object-cache-guava</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>object-cache-noop</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${project.groupId}</groupId>
+                <artifactId>util</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>opendaylight-l2-types</artifactId>
+                <version>2013.08.27.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools.model</groupId>
+                <artifactId>yang-ext</artifactId>
+                <version>2013.09.07.7-SNAPSHOT</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-type-provider</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yang-data-operations</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-data-codec</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>features-yangtools</artifactId>
+                <classifier>features</classifier>
+                <type>xml</type>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>mockito-configuration</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>binding-test-model</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>features-test</artifactId>
+                <version>${project.version}</version>
+                <scope>test</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+</project>
diff --git a/common/features-builder/pom.xml b/common/features-builder/pom.xml
new file mode 100644 (file)
index 0000000..0576893
--- /dev/null
@@ -0,0 +1,250 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: -->
+<!--
+ 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
+-->
+<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">
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.opendaylight.odlparent</groupId>
+        <artifactId>odlparent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.opendaylight.yangtools</groupId>
+    <artifactId>features-builder</artifactId>
+    <packaging>pom</packaging>
+    <version>0.7.0-SNAPSHOT</version>
+
+    <properties>
+        <features.file>features.xml</features.file>
+    </properties>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+
+        <pluginManagement>
+            <plugins>
+                <!-- generate dependencies versions -->
+                <plugin>
+                    <artifactId>maven-dependency-plugin</artifactId>
+                      <executions>
+                          <execution>
+                              <phase>generate-resources</phase>
+                              <goals><goal>resolve</goal></goals>
+                              <configuration>
+                                  <outputFile>${project.build.directory}/dependencies.txt</outputFile>
+                              </configuration>
+                          </execution>
+                      </executions>
+                </plugin>
+                <plugin>
+                    <groupId>com.alexecollins.maven.plugin</groupId>
+                    <artifactId>script-maven-plugin</artifactId>
+                    <version>1.0.0</version>
+                    <executions>
+                        <execution>
+                        <id>add-version-to-features</id>
+                        <phase>generate-resources</phase>
+                            <goals>
+                                 <goal>execute</goal>
+                            </goals>
+                            <configuration>
+                                <language>groovy</language>
+                                <script>
+                                    /**
+                                     * Placeholder, which is used in src/feature/features.xml
+                                     * to mark version which should be inserted from dependencies.
+                                     * Currently works only for bundle and configfile tags
+                                     * with mvn: url schema, and needs to be used 
+                                     * as third component of schema.
+                                     * eg. mvn:group/artefact/{{VERSION}}
+                                     */
+                                    def versionPlaceholder = "{{VERSION}}"
+                                    /**
+                                     * Path to features.xml which uses versionPlaceholder.
+                                     * This will be processed by this script.
+                                     *
+                                     */
+                                    def featureFilePath = "src/main/feature/features.xml"
+                                    // Contains mapping of groupID:artefactID to versoin
+                                    def versionMap = new HashMap();
+                                    /* Loads transitive dependency list generated from
+                                     * maven-dependency-plugin resolve goal
+                                     * and populates map
+                                     */
+                                    def dependencies = new File(project.build.directory,"dependencies.txt")
+                                    dependencies.eachLine {
+                                        def cmps = it.trim().split(":")
+                                        // 0 - groupId
+                                        // 1 - artifactId
+                                        // 2 - Type
+                                        // 3 - Version
+                                        if(cmps.length >= 4) {
+                                            def id = cmps[0] + ":" + cmps[1]
+                                            versionMap[id] = cmps[3]
+                                        }
+                                    }
+
+                                    /*
+                                     * Takes splitted mvn: URL, looks for placeholder
+                                     * and returns new mvn: URL with version learned
+                                     * from dependency plugin.
+                                     *
+                                     * If referenced bundle is not dependency (direct or transitive)
+                                     * throws an exception and fails build.
+                                     *
+                                     */
+                                    def updatedURLFromProject = { args ->
+                                        // 0 - groupID, 1 - artifactID
+                                        // 2 - version, 3 - type, 4 - Classifier
+
+                                        def groupId = args[0];
+                                        def artifactId = args[1];
+                                        def id = groupId + ":" + artifactId
+                                        def dependencyVersion = versionMap[id]
+                                        if(dependencyVersion != null) {
+                                            // Overriding version
+                                            args[2] = dependencyVersion
+                                            return "mvn:" + args.join("/")
+                                        }
+                                        throw new IllegalArgumentException("Feature dependency $groupId:$artifactId is not dependecy of project.")
+                                    }
+
+
+                                    def updateMavenDependency  = { dep ->
+                                       def mvnUrl = dep.text()
+                                       if(mvnUrl.startsWith("mvn:")) {
+                                         def components =  mvnUrl.substring(4).split("/")
+                                         if(components[2] == versionPlaceholder) {
+                                         dep.value = updatedURLFromProject(components)
+                                         }
+                                       }
+                                    }
+
+                                    def featureFile = new File(project.basedir,featureFilePath)
+                                    def root = new XmlParser().parse(featureFile)
+
+                                    root.feature.each { feature ->
+                                        println "[INFO] Processing feature: ${feature.@name}"
+                                        feature.bundle.each updateMavenDependency
+                                        feature.configfile.each updateMavenDependency
+                                    }
+
+                                    def outDir = new File(project.build.directory,"generated-resources/script")
+                                    outDir.mkdirs();
+                                    def outFile = new File(outDir,"features.xml")
+                                    def outWriter = outFile.newPrintWriter("ASCII");
+                                    xmlPrinter = new XmlNodePrinter(outWriter);
+                                    xmlPrinter.preserveWhitespace = true
+                                    xmlPrinter.print(root)
+                                    outWriter.close();
+                                </script>
+                            </configuration>
+                        </execution>
+                    </executions>
+                    <dependencies>
+                        <dependency>
+                            <groupId>org.codehaus.groovy</groupId>
+                            <artifactId>groovy</artifactId>
+                            <version>1.8.6</version>
+                        </dependency>
+                    </dependencies>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.karaf.tooling</groupId>
+                    <artifactId>karaf-maven-plugin</artifactId>
+                    <version>${karaf.version}</version>
+                    <extensions>true</extensions>
+                    <executions>
+                        <execution>
+                            <id>features-create-kar</id>
+                            <goals>
+                                <goal>features-create-kar</goal>
+                            </goals>
+                            <configuration>
+                                <featuresFile>${project.build.directory}/classes/${features.file}</featuresFile>
+                            </configuration>
+                        </execution>
+                    </executions>
+                    <!-- There is no useful configuration for the kar mojo. The features-generate-descriptor mojo configuration may be useful -->
+                </plugin>
+                <plugin>
+                    <groupId>org.codehaus.mojo</groupId>
+                    <artifactId>build-helper-maven-plugin</artifactId>
+                    <executions>
+                        <execution>
+                        <phase>generate-resources</phase>
+                        <goals><goal>add-resource</goal></goals>
+                        <configuration>
+                            <resources>
+                              <resource>
+                                <directory>${project.build.directory}/generated-resources/script</directory>
+                                <filtering>true</filtering>
+                              </resource>
+                            </resources>
+                        </configuration>
+                        </execution>
+                        <execution>
+                            <id>attach-artifacts</id>
+                            <phase>package</phase>
+                            <goals>
+                                <goal>attach-artifact</goal>
+                            </goals>
+                            <configuration>
+                                <artifacts>
+                                    <artifact>
+                                        <file>${project.build.directory}/classes/${features.file}</file>
+                                        <type>xml</type>
+                                        <classifier>features</classifier>
+                                    </artifact>
+                                </artifacts>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <executions>
+                        <execution>
+                            <id>filter</id>
+                            <phase>generate-resources</phase>
+                            <goals>
+                                <goal>resources</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <configuration>
+                        <dependenciesToScan>
+                            <dependency>org.opendaylight.yangtools:features-test</dependency>
+                        </dependenciesToScan>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+    <dependencies>
+        <!-- test the features.xml -->
+        <dependency>
+            <groupId>org.opendaylight.yangtools</groupId>
+            <artifactId>features-test</artifactId>
+            <version>0.7.0-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+</project>
index a37c36a72653dd63af7a981d38a5b2a780c24658..a3aefd8072f08fc9507672bdea8d28fcaf05e354 100644 (file)
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-parent</artifactId>
+        <artifactId>features-builder</artifactId>
         <version>0.7.0-SNAPSHOT</version>
-        <relativePath>../parent/pom.xml</relativePath>
+        <relativePath>../features-builder/pom.xml</relativePath>
     </parent>
-    <artifactId>features-yangtools</artifactId>
+
+    <artifactId>yangtools-features</artifactId>
     <packaging>jar</packaging>
-    <properties>
-        <features.file>features.xml</features.file>
-    </properties>
+
     <build>
-        <resources>
-            <resource>
-                <directory>src/main/resources</directory>
-                <filtering>true</filtering>
-            </resource>
-        </resources>
         <plugins>
+            <!-- generate dependencies versions -->
             <plugin>
-                <groupId>org.apache.karaf.tooling</groupId>
-                <artifactId>karaf-maven-plugin</artifactId>
-                <version>${karaf.version}</version>
-                <extensions>true</extensions>
-                <executions>
-                    <execution>
-                        <id>features-create-kar</id>
-                        <goals>
-                            <goal>features-create-kar</goal>
-                        </goals>
-                        <configuration>
-                            <featuresFile>${project.build.directory}/classes/${features.file}</featuresFile>
-                        </configuration>
-                    </execution>
-                </executions>
-                <!-- There is no useful configuration for the kar mojo. The features-generate-descriptor mojo configuration may be useful -->
+                <artifactId>maven-dependency-plugin</artifactId>
             </plugin>
             <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-resources-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>filter</id>
-                        <phase>generate-resources</phase>
-                        <goals>
-                            <goal>resources</goal>
-                        </goals>
-                    </execution>
-                </executions>
+                <groupId>com.alexecollins.maven.plugin</groupId>
+                <artifactId>script-maven-plugin</artifactId>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>karaf-maven-plugin</artifactId>
             </plugin>
             <plugin>
                 <groupId>org.codehaus.mojo</groupId>
                 <artifactId>build-helper-maven-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-artifacts</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>attach-artifact</goal>
-                        </goals>
-                        <configuration>
-                            <artifacts>
-                                <artifact>
-                                    <file>${project.build.directory}/classes/${features.file}</file>
-                                    <type>xml</type>
-                                    <classifier>features</classifier>
-                                </artifact>
-                            </artifacts>
-                        </configuration>
-                    </execution>
-                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
             </plugin>
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
             </plugin>
         </plugins>
     </build>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.opendaylight.yangtools</groupId>
+                <artifactId>yangtools-artifacts</artifactId>
+                <version>${project.version}</version>
+                <scope>import</scope>
+                <type>pom</type>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>opendaylight-l2-types</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-ted</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.model</groupId>
             <artifactId>ietf-topology</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-topology-isis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-topology-ospf</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.yangtools.model</groupId>
+            <artifactId>ietf-topology-l3-unicast-igp</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.thirdparty</groupId>
             <artifactId>antlr4-runtime-osgi-nohead</artifactId>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
         </dependency>
-
-        <!-- test the features.xml -->
-        <dependency>
-            <groupId>org.opendaylight.yangtools</groupId>
-            <artifactId>features-test</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
 </project>
similarity index 60%
rename from common/features/src/main/resources/features.xml
rename to common/features/src/main/feature/features.xml
index baba09124cca17d37796fa74e1f169066eb3cd3e..ba174b1678e90836bcc91264195b3def57cf7d70 100644 (file)
 
     <feature name='odl-yangtools-models' version='${project.version}' description='OpenDaylight :: Yangtools :: Models'>
         <feature version='${project.version}'>odl-yangtools-binding</feature>
-        <bundle>mvn:org.opendaylight.yangtools.model/ietf-inet-types/${ietf.inet.types.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/ietf-yang-types/${ietf.yang.types.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/ietf-yang-types-20130715/${ietf.yang.types.20130715.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/ietf-restconf/${ietf.restconf.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/yang-ext/${yang.ext.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/opendaylight-l2-types/${opendaylight.l2.types.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.model/ietf-topology/${ietf.topology.version}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-inet-types/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-yang-types/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-yang-types-20130715/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-restconf/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/yang-ext/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/opendaylight-l2-types/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-ted/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-topology/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-topology-isis/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-topology-ospf/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.model/ietf-topology-l3-unicast-igp/{{VERSION}}</bundle>
        </feature>
 
     <feature name='odl-yangtools-data-binding' version='${project.version}' description='OpenDaylight :: Yangtools :: Data Binding'>
         <feature version='${project.version}'>odl-yangtools-binding</feature>
-        <bundle>mvn:org.opendaylight.yangtools.thirdparty/antlr4-runtime-osgi-nohead/${antlr4.version}</bundle>
-        <bundle>mvn:commons-io/commons-io/${commons.io.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-composite-node/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-impl/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-operations/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-util/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-model-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-model-util/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-parser-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-parser-impl/${project.version}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.thirdparty/antlr4-runtime-osgi-nohead/{{VERSION}}</bundle>
+        <bundle>mvn:commons-io/commons-io/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-composite-node/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-impl/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-operations/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-util/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-model-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-model-util/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-parser-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-parser-impl/{{VERSION}}</bundle>
 
         <!-- GSON-based JSON codec. Can be split out -->
-        <bundle>mvn:com.google.code.gson/gson/${gson.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-data-codec-gson/${project.version}</bundle>
+        <bundle>mvn:com.google.code.gson/gson/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-data-codec-gson/{{VERSION}}</bundle>
     </feature>
 
     <feature name='odl-yangtools-binding' version='${project.version}' description='OpenDaylight :: Yangtools :: Binding'>
         <feature version='${project.version}'>odl-yangtools-common</feature>
-        <bundle>mvn:org.opendaylight.yangtools/yang-binding/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/util/${project.version}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-binding/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/util/{{VERSION}}</bundle>
     </feature>
 
     <feature name='odl-yangtools-common' version='${project.version}' description='OpenDaylight :: Yangtools :: Common'>
-        <bundle>mvn:com.google.guava/guava/${guava.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/concepts/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-common/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/util/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/object-cache-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/object-cache-guava/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/object-cache-noop/${project.version}</bundle>
+        <bundle>mvn:com.google.guava/guava/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/concepts/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-common/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/util/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/object-cache-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/object-cache-guava/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/object-cache-noop/{{VERSION}}</bundle>
     </feature>
     <feature name='odl-yangtools-binding-generator' version='${project.version}' description='OpenDaylight :: Yangtools :: Binding Generator'>
         <feature version='${project.version}'>odl-yangtools-data-binding</feature>
-        <bundle>mvn:org.javassist/javassist/${javassist.version}</bundle>
-        <bundle>mvn:org.apache.commons/commons-lang3/${commons.lang3.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-generator-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-generator-impl/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-generator-spi/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-generator-util/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-model-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-type-provider/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/binding-data-codec/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools.thirdparty/xtend-lib-osgi/${xtend.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-model-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-model-util/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/yang-parser-api/${project.version}</bundle>
+        <bundle>mvn:org.javassist/javassist/{{VERSION}}</bundle>
+        <bundle>mvn:org.apache.commons/commons-lang3/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-generator-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-generator-impl/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-generator-spi/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-generator-util/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-model-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-type-provider/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/binding-data-codec/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools.thirdparty/xtend-lib-osgi/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-model-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-model-util/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/yang-parser-api/{{VERSION}}</bundle>
     </feature>
     <feature name='odl-yangtools-restconf' version='${project.version}' description='OpenDaylight :: Yangtools :: Restconf'>
-        <bundle>mvn:org.opendaylight.yangtools/restconf-client-api/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/restconf-client-impl/${project.version}</bundle>
-        <bundle>mvn:org.opendaylight.yangtools/restconf-common/${project.version}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/restconf-client-api/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/restconf-client-impl/{{VERSION}}</bundle>
+        <bundle>mvn:org.opendaylight.yangtools/restconf-common/{{VERSION}}</bundle>
      </feature>
 </features>
index dab18de6a2658f0fad5329d85a7e329d9358423a..4ca439428d019d368b4f10a7d6ce98a0f49fe798 100644 (file)
@@ -27,7 +27,6 @@
     </prerequisites>
 
     <properties>
-        <antlr4.version>4.0</antlr4.version>
         <commons.io.version>2.4</commons.io.version>
         <ctrie.version>0.2.0</ctrie.version>
         <exam.version>3.0.0</exam.version>
         <nexusproxy>http://nexus.opendaylight.org/content</nexusproxy>
         <maven.javadoc.version>2.9.1</maven.javadoc.version>
         <jsr305.version>2.0.1</jsr305.version>
-
-        <!-- Model versions -->
-        <ietf.topology.version>2013.10.21.7-SNAPSHOT</ietf.topology.version>
-        <ietf.inet.types.version>2010.09.24.7-SNAPSHOT</ietf.inet.types.version>
-        <ietf.yang.types.version>2010.09.24.7-SNAPSHOT</ietf.yang.types.version>
-        <ietf.yang.types.20130715.version>2013.07.15.7-SNAPSHOT</ietf.yang.types.20130715.version>
-        <ietf.restconf.version>2013.10.19.7-SNAPSHOT</ietf.restconf.version>
-        <opendaylight.l2.types.version>2013.08.27.7-SNAPSHOT</opendaylight.l2.types.version>
-        <yang.ext.version>2013.09.07.7-SNAPSHOT</yang.ext.version>
+        <maven.depends.version>1.2</maven.depends.version>
 
         <!-- Sonar config -->
         <sonar-jacoco-listeners.version>2.4</sonar-jacoco-listeners.version>
                 <version>1.5</version>
                 <scope>test</scope>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>maven-sal-api-gen-plugin</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.thirdparty</groupId>
-                <artifactId>antlr4-runtime-osgi-nohead</artifactId>
-                <version>4.0</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.thirdparty</groupId>
-                <artifactId>xtend-lib-osgi</artifactId>
-                <version>2.4.3</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>concepts</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>object-cache-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>object-cache-guava</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>object-cache-noop</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-model-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-spi</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-generator-impl</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>binding-java-api-generator</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-common</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-impl</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-codec-gson</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-model-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-binding</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-parser-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-parser-impl</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-maven-plugin</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-maven-plugin-spi</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-inet-types</artifactId>
-                <version>${ietf.inet.types.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-yang-types</artifactId>
-                <version>${ietf.yang.types.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-yang-types-20130715</artifactId>
-                <version>${ietf.yang.types.20130715.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-restconf</artifactId>
-                <version>${ietf.restconf.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-ted</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-topology</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-topology-isis</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-topology-l3-unicast-igp</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-topology-ospf</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-topology-l3-unicast</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yang-data-composite-node</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
             <dependency>
                 <groupId>org.apache.maven</groupId>
                 <artifactId>maven-core</artifactId>
 
             <dependency>
                 <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-client-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-common</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-test-service</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-client-impl</artifactId>
+                <artifactId>yangtools-artifacts</artifactId>
                 <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>restconf-jaxrs-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>bug527-test-model</artifactId>
-                <version>${yangtools.version}</version>
-                <scope>test</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>bug1196-test-model</artifactId>
-                <version>${yangtools.version}</version>
-                <scope>test</scope>
-            </dependency>
-
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>websocket-client</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>object-cache-api</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>object-cache-guava</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>object-cache-noop</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>util</artifactId>
-                <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools.model</groupId>
-              <artifactId>opendaylight-l2-types</artifactId>
-              <version>${opendaylight.l2.types.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools.model</groupId>
-              <artifactId>yang-ext</artifactId>
-              <version>${yang.ext.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools</groupId>
-              <artifactId>binding-type-provider</artifactId>
-              <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools</groupId>
-              <artifactId>yang-data-operations</artifactId>
-              <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools</groupId>
-              <artifactId>binding-data-codec</artifactId>
-              <version>${yangtools.version}</version>
-            </dependency>
-            <dependency>
-              <groupId>org.opendaylight.yangtools</groupId>
-              <artifactId>features-test</artifactId>
-              <version>${yangtools.version}</version>
-              <scope>test</scope>
+                <scope>import</scope>
+                <type>pom</type>
             </dependency>
         </dependencies>
     </dependencyManagement>
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>org.apache.servicemix.tooling</groupId>
+                    <artifactId>depends-maven-plugin</artifactId>
+                    <version>${maven.depends.version}</version>
+                    <executions>
+                        <execution>
+                            <id>generate-depends-file</id>
+                            <goals>
+                                <goal>generate-depends-file</goal>
+                            </goals>
+                        </execution>
+                    </executions>
+                </plugin>
             </plugins>
         </pluginManagement>
 
index f9a2d2423fd0a0107cdbcb6cb10785683a63ceca..a355d21407792b6cc087b3ce21939ddfae7cb98f 100644 (file)
     <packaging>pom</packaging>
 
     <modules>
+        <module>artifacts</module>
         <module>checkstyle-logging</module>
         <module>concepts</module>
         <module>features</module>
+        <module>features-builder</module>
         <module>features-test</module>
         <module>mockito-configuration</module>
         <module>object-cache-api</module>
index 21edf5c4033274699836cd285746f494f150d79f..c2d2746263d5a24d6cb6f48934ab7ec0674fb84a 100644 (file)
                         <artifactId>yang-common</artifactId>
                         <version>0.7.0-SNAPSHOT</version>
                     </dependency>
-                    <dependency>
-                        <groupId>org.opendaylight.yangtools.model</groupId>
-                        <artifactId>yang-ext</artifactId>
-                        <version>${yang.ext.version}</version>
-                    </dependency>
-                    <dependency>
-                        <groupId>org.opendaylight.yangtools.model</groupId>
-                        <artifactId>ietf-inet-types</artifactId>
-                        <version>${ietf.inet.types.version}</version>
-                    </dependency>
                 </dependencies>
             </plugin>
             <plugin>
index fb84a0d7bce27b074b8be13cd579b2e0245a2117..4fde8986ea2d7ece186c3cb3ac40836b24232f3f 100644 (file)
         <dependency>
             <groupId>org.opendaylight.yangtools.thirdparty</groupId>
             <artifactId>antlr4-runtime-osgi-nohead</artifactId>
+            <scope>test</scope>
         </dependency>
         <dependency>
             <groupId>org.opendaylight.yangtools.thirdparty</groupId>
             <artifactId>xtend-lib-osgi</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 
index d50f275fa949729551497dfb19c70277c04639ec..b2a66bb5227cd0c744461f802bc34c0b6db3c4b1 100644 (file)
         <module>ietf-restconf</module>
         <!--module>ietf-netconf</module -->
     </modules>
-
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-inet-types</artifactId>
-                <version>${ietf.inet.types.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-yang-types</artifactId>
-                <version>${ietf.yang.types.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools.model</groupId>
-                <artifactId>ietf-restconf</artifactId>
-                <version>${ietf.restconf.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>ietf-ted</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>ietf-topology</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>ietf-topology-isis</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>ietf-topology-l3-unicast-igp</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>${project.groupId}</groupId>
-                <artifactId>ietf-topology-ospf</artifactId>
-                <version>${ietf.topology.version}</version>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-   </project>
+</project>
index 8fcc596ab47ebe3e8e5d2ed86ecb00f8cc2d104e..e1bba78be001caa2977611544256ff23e5ffd510 100644 (file)
@@ -11,9 +11,6 @@ import com.google.common.base.CharMatcher;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import com.google.gson.stream.JsonWriter;
-import java.io.IOException;
-import java.io.Writer;
-import java.net.URI;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
@@ -26,6 +23,10 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.net.URI;
+
 /**
  * This implementation will create JSON output as output stream.
  *
@@ -43,7 +44,7 @@ public class JSONNormalizedNodeStreamWriter implements NormalizedNodeStreamWrite
     /**
      * Matcher used to check if a string needs to be escaped.
      */
-    private static final CharMatcher QUOTES_OR_BACKSLASH = CharMatcher.anyOf("\\\"");
+    private static final CharMatcher JSON_ILLEGAL_STRING_CHARACTERS = CharMatcher.anyOf("\\\"\n\r");
 
     private final SchemaTracker tracker;
     private final JSONCodecFactory codecs;
@@ -228,14 +229,14 @@ public class JSONNormalizedNodeStreamWriter implements NormalizedNodeStreamWrite
         if (needQuotes) {
             writer.append('"');
 
-            final int needEscape = QUOTES_OR_BACKSLASH.countIn(str);
+            final int needEscape = JSON_ILLEGAL_STRING_CHARACTERS.countIn(str);
             if (needEscape != 0) {
                 final char[] escaped = new char[str.length() + needEscape];
                 int offset = 0;
 
                 for (int i = 0; i < str.length(); i++) {
                     final char c = str.charAt(i);
-                    if (QUOTES_OR_BACKSLASH.matches(c)) {
+                    if (JSON_ILLEGAL_STRING_CHARACTERS.matches(c)) {
                         escaped[offset++] = '\\';
                     }
                     escaped[offset++] = c;
index 62e7cf18cd8ce742beebabe5971d5bdd60b2143c..39a1f1bc7bbe30c9cd131cd581d7269650ed4b0a 100644 (file)
@@ -7,26 +7,11 @@
  */
 package org.opendaylight.yangtools.yang.data.codec.gson;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.childArray;
-import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.childPrimitive;
-import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadModules;
-import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.resolveCont1;
-
 import com.google.common.collect.Sets;
 import com.google.gson.JsonArray;
 import com.google.gson.JsonElement;
 import com.google.gson.JsonObject;
 import com.google.gson.JsonPrimitive;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-import java.net.URISyntaxException;
-import java.util.HashSet;
-import java.util.Iterator;
 import org.junit.BeforeClass;
 import org.junit.Ignore;
 import org.junit.Test;
@@ -35,6 +20,22 @@ import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStre
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.net.URISyntaxException;
+import java.util.HashSet;
+import java.util.Iterator;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.childArray;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.childPrimitive;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.loadModules;
+import static org.opendaylight.yangtools.yang.data.codec.gson.TestUtils.resolveCont1;
+
 /**
  * Each test tests whether json output obtained after transformation contains is corect. The transformation takes
  * normalized node data structure and transform it to json output. To make it easier validate json output it is loaded
@@ -95,6 +96,32 @@ public class NormalizedNodeToJsonStreamTest {
 
     }
 
+    @Test
+    public void leafListNodeInContainerMultiline() throws IOException, URISyntaxException {
+        Writer writer = new StringWriter();
+        NormalizedNode<?, ?> leafListNodeInContainer = TestingNormalizedNodeStructuresCreator.leafListNodeInContainerMultiline();
+        String jsonOutput = normalizedNodeToJsonStreamTransformation(writer, leafListNodeInContainer);
+        new JsonValidator() {
+
+            @Override
+            public void validate(String jsonOutput) {
+                JsonObject cont1 = resolveCont1(jsonOutput);
+                assertNotNull(cont1);
+                JsonArray lflst11 = childArray(cont1, "complexjson:lflst11", "lflst11");
+                assertNotNull(lflst11);
+
+                HashSet<Object> lflst11Values = Sets.newHashSet();
+                for (JsonElement jsonElement : lflst11) {
+                    assertTrue(jsonElement instanceof JsonPrimitive);
+                    lflst11Values.add(((JsonPrimitive) jsonElement).getAsString());
+                }
+
+                assertEquals(Sets.newHashSet("lflst11 value2\r\nanother line 2", "lflst11 value1\nanother line 1"), lflst11Values);
+            }
+        }.validate(jsonOutput);
+
+    }
+
     @Test
     public void leafNodeViaAugmentationInContainer() throws IOException, URISyntaxException {
         Writer writer = new StringWriter();
index f1400854d9d76d2840849a0d8c6b9a5a3165ab94..1038ce883db6d8389f6ed15a77cc243b05011e0a 100644 (file)
@@ -9,8 +9,6 @@ package org.opendaylight.yangtools.yang.data.codec.gson;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
-import java.util.HashMap;
-import java.util.Map;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
 import org.opendaylight.yangtools.yang.data.api.SimpleNode;
@@ -40,6 +38,9 @@ import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContaine
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
 import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.ListNodeBuilder;
 
+import java.util.HashMap;
+import java.util.Map;
+
 public class TestingNormalizedNodeStructuresCreator {
 
     static NormalizedNode<?, ?> cont1Node(
@@ -236,6 +237,22 @@ public class TestingNormalizedNodeStructuresCreator {
         return lflst11.build();
     }
 
+    private static DataContainerChild<? extends PathArgument, ?> childLflst11Multiline() {
+        ListNodeBuilder<Object, LeafSetEntryNode<Object>> lflst11 = Builders.leafSetBuilder().withNodeIdentifier(
+                new NodeIdentifier(QName.create("ns:complex:json", "2014-08-11", "lflst11")));
+        lflst11.withChild(Builders
+                .leafSetEntryBuilder()
+                .withNodeIdentifier(
+                        new NodeWithValue(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value1\nanother line 1"))
+                .withValue("lflst11 value1\nanother line 1").build());
+        lflst11.withChild(Builders
+                .leafSetEntryBuilder()
+                .withNodeIdentifier(
+                        new NodeWithValue(QName.create("ns:complex:json", "2014-08-11", "lflst11"), "lflst11 value2\r\nanother line 2"))
+                .withValue("lflst11 value2\r\nanother line 2").build());
+        return lflst11.build();
+    }
+
     private static CompositeNode prepareLf12Value() {
         SimpleNode<?> anyxmlInData = NodeFactory.createImmutableSimpleNode(
                 QName.create("ns:complex:json", "2014-08-11", "anyxml-in-data"), null, "foo");
@@ -260,6 +277,9 @@ public class TestingNormalizedNodeStructuresCreator {
     public static NormalizedNode<?, ?> leafListNodeInContainer() {
         return cont1Node(childLflst11());
     }
+    public static NormalizedNode<?, ?> leafListNodeInContainerMultiline() {
+        return cont1Node(childLflst11Multiline());
+    }
 
     public static NormalizedNode<?, ?> keyedListNodeInContainer() {
         return cont1Node(childLst11());
index 2ffc3ad97368af238345fd6b553d98be11e85149..7dd248cf379e8adc48c78bb580c52e56a4b8b19e 100644 (file)
@@ -14,7 +14,7 @@ public interface DerivableSchemaNode extends DataSchemaNode {
      * grouping where it was defined.
      *
      * @return original node definition from grouping if this node is added by
-     *         uses, null otherwise
+     *         uses, Optional.absent otherwise
      */
     Optional<? extends SchemaNode> getOriginal();
 
index 972f4689d547e2c491f1c774183946fe5d5f94d0..0f7de6e7d27905211165963c06baa92c5942454b 100644 (file)
@@ -20,6 +20,7 @@ import java.util.Collections;
 import java.util.Date;
 import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ModuleImport;
@@ -118,8 +119,9 @@ final class DependencyResolver {
         } while (progress);
 
         /// Additional check only for belongs-to statement
-        for (final SourceIdentifier sourceIdentifier : submodules.keySet()) {
-            final BelongsToDependency belongs = submodules.get(sourceIdentifier);
+        for (final Entry<SourceIdentifier, BelongsToDependency> submodule : submodules.entrySet()) {
+            final BelongsToDependency belongs = submodule.getValue();
+            final SourceIdentifier sourceIdentifier = submodule.getKey();
             if (!isKnown(resolved, belongs)) {
                 LOG.debug("Source {} is missing parent {}", sourceIdentifier, belongs);
                 pending.add(sourceIdentifier);