+ /**
+ * MountPoint test. URI represents mount point.
+ *
+ * Slashes in URI behind mount point. lst1 element with key
+ * GigabitEthernet0%2F0%2F0%2F0 (GigabitEthernet0/0/0/0) is requested via
+ * GET HTTP operation. It is tested whether %2F character is replaced with
+ * simple / in InstanceIdentifier parameter in method
+ * {@link BrokerFacade#readConfigurationDataBehindMountPoint(MountInstance, InstanceIdentifier)}
+ * which is called in method {@link RestconfImpl#readConfigurationData}
+ *
+ *
+ * @throws ParseException
+ */
+ @Test
+ public void getDataWithSlashesBehindMountPoint() throws UnsupportedEncodingException, URISyntaxException,
+ ParseException {
+ InstanceIdentifier awaitedInstanceIdentifier = prepareInstanceIdentifierForList();
+ when(
+ brokerFacade.readConfigurationDataBehindMountPoint(any(MountInstance.class),
+ eq(awaitedInstanceIdentifier))).thenReturn(prepareCnDataForMountPointTest());
+ MountInstance mountInstance = mock(MountInstance.class);
+ when(mountInstance.getSchemaContext()).thenReturn(schemaContextTestModule);
+ MountService mockMountService = mock(MountService.class);
+ when(mockMountService.getMountPoint(any(InstanceIdentifier.class))).thenReturn(mountInstance);
+
+ ControllerContext.getInstance().setMountService(mockMountService);
+
+ String uri = "/config/ietf-interfaces:interfaces/interface/0/yang-ext:mount/test-module:cont/lst1/GigabitEthernet0%2F0%2F0%2F0";
+ assertEquals(200, get(uri, MediaType.APPLICATION_XML));
+ }
+
+ private InstanceIdentifier prepareInstanceIdentifierForList() throws URISyntaxException, ParseException {
+ List<PathArgument> parameters = new ArrayList<>();
+
+ Date revision = new SimpleDateFormat("yyyy-MM-dd").parse("2014-01-09");
+ URI uri = new URI("test:module");
+ QName qNameCont = QName.create(uri, revision, "cont");
+ QName qNameList = QName.create(uri, revision, "lst1");
+ QName qNameKeyList = QName.create(uri, revision, "lf11");
+
+ parameters.add(new InstanceIdentifier.NodeIdentifier(qNameCont));
+ parameters.add(new InstanceIdentifier.NodeIdentifierWithPredicates(qNameList, qNameKeyList,
+ "GigabitEthernet0/0/0/0"));
+ return new InstanceIdentifier(parameters);
+ }
+