processUsesAugments(notification, module);
final GeneratedTypeBuilder notificationInterface = addDefaultInterfaceDefinition(basePackageName,
- notification, BindingTypes.DATA_OBJECT, module);
+ notification, null, module);
notificationInterface.addImplementsType(NOTIFICATION);
genCtx.get(module).addChildNodeType(notification, notificationInterface);
package org.opendaylight.yangtools.sal.binding.generator.impl;
import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.IOException;
}
+ @Test
+ public void notificationGenerationTest() throws IOException, YangSyntaxErrorException, URISyntaxException {
+ File resourceFile = new File(getClass().getResource("/binding-generator-impl-test/notification-test.yang")
+ .toURI());
+ File resourceDir = resourceFile.getParentFile();
+
+ YangParserImpl parser = YangParserImpl.getInstance();
+ SchemaContext context = parser.parseFile(resourceFile, resourceDir);
+
+ List<Type> generateTypes = new BindingGeneratorImpl(false).generateTypes(context);
+
+ GeneratedType foo = null;
+ for (Type type : generateTypes) {
+ if (type.getName().equals("Foo")) {
+ foo = (GeneratedType) type;
+ break;
+ }
+ }
+
+ Type childOf = null;
+ Type dataObject = null;
+ List<Type> impl = foo.getImplements();
+ for (Type type : impl) {
+ switch (type.getName()) {
+ case "ChildOf":
+ childOf = type;
+ break;
+ case "DataObject":
+ dataObject = type;
+ break;
+ }
+ }
+
+ assertNull(childOf);
+ assertNotNull(dataObject);
+ }
+
}