Merge "Remove duplicate declarations"
authorTony Tkacik <ttkacik@cisco.com>
Mon, 13 Oct 2014 15:05:34 +0000 (15:05 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 13 Oct 2014 15:05:34 +0000 (15:05 +0000)
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedTOBuilderTest.java [new file with mode: 0644]
code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodParameterImplTest.java [new file with mode: 0644]
common/parent/pom.xml
common/util/src/main/java/org/opendaylight/yangtools/util/DurationStatsTracker.java
yang/yang-data-api/src/main/java/org/opendaylight/yangtools/yang/data/api/YangInstanceIdentifier.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BaseTypes.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/repo/SchemaSourceProviders.java

diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedTOBuilderTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/GeneratedTOBuilderTest.java
new file mode 100644 (file)
index 0000000..fe84ce0
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * 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.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+import org.opendaylight.yangtools.sal.binding.model.api.GeneratedTransferObject;
+import org.opendaylight.yangtools.sal.binding.model.api.type.builder.GeneratedPropertyBuilder;
+import org.opendaylight.yangtools.sal.binding.model.api.type.builder.GeneratedTOBuilder;
+
+public class GeneratedTOBuilderTest {
+
+    @Test
+    public void testBuilder() {
+        final GeneratedTOBuilder genTypeBuilder = new GeneratedTOBuilderImpl(
+                "org.opendaylight.controller", "AnnotClassCache");
+
+        genTypeBuilder.setSUID(genTypeBuilder.addProperty("SUID"));
+        genTypeBuilder.addMethod("addCount");
+
+        GeneratedTransferObject genTO = genTypeBuilder.toInstance();
+        genTypeBuilder.setExtendsType(genTO);
+
+        GeneratedPropertyBuilder property = genTypeBuilder
+                .addProperty("customProperty");
+        genTypeBuilder.addHashIdentity(property);
+
+        genTypeBuilder.addEqualsIdentity(property);
+
+        genTypeBuilder.addToStringProperty(property);
+
+        assertNotNull(genTO);
+        assertNotNull(genTO.getProperties());
+    }
+
+    @Test
+    public void testToString() {
+        final GeneratedTOBuilder genTypeBuilder = new GeneratedTOBuilderImpl(
+                "org.opendaylight.controller", "AnnotClassCache");
+        String toString = genTypeBuilder.toString();
+        assertTrue(toString.contains("GeneratedTransferObject"));
+    }
+
+    @Test
+    public void testTransferBuilderToString() {
+        final GeneratedTOBuilder genTypeBuilder1 = new GeneratedTOBuilderImpl(
+                "org.opendaylight.controller", "AnnotClassCache");
+
+        genTypeBuilder1.setTypedef(true);
+        GeneratedTransferObject genTO = genTypeBuilder1.toInstance();
+        String toString = genTO.toString();
+        assertFalse(toString.contains("GeneratedTransferObject"));
+
+        final GeneratedTOBuilder genTypeBuilder2 = new GeneratedTOBuilderImpl(
+                "org.opendaylight.controller", "AnnotClassCache");
+
+        genTypeBuilder2.setTypedef(false);
+        genTO = genTypeBuilder2.toInstance();
+        toString = genTO.toString();
+
+        assertTrue(toString.contains("GeneratedTransferObject"));
+    }
+}
diff --git a/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodParameterImplTest.java b/code-generator/binding-generator-util/src/test/java/org/opendaylight/yangtools/binding/generator/util/generated/type/builder/MethodParameterImplTest.java
new file mode 100644 (file)
index 0000000..ca7b455
--- /dev/null
@@ -0,0 +1,64 @@
+/*
+ * 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 org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.yangtools.binding.generator.util.Types;
+import org.opendaylight.yangtools.sal.binding.model.api.Type;
+
+public class MethodParameterImplTest {
+
+    MethodParameterImpl parameter1, parameter2, parameter3, parameter4;
+    int hash1, hash2, hash3, hash4;
+
+    @Before
+    public void Setup() {
+        String name = "customParameter";
+        Type type = Types.STRING;
+        parameter1 = new MethodParameterImpl(name, type);
+        parameter2 = new MethodParameterImpl(name, type);
+        parameter3 = new MethodParameterImpl(name, null);
+        parameter4 = new MethodParameterImpl(null, type);
+
+        hash1 = parameter1.hashCode();
+        hash2 = parameter2.hashCode();
+        hash3 = parameter3.hashCode();
+        hash4 = parameter4.hashCode();
+    }
+
+    @Test
+    public void testToString() {
+        String toString = parameter1.toString();
+        assertTrue(toString.contains("MethodParameter"));
+    }
+
+    @Test
+    public void testEquals() {
+        assertTrue(parameter1.equals(parameter1));
+        assertTrue(parameter1.equals(parameter2));
+        assertFalse(parameter1.equals("string"));
+        assertFalse(parameter1.equals(null));
+        assertFalse(parameter1.equals(parameter3));
+        assertFalse(parameter2.equals(parameter4));
+        assertFalse(parameter4.equals(parameter2));
+        assertFalse(parameter3.equals(parameter2));
+    }
+
+    @Test
+    public void testHashCode() {
+        assertEquals(hash1,hash2);
+        assertTrue(!(hash1 == hash3));
+        assertTrue(!(hash1 == hash4));
+    }
+
+}
index b5496f738cf96937489a71a6cf48543d5183b5c6..0944256ff7030dc4813138b237725b8b07d3766f 100644 (file)
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>org.eclipse.xtend</groupId>
+                    <artifactId>xtend-maven-plugin</artifactId>
+                    <version>${xtend.version}</version>
+                    <executions>
+                        <execution>
+                            <goals>
+                                <goal>compile</goal>
+                            </goals>
+                            <configuration>
+                                <outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory>
+                            </configuration>
+                        </execution>
+                    </executions>
+                </plugin>
             </plugins>
         </pluginManagement>
 
                 </executions>
             </plugin>
             -->
-            <plugin>
-                <groupId>org.eclipse.xtend</groupId>
-                <artifactId>xtend-maven-plugin</artifactId>
-                <version>${xtend.version}</version>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>compile</goal>
-                        </goals>
-                        <configuration>
-                            <outputDirectory>${basedir}/src/main/xtend-gen</outputDirectory>
-                        </configuration>
-                    </execution>
-                </executions>
-            </plugin>
             <plugin>
                 <artifactId>maven-clean-plugin</artifactId>
                 <version>2.5</version>
index ca85e83d9554fa86300aa1ab75a993fadc4db06e..b2db9e028c6ac47caee7636bc6c3f3774ba41190 100644 (file)
@@ -18,7 +18,7 @@ package org.opendaylight.yangtools.util;
 @Deprecated
 public class DurationStatsTracker extends ConcurrentDurationStatisticsTracker {
     /**
-     * @deprecated Use {@link DurationStatisticsTracker#createConcurrent() instead.
+     * @deprecated Use {@link DurationStatisticsTracker#createConcurrent()} instead.
      */
     @Deprecated
     public DurationStatsTracker() {
index dfd623fa84021d0452266c6941034eeabe629b70..3423110bdc0e844996d90955a5c982f08ecba4a2 100644 (file)
@@ -67,7 +67,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.LeafSetEntryNode;
  * </ul>
  *
  *
- * @see http://tools.ietf.org/html/rfc6020#section-9.13
+ * @see <a href="http://tools.ietf.org/html/rfc6020#section-9.13">RFC6020</a>
  */
 public final class YangInstanceIdentifier implements Path<YangInstanceIdentifier>, Immutable, Serializable {
     @SuppressWarnings("rawtypes")
@@ -620,7 +620,7 @@ public final class YangInstanceIdentifier implements Path<YangInstanceIdentifier
      * / module to the target node.
      *
      *
-     * @see http://tools.ietf.org/html/rfc6020#section-7.15
+     * @see <a href="http://tools.ietf.org/html/rfc6020#section-7.15">RFC6020</a>
      */
     public static final class AugmentationIdentifier implements PathArgument {
         private static final long serialVersionUID = -8122335594681936939L;
@@ -647,9 +647,7 @@ public final class YangInstanceIdentifier implements Path<YangInstanceIdentifier
         /**
          * Augmentation node has no QName
          *
-         * @deprecated Use
-         *             {@link AugmentationIdentifier#AugmentationIdentifier(Set)}
-         *             instead.
+         * @deprecated Use {@link #AugmentationIdentifier(Set)} instead.
          */
         @Deprecated
         public AugmentationIdentifier(final QName nodeType, final Set<QName> childNames) {
index 0e40bd2964472c4a354f3d99e61b5c9893043787..dccd07221db1baa4cc2e9867b4e5b85044b9292c 100644 (file)
@@ -113,7 +113,7 @@ public final class BaseTypes {
      *            Revision Date
      * @return Schema Path
      *
-     * @deprecated Use {@link SchemaPath#create(boolean, Iterable)} with QNames
+     * @deprecated Use {@link SchemaPath#create(Iterable, boolean)} with QNames
      *             manually constructed.
      */
     @Deprecated
index 24a92ba872215c730733af4426fbba2156336e62..4f7f111b9396c10e0cf6d94087f11dd016f6e793 100644 (file)
@@ -54,7 +54,7 @@ public final class SchemaSourceProviders {
      * Noop schema provider returns {@link Optional#absent()} for each call to
      * query schema source.
      *
-     * @return
+     * @return A reusable no-operation provider.
      */
     @SuppressWarnings("unchecked")
     public static <T> SchemaSourceProvider<T> noopProvider() {
@@ -67,7 +67,7 @@ public final class SchemaSourceProviders {
      * supplied String based schema source provider.
      *
      * @param delegate
-     * @return
+     * @return InputStream-based source provider.
      */
     public static SchemaSourceProvider<InputStream> inputStreamProviderfromStringProvider(
             final AdvancedSchemaSourceProvider<String> delegate) {
@@ -83,7 +83,7 @@ public final class SchemaSourceProviders {
      *
      * This implementation is really simple <code>return input;</code>.
      *
-     * @return
+     * @return Identity transformation.
      */
     @SuppressWarnings("unchecked")
     public static <I> SchemaSourceTransformation<I, I> identityTransformation() {