Address FIXME for QueuedNotificationManager
[yangtools.git] / yang / yang-parser-impl / src / test / java / org / opendaylight / yangtools / yang / stmt / TypedefSubStmtsTest.java
1 /*
2  * Copyright (c) 2016 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 package org.opendaylight.yangtools.yang.stmt;
10
11 import static org.junit.Assert.assertEquals;
12 import static org.junit.Assert.assertNotNull;
13
14 import java.util.Set;
15 import org.junit.Test;
16 import org.opendaylight.yangtools.yang.model.api.TypeDefinition;
17 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
18 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
19 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
20 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangStatementSourceImpl;
21 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.effective.EffectiveSchemaContext;
22
23 public class TypedefSubStmtsTest {
24
25     private static final YangStatementSourceImpl FOOBAR = new YangStatementSourceImpl
26             ("/typedef-substmts-test/typedef-substmts-test.yang", false);
27
28     @Test
29     public void typedefSubStmtsTest() throws ReactorException {
30         CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
31         StmtTestUtils.addSources(reactor, FOOBAR);
32
33         EffectiveSchemaContext result = reactor.buildEffective();
34         assertNotNull(result);
35
36         Set<TypeDefinition<?>> typedefs = result.getTypeDefinitions();
37         assertEquals(1, typedefs.size());
38
39         TypeDefinition<?> typedef = typedefs.iterator().next();
40         assertEquals("time-of-the-day", typedef.getQName().getLocalName());
41         assertEquals("string", typedef.getBaseType().getQName().getLocalName());
42         assertEquals("24-hour-clock", typedef.getUnits());
43         assertEquals("1am", typedef.getDefaultValue().toString());
44     }
45 }