Skip to content

Commit c3fddef

Browse files
committed
Use DatabindPath in PatchEntity
Implement changes made in: opendaylight/netconf@b25bb1f JIRA: LIGHTY-354 Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
1 parent b3cfe52 commit c3fddef

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

  • lighty-modules/lighty-restconf-nb-community/src/test/java/io/lighty/modules/northbound/restconf/community/impl/tests

lighty-modules/lighty-restconf-nb-community/src/test/java/io/lighty/modules/northbound/restconf/community/impl/tests/YangPatchTest.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,11 @@ public void patchDataReplaceTest() throws Exception {
5959
.node(CONTAINER_ID)
6060
.build();
6161

62-
final PatchEntity entityReplace = new PatchEntity("edit1", Edit.Operation.Replace, targetNodeMerge,
63-
patchContainerNode);
62+
final DatabindContext databindContext = DatabindContext.ofModel(getLightyController()
63+
.getServices().getDOMSchemaService().getGlobalContext());
64+
65+
final PatchEntity entityReplace = new PatchEntity(
66+
"edit1", Edit.Operation.Replace, getPath(targetNodeMerge, databindContext), patchContainerNode);
6467
final PatchContext patchContext = new PatchContext("test-patch", List.of(entityReplace));
6568

6669
final var strategy = new MdsalRestconfStrategy(DatabindContext.ofModel(getLightyController()
@@ -107,4 +110,10 @@ private static ContainerNode getContainerWithData() {
107110
.withValue(Collections.singletonList(myList))
108111
.build();
109112
}
113+
114+
private DatabindPath.Data getPath(final YangInstanceIdentifier path, DatabindContext databindContext) {
115+
final var childAndStack = new DatabindPath.Data(
116+
databindContext).databind().schemaTree().enterPath(path).orElseThrow();
117+
return new DatabindPath.Data(databindContext, childAndStack.stack().toInference(), path, childAndStack.node());
118+
}
110119
}

0 commit comments

Comments
 (0)