use of org.opendaylight.yangtools.yang.model.api.stmt.PresenceStatement in project yangtools by opendaylight.
the class DeclaredStatementsTest method testDeclaredContainer.
@Test
public void testDeclaredContainer() throws ReactorException {
final StatementStreamSource containerStmtModule = sourceForResource("/declared-statements-test/container-declared-test.yang");
final SchemaContext schemaContext = StmtTestUtils.parseYangSources(containerStmtModule);
assertNotNull(schemaContext);
final Module testModule = schemaContext.findModules("container-declared-test").iterator().next();
assertNotNull(testModule);
final ContainerSchemaNode containerSchemaNode = (ContainerSchemaNode) testModule.getDataChildByName(QName.create(testModule.getQNameModule(), "test-container"));
assertNotNull(containerSchemaNode);
final ContainerStatement containerStatement = ((ContainerEffectiveStatement) containerSchemaNode).getDeclared();
final QName name = containerStatement.argument();
assertNotNull(name);
final WhenStatement containerStatementWhen = containerStatement.getWhenStatement().get();
final Collection<? extends IfFeatureStatement> containerStatementIfFeatures = containerStatement.getIfFeatures();
assertNotNull(containerStatementIfFeatures);
assertEquals(1, containerStatementIfFeatures.size());
final Collection<? extends MustStatement> containerStatementMusts = containerStatement.getMustStatements();
assertNotNull(containerStatementMusts);
assertEquals(1, containerStatementMusts.size());
final PresenceStatement containerStatementPresence = containerStatement.getPresence();
assertNotNull(containerStatementPresence);
assertNotNull(containerStatementPresence.argument());
assertTrue(containerStatement.getConfig().isPresent());
assertTrue(containerStatement.getStatus().isPresent());
assertTrue(containerStatement.getDescription().isPresent());
assertTrue(containerStatement.getReference().isPresent());
final Collection<? extends TypedefStatement> containerStatementTypedefs = containerStatement.getTypedefs();
assertNotNull(containerStatementTypedefs);
assertEquals(1, containerStatementTypedefs.size());
final Collection<? extends GroupingStatement> containerStatementGroupings = containerStatement.getGroupings();
assertNotNull(containerStatementGroupings);
assertEquals(1, containerStatementGroupings.size());
final Collection<? extends DataDefinitionStatement> containerStatementDataDefinitions = containerStatement.getDataDefinitions();
assertNotNull(containerStatementDataDefinitions);
assertEquals(1, containerStatementDataDefinitions.size());
}
Aggregations