- @Test
- public void multipleEqualNameDataNodeTestForContainerJsonTest() {
- multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-container.json", ErrorType.APPLICATION,
- ErrorTag.BAD_ELEMENT,JsonToCompositeNodeProvider.INSTANCE);
- }
-
- @Test
- public void multipleEqualNameDataNodeTestForLeafJsonTest() {
- multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-leaf.json", ErrorType.PROTOCOL,
- ErrorTag.MALFORMED_MESSAGE,JsonToCompositeNodeProvider.INSTANCE);
- }
-
- @Test
- public void multipleEqualNameDataNodeTestForContainerXmlTest() {
- multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-container.xml", ErrorType.APPLICATION,
- ErrorTag.BAD_ELEMENT,XmlToCompositeNodeProvider.INSTANCE);
- }
-
- @Test
- public void multipleEqualNameDataNodeTestForLeafXmlTest() {
- multipleEqualNameDataNodeTest("/equal-data-node-names/equal-name-data-for-leaf.xml", ErrorType.APPLICATION,
- ErrorTag.BAD_ELEMENT,XmlToCompositeNodeProvider.INSTANCE);
- }
-
- private void multipleEqualNameDataNodeTest(String path, ErrorType errorType, ErrorTag errorTag,MessageBodyReader<CompositeNode> messageBodyReader) {
- try {
- CompositeNode compositeNode = TestUtils.readInputToCnSn(path, false,messageBodyReader);
- assertNotNull(compositeNode);
-
- Set<Module> modules = null;
- modules = TestUtils.loadModulesFrom("/equal-data-node-names/yang");
- assertNotNull(modules);
-
- TestUtils.normalizeCompositeNode(compositeNode, modules, "equal-data-node-names" + ":" + "cont");
- fail("Exception RestconfDocumentedException should be raised");
- } catch (RestconfDocumentedException e) {
- List<RestconfError> errors = e.getErrors();
- assertNotNull(errors);
-
- assertEquals(1, errors.size());
-
- RestconfError restconfError = errors.get(0);
-
- assertEquals(errorType, restconfError.getErrorType());
- assertEquals(errorTag, restconfError.getErrorTag());
- }
- }
-