2 * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.restconf.nb.jaxrs;
10 import javax.ws.rs.container.AsyncResponse;
11 import javax.ws.rs.core.Response;
12 import javax.ws.rs.core.UriInfo;
13 import org.eclipse.jdt.annotation.NonNull;
14 import org.junit.jupiter.api.BeforeEach;
15 import org.junit.jupiter.api.extension.ExtendWith;
16 import org.mockito.ArgumentCaptor;
17 import org.mockito.Captor;
18 import org.mockito.Mock;
19 import org.mockito.junit.jupiter.MockitoExtension;
20 import org.opendaylight.mdsal.dom.api.DOMActionService;
21 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
22 import org.opendaylight.mdsal.dom.api.DOMMountPoint;
23 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
24 import org.opendaylight.mdsal.dom.api.DOMRpcService;
25 import org.opendaylight.restconf.common.errors.RestconfDocumentedException;
26 import org.opendaylight.restconf.nb.rfc8040.AbstractJukeboxTest;
27 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindContext;
28 import org.opendaylight.restconf.server.mdsal.MdsalRestconfServer;
29 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
31 @ExtendWith(MockitoExtension.class)
32 abstract class AbstractRestconfTest extends AbstractJukeboxTest {
36 AsyncResponse asyncResponse;
38 DOMDataBroker dataBroker;
40 DOMActionService actionService;
42 DOMRpcService rpcService;
44 DOMMountPointService mountPointService;
46 DOMMountPoint mountPoint;
48 ArgumentCaptor<Response> responseCaptor;
50 ArgumentCaptor<RestconfDocumentedException> exceptionCaptor;
52 JaxRsRestconf restconf;
55 final void setupRestconf() {
56 restconf = new JaxRsRestconf(new MdsalRestconfServer(() -> DatabindContext.ofModel(modelContext()), dataBroker,
57 rpcService, actionService, mountPointService));
60 @NonNull EffectiveModelContext modelContext() {
61 return JUKEBOX_SCHEMA;