/* * Copyright (c) 2016 Cisco Systems, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.opendaylight.restconf.nb.rfc8040.rests.services.impl; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.mock; import java.io.IOException; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; import org.opendaylight.mdsal.dom.api.DOMMountPointService; import org.opendaylight.restconf.nb.rfc8040.TestRestconfUtils; import org.opendaylight.restconf.nb.rfc8040.TestUtils; import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils; @RunWith(MockitoJUnitRunner.StrictStubs.class) public class RestconfOperationsServiceTest { @Test public void getOperationsTest() throws IOException { final var oper = new RestconfOperationsServiceImpl( TestUtils.newSchemaContextHandler( YangParserTestUtils.parseYangFiles(TestRestconfUtils.loadFiles("/modules"))), mock(DOMMountPointService.class)); assertEquals("{\n" + " \"ietf-restconf:operations\" : {\n" + " \"module1:dummy-rpc1-module1\": [null],\n" + " \"module1:dummy-rpc2-module1\": [null],\n" + " \"module2:dummy-rpc1-module2\": [null],\n" + " \"module2:dummy-rpc2-module2\": [null]\n" + " }\n" + "}", oper.getOperationsJSON()); assertEquals("\n" + "\n" + " \n" + " \n" + " \n" + " \n" + "", oper.getOperationsXML()); } }