Introduce restconf.nb.jaxrs package
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / jaxrs / AbstractRestconfTest.java
1 /*
2  * Copyright (c) 2023 PANTHEON.tech, s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.restconf.nb.jaxrs;
9
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;
30
31 @ExtendWith(MockitoExtension.class)
32 abstract class AbstractRestconfTest extends AbstractJukeboxTest {
33     @Mock
34     UriInfo uriInfo;
35     @Mock
36     AsyncResponse asyncResponse;
37     @Mock
38     DOMDataBroker dataBroker;
39     @Mock
40     DOMActionService actionService;
41     @Mock
42     DOMRpcService rpcService;
43     @Mock
44     DOMMountPointService mountPointService;
45     @Mock
46     DOMMountPoint mountPoint;
47     @Captor
48     ArgumentCaptor<Response> responseCaptor;
49     @Captor
50     ArgumentCaptor<RestconfDocumentedException> exceptionCaptor;
51
52     JaxRsRestconf restconf;
53
54     @BeforeEach
55     final void setupRestconf() {
56         restconf = new JaxRsRestconf(new MdsalRestconfServer(() -> DatabindContext.ofModel(modelContext()), dataBroker,
57             rpcService, actionService, mountPointService));
58     }
59
60     @NonNull EffectiveModelContext modelContext() {
61         return JUKEBOX_SCHEMA;
62     }
63 }