Move SimpleUriInfo
[netconf.git] / restconf / restconf-nb-rfc8040 / src / test / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / Netconf822Test.java
1 /*
2  * Copyright (c) 2021 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.rfc8040.rests.services.impl;
9
10 import static org.junit.Assert.assertEquals;
11
12 import org.junit.BeforeClass;
13 import org.junit.Test;
14 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
15 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
16
17 public class Netconf822Test {
18     private static EffectiveModelContext CONTEXT;
19
20     @BeforeClass
21     public static void beforeClass() {
22         CONTEXT = YangParserTestUtils.parseYangResourceDirectory("/nc822");
23     }
24
25     @Test
26     public void testOperationsContentJSON() {
27         assertEquals("{\n"
28             + "  \"ietf-restconf:operations\" : {\n"
29             + "    \"foo:new\": [null]\n"
30             + "  }\n"
31             + "}", OperationsContent.JSON.bodyFor(CONTEXT));
32     }
33
34     @Test
35     public void testOperationsContentXML() {
36         assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
37             + "<operations xmlns=\"urn:ietf:params:xml:ns:yang:ietf-restconf\"\n"
38             + "            xmlns:ns0=\"foo\" >\n"
39             + "  <ns0:new/>\n"
40             + "</operations>", OperationsContent.XML.bodyFor(CONTEXT));
41     }
42 }