2 * Copyright (c) 2016 Cisco Systems, Inc. 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.rfc8040.rests.services.impl;
10 import static org.junit.jupiter.api.Assertions.assertEquals;
11 import static org.junit.jupiter.api.Assertions.assertInstanceOf;
13 import org.junit.jupiter.api.Test;
14 import org.junit.jupiter.api.extension.ExtendWith;
15 import org.mockito.Mock;
16 import org.mockito.junit.jupiter.MockitoExtension;
17 import org.opendaylight.mdsal.dom.api.DOMActionService;
18 import org.opendaylight.mdsal.dom.api.DOMDataBroker;
19 import org.opendaylight.mdsal.dom.api.DOMMountPointService;
20 import org.opendaylight.mdsal.dom.api.DOMRpcService;
21 import org.opendaylight.restconf.nb.rfc8040.databind.DatabindContext;
22 import org.opendaylight.yangtools.yang.data.api.schema.LeafNode;
23 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
25 @ExtendWith(MockitoExtension.class)
26 class RestconfImplTest {
28 private DOMDataBroker dataBroker;
30 private DOMRpcService rpcService;
32 private DOMActionService actionService;
34 private DOMMountPointService mountPointService;
37 void testLibraryVersion() {
38 final var context = DatabindContext.ofModel(YangParserTestUtils.parseYangResourceDirectory("/restconf/impl"));
39 final var restconfImpl = new RestconfImpl(new MdsalRestconfServer(() -> context, dataBroker, rpcService,
40 actionService, mountPointService));
41 final var libraryVersion = assertInstanceOf(LeafNode.class, restconfImpl.yangLibraryVersionGET().data());
42 assertEquals("2019-01-04", libraryVersion.body());