import static com.google.common.base.Preconditions.checkState;
+import com.google.common.collect.ImmutableSet;
import java.io.File;
-import java.io.FileNotFoundException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.Collections;
import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
public class NormalizedDataBuilderTest {
private SchemaContext schema;
@Before
- public void setUp() throws URISyntaxException, FileNotFoundException, ReactorException {
- final File resourceFile = new File(getClass().getResource(
- "test.yang").toURI());
- schema = YangParserTestUtils.parseYangFiles(resourceFile);
+ public void setUp() throws URISyntaxException {
+ schema = YangParserTestUtils.parseYangFiles(new File(getClass().getResource("test.yang").toURI()));
containerNode = (ContainerSchemaNode) getSchemaNode(schema, "test", "container");
}
Builders.<Integer>leafBuilder().withNodeIdentifier(getNodeIdentifier("uint32InList"))
.withValue(1).build())
.withChild(Builders.containerBuilder().withNodeIdentifier(getNodeIdentifier("containerInList")).build())
- .withNodeIdentifier(
- new NodeIdentifierWithPredicates(
+ .withNodeIdentifier(NodeIdentifierWithPredicates.of(
getNodeIdentifier("list").getNodeType(), Collections.singletonMap(
getNodeIdentifier("uint32InList").getNodeType(), 1))).build();
AugmentationNode augmentation = Builders
.augmentationBuilder()
.withNodeIdentifier(
- new AugmentationIdentifier(Collections.singleton(getQName("augmentUint32"))))
+ new AugmentationIdentifier(ImmutableSet.of(getQName("augmentUint32"))))
.withChild(
Builders.<Integer>leafBuilder().withNodeIdentifier(getNodeIdentifier("augmentUint32"))
.withValue(11).build()).build();
private static AugmentationSchemaNode getAugmentationSchemaForChild(final ContainerSchemaNode containerNode,
final QName qname) {
for (AugmentationSchemaNode augmentationSchema : containerNode.getAvailableAugmentations()) {
- if (augmentationSchema.getDataChildByName(qname) != null) {
+ if (augmentationSchema.findDataChildByName(qname).isPresent()) {
return augmentationSchema;
}
}