import org.opendaylight.mdsal.binding.model.api.GeneratedType;
import org.opendaylight.mdsal.binding.model.api.MethodSignature;
import org.opendaylight.mdsal.binding.model.api.Type;
+import org.opendaylight.mdsal.binding.spec.naming.BindingMapping;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
}
@Test
- public void AugmentationWithRelativeXPathTest() {
+ public void testAugmentationWithRelativeXPath() {
final SchemaContext context = YangParserTestUtils.parseYangFiles(testModels);
assertNotNull("context is null", context);
- final BindingGenerator bindingGen = new BindingGeneratorImpl(true);
+ final BindingGenerator bindingGen = new BindingGeneratorImpl();
final List<Type> genTypes = bindingGen.generateTypes(context);
assertNotNull("genTypes is null", genTypes);
GeneratedTransferObject gtTunnelKey = null;
for (final Type type : genTypes) {
- if (type.getName().equals("InterfaceKey") && type.getPackageName().contains("augment._abstract.topology")) {
+ if (!type.getPackageName().contains("augment._abstract.topology")) {
+ continue;
+ }
+
+ if (type.getName().equals("InterfaceKey")) {
gtInterfaceKey = (GeneratedTransferObject) type;
- } else if (type.getName().equals("Interface")
- && type.getPackageName().contains("augment._abstract.topology")) {
+ } else if (type.getName().equals("Interface")) {
gtInterface = (GeneratedType) type;
- } else if (type.getName().equals("Tunnel") && type.getPackageName().contains("augment._abstract.topology")) {
+ } else if (type.getName().equals("Tunnel")) {
gtTunnel = (GeneratedType) type;
- } else if (type.getName().equals("TunnelKey")
- && type.getPackageName().contains("augment._abstract.topology")) {
+ } else if (type.getName().equals("TunnelKey")) {
gtTunnelKey = (GeneratedTransferObject) type;
}
}
assertNotNull("Interface methods are null", gtInterfaceMethods);
MethodSignature getIfcKeyMethod = null;
for (final MethodSignature method : gtInterfaceMethods) {
- if (method.getName().equals("getKey")) {
+ if (BindingMapping.IDENTIFIABLE_KEY_NAME.equals(method.getName())) {
getIfcKeyMethod = method;
break;
}
assertNotNull("Tunnel methods are null", tunnelMethods);
MethodSignature getTunnelKeyMethod = null;
for (MethodSignature method : tunnelMethods) {
- if (method.getName().equals("getKey")) {
+ if (BindingMapping.IDENTIFIABLE_KEY_NAME.equals(method.getName())) {
getTunnelKeyMethod = method;
break;
}