--- /dev/null
+/*
+ * 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"));
+ }
+}
--- /dev/null
+/*
+ * 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));
+ }
+
+}
</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>
@Deprecated
public class DurationStatsTracker extends ConcurrentDurationStatisticsTracker {
/**
- * @deprecated Use {@link DurationStatisticsTracker#createConcurrent() instead.
+ * @deprecated Use {@link DurationStatisticsTracker#createConcurrent()} instead.
*/
@Deprecated
public DurationStatsTracker() {
* </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")
* / 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;
/**
* 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) {
* 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
* 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() {
* supplied String based schema source provider.
*
* @param delegate
- * @return
+ * @return InputStream-based source provider.
*/
public static SchemaSourceProvider<InputStream> inputStreamProviderfromStringProvider(
final AdvancedSchemaSourceProvider<String> delegate) {
*
* This implementation is really simple <code>return input;</code>.
*
- * @return
+ * @return Identity transformation.
*/
@SuppressWarnings("unchecked")
public static <I> SchemaSourceTransformation<I, I> identityTransformation() {