X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Ftest%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frestconf%2Fimpl%2Ftest%2FRestconfImplTest.java;h=906695b3aab9fbad4c7b38fc2fd30db95c7d2037;hb=af133ce587363d0b4293f4adbb9eac32e478ecbc;hp=e2559f4b70ab27e2e6d990996e84bd8fbfb47045;hpb=b78e63501576638e1f000fd46663f8c42340f9e2;p=controller.git 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 e2559f4b70..906695b3aa 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,17 +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.InstanceIdentifier; +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; @@ -40,33 +39,27 @@ public class RestconfImplTest { @BeforeClass public static void init() throws FileNotFoundException { - Set allModules = TestUtils - .loadModulesFrom("/full-versions/yangs"); + Set allModules = TestUtils.loadModulesFrom("/full-versions/yangs"); assertNotNull(allModules); SchemaContext schemaContext = TestUtils.loadSchemaContext(allModules); - controllerContext = spy( ControllerContext.getInstance() ); + controllerContext = spy(ControllerContext.getInstance()); controllerContext.setSchemas(schemaContext); } @Before - public void initMethod() - { + public void initMethod() { restconfImpl = RestconfImpl.getInstance(); - restconfImpl.setControllerContext( controllerContext ); + restconfImpl.setControllerContext(controllerContext); } @Test - public void testExample() throws FileNotFoundException { - CompositeNode loadedCompositeNode = TestUtils.readInputToCnSn( - "/parts/ietf-interfaces_interfaces.xml", - XmlToCompositeNodeProvider.INSTANCE); + public void testExample() throws FileNotFoundException, ParseException { + NormalizedNode normalizedNodeData = TestUtils.prepareNormalizedNodeWithIetfInterfacesInterfacesData(); BrokerFacade brokerFacade = mock(BrokerFacade.class); - when(brokerFacade.readOperationalData(any(InstanceIdentifier.class))) - .thenReturn(loadedCompositeNode); - assertEquals(loadedCompositeNode, + when(brokerFacade.readOperationalData(any(YangInstanceIdentifier.class))).thenReturn(normalizedNodeData); + assertEquals(normalizedNodeData, brokerFacade.readOperationalData(null)); } - }