1 package org.opendaylight.controller.sal.restconf.impl.test;
3 import static org.junit.Assert.assertEquals;
4 import static org.mockito.Matchers.any;
5 import static org.mockito.Mockito.mock;
6 import static org.mockito.Mockito.when;
8 import java.io.FileNotFoundException;
11 import org.junit.BeforeClass;
12 import org.junit.Test;
13 import org.opendaylight.controller.sal.restconf.impl.*;
14 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
15 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
16 import org.opendaylight.yangtools.yang.model.api.Module;
17 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 public class RestconfImplTest {
21 private static final RestconfImpl restconfImpl = RestconfImpl.getInstance();
24 public static void init() throws FileNotFoundException {
25 Set<Module> allModules = TestUtils.loadModules(RestconfImplTest.class.getResource("/full-versions/yangs")
27 SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
28 ControllerContext controllerContext = ControllerContext.getInstance();
29 controllerContext.setSchemas(schemaContext);
30 restconfImpl.setControllerContext(controllerContext);
34 public void testExample() throws FileNotFoundException {
35 CompositeNode loadedCompositeNode = TestUtils.loadCompositeNode("/parts/ietf-interfaces_interfaces.xml");
36 BrokerFacade brokerFacade = mock(BrokerFacade.class);
37 when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
38 assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));