--- /dev/null
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.netconf.rpc;\r
+\r
+import static org.junit.Assert.assertTrue;\r
+import static org.junit.Assert.fail;\r
+\r
+import org.junit.jupiter.api.Test;\r
+import org.w3c.dom.Element;\r
+\r
+class XmlUtilityTest {\r
+\r
+ @Test\r
+ void testConvertDocumentToStringXmlElement() {\r
+\r
+ String xmlStr =\r
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><get-config xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\"><source><running /></source><filter xmlns:ns0=\"urn:ietf:params:xml:ns:netconf:base:1.0\" ns0:type=\"subtree\"><device xmlns=\"urn:onf:otcc:wireless:yang:radio-access-186\"><services><fap-service xmlns=\"urn:onf:otcc:wireless:yang:radio-access\"><index>1</index><cell-config><lte><epc/></lte></cell-config></fap-service></services></device></filter></get-config>";\r
+ try {\r
+ Element el = XmlUtility.convertStringToDocument(xmlStr);\r
+ String result = XmlUtility.convertDocumentToString(el);\r
+ assertTrue(result != null);\r
+ } catch (Exception e) {\r
+ fail("Failed to convert string into document.");\r
+ }\r
+ }\r
+\r
+ @Test\r
+ void testConvertStringToDocument() {\r
+ String xmlStr =\r
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?><rpc-reply xmlns=\"URN\" xmlns:junos=\"URL\"><data/></rpc-reply>";\r
+ try {\r
+ XmlUtility.convertStringToDocument(xmlStr);\r
+ } catch (Exception e) {\r
+ fail("Failed to convert string into document.");\r
+ }\r
+ assertTrue(true);\r
+ }\r
+\r
+}\r