Rename restconf-nb-rfc8040 to restconf-nb
[netconf.git] / restconf / restconf-nb / src / test / java / org / opendaylight / restconf / nb / rfc8040 / rests / services / impl / RootResourceDiscoveryServiceTest.java
1 /*
2  * Copyright (c) 2020 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.Test;
13
14 public class RootResourceDiscoveryServiceTest {
15     @Test
16     public void testJsonData() {
17         assertEquals("{\n"
18             + " \"links\" :\n"
19             + " {\n"
20             + "     \"rel\" : \"restconf\",\n"
21             + "     \"href\" : \"/fooBarBaz\"\n"
22             + " }\n"
23             + "}", new RootResourceDiscoveryServiceImpl("fooBarBaz").readJsonData().getEntity());
24     }
25
26     @Test
27     public void testXrdData() {
28         assertEquals("<?xml version='1.0' encoding='UTF-8'?>\n"
29             + "<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>\n"
30             + "     <Link rel='restconf' href='/fooBarBaz'/>\n"
31             + "</XRD>", new RootResourceDiscoveryServiceImpl("fooBarBaz").readXrdData().getEntity());
32     }
33 }