BUG-865: remove unused model.util types 29/40629/5
authorRobert Varga <rovarga@cisco.com>
Tue, 21 Jun 2016 16:47:53 +0000 (18:47 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Wed, 22 Jun 2016 14:14:11 +0000 (14:14 +0000)
This removes classes no longer used anywhere.

Change-Id: I911d7e721f2c66059afdb0b54d9b15427fbe4706
Signed-off-by: Robert Varga <rovarga@cisco.com>
42 files changed:
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BinaryCodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BitsCodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/BooleanCodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EmptyCodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/EnumCodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int32CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int64CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Int8CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/TypeDefinitionAwareCodecTestHelper.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint32CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint64CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/Uint8CodecStringTest.java
yang/yang-data-impl/src/test/java/org/opendaylight/yangtools/yang/data/impl/codecs/UnionCodecStringTest.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/AbstractSignedInteger.java
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/AbstractUnsignedInteger.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/BinaryType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BitsType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BooleanType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/EmptyType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/IdentityrefType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/InstanceIdentifierType.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int32.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int64.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int8.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Leafref.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint32.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint64.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint8.java [deleted file]
yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/package-info.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BaseTypesTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BinaryTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BitsTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/BooleanTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/EmptyTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/ExtendedTypeTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/Int8Test.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/LeafrefTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/SchemaContextUtilTest.java
yang/yang-model-util/src/test/java/org/opendaylight/yangtools/yang/model/util/UnionTypeTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/util/SchemaContextUtilTest.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/SchemaContextUtilTest.java

index c5e4e9a4d429ac55a86f0c037fca777bc9743332..f6424413160d548419673a122be8e8123b822f80 100644 (file)
@@ -8,14 +8,13 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
-import org.junit.Test;
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-import org.opendaylight.yangtools.yang.data.api.codec.BinaryCodec;
-import org.opendaylight.yangtools.yang.model.util.BinaryType;
-
 import com.google.common.io.BaseEncoding;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.data.api.codec.BinaryCodec;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for BinaryCodecString.
@@ -27,20 +26,20 @@ public class BinaryCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        BinaryCodec<String> codec = getCodec( BinaryType.getInstance(), BinaryCodec.class);
+        BinaryCodec<String> codec = getCodec(BaseTypes.binaryType(), BinaryCodec.class);
 
-        assertEquals( "serialize", BaseEncoding.base64().encode( new byte[]{1,2,3,4} ),
-                      codec.serialize( new byte[]{1,2,3,4} ) );
-        assertEquals( "serialize", "", codec.serialize( null ) );
+        assertEquals("serialize", BaseEncoding.base64().encode(new byte[] { 1, 2, 3, 4 }),
+                      codec.serialize( new byte[] { 1, 2, 3, 4 }));
+        assertEquals( "serialize", "", codec.serialize(null));
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testDererialize() {
-        BinaryCodec<String> codec = getCodec( BinaryType.getInstance(), BinaryCodec.class);
+        BinaryCodec<String> codec = getCodec(BaseTypes.binaryType(), BinaryCodec.class);
 
-        assertArrayEquals( "deserialize", new byte[]{1,2,3,4},
-                      codec.deserialize( BaseEncoding.base64().encode( new byte[]{1,2,3,4} ) ) );
-        assertEquals( "deserialize", null, codec.deserialize( null ) );
+        assertArrayEquals("deserialize", new byte[] {1, 2, 3, 4 },
+                      codec.deserialize(BaseEncoding.base64().encode( new byte[] { 1, 2, 3, 4 })));
+        assertEquals("deserialize", null, codec.deserialize(null));
     }
 }
index d39226729aeae765f25b694f8672e95f475875fd..25a4e3dd567a58f95cec8682f174da8d56969c11 100644 (file)
@@ -8,12 +8,19 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import com.google.common.collect.ImmutableSet;
 import java.util.Collections;
 import org.junit.Test;
-
 import org.opendaylight.yangtools.yang.data.api.codec.BitsCodec;
-import com.google.common.collect.ImmutableSet;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
+import org.opendaylight.yangtools.yang.model.util.type.BitsTypeBuilder;
 
 /**
  * Unit tests for BitsCodecString.
@@ -23,11 +30,27 @@ import com.google.common.collect.ImmutableSet;
  */
 public class BitsCodecStringTest {
 
+    private  static BitsTypeDefinition toBitsTypeDefinition(final String... bits) {
+        final BitsTypeBuilder b = BaseTypes.bitsTypeBuilder(mock(SchemaPath.class));
+
+        long i = 0;
+        for (String bit : bits) {
+            BitsTypeDefinition.Bit mockBit = mock(BitsTypeDefinition.Bit.class);
+            when(mockBit.getName()).thenReturn(bit);
+            when(mockBit.getPosition()).thenReturn(i);
+            b.addBit(mockBit);
+            ++i;
+        }
+
+        return b.build();
+    }
+
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
 
-        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( TypeDefinitionAwareCodecTestHelper.toBitsTypeDefinition( "foo" ), BitsCodec.class );
+        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(
+            toBitsTypeDefinition("foo"), BitsCodec.class);
 
         ImmutableSet<String> toSerialize = ImmutableSet.of("foo", "bar");
 
@@ -45,7 +68,8 @@ public class BitsCodecStringTest {
     @Test
     public void testDeserialize() {
 
-        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( TypeDefinitionAwareCodecTestHelper.toBitsTypeDefinition( "bit1", "bit2" ), BitsCodec.class );
+        BitsCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(
+            toBitsTypeDefinition("bit1", "bit2"), BitsCodec.class);
 
         assertEquals("deserialize", ImmutableSet.of("bit1", "bit2"), codec.deserialize("  bit1 bit2     "));
 
index 143052ddf3225ad5f0d2e1afbc296518a5061440..66f7ba0c6945bfcc5c464b940dd38eff5334307e 100644 (file)
@@ -8,12 +8,10 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
-
 import org.opendaylight.yangtools.yang.data.api.codec.BooleanCodec;
-import org.opendaylight.yangtools.yang.model.util.BooleanType;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for BooleanCodecString.
@@ -25,23 +23,23 @@ public class BooleanCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( BooleanType.getInstance(), BooleanCodec.class);
+        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.booleanType(), BooleanCodec.class);
 
-        assertEquals( "serialize", "", codec.serialize( null ) );
-        assertEquals( "serialize", "true", codec.serialize( true ) );
-        assertEquals( "serialize", "false", codec.serialize( false ) );
+        assertEquals("serialize", "", codec.serialize(null));
+        assertEquals("serialize", "true", codec.serialize(true));
+        assertEquals("serialize", "false", codec.serialize(false));
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( BooleanType.getInstance(), BooleanCodec.class);
+        BooleanCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.booleanType(), BooleanCodec.class);
 
-        assertEquals( "deserialize", Boolean.TRUE, codec.deserialize( "true" ) );
-        assertEquals( "deserialize", Boolean.TRUE, codec.deserialize( "TRUE" ) );
-        assertEquals( "deserialize", Boolean.FALSE, codec.deserialize( "FALSE" ) );
-        assertEquals( "deserialize", Boolean.FALSE, codec.deserialize( "false" ) );
-        assertEquals( "deserialize", null, codec.deserialize( null ) );
+        assertEquals("deserialize", Boolean.TRUE, codec.deserialize("true"));
+        assertEquals("deserialize", Boolean.TRUE, codec.deserialize("TRUE"));
+        assertEquals("deserialize", Boolean.FALSE, codec.deserialize("FALSE"));
+        assertEquals("deserialize", Boolean.FALSE, codec.deserialize("false"));
+        assertEquals("deserialize", null, codec.deserialize(null));
         TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "foo");
         TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "");
     }
index 58162668065de4322520a4d15b891f58f93fb104..9e7bf2619100501149ad7b76f7a302c492ffb867 100644 (file)
@@ -8,11 +8,10 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.EmptyCodec;
-import org.opendaylight.yangtools.yang.model.util.EmptyType;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for EmptyCodecString.
@@ -24,20 +23,19 @@ public class EmptyCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( EmptyType.getInstance(), EmptyCodec.class);
+        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
 
-        assertEquals( "serialize", "", codec.serialize( null ) );
+        assertEquals("serialize", "", codec.serialize(null));
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec( EmptyType.getInstance(), EmptyCodec.class);
+        EmptyCodec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.emptyType(), EmptyCodec.class);
 
-        assertEquals( "deserialize", null, codec.deserialize( "" ) );
-        assertEquals( "deserialize", null, codec.deserialize( null ) );
+        assertEquals("deserialize", null, codec.deserialize(""));
+        assertEquals("deserialize", null, codec.deserialize(null));
 
-        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx( codec, "foo" );
+        TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx(codec, "foo");
     }
-
 }
index 6be2ddc88cb95bfdb88a623ca0275e22061d2553..638f87845bba34e78091279d7f2f6996266a102a 100644 (file)
@@ -8,13 +8,12 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.data.api.codec.EnumCodec;
-import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
+import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.data.api.codec.EnumCodec;
 
 /**
  * Unit tests for EnumCodecString.
@@ -26,10 +25,10 @@ public class EnumCodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        EnumCodec<String> codec = getCodec( toEnumTypeDefinition( "enum1", "enum2" ), EnumCodec.class);
+        EnumCodec<String> codec = getCodec(toEnumTypeDefinition("enum1", "enum2"), EnumCodec.class);
 
-        assertEquals( "serialize", "enum1", codec.serialize( "enum1" ) );
-        assertEquals( "serialize", "", codec.serialize( null ) );
+        assertEquals("serialize", "enum1", codec.serialize("enum1"));
+        assertEquals("serialize", "", codec.serialize(null));
     }
 
     @SuppressWarnings("unchecked")
@@ -37,9 +36,9 @@ public class EnumCodecStringTest {
     public void testDeserialize() {
         EnumCodec<String> codec = getCodec( toEnumTypeDefinition( "enum1", "enum2" ), EnumCodec.class);
 
-        assertEquals( "deserialize", "enum1", codec.deserialize( "enum1" ) );
-        assertEquals( "deserialize", "enum2", codec.deserialize( "enum2" ) );
+        assertEquals("deserialize", "enum1", codec.deserialize("enum1"));
+        assertEquals("deserialize", "enum2", codec.deserialize("enum2"));
 
-        deserializeWithExpectedIllegalArgEx( codec, "enum3" );
+        deserializeWithExpectedIllegalArgEx(codec, "enum3");
     }
 }
index ab7255d0a76665330490b12925ee4b095f7d81d2..9033cd29d811cc93bdd70a6283604686223ff98a 100644 (file)
@@ -8,11 +8,10 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int32Codec;
-import org.opendaylight.yangtools.yang.model.util.Int32;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Int32CodecString.
@@ -24,7 +23,7 @@ public class Int32CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int32.getInstance(), Int32Codec.class);
+        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.int32Type(), Int32Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Integer.valueOf( 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -40,7 +39,7 @@ public class Int32CodecStringTest {
         final String integer = "1174404318";
         final String negInteger = "-1174404318";
 
-        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int32.getInstance(), Int32Codec.class);
+        Int32Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.int32Type(), Int32Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Integer.valueOf("+045FFFCDE", 16));
         assertEquals("deserialize", codec.deserialize(negHexa), Integer.valueOf("-045FFFCDE", 16));
index bf784afe04759eea89e1eee287b3e4162eec645b..72b6e255c5029b38895f8fec98f87d982a8c0236 100644 (file)
@@ -8,13 +8,12 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int64Codec;
-import org.opendaylight.yangtools.yang.model.util.Int64;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Int64CodecString.
@@ -26,7 +25,7 @@ public class Int64CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Int64Codec<String> codec = getCodec(Int64.getInstance(), Int64Codec.class);
+        Int64Codec<String> codec = getCodec(BaseTypes.int64Type(), Int64Codec.class);
 
         assertEquals("serialize", "12345", codec.serialize(Long.valueOf( 12345 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -42,7 +41,7 @@ public class Int64CodecStringTest {
         final String integer = "+129664115727546";
         final String negInteger = "-129664115727546";
 
-        Int64Codec<String> codec = getCodec(Int64.getInstance(), Int64Codec.class);
+        Int64Codec<String> codec = getCodec(BaseTypes.int64Type(), Int64Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Long.valueOf("075EDC78edCBA", 16));
         assertEquals("deserialize", codec.deserialize(negHexa), Long.valueOf("-075EDC78edCBA", 16));
index 4ee8492f194d24b4440c94fc5665ca8798775f00..5f5eab430796ee3fdad5c4642426762deac0ef8d 100644 (file)
@@ -8,11 +8,10 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Int8Codec;
-import org.opendaylight.yangtools.yang.model.util.Int8;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Int8CodecString.
@@ -24,7 +23,7 @@ public class Int8CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int8.getInstance(), Int8Codec.class);
+        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.int8Type(), Int8Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Byte.valueOf( (byte) 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -40,7 +39,7 @@ public class Int8CodecStringTest {
         final String integer = "64";
         final String negInteger = "-64";
 
-        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Int8.getInstance(), Int8Codec.class);
+        Int8Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.int8Type(), Int8Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Byte.valueOf("040", 16));
         assertEquals("deserialize", codec.deserialize(negHexa), Byte.valueOf("-040", 16));
index 8c759e8074273020556cff2d44f744fc7d2c71fc..5b33d8336ecdc506f38cb30766faad3a3c5fc7e3 100644 (file)
@@ -13,66 +13,44 @@ import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
-
-import java.util.List;
-
 import org.opendaylight.yangtools.concepts.Codec;
 import org.opendaylight.yangtools.yang.data.impl.codec.TypeDefinitionAwareCodec;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.BitsType;
-import org.opendaylight.yangtools.yang.model.util.EnumerationType;
-import org.opendaylight.yangtools.yang.model.util.UnionType;
-
-import com.google.common.base.Optional;
-import com.google.common.collect.Lists;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
+import org.opendaylight.yangtools.yang.model.util.type.EnumerationTypeBuilder;
 
 public class TypeDefinitionAwareCodecTestHelper {
 
     @SuppressWarnings("unchecked")
-    public static <T> T getCodec( TypeDefinition<?> def, Class<T> clazz ) {
-        Object codec = TypeDefinitionAwareCodec.from( def );
-        assertNotNull( codec );
-        assertTrue( clazz.isAssignableFrom( codec.getClass() ) );
+    public static <T> T getCodec( final TypeDefinition<?> def, final Class<T> clazz) {
+        Object codec = TypeDefinitionAwareCodec.from(def);
+        assertNotNull(codec);
+        assertTrue(clazz.isAssignableFrom(codec.getClass()));
         return (T)codec;
     }
 
-    public static void deserializeWithExpectedIllegalArgEx( Codec<String,?> codec, String param ) {
+    public static void deserializeWithExpectedIllegalArgEx(final Codec<String,?> codec, final String param) {
         try {
-            codec.deserialize( param );
-            fail( "Expected IllegalArgumentException" );
+            codec.deserialize(param);
+            fail("Expected IllegalArgumentException");
         } catch (IllegalArgumentException e) {
             // Expected ...
         }
     }
 
-    public static EnumTypeDefinition toEnumTypeDefinition( String... enums ) {
-        List<EnumTypeDefinition.EnumPair> enumList = Lists.newArrayList();
-        for (String en: enums ) {
-            EnumTypeDefinition.EnumPair mockEnum = mock( EnumTypeDefinition.EnumPair.class );
-            when( mockEnum.getName() ).thenReturn( en );
-            enumList.add( mockEnum );
-        }
-
-        return EnumerationType.create( mock( SchemaPath.class ), enumList,
-                                       Optional.absent() );
-    }
-
-    public static UnionTypeDefinition toUnionTypeDefinition( TypeDefinition<?>... types ) {
-        return UnionType.create( Lists.newArrayList( types ) );
-    }
-
-    public static BitsTypeDefinition toBitsTypeDefinition( String... bits ) {
-        List<BitsTypeDefinition.Bit> bitList = Lists.newArrayList();
-        for (String bit: bits ) {
-            BitsTypeDefinition.Bit mockBit = mock( BitsTypeDefinition.Bit.class );
-            when( mockBit.getName() ).thenReturn( bit );
-            bitList.add( mockBit );
+    public static EnumTypeDefinition toEnumTypeDefinition(final String... enums) {
+        final EnumerationTypeBuilder b = BaseTypes.enumerationTypeBuilder(mock(SchemaPath.class));
+        int i = 0;
+        for (String en : enums) {
+            EnumTypeDefinition.EnumPair mockEnum = mock(EnumTypeDefinition.EnumPair.class);
+            when(mockEnum.getName()).thenReturn(en);
+            when(mockEnum.getValue()).thenReturn(i);
+            b.addEnum(mockEnum);
+            i++;
         }
 
-        return BitsType.create( mock( SchemaPath.class ), bitList );
+        return b.build();
     }
 }
index 12ad8a62da45c38577bd0d53c37b9d072f379ba5..55ae29da1d3a3ebea3e506a6daae75beb01e50fa 100644 (file)
@@ -8,13 +8,12 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint32Codec;
-import org.opendaylight.yangtools.yang.model.util.Uint32;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Uint32CodecString.
@@ -26,7 +25,7 @@ public class Uint32CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Uint32Codec<String> codec = getCodec(Uint32.getInstance(), Uint32Codec.class);
+        Uint32Codec<String> codec = getCodec(BaseTypes.uint32Type(), Uint32Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Long.valueOf( 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -39,7 +38,7 @@ public class Uint32CodecStringTest {
         final String octal = "010577776336";
         final String integer = "1174404318";
 
-        Uint32Codec<String> codec = getCodec(Uint32.getInstance(), Uint32Codec.class);
+        Uint32Codec<String> codec = getCodec(BaseTypes.uint32Type(), Uint32Codec.class);
         assertEquals("deserialize", codec.deserialize(hexa), Long.valueOf("45FFFCDE", 16));
         assertEquals("deserialize", codec.deserialize(octal), Long.valueOf(octal, 8));
         assertEquals("deserialize", codec.deserialize(integer), Long.valueOf(integer, 10));
index c59bfa314ac653f3f86e3fa0ba6b9595fc54f579..723bec2740bfbb6f26071093ac4b17a7ee70fdec 100644 (file)
@@ -8,13 +8,11 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
-
+import static org.junit.Assert.assertEquals;
 import java.math.BigInteger;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint64Codec;
-import org.opendaylight.yangtools.yang.model.util.Uint64;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Uint64CodecString.
@@ -26,7 +24,7 @@ public class Uint64CodecStringTest {
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Uint64.getInstance(), Uint64Codec.class);
+        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.uint64Type(), Uint64Codec.class);
 
         assertEquals("serialize", "123456789", codec.serialize(BigInteger.valueOf( 123456789 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -39,7 +37,7 @@ public class Uint64CodecStringTest {
         final String octal = "03536670743556272";
         final String integer = "129664115727546";
 
-        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(Uint64.getInstance(), Uint64Codec.class);
+        Uint64Codec<String> codec = TypeDefinitionAwareCodecTestHelper.getCodec(BaseTypes.uint64Type(), Uint64Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), new BigInteger("75EDC78edCBA", 16));
         assertEquals("deserialize", codec.deserialize(octal), new BigInteger(octal, 8));
index 9bde6e5624353a3cd7c85e4c5b36312607051730..9d5d72897e1fa1b67c1aa408cf97642556aa255a 100644 (file)
@@ -8,13 +8,12 @@
 
 package org.opendaylight.yangtools.yang.data.impl.codecs;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.Uint8Codec;
-import org.opendaylight.yangtools.yang.model.util.Uint8;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests for Uint8CodecString.
@@ -26,7 +25,7 @@ public class Uint8CodecStringTest {
     @SuppressWarnings({ "unchecked" })
     @Test
     public void testSerialize() {
-        Uint8Codec<String> codec = getCodec(Uint8.getInstance(), Uint8Codec.class);
+        Uint8Codec<String> codec = getCodec(BaseTypes.uint8Type(), Uint8Codec.class);
 
         assertEquals("serialize", "10", codec.serialize(Short.valueOf((short) 10 )));
         assertEquals("serialize", "", codec.serialize(null));
@@ -39,7 +38,7 @@ public class Uint8CodecStringTest {
         final String octal = "0100";
         final String integer = "64";
 
-        Uint8Codec<String> codec = getCodec(Uint8.getInstance(), Uint8Codec.class);
+        Uint8Codec<String> codec = getCodec(BaseTypes.uint8Type(), Uint8Codec.class);
 
         assertEquals("deserialize", codec.deserialize(hexa), Short.valueOf("040", 16));
         assertEquals("deserialize", codec.deserialize(octal), Short.valueOf(octal, 8));
index 48fd57bd1e831dae51380f9a3c30597113f5f8e5..2cd280a28c7158d9ff389f868c1fc0715292a851 100644 (file)
@@ -12,13 +12,13 @@ import static org.junit.Assert.assertEquals;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.deserializeWithExpectedIllegalArgEx;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.getCodec;
 import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toEnumTypeDefinition;
-import static org.opendaylight.yangtools.yang.data.impl.codecs.TypeDefinitionAwareCodecTestHelper.toUnionTypeDefinition;
-
+import java.util.Arrays;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.data.api.codec.UnionCodec;
-import org.opendaylight.yangtools.yang.model.util.EmptyType;
-import org.opendaylight.yangtools.yang.model.util.Int32;
-import org.opendaylight.yangtools.yang.model.util.Int64;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.UnionTypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.UnionType;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 /**
  * Unit tests forUnionCodecString.
@@ -26,43 +26,40 @@ import org.opendaylight.yangtools.yang.model.util.Int64;
  * @author Thomas Pantelis
  */
 public class UnionCodecStringTest {
+    private static UnionTypeDefinition toUnionTypeDefinition(final TypeDefinition<?>... types) {
+        return UnionType.create(Arrays.asList(types));
+    }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testSerialize() {
-        UnionCodec<String> codec =
-            getCodec( toUnionTypeDefinition( toEnumTypeDefinition( "enum1", "enum2" ),
-                                             toUnionTypeDefinition( Int32.getInstance(),
-                                                                    Int64.getInstance() ),
-                                             EmptyType.getInstance() ),
-                      UnionCodec.class);
+        UnionCodec<String> codec = getCodec(toUnionTypeDefinition(toEnumTypeDefinition("enum1", "enum2"),
+                toUnionTypeDefinition(BaseTypes.int32Type(),BaseTypes.int64Type()), BaseTypes.emptyType()),
+                UnionCodec.class);
 
-        assertEquals( "serialize", "enum1", codec.serialize( "enum1" ) );
-        assertEquals( "serialize", "123", codec.serialize( "123" ) );
-        assertEquals( "serialize", "123", codec.serialize( 123 ) );
-        assertEquals( "serialize", "", codec.serialize( null ) );
-        assertEquals( "serialize", "", codec.serialize( "" ) );
+        assertEquals("serialize", "enum1", codec.serialize("enum1"));
+        assertEquals("serialize", "123", codec.serialize("123"));
+        assertEquals("serialize", "123", codec.serialize(123));
+        assertEquals("serialize", "", codec.serialize(null));
+        assertEquals("serialize", "", codec.serialize("" ));
     }
 
     @SuppressWarnings("unchecked")
     @Test
     public void testDeserialize() {
-        UnionCodec<String> codec =
-            getCodec( toUnionTypeDefinition( toEnumTypeDefinition( "enum1", "enum2" ),
-                                             toUnionTypeDefinition( Int32.getInstance(),
-                                                                    Int64.getInstance() ),
-                                             EmptyType.getInstance() ),
-                      UnionCodec.class);
+        UnionCodec<String> codec = getCodec(toUnionTypeDefinition(toEnumTypeDefinition("enum1", "enum2"),
+                toUnionTypeDefinition(BaseTypes.int32Type(),BaseTypes.int64Type()), BaseTypes.emptyType()),
+                UnionCodec.class);
 
-        assertEquals( "deserialize", "enum1", codec.deserialize( "enum1" ) );
-        assertEquals( "deserialize", "123", codec.deserialize( "123" ) );
-        assertEquals( "deserialize", "-123", codec.deserialize( "-123" ) );
-        assertEquals( "deserialize", "41234567890", codec.deserialize( "41234567890" ) );
-        assertEquals( "deserialize", "", codec.deserialize( "" ) );
-        assertEquals( "deserialize", null, codec.deserialize( null ) );
+        assertEquals("deserialize", "enum1", codec.deserialize("enum1"));
+        assertEquals("deserialize", "123", codec.deserialize("123"));
+        assertEquals("deserialize", "-123", codec.deserialize("-123"));
+        assertEquals("deserialize", "41234567890", codec.deserialize("41234567890"));
+        assertEquals("deserialize", "", codec.deserialize(""));
+        assertEquals("deserialize", null, codec.deserialize(null));
 
-        deserializeWithExpectedIllegalArgEx( codec, "enum3" );
-        deserializeWithExpectedIllegalArgEx( codec, "123o" );
-        deserializeWithExpectedIllegalArgEx( codec, "true" );
+        deserializeWithExpectedIllegalArgEx(codec, "enum3");
+        deserializeWithExpectedIllegalArgEx(codec, "123o");
+        deserializeWithExpectedIllegalArgEx(codec, "true");
     }
 }
index 212910cec28044abae264a2996db2c6b97d00ba0..bb48fbdcd4080ec374327882bdac41430059ca05 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.model.api.type.RangeConstraint;
  * 9223372036854775807, inclusively.</li>
  * </ul>
  *
- * @deprecated Used only by deprecated {@link Int8} and friends.
+ * @deprecated Used only by deprecated {@link Int16}.
  */
 @Deprecated
 abstract class AbstractSignedInteger implements IntegerTypeDefinition {
index a0a6ec8c596f50533e72ef5297c2216052cb8039..87b310815c5fd73249f715abbc481f16ee79a9cd 100644 (file)
@@ -33,7 +33,7 @@ import org.opendaylight.yangtools.yang.model.api.type.UnsignedIntegerTypeDefinit
  * inclusively.</li>
  * </ul>
  *
- * @deprecated Used only by deprecated {@link Uint8} and friends.
+ * @deprecated Used only by deprecated {@link Uint16}.
  */
 @Deprecated
 abstract class AbstractUnsignedInteger implements UnsignedIntegerTypeDefinition {
index a6087d06aa6ef08c40b1a4508fde2ea14947ebd3..f0b1db4fbe3d2cf2e5a14ec618f61a49021e853d 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
 import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableSet;
 import java.net.URI;
@@ -119,60 +117,4 @@ public final class BaseTypes {
     public static boolean isYangBuildInType(final TypeDefinition<?> type) {
         return type != null && BUILT_IN_TYPES.contains(type.getQName());
     }
-
-    /**
-     * Returns default instance of built-in for supplied type
-     *
-     * See package documentation for description of base build-in types
-     * with default instance.
-     *
-     * @param typeName
-     * @return Returns default instance or {@link Optional#absent()} if default
-     *         instance does not exists
-     *
-     * @deprecated Use parser-specific lookup tables.
-     */
-    @Deprecated
-    public static Optional<TypeDefinition<?>> defaultBaseTypeFor(final String typeName) {
-        return Optional.fromNullable(defaultBaseTypeForImpl(typeName));
-    }
-
-    @Deprecated
-    private static TypeDefinition<?> defaultBaseTypeForImpl(final String typeName) {
-        Preconditions.checkNotNull(typeName, "typeName must not be null.");
-
-        if (typeName.startsWith("int")) {
-            if ("int8".equals(typeName)) {
-                return Int8.getInstance();
-            } else if ("int16".equals(typeName)) {
-                return Int16.getInstance();
-            } else if ("int32".equals(typeName)) {
-                return Int32.getInstance();
-            } else if ("int64".equals(typeName)) {
-                return Int64.getInstance();
-            }
-        } else if (typeName.startsWith("uint")) {
-            if ("uint8".equals(typeName)) {
-                return Uint8.getInstance();
-            } else if ("uint16".equals(typeName)) {
-                return Uint16.getInstance();
-            } else if ("uint32".equals(typeName)) {
-                return Uint32.getInstance();
-            } else if ("uint64".equals(typeName)) {
-                return Uint64.getInstance();
-            }
-        } else if ("string".equals(typeName)) {
-            return StringType.getInstance();
-        } else if ("binary".equals(typeName)) {
-            return BinaryType.getInstance();
-        } else if ("boolean".equals(typeName)) {
-            return BooleanType.getInstance();
-        } else if ("empty".equals(typeName)) {
-            return EmptyType.getInstance();
-        } else if ("instance-identifier".equals(typeName)) {
-            return InstanceIdentifierType.getInstance();
-        }
-        return null;
-    }
-
 }
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BinaryType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BinaryType.java
deleted file mode 100644 (file)
index 1e89697..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import com.google.common.base.Optional;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-
-/**
- * The <code>default</code> implementation of Binary Type Definition interface.
- *
- * @see BinaryTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#binaryType()} instead
- */
-@Deprecated
-public final class BinaryType implements BinaryTypeDefinition {
-    private static final String DESCRIPTION = "The binary built-in type represents any binary data, i.e., a sequence of octets.";
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.8";
-    private static final String UNITS = "";
-
-    private static final QName QNAME = BaseTypes.BINARY_QNAME;
-
-    private static final BinaryType INSTANCE = new BinaryType();
-
-    private static final SchemaPath PATH = SchemaPath.create(Collections.singletonList(QNAME), true);
-    private final List<Byte> bytes = Collections.emptyList();
-    private final List<LengthConstraint> lengthConstraints;
-
-    private BinaryType() {
-        this.lengthConstraints = Collections.singletonList(
-                BaseConstraints.newLengthConstraint(0, Long.MAX_VALUE, Optional.of(""), Optional.of("")));
-    }
-
-    public static BinaryType getInstance() {
-        return INSTANCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
-     */
-    @Override
-    public BinaryTypeDefinition getBaseType() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
-     */
-    @Override
-    public String getUnits() {
-        return UNITS;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
-     */
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
-     */
-    @Override
-    public QName getQName() {
-        return QNAME;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
-     */
-    @Override
-    public SchemaPath getPath() {
-        return PATH;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
-     */
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
-     */
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
-     */
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.base.type.api.BinaryTypeDefinition
-     * #getLengthConstraint ()
-     */
-    @Override
-    public List<LengthConstraint> getLengthConstraints() {
-        return lengthConstraints;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(bytes);
-        result = prime * result + Objects.hashCode(lengthConstraints);
-        result = prime * result + QNAME.hashCode();
-        result = prime * result + PATH.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        BinaryType other = (BinaryType) obj;
-        return Objects.equals(bytes, other.bytes) && Objects.equals(lengthConstraints, other.lengthConstraints);
-    }
-
-    @Override
-    public String toString() {
-        return "BinaryType [name=" +
-                QNAME +
-                ", description=" +
-                DESCRIPTION +
-                ", reference=" +
-                REFERENCE +
-                ", bytes=" +
-                bytes +
-                ", lengthConstraints=" +
-                lengthConstraints +
-                ", units=" +
-                UNITS +
-                "]";
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BitsType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BitsType.java
deleted file mode 100644 (file)
index 71fae9e..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
-
-/**
- * The <code>default</code> implementation of Bits Type Definition interface.
- *
- * @see BitsTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#bitsTypeBuilder(SchemaPath)} instead
- */
-@Deprecated
-public final class BitsType implements BitsTypeDefinition {
-    private static final QName NAME = BaseTypes.BITS_QNAME;
-    private static final String DESCRIPTION = "The bits built-in type represents a bit set. "
-            + "That is, a bits value is a set of flags identified by small integer position "
-            + "numbers starting at 0.  Each bit number has an assigned name.";
-
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.7";
-    private static final String UNITS = "";
-    private final SchemaPath path;
-    private final List<Bit> bits;
-
-    /**
-     * Constructor with explicit definition of bits assigned to BitsType.
-     *
-     * @param path
-     * @param bits
-     */
-    private BitsType(final SchemaPath path, final List<Bit> bits) {
-        super();
-        this.bits = ImmutableList.copyOf(bits);
-        this.path = Preconditions.checkNotNull(path, "path must not be null");
-    }
-
-    public static BitsType create(final SchemaPath path, final List<Bit> bits) {
-        return new BitsType(path,bits);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
-     */
-    @Override
-    public BitsTypeDefinition getBaseType() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
-     */
-    @Override
-    public String getUnits() {
-        return UNITS;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
-     */
-    @Override
-    public Object getDefaultValue() {
-        // FIXME: Return real bits.
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
-     */
-    @Override
-    public QName getQName() {
-        return NAME;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
-     */
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
-     */
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
-     */
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
-     */
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public List<Bit> getBits() {
-        return bits;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(bits);
-        result = prime * result + NAME.hashCode();
-        result = prime * result + path.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        BitsType other = (BitsType) obj;
-        return Objects.equals(bits, other.bits) && Objects.equals(path, other.path);
-    }
-
-    @Override
-    public String toString() {
-        return "BitsType [name=" +
-                NAME +
-                ", path=" +
-                path +
-                ", description=" +
-                DESCRIPTION +
-                ", reference=" +
-                REFERENCE +
-                ", bits=" +
-                bits +
-                ", units=" +
-                UNITS +
-                "]";
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BooleanType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/BooleanType.java
deleted file mode 100644 (file)
index df45320..0000000
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
-
-/**
- * The <code>default</code> implementation of Boolean Type Definition interface.
- *
- * @see BooleanTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#booleanType()} instead
- */
-@Deprecated
-public final class BooleanType implements BooleanTypeDefinition {
-    private static final BooleanType INSTANCE = new BooleanType();
-    private static final SchemaPath PATH = SchemaPath.create(true, BaseTypes.BOOLEAN_QNAME);
-    private static final String DESCRIPTION = "The boolean built-in type represents a boolean value.";
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.5";
-    private static final String UNITS = "";
-
-    /**
-     * Default constructor with default value set to "false".
-     */
-    private BooleanType() {
-    }
-
-    /**
-     * Returns default instance of boolean built-in type.
-     * @return default instance of boolean built-in type.
-     */
-    public static BooleanType getInstance() {
-        return INSTANCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
-     */
-    @Override
-    public BooleanTypeDefinition getBaseType() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
-     */
-    @Override
-    public String getUnits() {
-        return UNITS;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue
-     * ()
-     */
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
-     */
-    @Override
-    public QName getQName() {
-        return BaseTypes.BOOLEAN_QNAME;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
-     */
-    @Override
-    public SchemaPath getPath() {
-        return PATH;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
-     */
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
-     */
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
-     */
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public String toString() {
-        return "BooleanType [name=" +
-                BaseTypes.BOOLEAN_QNAME +
-                ", path=" +
-                PATH +
-                "]";
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/EmptyType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/EmptyType.java
deleted file mode 100644 (file)
index bdd7fb3..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
-
-/**
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#emptyType()} instead
- */
-@Deprecated
-public final class EmptyType implements EmptyTypeDefinition, Immutable {
-    private static final EmptyType INSTANCE = new EmptyType();
-    private static final QName NAME = BaseTypes.EMPTY_QNAME;
-    private static final SchemaPath PATH = SchemaPath.create(Collections.singletonList(NAME), true);
-    private static final String DESCRIPTION = "The empty built-in type represents a leaf that does not have any value, it conveys information by its presence or absence.";
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#page-131";
-
-    private EmptyType() {
-    }
-
-    public static EmptyType getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public EmptyTypeDefinition getBaseType() {
-        return null;
-    }
-
-    @Override
-    public String getUnits() {
-        return null;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public QName getQName() {
-        return NAME;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return PATH;
-    }
-
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public String toString() {
-        return "type empty " + NAME;
-    }
-
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/IdentityrefType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/IdentityrefType.java
deleted file mode 100644 (file)
index 9f0ed19..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import com.google.common.base.Preconditions;
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.IdentitySchemaNode;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.IdentityrefTypeDefinition;
-
-/**
- * The <code>default</code> implementation of Identityref Type Definition
- * interface.
- *
- * @see IdentityrefTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#identityrefTypeBuilder(SchemaPath)} instead
- */
-@Deprecated
-public final class IdentityrefType implements IdentityrefTypeDefinition {
-    private static final QName NAME = BaseTypes.IDENTITYREF_QNAME;
-    private static final String DESCRIPTION = "The identityref type is used to reference an existing identity.";
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.10";
-    private static final String UNITS = "";
-
-    private final IdentitySchemaNode identity;
-    private final SchemaPath path;
-
-    private IdentityrefType(final SchemaPath path, final IdentitySchemaNode baseIdentity) {
-        this.path = Preconditions.checkNotNull(path, "Path must be specified");
-        this.identity = Preconditions.checkNotNull(baseIdentity,"baseIdentity must be specified.");
-    }
-
-    /**
-     * Constructs a new {@link IdentityrefTypeDefinition} definition.
-     *
-     * @param path Path to the definition.
-     * @param baseIdentity Base Identity, all derived identities are valid arguments for instance of this type.
-     * @return New identityref definition.
-     */
-    public static IdentityrefType create(final SchemaPath path, final IdentitySchemaNode baseIdentity) {
-        return new IdentityrefType(path, baseIdentity);
-    }
-
-    @Override
-    public String getUnits() {
-        return UNITS;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public QName getQName() {
-        return NAME;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public IdentitySchemaNode getIdentity() {
-        return identity;
-    }
-
-    @Override
-    public IdentityrefTypeDefinition getBaseType() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "identityref " + identity.getQName().getLocalName();
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/InstanceIdentifierType.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/InstanceIdentifierType.java
deleted file mode 100644 (file)
index 452c9a7..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import java.util.Collections;
-import java.util.List;
-import org.opendaylight.yangtools.concepts.Immutable;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.InstanceIdentifierTypeDefinition;
-
-/**
- * The <code>default</code> implementation of Instance Identifier Type
- * Definition interface.
- *
- * Instance Identifier has only two possible variants - one with
- * {@link #requireInstance()} which returns true, other one
- * returns false.
- *
- * @see InstanceIdentifierTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#instanceIdentifierType()} instead
- */
-@Deprecated
-public final class InstanceIdentifierType implements InstanceIdentifierTypeDefinition, Immutable {
-
-    private static final QName NAME = BaseTypes.INSTANCE_IDENTIFIER_QNAME;
-    private static final SchemaPath PATH = SchemaPath.create(true, NAME);
-    private static final String DESCRIPTION = "The instance-identifier built-in type is used to "
-            + "uniquely identify a particular instance node in the data tree.";
-    private static final String REFERENCE = "https://tools.ietf.org/html/rfc6020#section-9.13";
-    private static final String UNITS = "";
-
-    private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_TRUE = new InstanceIdentifierType(true);
-    private static final InstanceIdentifierType INSTANCE_WITH_REQUIRED_FALSE = new InstanceIdentifierType(false);
-
-    private final Boolean requireInstance;
-
-    private InstanceIdentifierType(final boolean requiredInstance) {
-        this.requireInstance = requiredInstance;
-    }
-
-    public static InstanceIdentifierType getInstance() {
-        return INSTANCE_WITH_REQUIRED_TRUE;
-    }
-
-    public static InstanceIdentifierType create(final boolean requireInstance) {
-        return requireInstance ? INSTANCE_WITH_REQUIRED_TRUE : INSTANCE_WITH_REQUIRED_FALSE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getBaseType()
-     */
-    @Override
-    public InstanceIdentifierTypeDefinition getBaseType() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.TypeDefinition#getUnits()
-     */
-    @Override
-    public String getUnits() {
-        return UNITS;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.TypeDefinition#getDefaultValue()
-     */
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getQName()
-     */
-    @Override
-    public QName getQName() {
-        return NAME;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getPath()
-     */
-    @Override
-    public SchemaPath getPath() {
-        return PATH;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getDescription()
-     */
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getReference()
-     */
-    @Override
-    public String getReference() {
-        return REFERENCE;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.SchemaNode#getStatus()
-     */
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.opendaylight.yangtools.yang.model.api.SchemaNode#getExtensionSchemaNodes()
-     */
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.type.
-     * InstanceIdentifierTypeDefinition# getPathStatement()
-     */
-    @Override
-    @Deprecated
-    public RevisionAwareXPath getPathStatement() {
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.opendaylight.yangtools.yang.model.api.type.
-     * InstanceIdentifierTypeDefinition# requireInstance()
-     */
-    @Override
-    public boolean requireInstance() {
-        return requireInstance;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + requireInstance.hashCode();
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        InstanceIdentifierType other = (InstanceIdentifierType) obj;
-        return requireInstance.equals(other.requireInstance);
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int32.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int32.java
deleted file mode 100644 (file)
index 1acb55a..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang int32 built-in type. <br>
- * int32 represents integer values between -2147483648 and 2147483647,
- * inclusively. The Java counterpart of Yang int32 built-in type is
- * {@link Integer}.
- *
- * @see AbstractSignedInteger
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#int32Type()} instead
- */
-@Deprecated
-public final class Int32 extends AbstractSignedInteger implements Immutable {
-    private static final String DESCRIPTION = "int32  represents integer values between -2147483648 and 2147483647, inclusively.";
-
-
-    private static final Int32 INSTANCE = new Int32();
-
-    private Int32() {
-        super(BaseTypes.INT32_QNAME, Int32.DESCRIPTION, Integer.MIN_VALUE, Integer.MAX_VALUE, "");
-    }
-
-    /**
-     * Returns default instance of int32 type.
-     * @return default instance of int32 type.
-     */
-    public static Int32 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.INT32_QNAME;
-    }
-
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int64.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int64.java
deleted file mode 100644 (file)
index 0e8a11d..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang int64 built-in type. <br>
- * int64 represents integer values between -9223372036854775808 and
- * 9223372036854775807, inclusively. The Java counterpart of Yang int64 built-in
- * type is {@link Long}.
- *
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#int64Type()} instead
- */
-@Deprecated
-public final class Int64 extends AbstractSignedInteger implements Immutable {
-    private static final String DESCRIPTION = "int64  represents integer values between -9223372036854775808 and 9223372036854775807, inclusively.";
-
-    private Int64() {
-        super(BaseTypes.INT64_QNAME, DESCRIPTION, Long.MIN_VALUE, Long.MAX_VALUE, "");
-    }
-
-
-    private static final Int64 INSTANCE = new Int64();
-
-    /**
-     * Returns default instance of int64 type.
-     * @return default instance of int64 type.
-     */
-    public static Int64 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.INT64_QNAME;
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int8.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Int8.java
deleted file mode 100644 (file)
index d16d7dc..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang int8 built-in type. <br>
- * int8 represents integer values between -128 and 127, inclusively. The Java
- * counterpart of Yang int8 built-in type is {@link Byte}.
- *
- * @see AbstractSignedInteger
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#int8Type()} instead
- */
-@Deprecated
-public final class Int8 extends AbstractSignedInteger implements Immutable {
-    private static final String DESCRIPTION = "represents integer values between -128 and 127, inclusively.";
-
-    private Int8() {
-        super(BaseTypes.INT8_QNAME, DESCRIPTION, Byte.MIN_VALUE, Byte.MAX_VALUE, "");
-    }
-
-    private static final Int8 INSTANCE = new Int8();
-
-    /**
-     * Returns default instance of int8 type.
-     * @return default instance of int8 type.
-     */
-    public static Int8 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.INT8_QNAME;
-    }
-
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Leafref.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Leafref.java
deleted file mode 100644 (file)
index a411f9e..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import com.google.common.base.Preconditions;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.UnknownSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
-
-/**
- * The <code>default</code> implementation of Instance Leafref Type Definition
- * interface.
- *
- * @see LeafrefTypeDefinition
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#leafrefTypeBuilder(SchemaPath)} instead
- */
-@Deprecated
-public final class Leafref implements LeafrefTypeDefinition {
-    private static final QName NAME = BaseTypes.constructQName("leafref");
-    private static final SchemaPath PATH = SchemaPath.create(true, NAME);
-    private static final String DESCRIPTION = "The leafref type is used to reference a particular leaf instance in the data tree.";
-    private static final String REF = "https://tools.ietf.org/html/rfc6020#section-9.9";
-
-    private final RevisionAwareXPath xpath;
-    private final SchemaPath path;
-
-    @Deprecated
-    public Leafref(final RevisionAwareXPath xpath) {
-        this(PATH, xpath);
-    }
-
-    private Leafref(final SchemaPath path, final RevisionAwareXPath target) {
-        this.path = Preconditions.checkNotNull(path,"path must be specified");
-        this.xpath = Preconditions.checkNotNull(target,"target must not be null.");
-    }
-
-    public static Leafref create(final SchemaPath path, final RevisionAwareXPath target) {
-        return new Leafref(path,target);
-    }
-
-    @Override
-    public LeafrefTypeDefinition getBaseType() {
-        return null;
-    }
-
-    @Override
-    public String getUnits() {
-        return "";
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public QName getQName() {
-        return NAME;
-    }
-
-    @Override
-    public SchemaPath getPath() {
-        return path;
-    }
-
-    @Override
-    public String getDescription() {
-        return DESCRIPTION;
-    }
-
-    @Override
-    public String getReference() {
-        return REF;
-    }
-
-    @Override
-    public Status getStatus() {
-        return Status.CURRENT;
-    }
-
-    @Override
-    public List<UnknownSchemaNode> getUnknownSchemaNodes() {
-        return Collections.emptyList();
-    }
-
-    @Override
-    public RevisionAwareXPath getPathStatement() {
-        return xpath;
-    }
-
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Objects.hashCode(xpath);
-        return result;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (obj == null) {
-            return false;
-        }
-        if (getClass() != obj.getClass()) {
-            return false;
-        }
-        Leafref other = (Leafref) obj;
-        return Objects.equals(xpath, other.xpath);
-    }
-
-    @Override
-    public String toString() {
-        return "type " +
-                NAME +
-                " [xpath=" +
-                xpath +
-                "]";
-    }
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint32.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint32.java
deleted file mode 100644 (file)
index c48c4d4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang uint32 built-in type. <br>
- * uint32 represents integer values between 0 and 4294967295, inclusively.
- *
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#uint32Type()} instead
- */
-@Deprecated
-public final class Uint32 extends AbstractUnsignedInteger implements Immutable {
-    public static final long MAX_VALUE = 4294967295L;
-    private static final String DESCRIPTION = "uint32 represents integer values between 0 and 4294967295, inclusively.";
-
-    private static final Uint32 INSTANCE = new Uint32();
-
-
-    private Uint32() {
-        super(BaseTypes.UINT32_QNAME, DESCRIPTION, MAX_VALUE, "");
-    }
-
-    public static Uint32 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.UINT32_QNAME;
-    }
-
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint64.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint64.java
deleted file mode 100644 (file)
index 3d872c0..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import java.math.BigInteger;
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang uint64 built-in type. <br>
- * uint64 represents integer values between 0 and 18446744073709551615,
- * inclusively. The Java counterpart of Yang uint64 built-in type is
- * {@link BigInteger}.
- *
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#uint64Type()} instead
- */
-@Deprecated
-public final class Uint64 extends AbstractUnsignedInteger implements Immutable {
-    public static final BigInteger MAX_VALUE = new BigInteger("18446744073709551615");
-    private static final String DESCRIPTION = "uint64 represents integer values between 0 and 18446744073709551615, inclusively.";
-
-    private static final Uint64 INSTANCE = new Uint64();
-
-    private Uint64() {
-        super(BaseTypes.UINT64_QNAME, DESCRIPTION, MAX_VALUE, "");
-    }
-
-    public static Uint64 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.UINT64_QNAME;
-    }
-
-}
diff --git a/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint8.java b/yang/yang-model-util/src/main/java/org/opendaylight/yangtools/yang/model/util/Uint8.java
deleted file mode 100644 (file)
index 4f0aad4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- */
-package org.opendaylight.yangtools.yang.model.util;
-
-import org.opendaylight.yangtools.concepts.Immutable;
-
-/**
- * Implementation of Yang uint8 built-in type. <br>
- * uint8 represents integer values between 0 and 255, inclusively.
- *
- * @see AbstractUnsignedInteger
- * @deprecated Use {@link org.opendaylight.yangtools.yang.model.util.type.BaseTypes#uint8Type()} instead
- */
-@Deprecated
-public final class Uint8 extends AbstractUnsignedInteger implements Immutable {
-    public static final int MAX_VALUE = 255;
-    private static final String DESCRIPTION = "uint8  represents integer values between 0 and 255, inclusively.";
-
-    private static final Uint8 INSTANCE = new Uint8();
-
-    private Uint8() {
-        super(BaseTypes.UINT8_QNAME, DESCRIPTION, MAX_VALUE, "");
-    }
-
-    public static Uint8 getInstance() {
-        return INSTANCE;
-    }
-
-    @Override
-    public Object getDefaultValue() {
-        return null;
-    }
-
-    @Override
-    public String toString() {
-        return "type " + BaseTypes.UINT8_QNAME;
-    }
-
-}
index 7f263193f3d3ea58995dc3ab90529009b41a7d95..e034fd1a10f22804a0085ffb9b760bf0bfc9b652 100644 (file)
@@ -7,79 +7,5 @@
  */
 /**
  * Utility classes and implementations for concepts defined in yang-model-api.
- *
- *
- * <h2>Base Types</h2>
- *
- * YANG specification defines several base types, for which YANG model does not
- * exists, but have same properties as derived types. This package provides
- * implementation of {@link org.opendaylight.yangtools.yang.model.api.TypeDefinition}
- * interface and it's subinterfaces which represent YANG base types and
- * types derived from them.
- * <p>
- * YANG Specification implicitly defines two types of base types - ones with default version,
- * and ones which needs to be derived.
- *
- * <h3>Base built-in types with default instance and semantics</h3>
- *
- *    <dl>
- *       <dt>empty</dt>
- *       <dd>A leaf that does not have any value - {@link org.opendaylight.yangtools.yang.model.util.EmptyType}</dd>
- *       <dt>binary</dt>
- *       <dd>Any binary data - {@link org.opendaylight.yangtools.yang.model.util.BinaryType}
- *       <dt>boolean</dt>
- *       <dd>"true" or "false" - {@link org.opendaylight.yangtools.yang.model.util.BinaryType}</dd>
- *       <dt>int8</dt>
- *       <dd>8-bit signed integer - {@link org.opendaylight.yangtools.yang.model.util.Int8}</dd>
- *       <dt>int16</dt>
- *       <dd>16-bit signed integer - {@link org.opendaylight.yangtools.yang.model.util.Int16}</dd>
- *       <dt>int32</dt>
- *       <dd>32-bit signed integer - {@link org.opendaylight.yangtools.yang.model.util.Int32}</dd>
- *       <dt>int64</dt>
- *       <dd>64-bit signed integer - {@link org.opendaylight.yangtools.yang.model.util.Int64}</dd>
- *       <dt>uint8</dt>
- *       <dd>8-bit unsigned integer -{@link org.opendaylight.yangtools.yang.model.util.Uint8}</dd>
- *       <dt>uint16</dt>
- *       <dd>16-bit unsigned integer - {@link org.opendaylight.yangtools.yang.model.util.Int16}</dd>
- *       <dt>uint32</dt>
- *       <dd>32-bit unsigned integer - {@link org.opendaylight.yangtools.yang.model.util.Int32}</dd>
- *       <dt>uint64</dt>
- *       <dd>64-bit unsigned integer -{@link org.opendaylight.yangtools.yang.model.util.Int64}</dd>
- *       <dt>instance-identifier</dt>
- *       <dd>References a data tree node - {@link org.opendaylight.yangtools.yang.model.util.InstanceIdentifierType}</dd>
- *       <dt>string</dt>
- *       <dd>{@link org.opendaylight.yangtools.yang.model.util.StringType}</dd>
- *     </dl>
- *
- * Common trait of base types with default instance is, that there is no requirement
- * for user input in YANG schema to further modify this types.
- * <p>
- * The implementation classes for these base types contains static method <code>getInstance()</code>
- * which provides reusable {@link org.opendaylight.yangtools.concepts.Immutable} instance of type.
- *
- * <h3>Base built-in types without default instance</h3>
- *
- *     <dl>
- *       <dt>bits</dt>
- *       <dd>A set of bits or flags - {@link org.opendaylight.yangtools.yang.model.util.BitsType}</dd>
- *       <dt>decimal64</dt>
- *       <dd>64-bit signed decimal number - {@link org.opendaylight.yangtools.yang.model.util.Decimal64}</dd>
- *       <dt>enumeration</dt>
- *       <dd>Enumerated strings - {@link org.opendaylight.yangtools.yang.model.util.EnumerationType}</dd>
- *       <dt>union</dt>
- *       <dd>Choice of member types - {@link org.opendaylight.yangtools.yang.model.util.UnionType}</dd>
- *       <dt>identity-ref</dt>
- *       <dd>A reference to an abstract identity - {@link org.opendaylight.yangtools.yang.model.util.IdentityrefType}</dd>
- *       <dt>leafref</dt>
- *       <dd>A reference to a leaf instance - {@link org.opendaylight.yangtools.yang.model.util.Leafref}</dd>
- *     </dl>
- *
- * Common trait of these base types without default instance is, that they require
- * user input in YANG schema to create instance of this types, and may have infinity number of
- * possible permutations.
- * <p>
- * The implementations have static factory method <code>create(SchemaPath,...)</code>
- * which provides {@link org.opendaylight.yangtools.concepts.Immutable} instance of type.
- *
  */
 package org.opendaylight.yangtools.yang.model.util;
\ No newline at end of file
index 1f0d806a2c45e2de8f4e83671880f7740445afb6..aefdf8a3941dafe5517a3c7acc2e29a808d0595a 100644 (file)
@@ -7,67 +7,16 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import com.google.common.base.Optional;
-import org.junit.Test;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
 
 public class BaseTypesTest {
 
     @Test
-    public void canCreateBaseTypes() {
-        Optional<?> int8 = BaseTypes.defaultBaseTypeFor("int8");
-        assertEquals(Optional.of(Int8.getInstance()), int8);
-
-        Optional<?> int16 = BaseTypes.defaultBaseTypeFor("int16");
-        assertEquals(Optional.of(Int16.getInstance()), int16);
-
-        Optional<?> int32 = BaseTypes.defaultBaseTypeFor("int32");
-        assertEquals(Optional.of(Int32.getInstance()), int32);
-
-        Optional<?> int64 = BaseTypes.defaultBaseTypeFor("int64");
-        assertEquals(Optional.of(Int64.getInstance()), int64);
-
-        Optional<?> int128 = BaseTypes.defaultBaseTypeFor("int128");
-        assertEquals("wrong type", Optional.absent(), int128);
-
-        Optional<?> uint8 = BaseTypes.defaultBaseTypeFor("uint8");
-        assertEquals(Optional.of(Uint8.getInstance()), uint8);
-
-        Optional<?> uint16 = BaseTypes.defaultBaseTypeFor("uint16");
-        assertEquals(Optional.of(Uint16.getInstance()), uint16);
-
-        Optional<?> uint32 =  BaseTypes.defaultBaseTypeFor("uint32");
-        assertEquals(Optional.of(Uint32.getInstance()), uint32);
-
-        Optional<?> uint64 = BaseTypes.defaultBaseTypeFor("uint64");
-        assertEquals(Optional.of(Uint64.getInstance()), uint64);
-
-        Optional<?> uint128 = BaseTypes.defaultBaseTypeFor("uint128");
-        assertEquals("wrong type", Optional.absent(), uint128);
-
-        Optional<?> stringType = BaseTypes.defaultBaseTypeFor("string");
-        assertEquals(Optional.of(StringType.getInstance()), stringType);
-
-        Optional<?> binaryType = BaseTypes.defaultBaseTypeFor("binary");
-        assertEquals(Optional.of(BinaryType.getInstance()), binaryType);
-
-        Optional<?> booleanType = BaseTypes.defaultBaseTypeFor("boolean");
-        assertEquals(Optional.of(BooleanType.getInstance()), booleanType);
-
-        Optional<?> emptyType = BaseTypes.defaultBaseTypeFor("empty");
-        assertEquals(Optional.of(EmptyType.getInstance()), emptyType);
-
-        Optional<?> instance_identifier = BaseTypes.defaultBaseTypeFor("instance_identifier");
-        assertEquals(Optional.absent(), instance_identifier);
-
-        Optional<?> whatever = BaseTypes.defaultBaseTypeFor("whatever");
-        assertEquals("wrong type", Optional.absent(), whatever);
-
+    public void testIsYangBuildInType() {
         assertFalse("whatever is not build-in type", BaseTypes.isYangBuildInType("whatever"));
         assertTrue("int8 is build-in type", BaseTypes.isYangBuildInType("int8"));
     }
 
-}
\ No newline at end of file
+}
index 12cf1d9c80e1d78d65b48d3c840a7717689edc02..146cb48191dd6b9099188149da2977dbebba8388 100644 (file)
@@ -11,37 +11,28 @@ import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.binaryType;
 import java.util.Collections;
-import java.util.List;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
+import org.opendaylight.yangtools.yang.model.api.type.BinaryTypeDefinition;
 
 public class BinaryTypeTest {
 
     @Test
     public void canCreateBinaryType() {
-        BinaryType binType = BinaryType.getInstance();
-        BinaryType binType1 = BinaryType.getInstance();
-        String stringBinType = binType.toString();
-
-
-        List<LengthConstraint> lengthConstraints = binType.getLengthConstraints();
-        assertTrue(lengthConstraints.toString().contains("max=9223372036854775807"));
-        assertTrue(lengthConstraints.toString().contains("min=0"));
+        BinaryTypeDefinition binType = binaryType();
+        BinaryTypeDefinition binType1 = binaryType();
 
+        assertEquals(0, binType.getLengthConstraints().size());
         assertNull(binType.getDefaultValue());
         assertEquals("CURRENT", Status.CURRENT, binType.getStatus());
         assertEquals("Base type is null", null, binType.getBaseType());
         assertEquals("getQName gives BINARY_QNAME", BaseTypes.BINARY_QNAME, binType.getQName());
-        assertEquals("empty string", "", binType.getUnits());
+        assertNull("Units should be null", binType.getUnits());
         assertEquals("getPath gives List of BINARY_QNAME",
                 Collections.singletonList(BaseTypes.BINARY_QNAME), binType.getPath().getPathFromRoot());
 
-        assertTrue("BinType.toString should contain Description", stringBinType.contains(binType.getDescription()));
-        assertTrue("BinType.toString should contain Reference", stringBinType.contains(binType.getReference()));
-
         assertTrue("binType1 should equal to binType",
                 binType.equals(binType1) && binType1.equals(binType));
         assertTrue("Hash code of binType and binType1 should be equal",
index 017c4423a1f04da7cdfd1714f4218867129ef273..5507357018d30a06a183bbd1995b3531b9d273c1 100644 (file)
@@ -9,9 +9,9 @@ package org.opendaylight.yangtools.yang.model.util;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
-
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
 import java.util.Collections;
-import java.util.List;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
@@ -19,6 +19,7 @@ import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
 import org.opendaylight.yangtools.yang.model.api.type.BitsTypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 public class BitsTypeTest {
 
@@ -28,23 +29,24 @@ public class BitsTypeTest {
     @Test
     public void canCreateBitsType(){
         MockitoAnnotations.initMocks(this);
+        doReturn("test").when(bit).getName();
 
         QName qName = QName.create("TestQName");
         SchemaPath schemaPath = SchemaPath.create(Collections.singletonList(qName), true);
-        List<BitsTypeDefinition.Bit> listBit = Collections.singletonList(bit);
-        BitsType bitsType = BitsType.create(schemaPath, listBit);
 
-        assertNotEquals("Description is not null", null, bitsType.getDescription());
-        assertEquals("QName", BaseTypes.BITS_QNAME, bitsType.getQName());
-        assertEquals("Should be empty string", "", bitsType.getUnits());
+        BitsTypeDefinition bitsType = BaseTypes.bitsTypeBuilder(schemaPath).addBit(bit).build();
+
+        assertNull("Description is not null", bitsType.getDescription());
+        assertEquals("QName", qName, bitsType.getQName());
+        assertNull("Should be null", bitsType.getUnits());
         assertNotEquals("Description should not be null", null, bitsType.toString());
-        assertNotEquals("Reference is not null", null, bitsType.getReference());
-        assertEquals("BaseType should be null", null, bitsType.getBaseType());
-        assertEquals("Default value should be null", null, bitsType.getDefaultValue());
+        assertNull("Reference is not null", bitsType.getReference());
+        assertNull("BaseType should be null", bitsType.getBaseType());
+        assertNull("Default value should be null", bitsType.getDefaultValue());
         assertEquals("getPath should equal schemaPath", schemaPath, bitsType.getPath());
         assertEquals("Status should be CURRENT", Status.CURRENT, bitsType.getStatus());
         assertEquals("Should be empty list", Collections.EMPTY_LIST, bitsType.getUnknownSchemaNodes());
-        assertEquals("Values should be [enumPair]", listBit, bitsType.getBits());
+        assertEquals("Values should be [enumPair]", Collections.singletonList(bit), bitsType.getBits());
 
         assertEquals("Hash code of bitsType should be equal",
                 bitsType.hashCode(), bitsType.hashCode());
index 0af2f8b35e5f2832a706675ca22d465034cc580a..56253d9d2947521747743552d25e02d1fb2b4e9f 100644 (file)
@@ -10,15 +10,17 @@ package org.opendaylight.yangtools.yang.model.util;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.booleanType;
 import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.BooleanTypeDefinition;
 
 public class BooleanTypeTest {
 
     @Test
     public void canCreateBooleanType() {
-        BooleanType boolType = BooleanType.getInstance();
+        BooleanTypeDefinition boolType = booleanType();
         String stringBoolType = boolType.toString();
 
         assertEquals("getPath gives List of BOOLEAN_QNAME",
@@ -26,12 +28,12 @@ public class BooleanTypeTest {
 
         assertEquals("getQName gives BOOLEAN_QNAME", BaseTypes.BOOLEAN_QNAME, boolType.getQName());
 
-        assertEquals("The boolean built-in type represents a boolean value.", boolType.getDescription());
+        assertNull(boolType.getDescription());
 
         String strPath = boolType.getPath().toString();
         assertTrue("Should contain string of getPath", stringBoolType.contains(strPath));
 
-        assertEquals("Should be empty string", "", boolType.getUnits());
+        assertNull("Should be null", boolType.getUnits());
 
         assertEquals("Base type is null", null, boolType.getBaseType());
 
index f8924835ec938876e26bce26b3e67c1d6f6414d3..9c021d91c172cac59bca2209bc0069dcf43fe1b9 100644 (file)
@@ -7,20 +7,20 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Status;
-
-import java.util.Collections;
-
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.emptyType;
+import java.util.Collections;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.EmptyTypeDefinition;
 
 public class EmptyTypeTest {
 
     @Test
     public void canCreateEmptyType() {
-        EmptyType emptyType = EmptyType.getInstance();
+        EmptyTypeDefinition emptyType = emptyType();
 
         assertEquals("QName", BaseTypes.EMPTY_QNAME, emptyType.getQName());
         assertEquals("Path", Collections.singletonList(BaseTypes.EMPTY_QNAME),
@@ -28,9 +28,9 @@ public class EmptyTypeTest {
         assertEquals("BaseType", null, emptyType.getBaseType());
         assertEquals("DefaultValue", null, emptyType.getDefaultValue());
         assertEquals("Status", Status.CURRENT, emptyType.getStatus());
-        assertTrue("Reference", emptyType.getReference().contains("rfc6020"));
+        assertNull("Reference", emptyType.getReference());
         assertEquals("Units", null, emptyType.getUnits());
-        assertNotEquals("Description is not null", null, emptyType.getDescription());
+        assertNull("Description is not null", emptyType.getDescription());
         assertEquals("UnknownSchemaNodes", Collections.EMPTY_LIST, emptyType.getUnknownSchemaNodes());
         assertTrue("toString", emptyType.toString().contains("empty"));
     }
index 3eb7a3014d39e3033a4227f2040f02415e6d8888..41b2d9bae540acb93c96c6ec27d1dd236b4137e6 100644 (file)
@@ -7,18 +7,18 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 import com.google.common.base.Optional;
+import java.util.Collections;
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
 import org.opendaylight.yangtools.yang.model.api.type.LengthConstraint;
-
-import java.util.Collections;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 public class ExtendedTypeTest {
     @Test
@@ -27,7 +27,7 @@ public class ExtendedTypeTest {
         String revision = "2014-08-26";
         String localName = "testType";
         QName testType = QName.create(namespace, revision, localName);
-        Int32 int32 = Int32.getInstance();
+        IntegerTypeDefinition int32 = BaseTypes.int32Type();
         String description = "This type is used for testing purpose";
         Optional<String> desc = Optional.of(description);
         String reference = "Test Reference";
index 6c1d9c102825a64011abdeabcdc6383352cd1a9e..46db0ed9c02c212aefe4bf25832e5a23672f4913 100644 (file)
@@ -7,23 +7,19 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
-
 import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 public class Int8Test {
 
     @Test
     public void testInt8() {
-        Int8 int8 = Int8.getInstance();
-        Int8 int8Second = Int8.getInstance();
+        IntegerTypeDefinition int8 = BaseTypes.int8Type();
+        IntegerTypeDefinition int8Second = BaseTypes.int8Type();
         assertTrue("The method 'getInstance()' has to return the same instance", int8 == int8Second);
         assertTrue("The method 'getBaseType()' is returning incorrect value", int8.getBaseType() == null);
         assertTrue("The method 'getDefaultType()' is returning incorrect value", int8.getDefaultValue() == null);
-        assertEquals("The method 'toString()' is returning incorrect value",
-                "type (urn:ietf:params:xml:ns:yang:1)int8", int8.toString());
-
     }
-
 }
index 2bf56314de42c9c835e67a32c846ee46bdf3934b..1972d94c25ef6d601b7ca8afc495563d0ff6e814 100644 (file)
@@ -13,11 +13,12 @@ import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
 import org.junit.Test;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.type.LeafrefTypeDefinition;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 public class LeafrefTest {
 
@@ -27,21 +28,19 @@ public class LeafrefTest {
         final RevisionAwareXPathImpl revision = new RevisionAwareXPathImpl("/test:Cont1/test:List1", false);
         final RevisionAwareXPathImpl revision2 = new RevisionAwareXPathImpl("/test:Cont1/test:List2", false);
 
-        final Leafref leafref = Leafref.create(schemaPath, revision);
-        final Leafref leafref2 = Leafref.create(schemaPath, revision2);
-        final Leafref leafref3 = Leafref.create(schemaPath, revision);
-        final Leafref leafref4 = leafref;
+        final LeafrefTypeDefinition leafref = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision).build();
+        final LeafrefTypeDefinition leafref2 = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision2).build();
+        final LeafrefTypeDefinition leafref3 = BaseTypes.leafrefTypeBuilder(schemaPath).setPathStatement(revision).build();
+        final LeafrefTypeDefinition leafref4 = leafref;
 
         assertNotNull("Object 'leafref' shouldn't be null.", leafref);
         assertNull("Base type of 'leafref' should be null.", leafref.getBaseType());
-        assertTrue("Units of 'leafref' should be empty.", leafref.getUnits().isEmpty());
+        assertNull("Units of 'leafref' should be empty.", leafref.getUnits());
         assertNull("Leafref does not have a default value", leafref.getDefaultValue());
-        assertEquals("QName of 'leafref' is value '(urn:ietf:params:xml:ns:yang:1)leafref'.",
-                BaseTypes.constructQName("leafref"), leafref.getQName());
+        assertEquals(QName.create("List1"), leafref.getQName());
         assertEquals("SchemaPath of 'leafref' is '/Cont1/List1'.", schemaPath, leafref.getPath());
-        assertEquals("Description of 'leafref' is 'The leafref type is used to reference a particular leaf instance in the data tree.'",
-                "The leafref type is used to reference a particular leaf instance in the data tree.", leafref.getDescription());
-        assertEquals("Reference of 'leafref' is 'https://tools.ietf.org/html/rfc6020#section-9.9'.", "https://tools.ietf.org/html/rfc6020#section-9.9", leafref.getReference());
+        assertNull(leafref.getDescription());
+        assertNull(leafref.getReference());
         assertEquals("Status of 'leafref' is current.", Status.CURRENT, leafref.getStatus());
         assertTrue("Object 'leafref' shouldn't have any unknown schema nodes.", leafref.getUnknownSchemaNodes().isEmpty());
         assertEquals("Revision aware XPath of 'leafref' should be '/test:Cont1/test:List1'.", revision, leafref.getPathStatement());
index 93038e22691855e94deef3e85aa27038daa8637f..d69af03bb358be61046b5a61983d04714b5b580f 100644 (file)
@@ -7,19 +7,18 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
+import static org.junit.Assert.assertEquals;
+import java.util.Collections;
 import org.junit.Test;
 import org.mockito.Mock;
 import org.mockito.MockitoAnnotations;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.Module;
-import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.api.RevisionAwareXPath;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
-
-import java.util.Collections;
-
-import static org.junit.Assert.assertEquals;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 
 public class SchemaContextUtilTest {
     @Mock private SchemaContext mockSchemaContext;
@@ -38,7 +37,7 @@ public class SchemaContextUtilTest {
         assertEquals("Should be null. Module bookstore not found", null,
                 SchemaContextUtil.findDataSchemaNode(mockSchemaContext, mockModule, xPath));
 
-        SchemaNode schemaNode = Int32.getInstance();
+        SchemaNode schemaNode = BaseTypes.int32Type();
         RevisionAwareXPath xPathRelative = new RevisionAwareXPathImpl("../prefix", false);
         assertEquals("Should be null, Module prefix not found", null,
                 SchemaContextUtil.findDataSchemaNodeForRelativeXPath(
index 9a2f913369f93b0e3e6a70babb34474028604974..b48ae7ababe6940666e30a8e7ac817b5ca6c2268 100644 (file)
@@ -7,25 +7,25 @@
  */
 package org.opendaylight.yangtools.yang.model.util;
 
-import org.junit.Test;
-import org.opendaylight.yangtools.yang.model.api.Status;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.ArrayList;
-
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
+import static org.opendaylight.yangtools.yang.model.util.type.BaseTypes.int32Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import org.junit.Test;
+import org.opendaylight.yangtools.yang.model.api.Status;
+import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
+import org.opendaylight.yangtools.yang.model.api.type.IntegerTypeDefinition;
 
 public class UnionTypeTest {
 
     @Test
     public void canCreateUnion() {
         List<TypeDefinition<?>> listTypes = new ArrayList<>();
-        Int32 int32 = Int32.getInstance();
+        IntegerTypeDefinition int32 = int32Type();
         listTypes.add(int32);
         UnionType unionType = UnionType.create(listTypes);
 
index 926f7c54e8c3cc0f19bf70a6f6c2c362d0961878..6c70eab3b5f5008f39d9f45c27f17f14af33bf92 100644 (file)
@@ -34,9 +34,9 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
-import org.opendaylight.yangtools.yang.model.util.Int32;
 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
 import org.opendaylight.yangtools.yang.stmt.TestUtils;
 
@@ -59,7 +59,7 @@ public class SchemaContextUtilTest {
         assertEquals("Should be null. Module bookstore not found", null,
                 SchemaContextUtil.findDataSchemaNode(mockSchemaContext, mockModule, xPath));
 
-        SchemaNode schemaNode = Int32.getInstance();
+        SchemaNode schemaNode = BaseTypes.int32Type();
         RevisionAwareXPath xPathRelative = new RevisionAwareXPathImpl("../prefix", false);
         assertEquals("Should be null, Module prefix not found", null,
                 SchemaContextUtil.findDataSchemaNodeForRelativeXPath(mockSchemaContext, mockModule, schemaNode,
index e0349c59017f567a28d65456c07253d9bf3515e5..0b6f3c6b30a5c43bb4f7c858ca05feaef97bd1dd 100644 (file)
@@ -10,10 +10,6 @@ package org.opendaylight.yangtools.yang.stmt;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNull;
-
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
-import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
-
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -36,9 +32,11 @@ import org.opendaylight.yangtools.yang.model.api.RpcDefinition;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.util.Int32;
 import org.opendaylight.yangtools.yang.model.util.RevisionAwareXPathImpl;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
+import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
+import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 public class SchemaContextUtilTest {
     @Mock
@@ -59,7 +57,7 @@ public class SchemaContextUtilTest {
         assertEquals("Should be null. Module bookstore not found", null,
                 SchemaContextUtil.findDataSchemaNode(mockSchemaContext, mockModule, xPath));
 
-        SchemaNode schemaNode = Int32.getInstance();
+        SchemaNode schemaNode = BaseTypes.int32Type();
         RevisionAwareXPath xPathRelative = new RevisionAwareXPathImpl("../prefix", false);
         assertEquals("Should be null, Module prefix not found", null,
                 SchemaContextUtil.findDataSchemaNodeForRelativeXPath(mockSchemaContext, mockModule, schemaNode,