Refactored base yang-java types.
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / parser / impl / AugmentTest.java
index 5250846a429105c298dfa0cb18762b7cb3f7772a..e4cfd1bb191b90e67e10ddb72d16fd84133df75e 100644 (file)
@@ -15,6 +15,7 @@ import java.text.DateFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Set;
@@ -31,9 +32,7 @@ import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
-import org.opendaylight.yangtools.yang.model.util.ExtendedType;
-import org.opendaylight.yangtools.yang.model.util.Leafref;
+import org.opendaylight.yangtools.yang.model.util.BaseTypes;
 
 import com.google.common.collect.Lists;
 
@@ -107,6 +106,11 @@ public class AugmentTest {
         qnames[3] = new QName(types1NS, types1Rev, t1, "ds0ChannelNumber");
         expectedPath = new SchemaPath(Lists.newArrayList(qnames), true);
         assertEquals(expectedPath, ds0ChannelNumber.getPath());
+        // type of leaf ds0ChannelNumber
+        QName typeQName = BaseTypes.constructQName("string");
+        List<QName> typePath = Collections.singletonList(typeQName);
+        expectedPath = new SchemaPath(typePath, true);
+        assertEquals(expectedPath, ds0ChannelNumber.getType().getPath());
 
         // leaf interface-id
         qnames[3] = new QName(types1NS, types1Rev, t1, "interface-id");
@@ -328,33 +332,4 @@ public class AugmentTest {
         assertEquals(expectedPath, caseNode3Child.getPath());
     }
 
-    @Test
-    public void testAugmentNodesTypeSchemaPath() throws Exception {
-        Module testModule = TestUtils.findModule(modules, "nodes");
-        Set<AugmentationSchema> augments = testModule.getAugmentations();
-        assertEquals(1, augments.size());
-        AugmentationSchema augment = augments.iterator().next();
-
-        LeafSchemaNode ifcId = (LeafSchemaNode) augment.getDataChildByName("interface-id");
-        Leafref ifcIdType = (Leafref) ifcId.getType();
-        SchemaPath ifcIdTypeSchemaPath = ifcIdType.getPath();
-        List<QName> ifcIdTypePath = ifcIdTypeSchemaPath.getPath();
-
-        Date expectedDate = simpleDateFormat.parse("2013-02-27");
-
-        QName q3 = new QName(types1NS, expectedDate, "data", "interface-id");
-        assertEquals(q0, ifcIdTypePath.get(0));
-        assertEquals(q1, ifcIdTypePath.get(1));
-        assertEquals(q2, ifcIdTypePath.get(2));
-        assertEquals(q3, ifcIdTypePath.get(3));
-
-        LeafSchemaNode myType = (LeafSchemaNode) augment.getDataChildByName("my-type");
-        ExtendedType leafType = (ExtendedType) myType.getType();
-
-        testModule = TestUtils.findModule(modules, "types");
-        TypeDefinition<?> typedef = TestUtils.findTypedef(testModule.getTypeDefinitions(), "int32-ext2");
-
-        assertEquals(typedef, leafType);
-    }
-
 }