Merge "Simplify method isMutualExclusive in Subnet. Remove redundant 'if' statements."
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / test / RestconfImplTest.java
1 package org.opendaylight.controller.sal.restconf.impl.test;
2
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;
7
8 import java.io.FileNotFoundException;
9 import java.io.InputStream;
10 import java.util.Set;
11
12 import org.junit.BeforeClass;
13 import org.junit.Test;
14 import org.opendaylight.controller.sal.restconf.impl.*;
15 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
16 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19
20 public class RestconfImplTest {
21
22     private static final RestconfImpl restconfImpl = RestconfImpl.getInstance();
23
24     @BeforeClass
25     public static void init() throws FileNotFoundException {
26         Set<Module> allModules = TestUtils.loadModules(RestconfImplTest.class.getResource("/full-versions/yangs")
27                 .getPath());
28         SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
29         ControllerContext controllerContext = ControllerContext.getInstance();
30         controllerContext.setSchemas(schemaContext);
31         restconfImpl.setControllerContext(controllerContext);
32     }
33
34     @Test
35     public void testExample() throws FileNotFoundException {
36         InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
37         CompositeNode loadedCompositeNode = TestUtils.loadCompositeNodeWithXmlTreeBuilder(xmlStream);
38         BrokerFacade brokerFacade = mock(BrokerFacade.class);
39         when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
40         assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));
41     }
42
43 }