choiceToGeneratedType(context, typeBuilder, (ChoiceSchemaNode) schemaNode, inGrouping);
} else if (schemaNode instanceof ListSchemaNode) {
listToGenType(context, typeBuilder, childOf(typeBuilder), (ListSchemaNode) schemaNode, inGrouping);
+ } else if (schemaNode instanceof AnyxmlSchemaNode || schemaNode instanceof AnydataSchemaNode) {
+ opaqueToGeneratedType(context, typeBuilder, schemaNode);
}
}
}
--- /dev/null
+/*
+ * Copyright (c) 2019 PANTHEON.tech, s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.mdsal.binding.generator.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.util.List;
+import org.junit.Test;
+import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
+
+public class Mdsal506Test extends AbstractOpaqueTest {
+ @Test
+ public void generateAnydataTest() {
+ final SchemaContext context = YangParserTestUtils.parseYangResource("/mdsal506.yang");
+
+ final List<Type> types = new BindingGeneratorImpl().generateTypes(context);
+ assertNotNull(types);
+ assertEquals(4, types.size());
+
+ assertOpaqueNode(types, "mdsal506", ".lst", "TestAnydata");
+ assertOpaqueNode(types, "mdsal506", ".lst", "TestAnyxml");
+ }
+}
assertTrue(nodeList.exists());
assertTrue(nodeListBuilder.exists());
assertTrue(nodesType.exists());
- CompilationTestUtils.assertFilesCount(parent, 7);
+ CompilationTestUtils.assertFilesCount(parent, 8);
// Test if sources are compilable
CompilationTestUtils.testCompilation(sourcesOutputDir, compiledOutputDir);
// Test generated 'list links'
assertTrue(linksClass.isInterface());
CompilationTestUtils.assertImplementsIfc(linksClass, keyArgsClass);
- // TODO: anyxml
- assertEquals(6, abstractMethods(linksClass).size());
+ assertEquals(7, abstractMethods(linksClass).size());
// Test list key constructor arguments ordering
CompilationTestUtils.assertContainsConstructor(linksKeyClass, Byte.class, String.class, Integer.class);