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%2FRestPostOperationTest.java;h=819b5f8213d8b4a5c1931648cd680855c5309057;hp=833d030b920b46f8cdeb039b2ff16b6da70d8da3;hb=b29204146ca6957b5f968e07d9e7e2052ba70ef1;hpb=69005c240d2660dbd5bfa774cfd28e6f19f2bd77 diff --git a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java index 833d030b92..819b5f8213 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java +++ b/opendaylight/md-sal/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java @@ -43,9 +43,11 @@ import org.opendaylight.yangtools.yang.model.api.SchemaContext; public class RestPostOperationTest extends JerseyTest { private static String xmlDataAbsolutePath; + private static String xmlDataInterfaceAbsolutePath; private static String xmlDataRpcInput; private static CompositeNodeWrapper cnSnDataOutput; private static String xmlData2; + private static String xmlData3; private static ControllerContext controllerContext; private static BrokerFacade brokerFacade; @@ -115,13 +117,13 @@ public class RestPostOperationTest extends JerseyTest { controllerContext.setSchemas(schemaContextYangsIetf); mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED); String uri = createUri("/config/", "ietf-interfaces:interfaces"); - assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); mockCommitConfigurationDataPostMethod(null); - assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED); - assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); } @Test @@ -129,13 +131,13 @@ public class RestPostOperationTest extends JerseyTest { controllerContext.setSchemas(schemaContextYangsIetf); mockCommitConfigurationDataPostMethod(TransactionStatus.COMMITED); String uri = createUri("/datastore/", "ietf-interfaces:interfaces"); - assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(204, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); mockCommitConfigurationDataPostMethod(null); - assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(202, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); mockCommitConfigurationDataPostMethod(TransactionStatus.FAILED); - assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataAbsolutePath)); + assertEquals(500, post(uri, MediaType.APPLICATION_XML, xmlDataInterfaceAbsolutePath)); } @Test @@ -154,8 +156,10 @@ public class RestPostOperationTest extends JerseyTest { ControllerContext.getInstance().setMountService(mockMountService); - String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/cont1"); + String uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount"); assertEquals(204, post(uri, Draft02.MediaTypes.DATA + XML, xmlData2)); + uri = createUri("/config/", "ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont"); + assertEquals(204, post(uri, Draft02.MediaTypes.DATA + XML, xmlData3)); } private void mockInvokeRpc(CompositeNode result, boolean sucessful) { @@ -185,12 +189,16 @@ public class RestPostOperationTest extends JerseyTest { private static void loadData() throws IOException, URISyntaxException { InputStream xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces_absolute_path.xml"); xmlDataAbsolutePath = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream)); + xmlStream = RestconfImplTest.class.getResourceAsStream("/parts/ietf-interfaces_interfaces_interface_absolute_path.xml"); + xmlDataInterfaceAbsolutePath = TestUtils.getDocumentInPrintableForm(TestUtils.loadDocumentFrom(xmlStream)); String xmlPathRpcInput = RestconfImplTest.class.getResource("/full-versions/test-data2/data-rpc-input.xml") .getPath(); xmlDataRpcInput = TestUtils.loadTextFile(xmlPathRpcInput); cnSnDataOutput = prepareCnSnRpcOutput(); String data2Input = RestconfImplTest.class.getResource("/full-versions/test-data2/data2.xml").getPath(); xmlData2 = TestUtils.loadTextFile(data2Input); + String data3Input = RestconfImplTest.class.getResource("/full-versions/test-data2/data3.xml").getPath(); + xmlData3 = TestUtils.loadTextFile(data3Input); } private static CompositeNodeWrapper prepareCnSnRpcOutput() throws URISyntaxException {