import org.opendaylight.restconf.common.errors.RestconfError;
import org.opendaylight.restconf.common.patch.PatchContext;
import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils;
-import org.opendaylight.restconf.nb.rfc8040.TestUtils;
-import org.opendaylight.restconf.nb.rfc8040.handlers.SchemaContextHandler;
+import org.opendaylight.restconf.nb.rfc8040.databind.DatabindContext;
+import org.opendaylight.restconf.nb.rfc8040.databind.DatabindProvider;
import org.opendaylight.restconf.nb.rfc8040.jersey.providers.spi.AbstractIdentifierAwareJaxRsProvider;
import org.opendaylight.restconf.nb.rfc8040.legacy.NormalizedNodePayload;
import org.opendaylight.yangtools.yang.common.ErrorTag;
import org.opendaylight.yangtools.yang.common.ErrorType;
+import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
public abstract class AbstractBodyReaderTest {
+ protected static final QName MAP_CONT_QNAME = QName.create("map:ns", "my-map").intern();
+ protected static final QName KEY_LEAF_QNAME = QName.create("map:ns", "key-leaf").intern();
+ protected static final QName DATA_LEAF_QNAME = QName.create("map:ns", "data-leaf").intern();
+ protected static final QName LEAF_SET_QNAME = QName.create("set:ns", "my-set").intern();
+ protected static final QName LIST_QNAME = QName.create("list:ns", "unkeyed-list").intern();
+ protected static final QName LIST_LEAF1_QNAME = QName.create("list:ns", "leaf1").intern();
+ protected static final QName LIST_LEAF2_QNAME = QName.create("list:ns", "leaf2").intern();
+ protected static final QName CHOICE_CONT_QNAME = QName.create("choice:ns", "case-cont1").intern();
+ protected static final QName CASE_LEAF1_QNAME = QName.create("choice:ns", "case-leaf1").intern();
+
protected final MediaType mediaType;
- protected final SchemaContextHandler schemaContextHandler;
+ protected final DatabindProvider databindProvider;
protected final DOMMountPointService mountPointService;
protected AbstractBodyReaderTest(final EffectiveModelContext schemaContext) throws NoSuchFieldException,
IllegalAccessException {
mediaType = getMediaType();
- schemaContextHandler = TestUtils.newSchemaContextHandler(schemaContext);
+ final var databindContext = DatabindContext.ofModel(schemaContext);
+ databindProvider = () -> databindContext;
mountPointService = mock(DOMMountPointService.class);
- final DOMMountPoint mountPoint = mock(DOMMountPoint.class);
+ final var mountPoint = mock(DOMMountPoint.class);
doReturn(Optional.of(mountPoint)).when(mountPointService).getMountPoint(any(YangInstanceIdentifier.class));
doReturn(Optional.of(FixedDOMSchemaService.of(schemaContext))).when(mountPoint)
.getService(DOMSchemaService.class);