X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestconfImplTest.java;h=fa878b68e51d3bc939d949af3df9d8f1687f3e92;hp=236712b45499a70df1b1e69b7c19e3d094dc561b;hb=2727bea09c83646b6cbd2ef9672d0b7f6cf3b22f;hpb=de3e413b633b7555ae8f3fe2ec163dbb7dda5da8 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 236712b454..fa878b68e5 100644 --- 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 @@ -15,16 +15,16 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.when; import java.io.FileNotFoundException; +import java.text.ParseException; import java.util.Set; import org.junit.Before; 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.yangtools.yang.data.api.CompositeNode; import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier; +import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode; import org.opendaylight.yangtools.yang.model.api.Module; import org.opendaylight.yangtools.yang.model.api.SchemaContext; @@ -39,9 +39,9 @@ public class RestconfImplTest { @BeforeClass public static void init() throws FileNotFoundException { - Set allModules = TestUtils.loadModulesFrom("/full-versions/yangs"); + final Set allModules = TestUtils.loadModulesFrom("/full-versions/yangs"); assertNotNull(allModules); - SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules); + final SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules); controllerContext = spy(ControllerContext.getInstance()); controllerContext.setSchemas(schemaContext); @@ -53,13 +53,16 @@ public class RestconfImplTest { restconfImpl.setControllerContext(controllerContext); } + @SuppressWarnings("unchecked") @Test - public void testExample() throws FileNotFoundException { - CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn("/parts/ietf-interfaces_interfaces.xml", - XmlToCompositeNodeProvider.INSTANCE); - BrokerFacade brokerFacade = mock(BrokerFacade.class); - when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(loadedCompositeNode); - assertEquals(loadedCompositeNode, brokerFacade.readOperationalData(null)); + public void testExample() throws FileNotFoundException, ParseException { + @SuppressWarnings("rawtypes") + final + NormalizedNode normalizedNodeData = TestUtils.prepareNormalizedNodeWithIetfInterfacesInterfacesData(); + final BrokerFacade brokerFacade = mock(BrokerFacade.class); + when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(normalizedNodeData); + assertEquals(normalizedNodeData, + brokerFacade.readOperationalData(null)); } }