import org.opendaylight.yangtools.yang.model.util.type.BaseTypes;
import org.opendaylight.yangtools.yang.model.util.type.IdentityrefTypeBuilder;
import org.opendaylight.yangtools.yang.parser.util.YangValidationException;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
public class TypeProviderImplTest {
public void testLeafRefRelativeSelfReference() throws Exception {
File relative = new File(getClass().getResource("/leafref/leafref-relative-invalid.yang").toURI());
- final SchemaContext schemaContext = TestUtils.parseYangSources(relative);
+ final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(relative);
final Module moduleRelative = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lrr")).iterator().next();
final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
LeafSchemaNode leaf = (LeafSchemaNode) leafref;
TypeDefinition<?> leafType = leaf.getType();
Type leafrefResolvedType = typeProvider.javaTypeForSchemaDefinitionType(leafType, leaf);
+ assertNotNull(leafrefResolvedType);
}
@Test (expected = YangValidationException.class)
public void testLeafRefAbsoluteSelfReference() throws Exception {
File relative = new File(getClass().getResource("/leafref/leafref-absolute-invalid.yang").toURI());
- final SchemaContext schemaContext = TestUtils.parseYangSources(relative);
+ final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(relative);
final Module moduleRelative = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lra")).iterator().next();
final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
LeafSchemaNode leaf = (LeafSchemaNode) leafref;
TypeDefinition<?> leafType = leaf.getType();
Type leafrefResolvedType = typeProvider.javaTypeForSchemaDefinitionType(leafType, leaf);
+ assertNotNull(leafrefResolvedType);
}
@Test
public void testLeafRefRelativeAndAbsoluteValidReference() throws Exception {
File valid = new File(getClass().getResource("/leafref/leafref-valid.yang").toURI());
- final SchemaContext schemaContext = TestUtils.parseYangSources(valid);
+ final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(valid);
final Module moduleValid = schemaContext.findModuleByNamespace(new URI("urn:xml:ns:yang:lrv")).iterator().next();
final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);
public void testMethodsOfTypeProviderImpl() throws Exception {
final File abstractTopology = new File(getClass().getResource("/base-yang-types.yang").toURI());
- final SchemaContext schemaContext = TestUtils.parseYangSources(abstractTopology);
+ final SchemaContext schemaContext = YangParserTestUtils.parseYangSources(abstractTopology);
final TypeProviderImpl typeProvider = new TypeProviderImpl(schemaContext);