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;
}
assertNotNull(simpleContainer);
assertNotNull(nestedContainer);
- assertEquals(3, simpleContainer.getMethodDefinitions().size());
- assertEquals(2, nestedContainer.getMethodDefinitions().size());
+ assertEquals(4, simpleContainer.getMethodDefinitions().size());
+ assertEquals(3, nestedContainer.getMethodDefinitions().size());
int getFooMethodCounter = 0;
int getBarMethodCounter = 0;
}
assertEquals(1, getFooMethodCounter);
- assertEquals("Short", getFooMethodReturnTypeName);
+ assertEquals("Uint8", getFooMethodReturnTypeName);
assertEquals(1, getBarMethodCounter);
assertEquals("String", getBarMethodReturnTypeName);
}
assertNotNull(simpleContainer);
assertNotNull(nestedContainer);
- assertEquals(3, simpleContainer.getMethodDefinitions().size());
- assertEquals(2, nestedContainer.getMethodDefinitions().size());
+ assertEquals(4, simpleContainer.getMethodDefinitions().size());
+ assertEquals(3, nestedContainer.getMethodDefinitions().size());
int getFooMethodCounter = 0;
int getBarMethodCounter = 0;
String getBarMethodReturnTypeName = "";
String getNestedContainerReturnTypeName = "";
for (final MethodSignature method : simpleContainer.getMethodDefinitions()) {
+ if (method.isDefault()) {
+ continue;
+ }
if (method.getName().equals("getFoo")) {
getFooMethodCounter++;
getFooMethodReturnTypeName = method.getReturnType().getName();
}
assertEquals(1, getFooMethodCounter);
- assertEquals("Short", getFooMethodReturnTypeName);
+ assertEquals("Uint8", getFooMethodReturnTypeName);
assertEquals(1, getBarMethodCounter);
assertEquals("List", getBarMethodReturnTypeName);
simpleListMethodsCount = genType.getMethodDefinitions().size();
final List<MethodSignature> methods = genType.getMethodDefinitions();
for (final MethodSignature method : methods) {
- if (method.getName().equals("getKey")) {
- getSimpleListKeyMethodCount++;
- getSimpleListKeyMethodReturnTypeName = method.getReturnType().getName();
- } else if (method.getName().equals("getListChildContainer")) {
- getListChildContainerMethodCount++;
- getListChildContainerMethodReturnTypeName = method.getReturnType().getName();
- } else if (method.getName().equals("getFoo")) {
- getFooMethodCount++;
- } else if (method.getName().equals("setFoo")) {
- setFooMethodCount++;
- } else if (method.getName().equals("getSimpleLeafList")) {
- getSimpleLeafListMethodCount++;
- } else if (method.getName().equals("setSimpleLeafList")) {
- setSimpleLeafListMethodCount++;
- } else if (method.getName().equals("getBar")) {
- getBarMethodCount++;
+ switch (method.getName()) {
+ case BindingMapping.IDENTIFIABLE_KEY_NAME:
+ getSimpleListKeyMethodCount++;
+ getSimpleListKeyMethodReturnTypeName = method.getReturnType().getName();
+ break;
+ case "getListChildContainer":
+ getListChildContainerMethodCount++;
+ getListChildContainerMethodReturnTypeName = method.getReturnType().getName();
+ break;
+ case "getFoo":
+ getFooMethodCount++;
+ break;
+ case "setFoo":
+ setFooMethodCount++;
+ break;
+ case "getSimpleLeafList":
+ getSimpleLeafListMethodCount++;
+ break;
+ case "setSimpleLeafList":
+ setSimpleLeafListMethodCount++;
+ break;
+ case "getBar":
+ getBarMethodCount++;
+ break;
+ default:
}
}
} else if (genType.getName().equals("ListChildContainer")) {
}
}
- assertEquals(1, listParentContainerMethodsCount);
- assertEquals(1, listChildContainerMethodsCount);
+ assertEquals(3, listParentContainerMethodsCount);
+ assertEquals(2, listChildContainerMethodsCount);
assertEquals(1, getSimpleListKeyMethodCount);
assertEquals(1, listKeyClassCount);
assertEquals(0, setSimpleLeafListMethodCount);
assertEquals(1, getBarMethodCount);
- assertEquals(6, simpleListMethodsCount);
+ assertEquals(7, simpleListMethodsCount);
}
@Test