Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Switch to using yangtools version of mockito-configuration"
[controller.git]
/
opendaylight
/
md-sal
/
sal-rest-connector
/
src
/
test
/
java
/
org
/
opendaylight
/
controller
/
sal
/
restconf
/
impl
/
test
/
RestconfImplTest.java
diff --git
a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
index 292dfd8e2836174f7d661b45dc44b462b583a209..c15cd530823fd06a49321946c1fe8e33bdaf4e9a 100644
(file)
--- a/
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
+++ b/
opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
@@
-1,14
+1,17
@@
package org.opendaylight.controller.sal.restconf.impl.test;
package org.opendaylight.controller.sal.restconf.impl.test;
-import static org.mockito.Mockito.*;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import java.io.FileNotFoundException;
import java.io.FileNotFoundException;
-import java.io.InputStream;
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.Test;
import java.util.Set;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
import org.opendaylight.controller.sal.restconf.impl.RestconfImpl;
@@
-19,21
+22,21
@@
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public class RestconfImplTest {
public class RestconfImplTest {
- private static final RestconfImpl restconfImpl =
new RestconfImpl
();
+ private static final RestconfImpl restconfImpl =
RestconfImpl.getInstance
();
@BeforeClass
public static void init() throws FileNotFoundException {
@BeforeClass
public static void init() throws FileNotFoundException {
- Set<Module> allModules = TestUtils.loadModules(RestconfImplTest.class.getResource("/full-versions/yangs").getPath());
+ Set<Module> allModules = TestUtils.loadModulesFrom("/full-versions/yangs");
+ assertNotNull(allModules);
SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules);
- ControllerContext controllerContext =
new ControllerContext
();
+ ControllerContext controllerContext =
ControllerContext.getInstance
();
controllerContext.setSchemas(schemaContext);
restconfImpl.setControllerContext(controllerContext);
}
@Test
public void testExample() throws FileNotFoundException {
controllerContext.setSchemas(schemaContext);
restconfImpl.setControllerContext(controllerContext);
}
@Test
public void testExample() throws FileNotFoundException {
- InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces.xml");
- CompositeNode loadedCompositeNode = TestUtils.loadCompositeNode(xmlStream);
+ CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn("/parts/ietf-interfaces_interfaces.xml", XmlToCompositeNodeProvider.INSTANCE);
BrokerFacade brokerFacade = mock(BrokerFacade.class);
when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));
BrokerFacade brokerFacade = mock(BrokerFacade.class);
when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))).thenReturn(loadedCompositeNode);
assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null));