import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThrows;
-import java.util.Set;
import java.util.function.Consumer;
import org.junit.BeforeClass;
import org.junit.Test;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
applyOperation(mod -> {
mod.write(YangInstanceIdentifier.of(FOO), Builders.containerBuilder()
.withNodeIdentifier(new NodeIdentifier(FOO))
- .withChild(Builders.augmentationBuilder()
- .withNodeIdentifier(new AugmentationIdentifier(Set.of(BAR)))
- .withChild(ImmutableNodes.leafNode(BAR, "xyzzy"))
- .build())
+ .withChild(ImmutableNodes.leafNode(BAR, "xyzzy"))
.build());
});
}
.withNodeIdentifier(new NodeIdentifier(FOO))
.build());
});
- assertEquals(
- "Node (foo)foo is missing mandatory descendant /AugmentationIdentifier{childNames=[(foo)bar]}/(foo)bar",
- ex.getMessage());
+ assertEquals("Node (foo)foo is missing mandatory descendant /(foo)bar", ex.getMessage());
}
@Test
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(new NodeIdentifier(BAZ))
.withChild(ImmutableNodes.leafNode(XYZZY_LEAF, "xyzzy"))
- .withChild(Builders.augmentationBuilder()
- .withNodeIdentifier(new AugmentationIdentifier(Set.of(XYZZY_AUGMENT, XYZZY_AUGMENT_CONT)))
- .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT, "xyzzy"))
+ .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT, "xyzzy"))
+ .withChild(Builders.containerBuilder()
+ .withNodeIdentifier(new NodeIdentifier(XYZZY_AUGMENT_CONT))
.withChild(Builders.containerBuilder()
- .withNodeIdentifier(new NodeIdentifier(XYZZY_AUGMENT_CONT))
- .withChild(Builders.containerBuilder()
- .withNodeIdentifier(new NodeIdentifier(XYZZY_AUGMENT_CONT_INNER))
- .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT_CONT_LEAF, "aug-cont-leaf"))
- .build())
+ .withNodeIdentifier(new NodeIdentifier(XYZZY_AUGMENT_CONT_INNER))
+ .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT_CONT_LEAF, "aug-cont-leaf"))
.build())
.build())
.build())
.withNodeIdentifier(new NodeIdentifier(BAR))
.withChild(Builders.choiceBuilder()
.withNodeIdentifier(new NodeIdentifier(BAZ))
- .withChild(Builders.augmentationBuilder()
- .withNodeIdentifier(new AugmentationIdentifier(Set.of(XYZZY_AUGMENT, XYZZY_AUGMENT_CONT)))
- .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT, "xyzzy"))
+ .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT, "xyzzy"))
+ .withChild(Builders.containerBuilder()
+ .withNodeIdentifier(NodeIdentifier.create(XYZZY_AUGMENT_CONT))
.withChild(Builders.containerBuilder()
- .withNodeIdentifier(NodeIdentifier.create(XYZZY_AUGMENT_CONT))
- .withChild(Builders.containerBuilder()
- .withNodeIdentifier(NodeIdentifier.create(XYZZY_AUGMENT_CONT_INNER))
- .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT_CONT_LEAF, "aug-cont-leaf"))
- .build())
+ .withNodeIdentifier(NodeIdentifier.create(XYZZY_AUGMENT_CONT_INNER))
+ .withChild(ImmutableNodes.leafNode(XYZZY_AUGMENT_CONT_LEAF, "aug-cont-leaf"))
.build())
.build())
.build())
.build())
.build());
});
- assertEquals("Node (foo)baz is missing mandatory descendant /AugmentationIdentifier{childNames="
- + "[(foo)xyzzy-augment, (foo)xyzzy-augment-container]}/(foo)xyzzy-augment", ex.getMessage());
+ assertEquals("Node (foo)baz is missing mandatory descendant /(foo)xyzzy-augment", ex.getMessage());
}