import org.opendaylight.yangtools.yang.common.QNameModule;
import org.opendaylight.yangtools.yang.common.Revision;
import org.opendaylight.yangtools.yang.common.YangConstants;
-import org.opendaylight.yangtools.yang.model.api.AugmentationSchema;
+import org.opendaylight.yangtools.yang.model.api.AugmentationSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
import org.opendaylight.yangtools.yang.model.api.ChoiceSchemaNode;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
public class AugmentTest {
private static final QNameModule FOO = QNameModule.create(
- URI.create("urn:opendaylight.foo"), Revision.valueOf("2013-10-13"));
+ URI.create("urn:opendaylight.foo"), Revision.of("2013-10-13"));
private static final QNameModule BAR = QNameModule.create(
- URI.create("urn:opendaylight.bar"), Revision.valueOf("2013-10-14"));
+ URI.create("urn:opendaylight.bar"), Revision.of("2013-10-14"));
private static final QNameModule BAZ = QNameModule.create(
- URI.create("urn:opendaylight.baz"), Revision.valueOf("2013-10-15"));
+ URI.create("urn:opendaylight.baz"), Revision.of("2013-10-15"));
private static final QName Q0 = QName.create(BAR, "interfaces");
private static final QName Q1 = QName.create(BAR, "ifEntry");
// foo.yang
final Module module1 = TestUtils.findModule(context, "foo").get();
- Set<AugmentationSchema> augmentations = module1.getAugmentations();
+ Set<AugmentationSchemaNode> augmentations = module1.getAugmentations();
assertEquals(1, augmentations.size());
- final AugmentationSchema augment = augmentations.iterator().next();
+ final AugmentationSchemaNode augment = augmentations.iterator().next();
assertNotNull(augment);
SchemaPath expectedSchemaPath = SchemaPath.create(qnames, true);
final Module module3 = TestUtils.findModule(context, "baz").get();
augmentations = module3.getAugmentations();
assertEquals(3, augmentations.size());
- AugmentationSchema augment1 = null;
- AugmentationSchema augment2 = null;
- AugmentationSchema augment3 = null;
- for (final AugmentationSchema as : augmentations) {
- if (as.getWhenCondition() == null) {
+ AugmentationSchemaNode augment1 = null;
+ AugmentationSchemaNode augment2 = null;
+ AugmentationSchemaNode augment3 = null;
+ for (final AugmentationSchemaNode as : augmentations) {
+ if (!as.getWhenCondition().isPresent()) {
augment3 = as;
- } else if ("if:ifType='ds0'".equals(as.getWhenCondition().toString())) {
+ } else if ("if:ifType='ds0'".equals(as.getWhenCondition().get().toString())) {
augment1 = as;
- } else if ("if:ifType='ds2'".equals(as.getWhenCondition().toString())) {
+ } else if ("if:ifType='ds2'".equals(as.getWhenCondition().get().toString())) {
augment2 = as;
}
}
final SchemaContext context = TestUtils.loadModules(getClass().getResource("/augment-test/rpc").toURI());
final URI NS_BAR = URI.create("urn:opendaylight:bar");
final URI NS_FOO = URI.create("urn:opendaylight:foo");
- final Revision revision = Revision.valueOf("2013-10-11");
+ final Revision revision = Revision.of("2013-10-11");
final Module bar = TestUtils.findModule(context, "bar").get();
final Set<RpcDefinition> rpcs = bar.getRpcs();
assertEquals(2, rpcs.size());
"nodes"));
final ContainerSchemaNode node = (ContainerSchemaNode) nodes.getDataChildByName(QName.create(
test.getQNameModule(), "node"));
- final Set<AugmentationSchema> augments = node.getAvailableAugmentations();
+ final Set<AugmentationSchemaNode> augments = node.getAvailableAugmentations();
assertEquals(1, augments.size());
assertEquals(1, node.getChildNodes().size());
final LeafSchemaNode id = (LeafSchemaNode) node.getDataChildByName(QName.create(test.getQNameModule(), "id"));