use of org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement in project yangtools by opendaylight.
the class EffectiveStatementTypeTest method testBoolean.
@Test
public void testBoolean() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-boolean"));
assertNotNull(currentLeaf.getType());
final BooleanTypeDefinition booleanEff = (BooleanTypeDefinition) ((TypeEffectiveStatement<?>) ((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next()).getTypeDefinition();
assertNull(booleanEff.getBaseType());
assertEquals(Optional.empty(), booleanEff.getUnits());
assertEquals(Optional.empty(), booleanEff.getDefaultValue());
assertEquals("boolean", booleanEff.getQName().getLocalName());
assertNotNull(booleanEff.getUnknownSchemaNodes());
assertFalse(booleanEff.getDescription().isPresent());
assertFalse(booleanEff.getReference().isPresent());
assertEquals(Status.CURRENT, booleanEff.getStatus());
assertNotNull(booleanEff.toString());
}
use of org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement in project yangtools by opendaylight.
the class EffectiveStatementTypeTest method testLeafrefWithDeref.
@Test
public void testLeafrefWithDeref() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-leafref-deref"));
assertNotNull(currentLeaf.getType());
final LeafrefTypeDefinition leafrefEff = (LeafrefTypeDefinition) ((TypeDefinitionAware) ((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next()).getTypeDefinition();
assertEquals("deref(../container-test)/leaf-test", leafrefEff.getPathStatement().getOriginalString());
assertNull(leafrefEff.getBaseType());
assertEquals(Optional.empty(), leafrefEff.getUnits());
assertEquals(Optional.empty(), leafrefEff.getDefaultValue());
assertNotNull(leafrefEff.toString());
assertEquals("leafref", leafrefEff.getQName().getLocalName());
assertEquals(Status.CURRENT, leafrefEff.getStatus());
assertNotNull(leafrefEff.getUnknownSchemaNodes());
assertFalse(leafrefEff.getDescription().isPresent());
assertFalse(leafrefEff.getReference().isPresent());
assertNotNull(leafrefEff.hashCode());
assertFalse(leafrefEff.equals(null));
assertFalse(leafrefEff.equals("test"));
assertTrue(leafrefEff.equals(leafrefEff));
}
use of org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement in project yangtools by opendaylight.
the class EffectiveStatementTypeTest method testInstanceIdentifier.
@Test
public void testInstanceIdentifier() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-instance-identifier"));
assertNotNull(currentLeaf.getType());
final InstanceIdentifierTypeDefinition instanceIdentEff = (InstanceIdentifierTypeDefinition) ((TypeEffectiveStatement<?>) ((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next()).getTypeDefinition();
assertNotNull(instanceIdentEff.toString());
assertFalse(instanceIdentEff.requireInstance());
assertEquals("instance-identifier", instanceIdentEff.getQName().getLocalName());
assertNull(instanceIdentEff.getBaseType());
assertEquals(Optional.empty(), instanceIdentEff.getDefaultValue());
assertNotNull(instanceIdentEff.getUnknownSchemaNodes());
assertFalse(instanceIdentEff.getDescription().isPresent());
assertFalse(instanceIdentEff.getReference().isPresent());
assertEquals(Optional.empty(), instanceIdentEff.getUnits());
assertEquals(Status.CURRENT, instanceIdentEff.getStatus());
assertNotNull(instanceIdentEff.hashCode());
assertFalse(instanceIdentEff.equals(null));
assertFalse(instanceIdentEff.equals("test"));
assertTrue(instanceIdentEff.equals(instanceIdentEff));
}
use of org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement in project yangtools by opendaylight.
the class EffectiveStatementTypeTest method testString.
@Test
public void testString() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-string"));
assertNotNull(currentLeaf.getType());
final StringTypeDefinition stringEff = (StringTypeDefinition) ((TypeEffectiveStatement<?>) ((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next()).getTypeDefinition();
assertEquals("string", stringEff.getQName().getLocalName());
assertEquals(Status.CURRENT, stringEff.getStatus());
assertEquals(Optional.empty(), stringEff.getUnits());
assertEquals(Optional.empty(), stringEff.getDefaultValue());
assertNotNull(stringEff.getUnknownSchemaNodes());
assertNull(stringEff.getBaseType());
assertFalse(stringEff.getDescription().isPresent());
assertFalse(stringEff.getReference().isPresent());
assertNotNull(stringEff.toString());
assertNotNull(stringEff.hashCode());
assertFalse(stringEff.equals(null));
assertFalse(stringEff.equals("test"));
assertTrue(stringEff.equals(stringEff));
assertFalse(stringEff.getLengthConstraint().isPresent());
assertNotNull(stringEff.getPatternConstraints());
}
use of org.opendaylight.yangtools.yang.model.api.stmt.LeafEffectiveStatement in project yangtools by opendaylight.
the class EffectiveStatementTypeTest method testLeafref.
@Test
public void testLeafref() {
currentLeaf = (LeafSchemaNode) types.getDataChildByName(QName.create(types.getQNameModule(), "leaf-leafref"));
assertNotNull(currentLeaf.getType());
final LeafrefTypeDefinition leafrefEff = (LeafrefTypeDefinition) ((TypeDefinitionAware) ((LeafEffectiveStatement) currentLeaf).effectiveSubstatements().iterator().next()).getTypeDefinition();
assertEquals("/container-test/leaf-test", leafrefEff.getPathStatement().getOriginalString());
assertNull(leafrefEff.getBaseType());
assertEquals(Optional.empty(), leafrefEff.getUnits());
assertEquals(Optional.empty(), leafrefEff.getDefaultValue());
assertNotNull(leafrefEff.toString());
assertEquals("leafref", leafrefEff.getQName().getLocalName());
assertEquals(Status.CURRENT, leafrefEff.getStatus());
assertNotNull(leafrefEff.getUnknownSchemaNodes());
assertFalse(leafrefEff.getDescription().isPresent());
assertFalse(leafrefEff.getReference().isPresent());
assertNotNull(leafrefEff.hashCode());
assertFalse(leafrefEff.equals(null));
assertFalse(leafrefEff.equals("test"));
assertTrue(leafrefEff.equals(leafrefEff));
}
Aggregations